Skip to content

Commit

Permalink
feat: export individual cleaner functions
Browse files Browse the repository at this point in the history
Export `cleanString` etc. for better tree shaking
  • Loading branch information
IlyaSemenov committed Dec 24, 2022
1 parent 07e5d7d commit dc2d434
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
10 changes: 10 additions & 0 deletions packages/data-cleaner/src/clean/index-ns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export { cleanAny as any, AnySchema } from "./any"
export { cleanArray as array, ArraySchema } from "./array"
export { cleanBoolean as boolean, BooleanSchema } from "./boolean"
export { cleanDate as date, DateSchema } from "./date"
export { cleanEmail as email, EmailSchema } from "./email"
export { cleanFloat as float, FloatSchema } from "./float"
export { cleanInteger as integer, IntegerSchema } from "./integer"
export { cleanObject as object, ObjectSchema } from "./object"
export { cleanString as string, StringSchema } from "./string"
export { cleanUuid as uuid, UuidSchema } from "./uuid"
20 changes: 10 additions & 10 deletions packages/data-cleaner/src/clean/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export { cleanAny as any, AnySchema } from "./any"
export { cleanArray as array, ArraySchema } from "./array"
export { cleanBoolean as boolean, BooleanSchema } from "./boolean"
export { cleanDate as date, DateSchema } from "./date"
export { cleanEmail as email, EmailSchema } from "./email"
export { cleanFloat as float, FloatSchema } from "./float"
export { cleanInteger as integer, IntegerSchema } from "./integer"
export { cleanObject as object, ObjectSchema } from "./object"
export { cleanString as string, StringSchema } from "./string"
export { cleanUuid as uuid, UuidSchema } from "./uuid"
export * from "./any"
export * from "./array"
export * from "./boolean"
export * from "./date"
export * from "./email"
export * from "./float"
export * from "./integer"
export * from "./object"
export * from "./string"
export * from "./uuid"
2 changes: 2 additions & 0 deletions packages/data-cleaner/src/errors/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./SchemaError"
export * from "./ValidationError"
15 changes: 12 additions & 3 deletions packages/data-cleaner/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// allows:
// import { cleanString } from "data-cleaner"
// cleanString()
export * from "./clean"
export * as clean from "./clean"
export * from "./errors/SchemaError"
export * from "./errors/ValidationError"
// [DEPRECATED] allows:
// import * as clean from "data-cleaner"
// clean.string()
export * from "./clean/index-ns"
// allows:
// import { clean } from "data-cleaner"
// clean.string()
export * as clean from "./clean/index-ns"
export * from "./errors"
export * from "./types"

0 comments on commit dc2d434

Please sign in to comment.