find-replace
Advanced tools
Comparing version 1.0.3 to 2.0.0
'use strict' | ||
var arrayify = require('array-back') | ||
var testValue = require('test-value') | ||
const arrayify = require('array-back') | ||
const testValue = require('test-value') | ||
@@ -34,9 +34,9 @@ /** | ||
function findReplace (array, valueTest) { | ||
var found = [] | ||
var replaceWiths = arrayify(arguments) | ||
const found = [] | ||
const replaceWiths = arrayify(arguments) | ||
replaceWiths.splice(0, 2) | ||
arrayify(array).forEach(function (value, index) { | ||
var expanded = [] | ||
replaceWiths.forEach(function (replaceWith) { | ||
arrayify(array).forEach((value, index) => { | ||
let expanded = [] | ||
replaceWiths.forEach(replaceWith => { | ||
if (typeof replaceWith === 'function') { | ||
@@ -57,4 +57,4 @@ expanded = expanded.concat(replaceWith(value)) | ||
found.reverse().forEach(function (item) { | ||
var spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue) | ||
found.reverse().forEach(item => { | ||
const spliceArgs = [ item.index, 1 ].concat(item.replaceWithValue) | ||
array.splice.apply(array, spliceArgs) | ||
@@ -61,0 +61,0 @@ }) |
{ | ||
"name": "find-replace", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "1.0.3", | ||
"version": "2.0.0", | ||
"description": "Find and either replace or remove items from an array", | ||
@@ -24,9 +24,9 @@ "repository": "https://github.com/75lb/find-replace.git", | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^2.0.1", | ||
"test-runner": "^0.3.0" | ||
"jsdoc-to-markdown": "^3.0.2", | ||
"test-runner": "^0.4.1" | ||
}, | ||
"dependencies": { | ||
"array-back": "^1.0.4", | ||
"array-back": "^2.0.0", | ||
"test-value": "^2.1.0" | ||
} | ||
} |
@@ -42,2 +42,2 @@ [![view on npm](http://img.shields.io/npm/v/find-replace.svg)](https://www.npmjs.org/package/find-replace) | ||
© 2015-17 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). | ||
© 2015-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7140
7
+ Addedarray-back@2.0.0(transitive)
Updatedarray-back@^2.0.0