Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bb26

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bb26 - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

7

dist/increment.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const to_bb26_1 = __importDefault(require("./to-bb26"));
const to_decimal_1 = __importDefault(require("./to-decimal"));
var to_bb26_1 = require("./to-bb26");
var to_decimal_1 = require("./to-decimal");
/**

@@ -9,0 +6,0 @@ * Increments a bijective base-26 string by one numeral.

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBb26 = exports.toDecimal = exports.range = exports.random = exports.increment = void 0;
const increment_1 = __importDefault(require("./increment"));
var increment_1 = require("./increment");
exports.increment = increment_1.default;
const random_1 = __importDefault(require("./random"));
var random_1 = require("./random");
exports.random = random_1.default;
const range_1 = __importDefault(require("./range"));
var range_1 = require("./range");
exports.range = range_1.default;
const to_decimal_1 = __importDefault(require("./to-decimal"));
var to_decimal_1 = require("./to-decimal");
exports.toDecimal = to_decimal_1.default;
const to_bb26_1 = __importDefault(require("./to-bb26"));
var to_bb26_1 = require("./to-bb26");
exports.toBb26 = to_bb26_1.default;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const range_1 = __importDefault(require("./range"));
const sample_1 = __importDefault(require("./sample"));
var range_1 = require("./range");
var sample_1 = require("./sample");
/**

@@ -25,6 +22,6 @@ * Produces a random string between the inclusive `lower` and `upper` bounds. If

function random(lower, upper) {
const start = upper ? lower : 'A';
const end = upper || lower;
var start = upper ? lower : 'A';
var end = upper || lower;
return sample_1.default(range_1.default(start, end));
}
exports.default = random;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const to_decimal_1 = __importDefault(require("./to-decimal"));
const increment_1 = __importDefault(require("./increment"));
var to_decimal_1 = require("./to-decimal");
var increment_1 = require("./increment");
/**

@@ -28,6 +25,6 @@ * Creates an array of bijective base-26 numerals progressing from `start` up

function range(start, end) {
const range = [];
const _end = end || start;
const _start = end ? start : 'A';
for (let i = _start; to_decimal_1.default(i) < to_decimal_1.default(_end); i = increment_1.default(i)) {
var range = [];
var _end = end || start;
var _start = end ? start : 'A';
for (var i = _start; to_decimal_1.default(i) < to_decimal_1.default(_end); i = increment_1.default(i)) {
range.push(i);

@@ -34,0 +31,0 @@ }

@@ -1,2 +0,1 @@

/** @ignore */
export default function sample(array: any[]): any;
export default function sample<T>(array: T[]): T;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @ignore */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function sample(array) {

@@ -6,0 +4,0 @@ return array[Math.floor(Math.random() * array.length)];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @ignore */
function toChar(number) {

@@ -23,4 +22,4 @@ return String.fromCharCode('A'.charCodeAt(0) - 1 + number);

function toBb26(number) {
let string = '';
let _number = number;
var string = '';
var _number = number;
while (_number > 0) {

@@ -27,0 +26,0 @@ string = toChar(_number % 26 || 26) + string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @ignore */
function charToDecimal(letter) {

@@ -26,5 +25,5 @@ return letter.charCodeAt(0) - 'A'.charCodeAt(0) + 1;

}
let number = 0;
for (let i = 0; i < string.length; i++) {
const char = string[string.length - i - 1];
var number = 0;
for (var i = 0; i < string.length; i++) {
var char = string[string.length - i - 1];
number += Math.pow(26, i) * charToDecimal(char);

@@ -31,0 +30,0 @@ }

{
"name": "bb26",
"version": "2.0.1",
"description": "Bijective base-26 utility functions",
"version": "2.1.0",
"description": "Bijective base-26 utility functions for converting numbers to/from spreadsheet column letters",
"repository": "github:ptrkcsk/BB26",
"author": "Patrik Csak <patrik@csak.email>",
"author": "Patrik Csak <p@trikcsak.com>",
"license": "MIT",

@@ -13,32 +13,30 @@ "bugs": {

"keywords": [
"base-26",
"bijective-base-26",
"base 26",
"bijective base 26",
"hexavigesimal",
"spreadsheet"
"spreadsheet",
"spreadsheet column",
"spreadsheet column letters"
],
"main": "dist",
"files": [
"dist",
"!dist/*.js.map"
"dist"
],
"scripts": {
"build": "rm -fr dist && tsc",
"build": "tsc",
"lint": "eslint",
"prepublishOnly": "npm run build",
"prepublishOnly": "rm -fr dist && npm run build",
"test": "jest",
"test:coverage": "jest --coverage"
},
"dependencies": {},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.7.0",
"@types/jest": "^25.2.3",
"@types/lodash.sample": "^4.2.6",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
"eslint": "^7.1.0",
"jest": "^26.0.1",
"ts-jest": "^26.0.0",
"typescript": "^3.9.3"
"@types/jest": "^26.0.15",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.13.0",
"jest": "^26.6.3",
"ts-jest": "^26.4.4",
"typescript": "^4.0.5"
},
"types": "dist"
}

@@ -5,6 +5,4 @@ # BB26

[Bijective base-26](https://en.wikipedia.org/wiki/Bijective_numeration#The_bijective_base-26_system) utility functions for JavaScript
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
---
## Installation

@@ -16,8 +14,4 @@

---
## Usage
---
### Increment

@@ -39,4 +33,2 @@

---
### Random

@@ -58,4 +50,2 @@

---
### Range

@@ -82,4 +72,2 @@

---
### Convert from decimal to BB26

@@ -103,4 +91,2 @@

---
### Convert from BB26 to decimal

@@ -107,0 +93,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc