upsert:将对象插入或更新数组中的对象

时间:2021-06-21 11:22:09
【文件属性】:
文件名称:upsert:将对象插入或更新数组中的对象
文件大小:2KB
文件格式:ZIP
更新时间:2021-06-21 11:22:09
JavaScript 向上插入 用法 获取一个数组并通过更新与谓词匹配的对象或插入新对象来修改它: upsert(array, test, object) var upsert = require ( 'upsert' ) upsert ( arrayOfPeople , function ( person ) { return 'goodall' === person . name ; } , { name : 'dr goodall' , degree : 'doctorate' } ) ; 如果test对array任何内容都没有返回 true ,则object将被推送到array 。 如果test匹配array中的某些内容,则object将扩展到匹配的内容。 如果有多个匹配项,则只修改第一个匹配项。 传入的
【文件预览】:
upsert-master
----.gitignore(23B)
----package.json(549B)
----.travis.yml(97B)
----index.js(327B)
----README.md(1017B)
----test()
--------index.js(882B)

网友评论