Package Exports
- infer
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 (infer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
infer
Infer a name from an email address
A demo is available at bevacqua.github.io/infer
Install
npm install -S inferCLI
infer carlos@gmail.com
> 'carlos'API
The API exposes a single expose(email, placeholder?, strict?) method. The placeholder is used if the name cannot be inferred.
infer('carlos@gmail.com', 'you');
// <- 'carlos'The return value is a name when it matches completely with some part of the email address.
infer('nicolas_bevacqua+spam@gmail.com', 'you');
// <- 'nicolas'If no name is matched, the full local part of the address is returned.
infer('abudabi+junk@gmail.com');
// <- 'abudabi'If the input wasn't even a valid email address, the placeholder is returned.
infer('abudabi');
// <- 'you'If the input didn't match up with a name and strict is truthy, the placeholder is returned as well.
infer('abudabi@gmail.com', 'foo', true);
// <- 'foo'License
MIT