67168843dda5a1972a3a2b0a3e4ebba5 中文文档教程
PropertyMaper
JavaScript 中的模块,用于将对象的属性映射为字符串键的属性作为值
Prerequisites
要安装和运行项目,您需要安装 NodeJS。
https://nodejs.org/en
Installation
npm install 67168843dda5a1972a3a2b0a3e4ebba5
Usage
将对象映射到 json 字符串模板:
.map(map, scope)
参数:map(string) 包含json格式的字符串模板
参数:scope(object) 包含具有要绑定到地图中的数据的对象
返回: 具有地图格式
Example
var pm = require('67168843dda5a1972a3a2b0a3e4ebba5');
var result = pm.map("{
name:data.person.name,
last_name:data.person.last_name,
addres:data.person.addres,
hobbies:data.person.hobbies,
others:data.others.other
}",
{
data: {
person: {
name:"Carlos",
last_name:"Linares",
addres:"Guadalajara",
hobbies:"Play Guitar, Video Games"
},
others: {
other: "Other things, etc."
}
}
}
);
console.log(result);
Result
的映射对象结果将是……
{
name:"Carlos",
last_name:"Linares",
addres:"Guadalajara",
hobbies:"Play Guitar, Video Games",
others:"Other things, etc."
}
License
麻省理工学院许可证
PropertyMaper
Module in JavaScript for map object's properties to string key's properties as values
Prerequisites
To Install and run the project you need to have installed NodeJS.
https://nodejs.org/en
Installation
npm install 67168843dda5a1972a3a2b0a3e4ebba5
Usage
To map an object to a json-string template:
.map(map, scope)
Parameter: map(string) Contains the string template in json format
Parameter: scope(object) Contains the object wich has the data to bind into map
Return: Maped object with map format
Example
var pm = require('67168843dda5a1972a3a2b0a3e4ebba5');
var result = pm.map("{
name:data.person.name,
last_name:data.person.last_name,
addres:data.person.addres,
hobbies:data.person.hobbies,
others:data.others.other
}",
{
data: {
person: {
name:"Carlos",
last_name:"Linares",
addres:"Guadalajara",
hobbies:"Play Guitar, Video Games"
},
others: {
other: "Other things, etc."
}
}
}
);
console.log(result);
Result
The result will be…
{
name:"Carlos",
last_name:"Linares",
addres:"Guadalajara",
hobbies:"Play Guitar, Video Games",
others:"Other things, etc."
}
License
MIT License
更多
你可能也喜欢
- 4u-ui 中文文档教程
- 7-segment-display 中文文档教程
- @0xcert/ethereum-order-gateway-contracts 中文文档教程
- @0xcert/wanchain-value-ledger 中文文档教程
- @0y0/scraper-plugin-google-sheet 中文文档教程
- @1xinternet/editable-webpack-config 中文文档教程
- @1ziton/react-native-share-qr 中文文档教程
- @21kb/react-dom-status-hook 中文文档教程
- @4everland/cluster-cli 中文文档教程
- @4everland/hosting-cli 中文文档教程