aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2022-01-20 21:50:58 -0500
committerPriyansh <[email protected]>2022-01-20 21:50:58 -0500
commit72395e3e6388b9ea5cc7b3528f6f1d4dc80f2233 (patch)
tree62da4ed88657712b96d8591d1355e6428730999b
parente82b2e6163a69337114fb98c0ebd774c98448183 (diff)
downloadizuku.js-72395e3e6388b9ea5cc7b3528f6f1d4dc80f2233.tar.xz
izuku.js-72395e3e6388b9ea5cc7b3528f6f1d4dc80f2233.zip
docs: add range()
-rw-r--r--README.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/README.md b/README.md
index 395ed75..73ff719 100644
--- a/README.md
+++ b/README.md
@@ -268,6 +268,44 @@ Data Types: string(26), number(8), object(1), undefined(1)
Memory Usage: 550 bytes
```
+## Helper Methods
+
+Helper methods are methods that are used to help you with some common tasks. They are not chainable. They are not required to use the frame methods.
+
+### `range()`
+
+`range()` is a helper method that is used to create a an array of numbers. Here are the arguments and their default values:
+
+
+| Argument | Description | Default Value |
+|----------|-------------|-------------- |
+| `start` | The start of the range | Required |
+| `end` | The end of the range | Required |
+| `step` | The step size of the range | 1 |
+| `remove` | An array of numbers which should not be included in the range | `undefined` |
+
+> Note: The `step` and `remove` arguments are optional. If you do not provide it, `step` will be set to 1 and `remove` will be set to `undefined`.
+
+#### Example
+
+```js
+range(0, 10);
+// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+
+range(0, 10, 2);
+// [0, 2, 4, 6, 8, 10]
+
+range(0, 10, 2, [1, 3, 5, 7, 9]);
+// [0, 2, 4, 6, 8]
+```
+
+#### Example with frame
+
+```js
+// Get all columns from 2 to 6
+const columns = frame.column(range(2, 6));
+```
+
## Chaining Methods
Since, the row and column methods return a new frame, you can chain them together to get the data of multiple rows and columns. The following example shows how to get the data of multiple rows and columns.