PrimalArray
PrimalArray a cross-platform JavaScript array library.[1]
Original author(s) | Linas Samušas |
---|---|
Stable release | 2.0.0
|
Written in | JavaScript |
Engine | |
Operating system | Cross-platform |
Type | JavaScript library |
License | CC-ND |
Website | primalarray |
Search PrimalArray on Amazon.
Features[edit]
PrimalArray JavaScript array library has been created to provide easy, fast and efficient method to access and manipulate JavaScript arrays.
Distribution[edit]
The PrimalArray library is distributed as a single JavaScript file that defines all its array functions. It can be included within a Web page by linking to a local copy, or by CDN linking.
Local linking a copy of the library:
<script src="primalarray-v2.0.0-mini.js"></script>
Public CDN linking a copy of the library:
<script
src="https://cdn.rawgit.com/PrimalArray/lib/e36ad0bb/v2.0.0-mini.js"
integrity="sha384-qJyJMKr2MEkLldElljDcMFxkNb1HgQWrCgxZNk9N8r/SBw2rAsLupo7fMVioBvzJ"
crossorigin="anonymous">
</script>
Examples[edit]
Access PrimalArray core.[2]
<script>
var p = new primal();
/* ... code ... */
</script>
Example of arrayNumber function.[3]
<script>
/* primalArray v2.0.0 */
var array = ["one", 789, "two", 123, "67", 98.4, "unit", "0.23"], newArray;
newArray = primal.arrayNumber(array);
/* newArray = [789, 123, '67', 98.4, '0.23'] - returns number and numeric string */
newArray = primal.arrayNumber(array, false);
/* newArray = [789, 123, 67, 98.4, 0.23] - returns number only*/
</script>
Example of arrayRange function.[4]
<script>
/* primalArray v2.0.0 */
var array = [];
array = primal.arrayRange(0, 10);
/* array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] */
array = primal.arrayRange(-5, 5);
/* array = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5] */
array = primal.arrayRange("a", "f");
/* array = ['a', 'b', 'c', 'd', 'e', 'f'] */
</script>
Example of arraySort function.[5]
<script>
/* primalArray v2.0.0 */
var arrayNumber = [ 21, 2, 53, 3, 88, 7],
arrayString = [ "a", "f", "B", "c", "E", "d"],
arrayMixed = [ "a", "f", 21, 2, "53", 3, 88, "7"];
primal.arraySort(arrayNumber);
/* arrayNumber = [ 2, 3, 7, 21, 53, 88 ] */
primal.arraySort(arrayString);
/* arrayString = [ 'a', 'B', 'c', 'd', 'E', 'f' ] */
primal.arraySort(arrayMixed);
/* arrayMixed = [ 2, 3, '7', 21, '53', 88, 'a', 'f' ] */
primal.arraySort(arrayNumber, false);
/* arrayNumber = [ 88, 53, 21, 7, 3, 2 ] */
primal.arraySort(arrayString, false);
/* arrayString = [ 'f', 'E', 'd', 'c', 'B', 'a' ] */
</script>
References[edit]
External links[edit]
Official website
Official API documentation
This article "PrimalArray" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:PrimalArray. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.