move to biome (#297)
* switch to biome * writer format * migrate format * packages format * hudozka format * writer fix * biome config updated * migrate fix * packages fix * hudozka fix * claude updated
This commit is contained in:
1 parent
98dcaaa237
commit
467a218d00
112 files changed
+1472
-5914
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { insertBetween, tail } from "./array"
|
||||
|
||||
describe("insertBetween", () => {
|
||||
@@ -11,13 +11,11 @@ describe("insertBetween", () => {
|
||||
})
|
||||
|
||||
it("should insert separators between items", () => {
|
||||
expect(insertBetween(["a", "b", "c"], () => ",")).toEqual([
|
||||
"a", ",", "b", ",", "c",
|
||||
])
|
||||
expect(insertBetween(["a", "b", "c"], () => ",")).toEqual(["a", ",", "b", ",", "c"])
|
||||
})
|
||||
|
||||
it("should pass index to separator function", () => {
|
||||
const result = insertBetween(["a", "b", "c"], (i) => i)
|
||||
const result = insertBetween(["a", "b", "c"], i => i)
|
||||
expect(result).toEqual(["a", 0, "b", 1, "c"])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -16,4 +16,3 @@ export function tail<T>(items: T[]): T[] {
|
||||
const [_, ...rest] = items
|
||||
return rest
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { dateFormat } from "./date"
|
||||
|
||||
describe("dateFormat", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { ext, size } from "./file"
|
||||
|
||||
describe("ext", () => {
|
||||
|
||||
@@ -7,18 +7,14 @@ const mime = new Map([
|
||||
])
|
||||
|
||||
export function ext(mimeType: string): string {
|
||||
if (mime.has(mimeType)) {
|
||||
return mime.get(mimeType)!
|
||||
}
|
||||
|
||||
return mimeType
|
||||
return mime.get(mimeType) ?? mimeType
|
||||
}
|
||||
|
||||
export function size(bytes: number, precision = 1): string {
|
||||
if (Number.isNaN(bytes) || !Number.isFinite(bytes)) return ""
|
||||
|
||||
const number = Math.floor(Math.log(bytes) / Math.log(1024))
|
||||
const size = (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision)
|
||||
const size = (bytes / 1024 ** Math.floor(number)).toFixed(precision)
|
||||
|
||||
return `${size} ${units[number]}`
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { getResizedUrl } from "./image"
|
||||
|
||||
describe("getResizedUrl", () => {
|
||||
@@ -7,9 +7,7 @@ describe("getResizedUrl", () => {
|
||||
width: 800,
|
||||
height: 600,
|
||||
})
|
||||
expect(result).toBe(
|
||||
"https://images.weserv.nl/?url=example.com/img.jpg&w=800&h=600&n=1",
|
||||
)
|
||||
expect(result).toBe("https://images.weserv.nl/?url=example.com/img.jpg&w=800&h=600&n=1")
|
||||
})
|
||||
|
||||
it("should use custom n parameter", () => {
|
||||
@@ -18,8 +16,6 @@ describe("getResizedUrl", () => {
|
||||
height: 300,
|
||||
n: -1,
|
||||
})
|
||||
expect(result).toBe(
|
||||
"https://images.weserv.nl/?url=example.com/img.jpg&w=400&h=300&n=-1",
|
||||
)
|
||||
expect(result).toBe("https://images.weserv.nl/?url=example.com/img.jpg&w=400&h=300&n=-1")
|
||||
})
|
||||
})
|
||||
@@ -1,7 +1,7 @@
|
||||
export * from "./array"
|
||||
export * from "./date"
|
||||
export * from "./file"
|
||||
export * from "./image"
|
||||
export * from "./math"
|
||||
export * from "./string"
|
||||
export * from "./url"
|
||||
export * from "./math"
|
||||
export * from "./image"
|
||||
export * from "./file"
|
||||
export * from "./date"
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { clamp } from "./math"
|
||||
|
||||
describe("clamp", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { titleCase } from "./string"
|
||||
|
||||
describe("titleCase", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { queryList } from "./url"
|
||||
|
||||
describe("queryList", () => {
|
||||
@@ -11,8 +11,6 @@ describe("queryList", () => {
|
||||
})
|
||||
|
||||
it("should join multiple values with &", () => {
|
||||
expect(queryList("tag", ["art", "music", "photo"])).toBe(
|
||||
"tag=art&tag=music&tag=photo",
|
||||
)
|
||||
expect(queryList("tag", ["art", "music", "photo"])).toBe("tag=art&tag=music&tag=photo")
|
||||
})
|
||||
})
|
||||
@@ -3,7 +3,5 @@ export function queryList(key: string, values: string[]): string {
|
||||
return ""
|
||||
}
|
||||
|
||||
return values
|
||||
.map(value => `${key}=${value}`)
|
||||
.join("&")
|
||||
return values.map(value => `${key}=${value}`).join("&")
|
||||
}
|
||||
Reference in new issue
Block a user