Comparing version 0.2.2 to 0.3.1
/** | ||
* @ignore | ||
* Increments a bijective base-26 string by one numeral. | ||
* | ||
* ``` | ||
* import { bb26Increment } from 'bb26' | ||
* | ||
* bb26Increment('A') // 'B' | ||
* bb26Increment('Z') // 'AA' | ||
* bb26Increment('AA') // 'AB' | ||
* ``` | ||
* | ||
* @param string - String to increment | ||
* @return Incremented string | ||
*/ | ||
export default function bb26Increment(string: string): string; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const decimal_to_bb26_1 = require("./decimal-to-bb26"); | ||
const bb26_to_decimal_1 = require("./bb26-to-decimal"); | ||
const decimal_to_bb26_1 = __importDefault(require("./decimal-to-bb26")); | ||
const bb26_to_decimal_1 = __importDefault(require("./bb26-to-decimal")); | ||
/** | ||
* @ignore | ||
* Increments a bijective base-26 string by one numeral. | ||
* | ||
* ``` | ||
* import { bb26Increment } from 'bb26' | ||
* | ||
* bb26Increment('A') // 'B' | ||
* bb26Increment('Z') // 'AA' | ||
* bb26Increment('AA') // 'AB' | ||
* ``` | ||
* | ||
* @param string - String to increment | ||
* @return Incremented string | ||
*/ | ||
@@ -8,0 +22,0 @@ function bb26Increment(string) { |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const bb26_to_decimal_1 = require("./bb26-to-decimal"); | ||
const decimal_to_bb26_1 = require("./decimal-to-bb26"); | ||
const bb26_to_decimal_1 = __importDefault(require("./bb26-to-decimal")); | ||
const decimal_to_bb26_1 = __importDefault(require("./decimal-to-bb26")); | ||
/** | ||
@@ -22,6 +25,6 @@ * @ignore | ||
* | ||
* bb26Range('B') // ['A'] | ||
* bb26Range('C') // ['A', 'B'] | ||
* bb26Range('B', 'C') // ['B'] | ||
* bb26Range('B', 'D') // ['B', 'C'] | ||
* bb26Range('B') // ['A'] | ||
* bb26Range('C') // ['A', 'B'] | ||
* bb26Range('B', 'C') // ['B'] | ||
* bb26Range('B', 'D') // ['B', 'C'] | ||
* bb26Range('Z', 'AC') // ['Z', 'AA', 'AB'] | ||
@@ -28,0 +31,0 @@ * ``` |
@@ -0,1 +1,16 @@ | ||
/** | ||
* Converts a bijective base-26 string to a decimal number. | ||
* | ||
* ``` | ||
* import { bb26ToDecimal } from 'bb26' | ||
* | ||
* bb26ToDecimal('A') // 1 | ||
* bb26ToDecimal('B') // 2 | ||
* bb26ToDecimal('Z') // 26 | ||
* bb26ToDecimal('AA') // 27 | ||
* bb26ToDecimal('AB') // 28 | ||
* ``` | ||
* | ||
* @param string | ||
*/ | ||
export default function bb26ToDecimal(string: string): number; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** @ignore */ | ||
const letterToDecimal = (letter) => letter.charCodeAt(0) - 'A'.charCodeAt(0) + 1; | ||
/** | ||
* Converts a bijective base-26 string to a decimal number. | ||
* | ||
* ``` | ||
* import { bb26ToDecimal } from 'bb26' | ||
* | ||
* bb26ToDecimal('A') // 1 | ||
* bb26ToDecimal('B') // 2 | ||
* bb26ToDecimal('Z') // 26 | ||
* bb26ToDecimal('AA') // 27 | ||
* bb26ToDecimal('AB') // 28 | ||
* ``` | ||
* | ||
* @param string | ||
*/ | ||
function bb26ToDecimal(string) { | ||
@@ -5,0 +21,0 @@ if (!/[A-Z]/.test(string)) |
@@ -0,1 +1,16 @@ | ||
/** | ||
* Converts a decimal number to a bijective base-26 string. | ||
* | ||
* ``` | ||
* import { decimalToBb26 } from 'bb26' | ||
* | ||
* decimalToBb26(1) // 'A' | ||
* decimalToBb26(2) // 'B' | ||
* decimalToBb26(26) // 'Z' | ||
* decimalToBb26(27) // 'AA' | ||
* decimalToBb26(28) // 'AB' | ||
* ``` | ||
* | ||
* @param number | ||
*/ | ||
export default function decimalToBb26(number: number): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** @ignore */ | ||
const decimalToLetter = (number) => String.fromCharCode('A'.charCodeAt(0) - 1 + number); | ||
/** | ||
* Converts a decimal number to a bijective base-26 string. | ||
* | ||
* ``` | ||
* import { decimalToBb26 } from 'bb26' | ||
* | ||
* decimalToBb26(1) // 'A' | ||
* decimalToBb26(2) // 'B' | ||
* decimalToBb26(26) // 'Z' | ||
* decimalToBb26(27) // 'AA' | ||
* decimalToBb26(28) // 'AB' | ||
* ``` | ||
* | ||
* @param number | ||
*/ | ||
function decimalToBb26(number) { | ||
@@ -5,0 +21,0 @@ let string = ''; |
@@ -0,4 +1,6 @@ | ||
import bb26Increment from './bb26-increment'; | ||
import bb26Random from './bb26-random'; | ||
import bb26Range from './bb26-range'; | ||
import bb26ToDecimal from './bb26-to-decimal'; | ||
import decimalToBb26 from './decimal-to-bb26'; | ||
export { bb26Range, bb26ToDecimal, decimalToBb26 }; | ||
export { bb26Increment, bb26Random, bb26Range, bb26ToDecimal, decimalToBb26 }; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const bb26_range_1 = require("./bb26-range"); | ||
const bb26_increment_1 = __importDefault(require("./bb26-increment")); | ||
exports.bb26Increment = bb26_increment_1.default; | ||
const bb26_random_1 = __importDefault(require("./bb26-random")); | ||
exports.bb26Random = bb26_random_1.default; | ||
const bb26_range_1 = __importDefault(require("./bb26-range")); | ||
exports.bb26Range = bb26_range_1.default; | ||
const bb26_to_decimal_1 = require("./bb26-to-decimal"); | ||
const bb26_to_decimal_1 = __importDefault(require("./bb26-to-decimal")); | ||
exports.bb26ToDecimal = bb26_to_decimal_1.default; | ||
const decimal_to_bb26_1 = require("./decimal-to-bb26"); | ||
const decimal_to_bb26_1 = __importDefault(require("./decimal-to-bb26")); | ||
exports.decimalToBb26 = decimal_to_bb26_1.default; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "bb26", | ||
"version": "0.2.2", | ||
"version": "0.3.1", | ||
"description": "Bijective base-26 utility functions", | ||
@@ -26,8 +26,13 @@ "repository": "github:ptrkcsk/BB26", | ||
"docs": "typedoc", | ||
"prepublishOnly": "npm run build", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage" | ||
}, | ||
"dependencies": { | ||
"lodash.sample": "^4.2.1" | ||
}, | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "^0.4.0", | ||
"@types/jest": "^24.0.15", | ||
"@types/lodash.sample": "^4.2.6", | ||
"jest": "^24.8.0", | ||
@@ -34,0 +39,0 @@ "ts-jest": "^24.0.2", |
# BB26 | ||
[![BB26 Test Coverage](https://badgen.net/codeclimate/coverage/ptrkcsk/BB26?icon=codeclimate)](https://codeclimate.com/github/ptrkcsk/BB26) [![BB26 Maintainability](https://badgen.net/codeclimate/maintainability/ptrkcsk/BB26?icon=codeclimate)](https://codeclimate.com/github/ptrkcsk/BB26) [![BB26 Install Size](https://badgen.net/packagephobia/install/bb26)](https://packagephobia.now.sh/result?p=bb26) | ||
[![BB26 test coverage](https://badgen.net/codeclimate/coverage/ptrkcsk/BB26?icon=codeclimate)](https://codeclimate.com/github/ptrkcsk/BB26) [![BB26 maintainability](https://badgen.net/codeclimate/maintainability/ptrkcsk/BB26?icon=codeclimate)](https://codeclimate.com/github/ptrkcsk/BB26) [![BB26 install size](https://badgen.net/packagephobia/install/bb26)](https://packagephobia.now.sh/result?p=bb26) [![BB26 minified and gzipped size](https://badgen.net/bundlephobia/minzip/bb26)](https://bundlephobia.com/result?p=bb26) | ||
[Bijective base-26](https://en.wikipedia.org/wiki/Bijective_numeration#The_bijective_base-26_system) utility functions for JavaScript | ||
--- | ||
[Bijective base-26](https://en.wikipedia.org/wiki/Bijective_numeration#The_bijective_base-26_system) utility functions for JavaScript | ||
## Installation | ||
```bash | ||
npm i bb26 | ||
``` | ||
--- | ||
[Documentation](https://ptrkcsk.github.io/BB26/) | ||
## Usage | ||
[API documentation](https://ptrkcsk.github.io/BB26/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10204
15
231
20
1
7
+ Addedlodash.sample@^4.2.1
+ Addedlodash.sample@4.2.1(transitive)