taxonify

2.2.0 • Public • Published

taxonify

Categorize your stuff

Quick start

You need some categories, define them like this:

function relationships (define) {
  define('automobile', ['car', 'truck'])
  define('car', ['camry', 'accord'])
  define('truck', ['ridgeline', 'tacoma'])
  define('honda', ['accord', 'ridgeline'])
  define('toyota', ['camry', 'tacoma'])
}

Now hand the relationships function to taxonify

import { taxonify } from 'taxonify'
 
const { createVerifier, brand } = taxonify(relationships)

Make a verifier function (or two)

const isTruck = createVerifier('truck')
const isHonda = createVerifier('honda')

Brand an object with one of your categories

const myAccord = brand({ color: red, sunroof: true }, 'accord')

And you're ready to verify your object

isTruck(myAccord) // false
isHonda(myAccord) // true

Package Sidebar

Install

npm i taxonify

Weekly Downloads

0

Version

2.2.0

License

ISC

Unpacked Size

10.3 kB

Total Files

15

Last publish

Collaborators

  • dlmanning