Skip to content

Commit

Permalink
[Types] input is unknown, can be non object
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Dec 21, 2024
1 parent 4cff539 commit 909747b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare namespace stableStringify {
}

declare function stableStringify(
obj: object,
obj: unknown,
options?: (stableStringify.Comparator & stableStringify.StableStringifyOptions) | stableStringify.StableStringifyOptions,
): string | undefined;

Expand Down
12 changes: 12 additions & 0 deletions test/str.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ test('array with empty string', function (t) {
var obj = [4, '', 6];
t.equal(stringify(obj), '[4,"",6]');
});

test('raw string', function (t) {
t.plan(1);
var input = 'raw';
t.equal(stringify(input), '"raw"');
});

test('raw number', function (t) {
t.plan(1);
var input = 42;
t.equal(stringify(input), '42');
});

0 comments on commit 909747b

Please sign in to comment.