Skip to content

Commit bfa6176

Browse files
committed
Rename import variable for clarity
1 parent 6b7ed46 commit bfa6176

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ const buildRegExp = (body, opts) => {
99
return opts.exact ? new RegExp('(?:^' + body + '$)') : new RegExp(body, 'g')
1010
}
1111

12-
const bch = opts => {
12+
const bchRegex = opts => {
1313
opts = opts || {}
1414
const body = Object.keys(bchRegExps).map(format => '(?:' + bchRegExps[format] + ')').join('|')
1515
return buildRegExp(body, opts)
1616
}
1717

18-
bch.format = (format, opts) => {
18+
bchRegex.format = (format, opts) => {
1919
opts = opts || {}
2020
if (!bchRegExps[format]) {
2121
throw new Error('Invalid BCH format')
@@ -25,4 +25,4 @@ bch.format = (format, opts) => {
2525
return buildRegExp(body, opts)
2626
}
2727

28-
module.exports = bch
28+
module.exports = bchRegex

index.test-d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {expectType} from 'tsd';
2-
import bch = require('.');
2+
import bchRegex = require('.');
33

4-
expectType<RegExp>(bch());
5-
expectType<RegExp>(bch({exact: true}));
6-
expectType<RegExp>(bch.format('legacy'));
7-
expectType<RegExp>(bch.format('cashaddr', {exact: false}));
4+
expectType<RegExp>(bchRegex());
5+
expectType<RegExp>(bchRegex({exact: true}));
6+
expectType<RegExp>(bchRegex.format('legacy'));
7+
expectType<RegExp>(bchRegex.format('cashaddr', {exact: false}));

readme.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
## Usage
1414

1515
```js
16-
const bch = require('bitcoincash-regex')
16+
const bchRegex = require('bitcoincash-regex')
1717

18-
bch().test('nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
18+
bchRegex().test('nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
1919
//=> true
2020

21-
bch({exact: true}).test('nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k foo')
21+
bchRegex({exact: true}).test('nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k foo')
2222
//=> false
2323

24-
bch({exact: true}).test('19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
24+
bchRegex({exact: true}).test('19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
2525
//=> true
2626

27-
bch.format('cashaddr', {exact: true}).test('bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a')
27+
bchRegex.format('cashaddr', {exact: true}).test('bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a')
2828
//=> true
2929

30-
bch.format('cashaddr', {exact: true}).test('19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
30+
bchRegex.format('cashaddr', {exact: true}).test('19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
3131
//=> false
3232

3333
'nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k unicorn bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a rainbow'.match(bitcoincashRegex());
@@ -37,7 +37,7 @@ bch.format('cashaddr', {exact: true}).test('19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
3737

3838
## API
3939

40-
### bch([options])
40+
### bchRegex([options])
4141

4242
Returns a regex for matching BCH addresses.
4343

@@ -49,7 +49,7 @@ Default: `false` *(Matches any BCH address in a string)*
4949
Only match an exact string. Useful with `RegExp#test()` to check if a string is an BCH address.
5050

5151

52-
### bch.format([format], [options])
52+
### bchRegex.format([format], [options])
5353

5454
Returns a regex for matching specific BCH format addresses.
5555

0 commit comments

Comments
 (0)