【文件属性】:
文件名称:real-types:将字符串转换为相应的类型
文件大小:6KB
文件格式:ZIP
更新时间:2021-05-03 05:38:16
json normalizer JavaScript
实型
将字符串转换为相应的类型。
最初是作为将表单输入值转换为相应类型的快速方法而编写的。
安装
使用npm安装
npm install real-types
用法
import convert from 'real-types'
const example = {
foo : 'false' ,
bar : [ '1' , '5' , '9' ] ,
next : {
label : 'foo' ,
value : '10'
}
} ;
console . log ( convert ( example ) ) ;
上面的代码将打印:
{
foo: false,
bar: [1,5,9],
next: {
label: 'foo',
value: 10
}
【文件预览】:
real-types-master
----.gitignore(53B)
----.babelrc(84B)
----.eslintrc(560B)
----package.json(2KB)
----src()
--------index.js(2KB)
----webpack.config.js(961B)
----.travis.yml(277B)
----LICENSE(1KB)
----README.md(690B)
----.npmignore(39B)
----test()
--------index.test.js(3KB)