Skip to content

Commit da82db1

Browse files
committed
Fix styling issues
1 parent aba6b78 commit da82db1

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

index.d.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ declare namespace bchRegex {
99
/**
1010
Available BCH formats.
1111
*/
12-
type Format = 'legacy' | 'cashaddr';
12+
type Format = 'legacy' | 'cashaddr'
1313
}
1414

1515
declare const bchRegex: {
1616
/**
17-
Returns a regex for matching BCH addresses.
17+
Returns a regex for matching specific BCH format addresses.
1818
@example
1919
```
2020
import bchRegex = require('bitcoincash-regex')
21-
bchRegex().test('nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
21+
bchRegex.format('cashaddr', {exact: true}).test('bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a')
2222
//=> true
2323
```
2424
*/
25-
(options?: bchRegex.Options): RegExp;
25+
format: (format: bchRegex.Format, options?: bchRegex.Options) => RegExp;
2626

2727
/**
28-
Returns a regex for matching specific BCH format addresses.
28+
Returns a regex for matching BCH addresses.
2929
@example
3030
```
3131
import bchRegex = require('bitcoincash-regex')
32-
bchRegex.format('cashaddr', {exact: true}).test('bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a')
32+
bchRegex().test('nodejsrocks 19hZx234vNtLazfx5J2bxHsiWEmeYE8a7k')
3333
//=> true
3434
```
3535
*/
36-
format(format: bchRegex.Format, options?: bchRegex.Options): RegExp;
36+
(options?: bchRegex.Options): RegExp;
3737
}
3838

39-
export = bchRegex;
39+
export = bchRegex

index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ const bchRegExps = {
55
cashaddr: '((bitcoincash|bchreg|bchtest):)?(q|p)[a-z0-9]{41}'
66
}
77

8-
const buildRegExp = (body, opts) => {
9-
return opts.exact ? new RegExp('(?:^' + body + '$)') : new RegExp(body, 'g')
8+
const buildRegExp = (body, options) => {
9+
return options.exact ? new RegExp('(?:^' + body + '$)') : new RegExp(body, 'g')
1010
}
1111

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

18-
bchRegex.format = (format, opts) => {
19-
opts = opts || {}
18+
bchRegex.format = (format, options) => {
19+
options = options || {}
2020
if (!bchRegExps[format]) {
2121
throw new Error('Invalid BCH format')
2222
}
2323

2424
const body = bchRegExps[format]
25-
return buildRegExp(body, opts)
25+
return buildRegExp(body, options)
2626
}
2727

2828
module.exports = bchRegex

index.test-d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {expectType} from 'tsd';
2-
import bchRegex = require('.');
1+
import {expectType} from 'tsd'
2+
import bchRegex = require('.')
33

4-
expectType<RegExp>(bchRegex());
5-
expectType<RegExp>(bchRegex({exact: true}));
6-
expectType<RegExp>(bchRegex.format('legacy'));
7-
expectType<RegExp>(bchRegex.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}))

0 commit comments

Comments
 (0)