Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

magicpen

Package Overview
Dependencies
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magicpen - npm Package Compare versions

Comparing version 4.8.1 to 4.8.2

11

lib/MagicPen.js

@@ -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);

16

magicpen.js

@@ -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];

2

package.json
{
"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>&nbsp;&nbsp;<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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc