regexp-id

0.2.1 • Public • Published

regexp-id

Returns an identifier based on a RegExp match against an object property's value.

Build Status Code Climate js-standard-style

npm install regexp-id --save

You can also use Duo, Bower or download the files manually.

npm stats

npm NPM downloads David

API Example

var regexpId = require('regexp-id')
 
var company = {
  name: 'Acme Corporation',
  contact: '"Example Anvil" <example.anvil@example.com>'
}
 
var id = regexpId(/^"([^"]+)"/, 'contact')
 
id(company)
//=> '"Example Anvil"'

API

regexpId(regexp, key)

arguments
  • regexp (RegExp) Regular expression.
  • path (String) Dot or bracket-notation string path.
returns
  • (Function) Unary function accepting an object to evaluate.

Contributing

SEE: contributing.md

Licenses

GitHub license

Package Sidebar

Install

npm i regexp-id

Weekly Downloads

2

Version

0.2.1

License

MIT

Last publish

Collaborators

  • wilmoore