JSPM

transform-props

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1036
  • Score
    100M100P100Q93036F
  • License MIT

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

Package Exports

  • transform-props

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (transform-props) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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'