go-js-array-methods

command module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 2 Imported by: 0

README

��# go-js-array-methods

s/n Function Description
1 At ' The At() function returns an indexed element from a slice.
2 Concat ' The Concat() function Concatenates (joins) two or more slices.
3 CopyWithin ' The CopyWithin() function copies slice elements to another position in an slice. The CopyWithin() function overwrites the existing values. The CopyWithin() function does not add items to the slice.
4 Entries ' The entries() function returns an Slice with structs with field/value: {index 0, element "Banana"}. The entries() function does not change the original slice.
5 Every ' The Every() function executes a function for each slice element. The Every() function returns true if the function returns true for all elements. The Every() function returns false if the function returns false for one element. The Every() function does not execute the function for empty elements. The Every() function does not change the original slice.
6 Fill ' The Fill() function fills specified elements in an slice with a value. The fill() method does not overwrites the original array.
7 Filter ' The filter() function creates a new slice filled with elements that pass a test provided by a function. The filter() function does not execute the function for empty elements. The filter() function does not change the original slice.
8 Find ' The Find() function returns the value of the first element that passes a test. The Find() function executes a function for each slice element. The Find() function returns undefined if no elements are found. The Find() function does not execute the function for empty elements. The Find() function does not change the original slice.
7 FindIndex ' The FindIndex() function executes a function for each array element. The FindIndex() function returns the index (position) of the first element that passes a test. The FindIndex() function returns -1 if no match is found. The FindIndex() function does not execute the function for empty array elements. The FindIndex() function does not change the original array.
7 FindLast ' The FindLast() function returns the value of the last element that passes a test. The FindLast() function executes a function for each slice element. The FindLast() function returns -1 if no elements are found. The FindLast() function does not execute the function for empty elements. The FindLast() function does not change the original slice.
7 FindLastIndex ' The FindLastIndex() function executes a function for each array element. The FindLastIndex() function returns the index (position) of the last element that passes a test. The FindLastIndex() function returns -1 if no match is found. The FindLastIndex() function does not execute the function for empty slice elements.The FindLastIndex() function does not change the original slice.
8 Flat L'         
7 FlatMap L'         
9 ForEach ' The ForEach() function calls a function for each element in an slice. The ForEach() function is not executed for empty elements.
10 Includes ' The Includes() function returns true if an slice contains a specified value. The Includes() function returns false if the value is not found. The Includes() function is case sensitive.
11 IndexOf ' The IndexOf() function returns the first index (position) of a specified value. The IndexOf() function returns -1 if the value is not found. The IndexOf() function starts at a specified index and searches from left to right (from the given start postion to the end of the array). By default the search starts at the first element and ends at the last. Negative start values counts from the last element (but still searches from left to right).
12 Join ' The Join() function returns an slice as a string. The Join() function does not change the original slice. Any separator can be specified. The default is comma (,).
13 Keys L'         
14 LastIndexOf ' The LastIndexOf() function returns the last index (position) of a specified value. The LastIndexOf() function returns -1 if the value is not found. The LastIndexOf() starts at a specified index and searches from right to left (from the given position to the beginning of the slice). By default the search starts at the last element and ends at the first. Negative start values counts from the last element (but still searches from right to left).
15 Map ' Map() creates a new slice from calling a function for every slice element. Map creates a new slice of any type. Map() does not execute the function for empty elements. Map() does not change the original slice.
16 MapStrict ' Map() creates a new slice from calling a function for every slice element. Map creates a new slice of the original slice type. Map() does not execute the function for empty elements. Map() does not change the original slice.
17 Pop ' The Pop() function removes (pops) the last element of an slice. The Pop() function does not change the original slice. The Pop() function returns the new slice without the last element and a pointer of removed element.
18 Push ' The Push() function adds new items to the end of an slice. The Push() function returns the new slice.
19 Reduce ' The Reduce() function executes a Reducer function for slice element. The Reduce() function returns the function's accumulated result and an an error. The Reduce() function does not execute the function for empty slice elements. The Reduce() function does not change the original slice. Note at the first callback, there is no return value from the previous callback. Normally, alice element 0 is used as initial value, and the iteration starts from slice element 1. If an initial value is supplied, this is used, and the iteration starts from slice element 0.
20 ReduceStrict ' The ReduceStrict() function executes a Reducer function for slice element. The ReduceStrict() function returns the function's accumulated result(typed with the slices type) and an an error. The ReduceStrict() function does not execute the function for empty slice elements. The ReduceStrict() function does not change the original slice. Note at the first callback, there is no return value from the previous callback. Normally, alice element 0 is used as initial value, and the iteration starts from slice element 1. If an initial value is supplied, this is used, and the iteration starts from slice element 0.
21 ReduceRight ' The Reduce() function executes a Reducer function for slice element. The ReduceRight() function works from right to left. The Reduce() function returns the function's accumulated result and an an error. The Reduce() function does not execute the function for empty slice elements. The Reduce() function does not change the original slice. Note at the first callback, there is no return value from the previous callback. Normally, alice element 0 is used as initial value, and the iteration starts from slice element 1. If an initial value is supplied, this is used, and the iteration starts from slice element 0.
22 ReduceRightStrict ' The ReduceStrict() function executes a Reducer function for slice element. The ReduceRightStrict() function works from right to left . The ReduceStrict() function returns the function's accumulated result(typed with the slices type) and an an error. The ReduceStrict() function does not execute the function for empty slice elements. The ReduceStrict() function does not change the original slice. Note at the first callback, there is no return value from the previous callback. Normally, alice element 0 is used as initial value, and the iteration starts from slice element 1. If an initial value is supplied, this is used, and the iteration starts from slice element 0.
23 Reverse ' The Reverse() function Reverses the order of the elements in an slice. The Reverse() function does not overwrites the original slice.
24 Shift ' The Shift() function removes the first item of an slice. The Shift() function changes the original slice. The Shift() function returns the new slice and a pointer to the shifted element.
25 Slice ' The Slice() function returns selected elements in an slice, as a new slice and and error. The Slice() function selects from a given start, up to a (not inclusive) given end. The Slice() function does not change the original slice.
26 Some ' The Some() function checks if any slice elements pass a test (provided as a callback function). The Some() function executes the callback function once for each slice element.The Some() function returns true (and stops) if the function returns true for one of the slice elements. The Some() function returns false if the function returns false for all of the slice elements. The Some() function does not execute the function for empty slice elements. The Some() function does not change the original slice.
27 Sort L'         
28 Splice ' x
29 ToString ' x
30 Unshift ' The Unshift() function adds new elements to the beginning of an array. The Unshift() function does not overwrite the original array.
31 ValueOf ' The ValueOf() function returns the slice itself. The ValueOf() function does not change the original slice. fruits. ValueOf() returns the same as fruits.
32 With ' The With() function updates a specified slice element. The With() function returns a new slice. The With() function does not change the original slice.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package array provides functions for manipulating golang slices.
Package array provides functions for manipulating golang slices.

Jump to

Keyboard shortcuts

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