es5-extend
Simple helper for extending native or other objects with es5-ext functions
Installation
es5-extend does not bundle es5-ext package itself so you need to do it manually
npm install es5-ext
npm install es5-extend
Usage
Extending all native objects (for given context)
extend([methods [, customDescriptor] ])
- context - global object with native objects
- methods - array of methods to insert into native object
- customDescriptor - custom options for property descriptor
Extending specific object
extend.array([nativeObject [, methods [, customDescriptor ] ] ]);
extend.boolean([nativeObject [, methods [, customDescriptor ] ] ]);
extend.date([nativeObject [, methods [, customDescriptor ] ] ]);
extend.error([nativeObject [, methods [, customDescriptor ] ] ]);
extend.function([nativeObject [, methods [, customDescriptor ] ] ]);
extend.math([nativeObject [, methods [, customDescriptor ] ] ]);
extend.number([nativeObject [, methods [, customDescriptor ] ] ]);
extend.object([nativeObject [, methods [, customDescriptor ] ] ]);
extend.regExp([nativeObject [, methods [, customDescriptor ] ] ]);
extend.string([nativeObject [, methods [, customDescriptor ] ] ]);
- nativeObject - object to extend
- methods - array of methods to insert into native object
- customDescriptor - custom options for property descriptor
Extending all native objects with all methods in es5-ext
Please use it wisely.
// for node.js; // for browser;
Extending native objects with subset of methods
; 'pluck' in globalFunction; // true'contains' in Stringprototype; // true'contains' in Arrayprototype; // true
Extending specific native object
;// same as; 'contains' in Arrayprototype; // true'contains' in Stringprototype; //
Extending specific native object with subset of methods
; 'pluck' in Function; // true
Extending specific non-native object
var { // ...};CustomKlazzprototype = ;extend; 'keys' in Arrayprototype; // false'keys' in CustomKlazzprototype; // true
Extending specific native object with custom property descriptor