|
780 | 780 | "codetitle": "unhex(hex)" |
781 | 781 | }, |
782 | 782 | { |
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.", |
785 | 785 | "returns": { |
786 | 786 | "name": null, |
787 | 787 | "description": "Returns CSV-object Array", |
|
799 | 799 | "type": [ |
800 | 800 | "String" |
801 | 801 | ] |
802 | | - } |
803 | | - ], |
804 | | - "kind": "function", |
805 | | - "tags": [ |
806 | | - { |
807 | | - "title": "summary", |
808 | | - "description": "Decodes a CSV string to an array." |
809 | 802 | }, |
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": [ |
838 | 803 | { |
839 | 804 | "name": "delimiter", |
840 | | - "description": "Optional Sets the delimiter for CSV parsing", |
| 805 | + "description": "optional character[s] used to separate data.", |
841 | 806 | "optional": true, |
842 | 807 | "type": [ |
843 | 808 | "String" |
|
848 | 813 | "tags": [ |
849 | 814 | { |
850 | 815 | "title": "summary", |
851 | | - "description": "Sets the delimiter of the CSV decode and encode function." |
| 816 | + "description": "Parses (decodes) a CSV string to an array." |
852 | 817 | }, |
853 | 818 | { |
854 | 819 | "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);" |
856 | 827 | } |
857 | 828 | ], |
858 | | - "examples": [], |
859 | 829 | "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])" |
862 | 832 | }, |
863 | 833 | { |
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.", |
866 | 836 | "returns": { |
867 | 837 | "name": null, |
868 | 838 | "description": "Returns CSV-string", |
|
880 | 850 | "type": [ |
881 | 851 | "Array" |
882 | 852 | ] |
| 853 | + }, |
| 854 | + { |
| 855 | + "name": "delimiter", |
| 856 | + "description": "optional character[s] used to separate data.", |
| 857 | + "optional": true, |
| 858 | + "type": [ |
| 859 | + "String" |
| 860 | + ] |
883 | 861 | } |
884 | 862 | ], |
885 | 863 | "kind": "function", |
886 | 864 | "tags": [ |
887 | 865 | { |
888 | 866 | "title": "summary", |
889 | | - "description": "Encodes an array to a CSV string." |
| 867 | + "description": "Stringifies (encodes) an array to a CSV string." |
890 | 868 | }, |
891 | 869 | { |
892 | 870 | "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." |
894 | 872 | } |
895 | 873 | ], |
896 | 874 | "examples": [ |
897 | 875 | { |
898 | 876 | "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);" |
900 | 878 | } |
901 | 879 | ], |
902 | 880 | "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])" |
905 | 883 | }, |
906 | 884 | { |
907 | 885 | "name": "HashList", |
|
8158 | 8136 | "summary": "Returns a folder.", |
8159 | 8137 | "codetitle": "folder([folderPath])" |
8160 | 8138 | }, |
| 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 | + }, |
8161 | 8186 | { |
8162 | 8187 | "name": "loadJSON", |
8163 | 8188 | "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 | 8919 | "summary": "Prints a message line to the console.", |
8895 | 8920 | "codetitle": "println(msg)" |
8896 | 8921 | }, |
| 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 | + }, |
8897 | 8977 | { |
8898 | 8978 | "name": "saveJSON", |
8899 | 8979 | "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