create-object
Portable Object.create that is not a shim and drops the verbose property descriptor syntax.
npm install create-object --save
You can also use Duo, Bower or download the files manually.
npm stats
API Example
Create
var create = var point = point//=> {} point//=> [ -0.127758, 51.507351 ]
Create with properties
var create = var geo = geo//=> { coordinates: [ -0.127758, 51.507351 ] }
Features
- True prototypal inheritance.
- Your code does not need to bother with constructors or the
new
keyword. - Fields and methods on the prototype are non-enumerable.
- Works in all JS engines (including old IEs like IE8).
Anti-Features
- Does not shim/sham
Object.create
. - Ignores verbose ES5 property descriptor syntax.
API
create(prototype)
arguments
prototype: (Object)
The object which should be the prototype of the newly-created object.properties: (Object)
Key-values which should be copied to the newly-created object.
returns
(Object)
New object with the specified prototype object including any copied properties.
Reference
Alternatives
Contributing
SEE: contributing.md