diff options
| author | Priyansh <[email protected]> | 2022-01-22 23:21:34 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2022-01-22 23:21:34 -0500 |
| commit | 476e4574c8b0d0cf118e556f4b97be07143d2482 (patch) | |
| tree | 27fe2d22d33d4ee1329bdbda3001390f44b543da | |
| parent | 9e486eb652d0f8576dd2d70dfb296f763320eeb4 (diff) | |
| download | izuku.js-476e4574c8b0d0cf118e556f4b97be07143d2482.tar.xz izuku.js-476e4574c8b0d0cf118e556f4b97be07143d2482.zip | |
docs: add find() function
| -rw-r--r-- | README.md | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -248,6 +248,29 @@ const headers = [...]; const frame = new Frame().header(headers).fromCSV(csvPath); ``` +### `find()`  + +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()`  |
