-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(csv): add/update CSVOpts, cell transforms, docs
- allow arrays for `cols` option - update initIndex(), add column autonaming fallback - refactor parseCSV() - rename CoercionFn => CellTransform - add upper/lower() transforms - add/update tests
- Loading branch information
1 parent
28cac18
commit 282e85c
Showing
6 changed files
with
239 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./api"; | ||
export * from "./coerce"; | ||
export * from "./parse"; | ||
export * from "./transforms"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { maybeParseFloat, maybeParseInt } from "@thi.ng/strings"; | ||
import { CellTransform } from "./api"; | ||
|
||
export const upper: CellTransform = (x) => x.toUpperCase(); | ||
|
||
export const lower: CellTransform = (x) => x.toLowerCase(); | ||
|
||
export const float = (defaultVal = 0): CellTransform => (x) => | ||
maybeParseFloat(x, defaultVal); | ||
|
||
export const int = (defaultVal = 0): CellTransform => (x) => | ||
maybeParseInt(x, defaultVal, 10); | ||
|
||
export const hex = (defaultVal = 0): CellTransform => (x) => | ||
maybeParseInt(x, defaultVal, 16); |
Oops, something went wrong.