@burstjs/util
Advanced tools
Comparing version 0.1.0-rc1 to 0.1.1
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## 0.1.0-rc.3 | ||
- Timestamp conversion functions | ||
## 0.0.13 (2019-02-03) | ||
@@ -9,2 +12,2 @@ ### Added | ||
### Changed | ||
- Removed BurstUtils from `@burstjs/core`. | ||
- Removed BurstUtils from `@burstjs/core`. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const BN = require("bn.js"); | ||
const internal_1 = require("./internal"); | ||
@@ -59,4 +58,4 @@ const isBurstAddress_1 = require("./isBurstAddress"); | ||
} while (length > 0); | ||
return new BN(out.split('').reverse().join('')).toString(); | ||
return out.split('').reverse().join(''); | ||
}; | ||
//# sourceMappingURL=convertAddressToNumericId.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const BN = require("bn.js"); | ||
const internal_1 = require("./internal"); | ||
@@ -13,6 +12,5 @@ exports.convertNumericIdToAddress = (numericId) => { | ||
let pos = 0; | ||
const plainString = new BN(numericId).toString(); | ||
let length = plainString.length; | ||
let length = numericId.length; | ||
for (let i = 0; i < length; i++) { | ||
plainString10[i] = plainString.charCodeAt(i) - '0'.charCodeAt(0); | ||
plainString10[i] = numericId.charCodeAt(i) - '0'.charCodeAt(0); | ||
} | ||
@@ -19,0 +17,0 @@ let digit32 = 0, newLength = 0; |
@@ -5,2 +5,5 @@ export * from './constructBurstAddress'; | ||
export * from './convertNumericIdToAddress'; | ||
export * from './convertBurstTimeToEpochTime'; | ||
export * from './convertBurstTimeToDate'; | ||
export * from './convertDateToBurstTime'; | ||
export * from './convertAddressToNumericId'; | ||
@@ -7,0 +10,0 @@ export * from './isBurstAddress'; |
@@ -10,2 +10,5 @@ "use strict"; | ||
__export(require("./convertNumericIdToAddress")); | ||
__export(require("./convertBurstTimeToEpochTime")); | ||
__export(require("./convertBurstTimeToDate")); | ||
__export(require("./convertDateToBurstTime")); | ||
__export(require("./convertAddressToNumericId")); | ||
@@ -12,0 +15,0 @@ __export(require("./isBurstAddress")); |
@@ -0,1 +1,2 @@ | ||
export declare const GenesisBlockTime: number; | ||
export declare const initialCodeword: number[]; | ||
@@ -2,0 +3,0 @@ export declare const gexp: number[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GenesisBlockTime = Date.UTC(2014, 7, 11, 2, 0, 0, 0) / 1000; | ||
exports.initialCodeword = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | ||
@@ -4,0 +5,0 @@ exports.gexp = [1, 2, 4, 8, 16, 5, 10, 20, 13, 26, 17, 7, 14, 28, 29, 31, 27, 19, 3, 6, 12, 24, 21, 15, 30, 25, 23, 11, 22, 9, 18, 1]; |
{ | ||
"name": "@burstjs/util", | ||
"version": "0.1.0-rc1", | ||
"version": "0.1.1", | ||
"description": "Useful utilities and tools for building Burstcoin applications", | ||
@@ -56,6 +56,3 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"bn.js": "^4.11.8" | ||
}, | ||
"gitHead": "474b30eacdc74c568b04f429b0901f3bd9e831a8" | ||
"gitHead": "5ce4a3e1353fc38227fedac8e562cfa2567e6930" | ||
} |
@@ -9,3 +9,2 @@ /** @module util */ | ||
import * as BN from 'bn.js'; | ||
import { base32Length, cwmap, alphabet, initialCodeword } from './internal'; | ||
@@ -22,3 +21,2 @@ import { isValid } from './isBurstAddress'; | ||
if (address === undefined || | ||
@@ -30,3 +28,2 @@ address === null || | ||
// remove Burst prefix | ||
if (address.indexOf('BURST-') === 0) { | ||
@@ -90,3 +87,3 @@ address = address.substr(6); | ||
return new BN(out.split('').reverse().join('')).toString(); | ||
return out.split('').reverse().join(''); | ||
}; |
@@ -9,3 +9,2 @@ // tslint:disable:no-bitwise | ||
import * as BN from 'bn.js'; | ||
import { initialCodeword, base32Length, gmult, alphabet, cwmap } from './internal'; | ||
@@ -31,7 +30,6 @@ | ||
const plainString = new BN(numericId).toString(); | ||
let length = plainString.length; | ||
let length = numericId.length; | ||
for (let i = 0; i < length; i++) { | ||
plainString10[i] = plainString.charCodeAt(i) - '0'.charCodeAt(0); | ||
plainString10[i] = numericId.charCodeAt(i) - '0'.charCodeAt(0); | ||
} | ||
@@ -38,0 +36,0 @@ |
@@ -6,2 +6,5 @@ /** @module util */ | ||
export * from './convertNumericIdToAddress'; | ||
export * from './convertBurstTimeToEpochTime'; | ||
export * from './convertBurstTimeToDate'; | ||
export * from './convertDateToBurstTime'; | ||
export * from './convertAddressToNumericId'; | ||
@@ -13,5 +16,7 @@ export * from './isBurstAddress'; | ||
* A useful regex for matching burst addresses | ||
* | ||
*/ | ||
// TODO: I doubt that this should be in the lib. Very UI specific | ||
export const burstAddressPattern = { | ||
'_': {pattern: new RegExp('\[a-zA-Z0-9\]')} | ||
}; |
@@ -12,3 +12,3 @@ /** @ignore */ | ||
// Internal helper functions and structures | ||
export const GenesisBlockTime = Date.UTC(2014, 7, 11, 2, 0, 0, 0) / 1000; | ||
export const initialCodeword = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | ||
@@ -34,1 +34,2 @@ export const gexp: number[] = [1, 2, 4, 8, 16, 5, 10, 20, 13, 26, 17, 7, 14, 28, 29, 31, 27, 19, 3, 6, 12, 24, 21, 15, 30, 25, 23, 11, 22, 9, 18, 1]; | ||
}; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
47474
0
56
824
- Removedbn.js@^4.11.8
- Removedbn.js@4.12.1(transitive)