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 +4 -4
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/index.test.js +5 -0
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.
|
|
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:
|
|
598
|
-
passing:
|
|
597
|
+
total: 16
|
|
598
|
+
passing: 16
|
|
599
599
|
|
|
600
|
-
duration: 1.
|
|
600
|
+
duration: 1.6s
|
|
601
601
|
|
|
602
602
|
```
|
|
603
603
|
|
package/package.json
CHANGED
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()
|