Comparing version 1.6.3 to 1.7.0
@@ -12,2 +12,3 @@ export type Dict<T = any, K extends string | symbol = string> = { | ||
export function isNullable(value: any): value is null | undefined | void; | ||
export function isNonNullable<T>(value: T): value is NonNullable<T>; | ||
export function isPlainObject(data: any): any; | ||
@@ -14,0 +15,0 @@ export function filterKeys<T, K extends string, U extends K>(object: Dict<T, K>, filter: (key: K, value: T) => key is U): Dict<T, U>; |
{ | ||
"name": "cosmokit", | ||
"description": "A collection of common utilities", | ||
"version": "1.6.3", | ||
"version": "1.7.0", | ||
"sideEffects": false, | ||
@@ -45,3 +45,3 @@ "type": "module", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^22.1.0", | ||
"@types/node": "^22.7.5", | ||
"@types/sinonjs__fake-timers": "^6.0.4", | ||
@@ -55,4 +55,4 @@ "c8": "^7.14.0", | ||
"shx": "^0.3.4", | ||
"typescript": "^5.5.3" | ||
"typescript": "^5.6.2" | ||
} | ||
} |
@@ -15,2 +15,6 @@ export type Dict<T = any, K extends string | symbol = string> = { [key in K]: T } | ||
export function isNonNullable<T>(value: T): value is NonNullable<T> { | ||
return !isNullable(value) | ||
} | ||
export function isPlainObject(data: any) { | ||
@@ -17,0 +21,0 @@ return data && typeof data === 'object' && !Array.isArray(data) |
@@ -1,2 +0,2 @@ | ||
import { isNullable, mapValues } from './misc' | ||
import { isNullable } from './misc' | ||
@@ -84,3 +84,7 @@ type GlobalConstructorNames = keyof { | ||
if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength) | ||
return mapValues(source, clone) | ||
const result = Object.create(Object.getPrototypeOf(source)) | ||
for (const key of Reflect.ownKeys(source)) { | ||
Reflect.defineProperty(result, key, Reflect.getOwnPropertyDescriptor(source, key)!) | ||
} | ||
return result | ||
} | ||
@@ -87,0 +91,0 @@ |
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
66515
1200