【文件属性】:
文件名称:nested-prop:获取和设置嵌套属性
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-14 00:42:09
JavaScript
嵌套道具
获取和设置嵌套属性。
安装
$ npm install --save nested-prop
用法
var nestedProp = require ( 'nested-prop' ) ;
var obj = { a : '' } ;
nestedProp . set ( obj , 'a.b.c' , 1 ) ;
//=> {a: {b: {c: 1}}}
nestedProp . get ( obj , 'a.b.c' ) ;
//=> 1
应用程序接口
NestedProp.get(对象,路径)
按路径从对象获取属性。
NestedProp.set(对象,路径,值)
按路径将值设置为属性。 如果某些属性不是可分配的对象(如string ) - 它们将被覆盖。
执照
麻省理工学院 :copyright:
【文件预览】:
nested-prop-master
----.jshintrc(170B)
----.gitignore(13B)
----package.json(568B)
----.travis.yml(72B)
----index.js(826B)
----test.js(1KB)
----license(1KB)
----readme.md(730B)
----.gitattributes(12B)
----.editorconfig(231B)