Comparing version 0.2.1 to 0.3.0
@@ -15,9 +15,20 @@ 'use strict'; | ||
var _isBuffer = require('is-buffer'); | ||
var _isBuffer2 = _interopRequireDefault(_isBuffer); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const { loadImage } = _canvas2.default; | ||
const { loadImage, Image } = _canvas2.default; | ||
class DrawableImage { | ||
constructor(img, styles = {}) { | ||
this._img = img; | ||
// be able to set image buffer | ||
if ((0, _isBuffer2.default)(img)) { | ||
this._image = new Image(); | ||
this._image.src = img; | ||
this._dimensions = (0, _imageSize2.default)(img); | ||
} else { | ||
this._img = img; | ||
} | ||
this._styles = styles; | ||
@@ -28,3 +39,3 @@ } | ||
return loadImage(this._img).then(image => { | ||
this._dimensions = (0, _imageSize2.default)(this._img); | ||
this._dimensions = (0, _imageSize2.default)(image); | ||
this._image = image; | ||
@@ -31,0 +42,0 @@ }); |
{ | ||
"name": "drawable", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "A way to make styling canvas elements like text and images nicer", | ||
@@ -16,3 +16,4 @@ "main": "dist/index.js", | ||
"canvas": "2.0.0-alpha.4", | ||
"image-size": "^0.6.1" | ||
"image-size": "^0.6.1", | ||
"is-buffer": "^1.1.5" | ||
}, | ||
@@ -19,0 +20,0 @@ "devDependencies": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14325
237
0
3
+ Addedis-buffer@^1.1.5
+ Addedis-buffer@1.1.6(transitive)