]> git.ardis.lu - csvio/log
csvio
17 months agoAdd tests for createFileStream
Ardis Lu [Mon, 28 Apr 2025 06:14:04 +0000 (23:14 -0700)]
Add tests for createFileStream

17 months agoBlock `cancel()` until `start()` is finished
Ardis Lu [Mon, 28 Apr 2025 06:07:57 +0000 (23:07 -0700)]
Block `cancel()` until `start()` is finished

If `cancel()` is called immediately after the stream is instantiated, it is possible that `start()` is not yet finished setting up the file handle before the `cancel()` logic is executed.

17 months agoRefactor to unpack `options` into private properties
Ardis Lu [Sun, 27 Apr 2025 08:38:12 +0000 (01:38 -0700)]
Refactor to unpack `options` into private properties

This change makes these properties consistent with other classes in this library. This change is also the simplest way to let the TypeScript language server understand that these properties are not null.

17 months agoRefactor to simplify for language server
Ardis Lu [Sun, 27 Apr 2025 08:30:01 +0000 (01:30 -0700)]
Refactor to simplify for language server

The TypeScript language server is not yet capable of understanding that the nullish coalescing assignment will make the property non-null, so it will show a type error. Another workaround would be to assert the property is non-null using a JSDoc equivalent to TypeScript's `!` but that is also not yet supported by JSDoc.

18 months agoDelete outdated docs
Ardis Lu [Fri, 4 Apr 2025 08:27:27 +0000 (01:27 -0700)]
Delete outdated docs

18 months agoTest UTF-16 BE decoding
Ardis Lu [Fri, 4 Apr 2025 07:12:25 +0000 (00:12 -0700)]
Test UTF-16 BE decoding

`utf-16be` is not supported by Node.js's decoder in the `fs` module, but it is supported by the web standard Encoding API. So this is a good test to demonstrate the difference between the two.

18 months agoRemove dependency on Node.js `createReadStream`
Ardis Lu [Fri, 4 Apr 2025 06:51:45 +0000 (23:51 -0700)]
Remove dependency on Node.js `createReadStream`

This change decouples the file reading from the character decoding, which enables use of the web standard Encoding API (`TextDecoderStream`) instead of Node.js's internal decoder. The web standard allows a broader set of encodings.

18 months agoBump Node.js version
Ardis Lu [Thu, 3 Apr 2025 05:32:07 +0000 (22:32 -0700)]
Bump Node.js version

19 months agoBump Node.js version
Ardis Lu [Tue, 18 Mar 2025 05:45:53 +0000 (22:45 -0700)]
Bump Node.js version

19 months agoAdd skip error strategy
Ardis Lu [Thu, 6 Mar 2025 06:55:39 +0000 (22:55 -0800)]
Add skip error strategy

19 months agoBump Node.js version
Ardis Lu [Tue, 4 Mar 2025 08:06:25 +0000 (00:06 -0800)]
Bump Node.js version

19 months agoAdd test for interval with 1 retry
Ardis Lu [Wed, 26 Feb 2025 19:22:54 +0000 (11:22 -0800)]
Add test for interval with 1 retry

19 months agoAdd `interval` option to `retry` strategy
Ardis Lu [Wed, 26 Feb 2025 05:56:37 +0000 (21:56 -0800)]
Add `interval` option to `retry` strategy

19 months agoRename `options.value` to `options.placeholder`
Ardis Lu [Tue, 25 Feb 2025 09:36:27 +0000 (01:36 -0800)]
Rename `options.value` to `options.placeholder`

19 months agoRefactor extra arguments into options object
Ardis Lu [Tue, 25 Feb 2025 09:32:49 +0000 (01:32 -0800)]
Refactor extra arguments into options object

19 months agoRollback null-prototype to object prototype
Ardis Lu [Sat, 22 Feb 2025 09:45:03 +0000 (01:45 -0800)]
Rollback null-prototype to object prototype

Name collision is unlikely and enumeration may be useful. And it is easier for JSDoc to parse normal object initialization than `Object.create`.

19 months agoPin Node.js version
Ardis Lu [Fri, 21 Feb 2025 08:18:38 +0000 (00:18 -0800)]
Pin Node.js version

19 months agoAdd tests for ErrorStrategies
Ardis Lu [Fri, 21 Feb 2025 08:12:33 +0000 (00:12 -0800)]
Add tests for ErrorStrategies

19 months agoFreeze ErrorStrategies and use null prototype
Ardis Lu [Fri, 21 Feb 2025 06:43:01 +0000 (22:43 -0800)]
Freeze ErrorStrategies and use null prototype

This configuration is the most restrictive and fit for its intended purpose as a namespace only.

19 months agoAdd initial error strategies
Ardis Lu [Thu, 20 Feb 2025 07:49:23 +0000 (23:49 -0800)]
Add initial error strategies

20 months agoAdd JSDoc for benchmark utils
Ardis Lu [Mon, 17 Feb 2025 07:01:01 +0000 (23:01 -0800)]
Add JSDoc for benchmark utils

20 months agoAdd links to input and output CSVs
Ardis Lu [Mon, 17 Feb 2025 06:54:29 +0000 (22:54 -0800)]
Add links to input and output CSVs

20 months agoRefactor to simplify functions
Ardis Lu [Sun, 16 Feb 2025 07:38:41 +0000 (23:38 -0800)]
Refactor to simplify functions

20 months agoUse package name for imports
Ardis Lu [Sun, 16 Feb 2025 07:37:23 +0000 (23:37 -0800)]
Use package name for imports

20 months agoMake test input paths relative to the file instead of command
Ardis Lu [Sun, 16 Feb 2025 07:31:43 +0000 (23:31 -0800)]
Make test input paths relative to the file instead of command

Before, `npm test` only worked in the root directory. Now it can run in any directory.

20 months agoUnlink file on keyboard interrupt
Ardis Lu [Sat, 15 Feb 2025 07:06:00 +0000 (23:06 -0800)]
Unlink file on keyboard interrupt

20 months agoReorder test name for easier skimming
Ardis Lu [Sat, 15 Feb 2025 06:43:02 +0000 (22:43 -0800)]
Reorder test name for easier skimming

20 months agoAdd 50MB benchmarks
Ardis Lu [Fri, 14 Feb 2025 07:43:04 +0000 (23:43 -0800)]
Add 50MB benchmarks

20 months agoUse unique pseudorandom seed on each generation
Ardis Lu [Fri, 14 Feb 2025 07:41:54 +0000 (23:41 -0800)]
Use unique pseudorandom seed on each generation

20 months agoUse consistent name length to make it easier to compare outputs
Ardis Lu [Fri, 14 Feb 2025 07:39:37 +0000 (23:39 -0800)]
Use consistent name length to make it easier to compare outputs

20 months agoReplace passthrough options with typeCastOnly
Ardis Lu [Thu, 13 Feb 2025 07:45:40 +0000 (23:45 -0800)]
Replace passthrough options with typeCastOnly

To replicate old behavior (passthrough as string), simply use `type: "string"`.

20 months agoAssert non-nullable type instead of using nullish coalesce
Ardis Lu [Tue, 11 Feb 2025 06:41:02 +0000 (22:41 -0800)]
Assert non-nullable type instead of using nullish coalesce

There will be undefined `decimal` only if the input to `formatToParts` does not contain a decimal. But there will always be a decimal because the input is hardcoded.

The TS language server is not yet intelligent enough to assert it is non-nullable from the hardcoded input, so we need to pass the type hint.

Using nullish coalesce results in an uncovered branch which is impossible to test, so it should be removed.

20 months agoAdd additional tests for uncovered branches
Ardis Lu [Tue, 11 Feb 2025 06:33:25 +0000 (22:33 -0800)]
Add additional tests for uncovered branches

20 months agoDelete unnecessary token
Ardis Lu [Mon, 10 Feb 2025 04:21:02 +0000 (20:21 -0800)]
Delete unnecessary token

Originally intended to match the remaining characters of the rest of the test name, but this is not needed since we only need to match the "large:" prefix.

20 months agoAssert example 1.6 logs to console
Ardis Lu [Mon, 10 Feb 2025 04:12:26 +0000 (20:12 -0800)]
Assert example 1.6 logs to console

20 months agoAdd 1MB benchmark
Ardis Lu [Mon, 10 Feb 2025 04:06:12 +0000 (20:06 -0800)]
Add 1MB benchmark

20 months agoSilence console functions on stdout and instead assert they occurred
Ardis Lu [Sun, 9 Feb 2025 06:58:27 +0000 (22:58 -0800)]
Silence console functions on stdout and instead assert they occurred

This approach makes the test runner output cleaner, and also tests the console calls occurred as expected.

20 months agoExplicitly close file handle
Ardis Lu [Sun, 9 Feb 2025 06:04:59 +0000 (22:04 -0800)]
Explicitly close file handle

Dismisses "Closing a FileHandle object on garbage collection" warnings in tests.

20 months agoAdd cleanup on abort
Ardis Lu [Sun, 9 Feb 2025 06:03:39 +0000 (22:03 -0800)]
Add cleanup on abort

`close()` is NOT called if CSVWriter errors, only `abort()`. So need to call `close()` within `abort()` to finish cleanup.

20 months agoSimplify ReadableStream constructor
Ardis Lu [Sun, 9 Feb 2025 05:18:27 +0000 (21:18 -0800)]
Simplify ReadableStream constructor

20 months agoFix temp files not being deleted
Ardis Lu [Sat, 8 Feb 2025 09:47:24 +0000 (01:47 -0800)]
Fix temp files not being deleted

The test runner will run code inside a test suite block even if the tests inside are skipped, which means the temp file was created but the cleanup `after()` call is skipped. Putting the creation within `before()` makes the temp file creation skipped it the tests are skipped.

20 months agoUpdate prefix to match new project name
Ardis Lu [Sat, 8 Feb 2025 09:31:46 +0000 (01:31 -0800)]
Update prefix to match new project name

20 months agoAdd test for saving progress on uncaught error
Ardis Lu [Fri, 7 Feb 2025 08:29:49 +0000 (00:29 -0800)]
Add test for saving progress on uncaught error

20 months agoDelete leftover flag from debugging
Ardis Lu [Fri, 7 Feb 2025 08:20:38 +0000 (00:20 -0800)]
Delete leftover flag from debugging

20 months agoAdd initial benchmarks
Ardis Lu [Fri, 7 Feb 2025 07:39:55 +0000 (23:39 -0800)]
Add initial benchmarks

20 months agoUpdate example to demonstrate more transformations
Ardis Lu [Wed, 5 Feb 2025 06:26:12 +0000 (22:26 -0800)]
Update example to demonstrate more transformations

20 months agoFix regex to match examples
Ardis Lu [Tue, 4 Feb 2025 07:45:43 +0000 (23:45 -0800)]
Fix regex to match examples

This change allows for the file name convention "wip_ex1_1.js" for in-progress examples.

20 months agoAdd "Abort a transformation" example
Ardis Lu [Mon, 3 Feb 2025 07:51:34 +0000 (23:51 -0800)]
Add "Abort a transformation" example

20 months agoImprove type documentation
Ardis Lu [Thu, 30 Jan 2025 05:28:20 +0000 (21:28 -0800)]
Improve type documentation

20 months agoFix broken test
Ardis Lu [Thu, 30 Jan 2025 05:07:51 +0000 (21:07 -0800)]
Fix broken test

Was previously passing by coincidence. Added an additional check to compare the actual rows vs. status rows.

20 months agoAdd npm script for running test coverage report
Ardis Lu [Tue, 28 Jan 2025 07:26:05 +0000 (23:26 -0800)]
Add npm script for running test coverage report

20 months agoAdd initial large CSV tests
Ardis Lu [Tue, 28 Jan 2025 07:22:04 +0000 (23:22 -0800)]
Add initial large CSV tests

20 months agoAdd test for changing elapsed status
Ardis Lu [Tue, 28 Jan 2025 06:33:02 +0000 (22:33 -0800)]
Add test for changing elapsed status

20 months agoAdd tests for writing raw CSV strings
Ardis Lu [Tue, 28 Jan 2025 06:22:55 +0000 (22:22 -0800)]
Add tests for writing raw CSV strings

20 months agoAdd test for raising non-error rejection
Ardis Lu [Tue, 28 Jan 2025 06:10:24 +0000 (22:10 -0800)]
Add test for raising non-error rejection

20 months agoAdd test for handleHeaders error handling
Ardis Lu [Tue, 28 Jan 2025 06:09:35 +0000 (22:09 -0800)]
Add test for handleHeaders error handling

20 months agoNote that rows includes the header row
Ardis Lu [Mon, 27 Jan 2025 07:04:03 +0000 (23:04 -0800)]
Note that rows includes the header row

20 months agoAdd an example of using CSVWriter status
Ardis Lu [Mon, 27 Jan 2025 07:03:41 +0000 (23:03 -0800)]
Add an example of using CSVWriter status

20 months agoAdd public status property to CSVWriter for tracking progress
Ardis Lu [Mon, 27 Jan 2025 06:43:02 +0000 (22:43 -0800)]
Add public status property to CSVWriter for tracking progress

20 months agoUse consistent casing for types
Ardis Lu [Sun, 26 Jan 2025 07:20:21 +0000 (23:20 -0800)]
Use consistent casing for types

Lowercase for all primitive types except Object and Array, TitleCase for all other types.

20 months agoAdd example to combine retry and graceful failure strategies
Ardis Lu [Sat, 25 Jan 2025 08:03:47 +0000 (00:03 -0800)]
Add example to combine retry and graceful failure strategies

20 months agoAdd header row deletion test
Ardis Lu [Fri, 24 Jan 2025 04:23:55 +0000 (20:23 -0800)]
Add header row deletion test

20 months agoClarify handleHeaders intended usage
Ardis Lu [Fri, 24 Jan 2025 04:23:21 +0000 (20:23 -0800)]
Clarify handleHeaders intended usage

Setting it to an Array<any> is preferred for simple scenarios.

20 months agoAdd example to demonstrate passing a function to handleHeaders
Ardis Lu [Fri, 24 Jan 2025 04:21:43 +0000 (20:21 -0800)]
Add example to demonstrate passing a function to handleHeaders

20 months agoAllow Array<any> and TransformationFunction as inputs to handle headers
Ardis Lu [Fri, 24 Jan 2025 03:47:14 +0000 (19:47 -0800)]
Allow Array<any> and TransformationFunction as inputs to handle headers

This change simplifies the common tasks of (1) renaming headers (just pass the new header array) and (2) appending headers (pass a one-line TransformationFunction). Setting the option to a boolean is the same behavior as includeHeaders.

20 months agoPassthrough encoding option for CSVReader
Ardis Lu [Thu, 23 Jan 2025 06:36:29 +0000 (22:36 -0800)]
Passthrough encoding option for CSVReader

20 months agoAdd missing semicolon
Ardis Lu [Thu, 23 Jan 2025 06:21:20 +0000 (22:21 -0800)]
Add missing semicolon

20 months agoPrepare for npm publish
Ardis Lu [Wed, 22 Jan 2025 06:55:43 +0000 (22:55 -0800)]
Prepare for npm publish

20 months agoRenumber and categorize examples
Ardis Lu [Wed, 22 Jan 2025 05:59:15 +0000 (21:59 -0800)]
Renumber and categorize examples

Headers make the examples easier to skim. Using minor numberings is also useful to later add more examples without having to renumber existing groupings each time.

20 months agoAdd graceful failure example
Ardis Lu [Wed, 22 Jan 2025 05:35:38 +0000 (21:35 -0800)]
Add graceful failure example

20 months agoRefactor CSVNormalizer.fixExcelDate suite to vectors
Ardis Lu [Tue, 21 Jan 2025 05:34:59 +0000 (21:34 -0800)]
Refactor CSVNormalizer.fixExcelDate suite to vectors

20 months agoRefactor CSVNormalizer.fixExcelBigInt suite to vectors
Ardis Lu [Tue, 21 Jan 2025 05:23:46 +0000 (21:23 -0800)]
Refactor CSVNormalizer.fixExcelBigInt suite to vectors

20 months agoRefactor CSVNormalizer.fixExcelNumber suite to vectors
Ardis Lu [Tue, 21 Jan 2025 05:19:40 +0000 (21:19 -0800)]
Refactor CSVNormalizer.fixExcelNumber suite to vectors

20 months agoRun formatter
Ardis Lu [Tue, 21 Jan 2025 05:19:16 +0000 (21:19 -0800)]
Run formatter

20 months agoRefactor expandScientificNotation suite to vectors
Ardis Lu [Tue, 21 Jan 2025 05:12:53 +0000 (21:12 -0800)]
Refactor expandScientificNotation suite to vectors

20 months agoUse CRLF line endings
Ardis Lu [Tue, 21 Jan 2025 04:51:12 +0000 (20:51 -0800)]
Use CRLF line endings

20 months agoRefactor toCamelCase suite to vectors
Ardis Lu [Mon, 20 Jan 2025 09:27:27 +0000 (01:27 -0800)]
Refactor toCamelCase suite to vectors

20 months agoAdd note about maxConcurrent for transformation function
Ardis Lu [Mon, 20 Jan 2025 07:44:36 +0000 (23:44 -0800)]
Add note about maxConcurrent for transformation function

20 months agoSimplify with early returns
Ardis Lu [Mon, 20 Jan 2025 07:40:42 +0000 (23:40 -0800)]
Simplify with early returns

20 months agoRename to csvio
Ardis Lu [Mon, 20 Jan 2025 07:30:06 +0000 (23:30 -0800)]
Rename to csvio

20 months agoUse "concurrent" instead of "parallel" to avoid confusion with threads
Ardis Lu [Mon, 20 Jan 2025 07:26:04 +0000 (23:26 -0800)]
Use "concurrent" instead of "parallel" to avoid confusion with threads

20 months agoAdd maxConcurrent option
Ardis Lu [Mon, 20 Jan 2025 07:11:23 +0000 (23:11 -0800)]
Add maxConcurrent option

20 months agoTweak wording
Ardis Lu [Sun, 19 Jan 2025 08:24:25 +0000 (00:24 -0800)]
Tweak wording

20 months agoExpose fix functions as static methods of CSVNormalizer
Ardis Lu [Sun, 19 Jan 2025 08:16:39 +0000 (00:16 -0800)]
Expose fix functions as static methods of CSVNormalizer

These functions may be useful to create custom normalizers.

20 months agoAdd JSDoc type to output rows
Ardis Lu [Sun, 19 Jan 2025 07:56:42 +0000 (23:56 -0800)]
Add JSDoc type to output rows

20 months agoRefactor createCSVDenormalizationStream to CSVDenormalizer
Ardis Lu [Sun, 19 Jan 2025 07:52:59 +0000 (23:52 -0800)]
Refactor createCSVDenormalizationStream to CSVDenormalizer

20 months agoRefactor createCSVNormalizationStream to CSVNormalizer
Ardis Lu [Sun, 19 Jan 2025 07:47:34 +0000 (23:47 -0800)]
Refactor createCSVNormalizationStream to CSVNormalizer

20 months agoMake transform and flush private methods
Ardis Lu [Sun, 19 Jan 2025 07:35:50 +0000 (23:35 -0800)]
Make transform and flush private methods

Should've been private from the start to match pre-refactor.

20 months agoMove arrayToCSVString to be a static method of CSVWriter
Ardis Lu [Sun, 19 Jan 2025 07:25:37 +0000 (23:25 -0800)]
Move arrayToCSVString to be a static method of CSVWriter

This function is useful as part of the external API to make it easier to generate raw outputs for low-level transformations.

20 months agoRefactor createCSVWritableStream to CSVWriter
Ardis Lu [Sun, 19 Jan 2025 07:17:16 +0000 (23:17 -0800)]
Refactor createCSVWritableStream to CSVWriter

20 months agoRefactor createCSVReadableStream to CSVReader
Ardis Lu [Sun, 19 Jan 2025 06:55:36 +0000 (22:55 -0800)]
Refactor createCSVReadableStream to CSVReader

20 months agoPopulate JSDoc descriptions for TransformationFunction
Ardis Lu [Sun, 19 Jan 2025 06:24:33 +0000 (22:24 -0800)]
Populate JSDoc descriptions for TransformationFunction

20 months agoRefactor createCSVTransformStream to CSVTransformer
Ardis Lu [Sun, 19 Jan 2025 06:22:29 +0000 (22:22 -0800)]
Refactor createCSVTransformStream to CSVTransformer

Using classes is more aligned with existing stream APIs such as TextEncoder and CompressionStream.

20 months agoAdd maxBatchSize option
Ardis Lu [Sat, 18 Jan 2025 07:52:29 +0000 (23:52 -0800)]
Add maxBatchSize option

Although this functionality could be implemented by end-users by returning null in the transformation function until a batch is accumulated, baking it into the transform stream simplifies this common use case.

20 months agoSplit out TransformationInput and TransformationOutput types
Ardis Lu [Sat, 18 Jan 2025 07:18:03 +0000 (23:18 -0800)]
Split out TransformationInput and TransformationOutput types

20 months agoSplit out TransformationFunction callback function signature
Ardis Lu [Sat, 18 Jan 2025 07:12:13 +0000 (23:12 -0800)]
Split out TransformationFunction callback function signature

21 months agoAdd onError callback option
Ardis Lu [Wed, 15 Jan 2025 08:28:40 +0000 (00:28 -0800)]
Add onError callback option

21 months agoAlign example to match others
Ardis Lu [Tue, 14 Jan 2025 07:30:12 +0000 (23:30 -0800)]
Align example to match others

21 months agoSimplify and add test cases for parsePathLike
Ardis Lu [Mon, 13 Jan 2025 04:09:40 +0000 (20:09 -0800)]
Simplify and add test cases for parsePathLike

fileURLToPath already throws on unsupported URLs, no need to re-throw.

21 months agoBreak out parsePathLike utility function
Ardis Lu [Sun, 12 Jan 2025 08:11:41 +0000 (00:11 -0800)]
Break out parsePathLike utility function

This page took 0.071193 seconds and 4 git commands to generate.