Collection of libs: http exceptions, dsn-parser...
MIT License
Bot releases are hidden (Show)
Published by belgattitude 3 months ago
f6d0479
]:
Published by belgattitude 3 months ago
a1db7d3
Thanks @belgattitude! - Initial release of @httpx/plain-objectPublished by belgattitude 5 months ago
bd35900
Thanks @belgattitude! - Fix and improve assert documentation READMEPublished by belgattitude 5 months ago
bd35900
Thanks @belgattitude! - Add MIntl.cache to get stats or clear the lruPublished by belgattitude 5 months ago
a37e9e9
Thanks @belgattitude! - Add support for Intl.DateTimeFormatterPublished by belgattitude 5 months ago
fe460a9
Thanks @belgattitude! - Add LRU to limit the number of cached instances (50 by default)Published by belgattitude 5 months ago
a921f6a
Thanks @belgattitude! - Improve performance and bundle sizePublished by belgattitude 5 months ago
8bbf027
Thanks @belgattitude! - Initial @httpx/memo-intl utilityPublished by belgattitude 5 months ago
08e61f7
Thanks @belgattitude! - make assertParsableStrictIsoDateZ case insensitivePublished by belgattitude 5 months ago
19a5292
Thanks @belgattitude! - isPlainObject properly support node:vm.runInNewContex('({})')Published by belgattitude 5 months ago
#1231 fd2ecd3
Thanks @belgattitude! - Improve PlainObject convenience typings when passing a generic.
import { isPlainObject, assertPlainObject } from "@httpx/assert";
type TValue = {
key: string;
deep: {
connected: boolean;
};
};
const value = {
key: "hello",
deep: {
connected: true,
},
} as unknown;
// Without generic
assertPlainObject(value);
// value is Record<string, unknown>
// -> no typing
value.key; // unknown, no runtime error
value.anything; // unknown, no runtime error
// value.deep.connected // not possible without explicit typing
// With generic
assertPlainObject<TValue>(value);
value.key; // unknown, no runtime error
value.anything; // unknown, no runtime error
value.deep?.connected; // connected is 'unknown', typescript suggest the type
Published by belgattitude 5 months ago
ad7345f
Thanks @belgattitude! - Drop "official" support for node 16 and typesript < 5Published by belgattitude 5 months ago
#1217 da8474c
Thanks @belgattitude! - @httpx/assert - drop node 16
#1217 da8474c
Thanks @belgattitude! - Small perf for isPlainObject and add benchmark
ad7345f
Thanks @belgattitude! - Drop "official" support for node 16 and typesript < 5
Published by belgattitude 5 months ago
226a4b1
Thanks @belgattitude! - isPlainObject allows Object.create(null) and disallow stringTagName and iterators symbolsPublished by belgattitude 6 months ago
fd1d0c5
Thanks @belgattitude! - isPlainObject works with partial typesPublished by belgattitude 6 months ago
943adcd
Thanks @belgattitude! - Fix type exports for object typesPublished by belgattitude 6 months ago
#1171 7fdbf08
Thanks @belgattitude! - Add generic convenience typing in isPlainObject
You can now pass a generic type in isPlainObject and assertPlainObject.
It allows to get typescript autocompletion after running isPlainObject(v).
But notice all keys becomes optional and values are set to unknown in this case to reflect
that no runtime check was done.
Name | Type | Comment |
---|---|---|
isPlainObject<T?> | PlainObject<T extends Record<string, unknown> = Record<string, unknown> |
|
assertPlainObject<T?> | PlainObject<T extends Record<string, unknown> = Record<string, unknown> |
import { isPlainObject, assertPlainObject } from "@httpx/assert";
// Simple case: without generic value
isPlainObject({ cwol: true }); // 👈 true
isPlainObject(new Promise()); // 👈 false
assertPlainObject({});
// With generic value (unchecked at runtime!)
type CustomType = {
name: string;
deep: {
yes: boolean | null;
};
};
const value = {
name: "hello",
deep: {
yes: true,
},
} as unknown;
if (isPlainObject<CustomType>(value)) {
// Notice it's a deep partial to allow autocompletion
const test = value?.deep?.yes; // 👈 yes will be unknown (no runtime check)
}
Published by belgattitude 6 months ago
bfd78a3
Thanks @belgattitude! - Add missing documentation in TOCPublished by belgattitude 6 months ago
0d3b113
Thanks @belgattitude! - Add network port and http methods typeguard and assertions#1157 0d3b113
Thanks @belgattitude! - Fix isPlainObject when testing Object.create(null)
#1157 0d3b113
Thanks @belgattitude! - Fix isNumberSafeInt return
Published by belgattitude 6 months ago
#1154 6a52be7
Thanks @belgattitude! - Rebuild using esbuild 0.20.2
Updated dependencies [6a52be7
]: