1.0.0 • Published 9 years ago
6b2f7cba85b3b7129e74b5db7b1a23df v1.0.0
DataBind
Module used for data binding between a javascript object (provider) and a string (consumer), saves the synchronized data into a new object.
Installation
$ npm install 6b2f7cba85b3b7129e74b5db7b1a23df --savefunction dataBind(map, scope)
Params
- (string)
map: The string template, a valid javascript object - (object)
scope: The data object
Returns
Objectwith same format asmapparameter orfalseif an error occursfalseif a property is not defined in thescopeobject and themapstring requires it or if themapstring has an incorrect syntax
Example:
var dataBind = require('6b2f7cba85b3b7129e74b5db7b1a23df')
var map = '{Data: {property1: data.prop}, Other: {propertyN: other.data} }'
var scope = {
'data': {
'prop': 'VALUE 1'
},
'other': {
'data': 'VALUE 2'
}
}
var result = dataBind(map, scope)The result variable will contain
{
"Data": {
"property1": "VALUE 1"
},
"Other": {
"propertyN": "VALUE 2"
}
}Other info
Publish package, runs test tasks when the code changes
$ gulpUnit tests and code coverage tasks
$ gulp test1.0.0
9 years ago