Skip to content

Commit f9d3eeb

Browse files
committed
Update README docs with _reverse and _slice
1 parent c16a1a7 commit f9d3eeb

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# gdash - GML utility library
22

3-
Version 2.1.0
3+
Version 2.2.0
44

55
## Introduction
66

@@ -28,15 +28,17 @@ gdash is a functional utility library for GML, inspired by [lodash](https://loda
2828
* [`_join(array, joiner)`](#_joinarray-joiner)
2929
* [`_keys(dsMapId)`](#_keysdsmapid)
3030
* [`_length(collection)`](#_lengthcollection)
31-
* [`_log(anything)`](#_loganything)
31+
* [`_log(messages...)`](#_logmessages)
3232
* [`_map(colletion, mapScript)`](#_mapcolletion-mapscript)
3333
* [`_nth(collection, n)`](#_nthcollection-n)
3434
* [`_or(valueA, valueB)`](#_orvaluea-valueb)
3535
* [`_partial(script, arg0, arg1 ... arg13)`](#_partialscript-arg0-arg1--arg13)
3636
* [`_push(array, value)`](#_pusharray-value)
3737
* [`_reduce(collection, reducerScript)`](#_reducecollection-reducerscript)
38+
* [`_reverse(array)`](#_reversearray)
3839
* [`_run(script, arg0, arg1 ... arg13)`](#_runscript-arg0-arg1--arg13)
3940
* [`_set(mapId, locationString, value)`](#_setmapid-locationstring-value)
41+
* [`_slice(array, start[, end])`](#_slicearray-start-end)
4042
* [`_split(string, splitter)`](#_splitstring-splitter)
4143
* [`_spread(script, argArray)`](#_spreadscript-argarray)
4244
* [`_times(script)`](#_timesscript)
@@ -337,11 +339,11 @@ _length(some_list_id_of_size_5);
337339
// => 5
338340
```
339341

340-
### `_log(anything)`
342+
### `_log(messages...)`
341343

342344
Convenience method for `show_debug_message()`
343345

344-
Converts its argument to a string.
346+
Converts its arguments to a string.
345347

346348
### `_map(colletion, mapScript)`
347349

@@ -463,6 +465,21 @@ _reduce(arr, concat);
463465
// => 'helloworld';
464466
```
465467

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+
466483
### `_run(script, arg0, arg1 ... arg13)`
467484

468485
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);
498515
// => {nested: {three: {deep: 2}}}
499516
```
500517

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+
501535
### `_split(string, splitter)`
502536

503537
Returns an array of the given `string` split by the `splitter`

0 commit comments

Comments
 (0)