Comparing version 1.0.4 to 1.0.5
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./lexoRank")); | ||
__export(require("./numeralSystems")); | ||
__exportStar(require("./lexoRank"), exports); | ||
__exportStar(require("./numeralSystems"), exports); |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./lexoRank")); | ||
__export(require("./lexoRankBucket")); | ||
__export(require("./lexoDecimal")); | ||
__export(require("./lexoInteger")); | ||
__exportStar(require("./lexoRank"), exports); | ||
__exportStar(require("./lexoRankBucket"), exports); | ||
__exportStar(require("./lexoDecimal"), exports); | ||
__exportStar(require("./lexoInteger"), exports); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LexoDecimal = void 0; | ||
const lexoInteger_1 = require("./lexoInteger"); | ||
const stringBuilder_1 = require("../utils/stringBuilder"); | ||
class LexoDecimal { | ||
constructor(mag, sig) { | ||
this.mag = mag; | ||
this.sig = sig; | ||
} | ||
static half(sys) { | ||
@@ -36,6 +41,2 @@ const mid = (sys.getBase() / 2) | 0; | ||
} | ||
constructor(mag, sig) { | ||
this.mag = mag; | ||
this.sig = sig; | ||
} | ||
getSystem() { | ||
@@ -42,0 +43,0 @@ return this.mag.getSystem(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lexoHelper = void 0; | ||
exports.lexoHelper = { | ||
@@ -4,0 +5,0 @@ arrayCopy, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LexoInteger = void 0; | ||
const lexoHelper_1 = require("./lexoHelper"); | ||
@@ -289,2 +290,3 @@ const stringBuilder_1 = require("../utils/stringBuilder"); | ||
} | ||
exports.LexoInteger = LexoInteger; | ||
LexoInteger.ZERO_MAG = [0]; | ||
@@ -295,2 +297,1 @@ LexoInteger.ONE_MAG = [1]; | ||
LexoInteger.POSITIVE_SIGN = 1; | ||
exports.LexoInteger = LexoInteger; |
import { LexoDecimal } from './lexoDecimal'; | ||
import LexoRankBucket from './lexoRankBucket'; | ||
export declare class LexoRank { | ||
static readonly NUMERAL_SYSTEM: any; | ||
private static readonly ZERO_DECIMAL; | ||
private static readonly ONE_DECIMAL; | ||
private static readonly EIGHT_DECIMAL; | ||
private static readonly MIN_DECIMAL; | ||
private static readonly MAX_DECIMAL; | ||
private static readonly MID_DECIMAL; | ||
private static readonly INITIAL_MIN_DECIMAL; | ||
private static readonly INITIAL_MAX_DECIMAL; | ||
static get NUMERAL_SYSTEM(): any; | ||
private static get ZERO_DECIMAL(); | ||
private static get ONE_DECIMAL(); | ||
private static get EIGHT_DECIMAL(); | ||
private static get MIN_DECIMAL(); | ||
private static get MAX_DECIMAL(); | ||
private static get MID_DECIMAL(); | ||
private static get INITIAL_MIN_DECIMAL(); | ||
private static get INITIAL_MAX_DECIMAL(); | ||
static min(): LexoRank; | ||
@@ -14,0 +14,0 @@ static middle(): LexoRank; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LexoRank = void 0; | ||
const lexoDecimal_1 = require("./lexoDecimal"); | ||
@@ -8,2 +9,7 @@ const lexoRankBucket_1 = require("./lexoRankBucket"); | ||
class LexoRank { | ||
constructor(bucket, decimal) { | ||
this.value = bucket.format() + '|' + LexoRank.formatDecimal(decimal); | ||
this.bucket = bucket; | ||
this.decimal = decimal; | ||
} | ||
static get NUMERAL_SYSTEM() { | ||
@@ -182,7 +188,2 @@ if (!this._NUMERAL_SYSTEM) { | ||
} | ||
constructor(bucket, decimal) { | ||
this.value = bucket.format() + '|' + LexoRank.formatDecimal(decimal); | ||
this.bucket = bucket; | ||
this.decimal = decimal; | ||
} | ||
genPrev() { | ||
@@ -189,0 +190,0 @@ if (this.isMax()) { |
declare class LexoRankBucket { | ||
static readonly BUCKET_0: LexoRankBucket; | ||
private static readonly BUCKET_1; | ||
private static readonly BUCKET_2; | ||
private static readonly VALUES; | ||
static get BUCKET_0(): LexoRankBucket; | ||
private static get BUCKET_1(); | ||
private static get BUCKET_2(); | ||
private static get VALUES(); | ||
static max(): LexoRankBucket; | ||
@@ -7,0 +7,0 @@ static from(str: string): LexoRankBucket; |
@@ -6,2 +6,5 @@ "use strict"; | ||
class LexoRankBucket { | ||
constructor(val) { | ||
this.value = lexoInteger_1.LexoInteger.parse(val, lexoRank_1.LexoRank.NUMERAL_SYSTEM); | ||
} | ||
static get BUCKET_0() { | ||
@@ -57,5 +60,2 @@ if (!this._BUCKET_0) { | ||
} | ||
constructor(val) { | ||
this.value = lexoInteger_1.LexoInteger.parse(val, lexoRank_1.LexoRank.NUMERAL_SYSTEM); | ||
} | ||
format() { | ||
@@ -62,0 +62,0 @@ return this.value.format(); |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./lexoNumeralSystem10")); | ||
__export(require("./lexoNumeralSystem36")); | ||
__export(require("./lexoNumeralSystem64")); | ||
__exportStar(require("./lexoNumeralSystem"), exports); | ||
__exportStar(require("./lexoNumeralSystem10"), exports); | ||
__exportStar(require("./lexoNumeralSystem36"), exports); | ||
__exportStar(require("./lexoNumeralSystem64"), exports); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LexoNumeralSystem10 = void 0; | ||
class LexoNumeralSystem10 { | ||
@@ -4,0 +5,0 @@ getBase() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LexoNumeralSystem36 = void 0; | ||
class LexoNumeralSystem36 { | ||
@@ -4,0 +5,0 @@ constructor() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LexoNumeralSystem64 = void 0; | ||
class LexoNumeralSystem64 { | ||
@@ -4,0 +5,0 @@ constructor() { |
declare class StringBuilder { | ||
private str; | ||
constructor(str?: string); | ||
length: number; | ||
get length(): number; | ||
set length(value: number); | ||
append(str: string): StringBuilder; | ||
@@ -6,0 +7,0 @@ remove(startIndex: number, length: number): StringBuilder; |
{ | ||
"name": "lexorank", | ||
"version": "1.0.4", | ||
"_id": "lexorank@1.0.5", | ||
"version": "1.0.5", | ||
"description": "A reference implementation of a list ordering system like JIRA's Lexorank algorithm", | ||
"author": "kvandake", | ||
"author": { | ||
"name": "kvandake" | ||
}, | ||
"license": "MIT", | ||
@@ -15,3 +18,3 @@ "main": "lib/index.js", | ||
"type": "git", | ||
"url": "https://github.com/kvandake/lexorank-ts" | ||
"url": "git+https://github.com/kvandake/lexorank-ts.git" | ||
}, | ||
@@ -26,25 +29,44 @@ "bugs": { | ||
"test": "jest", | ||
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"prepare": "yarn run build", | ||
"lint": "eslint -c .eslintrc.js --ext .ts ./src", | ||
"prepublishOnly": "yarn test && yarn run lint", | ||
"preversion": "yarn run lint", | ||
"version": "yarn run format && git add -A src", | ||
"postversion": "git push && git push --tags" | ||
"version": "git add -A src", | ||
"postversion": "git push && git push --tags", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook", | ||
"chromatic": "npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.15", | ||
"@types/node": "^12.6.8", | ||
"jest": "^24.8.0", | ||
"prettier": "^1.18.2", | ||
"rimraf": "^2.6.3", | ||
"ts-jest": "^24.0.2", | ||
"tslint": "^5.18.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.5.3", | ||
"yarn": "^1.17.3" | ||
"@babel/core": "^7.18.13", | ||
"@dnd-kit/core": "^6.0.5", | ||
"@dnd-kit/sortable": "^7.0.1", | ||
"@storybook/addon-actions": "^6.5.10", | ||
"@storybook/addon-essentials": "^6.5.10", | ||
"@storybook/addon-interactions": "^6.5.10", | ||
"@storybook/addon-links": "^6.5.10", | ||
"@storybook/builder-webpack5": "^6.5.10", | ||
"@storybook/manager-webpack5": "^6.5.10", | ||
"@storybook/react": "^6.5.10", | ||
"@storybook/testing-library": "^0.0.13", | ||
"@types/jest": "^29.0.0", | ||
"@types/node": "^18.7.14", | ||
"@typescript-eslint/eslint-plugin": "^5.36.1", | ||
"@typescript-eslint/parser": "^5.36.1", | ||
"babel-loader": "^8.2.5", | ||
"chromatic": "^6.8.0", | ||
"eslint": "^8.23.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-storybook": "^0.6.4", | ||
"jest": "^29.0.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^28.0.8", | ||
"typescript": "^4.8.2", | ||
"yarn": "^1.22.19" | ||
}, | ||
"files": [ | ||
"lib/**/*" | ||
] | ||
], | ||
"dependencies": {} | ||
} |
# LexoRank on Typescript | ||
A reference implementation of a list ordering system like [JIRA's Lexorank algorithm](https://www.youtube.com/watch?v=OjQv9xMoFbg). | ||
[![npm version](https://badge.fury.io/js/lexorank.svg)](https://badge.fury.io/js/lexorank) | ||
## Getting Started | ||
@@ -13,5 +15,8 @@ | ||
```sh | ||
npm yarn add lexorank | ||
yarn add lexorank | ||
``` | ||
## Storyboard | ||
[See examples](https://630e298cd63179cde4d8775c-bensuqejhp.chromatic.com/?path=/story/dnd-kit--dnd-kit-list-story) | ||
## Using | ||
@@ -30,3 +35,3 @@ | ||
// middle | ||
const maxLexoRank = LexoRank.middle(); | ||
const middleLexoRank = LexoRank.middle(); | ||
// parse | ||
@@ -68,2 +73,5 @@ const parsedLexoRank = LexoRank.parse('0|0i0000:'); | ||
## Related projects | ||
- [LexoRank on C#](https://github.com/kvandake/lexorank-dotnet) | ||
## Licence | ||
@@ -70,0 +78,0 @@ MIT |
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
45120
1228
80
27