oef/node_modules/ext
2019-11-04 15:00:46 +01:00
..
function First commit 2019-11-04 15:00:46 +01:00
global-this First commit 2019-11-04 15:00:46 +01:00
node_modules/type First commit 2019-11-04 15:00:46 +01:00
object/entries First commit 2019-11-04 15:00:46 +01:00
test First commit 2019-11-04 15:00:46 +01:00
thenable_ First commit 2019-11-04 15:00:46 +01:00
.editorconfig First commit 2019-11-04 15:00:46 +01:00
CHANGELOG.md First commit 2019-11-04 15:00:46 +01:00
LICENSE First commit 2019-11-04 15:00:46 +01:00
package.json First commit 2019-11-04 15:00:46 +01:00
README.md First commit 2019-11-04 15:00:46 +01:00

ext

(Previously known as es5-ext)

JavaScript standard extensions (with respect to evolving standard)

Non-standard or soon to be standard language utilities in a future proof, non-invasive form.

Doesn't enforce transpilation step. Where it's applicable utilities/extensions are safe to use in all ES3+ implementations.

Installation

npm install ext

Utilities

Global

globalThis (ext/global-this)

Returns global object. Resolve native globalThis if implemented, otherwise fallback to internal resolution of a global object.

const globalThis = require("ext/global-this");

globalThis.Array === Array; // true

Object

Object.entries (ext/object/entries)

Object.entries implementation.

Returns native Object.entries if it's implemented, otherwise library implementation is returned

const entries = require("ext/object/entries");

entries({ foo: "bar" }); // [["foo", "bar"]]

Function

Function.identity (ext/function/identity)

Returns input argument.

const identity = require("ext/function/identity");

identity("foo"); // "foo"

Thenable.prototype

thenable.finally (ext/thenable_/finally)

finally method for any thenable input

const finally = require("ext/thenable_/finally");

finally.call(thenable, () => console.log("Thenable resolved"));