【文件属性】:
文件名称:groom:节点模块。 JSON.parse(JSON.stringify(myObject)) 并删除所有空值和空字符串
文件大小:4KB
文件格式:ZIP
更新时间:2021-06-05 08:17:44
JavaScript
马夫
执行 JSON.parse(JSON.stringify(myObject)) 并删除所有空值、未定义和空字符串。
var groom = require ( 'groom' ) ;
var o = {
a : 1 ,
b : '' ,
c : null ,
d : undefined ,
e : [
null ,
undefined ,
'test'
] ,
f : new Date ( 0 ) ,
g : / test /
} ;
console . log ( groom ( o ) ) ;
//output:
{
a : 1 ,
e : [ "test" ] ,
f : '1970-01-01T00:00:00.000Z' ,
g : { }
}
日
【文件预览】:
groom-master
----.jshintrc(492B)
----.gitignore(18B)
----package.json(687B)
----.travis.yml(48B)
----index.js(459B)
----.jshintignore(12B)
----README.md(817B)
----.npmignore(47B)
----test()
--------.jshintrc(614B)
--------common.js(56B)
--------jshint.spec.js(26B)
--------mocha.opts(98B)
--------groom.spec.js(434B)