Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.10.2 to 0.10.3

array/#/@@iterator/implement.js

6

array/#/index.js

@@ -13,2 +13,3 @@ 'use strict';

eLastIndexOf: require('./e-last-index-of'),
entries: require('./entries'),
exclusion: require('./exclusion'),

@@ -23,2 +24,3 @@ fill: require('./fill'),

forEachRight: require('./for-each-right'),
keys: require('./keys'),
group: require('./group'),

@@ -37,3 +39,5 @@ indexesOf: require('./indexes-of'),

splice: require('./splice'),
uniq: require('./uniq')
uniq: require('./uniq'),
values: require('./values')
};
module.exports[require('es6-symbol').iterator] = require('./@@iterator');

50

array/from/shim.js
'use strict';
var isArguments = require('../../function/is-arguments')
, toPosInt = require('../../number/to-pos-integer')
, callable = require('../../object/valid-callable')
, validValue = require('../../object/valid-value')
var iteratorSymbol = require('es6-symbol').iterator
, isArguments = require('../../function/is-arguments')
, toPosInt = require('../../number/to-pos-integer')
, callable = require('../../object/valid-callable')
, validValue = require('../../object/valid-value')
, isString = require('../../string/is-string')

@@ -11,4 +13,4 @@ , isArray = Array.isArray, call = Function.prototype.call;

module.exports = function (arrayLike/*, mapFn, thisArg*/) {
var mapFn = arguments[1], thisArg = arguments[2], Constructor
, i, arr, l, iterator, result;
var mapFn = arguments[1], thisArg = arguments[2], Constructor, i, j, arr, l, char, code, iterator
, result, getIterator;

@@ -19,16 +21,30 @@ arrayLike = Object(validValue(arrayLike));

else Constructor = this;
if (mapFn != null) callable(mapFn);
if (mapFn != null) callable(mapFn);
if ((typeof arrayLike['@@iterator'] === 'function') && !isArray(arrayLike)) {
arr = new Constructor();
iterator = arrayLike['@@iterator']();
result = iterator.next();
i = 0;
while (!result.done) {
arr[i] = mapFn ? call.call(mapFn, thisArg, result.value, i)
: result.value;
if (!isArray(arrayLike)) {
if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {
arr = new Constructor();
iterator = callable(getIterator).call(arrayLike);
result = iterator.next();
++i;
i = 0;
while (!result.done) {
arr[i] = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;
result = iterator.next();
++i;
}
return arr;
}
return arr;
if (isString(arrayLike)) {
l = arrayLike.length;
arr = new Constructor();
for (i = 0, j = 0; i < l; ++i) {
char = arrayLike[i];
if ((i + 1) < l) {
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) char += arrayLike[++i];
}
arr.push(mapFn ? call.call(mapFn, thisArg, char, j++) : char);
}
return arr;
}
}

@@ -35,0 +51,0 @@

{
"name": "es5-ext",
"version": "0.10.2",
"version": "0.10.3",
"description": "ECMAScript 5 extensions and ES6 shims",

@@ -28,12 +28,13 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",

},
"engines": {
"node": ">=0.4"
"dependencies": {
"es6-iterator": "~0.1.1",
"es6-symbol": "0.1.x"
},
"devDependencies": {
"tad": "0.2.x"
},
"scripts": {
"test": "node ./node_modules/tad/bin/tad"
},
"devDependencies": {
"tad": "~0.1.21"
},
"licence": "MIT"
}

@@ -13,10 +13,6 @@ # es5-ext

#### NPM:
$ npm install es5-ext
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
##### Browser:
You easily bundle custom toolkit of your choice, with any CJS bundler, e.g. [modules-webmake](https://github.com/medikoo/modules-webmake)
### Usage

@@ -55,2 +51,3 @@

- `Array.prototype.copyWithin` -> `require('es5-ext/array/#/copy-within')`
- `Array.prototype.entries` -> `require('es5-ext/array/#/entries')`
- `Array.prototype.fill` -> `require('es5-ext/array/#/fill')`

@@ -60,5 +57,8 @@ - `Array.prototype.filter` -> `require('es5-ext/array/#/filter')`

- `Array.prototype.findIndex` -> `require('es5-ext/array/#/find-index')`
- `Array.prototype.keys` -> `require('es5-ext/array/#/keys')`
- `Array.prototype.map` -> `require('es5-ext/array/#/map')`
- `Array.prototype.slice` -> `require('es5-ext/array/#/slice')`
- `Array.prototype.splice` -> `require('es5-ext/array/#/splice')`
- `Array.prototype.values` -> `require('es5-ext/array/#/values')`
- `Array.prototype[@@iterator]` -> `require('es5-ext/array/#/@@iterator')`
- `Math.acosh` -> `require('es5-ext/math/acosh')`

@@ -105,2 +105,3 @@ - `Math.asinh` -> `require('es5-ext/math/asinh')`

- `String.prototype.startsWith` -> `require('es5-ext/string/#/starts-with')`
- `String.prototype[@@iterator]` -> `require('es5-ext/string/#/@@iterator')`

@@ -163,3 +164,3 @@ #### Non ECMAScript standard features

#### from(arrayLike/*, mapFn, thisArg*/) _(es5-ext/array/from)_
#### from(arrayLike[, mapFn[, thisArg]]) _(es5-ext/array/from)_

@@ -230,2 +231,7 @@ [_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from).

#### arr.entries() _(es5-ext/array/#/entries)_
[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.entries).
Returns iterator object, which traverses the array. Each value is represented with an array, where first value is an index and second is corresponding to index value.
#### arr.exclusion([…lists]]) _(es5-ext/array/#/exclusion)_

@@ -290,2 +296,7 @@

#### arr.keys() _(es5-ext/array/#/keys)_
[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.keys).
Returns iterator object, which traverses all array indexes.
#### arr.last() _(es5-ext/array/#/last)_

@@ -304,3 +315,3 @@

#### remove(value[, …valuen]) _(es5-ext/array/#/remove)_
#### arr.remove(value[, …valuen]) _(es5-ext/array/#/remove)_

@@ -331,2 +342,12 @@ Remove values from the array

#### arr.values() _(es5-ext/array/#/values)_
[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.values).
Returns iterator object which traverses all array values.
#### arr[@@iterator] _(es5-ext/array/#/@@iterator)_
[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype-@@iterator).
Returns iterator object which traverses all array values.
### Boolean Constructor extensions

@@ -934,11 +955,11 @@

#### plainReplace(search, replace) _(es5-ext/string/#/plain-replace)_
#### str.plainReplace(search, replace) _(es5-ext/string/#/plain-replace)_
Simple `replace` version. Doesn't support regular expressions. Replaces just first occurrence of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case).
#### plainReplaceAll(search, replace) _(es5-ext/string/#/plain-replace-all)_
#### str.plainReplaceAll(search, replace) _(es5-ext/string/#/plain-replace-all)_
Simple `replace` version. Doesn't support regular expressions. Replaces all occurrences of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case).
#### startsWith(searchString[, position]) _(es5-ext/string/#/starts-with)_
#### str.startsWith(searchString[, position]) _(es5-ext/string/#/starts-with)_

@@ -948,4 +969,9 @@ [_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.startswith).

#### str[@@iterator] _(es5-ext/string/#/@@iterator)_
[_Introduced with ECMAScript 6_](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype-@@iterator).
Returns iterator object which traverses all string characters (with respect to unicode symbols)
### Tests [![Build Status](https://travis-ci.org/medikoo/es5-ext.png)](https://travis-ci.org/medikoo/es5-ext)
$ npm test

@@ -21,1 +21,2 @@ 'use strict';

};
module.exports[require('es6-symbol').iterator] = require('./@@iterator');
'use strict';
exports.Array = [1, 2, 3];
exports.Array = ['1', '2', '3'];
exports.Arguments = (function () {
return arguments;
}(1, 2, 3));
}('1', '2', '3'));
exports.String = "123";

Sorry, the diff of this file is not supported yet

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