Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Commit 8e47c7a

Browse files
Update README.md
1 parent 0f2b21a commit 8e47c7a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,30 @@ To import CSV, use the **fromFile** method
2121
* @param {Number|Number[]} [ignoreLines=0] Ignore lines. Use 0 to use no-ignore lines
2222
* @returns {Object[]} CSV Object
2323
*/
24-
csv.fromFile({file_path},ignoreLines=0);
24+
const myCSV = csv.fromFile({file_path},ignoreLines=0);
25+
```
26+
### From String
27+
To use a string version of CSV to create an object us the **fromString** method
28+
```js
29+
/**
30+
* Converts CSV from string to object
31+
* @param {String} str CSV string
32+
* @param {Number|Number[]} ignoreLines Lines to ignore
33+
* @returns {Object[]} CSV object
34+
*/
35+
const myCSV = csv.fromString(str, ignoreLines=0);
36+
```
37+
38+
### Ignoring lines
39+
Use the **_ignoreLines_** parameter of either a **Number** | **Number[]**. Numbers must be start from 1..., **0** means _no-ignore_ or _skip_
40+
41+
### Tables
42+
To load up the table from an object, use the **toTable** method
43+
```js
44+
/**
45+
* Creates a table off the object
46+
* @param {Object} obj Object of the CSV
47+
* @param {Element} elem Element to target the CSV
48+
*/
49+
csv.toTable(myCSV, {element});
2550
```

0 commit comments

Comments
 (0)