JSPM

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

Clones a function (creates wrapper function), with the same signature as source function

Package Exports

  • fulcon

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

Readme

fulcon NPM Module

Clones a function (creates wrapper function), with the same signature as source function

PhantomJS Build Linux Build MacOS Build Windows Build

Coverage Status Dependency Status MIT license

compression size
fulcon.js 1.03 kB
fulcon.min.js 686 B
fulcon.min.js.gz 386 B

Install

$ npm install --save fulcon

Example

var fulcon = require('fulcon');

function original(a, b, c)
{
  return 42 + a + b + c;
}

assert.strictEqual(original.length, 3, 'signature of the original function has 3 arguments');
assert.strictEqual(original(1, 2, 3), 48, 'original function returns 48');

var cloned = fulcon(original);

assert.notStrictEqual(original, cloned, 'original and cloned functions are not the same function');

assert.strictEqual(cloned.length, 3, 'signature of the cloned function has 3 arguments');
assert.strictEqual(cloned(1, 2, 3), 48, 'cloned function returns 48');

Note: Beware of functions with side-effects! Cloned function calls original function under the hood, so it has same side-effects for better or for worst. Check test.js for details.

Want to Know More?

More examples can be found in test.js.

Or open an issue with questions and/or suggestions.

License

Fulcon is released under the MIT license.