@types/dot-object
- Version 2.1.6
- Published
- 9.24 kB
- No dependencies
- MIT license
Install
npm i @types/dot-object
yarn add @types/dot-object
pnpm add @types/dot-object
Overview
TypeScript definitions for dot-object
Index
Variables
Namespaces
Variables
variable dot
var dot: DotObject.DotConstructor;
Namespaces
namespace dot-object
module 'dot-object' {}
variable dot
var dot: DotObject.DotConstructor;
namespace DotObject
namespace DotObject {}
interface Dot
interface Dot {}
property keepArray
keepArray: boolean;
Keep array
example:
var obj = { "id": "my-id", "other": [1, 2, 3] "some": { "array": ["A", "B"] } }
if the keepArray property is true:
{ "id": "my-id", "other": [1, 2, 3], "some.array": ["A", "B"] }
method copy
copy: ( source: string, target: string, obj1: any, obj2: any, mods?: ModifierFunctionWrapper | ModifierFunctionWrapper[], merge?: boolean) => void;
Copy a property from one object to another object.
If the source path does not exist (undefined) the property on the other object will not be set.
Parameter source
Parameter target
Parameter obj1
Parameter obj2
Parameter mods
Parameter merge
method del
del: (path: string | string[], obj: any) => any;
Remove value from an object using dot notation.
Parameter path
Parameter obj
{Mixed} The removed value
method delete
delete: (path: string | string[], obj: any) => any;
Delete value from an object using dot notation.
Parameter path
Parameter obj
{any} The removed value
method dot
dot: { (obj: any, tgt: any): void; (obj: any): any };
Convert object to dotted-key/value pair
Usage: var tgt = {} dot.dot(obj, tgt)
Parameter obj
source object
Parameter tgt
target object
Convert object to dotted-key/value pair
Usage:
var tgt = dot.dot(obj)
Parameter obj
source object {Object} result
method move
move: ( source: string, target: string, obj: any, mods?: ModifierFunctionWrapper | ModifierFunctionWrapper[], merge?: boolean) => void;
Move a property from one place to the other.
If the source path does not exist (undefined) the target property will not be set.
Parameter source
Parameter target
Parameter obj
Parameter mods
Parameter merge
method object
object: ( obj: object, mods?: ModifierFunctionWrapper | ModifierFunctionWrapper[]) => object;
Converts an object with dotted-key/value pairs to it's expanded version
Optionally transformed by a set of modifiers.
Usage:
var row = { 'nr': 200, 'doc.name': ' My Document ' }
var mods = { 'doc.name': [_s.trim, _s.underscored] }
dot.object(row, mods)
Parameter obj
Parameter mods
method pick
pick: (path: string, obj: any, remove?: boolean) => any;
Pick a value from an object using dot notation.
Optionally remove the value
Parameter path
Parameter obj
Parameter remove
method remove
remove: (path: string | string[], obj: any) => any;
Remove value from an object using dot notation.
Parameter path
Parameter obj
{Mixed} The removed value
method set
set: (path: string, v: any, obj: object, merge?: boolean) => void;
Replace/merge an object to an existing object property
Parameter path
dotted path
Parameter v
object to be set
Parameter obj
object to be modified
Parameter merge
optional merge
method str
str: ( path: string, v: any, obj: object, mods?: ModifierFunctionWrapper | ModifierFunctionWrapper[]) => void;
Replace/create with a string
Parameter path
dotted path
Parameter v
value to be set
Parameter obj
object to be modified
Parameter mods
optional modifier
method transfer
transfer: ( source: string, target: string, obj1: any, obj2: any, mods?: ModifierFunctionWrapper | ModifierFunctionWrapper[], merge?: boolean) => void;
Transfer a property from one object to another object.
If the source path does not exist (undefined) the property on the other object will not be set.
Parameter source
Parameter target
Parameter obj1
Parameter obj2
Parameter mods
Parameter merge
method transform
transform: ( recipe: any, obj: any, mods?: ModifierFunctionWrapper | ModifierFunctionWrapper[]) => void;
Transform an object
Usage:
var obj = { "id": 1, "some": { "thing": "else" } }
var transform = { "id": "nr", "some.thing": "name" }
var tgt = dot.transform(transform, obj)
Parameter recipe
Transform recipe
Parameter obj
Object to be transformed
Parameter mods
modifiers for the target
interface DotConstructor
interface DotConstructor extends Dot {}
construct signature
new ( separator: string, override?: boolean, useArray?: boolean, useBrackets?: boolean): Dot;
interface ModifierFunctionWrapper
interface ModifierFunctionWrapper {}
call signature
(arg: any): any;
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/dot-object
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/dot-object)
- HTML<a href="https://www.jsdocs.io/package/@types/dot-object"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3939 ms. - Missing or incorrect documentation? Open an issue for this package.