Package Exports
- loosely
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (loosely) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Loosely🌱
Text loosely based on input
Install
npm install --save looselyUse
const { Mask } = require('loosely');
const mask = new Mask(/\d \(\d{3}\) \d{3}-\d{4}/);
const text = mask.filter('1-800-555-1234');
// 1 (800) 555-1234
mask.validate(text);
// true
mask.sample()
// 8 (693) 906-1454Limitations
Greed
The non-greedy operators are currently ignored. filter is non-greedy by
default. An important behavior of filter is that it inserts static parts of
the pattern automatically. Since static expressions can be repeated infinitely,
it is not possible to be greedy without encountering infinite loops or enforcing
artificial recursion limits. Choosing a path through the pattern with the
smallest number of additions leads to an intuitive experience when filtering
live input.
Assertions (TODO)
Assertions are currently treated as normal groups. Any overlapping expressions before a look-behind or after a look-ahead will produce invalid results. Negative assertions are also treated as normal groups without negation, so they will always produce invalid results. Please consider contributing any ideas or code you have for this feature.