Prefix Matches
Find matching keys in a given object, for a given prefix string
Warning: experimental
Installation
npm i --save prefix-matches
then, in your scripts:
const prefixMatches =
Example
const prefixMatches = // Resolves simple cases // => [{ watch: 'watch things' }] // Does not flatten result set // => [{ watch: { js: 'watch javascript', css: 'watch css' }}] // Resolves nested prefixes // => [{ 'watch.js': 'watch javascript' }, { 'write.js': 'write javascript' }] // ... and so on // => [{ 'build.frontend.js': 'build javascript' }]
Why?
To attempt better prefixing support for the package-scripts project.
Tests
A basic test suite has been authored in AVA, used for its terrifying speed. To run it:
npm test