Skip to content

Commit 912f803

Browse files
authored
Merge pull request #199 from basiljs/chore/update-docs
chore: Update Basil.js api to latest state 💈
2 parents e3510dd + 2ba3af4 commit 912f803

File tree

12 files changed

+3881
-1892
lines changed

12 files changed

+3881
-1892
lines changed

_source/_data/categories.json

Lines changed: 130 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@
780780
"codetitle": "unhex(hex)"
781781
},
782782
{
783-
"name": "CSV.decode",
784-
"description": "Function parses a string as CSV-object Array.",
783+
"name": "CSV.parse",
784+
"description": "Function parses a string as CSV-object Array, with optional custom delimiter.",
785785
"returns": {
786786
"name": null,
787787
"description": "Returns CSV-object Array",
@@ -799,45 +799,10 @@
799799
"type": [
800800
"String"
801801
]
802-
}
803-
],
804-
"kind": "function",
805-
"tags": [
806-
{
807-
"title": "summary",
808-
"description": "Decodes a CSV string to an array."
809802
},
810-
{
811-
"title": "description",
812-
"description": "Function parses a string as CSV-object Array."
813-
}
814-
],
815-
"examples": [
816-
{
817-
"description": null,
818-
"code": "var arr = CSV.decode(str);\nvar str = CSV.encode(arr);"
819-
}
820-
],
821-
"todo": null,
822-
"summary": "Decodes a CSV string to an array.",
823-
"codetitle": "CSV.decode(String)"
824-
},
825-
{
826-
"name": "CSV.delimiter",
827-
"description": "Sets the delimiter of the CSV decode and encode function.",
828-
"returns": {
829-
"name": null,
830-
"description": "Returns the current delimiter if called without argument",
831-
"type": [
832-
"String"
833-
]
834-
},
835-
"category": "Data",
836-
"subcategory": "CSV",
837-
"parameters": [
838803
{
839804
"name": "delimiter",
840-
"description": "Optional Sets the delimiter for CSV parsing",
805+
"description": "optional character[s] used to separate data.",
841806
"optional": true,
842807
"type": [
843808
"String"
@@ -848,21 +813,26 @@
848813
"tags": [
849814
{
850815
"title": "summary",
851-
"description": "Sets the delimiter of the CSV decode and encode function."
816+
"description": "Parses (decodes) a CSV string to an array."
852817
},
853818
{
854819
"title": "description",
855-
"description": "Sets the delimiter of the CSV decode and encode function."
820+
"description": "Function parses a string as CSV-object Array, with optional custom delimiter."
821+
}
822+
],
823+
"examples": [
824+
{
825+
"description": null,
826+
"code": "var arr = CSV.parse(str);\nvar str = CSV.stringify(arr);"
856827
}
857828
],
858-
"examples": [],
859829
"todo": null,
860-
"summary": "Sets the delimiter of the CSV decode and encode function.",
861-
"codetitle": "CSV.delimiter([delimiter])"
830+
"summary": "Parses (decodes) a CSV string to an array.",
831+
"codetitle": "CSV.parse(String, [delimiter])"
862832
},
863833
{
864-
"name": "CSV.encode",
865-
"description": "Function convert an javascript array of objects to a CSV-string.",
834+
"name": "CSV.stringify",
835+
"description": "Function convert an javascript array of objects to a CSV-string, with optional custom delimiter.",
866836
"returns": {
867837
"name": null,
868838
"description": "Returns CSV-string",
@@ -880,28 +850,36 @@
880850
"type": [
881851
"Array"
882852
]
853+
},
854+
{
855+
"name": "delimiter",
856+
"description": "optional character[s] used to separate data.",
857+
"optional": true,
858+
"type": [
859+
"String"
860+
]
883861
}
884862
],
885863
"kind": "function",
886864
"tags": [
887865
{
888866
"title": "summary",
889-
"description": "Encodes an array to a CSV string."
867+
"description": "Stringifies (encodes) an array to a CSV string."
890868
},
891869
{
892870
"title": "description",
893-
"description": "Function convert an javascript array of objects to a CSV-string."
871+
"description": "Function convert an javascript array of objects to a CSV-string, with optional custom delimiter."
894872
}
895873
],
896874
"examples": [
897875
{
898876
"description": null,
899-
"code": "var str = CSV.encode(arr);\nvar arr = CSV.decode(str);"
877+
"code": "var str = CSV.stringify(arr);\nvar arr = CSV.parse(str);"
900878
}
901879
],
902880
"todo": null,
903-
"summary": "Encodes an array to a CSV string.",
904-
"codetitle": "CSV.encode(Array)"
881+
"summary": "Stringifies (encodes) an array to a CSV string.",
882+
"codetitle": "CSV.stringify(Array, [delimiter])"
905883
},
906884
{
907885
"name": "HashList",
@@ -8158,6 +8136,53 @@
81588136
"summary": "Returns a folder.",
81598137
"codetitle": "folder([folderPath])"
81608138
},
8139+
{
8140+
"name": "loadCSV",
8141+
"description": "Reads the contents of a CSV file and returns a CSV-object array with the data. If the file is specified by name as string, the path can point either directly at a file in the document's data directory or be specified as an absolute path.",
8142+
"returns": {
8143+
"name": null,
8144+
"description": "The resulting data object.",
8145+
"type": [
8146+
"Object"
8147+
]
8148+
},
8149+
"category": "Input",
8150+
"subcategory": "Files",
8151+
"parameters": [
8152+
{
8153+
"name": "file",
8154+
"description": "The CSV file name in the document's data directory, an absolute path to a CSV file, a File instance or an URL.",
8155+
"optional": false,
8156+
"type": [
8157+
"String",
8158+
"File"
8159+
]
8160+
},
8161+
{
8162+
"name": "delimiter",
8163+
"description": "optional character[s] used to separate data.",
8164+
"optional": true,
8165+
"type": [
8166+
"String"
8167+
]
8168+
}
8169+
],
8170+
"kind": "function",
8171+
"tags": [
8172+
{
8173+
"title": "summary",
8174+
"description": "Gets and parses the contents of a CSV file."
8175+
},
8176+
{
8177+
"title": "description",
8178+
"description": "Reads the contents of a CSV file and returns a CSV-object array with the data. If the file is specified by name as string, the path can point either directly at a file in the document's data directory or be specified as an absolute path."
8179+
}
8180+
],
8181+
"examples": [],
8182+
"todo": null,
8183+
"summary": "Gets and parses the contents of a CSV file.",
8184+
"codetitle": "loadCSV(file, [delimiter])"
8185+
},
81618186
{
81628187
"name": "loadJSON",
81638188
"description": "Reads the contents of a JSON file and returns an object with the data. If the file is specified by name as string, the path can point either directly at a file in the document's data directory or be specified as an absolute path.",
@@ -8894,6 +8919,61 @@
88948919
"summary": "Prints a message line to the console.",
88958920
"codetitle": "println(msg)"
88968921
},
8922+
{
8923+
"name": "saveCSV",
8924+
"description": "Encodes a CSV-object array to multi-line strings and saves it to a CSV file. If the given file exists it gets overridden.",
8925+
"returns": {
8926+
"name": null,
8927+
"description": "The CSV file the data was written to.",
8928+
"type": [
8929+
"File"
8930+
]
8931+
},
8932+
"category": "Output",
8933+
"subcategory": "Files",
8934+
"parameters": [
8935+
{
8936+
"name": "file",
8937+
"description": "The file name or a File instance.",
8938+
"optional": false,
8939+
"type": [
8940+
"String",
8941+
"File"
8942+
]
8943+
},
8944+
{
8945+
"name": "data",
8946+
"description": "The object to encode and save in the file.",
8947+
"optional": false,
8948+
"type": [
8949+
"Object"
8950+
]
8951+
},
8952+
{
8953+
"name": "delimiter",
8954+
"description": "optional character[s] used to separate data.",
8955+
"optional": true,
8956+
"type": [
8957+
"String"
8958+
]
8959+
}
8960+
],
8961+
"kind": "function",
8962+
"tags": [
8963+
{
8964+
"title": "summary",
8965+
"description": "Encodes a CSV-object array to multi-line strings and saves it to a CSV file."
8966+
},
8967+
{
8968+
"title": "description",
8969+
"description": "Encodes a CSV-object array to multi-line strings and saves it to a CSV file. If the given file exists it gets overridden."
8970+
}
8971+
],
8972+
"examples": [],
8973+
"todo": null,
8974+
"summary": "Encodes a CSV-object array to multi-line strings and saves it to a CSV file.",
8975+
"codetitle": "saveCSV(file, data, [delimiter])"
8976+
},
88978977
{
88988978
"name": "saveJSON",
88998979
"description": "Encodes an object to a JSON string and saves it to a JSON file. If the given file exists it gets overridden.",

0 commit comments

Comments
 (0)