-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
374 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const LARGE_ARRAY_SIZE = 200; | ||
export const LARGE_ARRAY_SIZE = 200; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { falsey } from "./falsey.ts"; | ||
import { falsey } from './falsey.ts'; | ||
|
||
export const empties = [[], {}].concat(falsey.slice(1)); | ||
export const empties = [[], {}].concat(falsey.slice(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { isDeepKey } from "./isDeepKey"; | ||
import { describe, expect, it } from 'vitest'; | ||
import { isDeepKey } from './isDeepKey'; | ||
|
||
describe("isDeepKey function", () => { | ||
it("returns true for deep keys", () => { | ||
expect(isDeepKey("a.b")).toBe(true); | ||
expect(isDeepKey("a[b]")).toBe(true); | ||
expect(isDeepKey("a.b.c")).toBe(true); | ||
expect(isDeepKey("a[b][c]")).toBe(true); | ||
describe('isDeepKey function', () => { | ||
it('returns true for deep keys', () => { | ||
expect(isDeepKey('a.b')).toBe(true); | ||
expect(isDeepKey('a[b]')).toBe(true); | ||
expect(isDeepKey('a.b.c')).toBe(true); | ||
expect(isDeepKey('a[b][c]')).toBe(true); | ||
}); | ||
|
||
it("returns false for non-deep keys", () => { | ||
expect(isDeepKey("a")).toBe(false); | ||
it('returns false for non-deep keys', () => { | ||
expect(isDeepKey('a')).toBe(false); | ||
expect(isDeepKey(123)).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { toPath } from "./toPath"; | ||
import { describe, expect, it } from 'vitest'; | ||
import { toPath } from './toPath'; | ||
|
||
describe("toPath function", () => { | ||
it("converts dot-separated keys correctly", () => { | ||
const result = toPath("a.b.c"); | ||
expect(result).toEqual(["a", "b", "c"]); | ||
describe('toPath function', () => { | ||
it('converts dot-separated keys correctly', () => { | ||
const result = toPath('a.b.c'); | ||
expect(result).toEqual(['a', 'b', 'c']); | ||
}); | ||
|
||
it("converts bracket notation keys correctly", () => { | ||
const result = toPath("a[b][c]"); | ||
expect(result).toEqual(["a", "b", "c"]); | ||
it('converts bracket notation keys correctly', () => { | ||
const result = toPath('a[b][c]'); | ||
expect(result).toEqual(['a', 'b', 'c']); | ||
}); | ||
|
||
it("handles mixed notation correctly", () => { | ||
const result = toPath("a[b].c"); | ||
expect(result).toEqual(["a", "b", "c"]); | ||
it('handles mixed notation correctly', () => { | ||
const result = toPath('a[b].c'); | ||
expect(result).toEqual(['a', 'b', 'c']); | ||
}); | ||
|
||
it("handles leading dots correctly", () => { | ||
const result = toPath(".a.b.c"); | ||
expect(result).toEqual(["", "a", "b", "c"]); | ||
it('handles leading dots correctly', () => { | ||
const result = toPath('.a.b.c'); | ||
expect(result).toEqual(['', 'a', 'b', 'c']); | ||
}); | ||
|
||
it("handles quoted keys correctly", () => { | ||
it('handles quoted keys correctly', () => { | ||
const result = toPath('a["b.c"].d'); | ||
expect(result).toEqual(["a", "b.c", "d"]); | ||
expect(result).toEqual(['a', 'b.c', 'd']); | ||
}); | ||
|
||
it("handles empty input correctly", () => { | ||
const result = toPath(""); | ||
it('handles empty input correctly', () => { | ||
const result = toPath(''); | ||
expect(result).toEqual([]); | ||
}); | ||
|
||
it("handles complex paths correctly", () => { | ||
it('handles complex paths correctly', () => { | ||
const result = toPath('a[-1.23]["[\\"b\\"]"].c[\'[\\\'d\\\']\'][\ne\n][f].g'); | ||
expect(result).toEqual(['a', '-1.23', '["b"]', 'c', "['d']", '\ne\n', 'f', 'g']); | ||
}); | ||
|
||
it("handles complex input with leading dot correctly", () => { | ||
it('handles complex input with leading dot correctly', () => { | ||
const result = toPath('.a[b].c.d[e]["f.g"].h'); | ||
expect(result).toEqual(["", "a", "b", "c", "d", "e", "f.g", "h"]); | ||
expect(result).toEqual(['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']); | ||
}); | ||
|
||
it("handles empty brackets correctly", () => { | ||
const result = toPath("a[].b"); | ||
it('handles empty brackets correctly', () => { | ||
const result = toPath('a[].b'); | ||
expect(result).toEqual(['a', '', 'b']); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.