Tuesday, November 17, 2015

Underscore.js : JavaScript Library

Underscore.js


Introduction

Underscore is a JavaScript library which provides a whole useful library of helper functions without requiring extension of any built-in objects. Underscore provides well over 100 functions that support the common needs of a programmer in his/her daily programming life. This is a must have for all the web programmers who deal with JavaScript. 

Key helper functions

  • Collections (Helper functions for lists/collection objects)
    • each
    • map
    • reduce
    • reduceRight
    • find
    • filter
    • where
    • findWhere
    • reject
    • every
    • some
    • contains
    • invoke
    • pluck
    • max
    • min
    • sortBy
    • groupBy
    • indexBy
    • countBy
    • shuffle
    • sample
    • toArray
    • size
    • partition
  • Arrays (Helper functions for arrays)
    • first
    • initial
    • last
    • rest
    • compact
    • flatten
    • without
    • union
    • intersection
    • difference
    • uniq
    • zip
    • unzip
    • object
    • indexOf
    • lastIndexOf
    • sortedIndex
    • findIndex
    • findLastIndex
    • range
  • Functions (General helper functions)
    • bind
    • bindAll
    • partial
    • memoize
    • delay
    • defer
    • throttle
    • debounce
    • once
    • after
    • before
    • wrap
    • negate
    • compose
  • Objects (Helper functions that can be applied to objects)
    • keys
    • allKeys
    • values
    • mapObject
    • pairs
    • invert
    • create
    • functions
    • findKey
    • extend
    • extendOwn
    • pick
    • omit
    • defaults
    • clone
    • tap
    • has
    • matcher
    • property
    • propertyOf
    • isEqual
    • isMatch
    • isEmpty
    • isElement
    • isArray
    • isObject
    • isArguments
    • isFunction
    • isString
    • isNumber
    • isFinite
    • isBoolean
    • isDate
    • isRegExp
    • isNaN
    • isNull
    • isUndefined
  • Utility
    • noConflict
    • identity
    • constant
    • noop
    • times
    • random
    • mixin
    • iteratee
    • uniqueId
    • escape
    • unescape
    • result
    • now
    • template
  • Chaining
    • chain
    • value

Conclusion


By using Underscore.js, a web developer could save a lot of time. Using these helper functions in the team or in the company enhances code re-usability and code readability. To get to know more about each helper functions in detail, go to http://underscorejs.org/ 





No comments:

Post a Comment