@types/object-path
- Version 0.11.4
- Published
- 6.5 kB
- No dependencies
- MIT license
Install
npm i @types/object-path
yarn add @types/object-path
pnpm add @types/object-path
Overview
TypeScript definitions for object-path
Index
Variables
variable objectPath
const objectPath: objectPath.ObjectPathStatic & { withInheritedProps: objectPath.ObjectPathStatic; create(options?: objectPath.Options): objectPath.ObjectPathStatic;};
Interfaces
interface ObjectPathBound
interface ObjectPathBound<T extends object> {}
method coalesce
coalesce: { <TResult>(paths: Path | Path[], defaultValue: TResult): TResult; <TResult = any>(paths: Path | Path[], defaultValue?: TResult): TResult;};
See Also
objectPath.coalesce
method del
del: (path: Path) => { [key: string]: any };
See Also
objectPath.del
method empty
empty: (path: Path) => any;
See Also
objectPath.empty
method ensureExists
ensureExists: { <TResult>(path: Path, defaultValue: TResult): TResult; <TResult = any>(path: Path, defaultValue?: TResult): TResult;};
See Also
objectPath.ensureExists
method get
get: { (path: Path): any; <TResult>(path: Path, defaultValue: TResult): TResult;};
See Also
objectPath.get
method has
has: (path: Path) => boolean;
See Also
objectPath.has
method insert
insert: (path: Path, value: any, at?: number) => void;
See Also
objectPath.insert
method push
push: (path: Path, ...items: any[]) => void;
See Also
objectPath.push
method set
set: <TResult = any>( path: Path, value: TResult, doNotReplace?: boolean) => TResult | undefined;
See Also
objectPath.set
interface ObjectPathStatic
interface ObjectPathStatic {}
method coalesce
coalesce: { <TResult>( object: object, paths: Path | Path[], defaultValue: TResult ): TResult; <TResult = any>( object: object, paths: Path | Path[], defaultValue?: TResult ): TResult;};
Get the first non undefined property
method del
del: (object: object, path: Path) => { [key: string]: any };
Deletes a member from object or array
method empty
empty: (object: object, path: Path) => any;
Empty a path. Arrays are set to length 0, objects have all elements deleted, strings are set to empty, numbers to 0, everything else is set to null
method ensureExists
ensureExists: { <TResult>(object: object, path: Path, defaultValue: TResult): TResult; <TResult = any>(object: object, path: Path, defaultValue?: TResult): TResult;};
Set a value if it doesn't exist, do nothing if it does
method get
get: { (object: object, path: Path): any; <TResult>(object: object, path: Path, defaultValue: TResult): TResult;};
Get a path from an object
method has
has: (object: object, path: Path) => boolean;
Tests path existence
method insert
insert: (object: object, path: Path, value: any, at?: number) => void;
Insert an item in an array path
method push
push: (object: object, path: Path, ...items: any[]) => void;
Create (if path isn't an array) and push the value to it. Can push unlimited number of values
method set
set: <TResult = any>( object: object, path: Path, value: TResult, doNotReplace?: boolean) => TResult | undefined;
Set a path to a value Any existing value on the path if any
call signature
<T extends object>(object: T): ObjectPathBound<T>;
Binds an object
interface Options
interface Options {}
property includeInheritedProps
includeInheritedProps?: boolean | undefined;
Type Aliases
type Path
type Path = Array<number | string> | number | string;
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/object-path
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/object-path)
- HTML<a href="https://www.jsdocs.io/package/@types/object-path"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3947 ms. - Missing or incorrect documentation? Open an issue for this package.