feat: improvements#136
Merged
Merged
Conversation
New utilities: - sortBy(): comparator factory with dotted paths, descending, case-insensitive, tie-breaking, mapping functions - SortMappingFunction type - pascalToKebab(): PascalCase → kebab-case conversion - isArray(): typed array predicate Breaking changes: - ValueType enum members renamed to PascalCase (e.g. ValueType.String, ValueType.Array) - difference() now returns a copy of the first array when values is empty (previously returned []) isEqual rewrite: - Removed Moment.js dependency - Added cycle detection (WeakMap<object, WeakSet<object>>) - Uses Reflect.ownKeys + propertyIsEnumerable for property comparison - Added bigint and symbol to IndividualEqualityType - More accurate ArrayBuffer.isView byte-level comparison Other improvements: - typeOf: removed isMoment, value: any → unknown, improved constructorName null safety - isEmpty: uses Reflect.ownKeys for object empty check, cleaner types (no namespace) - isPlainObject: uses Object.getPrototypeOf for null-prototype check - isMergeableObject: fixed filename typo (isMergable → isMergeable), added Map/Set/WeakMap/WeakSet/ArrayBuffer checks - merge: readonly MergeOptions, function overloads, prototype pollution guards (__proto__/prototype/constructor), symbol key support - randomNumberBetweenRange: validation for non-finite, non-safe-integer, and empty ranges - All simple predicates (isArguments, isBuffer, isDate, isError, isGeneratorObject, isRegExp, isBoolean, isNumber, isString, isObject, isNullOrUndefined, isNaNStrict): value: any → value: unknown - package.json exports: added types condition for import and require - README: documented new functions, fixed isMergableObject typo, updated ValueType note
BREAKING - ValueType enum members renamed to PascalCase throughout (ValueType.String, ValueType.Array, etc. — string values unchanged) - All src/ filenames converted from camelCase to kebab-case - Moment.js removed from typeOf, isEqual, and clone New utilities - sortBy: comparator factory for Array.prototype.sort with dot-notation, descending (-), case-insensitive (^), null-first, and mapping function support - pascalToKebab: converts PascalCase strings to kebab-case - isArray: type predicate returning value is unknown[] - isMergeableObject: corrected spelling (was isMergableObject) API improvements - typeOf: value parameter typed as unknown; all enum members PascalCase - isEqual: cycle detection (WeakMap); bigint and symbol added to IndividualEqualityType; Reflect.ownKeys → Object.keys (58% perf gain); lazy WeakMap creation eliminates allocation cost on primitive comparisons - isEmpty: Reflect.ownKeys for object empty-check; flat type aliases - isPlainObject: typed unknown; Object.getPrototypeOf(value) === null fast path - isMergeableObject: Map, Set, WeakMap, WeakSet, ArrayBuffer, ArrayBuffer.isView added to isSpecial() - merge: readonly MergeOptions; function overloads; prototype pollution protection (__proto__, prototype, constructor); symbol key support - difference: readonly params; returns array.slice() when values is empty - randomNumberBetweenRange: validates Number.isFinite, Number.isSafeInteger, range > 0 - clone: removed Moment.js; proto-first instanceof check order; for..in instead of Object.keys in object clone hot path; fast/slow path split eliminating instanceClone parameter threading overhead Testing - Migrate from Karma/Playwright browser mode to Vitest with jsdom environment - isVisible.spec.ts excluded (requires real browser layout engine) - is-equal.spec.ts rewritten as data-driven from isEqualTestDefinitions - Additional isEqual test cases added to definitions (null/false, bool/null, bool/undefined, bool/) Build - tsconfig.mjs.json and tsconfig.cjs.json: add rootDir (TypeScript 6 required) - tsconfig.cjs.json: override types to ["node"] to avoid vitest/vite resolution errors under node10 moduleResolution - tsconfig.json: add vitest/globals, benchmark.ts, eslint.config.mts, vitest.setup.ts to include - benchmark.ts: fix CJS imports (clone-deep, deepmerge, fast-deep-equal); switch library imports to pre-built dist/mjs README - Remove Moment.js references from clone and isEqual docs - Add bigint and symbol to IndividualEqualityType list - Fix benchmark link paths to renamed spec files - Fix capitaliseFirst/capitaliseLast heading levels and ToC nesting
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



New utilities:
Breaking changes:
isEqual rewrite:
Other improvements: