Skip to content

Commit 289ee00

Browse files
committed
chore: remove chai and update dependencies
1 parent f91a563 commit 289ee00

24 files changed

+384
-511
lines changed

.eslintrc

Lines changed: 0 additions & 42 deletions
This file was deleted.

dist/lib/get.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ import { JsonPointer, JsonPath, JsonData } from "./types";
88
* @param [defaultValue] - optional default value to return if json-pointer location does not exist
99
* @return value at json-pointer, defaultValue if specified or undefined
1010
*/
11-
export declare function get<T = any>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue: T): T;
12-
export declare function get<T = any>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue?: T): T | undefined;
11+
export declare function get<T = unknown>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue: T): T;
12+
export declare function get<T = unknown>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue?: T): T | undefined;

dist/lib/remove.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ import { JsonPointer, JsonPath } from "./types";
77
* @param pointer - location of data to remove
88
* @param [keepArrayIndices] - if set to `true`, will set array element to undefined (instead of removing it)
99
*/
10-
export declare function remove<T = any>(data: T, pointer: JsonPointer | JsonPath, keepArrayIndices?: boolean): T;
10+
export declare function remove<T = unknown>(data: T, pointer: JsonPointer | JsonPath, keepArrayIndices?: boolean): T;

dist/lib/removeUndefinedItems.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
* Removes all `undefined` values within an array without creating additional
33
* arrays
44
*/
5-
export declare function removeUndefinedItems<T = any>(array: Array<T>): Array<T>;
5+
export declare function removeUndefinedItems<T = unknown>(array: T[]): T[];

dist/lib/set.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import { JsonPointer, JsonPath, JsonData } from "./types";
2-
export declare function set<T = JsonData>(data: T, pointer: JsonPointer | JsonPath, value: any): T;
2+
export declare function set<T = JsonData>(data: T, pointer: JsonPointer | JsonPath, value: unknown): T;

dist/lib/types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export type JsonPointer = string;
2-
export type JsonPath = Array<string>;
3-
export type JsonData = any;
2+
export type JsonPath = string[];
3+
export type JsonData = unknown;

eslint.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @ts-check
2+
import eslint from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
5+
export default tseslint.config(
6+
eslint.configs.recommended,
7+
tseslint.configs.strict,
8+
tseslint.configs.stylistic, {
9+
rules: {
10+
"@typescript-eslint/no-dynamic-delete": "off"
11+
}
12+
});

lib/get.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ import { JsonPointer, JsonPath, JsonData } from "./types";
1111
* @param [defaultValue] - optional default value to return if json-pointer location does not exist
1212
* @return value at json-pointer, defaultValue if specified or undefined
1313
*/
14-
export function get<T = any>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue: T): T;
15-
export function get<T = any>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue?: T): T | undefined;
16-
export function get<T = any>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue = undefined): T | undefined {
14+
export function get<T = unknown>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue: T): T;
15+
export function get<T = unknown>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue?: T): T | undefined;
16+
export function get<T = unknown>(data: JsonData, pointer: JsonPointer | JsonPath, defaultValue = undefined): T | undefined {
1717
if (pointer == null || data == null) {
1818
return defaultValue;
1919
}
2020
if (isRoot(pointer)) {
21-
return data;
21+
return data as T;
2222
}
2323
const result = run(data, split(pointer));
2424
if (result === undefined) {
2525
return defaultValue;
2626
}
27-
return result;
27+
return result as T;
2828
}
2929

30-
function run<T = any>(data: JsonData, path: JsonPath): T | undefined {
30+
function run<T = unknown>(data: JsonData, path: JsonPath): T | undefined {
3131
const property = path.shift();
3232
if (data === undefined) {
3333
return;
3434
} else if (property !== undefined) {
3535
return run(data[property], path);
3636
}
37-
return data;
37+
return data as T;
3838
}

lib/remove.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { JsonPointer, JsonPath } from "./types";
1111
* @param pointer - location of data to remove
1212
* @param [keepArrayIndices] - if set to `true`, will set array element to undefined (instead of removing it)
1313
*/
14-
export function remove<T = any>(
14+
export function remove<T = unknown>(
1515
data: T,
1616
pointer: JsonPointer | JsonPath,
1717
keepArrayIndices?: boolean

lib/removeUndefinedItems.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Removes all `undefined` values within an array without creating additional
33
* arrays
44
*/
5-
export function removeUndefinedItems<T = any>(array: Array<T>): Array<T> {
5+
export function removeUndefinedItems<T = unknown>(array: T[]): T[] {
66
let i = 0;
77
let skip = 0;
88
while (i + skip < array.length) {

0 commit comments

Comments
 (0)