aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2022-01-22 23:21:34 -0500
committerPriyansh <[email protected]>2022-01-22 23:21:34 -0500
commit476e4574c8b0d0cf118e556f4b97be07143d2482 (patch)
tree27fe2d22d33d4ee1329bdbda3001390f44b543da
parent9e486eb652d0f8576dd2d70dfb296f763320eeb4 (diff)
downloadizuku.js-476e4574c8b0d0cf118e556f4b97be07143d2482.tar.xz
izuku.js-476e4574c8b0d0cf118e556f4b97be07143d2482.zip
docs: add find() function
-rw-r--r--README.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/README.md b/README.md
index 94a18d6..b39b908 100644
--- a/README.md
+++ b/README.md
@@ -248,6 +248,29 @@ const headers = [...];
const frame = new Frame().header(headers).fromCSV(csvPath);
```
+### `find()` ![](https://img.shields.io/badge/chainable-green.svg?style=plastic)
+
+The `find()` method is used to find the rows that match the given condition. It takes a string or a number as an argument which is needed to be found in the frame. Optionally, it also takes an `options` object as as the second argument.
+
+The valid options are defined below:
+
+ - `row`: The row index to seach in. Can also be an array of row indexes.
+ - `column`: The column name or index to search in. Can also be an array of column names or indexes.
+ - `strict`: If `true`, the search will be performed on the exact value. If `false`, the search will be performed on the value as a substring. Default is `false`.
+
+> **Hint**: You can also combine the `range()` helper method to pass a range of rows or columns.
+
+```js
+// find all the rows with value 'John' in column 'Name'
+const row = frame.find('John', {column: 'Name'});
+
+// find all the rows with value 'John' in columns 0, 1 and 2. Perform a strict search
+const row = frame.find('John', {column: [0, 1, 2], strict: true});
+
+// find all the rows with value 'John' in columns 0, 1 and 2 and rows 3, 4 and 5. Perform a non-strict search
+const row = frame.find('John', {column: [0, 1, 2], row: [3, 4, 5], strict: false});
+```
+
### `head()` ![](https://img.shields.io/badge/not%20chainable-red.svg?style=plastic)