@fgv/ts-utils
Advanced tools
Comparing version
import * as Conversion from './packlets/conversion'; | ||
import * as Hash from './packlets/hash'; | ||
import * as Validation from './packlets/validation'; | ||
@@ -6,3 +7,3 @@ import { Converter, Converters, ObjectConverter } from './packlets/conversion'; | ||
export * from './packlets/base'; | ||
export { Conversion, Converter, Converters, ObjectConverter, Validation, Validator, Validators }; | ||
export { Conversion, Converter, Converters, Hash, ObjectConverter, Validation, Validator, Validators }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -50,5 +50,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Validators = exports.Validation = exports.ObjectConverter = exports.Converters = exports.Conversion = void 0; | ||
exports.Validators = exports.Validation = exports.ObjectConverter = exports.Hash = exports.Converters = exports.Conversion = void 0; | ||
const Conversion = __importStar(require("./packlets/conversion")); | ||
exports.Conversion = Conversion; | ||
const Hash = __importStar(require("./packlets/hash")); | ||
exports.Hash = Hash; | ||
const Validation = __importStar(require("./packlets/validation")); | ||
@@ -55,0 +57,0 @@ exports.Validation = Validation; |
@@ -37,5 +37,4 @@ import { Result } from './result'; | ||
* @returns A normalized sorted array of entries. | ||
* @internal | ||
*/ | ||
protected _normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[]; | ||
normalizeEntries<T = unknown>(entries: Iterable<Entry<T>>): Entry<T>[]; | ||
protected _normalizeArray(from: unknown[]): Result<unknown[]>; | ||
@@ -46,6 +45,5 @@ /** | ||
* @returns A normalized value for the literal. | ||
* @internal | ||
*/ | ||
protected _normalizeLiteral<T>(from: T): Result<T>; | ||
normalizeLiteral<T>(from: T): Result<T>; | ||
} | ||
//# sourceMappingURL=normalize.d.ts.map |
@@ -45,6 +45,6 @@ "use strict"; | ||
case 'undefined': | ||
return this._normalizeLiteral(from); | ||
return this.normalizeLiteral(from); | ||
case 'object': | ||
if (from === null || from instanceof Date || from instanceof RegExp) { | ||
return this._normalizeLiteral(from); | ||
return this.normalizeLiteral(from); | ||
} | ||
@@ -55,9 +55,9 @@ else if (Array.isArray(from)) { | ||
else if (from instanceof Map) { | ||
return (0, result_1.succeed)(new Map(this._normalizeEntries(from.entries()))); | ||
return (0, result_1.succeed)(new Map(this.normalizeEntries(from.entries()))); | ||
} | ||
else if (from instanceof Set) { | ||
return (0, result_1.succeed)(new Set(this._normalizeEntries(from.entries()))); | ||
return (0, result_1.succeed)(new Set(this.normalizeEntries(from.entries()))); | ||
} | ||
const obj = {}; | ||
for (const e of this._normalizeEntries(Object.entries(from))) { | ||
for (const e of this.normalizeEntries(Object.entries(from))) { | ||
obj[e[0]] = e[1]; | ||
@@ -95,5 +95,4 @@ } | ||
* @returns A normalized sorted array of entries. | ||
* @internal | ||
*/ | ||
_normalizeEntries(entries) { | ||
normalizeEntries(entries) { | ||
return Array.from(entries) | ||
@@ -112,5 +111,4 @@ .sort((e1, e2) => this._compareKeys(e1[0], e2[0])) | ||
* @returns A normalized value for the literal. | ||
* @internal | ||
*/ | ||
_normalizeLiteral(from) { | ||
normalizeLiteral(from) { | ||
// TODO: Apply configurable normalization rules | ||
@@ -117,0 +115,0 @@ switch (typeof from) { |
{ | ||
"name": "@fgv/ts-utils", | ||
"version": "2.1.1-alpha.1", | ||
"version": "2.1.1-alpha.2", | ||
"description": "Assorted Typescript Utilities", | ||
@@ -63,4 +63,5 @@ "main": "lib/index.js", | ||
"luxon": "^3.4.4", | ||
"mustache": "^4.2.0" | ||
"mustache": "^4.2.0", | ||
"crc": "~4.3.2" | ||
} | ||
} |
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 not supported yet
Sorry, the diff of this file is not supported yet
695654
3.12%127
10.43%8492
2.93%3
50%+ Added
+ Added