Skip to content

Commit d206dfb

Browse files
committed
Make sure the if there is no match for pattern to try object pattern
1 parent 4853960 commit d206dfb

6 files changed

Lines changed: 187 additions & 113 deletions

File tree

lib/tailored.js

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tailored",
3-
"version": "2.4.4",
3+
"version": "2.4.5",
44
"description": "Pattern matching library",
55
"main": "lib/tailored.js",
66
"jsnext:main": "src/index.js",

rollup.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ export default {
66
dest: 'lib/tailored.js',
77
sourceMap: 'inline',
88
format: 'cjs',
9-
plugins: [babel()],
9+
plugins: [
10+
babel({
11+
babelrc: false,
12+
presets: [
13+
[
14+
'env',
15+
{
16+
targets: {
17+
node: 'current',
18+
},
19+
modules: false,
20+
loose: true,
21+
},
22+
],
23+
],
24+
}),
25+
],
1026
external: ['erlang-types'],
1127
};

src/tailored/match.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,9 @@ export function buildMatch(pattern) {
4242
return resolver(pattern);
4343
}
4444

45+
if (typeof pattern === 'object') {
46+
return Resolvers.resolveObject(pattern);
47+
}
48+
4549
return Resolvers.resolveNoMatch();
4650
}

0 commit comments

Comments
 (0)