Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Dec 20, 2024
1 parent 2fb8f72 commit 4a4717d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/core/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ describe('isObjectLiteral', () => {
['empty object literal', {}, true],
['object with properties', { foo: 'bar', num: 123 }, true],
['nested object literal', { nested: { foo: 'bar' } }, true],
['object with symbol key', { [Symbol.for('foo')]: 'bar' }, true],
['null', null, false],
['empty array', [], false],
['array with values', [1, 2, 3], false],
Expand All @@ -23,6 +24,7 @@ describe('isObjectLiteral', () => {
['Object.create(null)', Object.create(null), false],
['Buffer', Buffer.from('test'), false],
['Serialized Buffer', Buffer.from('test').toJSON(), true],
['Promise', new Promise(() => {}), false],
])('should return %s for %s', (_, input, expected) => {
expect(isObjectLiteral(input)).toBe(expected);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type ObjectLiteral = { [key: string]: unknown };
type ObjectLiteral = { [key: string | symbol]: unknown };

/**
* Checks if the provided value is a plain object literal (not null, not an array, not a class instance, and not a primitive).
Expand Down

0 comments on commit 4a4717d

Please sign in to comment.