New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fucktion

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fucktion

Allow to operate promise and non-promise values directly.

latest
Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
1
-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

Fucktion

Allow to operate promise and non-promise values directly.

  • Do you have a synchronous function which operates only on scalar values and doesn't understand about promises?

  • Do you want to operate promises or mix promises with other scalar values thought it?

Fuck it!!!

var fucked_myFunc = fucktion.sync(myFunc);
var rsult = fucked_myFunc("foo", Promise.resolve("bar"), ...); 

How it works?

Install

npm install --save fucktion

Usage

var fucktion = require("fucktion");

var fn_promise = fucktion.promise(fn); // Returns promisory.
var fn_cbk = fucktion.cbk(fn); // Returns async function (adds callback parameter).
var fn_sync = fucktion.sync(fn); // Returns "deasync"ed function..

Example

var fucktion = require("fucktion");

var max = fucktion.sync(Math.max);

setTimeout(function(){
    console.log("...note that Event Loop was not stopped...");
}, 2000);

console.log ("And the maximum increased by 5 is....");
var m = max(
    10                      // Scalar value.
    , Promise.resolve(23)   // Resolved promise.
    , 44                    // Another scalar value.
    , Promise.resolve(7)    // Another resolved promise.
    , new Promise(          // Pending promise.
        function(resolve, reject){
            setTimeout(function(){
                resolve(37)
            }, 3000);
        }
    )
);

console.log(m + 5);

console.log ("Done!!");

Output:

And the maximum increased by 5 is....
...note that Event Loop was not stopped...
49
Done!!

Keywords

fucktion

FAQs

Package last updated on 24 Mar 2017

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