-
#1791
946f440
Thanks @belgattitude! - Update comparative benchmarks with latest versions.RUN v2.1.8 ✓ bench/comparative.bench.ts (7) 5774ms ✓ Compare calling isPlainObject with 110x mixed types values (7) 5773ms name hz min max mean p75 p99 p995 p999 rme samples · "@httpx/plain-object": `isPlainObject(v)` 1,395,419.02 0.0006 1.8273 0.0007 0.0007 0.0012 0.0013 0.0022 ±1.01% 697710 fastest · "is-plain-obj":"4.1.0": 'isPlainObj(v)' 1,308,696.50 0.0006 1.0286 0.0008 0.0007 0.0013 0.0013 0.0022 ±0.71% 654349 · "@sindresorhus/is":"7.0.1": 'is.plainObject(v)' 780,257.18 0.0011 0.9150 0.0013 0.0012 0.0024 0.0025 0.0073 ±0.56% 390129 · "es-toolkit":"1.31.0": 'isPlainObject(v)' 1,077,076.98 0.0007 2.5125 0.0009 0.0008 0.0016 0.0017 0.0118 ±1.46% 538539 · "redux":"5.0.1": 'isPlainObject(v)' 473,750.80 0.0017 0.9967 0.0021 0.0019 0.0034 0.0038 0.0197 ±0.70% 236878 · "is-plain-object":"5.0.0": 'isPlainObject(v)' 569,808.67 0.0014 2.0280 0.0018 0.0016 0.0031 0.0033 0.0199 ±1.25% 284905 · lodash-es:"4.17.21": '_.isPlainObject(v)' 19,551.73 0.0452 1.2833 0.0511 0.0473 0.1073 0.1498 0.3331 ±0.96% 9776 slowest BENCH Summary "@httpx/plain-object": `isPlainObject(v)` - bench/comparative.bench.ts > Compare calling isPlainObject with 110x mixed types values 1.07x faster than "is-plain-obj":"4.1.0": 'isPlainObj(v)' 1.30x faster than "es-toolkit":"1.31.0": 'isPlainObject(v)' 1.79x faster than "@sindresorhus/is":"7.0.1": 'is.plainObject(v)' 2.45x faster than "is-plain-object":"5.0.0": 'isPlainObject(v)' 2.95x faster than "redux":"5.0.1": 'isPlainObject(v)' 71.37x faster than lodash-es:"4.17.21": '_.isPlainObject(v)'
- #1661
be1dbb3
Thanks @belgattitude! - Tiny size reduction
- #1546
bdf9e19
Thanks @belgattitude! - Ensure CI tests on Clouflare workers and latest chrome (playwright)
- #1535
d1a01e2
Thanks @belgattitude! - Mention comparison with redux isPlainObject (100% compat)
-
#1530
4e1ecf4
Thanks @belgattitude! - Not 100% compatible with sindreshorsus/is-plain-obj anymoreThe changes shouldn't affect most users, but it's worth noting that the
isPlainObject
function no longer consider static built-in objects as plain objects (Math, JSON, Atomics).This fix an issue with
{ [Symbol.toStringTag]: 'tag' }
that wasn't considered as a plain object.If the behaviour is needed there's a new
isStaticBuiltInClass
function that can be used to check if a value is a static built-in class (Math, JSON, Atomics).Another change to mention is that
isPlainObject
now accepts[Symbol.iterator]
as a valid property for plain objects.const v = { [Symbol.iterator]: function* () { yield 1; }, }; // Since v2 considered as a plain object
Which allows to add iterators to plain objects.
-
#1530
4e1ecf4
Thanks @belgattitude! - Fix issue with plain objects that contains a [Symbol.iterator]isPlainObject
now accepts[Symbol.iterator]
as a valid property for plain objects.const v = { [Symbol.iterator]: function* () { yield 1; }, }; // Since v2 considered as a plain object
Which allows to add iterators to plain objects.
-
#1530
4e1ecf4
Thanks @belgattitude! - Small performance increase@httpx/plain-object: `isPlainObject(v)` - bench/comparative.bench.ts > Compare calling isPlainObject with 110x mixed types values 1.11x faster than (sindresorhus/)is-plain-obj: `isPlainObj(v)` 1.79x faster than @sindresorhus/is: `is.plainObject(v)` 2.29x faster than (jonschlinkert/)is-plain-object: `isPlainObject(v)` 14.66x faster than estoolkit: `isPlainObject(v)` 73.82x faster than lodash-es: `_.isPlainObject(v)`
-
#1530
4e1ecf4
Thanks @belgattitude! - This fix an issue with{ [Symbol.toStringTag]: 'tag' }
that wasn't considered as a plain object. -
#1530
4e1ecf4
Thanks @belgattitude! - Bundle size reduction from 101B to 75B when importing isPlainObject from @httpx/plain-objectOnly { isPlainObject } (ESM) Package size is 1 B less than limit Size limit: 76 B Size: 75 B with all dependencies, minified and brotlied Only { assertPlainObject } (ESM) Package size is 1 B less than limit Size limit: 133 B Size: 132 B with all dependencies, minified and brotlied Import { assertPlainObject, isPlainObject } (ESM) Size: 139 B with all dependencies, minified and brotlied
-
#1530
4e1ecf4
Thanks @belgattitude! - isPlainObject allows static built-in classes: for Atomic, Math, Json.The changes shouldn't affect most users, but it's worth noting that the
isPlainObject
function no longer consider static build-in objects as plain objects (Math, JSON, Atomics).This fix an issue with
{ [Symbol.toStringTag]: 'tag' }
that wasn't considered as a plain object.If the behaviour is needed there's a new
isStaticBuiltInClass
function that can be used to check if a value is a static built-in class (Math, JSON, Atomics).import { isPlainObject, isStaticBuiltInClass } from "@httpx/plain-object"; const v = Math; // or Atomics or JSON if (isPlainObject(v) && !isStaticBuiltInClass(v)) { console.log("v is a plain object but not a static built-in class"); }
-
#1530
4e1ecf4
Thanks @belgattitude! - Change assertPlainObject default message to 'Not a PlainObject'This change the default error message of
assertPlainObject
to 'Not a PlainObject' instead of 'Not a plain object'.
- #1523
003cdb3
Thanks @belgattitude! - Small speedup for isPlainObject and size reduction
- #1434
6bd5105
Thanks @belgattitude! - internal: assertPlainObject error message remove explicit undefined union
-
#1418
366520a
Thanks @belgattitude! - Internal refactor based on linter updates -
#1418
366520a
Thanks @belgattitude! - Fix duplicate imports for assertPlainObject
- #1371
bda9fa3
Thanks @belgattitude! - Fix readme links
-
cb95198
Thanks @belgattitude! - Convert some type unions to interfaces to increase typechecking perf -
cb95198
Thanks @belgattitude! - Add perf comparison with es-toolkit
-
#1369
b39a71c
Thanks @belgattitude! - Add git url prefix in package.json -
#1369
b39a71c
Thanks @belgattitude! - Remove unecessary default condition from exports -
#1369
b39a71c
Thanks @belgattitude! - Add publint after arethetypeswrong checks
- #1334
e6a373c
Thanks @belgattitude! - Promote @httpx/plain-object to stable v1
- #1315
a1db7d3
Thanks @belgattitude! - Initial release of @httpx/plain-object