-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - Added import and documentation URLs. * - Removed outdated dependency reference. * - Updated main README with module documentation links. * - Updated dangling aside statements to use blockquoes for differentiation. * - [@eznastdlib/async] Added missing examples and docstrings. * - [enzastdlib/async] Ran examples through `deno fmt`. * - [enzastdlib/collections] Added missing docstrings and examples. * - Removed extra spacing. * - [@enzastdlib/errors] Added missing docstrings and examples. * - [@enzastdlib/events] Added missing docstrings and examples. * - [@enzastdlib/strings] Added missing docstrings and examples. * - [@enzastdlib/os] Added missing docstrings and examples. - **NOTE**: The MacOS paths were not tested as I do not have access to a MacOS device. - [@enzastdlib/os] Added credits for XDG documentation used. * - [@enzastdlib/path] Added missing docstrings and examples. * - [@enzastdlib/os] Fixed missing code fences. * - [@enzastdlib/json5] Added missing docstrings and examples. - [@enzastdlib/json5] Added TODO for creating tests. * - [@enzastdlib/testing] Added missing docstrings and examples. * - [@enzastdlib/json5] Fixed docstring typo. * - [@enzastdlib/schema] Added missing docstrings and examples. * - [@enzastdlib/json5] Fixed import typo. * - Added global TODOs for documentation. * - [@enzastdlib/schema] Added missing Markdown code block language specifiers.
- Loading branch information
Showing
50 changed files
with
1,257 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,87 @@ | ||
/** | ||
* Represents an `Object` that has no properties. | ||
* Represents an `Object` type that has no properties. | ||
* | ||
* @example | ||
* ```typescript | ||
* import type { EmptyObject } from 'https://deno.land/x/enzastdlib/collections/mod.ts'; | ||
* | ||
* type X = EmptyObject; // `{ [x: string]: never; [x: number]: never; [x: symbol]: never }` | ||
* ``` | ||
*/ | ||
export type EmptyObject = Record<PropertyKey, never>; | ||
|
||
/** | ||
* Returns an `Object` where properties with `Type` as the their typing are omitted. | ||
* Returns an `Object` where members with the given type are picked into a new `Object` type. | ||
* | ||
* @example | ||
* ```typescript | ||
* import type { PickValues } from 'https://deno.land/x/enzastdlib/collections/mod.ts'; | ||
* | ||
* const MY_CONSTANT_OBJECT = { | ||
* myBoolean: false, | ||
* | ||
* myNumber: 42, | ||
* | ||
* myString: 'Hello World', | ||
* | ||
* otherNumber: 84, | ||
* } as const; | ||
* | ||
* type FilteredValues = PickValues<typeof MY_CONSTANT_OBJECT, number>; // `{ readonly myNumber: 42; readonly otherNumber: 84; }` | ||
*/ | ||
export type PickValues<Obj, Value> = { | ||
[Key in keyof Obj as Obj[Key] extends Value ? Key : never]: Obj[Key]; | ||
}; | ||
|
||
/** | ||
* Returns an `Object` where properties with `Type` as the their typing are omitted. | ||
* Returns an `Object` where members with the given type are omitted from a new `Object` type. | ||
* | ||
* @example | ||
* ```typescript | ||
* import type { OmitValues } from 'https://deno.land/x/enzastdlib/collections/mod.ts'; | ||
* | ||
* const MY_CONSTANT_OBJECT = { | ||
* myBoolean: false, | ||
* | ||
* myNumber: 42, | ||
* | ||
* myString: 'Hello World', | ||
* | ||
* otherNumber: 84, | ||
* } as const; | ||
* | ||
* type FilteredValues = OmitValues<typeof MY_CONSTANT_OBJECT, number>; // `{ readonly myBoolean: false; readonly myString: "Hello World"; }` | ||
*/ | ||
export type OmitValues<Obj, Value> = { | ||
[Key in keyof Obj as Obj[Key] extends Value ? never : Key]: Obj[Key]; | ||
}; | ||
|
||
/** | ||
* Returns all the values of an `Object` as a type union. | ||
* Returns all the values of an `Object` as a type union of its values. | ||
* | ||
* @example | ||
* ```typescript | ||
* import type { ValueOf } from 'https://deno.land/x/enzastdlib/collections/mod.ts'; | ||
* | ||
* const MY_CONSTANT_OBJECT = { | ||
* x: 1, | ||
* y: 2, | ||
* z: 3 | ||
* } as const; | ||
* | ||
* type MyValues = ValueOf<typeof MY_CONSTANT_OBJECT>; // `1 | 2 | 3` | ||
* ``` | ||
*/ | ||
export type ValueOf<Obj> = Obj[keyof Obj]; | ||
|
||
/** | ||
* Represents an `Object` that has unknown properties. | ||
* Represents an `Object` type that has unknown properties. | ||
* | ||
* @example | ||
* ```typescript | ||
* import type { UnknownObject } from 'https://deno.land/x/enzastdlib/collections/mod.ts'; | ||
* | ||
* type X = UnknownObject; // `{ [x: string]: unknown; [x: number]: unknown; [x: symbol]: unknown }` | ||
* ``` | ||
*/ | ||
export type UnknownObject = Record<PropertyKey, unknown>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.