JSPM

pull-prop

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q16503F

Select a property and replace inside an object

Package Exports

  • pull-prop

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 (pull-prop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pull-prop

Map an object's property with a stream

pull(
  values([
    { foo: { bar: 123 } },
    { foo: { bar: 321 } },
    { foo: { bar: 333 } }
  ]),
  prop('foo.bar', () => pull(
    map(bar => bar * 3)
  ))
  drain(obj => {
    // ...
  })
)

Install

npm install --save pull-property

# with yarn
yarn add pull-property

Usage

prop(name, transform)

A through stream that takes and gives objects, replacing a certain property on them.

  • name: The property you are mapping (resolved by object-path)
  • transform: A function that returns a through stream, which maps the property

An psuedo example with pull-files:

pull(
  read('lib/**/*.js'),
  // Map `data` with buf -> buf streams:
  prop('data', () => pull(
    map(babel.transformSync),
    map(uglify.compileSync),
    // ...
  )),
  write('out', err => {
    if (err) throw err
  })
)

Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)