Bound native virtual methods to be used together with ES7 :: bind operator.
npm install bound-native-methodsBound Native Methods
====================
This library exports a collection of bound native virtual methods - static methods of JavaScript standard built-in objects in their bound form - so that they can be used together with the proposed bind operator.
Install
-------
``bash`
$ npm install bound-native-methods
Usage
-----
`javascript
import * from 'bound-native-methods';
// Or, be more specific and cut down the build size: //
import {assign, keys} from 'bound-native-methods/object';
`
`javascript`
0::isInteger();
// true
`javascript`
[3, 6, 9]::max()::is(9);
// true
`javascript`
{'2015-06-01T15:30:00.000Z': 300}::assign({'2015-07-01T15:30:00.000Z': 42})
::keys()
.map(x => x::toUnixOffset())
::toJSON();
// [1433172600000,1435764600000]
API
---
Most static methods have been exported as is, but a few have been renamed or excluded to better fit the context:
#### Object
| Native Form | Bound Form |
| ----------- | ---------- |
| Object.getPrototypeOf() | ::getPrototype() |
| Object.setPrototypeOf() | ::setPrototype() |
#### Symbol
| Native Form | Bound Form |
| ----------- | ---------- |
| Symbol.for() | ::toSymbol() [1] |
| Symbol.keyFor() | ::key() |
#### Number
| Native Form | Bound Form |
| ----------- | ---------- |
| Number.parseFloat() | ::toFloat() [1] |
| Number.parseInt() | ::toInt() [1] |
#### Math
| Native Form | Bound Form |
| ----------- | ---------- |
| Math.pow() [2] | × |
| Math.random() | × |
#### Date
| Native Form | Bound Form |
| ----------- | ---------- |
| Date.UTC() | × |
| Date.now() | × |
| Date.parse() | ::toUnixOffset() [1] |
#### Array
| Native Form | Bound Form |
| ----------- | ---------- |
| Array.from() | × |
| Array.of() | × |
#### ArrayBuffer
#### JSON
| Native Form | Bound Form |
| ----------- | ---------- |
| JSON.parse() | ::toObject() [1] |
| JSON.stringify() | ::toJSON() [1] |
> ###### Notes:
> 1. Bound methods whose names start with "to..." are to be applied to strings (with the exception of ::toJSON() which can be applied to a variety of data types)**` instead
> 2. Please use the exponentiation operator
License
-------
MIT © G. Kay Lee