0.10.1 • Published 7 years ago

blood v0.10.1

Weekly downloads
33
License
MIT
Repository
github
Last release
7 years ago

blood

JavaScript object life

npm install blood --save

API

Creation

  • blood.child(parent) create object that inherits parent (emulates Object.create)
  • blood.create(parent) alias for blood.child(parent)
  • blood.orphan() emulates Object.create(null)
  • blood.twin(object) create twin object
  • blood.combine(keys, values) create object from corresponding keys and values arrays
  • blood.pair(pairs) create object from pairs
  • blood.invert(object) create new object by inverting keys and values

Mutation

  • blood.assign(to, ...from) emulates ES6 Object.assign
  • blood.adopt(...from) assign to this
  • blood.foster(child, parent) force child to have a new parent (ES6+)

Reflection

  • blood.has(object, key) test if object owns key
  • blood.parent(object) emulates Object.getPrototypeOf
  • blood.parents(object) get array of parents (up the prototype chain)
  • blood.chain(object) equals [object].concat(blood.parents(object))
  • blood.keys(object) emulates Object.keys
  • blood.names(object) emulates Object.getOwnPropertyNames
  • blood.values(object) get array of own enumerable values
  • blood.methods(object) get array of own enumerable functions
  • blood.enums(object) get array of all enumerable values
  • blood.pairs(object) get array of [key, value] pairs

Developers

npm install
npm test

Compatibility

Works in Node.js and modern browsers (ES5+ except where noted ES6+)

Fund

Fund opensource development =)

Playground

Try blood in your browser

0.10.1

7 years ago

0.10.0

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.0

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.1

10 years ago

0.6.0

11 years ago

0.5.5

11 years ago

0.5.4

11 years ago

0.5.2

11 years ago

0.5.1

11 years ago

0.5.0

11 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.4

11 years ago

0.1.0

11 years ago