util-lib-apply

Apply method of encapsulation integration

Usage no npm install needed!

<script type="module">
  import utilLibApply from 'https://cdn.skypack.dev/util-lib-apply';
</script>

README

util-lib-apply

Apply method of encapsulation integration

Usage


    const utils = require('util-lib-apply');

    function add (a, b) {
        console.log('this', this);
        return a + b + this.c;
      }

      let obj = {
        c: 521,
      };
      window.c = 1314;
      
      console.log(utils.apply(add, obj, [10, 20]));
      console.log(utils.apply(add, null, [10, 20]));