1.0.3 • Published 5 years ago

node-guarantee v1.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

Guarantee.js

Promises without the new constructor keyword.

const Guarantee = require('Guarantee')

function doSomething () {
  const promise = Guarantee()

  setTimeout(function () {
    promise.resolve('Yeah!')
  }, 1000)

  return promise
}

doSomething()
  .then(function (data) {
    console.log(data)
  })

You can also use the Promise.new() function:

require('Guarantee')

function doSomething () {
  const promise = Promise.new()

  setTimeout(function () {
    promise.resolve('Yeah!')
  }, 1000)

  return promise
}

doSomething()
  .then(function (data) {
    console.log(data)
  })

This package adds the "new function" to Promise proto so you can use Promise.new() instead the Guarantee() standard function.

License

GNU

"Simplicity is the ultimate sophistication" Da Vinci

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago