What Can Underscore CDN Do to Help You and Your Company?
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It’s the answer to the question: “If I sit down in front of a blank HTML page, and want to start being productive immediately, what do I need?” … and the tie to go along with jQuery's tux and Backbone's suspenders.
Underscore CDN provides over 100 functions that support both your favorite workaday functional helpers: map, filter, invoke — as well as more specialized goodies: function binding, javascript templating, creating quick indexes, deep equality testing, and so on. These functions fall under four main categories depending on the datatypes which they manipulate: functions for manipulating arrays, functions for manipulating objects, functions for manipulating both arrays and objects (the name of the category is "Collections") and functions for manipulating other functions. There are also two utility categories : "Utility" and "Chaining".
Benefits of using Underscore CDN
Now that you are delivering the Underscore.js file via a CDN, your website will receive a boost in performance and a reduction in latency. Using a CDN for JS libraries, CSS frameworks, Jquery plugins, etc. not only increases their delivery speed but also helps improve redundancy and increase security. Read our 7 reasons you should use a CDN article to learn more. Additionally, there exists many other benefits to users who accelerate their Underscore.js file and other static content with KeyCDN:
- Access to global network of POPs
- HTTP/2 support for reduced latency and optimized content delivery
- Low pricing for content delivery
- Free SSL with Let’s Encrypt
Functions you can use on Objects in Underscore CDN
-
each
Iterates over a list of elements, yielding each in turn to an iteratee function. The iteratee is bound to the context object, if one is passed. Each invocation of iteratee is called with three arguments: (element, index, list). If list is a JavaScript object, iteratee's arguments will be (value, key, list). Returns the list for chaining
-
reduce
Also known as inject and foldl, reduce boils down a list of values into a single value. Memo is the initial state of the reduction, and each successive step of it should be returned by iteratee. The iteratee is passed four arguments: the memo, then the value and index (or key) of the iteration, and finally a reference to the entire list
If no memo is passed to the initial invocation of reduce, the iteratee is not invoked on the first element of the list. The first element is instead passed as the memo in the invocation of the iteratee on the next element in the list
-
find
Looks through each value in the list, returning the first one that passes a truth test (predicate), or undefined if no value passes the test. The function returns as soon as it finds an acceptable element, and doesn't traverse the entire list. predicate is transformed through iteratee to facilitate shorthand syntaxes
These are just some of the functions you can use to manipulate objects in JavaScript using Underscore CDN
Functions you can use on Arrays in Underscore CDN
-
uniq
Produces a duplicate-free version of the array, using === to test object equality. In particular only the first occurrence of each value is kept. If you know in advance that the array is sorted, passing true for isSorted will run a much faster algorithm. If you want to compute unique items based on a transformation, pass an iteratee function
-
zip
Merges together the values of each of the arrays with the values at the corresponding position. Useful when you have separate data sources that are coordinated through matching array indexes. Use with apply to pass in an array of arrays. If you're working with a matrix of nested arrays, this can be used to transpose the matrix
-
indexOf
Returns the index at which value can be found in the array, or -1 if value is not present in the array. If you're working with a large array, and you know that the array is already sorted, pass true for isSorted to use a faster binary search ... or, pass a number as the third argument in order to look for the first matching value in the array after the given index
-
sortedIndex
Uses a binary search to determine the index at which the value should be inserted into the array in order to maintain the array's sorted order. If an iteratee function is provided, it will be used to compute the sort ranking of each value, including the value you pass. The iteratee may also be the string name of the property to sort by
These are just some of the functions you can use to manipulate arrays in JavaScript using Underscore CDN.
Power-up your Content Delivery
30 Day Free Trial Cancel Anytime