cader
Facade your cascade.
npm install cader
const cader = const cade = cade
API
.save(mapping)
- Save
mapping
to the instance @param {Object} mapping
@return this
for chaining
const cade = cade cade // border-box m0 p0 border-nonecade // clearfix relativecade // border-box m0 p0 border-none clearfix relativecade // border-box m0 p0 border-none another
.fuse(atoms)
- fuse atoms into string
atoms
is a space-separated string of saved atoms only- throws error if attempting to fuse unsaved atoms
@return string
const cade = cade cade // border-box m0 p0 border-none w-100vw h-100vh
.bond(atoms)
- bond atoms into string
atoms
is a space-separated string of saved atoms or foreign particles- foreign particles are included as is
@return string
const cade = cade cade // border-box m0 p0 border-none w-100vw h-100vh p2
.freeze()
- freeze mapping to prevent new atoms from being saved
- facilitates immutability
@return this
for chaining
const cade = cadecade // throws Error
.clone()
- clone instance
- useful for extending frozen instances without mutating them
@return
new instance with cloned mapping
const library = library // save library atoms and then freeze exportconst feature = library // new instance has access to atoms from libraryfeature // can save more atoms if unique from library atoms
.pair(mate)
- pair instance with another instance
- shortcut for
.clone().save(mate.port())
- will
throw
if there are conflicts @return
clone containing atoms from both
const shape = const paint = /* ... */const super = shape
.port()
- get serializable object representing atom mapping
- mainly for internal use or inspection
@return
serializable plain object
.help()
- log helpful info about an instance including atom mapping and methods
- useful for inspection, debugging, learning
@return this
for chaining
Compatibility
- ES5+
- CommonJS
- Node
- Web via
webpack
|rollup
|browserify