Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decor

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decor

assorted function decorators

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

npm install decor 0.0.2
component install nomilous/decor 0.0.2

decor

assorted function decorators

decor.deferred(fn)

  • Decorates a function to be promisable
  • Injects as a new first argument the promise handler (action)
  • action. resolve(), reject() and notify() as usual from within
  • calling the decorated function returns the promise, availing .then to the caller
  • using q for the promising

{deferred} = require 'decor'

promisingFunction = deferred (action, arg1, argN) -> 
    
    doSomethingAsync arg1, (err, res) -> 

        # action.notify('50% complete')
        return action.reject err if err?
        return action.resolve res


promisingFunction( 'arg1' ).then -> # as usual

#
# or, more fully
#

promisingFunction( 'arg1' ).then(

    (result) -> 
    (error)  -> 
    (notify) -> 

)

decor.Q

  • onward export of q
  • so that it doesn't need to be installed twice by npm

Dev / Test

# sudo npm install ipso-cli -g
npm install
ipso -m

FAQs

Package last updated on 24 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc