imagemagick-stream
Advanced tools
Comparing version 4.0.1 to 4.1.0
20
index.js
@@ -160,2 +160,14 @@ "use strict"; | ||
/** | ||
* Sets the `annotate` option | ||
* | ||
* @param {String} args | ||
* @api public | ||
*/ | ||
annotate (degrees, text) { | ||
this[operators].push('-annotate', degrees, text); | ||
return this; | ||
} | ||
/** | ||
* Passes additional settings | ||
@@ -170,3 +182,5 @@ * | ||
this[settings].push(`-${key}`); | ||
if (val != null) this[settings].push(val); | ||
if (val == null) return this; | ||
if (!Array.isArray(val)) val = [val]; | ||
val.forEach(v => this[settings].push(v)); | ||
return this; | ||
@@ -185,3 +199,5 @@ } | ||
this[operators].push(`-${key}`); | ||
if (val != null) this[operators].push(val); | ||
if (val == null) return this; | ||
if (!Array.isArray(val)) val = [val]; | ||
val.forEach(v => this[operators].push(v)); | ||
return this; | ||
@@ -188,0 +204,0 @@ } |
{ | ||
"name": "imagemagick-stream", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Streaming Imagemagick api", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -169,2 +169,13 @@ var assert = require('assert'); | ||
describe('.annotate()', function () { | ||
it('should set the annotate option', function () { | ||
var img = im().annotate('0', "'text'"); | ||
var args = img.args(); | ||
assert(args.length == 5); | ||
assert(args[1] == '-annotate'); | ||
assert(args[2] == '0'); | ||
assert(args[3] == "'text'"); | ||
}); | ||
}); | ||
describe('.inputFormat()', function () { | ||
@@ -198,2 +209,12 @@ it('should set the input format', function () { | ||
}); | ||
it('should accept a key and an array', function () { | ||
var img = im(); | ||
img.op('annotate', ['0', "'text'"]); | ||
var args = img.args(); | ||
assert(args[1] == '-annotate'); | ||
assert(args[2] == '0'); | ||
assert(args[3] == "'text'"); | ||
}); | ||
}); | ||
@@ -216,2 +237,12 @@ | ||
it('should accept a key and an array', function () { | ||
var img = im(); | ||
img.set('something', ['hello', 'world']); | ||
var args = img.args(); | ||
assert(args[0] == '-something'); | ||
assert(args[1] == 'hello'); | ||
assert(args[2] == 'world'); | ||
}); | ||
it('should be combinable with freehand operations', function() { | ||
@@ -218,0 +249,0 @@ var img = im(); |
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
44326
461