Socket
Socket
Sign inDemoInstall

es5-ext

Package Overview
Dependencies
0
Maintainers
0
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    es5-ext

ECMAScript5 extensions


Version published
Weekly downloads
7.6M
decreased by-21.3%
Maintainers
0
Install size
28.4 kB
Created
Weekly downloads
 

Package description

What is es5-ext?

The es5-ext package is a collection of ECMAScript 5 extensions. It provides polyfills for some of the newer ECMAScript features, as well as additional utility functions that enhance the JavaScript standard library.

What are es5-ext's main functionalities?

Array polyfills and extensions

Adds new methods to the Array prototype, such as 'contains', which checks if an array includes a certain element.

[1, 2, 3].contains(2)

Object polyfills and extensions

Introduces new functions to work with objects, like 'isObject', which determines if a value is an object.

Object.isObject({})

String polyfills and extensions

Provides additional methods for strings, for instance, 'startsWith', which checks if a string starts with the specified characters.

'hello'.startsWith('he')

Function polyfills and extensions

Enhances functions with extra capabilities such as 'noop', which is an empty function that does nothing.

(function () {}).noop()

Number polyfills and extensions

Offers new properties and methods for numbers, like 'isFinite', which checks if a value is a finite number.

Number.isFinite(Infinity)

Other packages similar to es5-ext

Readme

Source

es5-ext - ECMAScript5 extensions

Useful functions and objects that are not part of the standard.
It's work in progress, new methods are added when needed.

Installation

Can be used in any environment that implements ES5.
In implementations that are stuck to ES3 it will work with es5-shim.

To use it with node:

$ npm install es5-ext

Usage

Recommended way is to require stuff you need individually:

var sequence = require('es5-ext/lib/Function/sequence')
  , merge = require('es5-ext/lib/Object/merge').call;

sequence(...);
merge(...);

but you can grab whole packs:

var fnExt = require('es5-ext/lib/Function');

fnExt.curry(...);
fnExt.sequence(...);

and if you prefer take them all:

var ext = require('es5-ext');

ext.Function.curry(...);
ext.Function.sequence(...);
ext.Object.merge.call(...);

Extensions

For documentation look into source files.

  • global
  • reserved
Function

Many of the following are inspired by http://osteele.com/sources/javascript/functional/

  • Function.bind(f)
  • Function.call(f)
  • Function.curry(f[, ...])
  • Function.dscope(f, scope)
  • Function.flip(f)
  • Function.functionalize(f)
  • Function.inherit(f, g)
  • Function.invoke(methodName[, ...])
  • Function.isFunction(x)
  • Function.k(x)
  • Function.s(f, g)
  • Function.sequence(f[, ...])
List

Extensions for Array-like objects

  • List.slice([begin[, end]])
  • List.toArray()
Object
  • Object.bindMethods([p])
  • Object.elevate([p])
  • Object.extend(o)
  • Object.isObject(x)
  • Object.isPlainObject()
  • Object.link(p)
  • Object.merge(p)
  • Object.pluck(name)
  • Object.set()
  • Object.setTrue()
  • Object.setValue(value)
  • Object.values()

Tests

When using node & npm

$ make test

Tests with coverage report:

$ make test-cov

Keywords

FAQs

Last updated on 28 May 2011

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc