@antfu/utils
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -47,3 +47,5 @@ /** | ||
*/ | ||
declare function partition<T>(array: T[], filter: (i: T, idx: number, arr: T[]) => any): T[][]; | ||
declare function partition<T>(array: readonly T[], filter: (i: T, idx: number, arr: readonly T[]) => any): T[][]; | ||
declare function uniq<T>(array: readonly T[]): T[]; | ||
declare function last<T>(array: readonly T[]): T | undefined; | ||
@@ -148,2 +150,2 @@ declare const assert: (condition: boolean, ...infos: any[]) => void; | ||
export { Arrayable, Awaitable, ElementOf, Fn, Nullable, UnionToIntersection, assert, batchInvoke, clamp, flattenArrayable, invoke, isBoolean, isBrowser, isDef, isFunction, isKeyOf, isNumber, isObject, isString, isTruthy, isWindow, mergeArrayable, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, partition, slash, sum, timestamp, toArray, toString }; | ||
export { Arrayable, Awaitable, ElementOf, Fn, Nullable, UnionToIntersection, assert, batchInvoke, clamp, flattenArrayable, invoke, isBoolean, isBrowser, isDef, isFunction, isKeyOf, isNumber, isObject, isString, isTruthy, isWindow, last, mergeArrayable, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, partition, slash, sum, timestamp, toArray, toString, uniq }; |
@@ -20,2 +20,10 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/array.ts | ||
} | ||
function uniq(array) { | ||
return Array.from(new Set(array)); | ||
} | ||
function last(array) { | ||
if (!array.length) | ||
return void 0; | ||
return array[array.length - 1]; | ||
} | ||
@@ -122,2 +130,4 @@ // src/base.ts | ||
exports.assert = assert; 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.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.slash = slash; exports.sum = sum; exports.timestamp = timestamp; exports.toArray = toArray; exports.toString = toString2; | ||
exports.assert = assert; 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.slash = slash; exports.sum = sum; exports.timestamp = timestamp; exports.toArray = toArray; exports.toString = toString2; exports.uniq = uniq; |
{ | ||
"name": "@antfu/utils", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13665
357