Catalog npm
PACKAGE EXPLORERView in registry

1tree-factory

npm

Factory that facilitates creating 1tree instances

1treetree
Versions collected16
Direct dependencies4From release 0.1.15
Last observed20 Oct, 18:39 UTC

README

Current package documentation

1tree-factory

Basically just a thin facade over 1tree to make the use case of creating a new 1tree instance easier when you have your own adapter/plugins etc.

1tree exports a default tree that's ready to start using provided that you want to use 1tree's default underlying data structures, and also exposes some methods for creating trees that use your own adapter and/or plugins.

Most people just want to start using a tree, 1tree's default export assumes this.

However, if you want to use your own adapter, or use your own plugins but also use 1tree's base plugins, there's a bit of fiddling around. It's not difficult but doing it often gets old fast.

This module also inserts the plugins specified before 1tree's base plugins - this is to ensure that the various 1tree plugins that do things like wrap other plugins or extend them in some way will play nicely with your plugins. If you want to add your plugins after the base plugins have been added, you can always call the plugin method on the tree instance.

usage

/*
  we use the name Mtree (mojule tree) internally but the npm package name was
  taken
*/
const Mtree = require( '1tree-factory' )

/*
 create a tree using the default adapter but with some extra plugins that are
 added before the base plugins
*/
const tree1 = Mtree( plugin1, plugin2, plugin3 )

// same, but array instead of multiple args
const tree2 = Mtree( [ plugin1, plugin2, plugin3 ] )

// same, but with a custom adapter
const tree3 = Mtree( adapter, plugin1, plugin2, plugin3 )

// pass a boolean with true to exclude the base plugins
const tree4 = Mtree( plugin1, plugin2, plugin3, true )
const tree5 = Mtree( adapter, plugin1, plugin2, plugin3, true )

// add plugins after the fact, for example to wrap or extend existing plugins
tree5.plugin( plugin4 )

// same as just using 1tree
const tree6 = Mtree()

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 16

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.15Registry latest9 Mar 20174
0.1.1416 Feb 20174
0.1.138 Feb 20174
0.1.127 Feb 20174
0.1.1125 Jan 20174
0.1.1025 Jan 20174
0.1.925 Jan 20174
0.1.825 Jan 20174
0.1.720 Jan 20174
0.1.620 Jan 20174
0.1.520 Jan 20174
0.1.418 Jan 20174
0.1.317 Jan 20174
0.1.213 Dec 20164
0.1.11 Dec 20164
0.1.01 Dec 20164

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
mojule/1tree-factory

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:39 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:feecf59805acc6b822bf12d7ebbf7547ee8a4fcaa1f46c56dc04ca7080e6800f