@d-i-t-a/reader 2.3.17 → 2.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -345,39 +345,65 @@ var require_implementation = __commonJS({
345
345
  "use strict";
346
346
  init_polyfills();
347
347
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
348
- var slice = Array.prototype.slice;
349
348
  var toStr = Object.prototype.toString;
349
+ var max = Math.max;
350
350
  var funcType = "[object Function]";
351
+ var concatty = function concatty2(a, b) {
352
+ var arr = [];
353
+ for (var i = 0; i < a.length; i += 1) {
354
+ arr[i] = a[i];
355
+ }
356
+ for (var j = 0; j < b.length; j += 1) {
357
+ arr[j + a.length] = b[j];
358
+ }
359
+ return arr;
360
+ };
361
+ var slicy = function slicy2(arrLike, offset) {
362
+ var arr = [];
363
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
364
+ arr[j] = arrLike[i];
365
+ }
366
+ return arr;
367
+ };
368
+ var joiny = function(arr, joiner) {
369
+ var str = "";
370
+ for (var i = 0; i < arr.length; i += 1) {
371
+ str += arr[i];
372
+ if (i + 1 < arr.length) {
373
+ str += joiner;
374
+ }
375
+ }
376
+ return str;
377
+ };
351
378
  module2.exports = function bind(that) {
352
379
  var target = this;
353
- if (typeof target !== "function" || toStr.call(target) !== funcType) {
380
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
354
381
  throw new TypeError(ERROR_MESSAGE + target);
355
382
  }
356
- var args = slice.call(arguments, 1);
383
+ var args = slicy(arguments, 1);
357
384
  var bound;
358
385
  var binder = function() {
359
386
  if (this instanceof bound) {
360
387
  var result = target.apply(
361
388
  this,
362
- args.concat(slice.call(arguments))
389
+ concatty(args, arguments)
363
390
  );
364
391
  if (Object(result) === result) {
365
392
  return result;
366
393
  }
367
394
  return this;
368
- } else {
369
- return target.apply(
370
- that,
371
- args.concat(slice.call(arguments))
372
- );
373
395
  }
396
+ return target.apply(
397
+ that,
398
+ concatty(args, arguments)
399
+ );
374
400
  };
375
- var boundLength = Math.max(0, target.length - args.length);
401
+ var boundLength = max(0, target.length - args.length);
376
402
  var boundArgs = [];
377
403
  for (var i = 0; i < boundLength; i++) {
378
- boundArgs.push("$" + i);
404
+ boundArgs[i] = "$" + i;
379
405
  }
380
- bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
406
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
381
407
  if (target.prototype) {
382
408
  var Empty = function Empty2() {
383
409
  };