You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,37 @@
3
3
4
4
Despite AutoHotKey (1.1.28 at the moment) supporting Arrays and Function Objects, there are no handy built-in methods for parsing Array data. This project ports most of JavaScript's Array object methods over to AutoHotKey.
5
5
6
+
<<<<<<< HEAD
6
7
### Ported Methods
8
+
=======
9
+
AHK supports [objects](https://autohotkey.com/docs/objects/Object.htm), [arrays](https://autohotkey.com/docs/Objects.htm#Table_of_Contents), and [function objects](https://autohotkey.com/docs/objects/Functor.htm). But it lacks built in methods for functional operation on arrays, like `Array.map()`. JavaScript's Array object has some handy methods; so I ported them over.
10
+
11
+
Since AHK is also prototypical in nature, these could have been added to a base object. For simplicity's sake these are global functions. All methods are prefixed with `array_`.
12
+
13
+
### Usage
14
+
15
+
Just include the `array_.ahk` file and pass functors as arguments when needed. For instance, to double all values in an array:
@@ -27,7 +57,10 @@ Despite AutoHotKey (1.1.28 at the moment) supporting Arrays and Function Objects
27
57
* toString
28
58
* unshift
29
59
60
+
### Sort?
61
+
Considered implementing a `array_sort` quicksort; but currently no immediate need.
30
62
63
+
<<<<<<< HEAD
31
64
### Installation
32
65
There are two options for using importing these functions, either as global functions stored in **array_.ahk** or by extending the built-in Array object stored in **array_base.ahk**. The sorting function in both files depends on the object defined in **array_quicksort.ahk**. This object must be present for sorting to work properly.
33
66
@@ -122,3 +155,31 @@ Class Array_QuickSort {
122
155
A quick and dirty test suite was crafted to make sure these were functioning properly. Each function/method has a test case in the **/tests/** directory. The test runner UI has two tabs representing each library's test results:
Nothing is truely complete without testing, so each `array_<method>` has a test case file in the `tests/` directory.
161
+
162
+
Built a few primitive [test classes](test_suite/tester.ahk) to collect test cases. Management of this test class is located in [testrunner.ahk](testrunner.ahk). Results are output to an edit control in a new window.
163
+
164
+
Sample of [test runner results](testrunner_results.txt):
165
+
166
+
01/22/17 - 19:23:53
167
+
-Conversion of JavaScript's Array methods to AutoHotkey-
0 commit comments