|
|
|
|
|
by c0nfused
2985 days ago
|
|
I rather like your syntax compared to the proposed version. It is less concise but must more consistent and parsable: return match(user, [
[{first: $, middle: $, last: $}, (f, m, l) => f + ' ' + m + ' ' + l],
[{first: $, last: $} , (f, l) => f + ' ' + l],
[_, 'unknown']
]);
|
|
... so calling Object.keys() is not necessarily going to use a consistent ordering. I think that is why they have to use the more verbose syntax in the other library.
I think you could do something like: {first: $.0, middle: $.1, last: $.2}, (f, m, l) => ... pretty easily, though.