Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: antfu/utils
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.7.5
Choose a base ref
...
head repository: antfu/utils
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.7.6
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Aug 14, 2023

  1. chore: update deps

    antfu committed Aug 14, 2023
    Copy the full SHA
    eb4330c View commit details
  2. chore: release v0.7.6

    antfu committed Aug 14, 2023
    Copy the full SHA
    814ec75 View commit details
Showing with 724 additions and 820 deletions.
  1. +14 −14 package.json
  2. +706 −803 pnpm-lock.yaml
  3. +1 −1 src/array.ts
  4. +1 −0 src/is.ts
  5. +1 −1 src/object.ts
  6. +1 −1 src/string.ts
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@antfu/utils",
"type": "module",
"version": "0.7.5",
"packageManager": "pnpm@8.6.5",
"version": "0.7.6",
"packageManager": "pnpm@8.6.12",
"description": "Opinionated collection of common JavaScript / TypeScript utils by @antfu",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
@@ -22,8 +22,8 @@
"exports": {
".": {
"types": "./index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
@@ -44,24 +44,24 @@
"test": "vitest"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.6",
"@antfu/ni": "^0.21.4",
"@antfu/eslint-config": "^0.40.2",
"@antfu/ni": "^0.21.5",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-commonjs": "^25.0.4",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@types/node": "^18.16.19",
"@types/node": "^20.5.0",
"@types/throttle-debounce": "^5.0.0",
"bumpp": "^9.1.1",
"eslint": "^8.44.0",
"esno": "^0.16.3",
"eslint": "^8.47.0",
"esno": "^0.17.0",
"p-limit": "^4.0.0",
"rollup": "^3.26.0",
"rollup-plugin-dts": "^5.3.0",
"rollup": "^3.28.0",
"rollup-plugin-dts": "^5.3.1",
"rollup-plugin-esbuild": "^5.0.0",
"throttle-debounce": "5.0.0",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vitest": "^0.32.2"
"vite": "^4.4.9",
"vitest": "^0.34.1"
}
}
1,509 changes: 706 additions & 803 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/array.ts
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ export function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: Pa
export function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[]]
export function partition<T>(array: readonly T[], f1: PartitionFilter<T>, f2: PartitionFilter<T>, f3: PartitionFilter<T>, f4: PartitionFilter<T>, f5: PartitionFilter<T>, f6: PartitionFilter<T>): [T[], T[], T[], T[], T[], T[], T[]]
export function partition<T>(array: readonly T[], ...filters: PartitionFilter<T>[]): any {
const result: T[][] = new Array(filters.length + 1).fill(null).map(() => [])
const result: T[][] = Array.from({ length: filters.length + 1 }).fill(null).map(() => [])

array.forEach((e, idx, arr) => {
let i = 0
1 change: 1 addition & 0 deletions src/is.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import { toString } from './base'

export const isDef = <T = any>(val?: T): val is T => typeof val !== 'undefined'
export const isBoolean = (val: any): val is boolean => typeof val === 'boolean'
// eslint-disable-next-line @typescript-eslint/ban-types
export const isFunction = <T extends Function> (val: any): val is T => typeof val === 'function'
export const isNumber = (val: any): val is number => typeof val === 'number'
export const isString = (val: unknown): val is string => typeof val === 'string'
2 changes: 1 addition & 1 deletion src/object.ts
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ export function deepMergeWithArray<T extends object = object, S extends object =
return deepMergeWithArray(target, ...sources)
}

function isMergableObject(item: any): item is Object {
function isMergableObject(item: any): item is object {
return isObject(item) && !Array.isArray(item)
}

2 changes: 1 addition & 1 deletion src/string.ts
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ export function ensureSuffix(suffix: string, str: string) {
* ```
*/
export function template(str: string, object: Record<string | number, any>, fallback?: string | ((key: string) => string)): string
export function template(str: string, ...args: (string | number | BigInt | undefined | null)[]): string
export function template(str: string, ...args: (string | number | bigint | undefined | null)[]): string
export function template(str: string, ...args: any[]): string {
const [firstArg, fallback] = args