@erebos/hex
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -42,2 +42,6 @@ "use strict"; | ||
function () { | ||
Hex.from = function from(input) { | ||
return new Hex(input); | ||
}; | ||
function Hex(inputValue) { | ||
@@ -57,30 +61,28 @@ (0, _defineProperty2.default)(this, "input", void 0); | ||
this.hexValue = inputValue; | ||
} else if (typeof inputValue === 'string') { | ||
this.input = { | ||
type: 'string', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Array.isArray(inputValue)) { | ||
this.input = { | ||
type: 'bytesArray', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Buffer.isBuffer(inputValue)) { | ||
this.input = { | ||
type: 'buffer', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (typeof inputValue === 'object') { | ||
this.input = { | ||
type: 'object', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(JSON.stringify(inputValue)); | ||
} else { | ||
if (typeof inputValue === 'string') { | ||
this.input = { | ||
type: 'string', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Array.isArray(inputValue)) { | ||
this.input = { | ||
type: 'bytesArray', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Buffer.isBuffer(inputValue)) { | ||
this.input = { | ||
type: 'buffer', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (typeof inputValue === 'object') { | ||
this.input = { | ||
type: 'object', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(JSON.stringify(inputValue)); | ||
} else { | ||
throw new Error('Invalid input'); | ||
} | ||
throw new Error('Invalid input'); | ||
} | ||
@@ -92,3 +94,3 @@ } | ||
_proto.equals = function equals(other) { | ||
return new Hex(other).value === this.hexValue; | ||
return Hex.from(other).value === this.hexValue; | ||
}; | ||
@@ -158,3 +160,3 @@ | ||
function createHex(input) { | ||
return new Hex(input); | ||
return Hex.from(input); | ||
} |
@@ -26,2 +26,6 @@ import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
function () { | ||
Hex.from = function from(input) { | ||
return new Hex(input); | ||
}; | ||
function Hex(inputValue) { | ||
@@ -42,30 +46,28 @@ _defineProperty(this, "input", void 0); | ||
this.hexValue = inputValue; | ||
} else if (typeof inputValue === 'string') { | ||
this.input = { | ||
type: 'string', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Array.isArray(inputValue)) { | ||
this.input = { | ||
type: 'bytesArray', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Buffer.isBuffer(inputValue)) { | ||
this.input = { | ||
type: 'buffer', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (typeof inputValue === 'object') { | ||
this.input = { | ||
type: 'object', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(JSON.stringify(inputValue)); | ||
} else { | ||
if (typeof inputValue === 'string') { | ||
this.input = { | ||
type: 'string', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Array.isArray(inputValue)) { | ||
this.input = { | ||
type: 'bytesArray', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (Buffer.isBuffer(inputValue)) { | ||
this.input = { | ||
type: 'buffer', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(inputValue); | ||
} else if (typeof inputValue === 'object') { | ||
this.input = { | ||
type: 'object', | ||
value: inputValue | ||
}; | ||
this.hexValue = toHexValue(JSON.stringify(inputValue)); | ||
} else { | ||
throw new Error('Invalid input'); | ||
} | ||
throw new Error('Invalid input'); | ||
} | ||
@@ -77,3 +79,3 @@ } | ||
_proto.equals = function equals(other) { | ||
return new Hex(other).value === this.hexValue; | ||
return Hex.from(other).value === this.hexValue; | ||
}; | ||
@@ -141,3 +143,3 @@ | ||
export function createHex(input) { | ||
return new Hex(input); | ||
return Hex.from(input); | ||
} |
{ | ||
"name": "@erebos/hex", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "Hex conversion utilities", | ||
@@ -27,4 +27,4 @@ "repository": "git@github.com:MainframeHQ/erebos.git", | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.4" | ||
"@babel/runtime": "^7.7.6" | ||
} | ||
} |
@@ -27,2 +27,3 @@ /// <reference types="node" /> | ||
export declare class Hex { | ||
static from(input: hexInput | Hex): Hex; | ||
protected input: HexInput; | ||
@@ -29,0 +30,0 @@ protected hexValue: hexValue; |
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
9350
280
Updated@babel/runtime@^7.7.6