@augment-vir/common 30.0.3 → 30.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from '@augment-vir/core';
1
+ import { type MaybePromise } from '@augment-vir/core';
2
2
  /**
3
3
  * Polyfill for `Object.groupBy`:
4
4
  * https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/groupBy
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from '@augment-vir/core';
1
+ import { type MaybePromise } from '@augment-vir/core';
2
2
  /**
3
3
  * Call a function asynchronously without interrupting current synchronous execution, even if the
4
4
  * function was originally synchronous.
@@ -1,4 +1,4 @@
1
- import { MaybePromise } from '@augment-vir/core';
1
+ import { type MaybePromise } from '@augment-vir/core';
2
2
  import { AnyDuration } from '@date-vir/duration';
3
3
  /**
4
4
  * Different types of debouncing for the {@link Debounce} class.
@@ -1,5 +1,5 @@
1
- import type { JsonCompatibleArray, JsonCompatibleObject, JsonCompatibleValue } from './json-compatible.js';
2
- import { JsonCompatiblePrimitive } from './json-compatible.js';
1
+ import type { JsonCompatibleArray, JsonCompatibleObject, JsonCompatibleValue } from '@augment-vir/core';
2
+ import { JsonCompatiblePrimitive } from '@augment-vir/core';
3
3
  export declare function appendJson(entry: JsonCompatibleArray | JsonCompatiblePrimitive, ...entries: ReadonlyArray<JsonCompatibleValue | undefined>): JsonCompatibleArray;
4
4
  export declare function appendJson(entry: JsonCompatibleObject, ...entries: ReadonlyArray<JsonCompatibleObject | JsonCompatibleArray | undefined>): JsonCompatibleObject;
5
5
  export declare function appendJson(...entries: ReadonlyArray<JsonCompatibleValue | undefined>): JsonCompatibleObject | JsonCompatibleArray;
@@ -39,9 +39,7 @@ export function appendJson(...rawEntries) {
39
39
  return {};
40
40
  }
41
41
  const firstEntry = copyThroughJson(entries[0]);
42
- const combinedData = typeof firstEntry === 'object'
43
- ? firstEntry
44
- : [firstEntry];
42
+ const combinedData = (typeof firstEntry === 'object' ? firstEntry : [firstEntry]);
45
43
  entries.slice(1).forEach((entry) => {
46
44
  if (check.isArray(combinedData)) {
47
45
  if (check.isArray(entry)) {
package/dist/index.d.ts CHANGED
@@ -19,7 +19,6 @@ export * from './augments/function/if-truthy.js';
19
19
  export * from './augments/function/wrap-in-try.js';
20
20
  export * from './augments/json/append-json.js';
21
21
  export * from './augments/json/copy-through-json.js';
22
- export * from './augments/json/json-compatible.js';
23
22
  export * from './augments/json/jsonify.js';
24
23
  export * from './augments/log/log-colors.js';
25
24
  export * from './augments/log/log-string.js';
package/dist/index.js CHANGED
@@ -19,7 +19,6 @@ export * from './augments/function/if-truthy.js';
19
19
  export * from './augments/function/wrap-in-try.js';
20
20
  export * from './augments/json/append-json.js';
21
21
  export * from './augments/json/copy-through-json.js';
22
- export * from './augments/json/json-compatible.js';
23
22
  export * from './augments/json/jsonify.js';
24
23
  export * from './augments/log/log-colors.js';
25
24
  export * from './augments/log/log-string.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "30.0.3",
3
+ "version": "30.0.5",
4
4
  "description": "A collection of augments, helpers types, functions, and classes for any JavaScript environment.",
5
5
  "keywords": [
6
6
  "augment",
@@ -39,8 +39,8 @@
39
39
  "test:web": "virmator --no-deps test web"
40
40
  },
41
41
  "dependencies": {
42
- "@augment-vir/assert": "^30.0.2",
43
- "@augment-vir/core": "^30.0.2",
42
+ "@augment-vir/assert": "^30.0.5",
43
+ "@augment-vir/core": "^30.0.5",
44
44
  "@date-vir/duration": "^6.0.0",
45
45
  "ansi-styles": "^6.2.1",
46
46
  "json5": "^2.2.3",
@@ -1,50 +0,0 @@
1
- import { Jsonify, Primitive } from 'type-fest';
2
- /**
3
- * These are similar in purpose, name, and structure to type-fest's JsonValue types but these are
4
- * more permissive. The goal here is to allow any types that do not get serialized into just empty
5
- * objects. (For example, JSON.stringify(new Map()) returns "{}", so we don't want to allow that
6
- * type.)
7
- */
8
- /**
9
- * All primitives that are allowed in JSON.
10
- *
11
- * Note that while `undefined` is allowed here, it will be behave slightly differently than the
12
- * others.
13
- *
14
- * - `JSON.stringify(undefined)` will output `undefined`, not a string.
15
- * - `JSON.stringify({a: null, b: undefined})` will output `'{"a": null}'`, omitting the `b` key
16
- * entirely.
17
- *
18
- * @category JSON : Common
19
- * @category Package : @augment-vir/common
20
- * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
21
- */
22
- export type JsonCompatiblePrimitive = Jsonify<Primitive> | undefined;
23
- /**
24
- * An object that only contains JSON compatible values.
25
- *
26
- * @category JSON : Common
27
- * @category Package : @augment-vir/common
28
- * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
29
- */
30
- export type JsonCompatibleObject = Partial<{
31
- readonly [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
32
- }> | Partial<{
33
- [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
34
- }>;
35
- /**
36
- * An array that only contains JSON compatible values.
37
- *
38
- * @category JSON : Common
39
- * @category Package : @augment-vir/common
40
- * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
41
- */
42
- export type JsonCompatibleArray = JsonCompatibleValue[] | ReadonlyArray<JsonCompatibleValue>;
43
- /**
44
- * Any JSON compatible value.
45
- *
46
- * @category JSON : Common
47
- * @category Package : @augment-vir/common
48
- * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
49
- */
50
- export type JsonCompatibleValue = JsonCompatiblePrimitive | JsonCompatibleObject | JsonCompatibleArray;
@@ -1 +0,0 @@
1
- export {};