@augment-vir/common 11.1.2 → 11.3.0

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @augment-vir/common
2
2
 
3
- `augment-vir` is a collection of small helper functions that I constantly use across all my JavaScript and TypeScript repos. I call these functions `augments`. These are things commonly placed within a "util", or "helpers", etc. directory; they don't really have anything in common with each other except that they have almost no dependencies.
3
+ `augment-vir` is a collection of small helper functions that I constantly use across all my JavaScript and TypeScript repos. I call these functions `augments`. These are functions, constants, and types typically placed within a "util", or "helpers", etc. directory.
4
4
 
5
5
  This `common` package is for environment-agnostic augments. Everything in here will work in Node.js or the browser with identical results.
@@ -23,6 +23,8 @@ export type SetOptionalAndNullable<OriginalObjectGeneric, OptionalKeysGeneric ex
23
23
  }>;
24
24
  /** Require only a subset of object properties. */
25
25
  export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
26
+ export declare function makeWritable<T>(input: T): Writeable<T>;
27
+ export declare function makeReadonly<T>(input: T): Readonly<T>;
26
28
  /**
27
29
  * Require only a subset of object properties and require that they be not null. This is
28
30
  * particularly useful in conjunction with the "exactOptionalPropertyTypes" tsconfig flag.
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureType = exports.wrapNarrowTypeWithTypeCheck = void 0;
3
+ exports.ensureType = exports.wrapNarrowTypeWithTypeCheck = exports.makeReadonly = exports.makeWritable = void 0;
4
+ function makeWritable(input) {
5
+ return input;
6
+ }
7
+ exports.makeWritable = makeWritable;
8
+ function makeReadonly(input) {
9
+ return input;
10
+ }
11
+ exports.makeReadonly = makeReadonly;
4
12
  /**
5
13
  * This function returns another function that simply returns whatever input it's given. However, it
6
14
  * also checks that the input matches the original wrapNarrowTypeWithTypeCheck's generic, while
@@ -23,6 +23,8 @@ export type SetOptionalAndNullable<OriginalObjectGeneric, OptionalKeysGeneric ex
23
23
  }>;
24
24
  /** Require only a subset of object properties. */
25
25
  export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
26
+ export declare function makeWritable<T>(input: T): Writeable<T>;
27
+ export declare function makeReadonly<T>(input: T): Readonly<T>;
26
28
  /**
27
29
  * Require only a subset of object properties and require that they be not null. This is
28
30
  * particularly useful in conjunction with the "exactOptionalPropertyTypes" tsconfig flag.
@@ -1,3 +1,9 @@
1
+ export function makeWritable(input) {
2
+ return input;
3
+ }
4
+ export function makeReadonly(input) {
5
+ return input;
6
+ }
1
7
  /**
2
8
  * This function returns another function that simply returns whatever input it's given. However, it
3
9
  * also checks that the input matches the original wrapNarrowTypeWithTypeCheck's generic, while
@@ -23,6 +23,8 @@ export type SetOptionalAndNullable<OriginalObjectGeneric, OptionalKeysGeneric ex
23
23
  }>;
24
24
  /** Require only a subset of object properties. */
25
25
  export type RequiredBy<T, K extends keyof T> = Overwrite<T, Required<Pick<T, K>>>;
26
+ export declare function makeWritable<T>(input: T): Writeable<T>;
27
+ export declare function makeReadonly<T>(input: T): Readonly<T>;
26
28
  /**
27
29
  * Require only a subset of object properties and require that they be not null. This is
28
30
  * particularly useful in conjunction with the "exactOptionalPropertyTypes" tsconfig flag.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "11.1.2",
3
+ "version": "11.3.0",
4
4
  "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",
5
5
  "bugs": {
6
6
  "url": "https://github.com/electrovir/augment-vir/issues"