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

data-matching

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-matching - npm Package Compare versions

Comparing version 1.29.0 to 1.30.0

2

package.json
{
"name": "data-matching",
"version": "1.29.0",
"version": "1.30.0",
"description": "Matches a data object against a reference value Edit",

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

@@ -408,3 +408,3 @@ const _ = require('lodash')

const pop_match = (function_or_array, array, dict) => {
const pop_match = (expected, array, dict) => {
const throw_matching_error = false

@@ -414,5 +414,5 @@ const path = ""

var expected_array = null
if(Array.isArray(function_or_array)) {
expected_array = matchify_strings(function_or_array)
var expected2 = expected
if(typeof expected2 != 'function') {
expected2 = matchify_strings(expected2)
}

@@ -422,21 +422,13 @@

for(var i=0 ; i<array.length ; i++) {
const item = array[i]
if(typeof function_or_array == 'function') {
if(function_or_array(item, dict, throw_matching_error, path)) {
var item = array[i]
if(typeof expected2 == 'function') {
if(expected2(item, dict, throw_matching_error, path)) {
index = i
break
}
} else if(Array.isArray(function_or_array)) {
for(var j=0 ; j<expected_array.length ; j++) {
const expected_item = expected_array[j]
if(_match(expected_item, item, dict, full_match , throw_matching_error, '')) {
index = i
break
}
}
if(index >= 0) {
} else {
if(_match(expected2, item, dict, full_match , throw_matching_error, '')) {
index = i
break
}
} else {
throw("pop_match requires function or array as first argument")
}

@@ -451,3 +443,2 @@ }

module.exports = {

@@ -454,0 +445,0 @@ absent: absent,

@@ -581,3 +581,3 @@ const dm = require('../src/index');

test('pop_match with array', () => {
test('pop_match with object', () => {
const item1 = {

@@ -600,8 +600,6 @@ id: 1,

const item = dm.pop_match([
{
name: 'user2',
id: dm.collect('id')
}
], items, dict)
const item = dm.pop_match( {
name: 'user2',
id: dm.collect('id')
}, items, dict)

@@ -615,3 +613,3 @@ expect(item).toEqual(item2)

test('pop_match with string collection', () => {
test('pop_match with object and string collection', () => {
const item1 = {

@@ -634,7 +632,5 @@ id: 1,

const item = dm.pop_match([
{
name: 'user!{id}',
}
], items, dict)
const item = dm.pop_match({
name: 'user!{id}',
}, items, dict)

@@ -641,0 +637,0 @@ expect(item).toEqual(item1)

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