Underscore: "bindAll must be passed function names "

Created on 1 Mar 2013  路  3Comments  路  Source: jashkenas/underscore

Previously to v1.4.4, using "_.bindAll(this);" would work as expected, and as per documentation: " If no methodNames are provided, all of the object's function properties will be bound to it."

In v1.4.4 "_.bindAll(this);" throws an error - "bindAll must be passed function names "

In the diff for 1.4.3 and 1.4.4 (https://gist.github.com/ahomu/4700664) at lines 107 this was changed:

  • if (funcs.length == 0) funcs = _.functions(obj);
  • if (funcs.length === 0) throw new Error("bindAll must be passed function names");

This isn't in the changelog, and the documentation is out-of-date

Out of interest, why was this changed? Attempting to update 1.4.4 has broken a lot of my code!

question

Most helpful comment

Will you please at least respect some backward compatibility?

Quoting http://semver.org/

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,

All 3 comments

Mornin' @markvr! _.bindAll has been changed recently, but it is not included in version 1.4.4. The change is only in the master branch. There is some discussion about the change in bf657be243a075b5e72acc8a83e6f12a564d8f55. Check it out and let us know what you think.

It's probably misleading to name it "bindAll" then, no?

Will you please at least respect some backward compatibility?

Quoting http://semver.org/

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
Was this page helpful?
0 / 5 - 0 ratings

Related issues

chikamichi picture chikamichi  路  8Comments

Francefire picture Francefire  路  5Comments

xiaoliwang picture xiaoliwang  路  3Comments

clouddueling picture clouddueling  路  3Comments

jdalton picture jdalton  路  6Comments