@effect/schema
Advanced tools
Comparing version 0.73.0 to 0.73.1
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.ownKeys = exports.memoizeThunk = exports.isSingle = exports.isNonEmpty = exports.getKeysForIndexSignature = exports.formatUnknown = exports.formatPropertyKey = exports.formatPathKey = exports.formatPath = void 0; | ||
exports.ownKeys = exports.memoizeThunk = exports.isSingle = exports.isNonEmpty = exports.getKeysForIndexSignature = exports.formatUnknown = exports.formatPropertyKey = exports.formatPathKey = exports.formatPath = exports.formatDate = void 0; | ||
var array_ = _interopRequireWildcard(require("effect/Array")); | ||
@@ -43,7 +43,18 @@ var Predicate = _interopRequireWildcard(require("effect/Predicate")); | ||
exports.memoizeThunk = memoizeThunk; | ||
const formatDate = date => { | ||
try { | ||
return date.toISOString(); | ||
} catch (e) { | ||
return String(date); | ||
} | ||
}; | ||
/** @internal */ | ||
exports.formatDate = formatDate; | ||
const formatUnknown = u => { | ||
if (Predicate.isString(u)) { | ||
return JSON.stringify(u); | ||
} else if (Predicate.isNumber(u) || u == null || Predicate.isBoolean(u) || Predicate.isSymbol(u) || Predicate.isDate(u)) { | ||
} else if (Predicate.isNumber(u) || u == null || Predicate.isBoolean(u) || Predicate.isSymbol(u)) { | ||
return String(u); | ||
} else if (Predicate.isDate(u)) { | ||
return formatDate(u); | ||
} else if (Predicate.isBigInt(u)) { | ||
@@ -50,0 +61,0 @@ return String(u) + "n"; |
@@ -31,7 +31,17 @@ import * as array_ from "effect/Array"; | ||
/** @internal */ | ||
export const formatDate = date => { | ||
try { | ||
return date.toISOString(); | ||
} catch (e) { | ||
return String(date); | ||
} | ||
}; | ||
/** @internal */ | ||
export const formatUnknown = u => { | ||
if (Predicate.isString(u)) { | ||
return JSON.stringify(u); | ||
} else if (Predicate.isNumber(u) || u == null || Predicate.isBoolean(u) || Predicate.isSymbol(u) || Predicate.isDate(u)) { | ||
} else if (Predicate.isNumber(u) || u == null || Predicate.isBoolean(u) || Predicate.isSymbol(u)) { | ||
return String(u); | ||
} else if (Predicate.isDate(u)) { | ||
return formatDate(u); | ||
} else if (Predicate.isBigInt(u)) { | ||
@@ -38,0 +48,0 @@ return String(u) + "n"; |
{ | ||
"name": "@effect/schema", | ||
"version": "0.73.0", | ||
"version": "0.73.1", | ||
"description": "Modeling the schema of data structures as first-class values", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"effect": "^3.8.0" | ||
"effect": "^3.8.1" | ||
}, | ||
@@ -19,0 +19,0 @@ "publishConfig": { |
@@ -41,2 +41,11 @@ import * as array_ from "effect/Array" | ||
/** @internal */ | ||
export const formatDate = (date: Date): string => { | ||
try { | ||
return date.toISOString() | ||
} catch (e) { | ||
return String(date) | ||
} | ||
} | ||
/** @internal */ | ||
export const formatUnknown = (u: unknown): string => { | ||
@@ -50,5 +59,6 @@ if (Predicate.isString(u)) { | ||
|| Predicate.isSymbol(u) | ||
|| Predicate.isDate(u) | ||
) { | ||
return String(u) | ||
} else if (Predicate.isDate(u)) { | ||
return formatDate(u) | ||
} else if (Predicate.isBigInt(u)) { | ||
@@ -55,0 +65,0 @@ return String(u) + "n" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2307564
43009