Nautical Pirate Moustache

    dedup-function

    1.0.0 • Public • Published

    JS module to dedup function calls. Requires that your environment has Promise, or that it's been provided by a polyfill.

    Usage-

    const dedup = require('dedup-function');
     
    function expensiveOperation() {
      // do some stuff
      return 42;
    }
     
    const sometimesExpensiveOperation = dedup(expensiveOperation, 5000);
    sometimesExpensiveOperation().then(result => {
      console.info('This value is probably going to be 42, is it?', result);
    }).catch(err => {
      console.info('Got error', err);
    });
     

    Install

    npm i dedup-function

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    Apache-2.0

    Last publish

    Collaborators

    • samthor