Comparing version 4.8.1 to 4.8.2
@@ -293,2 +293,13 @@ /*global window*/ | ||
var pen = that.clone(); | ||
var originalRaw = pen.raw; | ||
pen.raw = function (arg) { | ||
if (typeof arg !== 'object') { | ||
var content = arg; | ||
arg = { | ||
fallback: '' | ||
}; | ||
arg[mode] = content; | ||
} | ||
return originalRaw.call(this, arg); | ||
}; | ||
args.unshift(pen); | ||
@@ -295,0 +306,0 @@ var result = outputMethod.apply(pen, args); |
@@ -621,2 +621,13 @@ /*! | ||
var pen = that.clone(); | ||
var originalRaw = pen.raw; | ||
pen.raw = function (arg) { | ||
if (typeof arg !== 'object') { | ||
var content = arg; | ||
arg = { | ||
fallback: '' | ||
}; | ||
arg[mode] = content; | ||
} | ||
return originalRaw.call(this, arg); | ||
}; | ||
args.unshift(pen); | ||
@@ -1360,2 +1371,3 @@ var result = outputMethod.apply(pen, args); | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
@@ -1760,7 +1772,7 @@ function noop() {} | ||
type = type || 'closest'; | ||
for (var idx1 in a){ | ||
for (var idx1 = 0; idx1 < a.length; idx1 += 1){ | ||
var color1 = a[idx1]; | ||
var best_color = undefined; | ||
var best_color_diff = undefined; | ||
for (var idx2 in b) | ||
for (var idx2 = 0; idx2 < b.length; idx2 += 1) | ||
{ | ||
@@ -1767,0 +1779,0 @@ var color2 = b[idx2]; |
{ | ||
"name": "magicpen", | ||
"version": "4.8.1", | ||
"version": "4.8.2", | ||
"description": "Styled output in both consoles and browsers", | ||
@@ -5,0 +5,0 @@ "main": "./lib/MagicPen.js", |
@@ -500,2 +500,21 @@ # MagicPen | ||
If you're already in raw mode, you can add more raw output by passing the | ||
content directly to the `raw` method: | ||
```javascript | ||
pen.raw({ | ||
html: function () { | ||
this.text('Hello'); | ||
this.raw('<canvas id="whoa"></canvas>').nl(); | ||
this.indentLines() | ||
this.i().block(function () { | ||
this.raw(function () { | ||
return 'it even works in blocks'; | ||
}); | ||
}); | ||
}, | ||
fallback: 'foo' | ||
}); | ||
``` | ||
### isBlock() | ||
@@ -502,0 +521,0 @@ |
@@ -677,2 +677,37 @@ /*global describe, it, beforeEach*/ | ||
}); | ||
it('should support fallback-less .raw within an existing raw context', function () { | ||
pen.raw({ | ||
html: function () { | ||
this.text('Hello'); | ||
this.raw('<canvas id="whoa"></canvas>'); | ||
this.raw({ | ||
html: '<canvas id="there"></canvas>', | ||
fallback: '' | ||
}).nl(); | ||
this.indentLines(); | ||
this.i().block(function () { | ||
this.raw(function () { | ||
return 'it even works in blocks'; | ||
}); | ||
}); | ||
}, | ||
fallback: 'foo' | ||
}); | ||
expect( | ||
pen.toString('html'), | ||
'to equal', | ||
'<div style="font-family: monospace; white-space: nowrap">\n' + | ||
' <div><div style="display: inline-block; vertical-align: top">\n' + | ||
' <div>Hello<canvas id="whoa"></canvas><canvas id="there"></canvas></div>\n' + | ||
' <div> <div style="display: inline-block; vertical-align: top">\n' + | ||
' <div>it even works in blocks</div>\n' + | ||
'</div></div>\n' + | ||
'</div></div>\n' + | ||
'</div>' | ||
); | ||
expect(pen.toString('text'), 'to equal', 'foo'); | ||
}); | ||
}); | ||
@@ -679,0 +714,0 @@ |
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
561040
3995
731