Skip to content

NickGard/tiny-get

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny-get

source bundle size build status license

A minimal-weight utility similar to lodash.get. For when every byte counts!


lodash.get bundle size
tiny-get bundle size


Syntax

get(/* root, path [, default] */)

Parameters

root - An object or array to traverse
path - A string of the path, or an array of property names to be traversed
default - [optional] A value to be returned if the path does not exist or results in an undefined value

Return

The value found at the path on the root object or array, if it exists. If the path is invalid or results in an undefined value, then tiny-get will return undefined or the default value if passed.

Example

import { get } from '@ngard/tiny-get';

const value = get(baseObj, 'really.deep.value', 'defaultValue');
const value = get(baseObj, 'really["deep"].value', 'defaultValue');
const value = get(baseObj, ['really', 'deep', 'value'], 'defaultValue');

About

A minimal-weight lodash.get equivalent utility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published