【文件属性】:
文件名称:update-array:如果对象 id 与新数组相同,则对数组中的对象进行更改
文件大小:13KB
文件格式:ZIP
更新时间:2021-06-18 10:01:01
JavaScript
阵列更新器
如果对象 id 与新数组相同,则对数组中的对象进行更改。
用法
var updateArray = require ( 'array-updater' ) ;
var original = [
{ id : 1 , val : 'one' } ,
{ id : 2 , val : 'two' } ,
{ id : 3 , val : 'three' } ,
] ;
var newArray = [
{ id : 3 , val : 'new three' } ,
{ id : 1 , val : 'one' } ,
] ;
updateArray ( original , newArray ) ;
// original[0] now points to the old original[2] with the updated `val` field
//
【文件预览】:
update-array-master
----.gitignore(14B)
----package.json(368B)
----webpack.config.js(575B)
----dist()
--------update-array.js(11KB)
--------update-array.min.js(4KB)
----index.js(2KB)
----__tests__()
--------longest-common-substring-tests.js(554B)
--------union-tests.js(851B)
--------update-array-tests.js(6KB)
--------id-diff-tests.js(1000B)
----README.md(575B)
----lib()
--------union.js(403B)
--------id-diff.js(908B)
--------extend.js(286B)
--------longest-common-substring.js(972B)
--------array-diff.js(2KB)