@travic/get
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

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

Package Sidebar

Install

npm i @travic/get

Weekly Downloads

0

Version

1.0.7

License

ISC

Unpacked Size

4.92 kB

Total Files

6

Last publish

Collaborators

  • travic