npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

fractal-objects

v0.10.4

Published

Fractal Objects

Downloads

339

Readme

Fractal Objects

npm version Twitter Follow

Installation

Install Fractal Objects to the development dependencies of your project:

# With NPM
npm install --save-dev fractal-objects

# With Yarn
yarn add fractal-objects --dev

Usage

import { fold } from 'fractal-objects';

// Fractal object #1
const part1 = { arrayKey: [1], objectKey: { a: 'a', b: 'b' } };
// Fractal object #2
const part2 = { arrayKey: [2, 3], objectKey: { c: 'c' } };
// Fractal object #3
const part3 = { arrayKey: [4] }

// View multiplication of the fractal objects #1, #2, and #3
console.log(fold([part1, part2, part3]));
// Output:
// { arrayKey: [ 1, 2, 3, 4 ], objectKey: { a: 'a', b: 'b', c: 'c' } }

Concept

A fractal object is an object that has self-similarity at lower scales. Multiplication of two fractal objects results in a new fractal object that has the same shape as the original ones.

If we multiply fractal objects in a list pairwise, we'll receive a new fractal object, which will represent all the fractal objects in the list and which will also have the same shape.

By default, the multiplication function provided by the fractal-objects package multiplies two objects by concatenating their array values, merging object values, and replacing scalars with values from the second multiplied object.

Any other multiplication function can be used if it has the following properties:

  1. It keeps the object shape: The multiplicands and the result must have the same shape and type.
  2. It's associative. For example, multiplying (a b) c must have the same result as multiplying a (b c).
  3. It must yield the result a when multiplying undefined a or a undefined.

In terms of mathematics, fractal objects are a [semigroup].

License

Copyright © 2018 SysGears (Cyprus) Limited. This source code is licensed under the MIT license.