@koine/utils 2.0.0-beta.44 → 2.0.0-beta.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +3 -0
- package/index.d.ts +2 -1
- package/index.esm.js +3 -1
- package/objectMergeWithDefaults.d.ts +6 -0
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -250,6 +250,8 @@ let objectFlip=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,r])=>[r,t?t(e
|
|
|
250
250
|
|
|
251
251
|
let objectPick=(e,t)=>{let r={},l=t.length;for(;l--;)r[t[l]]=e[t[l]];return r};
|
|
252
252
|
|
|
253
|
+
let objectMergeWithDefaults=(t,o)=>o?Object.keys(o).reduce((r,c)=>(isObject(o[c])?(t[c]||(t[c]={}),r[c]=objectMergeWithDefaults(t[c],o[c])):r[c]=void 0===o[c]?t[c]:o[c],r),{...t}):t;
|
|
254
|
+
|
|
253
255
|
let objectOmit=(e,t)=>Object.keys(e).reduce((c,b)=>(t.includes(b)||(c[b]=e[b]),c),{});
|
|
254
256
|
|
|
255
257
|
let objectSortByKeysMatching=(e,t)=>Object.fromEntries(Object.entries(e).sort(([e],[o])=>e===t?-1:e.localeCompare(o)));
|
|
@@ -440,6 +442,7 @@ exports.normaliseUrl = normaliseUrl;
|
|
|
440
442
|
exports.normaliseUrlPathname = normaliseUrlPathname;
|
|
441
443
|
exports.objectFlat = objectFlat;
|
|
442
444
|
exports.objectFlip = objectFlip;
|
|
445
|
+
exports.objectMergeWithDefaults = objectMergeWithDefaults;
|
|
443
446
|
exports.objectOmit = objectOmit;
|
|
444
447
|
exports.objectPick = objectPick;
|
|
445
448
|
exports.objectSortByKeysMatching = objectSortByKeysMatching;
|
package/index.d.ts
CHANGED
|
@@ -110,6 +110,7 @@ export { normaliseUrl } from "./normaliseUrl";
|
|
|
110
110
|
export { objectFlat } from "./objectFlat";
|
|
111
111
|
export { objectFlip } from "./objectFlip";
|
|
112
112
|
export { objectPick } from "./objectPick";
|
|
113
|
+
export { objectMergeWithDefaults, type ObjectMergeWithDefaults, } from "./objectMergeWithDefaults";
|
|
113
114
|
export { objectOmit } from "./objectOmit";
|
|
114
115
|
export { objectSortByKeysMatching } from "./objectSortByKeysMatching";
|
|
115
116
|
export { objectToArray } from "./objectToArray";
|
|
@@ -150,4 +151,4 @@ export { uuid } from "./uuid";
|
|
|
150
151
|
export { uuidNumeric } from "./uuidNumeric";
|
|
151
152
|
export { wait } from "./wait";
|
|
152
153
|
export type { AnythingFalsy, KeysStartsWith, KeysTailsStartsWith, PickStartsWith, PickStartsWithTails, } from "./types";
|
|
153
|
-
export type { KeysOfUnion, EmptyObject, IsEmptyObject, NonEmptyObject, UnknownRecord, UnknownArray, Except, TaggedUnion, Writable, WritableDeep, Merge, MergeDeep, MergeDeepOptions, MergeExclusive, RequireAtLeastOne, RequireExactlyOne, RequireAllOrNone, RequireOneOrNone, OmitIndexSignature, PickIndexSignature, PartialDeep, PartialDeepOptions, RequiredDeep, PickDeep, PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions, UndefinedOnPartialDeep, ReadonlyDeep, LiteralUnion, Promisable, Opaque, UnwrapOpaque, Tagged, UnwrapTagged, InvariantOf, SetOptional, SetReadonly, SetRequired, SetNonNullable, ValueOf, AsyncReturnType, ConditionalExcept, ConditionalKeys, ConditionalPick, ConditionalPickDeep, ConditionalPickDeepOptions, UnionToIntersection, Stringified, FixedLengthArray, MultidimensionalArray, MultidimensionalReadonlyArray, IterableElement, Entry, Entries, SetReturnType, SetParameterType, Asyncify, Simplify, Jsonify, Jsonifiable, Schema, LiteralToPrimitive, LiteralToPrimitiveDeep, PositiveInfinity, NegativeInfinity, Finite, Integer, Float, NegativeFloat, Negative, NonNegative, NegativeInteger, NonNegativeInteger, StringKeyOf, Exact, ReadonlyTuple, OptionalKeysOf, OverrideProperties, HasOptionalKeys, RequiredKeysOf, HasRequiredKeys, ReadonlyKeysOf, HasReadonlyKeys, WritableKeysOf, HasWritableKeys, Spread, TupleToUnion, IntRange, IsEqual, IsLiteral, IsStringLiteral, IsNumericLiteral, IsBooleanLiteral, IsSymbolLiteral, IsAny, IfAny, IsNever, IfNever, IsUnknown, IfUnknown, ArrayIndices, ArrayValues, SetFieldType, Paths, SharedUnionFieldsDeep, CamelCase, CamelCasedProperties, CamelCasedPropertiesDeep, KebabCase, KebabCasedProperties, KebabCasedPropertiesDeep, PascalCase, PascalCasedProperties, PascalCasedPropertiesDeep, SnakeCase, SnakeCasedProperties, SnakeCasedPropertiesDeep, ScreamingSnakeCase, DelimiterCase, DelimiterCasedProperties, DelimiterCasedPropertiesDeep, Join, Split, Trim, Replace, Includes, Get, LastArrayElement, GlobalThis, PackageJson, TsConfigJson, } from "type-fest";
|
|
154
|
+
export type { KeysOfUnion, EmptyObject, IsEmptyObject, NonEmptyObject, UnknownRecord, UnknownArray, Except, TaggedUnion, Writable, WritableDeep, Merge, MergeDeep, MergeDeepOptions, MergeExclusive, RequireAtLeastOne, RequireExactlyOne, RequireAllOrNone, RequireOneOrNone, OmitIndexSignature, PickIndexSignature, PartialDeep, PartialDeepOptions, RequiredDeep, PickDeep, PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions, UndefinedOnPartialDeep, ReadonlyDeep, LiteralUnion, Promisable, Opaque, UnwrapOpaque, Tagged, UnwrapTagged, InvariantOf, SetOptional, SetReadonly, SetRequired, SetNonNullable, ValueOf, AsyncReturnType, ConditionalExcept, ConditionalKeys, ConditionalPick, ConditionalPickDeep, ConditionalPickDeepOptions, UnionToIntersection, Stringified, FixedLengthArray, MultidimensionalArray, MultidimensionalReadonlyArray, IterableElement, Entry, Entries, SetReturnType, SetParameterType, Asyncify, Simplify, Jsonify, Jsonifiable, JsonObject, Schema, LiteralToPrimitive, LiteralToPrimitiveDeep, PositiveInfinity, NegativeInfinity, Finite, Integer, Float, NegativeFloat, Negative, NonNegative, NegativeInteger, NonNegativeInteger, StringKeyOf, Exact, ReadonlyTuple, OptionalKeysOf, OverrideProperties, HasOptionalKeys, RequiredKeysOf, HasRequiredKeys, ReadonlyKeysOf, HasReadonlyKeys, WritableKeysOf, HasWritableKeys, Spread, TupleToUnion, IntRange, IsEqual, IsLiteral, IsStringLiteral, IsNumericLiteral, IsBooleanLiteral, IsSymbolLiteral, IsAny, IfAny, IsNever, IfNever, IsUnknown, IfUnknown, ArrayIndices, ArrayValues, SetFieldType, Paths, SharedUnionFieldsDeep, CamelCase, CamelCasedProperties, CamelCasedPropertiesDeep, KebabCase, KebabCasedProperties, KebabCasedPropertiesDeep, PascalCase, PascalCasedProperties, PascalCasedPropertiesDeep, SnakeCase, SnakeCasedProperties, SnakeCasedPropertiesDeep, ScreamingSnakeCase, DelimiterCase, DelimiterCasedProperties, DelimiterCasedPropertiesDeep, Join, Split, Trim, Replace, Includes, Get, LastArrayElement, GlobalThis, PackageJson, TsConfigJson, } from "type-fest";
|
package/index.esm.js
CHANGED
|
@@ -246,6 +246,8 @@ let objectFlip=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,r])=>[r,t?t(e
|
|
|
246
246
|
|
|
247
247
|
let objectPick=(e,t)=>{let r={},l=t.length;for(;l--;)r[t[l]]=e[t[l]];return r};
|
|
248
248
|
|
|
249
|
+
let objectMergeWithDefaults=(t,o)=>o?Object.keys(o).reduce((r,c)=>(isObject(o[c])?(t[c]||(t[c]={}),r[c]=objectMergeWithDefaults(t[c],o[c])):r[c]=void 0===o[c]?t[c]:o[c],r),{...t}):t;
|
|
250
|
+
|
|
249
251
|
let objectOmit=(e,t)=>Object.keys(e).reduce((c,b)=>(t.includes(b)||(c[b]=e[b]),c),{});
|
|
250
252
|
|
|
251
253
|
let objectSortByKeysMatching=(e,t)=>Object.fromEntries(Object.entries(e).sort(([e],[o])=>e===t?-1:e.localeCompare(o)));
|
|
@@ -327,4 +329,4 @@ let uuidNumeric=()=>new Date().valueOf();
|
|
|
327
329
|
|
|
328
330
|
let wait=e=>new Promise(t=>setTimeout(t,e));
|
|
329
331
|
|
|
330
|
-
export { Defer, Emitter, accentsSets, addOrReplaceAtIdx, areEqual, arrayFilterFalsy, arrayOfAll, arraySum, arrayToLookup, arrayUniqueByProperties, buildUrlQueryString, capitalize, changeCaseCamel, changeCaseConstant, changeCaseDot, changeCaseKebab, changeCasePascal, changeCasePath, changeCaseSentence, changeCaseSnake, changeCaseTrain, chunkByChunks, chunkBySize, clamp, clsx, convertRange, createPalette, debounce, debouncePromise, debounceRaf, decode, encode, ensureInt, errorToString, findDuplicatedIndexes, forin, gbToBytes, getEmptyArray, getKeys, getMediaQueryWidthResolvers, getMediaQueryWidthTailwindScreens, getNonce, getParamAmong, getParamAsInt, getParamAsString, getType, getUrlHashParams, getUrlHashPathname, getUrlPathnameParts, getUrlQueryParams, imgEmptyPixel, isAnyObject, isArray, isBlob, isBoolean, isBrowser, isBrowserNow, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isExternalUrl, isFile, isFloat, isFormData, isFullArray, isFullObject, isFullString, isFunction, isInt, isMap, isNaNValue, isNegativeNumber, isNull, isNullOrUndefined, isNumber, isNumericLiteral, isObject, isObjectLike, isObjectStringKeyed, isOneOf, isPlainObject, isPositiveNumber, isPrimitive, isPromise, isRegExp, isServer, isServerNow, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet, kbToBytes, lowercase, mapListBy, l as matchSorter, mbToBytes, mergeObjects, mergeUrlQueryParams, moveSortableArrayItemByKey, noop, normaliseUrl, normaliseUrlPathname, objectFlat, objectFlip, objectOmit, objectPick, objectSortByKeysMatching, objectToArray, parseCookie, parseURL, quaranteneProps, randomInt, randomKey, readCookie, removeAccents, removeCookie, removeDuplicatesByKey, removeDuplicatesComparing, removeIndexesFromArray, removeTralingSlash, removeUrlQueryParams, round, roundTo, serializeCookie, setCookie, shuffle, slugify, split, splitReverse, swapMap, throttle, titleCase, toNumber, toRgba, transformToUrlPathname, truncate, tryUntil, uid, updateLinkParams, updateUrlQueryParams, uppercase, uuid, uuidNumeric, wait };
|
|
332
|
+
export { Defer, Emitter, accentsSets, addOrReplaceAtIdx, areEqual, arrayFilterFalsy, arrayOfAll, arraySum, arrayToLookup, arrayUniqueByProperties, buildUrlQueryString, capitalize, changeCaseCamel, changeCaseConstant, changeCaseDot, changeCaseKebab, changeCasePascal, changeCasePath, changeCaseSentence, changeCaseSnake, changeCaseTrain, chunkByChunks, chunkBySize, clamp, clsx, convertRange, createPalette, debounce, debouncePromise, debounceRaf, decode, encode, ensureInt, errorToString, findDuplicatedIndexes, forin, gbToBytes, getEmptyArray, getKeys, getMediaQueryWidthResolvers, getMediaQueryWidthTailwindScreens, getNonce, getParamAmong, getParamAsInt, getParamAsString, getType, getUrlHashParams, getUrlHashPathname, getUrlPathnameParts, getUrlQueryParams, imgEmptyPixel, isAnyObject, isArray, isBlob, isBoolean, isBrowser, isBrowserNow, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isExternalUrl, isFile, isFloat, isFormData, isFullArray, isFullObject, isFullString, isFunction, isInt, isMap, isNaNValue, isNegativeNumber, isNull, isNullOrUndefined, isNumber, isNumericLiteral, isObject, isObjectLike, isObjectStringKeyed, isOneOf, isPlainObject, isPositiveNumber, isPrimitive, isPromise, isRegExp, isServer, isServerNow, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet, kbToBytes, lowercase, mapListBy, l as matchSorter, mbToBytes, mergeObjects, mergeUrlQueryParams, moveSortableArrayItemByKey, noop, normaliseUrl, normaliseUrlPathname, objectFlat, objectFlip, objectMergeWithDefaults, objectOmit, objectPick, objectSortByKeysMatching, objectToArray, parseCookie, parseURL, quaranteneProps, randomInt, randomKey, readCookie, removeAccents, removeCookie, removeDuplicatesByKey, removeDuplicatesComparing, removeIndexesFromArray, removeTralingSlash, removeUrlQueryParams, round, roundTo, serializeCookie, setCookie, shuffle, slugify, split, splitReverse, swapMap, throttle, titleCase, toNumber, toRgba, transformToUrlPathname, truncate, tryUntil, uid, updateLinkParams, updateUrlQueryParams, uppercase, uuid, uuidNumeric, wait };
|