JSPM

lazy-resolver

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 465
  • Score
    100M100P100Q95730F
  • License MIT

Skip hoops with promises Edit

Package Exports

  • lazy-resolver

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

Readme

lazy-resolver

Skip hoops with promises

npm install lazy-resolver

Example:

const resolve = require('lazy-resolver') // This is a Proxy handler
const fetch = require('node-fetch')
const utils = {fetch}

resolve(utils) // this will chain a noop function until you call then()
  .fetch('https://httpbin.org/get?items=4&items=2') // promise
  .json() // promise
  .args
  .items
  .map(n => ~~n * 4)
  .then(console.log, console.warn)

Do you know how lodash _.get works or angulars $parse works? this lib is kind of like that, you can test deep objects/path but it dose it with promises and by chaining a dummy function to evaluate the code when a promise has been resolved