Skip to content

Instantly share code, notes, and snippets.

@khoand0000
Last active January 22, 2016 09:38
Show Gist options
  • Save khoand0000/c1d9215d9f9e44284bf5 to your computer and use it in GitHub Desktop.
Save khoand0000/c1d9215d9f9e44284bf5 to your computer and use it in GitHub Desktop.
common underscore functions
pure js jquery angular _.js _.php pure php note
- $.map - _.map ->map array_map -
- - - _.filter ->filter array_filter -
- - - _.pick ->pick array_filter filter object (whitelisted keys)
- - - _.omit - filter object (blacklisted keys)
- - - _.reduce ->reduce - -
- - - _.chain Underscore::from - -
- - - _.value ->value - -
- - - _.pluck - -
- - - _.findWhere ->find - -
- - - _.first ->head - -
- - - _.negate - -
- - - _.each ->invoke - -
- $.each angular.forEach _.invoke ->invoke - -
- - - _.result - - -
- $.extend - _.extend ->extend array_merge extend object
arr.concat $.merge - _.chain(a).concat(b).value() ->merge array_merge merge arrays
arr.join - - _.chain(a).join().value() implode concat arrays to string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment