Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antfu/utils

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antfu/utils - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

16

dist/index.d.ts

@@ -29,2 +29,12 @@ /**

declare type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
/**
* Infers the arguments type of a function
*/
declare type ArgumentsType<T> = T extends ((...args: infer A) => any) ? A : never;
declare type MergeInsertions<T> = T extends object ? {
[K in keyof T]: MergeInsertions<T[K]>;
} : T;
declare type DeepMerge<F, S> = MergeInsertions<{
[K in keyof F | keyof S]: K extends keyof S & keyof F ? DeepMerge<F[K], S[K]> : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never;
}>;

@@ -153,3 +163,7 @@ /**

declare function objectEntries<T extends object>(obj: T): [keyof T, T[keyof T]][];
/**
* Deep merge :P
*/
declare function deepMerge<T extends object = object, S extends object = T>(target: T, ...sources: S[]): DeepMerge<T, S>;
export { Arrayable, Awaitable, ElementOf, Fn, Nullable, UnionToIntersection, assert, at, batchInvoke, clamp, flattenArrayable, invoke, isBoolean, isBrowser, isDef, isFunction, isKeyOf, isNumber, isObject, isString, isTruthy, isWindow, last, mergeArrayable, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, partition, remove, slash, sum, timestamp, toArray, toString, uniq };
export { ArgumentsType, Arrayable, Awaitable, DeepMerge, ElementOf, Fn, MergeInsertions, Nullable, UnionToIntersection, assert, at, batchInvoke, clamp, deepMerge, flattenArrayable, invoke, isBoolean, isBrowser, isDef, isFunction, isKeyOf, isNumber, isObject, isString, isTruthy, isWindow, last, mergeArrayable, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, partition, remove, slash, sum, timestamp, toArray, toString, uniq };

@@ -114,2 +114,24 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/array.ts

}
function deepMerge(target, ...sources) {
if (!sources.length)
return target;
const source = sources.shift();
if (source === void 0)
return target;
if (isMergableObject(target) && isMergableObject(source)) {
objectKeys(source).forEach((key) => {
if (isMergableObject(source[key])) {
if (!target[key])
target[key] = {};
deepMerge(target[key], source[key]);
} else {
target[key] = source[key];
}
});
}
return deepMerge(target, ...sources);
}
function isMergableObject(item) {
return isObject(item) && !Array.isArray(item);
}

@@ -149,2 +171,3 @@

exports.assert = assert; exports.at = at; exports.batchInvoke = batchInvoke; exports.clamp = clamp; exports.flattenArrayable = flattenArrayable; exports.invoke = invoke; exports.isBoolean = isBoolean; exports.isBrowser = isBrowser; exports.isDef = isDef; exports.isFunction = isFunction; exports.isKeyOf = isKeyOf; exports.isNumber = isNumber; exports.isObject = isObject; exports.isString = isString; exports.isTruthy = isTruthy; exports.isWindow = isWindow; exports.last = last; exports.mergeArrayable = mergeArrayable; exports.noNull = noNull; exports.noop = noop; exports.notNullish = notNullish; exports.notUndefined = notUndefined; exports.objectEntries = objectEntries; exports.objectKeys = objectKeys; exports.objectMap = objectMap; exports.partition = partition; exports.remove = remove; exports.slash = slash; exports.sum = sum; exports.timestamp = timestamp; exports.toArray = toArray; exports.toString = toString2; exports.uniq = uniq;
exports.assert = assert; exports.at = at; exports.batchInvoke = batchInvoke; exports.clamp = clamp; exports.deepMerge = deepMerge; exports.flattenArrayable = flattenArrayable; exports.invoke = invoke; exports.isBoolean = isBoolean; exports.isBrowser = isBrowser; exports.isDef = isDef; exports.isFunction = isFunction; exports.isKeyOf = isKeyOf; exports.isNumber = isNumber; exports.isObject = isObject; exports.isString = isString; exports.isTruthy = isTruthy; exports.isWindow = isWindow; exports.last = last; exports.mergeArrayable = mergeArrayable; exports.noNull = noNull; exports.noop = noop; exports.notNullish = notNullish; exports.notUndefined = notUndefined; exports.objectEntries = objectEntries; exports.objectKeys = objectKeys; exports.objectMap = objectMap; exports.partition = partition; exports.remove = remove; exports.slash = slash; exports.sum = sum; exports.timestamp = timestamp; exports.toArray = toArray; exports.toString = toString2; exports.uniq = uniq;

2

package.json
{
"name": "@antfu/utils",
"version": "0.0.8",
"version": "0.0.9",
"description": "Opinionated collection of common JavaScript / TypeScript utils by @antfu",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc