Socket
Socket
Sign inDemoInstall

array.prototype.flatmap

Package Overview
Dependencies
65
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

auto.js

9

CHANGELOG.md

@@ -0,1 +1,10 @@

1.2.0 / 2018-01-18
=================
* [New] add "auto" entry point
* [Fix] Move the receiver length check higher
* [Fix] spec adjustments
* [Refactor] adjust shouldFlatten logic
* [Dev Deps] update `eslint`, `object-inspect`
* [Tests] up to `node` `v9.4`
1.1.1 / 2017-11-29

@@ -2,0 +11,0 @@ =================

28

implementation.js

@@ -8,3 +8,3 @@ 'use strict';

// eslint-disable-next-line max-params
var FlattenIntoArray = function FlattenIntoArray(target, original, source, sourceLen, start, depth) {
var FlattenIntoArray = function FlattenIntoArray(target, source, sourceLen, start, depth) {
var targetIndex = start;

@@ -14,4 +14,4 @@ var sourceIndex = 0;

var mapperFunction;
if (arguments.length > 6) {
mapperFunction = arguments[6];
if (arguments.length > 5) {
mapperFunction = arguments[5];
}

@@ -25,12 +25,14 @@

if (typeof mapperFunction !== 'undefined') {
if (arguments.length <= 7) {
if (arguments.length <= 6) {
throw new TypeError('Assertion failed: thisArg is required when mapperFunction is provided');
}
element = ES.Call(mapperFunction, arguments[7], [element, sourceIndex, original]);
element = ES.Call(mapperFunction, arguments[6], [element, sourceIndex, source]);
}
var spreadable = ES.IsArray(element);
if (spreadable && depth > 0) {
var shouldFlatten = false;
if (depth > 0) {
shouldFlatten = ES.IsArray(element);
}
if (shouldFlatten) {
var elementLen = ES.ToLength(ES.Get(element, 'length'));
var nextIndex = FlattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1);
targetIndex = nextIndex - 1;
targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1);
} else {

@@ -41,4 +43,4 @@ if (targetIndex >= MAX_SAFE_INTEGER) {

ES.CreateDataPropertyOrThrow(target, ES.ToString(targetIndex), element);
targetIndex += 1;
}
targetIndex += 1;
}

@@ -53,2 +55,4 @@ sourceIndex += 1;

var O = ES.ToObject(this);
var sourceLen = ES.ToLength(ES.Get(O, 'length'));
if (!ES.IsCallable(callbackfn)) {

@@ -63,7 +67,5 @@ throw new TypeError('callback must be a function');

var sourceLen = ES.ToLength(ES.Get(O, 'length'));
var A = ES.ArraySpeciesCreate(O, 0);
var nextIndex = FlattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, T);
ES.Set(A, 'length', nextIndex, true);
FlattenIntoArray(A, O, sourceLen, 0, 1, callbackfn, T);
return A;
};
{
"name": "array.prototype.flatmap",
"version": "1.1.1",
"version": "1.2.0",
"author": {

@@ -24,3 +24,4 @@ "name": "Jordan Harband",

"posttest": "npm run --silent security",
"tests-only": "es-shim-api --bound && npm run --silent test:shimmed && npm run --silent test:module",
"pretests-only": "es-shim-api --bound",
"tests-only": "npm run --silent test:shimmed && npm run --silent test:module",
"test:shimmed": "node test/shimmed",

@@ -53,6 +54,6 @@ "test:module": "node test",

"devDependencies": {
"@es-shims/api": "^1.3.0",
"@es-shims/api": "^2.1.2",
"@ljharb/eslint-config": "^12.2.1",
"covert": "^1.1.0",
"eslint": "^4.12.0",
"eslint": "^4.15.0",
"evalmd": "^0.0.17",

@@ -62,3 +63,3 @@ "foreach": "^2.0.5",

"nyc": "^10.3.2",
"object-inspect": "^1.4.0",
"object-inspect": "^1.5.0",
"safe-publish-latest": "^1.1.1",

@@ -65,0 +66,0 @@ "tape": "^4.8.0"

Sorry, the diff of this file is not supported yet

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