util-lib-call

Call method of encapsulation integration

Usage no npm install needed!

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

README

util-lib-call

Call method of encapsulation integration

Usage


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

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

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