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

json-rel

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-rel - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/querySpec.js

2

package.json
{
"name": "json-rel",
"version": "0.0.1",
"version": "0.0.2",
"description": "Transparent data references in JSON",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -50,1 +50,3 @@ import jsonPath from 'jsonpath'

export const $ = () => new PathRel(...arguments)
export default {PathRel, PathRelSpec, $}

@@ -45,1 +45,3 @@ import jsonPointer from 'jsonpointer'

export const _ = () => new PointerRel(...arguments)
export default {PointerRel, PointerRelSpec, _}
import jsonQuery from 'json-query'
import {AbstractRel, AbstractRelSpec} from './abstract'
export class QueryRel extends AbstractRel {
constructor(path, value) {
super({ path, value, spec: new QueryRelSpec() })
this.path = path
this.value = value
}
}
export class QueryRelSpec extends AbstractRelSpec {

@@ -11,3 +21,3 @@

matches(rel) {
if (!rel.constructor === String && !rel.constructor === Array) {
if (!rel.constructor === String && !rel instanceof Array) {
return false

@@ -19,2 +29,14 @@ }

follow(rel, data) {
if (this.matches(rel)) {
return jsonQuery(rel, {data}).value || []
}
}
update(rel, obj, data) {
// TODO - no core support
}
}
export const ø = () => new QueryRel(...arguments)
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