tc-get
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

GET

To install;

npm i tc-get

To use, import or require package;

import { get } from 'tc-get'
// or
const { get } = require('tc-get');

// ...

// example use

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

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

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

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

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

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

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

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

console.log(get(1, "d.1")); // -> null

Readme

Keywords

Package Sidebar

Install

npm i tc-get

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

9.52 kB

Total Files

8

Last publish

Collaborators

  • travic