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

glance-json

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glance-json

Use glance for referencing data in json

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Glance JSON

npm install glance-json

Example

import glanceJSON from 'glance-json';

let data = {
	contact: {
		firstName: "John",
		lastName: "Doe",
		phoneNumber: 555-555-555
	}
};

glanceJSON(data, "John > phoneNumber") // 555-555-555

Options

key

Perform an exact match search on keys

let data = {
	square: {
		backgroundColor: "blue",
		color: "red"
	}
};

glanceJSON(data, "color#key"); // red

value

Perform an exact match search on values

let data = {
	contacts: [{
		firstName: "John",
		lastName: "Doe",
		phoneNumber: 555-555-555
	},
    {
    	firstName: "Johnny",
       	lastName: "Doey",
       	phoneNumber: 555-555-555	
    }]
};

glanceJSON(data, "John#value > phoneNumber") // 555-555-555

key-contains

Perform a contains text search on keys

let data = {
	contact: {
		firstName: "John",
		lastName: "Doe",
		phoneNumber: 555-555-555
	}
};

glanceJSON(data, "first#key-contains > phoneNumber") // 555-555-555

value-contains

Perform a contains text search on values

let data = {
	contact: {
		firstName: "John",
		lastName: "Doe",
		phoneNumber: 555-555-555
	}
};

glanceJSON(data, "555#value-contains > firstName") // John

Keywords

glance

FAQs

Package last updated on 21 May 2018

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