ish.type.arr

Array-based type functionality.

Source:

Methods

ish.type.arr.clone(a_vArray) → {Array.<variant>}

Source:
Clones the passed value into a new array.
Parameters:
Name Type Description
a_vArray Array.<variant> Value to interrogate.
Returns:
Type Description
Array.<variant> Value representing a shallow copy clone of the passed value.

[mixin] ish.type.arr.cmp(x, y, bInOrderOnlyopt) → {integer|boolean}

Source:
Compares the passed value to the reference value, determining if the values match, match when coerced or match in a different order.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
x Array.<variant> Value representing the array to compare.
y Array.<variant> Value representing the reference array.
bInOrderOnly boolean <optional>
false Value representing if the comparison is to be in matching order only.
Returns:
Type Description
integer | boolean Value representing if the values match (true), match when coerced (1) or match in a different order (2) the passed relative value with false indicating the arrays do not match.

[mixin] ish.type.arr.countOf(x, vValue) → {integer}

Source:
Counts the instances of the passed value within the passed collection.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
x Array.<variant> Value representing the array to interrogate.
vValue variant Value representing the entries to count.
Returns:
Type Description
integer Value representing the count of the passed value within the passed collection.

[mixin] ish.type.arr.cp(x, vMaxDepthopt) → {Array.<variant>}

Source:
Copies the passed value into a new instance.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
x Array.<variant> Value representing the array to copy.
vMaxDepth boolean | integer <optional>
0 Indicates if a deep copy is to occur. false/0 performs a shallow copy, a positive integer indicates the max depth to perform a deep copy to, true and all other integer values perform a deep copy to an unlimited depth.
Returns:
Type Description
Array.<variant> Value representing the passed value as a new instance.

[mixin] ish.type.arr.extract(x, a_vPath) → {Array.<variant>}

Source:
Extracts the passed paths from the within the passed value.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
x Array.<variant> Value to interrogate.
a_vPath string | Array.<string> Value representing the path to the requested property as a period-delimited string (e.g. "parent.child.array.0.key") or an array of strings.
Returns:
Type Description
Array.<variant> Value representing the extracted entries from the passed value.

ish.type.arr.is(x, bDisallow0Lengthopt) → {boolean}

Source:
Determines if the passed value represents an array.
Parameters:
Name Type Attributes Default Description
x variant Value to interrogate.
bDisallow0Length boolean <optional>
false Value representing if zero length arrays are to be ignored.
Returns:
Type Description
boolean Value representing if the passed value represents an array.

[mixin] ish.type.arr.matches(x, y) → {Array.<variant>}

Source:
Determines the matching entries within the passed values.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
x Array.<variant> Value representing the array to compare.
y Array.<variant> Value representing the reference array.
Returns:
Type Description
Array.<variant> Value representing the passed values' matching entries.

ish.type.arr.mk(x, vDefaultValopt) → {Array.<variant>}

Source:
Casts the passed value into an array.
Parameters:
Name Type Attributes Default Description
x variant Value to interrogate.
vDefaultVal variant <optional>
[] Value representing the default return value if casting fails.
Returns:
Type Description
Array.<variant> Value representing the passed value as an array type.

ish.type.arr.of(x, vTest) → {boolean}

Source:
Determines if the passed array only contains values that conform to the passed test.
Parameters:
Name Type Description
x Array.<variant> Values to interrogate.
vTest function | string Value representing the test function (accepting one argument, returning truthy) or a string referencing a type under ish.type.
Returns:
Type Description
boolean Value representing if the passed array only contains values that conform to the passed test.

[mixin] ish.type.arr.pagination(a_vData, oOptionsopt) → {object|Array.<object>|Array.<variant>|integer|integer|integer|integer|function|function}

Source:
Creates an interface that represents the pagination information.
From Mixin: ish.type.arr.pagination.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Description
a_vData Array.<variant> Value representing the array of data.
oOptions object <optional>
Value representing the following options:
Properties
Name Type Attributes Default Description
current integer <optional>
1 Value representing the current page.
pageSize integer <optional>
10 Value representing the page size.
maxPagesToShow integer <optional>
10 Value representing the max pages to show.
showPrevNext boolean <optional>
false Value representing if the previous/next controls will be shown.
Returns:
Name Type Description
interface object Value representing the following properties:
Properties
Name Type Description
pages Array.<object> Value representing the pagination's page descriptions; { clickable: boolean, isCurrent: boolean, label: string, page: integer }.
data Array.<variant> Value representing the pagination's data.
current integer Value representing the pagination's current page.
pageSize integer Value representing the pagination's page size.
maxPagesToShow integer Value representing the pagination's max number of pages to show.
showPrevNext integer Value representing the pagination's max number of pages to show.
slice function Determines the current page's records; slice().
set function Sets the current page; set(iPage):
iPageintegerValue representing the page to set as current.

[mixin] ish.type.arr.randomize(x) → {Array.<variant>}

Source:
Randomizes the entries within the passed value.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
x Array.<variant> Value to interrogate.
Returns:
Type Description
Array.<variant> Value representing the passed value's randomized entries.

ish.type.arr.rm(a_vArray, vTargets, vReplacements) → {boolean}

Source:
Removes the passed target(s) from the passed array (optionally replacing them with updated values).
Parameters:
Name Type Description
a_vArray Array.<variant> Values to interrogate.
vTargets variant | Array.<variant> Value(s) to remove.
vReplacements variant | Array.<variant> Value(s) to replace the removed items.
Note: The number of replacements must match the number of targets.
Returns:
Type Description
boolean Value representing if one or more of the passed value(s) were successfully removed / replaced.

[mixin] ish.type.arr.sort(x, bReverse) → {Array.<variant>}

Source:
See:
Sorts the entries in the passed value into a new array via Javascript's default sort.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
x Array.<variant> Value representing the array to interrogate.
bReverse boolean Value representing if the entries are to be reversed.
Returns:
Type Description
Array.<variant> Value the entries in the passed value into a new array via Javascript's default sort.

[mixin] ish.type.arr.sort.by(x, oOptionsopt) → {Array.<variant>}

Source:
Sorts the entries in the passed value into a new array via the comparator.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Description
x Array.<variant> Value representing the array to interrogate.
oOptions object <optional>
Value representing the following options:
Properties
Name Type Attributes Default Description
path string <optional>
"" Value representing the path to the requested property as a period-delimited string (e.g. "parent.child.array.0.key") or an array of strings.
reverse boolean <optional>
false Value representing if the entries are to be reversed.
compare function <optional>
function (a, b) { return ish.resolve(a, oOptions.path) > ish.resolve(b, oOptions.path); } Value representing the function that implements the compare, accepting 2 arguments (a, b) and returning truthy if a > b.
Returns:
Type Description
Array.<variant> Value representing the entries in the passed value into a new array via the comparator.

[mixin] ish.type.arr.sort.natural(x, bReverse) → {Array.<variant>}

Source:
See:
Sorts the entries in the passed value into a new array via a natural sort.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
x Array.<variant> Value representing the array to interrogate.
bReverse boolean Value representing if the entries are to be reversed.
Returns:
Type Description
Array.<variant> Value representing the entries in the passed value into a new array via a natural sort.

[mixin] ish.type.arr.unique(x, vOptionsopt) → {Array.<variant>}

Source:
Determines the unique entries within the passed value.
From Mixin: ish.type-ex.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
x Array.<variant> Value representing the array to compare.
vOptions object | boolean <optional>
false Value representing if the passed value is to be compared in a case-insensitive manor.
Properties
Name Type Attributes Default Description
caseInsensitive boolean <optional>
false Value representing if the keys are to be searched for in a case-insensitive manor.
path string <optional>
"" Value representing the path to the requested property as a period-delimited string (e.g. "parent.child.array.0.key") or an array of strings.
Returns:
Type Description
Array.<variant> Value representing the passed values' unique entries.