Comparing version 1.1.0 to 1.1.1
@@ -5,2 +5,3 @@ "use strict"; | ||
var utils_1 = require("./utils"); | ||
var error_1 = require("./error"); | ||
var decodeDC = function (value) { | ||
@@ -26,4 +27,3 @@ var intR = value >> 16; | ||
if (blurhash.length < 6) { | ||
console.error("too short blurhash"); | ||
return null; | ||
throw new error_1.ValidationError("The blurhash string must be at least 6 characters"); | ||
} | ||
@@ -36,3 +36,3 @@ var sizeFlag = base83_1.decode83(blurhash[0]); | ||
if (blurhash.length !== 4 + 2 * numX * numY) { | ||
console.error("blurhash length mismatch", blurhash.length, 4 + 2 * numX * numY); | ||
throw new error_1.ValidationError("blurhash length mismatch: length is " + blurhash.length + " but it should be " + (4 + 2 * numX * numY)); | ||
return null; | ||
@@ -39,0 +39,0 @@ } |
@@ -5,2 +5,3 @@ "use strict"; | ||
var utils_1 = require("./utils"); | ||
var error_1 = require("./error"); | ||
var bytesPerPixel = 4; | ||
@@ -40,6 +41,6 @@ var multiplyBasisFunction = function (pixels, width, height, basisFunction) { | ||
if (componentX < 1 || componentX > 9 || componentY < 1 || componentY > 9) { | ||
throw new Error("BlurHash must have between 1 and 9 components"); | ||
throw new error_1.ValidationError("BlurHash must have between 1 and 9 components"); | ||
} | ||
if (width * height * 4 !== pixels.length) { | ||
throw new Error("Width and height must match the pixels array"); | ||
throw new error_1.ValidationError("Width and height must match the pixels array"); | ||
} | ||
@@ -46,0 +47,0 @@ var factors = []; |
export { default as decode } from "./decode"; | ||
export { default as encode } from "./encode"; | ||
export * from "./error"; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -7,2 +10,3 @@ var decode_1 = require("./decode"); | ||
exports.encode = encode_1.default; | ||
__export(require("./error")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "blurhash", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Encoder and decoder for the Wolt BlurHash algorithm.", | ||
"main": "dist/index.js", | ||
"types": "dist/index.t.js", | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
@@ -13,2 +13,3 @@ "type": "git", | ||
"scripts": { | ||
"prepublishOnly": "npm run build", | ||
"build": "npm run ts", | ||
@@ -15,0 +16,0 @@ "demo": "webpack-dev-server --mode development", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23948
23
366
1