New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jsonic/directive

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonic/directive - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

2

directive.d.ts

@@ -5,3 +5,3 @@ import { AltAction, Plugin } from 'jsonic';

open: string;
action: AltAction;
action: AltAction | string;
close?: string;

@@ -8,0 +8,0 @@ rules?: string | string[];

@@ -13,2 +13,6 @@ "use strict";

let action = options.action;
if ('string' === typeof action) {
let path = action;
action = (rule) => (rule.node = jsonic.util.prop(jsonic.options, path));
}
let token = {};

@@ -15,0 +19,0 @@ let openTN = '#D_open_' + name;

@@ -1,1 +0,1 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JsonicDirective=e()}}((function(){var e={};Object.defineProperty(e,"__esModule",{value:!0}),e.Directive=void 0;const n=(e,n)=>{let l=("string"==typeof n.rules?n.rules.split(/\s*,\s*/):n.rules||[]).filter(e=>""!==e),t=n.name,o=n.open,i=n.close,r=n.action,s={},u="#D_open_"+t,d="#D_close_"+t,c=e.fixed(o),a=null==i?null:e.fixed(i);if(null!=c)throw new Error("Directive open token already in use: "+o);s[u]=o,null==a&&null!=i&&(s[d]=i),e.options({fixed:{token:s},error:{[t+"_close"]:null==i?null:"directive "+t+' close "'+i+'" without open "'+o+'"'},hint:{[t+"_close"]:null==i?null:`\nThe ${t} directive must start with the characters "${o}" and end\nwith the characters "${i}". The end characters "${i}" may not\nappear without the start characters "${o}" appearing first:\n"${o}...${i}".\n`}});let f=e.token.CA;c=e.fixed(o),a=null==i?null:e.fixed(i),l.forEach(n=>{e.rule(n,e=>(e.open({s:[c],p:t,n:{dr:1}}),null!=i&&(e.open([{s:[a],c:{n:{dr:0}},e:(e,n)=>n.t0.bad(t+"_close")},{s:[a],b:1}]),e.close({s:[a],b:1})),e))}),e.rule(t,e=>e.clear().bo(e=>e.node={}).open([{p:"val",n:null==i?{}:{pk:-1,il:0}}]).bc((...e)=>r(...e)).close(null!=i?[{s:[a]},{s:[f,a]}]:[]))};return e.Directive=n,n.defaults={rules:"val,pair,elem"},e}));
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JsonicDirective=e()}}((function(){var e={};Object.defineProperty(e,"__esModule",{value:!0}),e.Directive=void 0;const n=(e,n)=>{let l=("string"==typeof n.rules?n.rules.split(/\s*,\s*/):n.rules||[]).filter(e=>""!==e),t=n.name,o=n.open,i=n.close,r=n.action;if("string"==typeof r){let n=r;r=l=>l.node=e.util.prop(e.options,n)}let s={},u="#D_open_"+t,d="#D_close_"+t,c=e.fixed(o),f=null==i?null:e.fixed(i);if(null!=c)throw new Error("Directive open token already in use: "+o);s[u]=o,null==f&&null!=i&&(s[d]=i),e.options({fixed:{token:s},error:{[t+"_close"]:null==i?null:"directive "+t+' close "'+i+'" without open "'+o+'"'},hint:{[t+"_close"]:null==i?null:`\nThe ${t} directive must start with the characters "${o}" and end\nwith the characters "${i}". The end characters "${i}" may not\nappear without the start characters "${o}" appearing first:\n"${o}...${i}".\n`}});let a=e.token.CA;c=e.fixed(o),f=null==i?null:e.fixed(i),l.forEach(n=>{e.rule(n,e=>(e.open({s:[c],p:t,n:{dr:1}}),null!=i&&(e.open([{s:[f],c:{n:{dr:0}},e:(e,n)=>n.t0.bad(t+"_close")},{s:[f],b:1}]),e.close({s:[f],b:1})),e))}),e.rule(t,e=>e.clear().bo(e=>e.node={}).open([{p:"val",n:null==i?{}:{pk:-1,il:0}}]).bc((...e)=>r(...e)).close(null!=i?[{s:[f]},{s:[a,f]}]:[]))};return e.Directive=n,n.defaults={rules:"val,pair,elem"},e}));

@@ -8,3 +8,3 @@ /* Copyright (c) 2021 Richard Rodger, MIT License */

open: string
action: AltAction
action: AltAction | string
close?: string

@@ -25,2 +25,8 @@ rules?: string | string[]

if ('string' === typeof action) {
let path = action
action = (rule: Rule) =>
(rule.node = jsonic.util.prop(jsonic.options, path))
}
let token: Record<string, string> = {}

@@ -27,0 +33,0 @@

{
"name": "@jsonic/directive",
"version": "0.1.1",
"version": "0.2.0",
"description": "This plugin allows the [Jsonic](https://jsonic.senecajs.org) JSON parser to support directive syntax.",

@@ -43,14 +43,14 @@ "main": "directive.js",

"devDependencies": {
"@types/jest": "^26.0.24",
"@types/jest": "^27.0.1",
"browserify": "^17.0.0",
"esbuild": "^0.12.24",
"esbuild": "^0.12.26",
"esbuild-jest": "^0.5.0",
"jest": "^27.0.6",
"jest": "^27.1.1",
"jsonic": "github:jsonicjs/jsonic#nextgen",
"prettier": "^2.3.2",
"prettier": "^2.4.0",
"tinyify": "^3.0.0",
"ts-jest": "^27.0.4",
"typescript": "^4.3.5"
"ts-jest": "^27.0.5",
"typescript": "^4.4.2"
},
"dependencies": {}
}

Sorry, the diff of this file is not supported yet

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