Documentation ¶
Overview ¶
Underscore.js 1.6.0 http://underscorejs.org (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors Underscore may be freely distributed under the MIT license.
Index ¶
- type IntEachFn
- type IntFilterFn
- type IntMapFn
- type IntReduceFn
- type IntSlice
- func (self IntSlice) Compact() IntSlice
- func (self IntSlice) Contains(item int) bool
- func (self IntSlice) Each(fn IntEachFn)
- func (self IntSlice) Equal(other IntSlice) bool
- func (self IntSlice) Every(fn IntFilterFn) bool
- func (self IntSlice) Filter(fn IntFilterFn) (result IntSlice)
- func (self IntSlice) Find(fn IntFilterFn) (int, error)
- func (self IntSlice) IndexOf(item int) int
- func (self IntSlice) Initial(n int) IntSlice
- func (self IntSlice) Last(n int) IntSlice
- func (self IntSlice) LastIndexOf(item int) int
- func (self IntSlice) Map(fn IntMapFn) (result IntSlice)
- func (self IntSlice) Max() int
- func (self IntSlice) Min() int
- func (self IntSlice) Reduce(fn IntReduceFn, initial int) (result int)
- func (self IntSlice) Reject(fn IntFilterFn) (result IntSlice)
- func (self IntSlice) Rest(n int) IntSlice
- func (self IntSlice) Size() int
- func (self IntSlice) Some(fn IntFilterFn) bool
- func (self IntSlice) Take(n int) IntSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IntFilterFn ¶
type IntReduceFn ¶
type IntSlice ¶
type IntSlice []int
func Range ¶
Generate an integer Array containing an arithmetic progression.
A port of the native Python `range()` function. See [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
func (IntSlice) Contains ¶
Determine if the array or object contains a given value.
_.contains = _.include = function(obj, target) {
func (IntSlice) Each ¶
The cornerstone, an `each` implementation, aka `forEach`.
var each = _.each = _.forEach = function(obj, iterator, context) {
func (IntSlice) Every ¶
func (self IntSlice) Every(fn IntFilterFn) bool
Determine whether all of the elements match a truth test.
_.every = _.all = function(obj, predicate, context) {
func (IntSlice) Filter ¶
func (self IntSlice) Filter(fn IntFilterFn) (result IntSlice)
Return all the elements that pass a truth test.
_.filter = _.select = function(obj, predicate, context) {
func (IntSlice) Find ¶
func (self IntSlice) Find(fn IntFilterFn) (int, error)
Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, predicate, context) {
func (IntSlice) IndexOf ¶
Return the position of the first occurrence of an item in an array, or -1 if the item is not included in the array.
_.indexOf = function(array, item, isSorted) {
func (IntSlice) Initial ¶
Returns all the values in the array, excluding the last N.
_.initial = function(array, n, guard) {
func (IntSlice) LastIndexOf ¶
Return the position of the last occurrence of an item in an array, or -1 if the item is not included in the array.
_.lastIndexOf = function(array, item, from) {
func (IntSlice) Map ¶
Return the results of applying the iterator to each element.
_.map = _.collect = function(obj, iterator, context) {
func (IntSlice) Max ¶
Return the maximum element or (element-based computation).
_.max = function(obj, iterator, context) {
func (IntSlice) Min ¶
Return the minimum element (or element-based computation).
_.min = function(obj, iterator, context) {
func (IntSlice) Reduce ¶
func (self IntSlice) Reduce(fn IntReduceFn, initial int) (result int)
Reduce builds up a single result from a list of values.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
func (IntSlice) Reject ¶
func (self IntSlice) Reject(fn IntFilterFn) (result IntSlice)
Return all the elements for which a truth test fails.
_.reject = function(obj, predicate, context) {
func (IntSlice) Rest ¶
Returns all the values in the array, excluding the first N.
_.rest = _.tail = _.drop = function(array, n, guard) {
func (IntSlice) Some ¶
func (self IntSlice) Some(fn IntFilterFn) bool
Determine if at least one element in the object matches a truth test.
var any = _.some = _.any = function(obj, predicate, context) {