Skip to content

dsblv/iterable-regexp-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iterable-regexp-exec Build Status

Iterable interface for RegExp.prototype.exec()

Compatible with multiple other ES2015 features (e.g. spread operator, Array.from(), for..of).

Install

$ npm install --save iterable-regexp-exec

Usage

const iterableRegexpExec = require('iterable-regexp-exec');

const res = iterableRegexpExec(/[unicorns]/g, 'rainbows');

[...res].map(match => match[0]);
//=> ['r', 'i', 'n', 'o', 's']

API

iterableRegexpExec(regexp, string)

Yields regexp.exec(string) once per iteration.

regexp

Type: regexp

string

Type: string

License

MIT © Dmitriy Sobolev

About

Iterable interface for RegExp.prototype.exec()

Resources

License

Stars

Watchers

Forks

Packages

No packages published