patroon 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -583,7 +583,7 @@ npx nyc npm t | npx tap-nyc
583
583
  npx nyc check-coverage
584
584
  ```
585
585
  ```
586
- > patroon@1.1.0 test
586
+ > patroon@1.1.1 test
587
587
  > tape ./src/index.test.js
588
588
  -------------|---------|----------|---------|---------|-------------------
589
589
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
@@ -594,10 +594,10 @@ npx nyc check-coverage
594
594
  walkable.js | 100 | 100 | 100 | 100 |
595
595
  -------------|---------|----------|---------|---------|-------------------
596
596
 
597
- total: 15
598
- passing: 15
597
+ total: 16
598
+ passing: 16
599
599
 
600
- duration: 1.4s
600
+ duration: 1.6s
601
601
 
602
602
  ```
603
603
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patroon",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Pattern matching library",
5
5
  "repository": "github:bas080/patroon",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -39,7 +39,7 @@ const predicate = pattern => {
39
39
  if (pattern && pattern[multiSymbol]) { return (...args) => pattern(...args) }
40
40
 
41
41
  const normalize = (value, pth) => {
42
- if (isRegExp(value)) return arg => value.test(arg)
42
+ if (isRegExp(value)) return arg => value.test(path(pth, arg))
43
43
 
44
44
  if (isFunction(value)) { return arg => value(path(pth, arg)) }
45
45
 
package/src/index.test.js CHANGED
@@ -24,6 +24,11 @@ test('Matches on a simple primitive', t => {
24
24
  })
25
25
 
26
26
  test('Matches using a RegExp', t => {
27
+ patroon(
28
+ { a: /^bunion/ }, () => t.fail(),
29
+ { a: /^banana/ }, () => t.pass()
30
+ )({ a: 'banana tree' })
31
+
27
32
  patroon(
28
33
  /^bunion/, () => t.fail(),
29
34
  /^banana/, () => t.end()