# safe-match **Repository Path**: mirrors_dafrok/safe-match ## Basic Information - **Project Name**: safe-match - **Description**: Prevent match API from the result of null - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # safe-match ## Description Prevent match API from the result of null. ## Install ``` $ npm i safe-match ``` ## API - match - init - reset ## Usage ``` javascript var safeMatch = require('safe-match').match safeMatch('foo', /bar/) // => 0 var safeMatchInit = require('safe-match').init var safeMatchReset = require('safe-match').reset safeMatchInit() 'foo'.safeMatch(/bar/) // => 0 safeMatchReset() 'foo'.safeMatch(/bar/) // => null safeMatchInit({ name: 'match' }) 'foo'.match(/bar/) // => 0 safeMatchReset() 'foo'.match(/bar/) // => null safeMatchInit({ noConflict: true }) 'foo'.safeMatch(/bar/, true) // => 0 'foo'.safeMatch(/bar/) // => null safeMatchReset() 'foo'.match(/bar/, true) // => null ```