1.0.7 • Published 3 years ago

@travic/get v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

GET

ci npm version npm

Coverage lines Coverage functions Coverage branches Coverage statements

npm i @travic/get
or
yarn add @travic/get

To use, import or require package;

import { get } from '@travic/get';
// or
const { get } = require('@travic/get');

// example use

const obj = {
	a: 'string',
	b: true,
	c: {
		aa: 'another string',
	},
	d: [1, 2, 3],
};

get(obj, 'a'); // -> 'string'

get(obj, 'b'); // -> true

get(obj, 'c'); // -> { aa: 'aa' }

get(obj, 'c.aa'); // -> 'another string'

get(obj, 'c.aa.aaa'); // -> null

get(obj, 'c.aa.aaa', "It's not here!"); // -> "It's not here!"

get(obj, 'd.1'); // -> 2

get(1, 'd.1'); // -> null
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago