Skip to content

Commit

Permalink
fix(assert): isPlainObject allows Object.create(null)
Browse files Browse the repository at this point in the history
  • Loading branch information
belgattitude committed May 17, 2024
1 parent d1d7c8e commit c7ce0ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 5 additions & 2 deletions docs/src/pages/assert/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ assertParsableStrictIsoDateZ('2023-02-29T23:37:31.653z'); // 👉 throws cause n
| isUuidV3 | `string` | `UuidV3` | |
| isUuidV4 | `string` | `UuidV4` | |
| isUuidV5 | `string` | `UuidV5` | |
| isUuidV7 | `string` | `UuidV7` | |
| assertUuid | `string` | `UuidV1 \| UuidV3 \| UuidV4 \| UuidV5 \| UuidV7` | |
| assertUuidV1 | `string` | `UuidV5` | |
| assertUuidV3 | `string` | `UuidV3` | |
Expand Down Expand Up @@ -418,12 +419,14 @@ for the browser.
ESM individual imports are tracked by a
[size-limit configuration](https://github.com/belgattitude/httpx/blob/main/packages/assert/.size-limit.cjs).


| Scenario | Size (compressed) |
|----------------------------------------|------------------:|
| Import `isPlainObject` | ~ 56b |
| Import `isPlainObject` | ~ 100b |
| Import `isUuid` | ~ 175b |
| Import `isEan13` | ~ 117b |
| All typeguards, assertions and helpers | ~ 900b |
| All typeguards, assertions and helpers | ~ 1700b |


> For CJS usage (not recommended) track the size on [bundlephobia](https://bundlephobia.com/package/@httpx/assert@latest).
Expand Down
6 changes: 3 additions & 3 deletions packages/assert/.size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = [
name: 'Only isPlainObject (ESM)',
path: ['dist/index.mjs'],
import: "{ isPlainObject }",
limit: "76B",
limit: "108B",
},
{
name: 'Only isUuid (ESM)',
Expand All @@ -31,12 +31,12 @@ module.exports = [
name: 'Only assertPlainObject (ESM)',
path: ['dist/index.mjs'],
import: "{ assertPlainObject }",
limit: "461B",
limit: "487B",
},
{
name: 'Everything (CJS)',
import: "*",
path: ['dist/index.cjs'],
limit: '2400B',
limit: '2600B',
},
];
7 changes: 4 additions & 3 deletions packages/assert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,12 @@ assertParsableStrictIsoDateZ('2023-02-29T23:37:31.653z'); // 👉 throws cause n

| Name | Type | Opaque type | Comment |
|----------------|-------------------------|--------------------------------------------------|--------|
| isUuid | `string` | `UuidV1 \| UuidV3 \| UuidV4 \| UuidV5 \| UuidV7` | |
| isUuid | `string` | `UuidV1 \| UuidV3 \| UuidV4 \| UuidV5 \| UuidV7` | |
| isUuidV1 | `string` | `UuidV1` | |
| isUuidV3 | `string` | `UuidV3` | |
| isUuidV4 | `string` | `UuidV4` | |
| isUuidV5 | `string` | `UuidV5` | |
| isUuidV7 | `string` | `UuidV7` | |
| assertUuid | `string` | `UuidV1 \| UuidV3 \| UuidV4 \| UuidV5 \| UuidV7` | |
| assertUuidV1 | `string` | `UuidV5` | |
| assertUuidV3 | `string` | `UuidV3` | |
Expand Down Expand Up @@ -401,10 +402,10 @@ ESM individual imports are tracked by a

| Scenario | Size (compressed) |
|----------------------------------------|------------------:|
| Import `isPlainObject` | ~ 56b |
| Import `isPlainObject` | ~ 100b |
| Import `isUuid` | ~ 175b |
| Import `isEan13` | ~ 117b |
| All typeguards, assertions and helpers | ~ 900b |
| All typeguards, assertions and helpers | ~ 1700b |

> For CJS usage (not recommended) track the size on [bundlephobia](https://bundlephobia.com/package/@httpx/assert@latest).
Expand Down

0 comments on commit c7ce0ce

Please sign in to comment.