Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/node_modules/@stdlib/utils/dsv/base/parse/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
var format = require( '@stdlib/string/format' );
var rescape = require( '@stdlib/utils/escape-regexp-string' );
var replace = require( '@stdlib/string/base/replace' );
var push = require( '@stdlib/utils/push' );
var defaults = require( './defaults.js' );
var state2enum = require( './states/state2enum.js' );
var enum2state = require( './states/enum2state.json' );
Expand Down Expand Up @@ -123,7 +124,7 @@
}
return new Parser();
}
// TODO: option validation; enforce quote, comment, skip, delimiter, escape, and newline all being different and none can be a substring of the other (i.e., no escape equal to `,,` and delimiter equal to `,`, and no delimiter equal to `,` and newline being `,,` and vice versa; is `,,` an escape or simply an empty field?); should probably require that "whitespace" does not conflict with any of the special character sequences; require at least one whitespace character

Check warning on line 127 in lib/node_modules/@stdlib/utils/dsv/base/parse/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: option validation; enforce quote,...'
options = options || {};
opts = defaults();

Expand Down Expand Up @@ -365,12 +366,13 @@
setReadOnly( Parser.prototype, '_setField', function set( value, idx ) {
var buf = this._rowBuffer;

// FIXME: as buffer may be provided from userland, use `set` accessor and consider using `@stdlib/utils/push` to allow support of dynamically resizing fixed length buffers

Check warning on line 369 in lib/node_modules/@stdlib/utils/dsv/base/parse/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: as buffer may be provided from...'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should not be removed, as the proposed changes only partially resolve what is described.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also not clear whether we want to use utils/push here. The reason why this was not done originally was due to performance concerns. As such, I am not convinced that this PR should move forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean the performance concern make sense it is low i mean should we go with caching the buffer type at initialization and using a fast path for arrays?
what u think on it ?

// Partially addressed: `@stdlib/utils/push` is now used to support TypedArrays, but `set` accessor still needs to be implemented.

Check failure on line 370 in lib/node_modules/@stdlib/utils/dsv/base/parse/lib/main.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Missing empty line before comment

// Only expand the row buffer if we've run out of previously allocated memory...
if ( idx >= buf.length ) {
buf.push( value );
debug( 'Row buffer size increased. Length: %d.', buf.length );
this._rowBuffer = push( buf, value );
debug( 'Row buffer size increased. Length: %d.', this._rowBuffer.length );
} else {
// Reuse existing memory:
buf[ idx ] = value;
Expand Down
Loading