Socket
Socket
Sign inDemoInstall

es5-ext

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es5-ext - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

4

package.json
{
"name": "es5-ext",
"version": "0.6.2",
"version": "0.6.3",
"description": "ECMAScript5 extensions",

@@ -14,3 +14,3 @@ "keywords": ["ecmascript", "ecmascript5", "es5", "extensions", "addons", "extras", "javascript"],

"mail": "medikoo+es5-ext@medikoo.com",
"web": "https://github.com/medikoo/es5-ext/issues"
"url": "https://github.com/medikoo/es5-ext/issues"
},

@@ -17,0 +17,0 @@ "engines": {

# 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._
Useful methods, functions and objects that are not part of the standard.

@@ -9,3 +8,3 @@ ## Installation

Can be used in any environment that implements EcmaScript 5th edition.
To make it work with EcmaScript 3, apply [es5-shim](https://github.com/kriskowal/es5-shim).
Many extensions will also work with ECMAScript 3rd edition, if they're not let [es5-shim](https://github.com/kriskowal/es5-shim) be your aid.

@@ -16,126 +15,164 @@ To use it with node:

For browser, you can easily create custom toolset with help of
[modules-webmake](https://github.com/medikoo/modules-webmake)
## Usage
Recommended way is to require stuff you need individually:
All utitlities are written with ES5 conventions in mind. It means we mainly deal
with methods (not functions) which can directly be
assigned to any ES native object's prototype, e.g.:
var sequence = require('es5-ext/lib/Function/sequence')
, merge = require('es5-ext/lib/Object/merge').call;
Function.prototype.curry = require('es5-ext/lib/Function/prototype/curry');
Array.prototype.flatten = require('es5-ext/lib/Array/prototype/flatten');
String.prototype.startsWith = require('es5-ext/lib/String/prototype/starts-with');
sequence(...);
merge(...);
However __in general extending prototypes of native objects is discouraged__, I'd say __it's ok only if you own the context__ (see [extending-javascript-natives](http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/) for more views on that matter).
but you can grab whole packs:
So when you don't want to extend native prototypes,
you can use methods as functions:
var fnExt = require('es5-ext/lib/Function');
var util = {};
var call = Function.prototype.call;
fnExt.curry(...);
fnExt.sequence(...);
util.curry = call.bind(require('es5-ext/lib/Function/prototype/curry'));
util.flatten = call.bind(require('es5-ext/lib/Array/prototype/flatten'));
util.startsWith = call.bind(require('es5-ext/lib/String/prototype/starts-with'));
and if you prefer take them all:
### API
var ext = require('es5-ext');
ext.Function.curry(...);
ext.Function.sequence(...);
ext.Object.merge.call(...);
### Extensions
_Each extension is documented at begin of its source file._
* `assertNotNull(arg)`
* `getNextIdGenerator([prefix[, postfix]])`
* `global`
* `guid()`
* `isPrimitive(arg)`
* `reserved`
* `toObject(arg)`
#### Array
Extensions for Array that can be used only on Array instances, these are mainly extensions that modify Array object in-place. For more generic extensions see List section.
* `Array.generate(length, fill0[, fill1[, ...]])`
* `Array.clone()`
* `Array.compact()`
#### Array.prototype
Same as with standarized ES methods, following methods are generic and can be
called on any object.
* `Array.prototype.bsearchClosest(compareFn)`
* `Array.prototype.clear()`
* `Array.prototype.commonLeft(list0[, list1[, ...]])`
* `Array.prototype.compact()`
* `Array.prototype.contains(searchElement)`
* `Array.prototype.copy()`
* `Array.prototype.diff(other)`
* `Array.prototype.exclusion(list0[, list1[, ...]])`
* `Array.prototype.find(query[, thisArg])`
* `Array.prototype.first()`
* `Array.prototype.flatten()`
* `Array.prototype.forEachRight(cb[, thisArg])`
* `Array.prototype.group(cb[, thisArg])`
* `Array.prototype.indexesOf(searchElement[, fromIndex])`
* `Array.prototype.intersection(list0[, list1[, ...]])`
* `Array.prototype.peek()`
* `Array.prototype.remove(value)`
* `Array.prototype.someRight(cb[, thisArg])`
* `Array.prototype.someValue(cb[, thisArg])`
* `Array.prototype.uniq()`
#### Boolean
* `Boolean.isBoolean(arg)`
#### Date
* `Date.clone()`
* `Date.duration(to)`
* `Date.format()`
* `Date.monthDaysCount()`
* `Date.getFormat(pattern)`
* `Date.isDate(arg)`
##### Day
#### Date.prototype
* `Date.day.floor()`
* `Date.prototype.copy(date)`
* `Date.prototype.duration(to)`
* `Date.prototype.floorDay()`
* `Date.prototype.floorMonth()`
* `Date.prototype.floorYear()`
* `Date.prototype.monthDaysCount()`
##### Month
#### Error
* `Date.month.floor()`
* `Error.isError(arg)`
##### Year
##### Error.prototype
* `Date.year.floor()`
* `Error.prototype.throw()`
#### Function
Many of the following are inspired by
http://osteele.com/sources/javascript/functional/
* `Function.applyBind(f)`
* `Function.aritize(n)`
* `Function.bindBind(f)`
* `Function.cache()`
* `Function.callBind(f)`
* `Function.clone()`
* `Function.curry([...])`
* `Function.dscope(scope)`
* `Function.flip()`
* `Function.functionalize(f)`
* `Function.getApplyArg(f)`
* `Function.hold([n, ...])`
* `Function.i(x)`
* `Function.invoke(methodName[, ...])`
* `Function.isFunction(x)`
* `Function.k(x)`
* `Function.lock([...])`
* `Function.log(log)`
* `Function.ncurry(n[, ...])`
* `Function.arguments([arg0[, arg1[, ...]])`
* `Function.context()`
* `Function.i(arg)`
* `Function.insert(name, value)`
* `Function.invoke(name[, arg0[, arg1[, ...]]])`
* `Function.isArguments(arg)`
* `Function.isFunction(arg)`
* `Function.k(arg)`
* `Function.memoize(fn[, length[, resolvers]])`
* `Function.noop()`
* `Function.pluck(name)`
* `Function.rcurry([...])`
* `Function.rncurry(n[, ...])`
* `Function.s(f)`
* `Function.sequence([...])`
* `Function.remove(name)`
#### List
#### Function.prototype
Extensions for Array-like objects.
* `Function.prototype.aritize(n)`
* `Function.prototype.chain(fn0[, fn1[, ...]])`
* `Function.prototype.curry([arg0[, arg1[, ...])`
* `Function.prototype.flip()`
* `Function.prototype.hold([n[, arg0[, arg1[, ...]]]])`
* `Function.prototype.lock([arg0[, arg1[, ...])`
* `Function.prototype.log(log)`
* `Function.prototype.match()`
* `Function.prototype.ncurry([n[, arg0[, arg1[, ...]])`
* `Function.prototype.not()`
* `Function.prototype.rcurry([arg0[, arg1[, ...])`
* `Function.prototype.rncurry([n[, arg0[, arg1[, ...]])`
* `Function.prototype.s(fn)`
* `Function.prototype.silent([arg0[, arg1[, ...])`
* `List.compact()`
* `List.concat([...])`
* `List.every(f[, o])`
* `List.filter(f[, o])`
* `List.findSameStartLength(l[, ...])`
* `List.flatten()`
* `List.forEach(f[, o])`
* `List.isListObject(x)`
* `List.isList(x)`
* `List.map(f[, o])`
* `List.peek()`
* `List.reduce(f[, x])`
* `List.shiftSame(l[, ...])`
* `List.slice([start[, end]])`
* `List.some(f[, o])`
* `List.toArray()`
#### Number
##### List.sort
* `Number.getAutoincrement(start, step)`
* `Number.getPad(length[, precision])`
* `Number.isNumber(arg)`
Functions for sorting list objects
#### Number.prototype
* `List.sort.length(l1, l2)`
* `Number.prototype.isLessOrEqual(n)`
* `Number.prototype.isLess(n)`
* `Number.prototype.subtract(n)`
#### Number
#### Object
* `Number.pad(precision)`
* `Object.assertCallable(arg)`
* `Object.getCompareBy(name)`
* `Object.getSet(value)`
* `Object.isCallable(arg)`
* `Object.isList(arg)`
* `Object.isObject(arg)`
* `Object.isPlainObject(arg)`
#### Object
##### Object.descriptors
Following takes into account all ES5 goodies (not enumerable properties, descriptors). For more tradtional ES3 like stuff see Object.plain below
Shortcuts for building descriptors
* `Object.descriptors.c(valueOrGet[, set])`
* `Object.descriptors.ce(valueOrGet[, set])`
* `Object.descriptors.cew(value)`
* `Object.descriptors.cw(value)`
* `Object.descriptors.e(valueOrGet[, set])`
* `Object.descriptors.ew(value)`
* `Object.descriptors.v(valueOrGet[, set])`
* `Object.descriptors.w()`
#### Object.prototype
* `Object.bindMethods([p[, q]])`

@@ -142,0 +179,0 @@ * `Object.every(f[, p])`

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc