Detalhes do pacote

call-bind

ljharb236.4mMIT1.0.8

Robustly .call.bind() a function

javascript, ecmascript, es, js

readme (leia-me)

call-bind Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Robustly .call.bind() a function.

Getting started

npm install --save call-bind

Usage/Examples

const assert = require('assert');
const callBind = require('call-bind');
const callBound = require('call-bind/callBound');

function f(a, b) {
    assert.equal(this, 1);
    assert.equal(a, 2);
    assert.equal(b, 3);
    assert.equal(arguments.length, 2);
}

const fBound = callBind(f);

const slice = callBound('Array.prototype.slice');

delete Function.prototype.call;
delete Function.prototype.bind;

fBound(1, 2, 3);

assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);

Tests

Clone the repo, npm install, and run npm test

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.8 - 2024-12-05

Commits

  • [Refactor] extract out some helpers and avoid get-intrinsic usage 407fd5e
  • [Refactor] replace code with extracted call-bind-apply-helpers 81018fb
  • [Tests] use set-function-length/env 0fc311d
  • [actions] split out node 10-20, and 20+ 77a0cad
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, es-value-fixtures, gopd, object-inspect, tape a145d10
  • [Tests] replace aud with npm audit 30ca3dd
  • [Deps] update set-function-length 57c79a3
  • [Dev Deps] add missing peer dep 601cfa5

v1.0.7 - 2024-02-12

Commits

  • [Refactor] use es-define-property 09b76a0
  • [Deps] update get-intrinsic, set-function-length ad5136d

v1.0.6 - 2024-02-05

Commits

  • [Dev Deps] update aud, npmignore, tape d564d5c
  • [Deps] update get-intrinsic, set-function-length cfc2bdc
  • [Refactor] use es-errors, so things that only need those do not need get-intrinsic 64cd289
  • [meta] add missing engines.node 32a4038

v1.0.5 - 2023-10-19

Commits

  • [Fix] throw an error on non-functions as early as possible f262408
  • [Deps] update set-function-length 3fff271

v1.0.4 - 2023-10-19

v1.0.3 - 2023-10-19

Commits

  • [actions] reuse common workflows a994df6
  • [meta] use npmignore to autogenerate an npmignore file eef3ef2
  • [readme] flesh out content 1845ccf
  • [actions] use node/install instead of node/run; use codecov action 5b47d53
  • [Refactor] use set-function-length a0e165c
  • [Dev Deps] update @ljharb/eslint-config, aud, tape 9c50103
  • [meta] simplify "exports" 019c6d0
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, safe-publish-latest, tape 23bd718
  • [actions] update codecov uploader 62552d7
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape ec81665
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape 35d67fc
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 0266d8d
  • [Dev Deps] update @ljharb/eslint-config, aud, tape 43a5b28
  • [Deps] update define-data-property, function-bind, get-intrinsic 780eb36
  • [Dev Deps] update aud, tape 90d50ad
  • [meta] use prepublishOnly script for npm 7+ 44c5433
  • [Deps] update get-intrinsic 86bfbfc
  • [Deps] update get-intrinsic 5c53354
  • [actions] update checkout action 4c393a8
  • [Deps] update get-intrinsic 4e70bde
  • [Deps] update get-intrinsic 55ae803

v1.0.2 - 2021-01-11

Commits

  • [Fix] properly include the receiver in the bound length dbae7bc

v1.0.1 - 2021-01-08

Commits

  • [Tests] migrate tests to Github Actions b6db284
  • [meta] do not publish github action workflow files ec7fe46
  • [Fix] preserve original function’s length when possible adbceaa
  • [Tests] gather coverage data on every job d69e23c
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 2fd3586
  • [Deps] update get-intrinsic f23e931
  • [Deps] update get-intrinsic 72d9f44
  • [meta] fix FUNDING.yml e723573
  • [eslint] ignore coverage output 15e76d2
  • [meta] add Automatic Rebase and Require Allow Edits workflows 8fa4dab

v1.0.0 - 2020-10-30

Commits