underscore

package
v0.0.0-...-fe056f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2014 License: MIT Imports: 1 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntEachFn

type IntEachFn func(int)

type IntFilterFn

type IntFilterFn func(int) bool

type IntMapFn

type IntMapFn func(int) int

type IntReduceFn

type IntReduceFn func(int, int) int

type IntSlice

type IntSlice []int

func Range

func Range(args ...int) (result IntSlice)

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) Compact

func (self IntSlice) Compact() IntSlice

Trim out all falsy values from an array.

_.compact = function(array) {

func (IntSlice) Contains

func (self IntSlice) Contains(item int) bool

Determine if the array or object contains a given value.

_.contains = _.include = function(obj, target) {

func (IntSlice) Each

func (self IntSlice) Each(fn IntEachFn)

The cornerstone, an `each` implementation, aka `forEach`.

var each = _.each = _.forEach = function(obj, iterator, context) {

func (IntSlice) Equal

func (self IntSlice) Equal(other IntSlice) bool

Customize functions

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

func (self IntSlice) IndexOf(item int) int

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

func (self IntSlice) Initial(n int) IntSlice

Returns all the values in the array, excluding the last N.

_.initial = function(array, n, guard) {

func (IntSlice) Last

func (self IntSlice) Last(n int) IntSlice

Get the last N elements in the array.

_.last = function(array, n, guard) {

func (IntSlice) LastIndexOf

func (self IntSlice) LastIndexOf(item int) int

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

func (self IntSlice) Map(fn IntMapFn) (result IntSlice)

Return the results of applying the iterator to each element.

_.map = _.collect = function(obj, iterator, context) {

func (IntSlice) Max

func (self IntSlice) Max() int

Return the maximum element or (element-based computation).

_.max = function(obj, iterator, context) {

func (IntSlice) Min

func (self IntSlice) Min() int

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

func (self IntSlice) Rest(n int) IntSlice

Returns all the values in the array, excluding the first N.

_.rest = _.tail = _.drop = function(array, n, guard) {

func (IntSlice) Size

func (self IntSlice) Size() int

Return the number of elements in an object.

_.size = function(obj) {

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) {

func (IntSlice) Take

func (self IntSlice) Take(n int) IntSlice

Get the first N elements in the array.

_.first = _.head = _.take = function(array, n, guard) {

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL