sm

str-match

String matcher that output the input string replacing the match.

Showing:

Popularity

Downloads/wk

17

GitHub Stars

0

Maintenance

Last Commit

5mos ago

Contributors

2

Package

Dependencies

1

Size (min+gzip)

0.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

str-match

Last version Build Status Coverage Status Dependency status Dev Dependencies Status NPM Status Donate

String matcher that output the input string replacing the match.

I created this module for be easy create a pipeline string processor, where the output of a pipe is the input of the next pipe.

Install

$ npm install str-match --save

Usage

const strmatch = require('str-match')({ replacement: 'gift' })

const str = "I'm selling my Macbook Pro"
const regex = /selling/i
const detection = strmatch(str, regex)

console.log(detection)
// {
//  test: true,
//  match: 'Macbook Pro',
//  input: 'I\'m selling my Macbook Pro',
//  output: 'I\'m gift my Macbook Pro'
//  }

API

.constructor([opts])

opts

opts.flags

Type: string
Default: ''

opts.replacement

Type: string
Default: ''

strmatch(str, regex)

str

Required
Type: string

regex

Required
Type: regexp

License

MIT © Kiko Beats.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100