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

jora

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jora - npm Package Compare versions

Comparing version 1.0.0-beta.12 to 1.0.0-beta.13

6

package.json
{
"name": "jora",
"version": "1.0.0-beta.12",
"version": "1.0.0-beta.13",
"description": "JavaScript object query engine",

@@ -25,3 +25,5 @@ "author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)",

"require": "./cjs/index.cjs"
}
},
"./dist/*": "./dist/*",
"./package.json": "./package.json"
},

@@ -28,0 +30,0 @@ "scripts": {

@@ -75,3 +75,3 @@ import { hasOwn } from '../utils/misc.js';

const prevScope = ctx.scope;
const scopeStart = buffer.length;
const scopeStart = buffer.length - 1;

@@ -92,3 +92,3 @@ ctx.scope = prevScope.spawn(prevScope.arg1 || kind === 'method', $ref);

} else {
buffer[scopeStart] = defCurrent(buffer[scopeStart], stat);
buffer[scopeStart] += defCurrent(stat);
}

@@ -124,4 +124,3 @@ }

if (node.type === 'Current' &&
ctx.scope.firstCurrent === null &&
ctx.scope.captureCurrent.disabled !== true) {
ctx.scope.firstCurrent === null) {
ctx.scope.firstCurrent = buffer.length;

@@ -245,5 +244,5 @@ }

() => walk(ast),
(scopeStart, sp) => {
(sp) => {
buffer.push(')');
return '(' + sp + ',' + scopeStart;
return '(' + sp + ',';
},

@@ -250,0 +249,0 @@ 'data'

@@ -92,5 +92,10 @@ const binary = {

ctx.put(`)?${tmpVar}:`);
ctx.scope.captureCurrent.disabled = true;
ctx.node(node.right);
ctx.scope.captureCurrent.disabled = false;
ctx.createScope(
() => ctx.node(node.right),
(sp) => {
ctx.put(')');
return '(' + sp + ',';
},
ctx.scope.$ref
);
break;

@@ -104,8 +109,15 @@ }

// TODO: replace for Nullish coalescing operator (??) instead of ternary operator once drop support for Node.js below 14.0
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing
ctx.put(`(${tmpVar}=`);
ctx.node(node.left);
ctx.put(`,${tmpVar}!==null&&${tmpVar}!==undefined)?${tmpVar}:`);
ctx.scope.captureCurrent.disabled = true;
ctx.node(node.right);
ctx.scope.captureCurrent.disabled = false;
ctx.createScope(
() => ctx.node(node.right),
(sp) => {
ctx.put(')');
return '(' + sp + ',';
},
ctx.scope.$ref
);
break;

@@ -112,0 +124,0 @@ }

@@ -8,2 +8,3 @@ export function suggest(node, ctx) {

if (node.definitions.length) {
ctx.put('(()=>{');
ctx.createScope(

@@ -15,13 +16,10 @@ () => {

ctx.put('(()=>{');
ctx.list(node.definitions);
ctx.put('return ');
ctx.nodeOrCurrent(node.body);
ctx.put('})()');
},
(scopeStart, sp) => {
return scopeStart + sp + ';';
},
(sp) => sp + ';',
ctx.scope.$ref
);
ctx.put('})()');
} else if (node.body && node.body.type === 'Object') {

@@ -28,0 +26,0 @@ ctx.put('(');

@@ -10,19 +10,16 @@ const comparator = {

export function compile(node, ctx) {
if (node.order.startsWith('desc')) {
const isDesc = node.order.startsWith('desc');
const cmpFn = comparator[node.order.slice(isDesc ? 4 : 3)] || comparator[''];
if (isDesc) {
ctx.put('-');
}
ctx.put(ctx.buildinFn(cmpFn));
ctx.put('((_q=$=>(');
ctx.createScope(
() => {
const cmpFn = comparator[node.order.slice(3 + node.order.startsWith('desc'))] || comparator[''];
ctx.put(ctx.buildinFn(cmpFn));
ctx.put('((_q=$=>(');
ctx.node(node.query);
ctx.put('))(a),_q(b))');
},
(scopeStart, sp) => {
return scopeStart + sp + ',';
}
() => ctx.node(node.query),
(sp) => sp + ','
);
ctx.put('))(_a),_q(_b))');
}

@@ -29,0 +26,0 @@ export function walk(node, ctx) {

export function compile(node, ctx) {
ctx.put('(a, b)=>{let _q;return ');
ctx.put('(_a, _b)=>{let _q;return ');
ctx.list(node.compares, '||');

@@ -4,0 +4,0 @@ ctx.put('||0}');

export function compile(node, ctx) {
ctx.put(ctx.buildinFn('bool'));
ctx.put('(');
ctx.scope.captureCurrent.disabled = true;
ctx.nodeOrCurrent(node.test);
ctx.put(')?');
ctx.nodeOrCurrent(node.consequent);
ctx.createScope(
() => ctx.nodeOrCurrent(node.consequent),
(sp) => {
ctx.put(')');
return '(' + sp + ',';
},
ctx.scope.$ref
);
ctx.put(':');
if (node.alternate) {
ctx.node(node.alternate);
} else {
ctx.put('undefined');
}
ctx.scope.captureCurrent.disabled = false;
ctx.createScope(
() => {
if (node.alternate) {
if (node.alternate.type === 'Placeholder') {
ctx.put('(');
ctx.node(node.alternate);
ctx.put(',undefined)');
} else {
ctx.node(node.alternate);
}
} else {
ctx.put('undefined');
}
},
(sp) => {
ctx.put(')');
return '(' + sp + ',';
},
ctx.scope.$ref
);
}

@@ -16,0 +36,0 @@ export function walk(node, ctx) {

@@ -5,10 +5,8 @@ export function compile(node, ctx) {

ctx.nodeOrCurrent(node.value);
ctx.put(',$=>');
ctx.createScope(
() => {
ctx.put(',$=>');
ctx.node(node.query);
},
(scopeStart, sp) => {
() => ctx.node(node.query),
(sp) => {
ctx.put(')');
return scopeStart + '(' + sp + ',';
return '(' + sp + ',';
}

@@ -15,0 +13,0 @@ );

export function compile(node, ctx) {
const args = node.arguments.map(arg => '$' + arg.name);
const duplicateNameNode = node.arguments.find((node, index) =>
index > 0 && args.lastIndexOf('$' + node.name, index - 1) !== -1
);
if (duplicateNameNode) {
ctx.error('Duplicate parameter name "$' + duplicateNameNode.name + '" is not allowed', duplicateNameNode);
}
// use function(){} since Arg1 refers to arguments[1],
// but Function doesn't create 2nd argument implicitly to prevent function arity changes
ctx.put('function(');
ctx.put(String(args) || '$');
ctx.put('){return ');
ctx.createScope(
() => {
const args = node.arguments.map(arg => '$' + arg.name);
ctx.scope.arg1 = true;

@@ -13,12 +25,7 @@ ctx.scope.$ref = args[0] || '$';

ctx.put('function(');
ctx.put(String(args) || '$');
ctx.put('){return ');
ctx.node(node.body);
ctx.put('}');
},
(scopeStart, sp) => {
return scopeStart + sp + ',';
}
(sp) => sp + ','
);
ctx.put('}');
}

@@ -25,0 +32,0 @@ export function walk(node, ctx) {

@@ -5,10 +5,8 @@ export function compile(node, ctx) {

ctx.nodeOrCurrent(node.value);
ctx.put(',$=>');
ctx.createScope(
() => {
ctx.put(',$=>');
ctx.node(node.query);
},
(scopeStart, sp) => {
() => ctx.node(node.query),
(sp) => {
ctx.put(')');
return scopeStart + '(' + sp + ',';
return '(' + sp + ',';
}

@@ -15,0 +13,0 @@ );

@@ -5,10 +5,8 @@ export function compile(node, ctx) {

ctx.nodeOrCurrent(node.value);
ctx.put(',$=>');
ctx.createScope(
() => {
ctx.put(',$=>');
ctx.node(node.query);
},
(scopeStart, sp) => {
() => ctx.node(node.query),
(sp) => {
ctx.put(')');
return scopeStart + '(' + sp + ',';
return '(' + sp + ',';
}

@@ -15,0 +13,0 @@ );

export function compile(node, ctx) {
ctx.put('($=>(');
ctx.createScope(
() => {
ctx.put('($=>(');
ctx.node(node.right);
ctx.put('))');
},
(scopeStart, sp) => {
return scopeStart + sp + ',';
}
() => ctx.node(node.right),
(sp) => sp + ','
);
ctx.put('))');
ctx.put('(');

@@ -14,0 +9,0 @@ ctx.nodeOrCurrent(node.left);

export function compile(node, ctx) {
if (node.operator && node.operator.type) {
ctx.put('($=>(');
ctx.createScope(
() => {
ctx.put('($=>(');
ctx.node(node.operator);
ctx.put('))');
},
(scopeStart, sp) => {
return scopeStart + sp + ',';
}
() => ctx.node(node.operator),
(sp) => sp + ','
);
ctx.put('))');
ctx.put('(');

@@ -19,7 +15,3 @@ ctx.node(node.argument);

switch (node.operator) {
default: {
ctx.error('Unknown operator "' + node.operator + '"', node);
}
}
ctx.error('Unknown operator "' + node.operator + '"', node);
}

@@ -26,0 +18,0 @@ export function walk(node, ctx) {

@@ -682,3 +682,6 @@ /* parser generated by jison 0.4.18-remastered.7 */

break;
case 15: case 17: case 18: case 162:
case 15: case 17:
this.$ = {type:"Placeholder",range:[_$[$0].range[1],_$[$0].range[1]]}
break;
case 18: case 162:
this.$ = null

@@ -685,0 +688,0 @@ break;

@@ -37,3 +37,3 @@ export const hasOwn = Object.hasOwn || ((subject, key) => Object.hasOwnProperty.call(subject, key));

export function isArrayLike(value) {
return value && hasOwn(value, 'length') && isFinite(value.length);
return value && (isArray(value) || (hasOwn(value, 'length') && isFinite(value.length)));
}

@@ -40,0 +40,0 @@

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

export const version = '1.0.0-beta.12';
export const version = '1.0.0-beta.13';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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