Skip to content

Commit

Permalink
refactor(csv): update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 10, 2021
1 parent 9c6f8b8 commit 6b102d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
11 changes: 8 additions & 3 deletions packages/csv/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { compR, iterator1, Reducer, Transducer } from "@thi.ng/transducers";
import { ESCAPES, split } from "@thi.ng/strings";
import { isArray, isFunction, isIterable } from "@thi.ng/checks";
import type { Nullable } from "@thi.ng/api";
import { isArray } from "@thi.ng/checks/is-array";
import { isFunction } from "@thi.ng/checks/is-function";
import { isIterable } from "@thi.ng/checks/is-iterable";
import { ESCAPES } from "@thi.ng/strings/escape";
import { split } from "@thi.ng/strings/split";
import type { Reducer, Transducer } from "@thi.ng/transducers";
import { compR } from "@thi.ng/transducers/func/compr";
import { iterator1 } from "@thi.ng/transducers/iterator";
import type {
ColumnSpec,
CommonCSVOpts,
Expand Down
20 changes: 13 additions & 7 deletions packages/csv/src/transforms.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { maybeParseFloat, maybeParseInt } from "@thi.ng/strings";
import { maybeParseFloat, maybeParseInt } from "@thi.ng/strings/parse";
import type { 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 float =
(defaultVal = 0): CellTransform =>
(x) =>
maybeParseFloat(x, defaultVal);

export const int = (defaultVal = 0): CellTransform => (x) =>
maybeParseInt(x, defaultVal, 10);
export const int =
(defaultVal = 0): CellTransform =>
(x) =>
maybeParseInt(x, defaultVal, 10);

export const hex = (defaultVal = 0): CellTransform => (x) =>
maybeParseInt(x, defaultVal, 16);
export const hex =
(defaultVal = 0): CellTransform =>
(x) =>
maybeParseInt(x, defaultVal, 16);

0 comments on commit 6b102d0

Please sign in to comment.