Underscore.js

Software Screenshot:
Underscore.js
Software Details:
Version: 1.8.3 updated
Upload Date: 11 Apr 15
Developer: Jeremy Ashkenas
Distribution Type: Freeware
Downloads: 176

Rating: nan/5 (Total Votes: 0)

Portions of Underscore are inspired by or borrowed from Oliver Steele's Functional, Prototype.js and John Resig's Micro-Templating.

Functional programming support is added, but without extending any of the built-in JavaScript objects.

Underscore provides 60-odd functions that support both the usual functional suspects: map, select, invoke — as well as more specialized helpers: function binding, JavaScript templating, deep equality testing, and so on. It delegates to built-in functions, if present, so modern browsers will use the native implementations of forEach, map, reduce, filter, every, some and indexOf.

Ports of Underscore.js are available for:
PHP
Python
Perl

What is new in this release:

  • Adds an _.create method, as a slimmed down version of Object.create.
  • Works around an iOS bug that can improperly cause isArrayLike to be JIT-ed. Also fixes a bug when passing 0 to isArrayLike.

What is new in version 1.8.2:

  • Fixes/changes some old-Internet-Explorer and related edge case behavior.

What is new in version 1.7.0:

  • For consistency and speed across browsers, Underscore now ignores native array methods for forEach, map, reduce, reduceRight, filter, every, some, indexOf, and lastIndexOf. "Sparse" arrays are officially dead in Underscore.
  • Added _.iteratee to customize the iterators used by collection functions. Many Underscore methods will take a string argument for easier _.property-style lookups, an object for _.where-style filtering, or a function as a custom callback.
  • Added _.before as a counterpart to _.after.
  • Added _.negate to invert the truth value of a passed-in predicate.
  • Added _.noop as a handy empty placeholder function.
  • _.isEmpty now works with arguments objects.
  • _.has now guards against nullish objects.
  • Override base methods like each and some and they'll be used internally by other Underscore functions too.
  • The escape functions handle backticks (`), to deal with an IE ≤ 8 bug.
  • For consistency, _.union and _.difference now only work with arrays and not variadic args.
  • _.memoize exposes the cache of memoized values as a property on the returned function.
  • _.pick accepts iteratee and context arguments for a more advanced callback.
  • Underscore templates no longer accept an initial data object. _.template always returns a function now.

What is new in version 1.5.0:

  • A source map is now supplied for easier debugging of the minified production build of Underscore.
  • The defaults function now only overrides undefined values, not null ones.
  • Removed the ability to call _.bindAll with no method name arguments. It's pretty much always wiser to white-list the names of the methods you'd like to bind.
  • Removed the ability to call _.after with an invocation count of zero. The minimum number of calls is (naturally) now 1.

What is new in version 1.4.4:

  • Added _.findWhere, for finding the first element in a list that matches a particular set of keys and values.
  • Added _.partial, for partially applying a function without changing its dynamic reference to this.
  • Simplified bind by removing some edge cases involving constructor functions. In short: don't _.bind your constructors.
  • A minor optimization to invoke.
  • Fix bug in the minified version due to the minifier incorrectly optimizing-away isFunction.

What is new in version 1.4.3:

  • Added a default _.identity iterator to countBy and groupBy.
  • The uniq function can now take array, iterator, context as the argument list.
  • The times function now returns the mapped array of iterator results.
  • Simplified and fixed bugs in throttle.

What is new in version 1.4.2:

  • For backwards compatibility, returned to pre-1.4.0 behavior when passing null to iteration functions. They now become no-ops again.

What is new in version 1.4.0:

  • Added a pairs function, for turning a JavaScript object into [key, value] pairs ... as well as an object function, for converting an array of [key, value] pairs into an object.
  • Added a countBy function, for counting the number of objects in a list that match a certain criteria.
  • Added an invert function, for performing a simple inversion of the keys and values in an object.
  • Added a where function, for easy cases of filtering a list for objects with specific values.
  • Added an omit function, for filtering an object to remove certain keys.
  • Added a random function, to return a random number in a given range.
  • _.debounce'd functions now return their last updated value, just like _.throttle'd functions do.
  • The sortBy function now runs a stable sort algorithm.
  • Added the optional fromIndex option to indexOf and lastIndexOf.
  • "Sparse" arrays are no longer supported in Underscore iteration functions. Use a for instead (or better yet, an object).
  • The min and max functions may now be called on very large arrays.
  • Interpolation in templates now represents null and undefined as the empty string.

What is new in version 1.3.2:

  • Added the pick function, which allows you to filter an object literal with a whitelist of allowed property names.
  • Added the result function, for convenience when working with APIs that allow either functions or raw properties.
  • Added the isFinite function, because sometimes knowing that a value is a number just ain't quite enough.
  • The sortBy function may now also be passed the string name of a property to use as the sort order on each object.
  • Fixed uniq to work with sparse arrays.
  • The difference function now performs a shallow flatten instead of a deep one when computing array differences.
  • The debounce function now takes an immediate parameter, which will cause the callback to fire on the leading instead of the trailing edge.

What is new in version 1.3.1:

  • Added an _.has function, as a safer way to use hasOwnProperty.
  • Added _.collect as an alias for _.map. Smalltalkers, rejoice.
  • Reverted an old change so that _.extend will correctly copy over keys with undefined values again.
  • Bugfix to stop escaping slashes within interpolations in _.template.

What is new in version 1.3.0:

  • Removed AMD (RequireJS) support from Underscore.

What is new in version 1.2.4:

  • Can (and probably should) write _.chain(list) instead of _(list).chain().
  • Fix for escaped characters in Underscore templates, and for supporting customizations of _.templateSettings that only define one or two of the required regexes.
  • Fix for passing an array as the first argument to an _.wrap'd function.
  • Improved compatibility with ClojureScript, which adds a call function to String.prototype.

What is new in version 1.2.3:

  • Dynamic scope is now preserved for compiled _.template functions, so you can use the value of this if you like.
  • Sparse array support of _.indexOf, _.lastIndexOf.
  • Both _.reduce and _.reduceRight can now be passed an explicitly undefined value.

What is new in version 1.2.2:

  • Continued tweaks to _.isEqual semantics. Now JS primitives are considered equivalent to their wrapped versions, and arrays are compared by their numeric properties only.
  • _.escape no longer tries to be smart about not double-escaping already-escaped HTML entities. Now it just escapes regardless.
  • In _.template, you may now leave semicolons out of evaluated statements if you wish: <% }) %>.
  • _.after(callback, 0) will now trigger the callback immediately, making "after" easier to use with asynchronous APIs.

What is new in version 1.2.1:

  • Several important bug fixes for _.isEqual, which should now do better on mutated Arrays, and on non-Array objects with length properties.
  • Can now _.groupBy(list, 'property') as a shortcut for grouping values by a particular common property.
  • _.throttle'd functions now fire immediately upon invocation, and are rate-limited thereafter.
  • Most of the _.is[Type] checks no longer ducktype.
  • The _.bind function now also works on constructors, a-la ES5 ... but you would never want to use _.bind on a constructor function.
  • _.clone no longer wraps non-object types in Objects.
  • _.find and _.filter are now the preferred names for _.detect and _.select.

What is new in version 1.2.0:

  • The _.isEqual function now supports true deep equality comparisons, with checks for cyclic structures, thanks to Kit Cambridge.
  • Underscore templates now support HTML escaping interpolations, using <%- ... %> syntax.
  • Ryan Tenney contributed _.shuffle, which uses a modified Fisher-Yates to give you a shuffled copy of an array.
  • _.uniq can now be passed an optional iterator, to determine by what criteria an object should be considered unique.
  • _.last now takes an optional argument which will return the last N elements of the list.
  • A new _.initial function was added, as a mirror of _.rest, which returns all the initial values of a list (except the last N).

What is new in version 1.1.7:

  • Added _.groupBy, which aggregates a collection into groups of like items.
  • Added _.union and _.difference, to complement the (re-named) _.intersection.
  • Various improvements for support of sparse arrays. _.toArray now returns a clone, if directly passed an array. _.functions now also returns the names of functions that are present in the prototype chain.

What is new in version 1.1.6:

  • Added _.after, which will return a function that only runs after first being called a specified number of times. _.invoke can now take a direct function reference. _.every now requires an iterator function to be passed, which mirrors the ECMA5 API. _.extend no longer copies keys when the value is undefined. _.bind now errors when trying to bind an undefined value.

What is new in version 1.1.4:

  • Improved compliance with ES5's Array methods when passing null as a value. _.wrap now correctly sets this for the wrapped function. _.indexOf now takes an optional flag for finding the insertion index in an array that is guaranteed to already be sorted.
  • Avoiding the use of .callee, to allow _.isArray to work properly in ES5's strict mode.

What is new in version 1.1.3:

  • In CommonJS, Underscore may now be required with just:
  • var _ = require("underscore"). Added _.throttle and _.debounce functions.
  • Removed _.breakLoop, in favor of an ECMA5-style un-break-able each implementation - this removes the try/catch, and you'll now have better stack traces for exceptions that are thrown within an Underscore iterator. Improved the isType family of functions for better interoperability with Internet Explorer host objects. _.template now correctly escapes backslashes in templates. Improved _.reduce compatibility with the ECMA5 version: if you don't pass an initial value, the first item in the collection is used. _.each no longer returns the iterated collection, for improved consistency with ECMA5's forEach.

What is new in version 1.0.4:

  • _.memoize function, which can be used to speed up expensive repeated computations by caching the results.

What is new in version 1.0.2:

  • Fixed _.isArguments for Opera.

Similar Software

Ambient.js
Ambient.js

12 Apr 15

snappy (Ruby)
snappy (Ruby)

20 Jul 15

CSSOM
CSSOM

18 Apr 16

pyprotobuf
pyprotobuf

13 May 15

Other Software of Developer Jeremy Ashkenas

Comments to Underscore.js

Comments not found
Add Comment
Turn on images!