safe-match

0.0.2 • Public • Published

safe-match

Description

Prevent match API from the result of null.

Install

$ npm i safe-match

API

  • match
  • init
  • reset

Usage

var safeMatch = require('safe-match').match
safeMatch('foo', /bar/) // => []
 
var safeMatchInit = require('safe-match').init
var safeMatchReset = require('safe-match').reset
safeMatchInit()
'foo'.safeMatch(/bar/) // => []
safeMatchReset()
'foo'.safeMatch(/bar/) // => null
 
safeMatchInit({
    name: 'match'
})
'foo'.match(/bar/) // => []
safeMatchReset()
'foo'.match(/bar/) // => null
 
safeMatchInit({
    noConflict: true
})
'foo'.safeMatch(/bar/, true) // => []
'foo'.safeMatch(/bar/) // => null
safeMatchReset()
'foo'.match(/bar/, true) // => null

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.21latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.21
0.0.10

Package Sidebar

Install

npm i safe-match

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • dafrok