transform-props

Transform @object properties using @propKeys and @transformers. ES5 compatible.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
transform-props
401.0.15 years ago5 years agoMinified + gzip package size for transform-props in KB

Readme

Transform Props
Transform @object properties using @propKeys and @transformers. ES5 compatible.
Installation
$ npm install transform-props
Usage
var transformProps = require('transform-props');

function castToString(arg) {
	return String(arg);
}

var doc = new MongooseModel({ subDoc: { foo: 'bar' }});
var docObj = doc.toObject();

transformProps(docObj, castToString, '_id');

console.log(typeof docObj._id); // 'string'
console.log(typeof docObj.subDoc._id); // 'string'