New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pluckey

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pluckey

A tiny util library to pluck key from deep arrays and objects

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

pluckey - plucks key

A tiny util library to pluck key from deep arrays and objects

const pluckey = require('pluckey');

//sample object
let college={
	class:{
		student:[{
			'name':'Vigneshwaran P',
			'rollNo':'103',
			'results':[
				{
					'subject': 'Tamil',
					'mark':99
				},
				{
					'subject': 'Nodejs',
					'mark':80
				}
			]
		},
		{
			'name':'Bob',
			'rollNo':'102',
			'results':[
				{
					'subject': 'English',
					'mark':88
				},
				{
					'subject': 'Nodejs',
					'mark':89
				}
			]
		}
		]
	}
}

pluckey(college,'class.student.results.subject');
//output=> [ 'Tamil', 'Nodejs', 'English', 'Nodejs' ]

pluckey(college,'class.student.results'); 
/*output=> [
  { subject: 'Tamil', mark: 99 },
  { subject: 'Nodejs', mark: 80 },
  { subject: 'English', mark: 88 },
  { subject: 'Nodejs', mark: 89 }
]*/

pluckey(college,'class.student.name');
//output=>[ 'Vigneshwaran P', 'Bob' ]

Installation

Installation is done using the npm install command:

$ npm install pluckey

Keywords

plucky

FAQs

Package last updated on 07 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts