jsbeans

jsbeans  1.0.0

jsbeans > jsbeans > jsbeans.Array
Search:
 
Filters

static Class jsbeans.Array

A collection of utilities for Array objects

Methods

equals

static boolean equals ( first_Array , second_Array )
Checks if two Arrays have same content per position using the == operator.
Note that it returns false even if at least one parameter isn't an Array Object.
Parameters:
first_Array <Object>
second_Array <Object>
Returns: boolean
true if both arguments have same content at same position

forEach

static void forEach ( an_Array , callback , [args] )
Calls {@param} callback on each element of given Array.
An optional third argument can be passed as argument of {@param} callback. Note that it breaks execution if a callback returns false. If {@param} an_Array isn't an Array Object this function does nothing exiting silently.
Parameters:
an_Array <Object>
callback <Function> an (eventually) anonymous function fired on each element
[args] <Object> optional argument for callback. May be everything.
Returns: void

frequency

static Integer frequency ( an_Array , object_to_find )
Counts how many times {@param} object_to_find appears in {@param} an_Array.
Note that it returns {Integer} 0 even if {@param} an_Array isn't an Array Object.
Parameters:
an_Array <Object>
object_to_find <Object>
Returns: Integer
counts occurences in an Array

indexOf

static Integer indexOf ( an_Array , object_to_find )
Returns the index (position) of the first occurence of {@param} object_to_find inside {@param} an_Array using the == operator, -1 otherwise.
Note that it returns -1 even if {@param} an_Array isn't an Array Object.
Parameters:
an_Array <Object>
object_to_find <Object>
Returns: Integer
the position

isArray

static boolean isArray ( may_be_everything )
Checks if provided parameter is an Array
Parameters:
may_be_everything <Object>
Returns: boolean
true if parameter is an Array

lastIndexOf

static Integer lastIndexOf ( an_Array , object_to_find )
Returns the index (position) of the last occurence of {@param} object_to_find inside {@param} an_Array using operator ==, -1 otherwise.
Note that it returns -1 even if {@param} an_Array isn't an Array Object.
Parameters:
an_Array <Object>
object_to_find <Object>
Returns: Integer
the position

max

static Object max ( an_Array )
Compares elements each other using operator > of given Array returning the highest value.
Note that it returns null even if {@param} an_Array isn't an Array Object.
Parameters:
an_Array <Object>
Returns: Object
the highest value

min

static Object min ( an_Array )
Compares elements each other using operator < of given Array returning the lowest value.
Note that it returns null even if {@param} an_Array isn't an Array Object.
Parameters:
an_Array <Object>
Returns: Object
the lowest value

parse

static Array parse ( str )
Parses string {@param} str in the form [element list separated by commas].
Internally this method parses the string via a JSON format, so it fails when native JSON parsing fails.
Parameters:
str <String>
Returns: Array

remove

static Array remove ( an_Array , value )
Creates a copy of {@param} an_Array without {@param} value.
{@param} value matches using != operator. If {@param} an_Array isn't an Array Object it returns the parameter itself.
Parameters:
an_Array <Object>
value <Object> the element to remove
Returns: Array


Copyright © 2016 Francesco Mele. All rights reserved.