promise-get

1.0.0 • Public • Published

promise-get

Build status NPM version js-xo-style

Get a property from the object a promise resolves to, using a dot path

Installation

Install promise-get using npm:

npm install --save promise-get

Usage

Module usage

var get = require('promise-get');
 
get('key.deep', Promise.resolve({key: {deep: 'hello'}}))
  .then(function (val) {
    // val === 'hello'
  });

API

get(property, promise)

Name Type Description
property String A dot path to get value from resolved promise
promise Promise The promise which resolves to the object you want a property from

Returns: Promise, which resolves to the property found in promise's resolved object.

Related

License

MIT © Joakim Carlstein

Package Sidebar

Install

npm i promise-get

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • joakimbeng