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

cool-path

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cool-path - npm Package Compare versions

Comparing version 0.1.23 to 0.1.24

9

lib/matcher.js

@@ -5,2 +5,3 @@ "use strict";

var utils_1 = require("./utils");
var isValid = function (val) { return val !== undefined && val !== null && val !== ''; };
var Matcher = (function () {

@@ -10,3 +11,5 @@ function Matcher(tree) {

this.matchNext = function (node, path) {
return node.after ? _this.matchAtom(path, node.after) : !!path[_this.pos];
return node.after
? _this.matchAtom(path, node.after)
: isValid(path[_this.pos]);
};

@@ -23,3 +26,3 @@ this.tree = tree;

this.tail = node;
if (path[this.pos + 1] && !node.after) {
if (isValid(path[this.pos + 1]) && !node.after) {
if (this.stack.length) {

@@ -129,3 +132,3 @@ for (var i = this.stack.length - 1; i >= 0; i--) {

return true;
if (path[this.pos + 1])
if (isValid(path[this.pos + 1]))
return false;

@@ -132,0 +135,0 @@ if (this.pos == path.length - 1)

{
"name": "cool-path",
"version": "0.1.23",
"version": "0.1.24",
"description": "Path Matcher/Getter/Setter for Object/Array",

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

@@ -23,2 +23,4 @@ import {

const isValid = val => val !== undefined && val !== null && val !== ''
export class Matcher {

@@ -44,3 +46,5 @@ private tree: Node

matchNext = (node: any, path: any) => {
return node.after ? this.matchAtom(path, node.after) : !!path[this.pos]
return node.after
? this.matchAtom(path, node.after)
: isValid(path[this.pos])
}

@@ -50,3 +54,3 @@

this.tail = node
if (path[this.pos + 1] && !node.after) {
if (isValid(path[this.pos + 1]) && !node.after) {
if (this.stack.length) {

@@ -165,3 +169,3 @@ for (let i = this.stack.length - 1; i >= 0; i--) {

if (this.stack.length > 0) return true
if (path[this.pos + 1]) return false
if (isValid(path[this.pos + 1])) return false
if (this.pos == path.length - 1) return true

@@ -168,0 +172,0 @@ }

@@ -41,2 +41,6 @@ import expect from 'expect'

).toEqual(false)
const patttern2 = Path.parse('*(array)')
expect(
patttern2.matchAliasGroup(['array',0],['array',0])
).toEqual(false)
})

@@ -105,2 +109,3 @@

'a.*': [['a'], ['b']],
'*(array)': [['array','0']],
'aa.bb.*': [['aa', 'bb']],

@@ -107,0 +112,0 @@ 'a.*.b': [['a', 'k', 'b', 'd']],

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