diff --git a/README.md b/README.md index 007c6ec..d6832b2 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,12 @@ returns { boltColor: '#01a100', zapColor: '#3213d6', sparkColor: '#f6853e' + }, + parts: { + bolts: 0, + zaps: 1, + sparks: 3, + charges: e } } */ diff --git a/package.json b/package.json index 37f8b74..c1e4479 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@purduehackers/time", - "version": "0.6.12", + "version": "0.6.13", "description": "convert between traditional time and lightning time ⚡️", "main": "dist/index.js", "module": "dist/esm/index.js", diff --git a/src/time.ts b/src/time.ts index 8bfa98c..e384c9f 100644 --- a/src/time.ts +++ b/src/time.ts @@ -57,23 +57,22 @@ export class LightningTime { const totalZaps = totalSparks / 16 const totalBolts = totalZaps / 16 - const charges = Math.floor(totalCharges) % 16 - const sparks = Math.floor(totalSparks) % 16 - const zaps = Math.floor(totalZaps) % 16 - const bolts = Math.floor(totalBolts) % 16 - - const lightningString = - bolts.toString(16) + - '~' + - zaps.toString(16) + - '~' + - sparks.toString(16) + - '|' + - charges.toString(16) + const charges = (Math.floor(totalCharges) % 16).toString(16) + const sparks = (Math.floor(totalSparks) % 16).toString(16) + const zaps = (Math.floor(totalZaps) % 16).toString(16) + const bolts = (Math.floor(totalBolts) % 16).toString(16) + + const lightningString = bolts + '~' + zaps + '~' + sparks + '|' + charges return { lightningString, strippedCharges: stripCharges(lightningString), - colors: this.getColors(lightningString) + colors: this.getColors(lightningString), + parts: { + bolts, + zaps, + sparks, + charges + } } } diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 7f3bd7a..b89fdbe 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -2,6 +2,7 @@ export interface LightningString { lightningString: string strippedCharges: string colors: Colors + parts: LightningTimeParts } export interface LightningTimeObject {