Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eval-json-path

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eval-json-path

Evaluate and query json object value at given path

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-78.69%
Maintainers
1
Weekly downloads
 
Created
Source

eval-json-path

Evaluate/Query the value of json object at given path

JavaScript Style Guide

Commonly js object variable can be accessed by property name or index. This module allow to access by path/steps given by a string

Usage


const evalJsonPath = require('eval-json-path')

const value = evalJsonPath(obj, 'prop.subprop[prett-prop][3].lastprop')

const sameValue = obj.prop.subprop['prett-prop'][3].lastprop

The evaluation is done by each step, which is null-safe, any not-existing step will result undefined or fallback

API

evalJsonPath(obj, path, fallback)

  • obj: The object should has sub property
  • path: A string represent the path/steps
  • fallback: A optional fallback for any not-existing step

Keywords

FAQs

Package last updated on 31 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc