Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

regexp-tpl

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regexp-tpl

Templated regular expressions.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

regexp-tpl

regexp-tpl allows you to create templated regular expressions.

NPM version Build status Dependency Status devDependency Status Coverage Status Code Climate

Installation

First install regexp-tpl in you project:

npm install --save regexp-tpl

Getting started

Then, use it:

var regexpTpl = require('regexp-tpl');
var assert = require('assert');

var fruits = [{
  name: 'orange',
  count: 2,
  colors: ['orange']
}, {
	name: 'banana',
  count: 0,
  colors: ['yellow', 'white']
}, {
	name: 'kiwi',
  count: 8,
  colors: ['brown', 'green']
}];

assert(regexpTpl(fruits, 'My car is {colors.#}!').test('My car is brown!'));
assert(!regexpTpl(fruits, 'My car is {colors.#}!').test('My car is blue!'));

Note that regexp-tpl template values are evaluated with miniquery's' syntax.

## API

### regExp:RegExp regexpTpl(objs:Array, regExpTemplate:String, regExpflags:String) Return a RegExp instance made with the given regExpTemplate``and regExplags filled with the values picked up in the givenobjs`.

Contribute

Feel free to submit us your improvements. To do so, you must accept to publish your code under the MIT license.

To start contributing, first run the following to setup the development environment:

git clone git@github.com:SimpliField/regexp-tpl.git
cd regexp-tpl
npm install

Then, run the tests:

npm test

Stats

NPM NPM

Keywords

FAQs

Package last updated on 22 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc