···991010### Changed
11111212+- Convert BB26 to a pure ECMAScript module (ESM). Please read Sindre Sorhus’s [Pure ESM Package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) article
1313+- Update dependencies
1214- Improve documentation
13151416## [2.2.1](https://github.com/ptrkcsk/BB26/compare/v2.2.0...v2.2.1) – 2022-11-22
+1-1
license.txt
···11MIT License
2233-Copyright (c) 2021 Patrik Csak
33+Copyright (c) Patrik Csak <p@trikcsak.com> (https://patrikcsak.com)
4455Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
···11-import toBb26 from './to-bb26';
22-import toDecimal from './to-decimal';
11+import {toBb26, toDecimal} from './index.js';
3243/**
54 * Increments a bijective base-26 string by one numeral.
+5-7
source/index.ts
···11-import increment from './increment';
22-import random from './random';
33-import range from './range';
44-import toBb26 from './to-bb26';
55-import toDecimal from './to-decimal';
66-77-export {increment, random, range, toBb26, toDecimal};
11+export {default as increment} from './increment.js';
22+export {default as range} from './range.js';
33+export {default as random} from './random.js';
44+export {default as toBb26} from './to-bb26.js';
55+export {default as toDecimal} from './to-decimal.js';
+2-2
source/random.ts
···11-/* eslint-disable @typescript-eslint/unified-signatures, no-redeclare */
11+/* eslint-disable @typescript-eslint/unified-signatures */
2233import randomItem from 'random-item';
44-import range from './range';
44+import {range} from './index.js';
5566export default function random(upper: string): string;
77export default function random(lower: string, upper: string): string;
+2-3
source/range.ts
···11-/* eslint-disable @typescript-eslint/unified-signatures, no-redeclare */
11+/* eslint-disable @typescript-eslint/unified-signatures */
2233-import toDecimal from './to-decimal';
44-import increment from './increment';
33+import {toDecimal, increment} from './index.js';
5465export default function range(end: string): string[];
76export default function range(start: string, end: string): string[];
···11function charToDecimal(letter: string) {
22- return letter.charCodeAt(0) - 'A'.charCodeAt(0) + 1;
22+ return letter.codePointAt(0)! - 'A'.codePointAt(0)! + 1;
33}
4455/**
···2525 let number = 0;
26262727 for (let i = 0; i < string.length; i++) {
2828- const char = string[string.length - i - 1];
2828+ const char = string[string.length - i - 1]!;
29293030 number += 26 ** i * charToDecimal(char);
3131 }
+2-2
test/increment.ts
···11import test from 'ava';
22-import increment from '../source/increment';
22+import {increment} from '../source/index.js';
3344type TestCase = {
55 from: string;
···1313 {from: 'AA', to: 'AB'},
1414 {from: 'AB', to: 'AC'},
1515 {from: 'AAA', to: 'AAB'},
1616- {from: 'AAB', to: 'AAC'}
1616+ {from: 'AAB', to: 'AAC'},
1717];
18181919for (const {from, to} of testCases) {
+1-1
test/random.ts
···11import test from 'ava';
22-import {random, range} from '../source';
22+import {random, range} from '../source/index.js';
3344test('returns a valid string given only an upper bound', (t) => {
55 const validLetters = range('AAA');
+1-1
test/range.ts
···11import test from 'ava';
22-import range from '../source/range';
22+import {range} from '../source/index.js';
3344test('works with end', (t) => {
55 t.deepEqual(range('A'), []);
+2-2
test/to-bb26.ts
···11import test from 'ava';
22-import toBb26 from '../source/to-bb26';
22+import {toBb26} from '../source/index.js';
3344type TestCase = {
55 from: number;
···1212 {from: 26, to: 'Z'},
1313 {from: 27, to: 'AA'},
1414 {from: 28, to: 'AB'},
1515- {from: 29, to: 'AC'}
1515+ {from: 29, to: 'AC'},
1616];
17171818for (const {from, to} of testCases) {
+2-2
test/to-decimal.ts
···11import test from 'ava';
22-import toDecimal from '../source/to-decimal';
22+import {toDecimal} from '../source/index.js';
3344type TestCase = {
55 from: string;
···1212 {from: 'Z', to: 26},
1313 {from: 'AA', to: 27},
1414 {from: 'AB', to: 28},
1515- {from: 'AC', to: 29}
1515+ {from: 'AC', to: 29},
1616];
17171818for (const {from, to} of testCases) {