bb26 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +40 -38
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bb26",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Utilities for working with bijective base-26 numerals",
5
5
  "keywords": [
6
6
  "base 26",
package/readme.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # BB26
2
2
 
3
- [![Badge indicating minified and gzipped size of BB26](https://badgen.net/bundlephobia/minzip/bb26)](https://bundlephobia.com/result?p=bb26)
4
3
  [![Badge indicating number of weekly downloads of BB26 from npm package registry](https://badgen.net/npm/dw/bb26)](https://www.npmjs.com/package/bb26)
5
4
  [![Badge indicating percent test coverage of BB26](https://badgen.net/codeclimate/coverage/patrik-csak/BB26?label=test+coverage)](https://codeclimate.com/github/patrik-csak/BB26/test_coverage)
6
5
 
@@ -19,6 +18,9 @@ Decimal: | 1 | 2 | 3 | ... | 24 | 25 | 26 | 27 | 28 | 29 | ...
19
18
 
20
19
  ## Install
21
20
 
21
+ > **Note**
22
+ > This package is a native ECMAScript Module (ESM). If your project is not ESM, read [Sindre Sorhus’s Pure ESM package article](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
23
+
22
24
  ```sh
23
25
  npm install bb26
24
26
  ```
@@ -27,87 +29,87 @@ npm install bb26
27
29
 
28
30
  ### `increment()`
29
31
 
30
- ```
31
- increment(string: string): string
32
+ ```ts
33
+ function increment(string: string): string;
32
34
  ```
33
35
 
34
36
  Increments a bijective base-26 string by one numeral.
35
37
 
36
38
  ```js
37
- import { increment } from 'bb26'
39
+ import { increment } from "bb26";
38
40
 
39
- increment('A') // 'B'
40
- increment('Z') // 'AA'
41
- increment('AA') // 'AB'
41
+ increment("A"); // 'B'
42
+ increment("Z"); // 'AA'
43
+ increment("AA"); // 'AB'
42
44
  ```
43
45
 
44
46
  ### `random()`
45
47
 
46
- ```
47
- random(upper: string): string
48
- random(lower: string, upper: string): string
48
+ ```ts
49
+ function random(upper: string): string
50
+ function random(lower: string, upper: string): string
49
51
  ```
50
52
 
51
53
  Produces a random string between the inclusive `lower` and `upper` bounds. If only one argument is provided, a string between `'A'` and the given string is returned.
52
54
 
53
55
  ```js
54
- import { random } from 'bb26'
56
+ import { random } from "bb26";
55
57
 
56
- random('AAA') // 'NE'
57
- random('AAA', 'AAAA') // 'KXZ'
58
+ random("AAA"); // 'NE'
59
+ random("AAA", "AAAA"); // 'KXZ'
58
60
  ```
59
61
 
60
62
  ### `range()`
61
63
 
62
- ```
63
- range(end: string): string[]
64
- range(start: string, end: string): string[]
64
+ ```ts
65
+ function range(end: string): string[]
66
+ function range(start: string, end: string): string[]
65
67
  ```
66
68
 
67
69
  Creates an array of bijective base-26 numerals progressing from `start` up to, but not including, `end`. If `end` is not specified, it's set to `start` with `start` then set to `'A'`.
68
70
 
69
71
  ```js
70
- import { range } from 'bb26'
72
+ import { range } from "bb26";
71
73
 
72
- range('B') // ['A']
73
- range('C') // ['A', 'B']
74
- range('B', 'C') // ['B']
75
- range('B', 'D') // ['B', 'C']
76
- range('Z', 'AC') // ['Z', 'AA', 'AB']
74
+ range("B"); // ['A']
75
+ range("C"); // ['A', 'B']
76
+ range("B", "C"); // ['B']
77
+ range("B", "D"); // ['B', 'C']
78
+ range("Z", "AC"); // ['Z', 'AA', 'AB']
77
79
  ```
78
80
 
79
81
  ### `toBb26()`
80
82
 
81
- ```
82
- toBb26(number: number): string
83
+ ```ts
84
+ function toBb26(number: number): string;
83
85
  ```
84
86
 
85
87
  Converts a decimal number to a bijective base-26 string.
86
88
 
87
89
  ```js
88
- import { toBb26 } from 'bb26'
90
+ import { toBb26 } from "bb26";
89
91
 
90
- toBb26(1) // 'A'
91
- toBb26(2) // 'B'
92
- toBb26(26) // 'Z'
93
- toBb26(27) // 'AA'
94
- toBb26(28) // 'AB'
92
+ toBb26(1); // 'A'
93
+ toBb26(2); // 'B'
94
+ toBb26(26); // 'Z'
95
+ toBb26(27); // 'AA'
96
+ toBb26(28); // 'AB'
95
97
  ```
96
98
 
97
99
  ### `toDecimal()`
98
100
 
99
- ```
100
- toDecimal(string: string): number
101
+ ```ts
102
+ function toDecimal(string: string): number;
101
103
  ```
102
104
 
103
105
  Converts a bijective base-26 string to a decimal number.
104
106
 
105
107
  ```js
106
- import { toDecimal } from 'bb26'
108
+ import { toDecimal } from "bb26";
107
109
 
108
- toDecimal('A') // 1
109
- toDecimal('B') // 2
110
- toDecimal('Z') // 26
111
- toDecimal('AA') // 27
112
- toDecimal('AB') // 28
110
+ toDecimal("A"); // 1
111
+ toDecimal("B"); // 2
112
+ toDecimal("Z"); // 26
113
+ toDecimal("AA"); // 27
114
+ toDecimal("AB"); // 28
113
115
  ```