bb26 2.0.0 → 2.2.0

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.
package/dist/increment.js CHANGED
@@ -20,6 +20,6 @@ const to_decimal_1 = __importDefault(require("./to-decimal"));
20
20
  * @return Incremented string
21
21
  */
22
22
  function increment(string) {
23
- return to_bb26_1.default(to_decimal_1.default(string) + 1);
23
+ return (0, to_bb26_1.default)((0, to_decimal_1.default)(string) + 1);
24
24
  }
25
25
  exports.default = increment;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import increment from './increment';
2
2
  import random from './random';
3
3
  import range from './range';
4
- import toDecimal from './to-decimal';
5
4
  import toBb26 from './to-bb26';
6
- export { increment, random, range, toDecimal, toBb26 };
5
+ import toDecimal from './to-decimal';
6
+ export { increment, random, range, toBb26, toDecimal };
package/dist/index.js CHANGED
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.toBb26 = exports.toDecimal = exports.range = exports.random = exports.increment = void 0;
6
+ exports.toDecimal = exports.toBb26 = exports.range = exports.random = exports.increment = void 0;
7
7
  const increment_1 = __importDefault(require("./increment"));
8
8
  exports.increment = increment_1.default;
9
9
  const random_1 = __importDefault(require("./random"));
10
10
  exports.random = random_1.default;
11
11
  const range_1 = __importDefault(require("./range"));
12
12
  exports.range = range_1.default;
13
- const to_decimal_1 = __importDefault(require("./to-decimal"));
14
- exports.toDecimal = to_decimal_1.default;
15
13
  const to_bb26_1 = __importDefault(require("./to-bb26"));
16
14
  exports.toBb26 = to_bb26_1.default;
15
+ const to_decimal_1 = __importDefault(require("./to-decimal"));
16
+ exports.toDecimal = to_decimal_1.default;
package/dist/random.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- declare function random(upper: string): string;
2
- declare function random(lower: string, upper: string): string;
3
- export default random;
1
+ export default function random(upper: string): string;
2
+ export default function random(lower: string, upper: string): string;
package/dist/random.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/unified-signatures, no-redeclare */
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ const random_item_1 = __importDefault(require("random-item"));
6
8
  const range_1 = __importDefault(require("./range"));
7
- const sample_1 = __importDefault(require("./sample"));
8
9
  /**
9
10
  * Produces a random string between the inclusive `lower` and `upper` bounds. If
10
11
  * only one argument is provided, a string between `'A'` and the given string is
@@ -23,7 +24,7 @@ const sample_1 = __importDefault(require("./sample"));
23
24
  */
24
25
  function random(lower, upper) {
25
26
  const start = upper ? lower : 'A';
26
- const end = upper || lower;
27
- return sample_1.default(range_1.default(start, end));
27
+ const end = upper !== null && upper !== void 0 ? upper : lower;
28
+ return (0, random_item_1.default)((0, range_1.default)(start, end));
28
29
  }
29
30
  exports.default = random;
package/dist/range.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- declare function range(end: string): string[];
2
- declare function range(start: string, end: string): string[];
3
- export default range;
1
+ export default function range(end: string): string[];
2
+ export default function range(start: string, end: string): string[];
package/dist/range.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ /* eslint-disable @typescript-eslint/unified-signatures, no-redeclare */
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
@@ -25,12 +26,12 @@ const increment_1 = __importDefault(require("./increment"));
25
26
  * @param end - The end of the range
26
27
  */
27
28
  function range(start, end) {
28
- const range = [];
29
- const _end = end || start;
29
+ const _range = [];
30
+ const _end = end !== null && end !== void 0 ? end : start;
30
31
  const _start = end ? start : 'A';
31
- for (let i = _start; to_decimal_1.default(i) < to_decimal_1.default(_end); i = increment_1.default(i)) {
32
- range.push(i);
32
+ for (let i = _start; (0, to_decimal_1.default)(i) < (0, to_decimal_1.default)(_end); i = (0, increment_1.default)(i)) {
33
+ _range.push(i);
33
34
  }
34
- return range;
35
+ return _range;
35
36
  }
36
37
  exports.default = range;
package/dist/to-bb26.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @ignore */
4
3
  function toChar(number) {
5
4
  return String.fromCharCode('A'.charCodeAt(0) - 1 + number);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @ignore */
4
3
  function charToDecimal(letter) {
5
4
  return letter.charCodeAt(0) - 'A'.charCodeAt(0) + 1;
6
5
  }
package/license.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 Patrik Csak
3
+ Copyright (c) 2021 Patrik Csak
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,43 +1,45 @@
1
1
  {
2
2
  "name": "bb26",
3
- "version": "2.0.0",
4
- "description": "Bijective base-26 utility functions",
3
+ "version": "2.2.0",
4
+ "description": "Bijective base-26 utility functions for converting numbers to/from spreadsheet column letters",
5
5
  "repository": "github:ptrkcsk/BB26",
6
- "author": "Patrik Csak <patrik@csak.email>",
6
+ "author": "Patrik Csak <p@trikcsak.com>",
7
7
  "license": "MIT",
8
8
  "bugs": {
9
9
  "url": "https://github.com/ptrkcsk/BB26/issues"
10
10
  },
11
11
  "homepage": "https://github.com/ptrkcsk/BB26#readme",
12
12
  "keywords": [
13
- "base-26",
14
- "bijective-base-26",
13
+ "base 26",
14
+ "bijective base 26",
15
15
  "hexavigesimal",
16
- "spreadsheet"
16
+ "spreadsheet",
17
+ "spreadsheet column",
18
+ "spreadsheet column letters"
17
19
  ],
18
20
  "main": "dist",
19
21
  "files": [
20
- "dist",
21
- "!dist/*.js.map"
22
+ "dist"
22
23
  ],
23
24
  "scripts": {
24
25
  "build": "tsc",
25
- "lint": "eslint",
26
- "prepublishOnly": "npm run build",
27
- "test": "jest",
28
- "test:coverage": "jest --coverage"
26
+ "format": "xo --fix",
27
+ "prepare": "del-cli dist && npm run build",
28
+ "test": "xo && ava",
29
+ "test:coverage": "del-cli coverage && xo && c8 ava",
30
+ "test:coverage:lcov": "del-cli coverage && xo && c8 --reporter=lcovonly ava"
31
+ },
32
+ "dependencies": {
33
+ "random-item": "^3.1.0"
29
34
  },
30
- "dependencies": {},
31
35
  "devDependencies": {
32
- "@sindresorhus/tsconfig": "^0.7.0",
33
- "@types/jest": "^25.2.3",
34
- "@types/lodash.sample": "^4.2.6",
35
- "@typescript-eslint/eslint-plugin": "^3.0.2",
36
- "@typescript-eslint/parser": "^3.0.2",
37
- "eslint": "^7.1.0",
38
- "jest": "^26.0.1",
39
- "ts-jest": "^26.0.0",
40
- "typescript": "^3.9.3"
36
+ "@tsconfig/recommended": "^1.0.1",
37
+ "ava": "^3.15.0",
38
+ "c8": "^7.10.0",
39
+ "del-cli": "^4.0.1",
40
+ "ts-node": "^10.4.0",
41
+ "typescript": "^4.0.5",
42
+ "xo": "^0.39.1"
41
43
  },
42
44
  "types": "dist"
43
45
  }
package/readme.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/c56701b3968f3de65188/test_coverage)](https://codeclimate.com/github/ptrkcsk/BB26/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/c56701b3968f3de65188/maintainability)](https://codeclimate.com/github/ptrkcsk/BB26/maintainability) [![BB26 minified and gzipped size](https://badgen.net/bundlephobia/minzip/bb26)](https://bundlephobia.com/result?p=bb26)
4
4
 
5
- [Bijective base-26](https://en.wikipedia.org/wiki/Bijective_numeration#The_bijective_base-26_system) utility functions for JavaScript
6
-
7
- ---
5
+ JavaScript [bijective base-26](https://en.wikipedia.org/wiki/Bijective_numeration#The_bijective_base-26_system) utility functions for converting numbers to/from spreadsheet column letters
8
6
 
9
7
  ## Installation
10
8
 
@@ -12,12 +10,8 @@
12
10
  npm install bb26
13
11
  ```
14
12
 
15
- ---
16
-
17
13
  ## Usage
18
14
 
19
- ---
20
-
21
15
  ### Increment
22
16
 
23
17
  ```
@@ -34,8 +28,6 @@ increment('Z') // 'AA'
34
28
  increment('AA') // 'AB'
35
29
  ```
36
30
 
37
- ---
38
-
39
31
  ### Random
40
32
 
41
33
  ```
@@ -52,8 +44,6 @@ random('AAA') // 'NE'
52
44
  random('AAA', 'AAAA') // 'KXZ'
53
45
  ```
54
46
 
55
- ---
56
-
57
47
  ### Range
58
48
 
59
49
  ```
@@ -75,8 +65,6 @@ range('B', 'D') // ['B', 'C']
75
65
  range('Z', 'AC') // ['Z', 'AA', 'AB']
76
66
  ```
77
67
 
78
- ---
79
-
80
68
  ### Convert from decimal to BB26
81
69
 
82
70
  ```
@@ -95,8 +83,6 @@ toBb26(27) // 'AA'
95
83
  toBb26(28) // 'AB'
96
84
  ```
97
85
 
98
- ---
99
-
100
86
  ### Convert from BB26 to decimal
101
87
 
102
88
  ```
@@ -1,15 +0,0 @@
1
- /**
2
- * Increments a bijective base-26 string by one numeral.
3
- *
4
- * ```
5
- * import { bb26Increment } from 'bb26'
6
- *
7
- * bb26Increment('A') // 'B'
8
- * bb26Increment('Z') // 'AA'
9
- * bb26Increment('AA') // 'AB'
10
- * ```
11
- *
12
- * @param string - String to increment
13
- * @return Incremented string
14
- */
15
- export default function bb26Increment(string: string): string;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const decimal_to_bb26_1 = __importDefault(require("./decimal-to-bb26"));
7
- const bb26_to_decimal_1 = __importDefault(require("./bb26-to-decimal"));
8
- /**
9
- * Increments a bijective base-26 string by one numeral.
10
- *
11
- * ```
12
- * import { bb26Increment } from 'bb26'
13
- *
14
- * bb26Increment('A') // 'B'
15
- * bb26Increment('Z') // 'AA'
16
- * bb26Increment('AA') // 'AB'
17
- * ```
18
- *
19
- * @param string - String to increment
20
- * @return Incremented string
21
- */
22
- function bb26Increment(string) {
23
- return decimal_to_bb26_1.default(bb26_to_decimal_1.default(string) + 1);
24
- }
25
- exports.default = bb26Increment;
@@ -1 +0,0 @@
1
- export {};
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bb26_increment_1 = __importDefault(require("./bb26-increment"));
7
- describe('bb26Increment', () => {
8
- it('Should increment A to B', () => {
9
- expect(bb26_increment_1.default('A')).toBe('B');
10
- });
11
- it('Should increment Z to AA', () => {
12
- expect(bb26_increment_1.default('Z')).toBe('AA');
13
- });
14
- it('Should increment ZZ to AAA', () => {
15
- expect(bb26_increment_1.default('ZZ')).toBe('AAA');
16
- });
17
- it('Should increment AA to AB', () => {
18
- expect(bb26_increment_1.default('AA')).toBe('AB');
19
- });
20
- it('Should increment AB to AC', () => {
21
- expect(bb26_increment_1.default('AB')).toBe('AC');
22
- });
23
- it('Should increment AAA to AAB', () => {
24
- expect(bb26_increment_1.default('AAA')).toBe('AAB');
25
- });
26
- it('Should increment AAB to AAC', () => {
27
- expect(bb26_increment_1.default('AAB')).toBe('AAC');
28
- });
29
- it('Should throw if passed non-bijective base-26 string', () => {
30
- expect(() => bb26_increment_1.default('abc123')).toThrow();
31
- });
32
- });
@@ -1,3 +0,0 @@
1
- declare function bb26Random(upper: string): string;
2
- declare function bb26Random(lower: string, upper: string): string;
3
- export default bb26Random;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bb26_range_1 = __importDefault(require("./bb26-range"));
7
- const sample_1 = __importDefault(require("./sample"));
8
- /**
9
- * Produces a random string between the inclusive `lower` and `upper` bounds. If
10
- * only one argument is provided, a string between `'A'` and the given string is
11
- * returned.
12
- *
13
- * ```
14
- * import { bb26Random } from 'bb26'
15
- *
16
- * bb26Random('AAA') // 'NE'
17
- * bb26Random('AAA', 'AAAA') // 'KXZ'
18
- * ```
19
- *
20
- * @param lower
21
- * @param upper
22
- * @returns Random string
23
- */
24
- function bb26Random(lower, upper) {
25
- const start = upper ? lower : 'A';
26
- const end = upper || lower;
27
- return sample_1.default(bb26_range_1.default(start, end));
28
- }
29
- exports.default = bb26Random;
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_1 = require("./index");
4
- describe('bb26Random', () => {
5
- describe('Given an upper bound', () => {
6
- test('Should return a valid random string', () => {
7
- const validLetters = index_1.bb26Range('AAA');
8
- const results = [];
9
- for (let i = 0; i < 1000; ++i)
10
- results.push(index_1.bb26Random('ZZ'));
11
- for (const result of results)
12
- expect(validLetters).toContain(result);
13
- });
14
- });
15
- describe('Given an upper and lower bound', () => {
16
- test('Should return a valid random string', () => {
17
- const validLetters = index_1.bb26Range('AA', 'AAA');
18
- const results = [];
19
- for (let i = 0; i < 1000; ++i)
20
- results.push(index_1.bb26Random('AA', 'ZZ'));
21
- for (const result of results)
22
- expect(validLetters).toContain(result);
23
- });
24
- });
25
- });
@@ -1,3 +0,0 @@
1
- declare function bb26Range(end: string): string[];
2
- declare function bb26Range(start: string, end: string): string[];
3
- export default bb26Range;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bb26_to_decimal_1 = __importDefault(require("./bb26-to-decimal"));
7
- const bb26_increment_1 = __importDefault(require("./bb26-increment"));
8
- /**
9
- * Creates an array of bijective base-26 numerals progressing from `start` up
10
- * to, but not including, `end`.
11
- *
12
- * If `end` is not specified, it's set to `start` with `start` then set to `'A'`.
13
- *
14
- * ```
15
- * import { bb26Range } from 'bb26'
16
- *
17
- * bb26Range('B') // ['A']
18
- * bb26Range('C') // ['A', 'B']
19
- * bb26Range('B', 'C') // ['B']
20
- * bb26Range('B', 'D') // ['B', 'C']
21
- * bb26Range('Z', 'AC') // ['Z', 'AA', 'AB']
22
- * ```
23
- *
24
- * @param start - The start of the range
25
- * @param end - The end of the range
26
- */
27
- function bb26Range(start, end) {
28
- const range = [];
29
- const _end = end || start;
30
- const _start = end ? start : 'A';
31
- for (let i = _start; bb26_to_decimal_1.default(i) < bb26_to_decimal_1.default(_end); i = bb26_increment_1.default(i)) {
32
- range.push(i);
33
- }
34
- return range;
35
- }
36
- exports.default = bb26Range;
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bb26_range_1 = __importDefault(require("./bb26-range"));
7
- describe('bb26Range', () => {
8
- test('Should work with end', () => {
9
- expect(bb26_range_1.default('A')).toEqual([]);
10
- expect(bb26_range_1.default('B')).toEqual(['A']);
11
- expect(bb26_range_1.default('C')).toEqual(['A', 'B']);
12
- expect(bb26_range_1.default('AB')).toContain('AA');
13
- });
14
- test('Should work with start and end', () => {
15
- expect(bb26_range_1.default('B', 'C')).toEqual(['B']);
16
- expect(bb26_range_1.default('B', 'D')).toEqual(['B', 'C']);
17
- expect(bb26_range_1.default('ZZ', 'AAC')).toEqual(['ZZ', 'AAA', 'AAB']);
18
- });
19
- test('Should throw if given a string with a non-upper-case letter', () => {
20
- expect(() => bb26_range_1.default('a')).toThrow();
21
- });
22
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Converts a bijective base-26 string to a decimal number.
3
- *
4
- * ```
5
- * import { bb26ToDecimal } from 'bb26'
6
- *
7
- * bb26ToDecimal('A') // 1
8
- * bb26ToDecimal('B') // 2
9
- * bb26ToDecimal('Z') // 26
10
- * bb26ToDecimal('AA') // 27
11
- * bb26ToDecimal('AB') // 28
12
- * ```
13
- *
14
- * @param string
15
- */
16
- export default function bb26ToDecimal(string: string): number;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @ignore */
4
- function toDecimal(letter) {
5
- return letter.charCodeAt(0) - 'A'.charCodeAt(0) + 1;
6
- }
7
- /**
8
- * Converts a bijective base-26 string to a decimal number.
9
- *
10
- * ```
11
- * import { bb26ToDecimal } from 'bb26'
12
- *
13
- * bb26ToDecimal('A') // 1
14
- * bb26ToDecimal('B') // 2
15
- * bb26ToDecimal('Z') // 26
16
- * bb26ToDecimal('AA') // 27
17
- * bb26ToDecimal('AB') // 28
18
- * ```
19
- *
20
- * @param string
21
- */
22
- function bb26ToDecimal(string) {
23
- if (!/[A-Z]/.test(string)) {
24
- throw new Error('String must contain only upper-case characters');
25
- }
26
- let number = 0;
27
- for (let i = 0; i < string.length; i++) {
28
- const char = string[string.length - i - 1];
29
- number += Math.pow(26, i) * toDecimal(char);
30
- }
31
- return number;
32
- }
33
- exports.default = bb26ToDecimal;
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const bb26_to_decimal_1 = __importDefault(require("./bb26-to-decimal"));
7
- describe('bb26ToDecimal', () => {
8
- test('Should convert A to 1', () => {
9
- expect(bb26_to_decimal_1.default('A')).toBe(1);
10
- });
11
- test('Should convert B to 2', () => {
12
- expect(bb26_to_decimal_1.default('B')).toBe(2);
13
- });
14
- test('Should convert Z to 26', () => {
15
- expect(bb26_to_decimal_1.default('Z')).toBe(26);
16
- });
17
- test('Should convert AA to 27', () => {
18
- expect(bb26_to_decimal_1.default('AA')).toBe(27);
19
- });
20
- test('Should convert AB to 28', () => {
21
- expect(bb26_to_decimal_1.default('AB')).toBe(28);
22
- });
23
- test('Should convert AC to 29', () => {
24
- expect(bb26_to_decimal_1.default('AC')).toBe(29);
25
- });
26
- test('Should throw if given a non-upper-case character', () => {
27
- expect(() => {
28
- bb26_to_decimal_1.default('a');
29
- }).toThrow();
30
- });
31
- });
@@ -1,16 +0,0 @@
1
- /**
2
- * Converts a decimal number to a bijective base-26 string.
3
- *
4
- * ```
5
- * import { decimalToBb26 } from 'bb26'
6
- *
7
- * decimalToBb26(1) // 'A'
8
- * decimalToBb26(2) // 'B'
9
- * decimalToBb26(26) // 'Z'
10
- * decimalToBb26(27) // 'AA'
11
- * decimalToBb26(28) // 'AB'
12
- * ```
13
- *
14
- * @param number
15
- */
16
- export default function decimalToBb26(number: number): string;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @ignore */
4
- function toChar(number) {
5
- return String.fromCharCode('A'.charCodeAt(0) - 1 + number);
6
- }
7
- /**
8
- * Converts a decimal number to a bijective base-26 string.
9
- *
10
- * ```
11
- * import { decimalToBb26 } from 'bb26'
12
- *
13
- * decimalToBb26(1) // 'A'
14
- * decimalToBb26(2) // 'B'
15
- * decimalToBb26(26) // 'Z'
16
- * decimalToBb26(27) // 'AA'
17
- * decimalToBb26(28) // 'AB'
18
- * ```
19
- *
20
- * @param number
21
- */
22
- function decimalToBb26(number) {
23
- let string = '';
24
- let _number = number;
25
- while (_number > 0) {
26
- string = toChar(_number % 26 || 26) + string;
27
- _number = Math.floor((_number - 1) / 26);
28
- }
29
- return string;
30
- }
31
- exports.default = decimalToBb26;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const decimal_to_bb26_1 = __importDefault(require("./decimal-to-bb26"));
7
- describe('decimalToBb26', () => {
8
- test('Should convert 1 to A', () => {
9
- expect(decimal_to_bb26_1.default(1)).toBe('A');
10
- });
11
- test('Should convert 2 to B', () => {
12
- expect(decimal_to_bb26_1.default(2)).toBe('B');
13
- });
14
- test('Should convert 26 to Z', () => {
15
- expect(decimal_to_bb26_1.default(26)).toBe('Z');
16
- });
17
- test('Should convert 27 to AA', () => {
18
- expect(decimal_to_bb26_1.default(27)).toBe('AA');
19
- });
20
- test('Should convert 28 to AB', () => {
21
- expect(decimal_to_bb26_1.default(28)).toBe('AB');
22
- });
23
- test('Should convert 29 to AC', () => {
24
- expect(decimal_to_bb26_1.default(29)).toBe('AC');
25
- });
26
- });
package/dist/sample.d.ts DELETED
@@ -1,2 +0,0 @@
1
- /** @ignore */
2
- export default function sample(array: any[]): any;
package/dist/sample.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @ignore */
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- function sample(array) {
6
- return array[Math.floor(Math.random() * array.length)];
7
- }
8
- exports.default = sample;