ethereum-regex
Advanced tools
Comparing version 1.1.12 to 1.1.13
declare namespace ethereumRegex { | ||
interface Options { | ||
/** | ||
Only match an exact string. By default, it matches any ETH addresses in a string. Useful with `RegExp#test()` to check if a string is an ETH address. | ||
@default false | ||
*/ | ||
readonly exact?: boolean; | ||
} | ||
interface Options { | ||
/** | ||
Only match an exact string. By default, it matches any ETH addresses in a string. Useful with `RegExp#test()` to check if a string is an ETH address. | ||
@default false | ||
*/ | ||
readonly exact?: boolean; | ||
} | ||
} | ||
@@ -20,4 +20,4 @@ | ||
*/ | ||
declare function ethereumRegex(options?: ethereumRegex.Options): RegExp; | ||
declare function ethereumRegex(options?: ethereumRegex.Options): RegExp | ||
export = ethereumRegex; | ||
export = ethereumRegex |
'use strict' | ||
const re = '0x[a-fA-F0-9]{40}' | ||
module.exports = opts => { | ||
opts = opts || {} | ||
return opts.exact ? new RegExp(`(?:^${re}$)`) : new RegExp(re, 'g') | ||
module.exports = options => { | ||
options = options || {} | ||
return options.exact ? new RegExp(`(?:^${re}$)`) : new RegExp(re, 'g') | ||
} |
{ | ||
"name": "ethereum-regex", | ||
"version": "1.1.12", | ||
"version": "1.1.13", | ||
"description": "Regular expression for matching Ethereum (ETH) addresses.", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=9" | ||
"node": ">=10" | ||
}, | ||
@@ -38,5 +38,5 @@ "main": "index.js", | ||
"ava": "^3.5.2", | ||
"tsd": "^0.11.0", | ||
"xo": "^0.25.4" | ||
"tsd": "^0.13.1", | ||
"xo": "^0.32.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26
4734