lb.base.array

Array Adapter Module for Base Library

Authors

Copyright

Eric Bréchemier © 2011, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved

License

BSD License http://creativecommons.org/licenses/BSD/

Version

2011-08-14

Summary
lb.base.arrayArray Adapter Module for Base Library
Functions
addOne(array, item)Add an item to the array, only once (no duplicates allowed).
removeOne(array, item])Remove the first occurence of an item from the given array.
removeAll(array)Remove all items from the array.
copy(array): arrayCopy an array.
toArray(pseudoArray): arrayConvert a pseudo-array to an array.

Functions

addOne(array, item)

Add an item to the array, only once (no duplicates allowed).

Parameters

arrayarray, the array to modify in place
itemany, the new item to insert at end, unless already present

removeOne(array, item])

Remove the first occurence of an item from the given array.  The identity operator === is used for the comparison.

Parameters

arrayarray, the array to modify in place
itemany, the item to remove

Note

Duplicates are not removed.

removeAll(array)

Remove all items from the array.

copy(array): array

Copy an array.

Parameter

arrayarray, the array to copy

Returns

array, a shallow copy of given array

toArray(pseudoArray): array

Convert a pseudo-array to an array.

Parameter

pseudoArrayobject, a pseudo-array such as function arguments

Returns

array, the pseudo-array converted to a new array instance

Close