ip-filter
Filter valid IPv4 or IPv6 IP against glob pattern, array, string, regexp or matcher function, if match return the checked IP, otherwise return falsey value.
Install
npm i ip-filter --save
npm test
Usage
For more use-cases see the tests
return
{String|Null} string when match, otherwise null
var ipFilter = require('ip-filter')
console.log(ipFilter('123.77.34.89', '123.??.34.8*'))
console.log(ipFilter('123.222.34.89', ['123.???.34.8*', '!123.222.34.89']))
See also
- apidocs-cli: Async CLI for automatically generating API docs from code comments
- is-missing: Check that given
name
or user/repo
exists in npm registry or in… more - koa-ip-filter: Filter IPs with a glob pattern, regex, string, array or matcher function.… more
- micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster… more
- npm-related: Thin wrapper on top of
helper-related
for generating a list of links… more
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.