string-matching
Advanced tools
Comparing version 1.11.15 to 1.11.16
{ | ||
"name": "string-matching", | ||
"version": "1.11.15", | ||
"version": "1.11.16", | ||
"description": "Checks strings against patterns and collects matched substrings", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,2 +5,4 @@ const MatchingError = require ('./matching_error') | ||
var _set_key = (step, val, dict, throw_matching_error, path) => { | ||
if(step.name == '_') return true | ||
var v | ||
@@ -7,0 +9,0 @@ if(!step.type || step.type == 'str') { |
@@ -29,2 +29,16 @@ const sm = require('../src/index'); | ||
test('underscore', () => { | ||
var matcher = sm.gen_matcher('!{first},!{_},!{second},!{_},!{third}') | ||
var dict = {} | ||
var res = matcher('abc,000,def,111,ghi', dict) | ||
expect(res).toEqual(true) | ||
expect(dict).toEqual({ | ||
first: 'abc', | ||
second: 'def', | ||
third: 'ghi', | ||
}) | ||
}) | ||
test('invalid string match expression', () => { | ||
@@ -31,0 +45,0 @@ expect( () => { sm.gen_matcher(`!{`) } ).toThrow(/Invalid string match expression/) |
44239
1374