New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

d2-utilizr

Package Overview
Dependencies
Maintainers
7
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d2-utilizr - npm Package Compare versions

Comparing version 0.2.15 to 0.2.16

26

lib/arrayRepeat.js

@@ -7,2 +7,5 @@ 'use strict';

exports.default = arrayRepeat;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
/**

@@ -29,2 +32,3 @@ *

if (typeof array === 'undefined') {

@@ -34,11 +38,21 @@ throw 'Cannot repeat array of type undefined';

var newArray = [];
if (byIndex) {
return [].concat.apply([], array.map(function (item, i) {
return Array(n).fill(array[i]);
}));
for (var i = 0; i < array.length; i++) {
for (var j = 0; j < n; j++) {
newArray.push(array[i]);
}
}
return newArray;
}
return [].concat.apply([], Array.apply(null, Array(n)).map(function () {
return array;
}));
for (var _i = 0; _i < n; _i++) {
newArray.push.apply(newArray, _toConsumableArray(array));
}
return newArray;
};
//# sourceMappingURL=arrayRepeat.js.map
{
"name": "d2-utilizr",
"version": "0.2.15",
"version": "0.2.16",
"description": "d2-utilizr",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -19,2 +19,3 @@ /**

export default function arrayRepeat(array, n=1, byIndex=false) {
if (typeof array === 'undefined') {

@@ -24,7 +25,21 @@ throw `Cannot repeat array of type undefined`;

let newArray = [];
if (byIndex) {
return [].concat.apply([], array.map((item, i) => Array(n).fill(array[i])));
for (let i=0; i<array.length; i++) {
for (let j = 0; j < n; j++) {
newArray.push(array[i]);
}
}
return newArray
}
return [].concat.apply([], Array.apply(null, Array(n)).map(() => array));
for (let i=0; i<n; i++) {
newArray.push(...array);
}
return newArray
};

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