New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bound-native-methods

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bound-native-methods

Bound native virtual methods to be used together with ES7 :: bind operator.

latest
Source
npmnpm
Version
0.1.6
Version published
Maintainers
1
Created
Source

Bound 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

$ npm install bound-native-methods

Usage

import * from 'bound-native-methods';

// Or, be more specific and cut down the build size: //

import {assign, keys} from 'bound-native-methods/object';
0::isInteger();
// true
[3, 6, 9]::max()::is(9);
// true
{'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 FormBound Form
Object.getPrototypeOf()::getPrototype()
Object.setPrototypeOf()::setPrototype()

Symbol

Native FormBound Form
Symbol.for()::toSymbol() [1]
Symbol.keyFor()::key()

Number

Native FormBound Form
Number.parseFloat()::toFloat() [1]
Number.parseInt()::toInt() [1]

Math

Native FormBound Form
Math.pow() [2]×
Math.random()×

Date

Native FormBound Form
Date.UTC()×
Date.now()×
Date.parse()::toUnixOffset() [1]

Array

Native FormBound Form
Array.from()×
Array.of()×

ArrayBuffer

JSON

Native FormBound Form
JSON.parse()::toObject() [1]
JSON.stringify()::toJSON() [1]
Notes:
  • 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)
  • Please use the exponentiation operator ** instead

License

MIT © G. Kay Lee

Keywords

virtual method

FAQs

Package last updated on 05 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts