|
1 | 1 | # gdash - GML utility library |
2 | 2 |
|
3 | | -Version 2.1.0 |
| 3 | +Version 2.2.0 |
4 | 4 |
|
5 | 5 | ## Introduction |
6 | 6 |
|
@@ -28,15 +28,17 @@ gdash is a functional utility library for GML, inspired by [lodash](https://loda |
28 | 28 | * [`_join(array, joiner)`](#_joinarray-joiner) |
29 | 29 | * [`_keys(dsMapId)`](#_keysdsmapid) |
30 | 30 | * [`_length(collection)`](#_lengthcollection) |
31 | | - * [`_log(anything)`](#_loganything) |
| 31 | + * [`_log(messages...)`](#_logmessages) |
32 | 32 | * [`_map(colletion, mapScript)`](#_mapcolletion-mapscript) |
33 | 33 | * [`_nth(collection, n)`](#_nthcollection-n) |
34 | 34 | * [`_or(valueA, valueB)`](#_orvaluea-valueb) |
35 | 35 | * [`_partial(script, arg0, arg1 ... arg13)`](#_partialscript-arg0-arg1--arg13) |
36 | 36 | * [`_push(array, value)`](#_pusharray-value) |
37 | 37 | * [`_reduce(collection, reducerScript)`](#_reducecollection-reducerscript) |
| 38 | + * [`_reverse(array)`](#_reversearray) |
38 | 39 | * [`_run(script, arg0, arg1 ... arg13)`](#_runscript-arg0-arg1--arg13) |
39 | 40 | * [`_set(mapId, locationString, value)`](#_setmapid-locationstring-value) |
| 41 | + * [`_slice(array, start[, end])`](#_slicearray-start-end) |
40 | 42 | * [`_split(string, splitter)`](#_splitstring-splitter) |
41 | 43 | * [`_spread(script, argArray)`](#_spreadscript-argarray) |
42 | 44 | * [`_times(script)`](#_timesscript) |
@@ -337,11 +339,11 @@ _length(some_list_id_of_size_5); |
337 | 339 | // => 5 |
338 | 340 | ``` |
339 | 341 |
|
340 | | -### `_log(anything)` |
| 342 | +### `_log(messages...)` |
341 | 343 |
|
342 | 344 | Convenience method for `show_debug_message()` |
343 | 345 |
|
344 | | -Converts its argument to a string. |
| 346 | +Converts its arguments to a string. |
345 | 347 |
|
346 | 348 | ### `_map(colletion, mapScript)` |
347 | 349 |
|
@@ -463,6 +465,21 @@ _reduce(arr, concat); |
463 | 465 | // => 'helloworld'; |
464 | 466 | ``` |
465 | 467 |
|
| 468 | +### `_reverse(array)` |
| 469 | + |
| 470 | +Reverses a given input array. |
| 471 | + |
| 472 | +``` |
| 473 | +@param {Array} array The array to reverse |
| 474 | +@returns {Array} The reversed array |
| 475 | +
|
| 476 | +@example |
| 477 | +var myArray = _arrayOf(1, 2, 3); |
| 478 | +var reverseArray = _reverse(myArray); |
| 479 | +_isEqual(_arrayOf(3,2,1), reverseArray) |
| 480 | +// => true |
| 481 | +``` |
| 482 | + |
466 | 483 | ### `_run(script, arg0, arg1 ... arg13)` |
467 | 484 |
|
468 | 485 | Executes a script or partial with the provided arguments. Can be used in place of `script_execute` |
@@ -498,6 +515,23 @@ _set(someMap, 'nested.three.deep', 2); |
498 | 515 | // => {nested: {three: {deep: 2}}} |
499 | 516 | ``` |
500 | 517 |
|
| 518 | +### `_slice(array, start[, end])` |
| 519 | + |
| 520 | +Creates a slice of array from start up to, but not including, end. |
| 521 | + |
| 522 | +``` |
| 523 | +@param {Array} array The array to slice |
| 524 | +@param {Integer} start Index to start the slice |
| 525 | +@param {Integer} end(optional) Index up to which to make the slice, defaults to end of array. |
| 526 | +@returns {Array} The sliced array |
| 527 | +
|
| 528 | +@example |
| 529 | +var myArray = _arrayOf(1, 2, 3, 4); |
| 530 | +var slicedArray = _slice(myArray, 1, 3); |
| 531 | +_isEqual(_arrayOf(2,3), slicedArray) |
| 532 | +// => true |
| 533 | +``` |
| 534 | + |
501 | 535 | ### `_split(string, splitter)` |
502 | 536 |
|
503 | 537 | Returns an array of the given `string` split by the `splitter` |
|
0 commit comments