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 1.0.0 to 1.0.1

2

lib/HtmlSerializer.js

@@ -37,3 +37,3 @@ var htmlStyles = {

HtmlSerializer.prototype.serialize = function (lines) {
return '<div style="font-family: monospace">\n' + this.serializeLines(lines) + '\n</div>';
return '<div style="font-family: monospace; white-space: nowrap">\n' + this.serializeLines(lines) + '\n</div>';
};

@@ -40,0 +40,0 @@

@@ -241,31 +241,4 @@ /*global window*/

function callculateLineSize(line) {
var size = { height: 1, width: 0 };
line.forEach(function (outputEntry) {
switch (outputEntry.style) {
case 'text':
size.width += String(outputEntry.args[0]).length;
break;
case 'block':
var blockSize = calculateSize(outputEntry.args[0]);
size.width += blockSize.width;
size.height = Math.max(blockSize.height, size.height);
break;
}
});
return size;
}
function calculateSize(lines) {
var size = { height: 0, width: 0 };
lines.forEach(function (line) {
var lineSize = callculateLineSize(line);
size.height += lineSize.height;
size.width = Math.max(size.width, lineSize.width);
});
return size;
}
MagicPen.prototype.size = function () {
return calculateSize(this.output);
return utils.calculateSize(this.output);
};

@@ -272,0 +245,0 @@

@@ -1,2 +0,2 @@

module.exports = {
var utils = {
extend: function (target) {

@@ -10,3 +10,32 @@ var sources = Array.prototype.slice.call(arguments, 1);

return target;
},
calculateLineSize: function (line) {
var size = { height: 1, width: 0 };
line.forEach(function (outputEntry) {
switch (outputEntry.style) {
case 'text':
size.width += String(outputEntry.args[0]).length;
break;
case 'block':
var blockSize = utils.calculateSize(outputEntry.args[0]);
size.width += blockSize.width;
size.height = Math.max(blockSize.height, size.height);
break;
}
});
return size;
},
calculateSize: function (lines) {
var size = { height: 0, width: 0 };
lines.forEach(function (line) {
var lineSize = utils.calculateLineSize(line);
size.height += lineSize.height;
size.width = Math.max(size.width, lineSize.width);
});
return size;
}
};
module.exports = utils;

@@ -190,3 +190,3 @@ /*!

HtmlSerializer.prototype.serialize = function (lines) {
return '<div style="font-family: monospace">\n' + this.serializeLines(lines) + '\n</div>';
return '<div style="font-family: monospace; white-space: nowrap">\n' + this.serializeLines(lines) + '\n</div>';
};

@@ -486,31 +486,4 @@

function callculateLineSize(line) {
var size = { height: 1, width: 0 };
line.forEach(function (outputEntry) {
switch (outputEntry.style) {
case 'text':
size.width += String(outputEntry.args[0]).length;
break;
case 'block':
var blockSize = calculateSize(outputEntry.args[0]);
size.width += blockSize.width;
size.height = Math.max(blockSize.height, size.height);
break;
}
});
return size;
}
function calculateSize(lines) {
var size = { height: 0, width: 0 };
lines.forEach(function (line) {
var lineSize = callculateLineSize(line);
size.height += lineSize.height;
size.width = Math.max(size.width, lineSize.width);
});
return size;
}
MagicPen.prototype.size = function () {
return calculateSize(this.output);
return utils.calculateSize(this.output);
};

@@ -599,3 +572,3 @@

},{}],6:[function(require,module,exports){
module.exports = {
var utils = {
extend: function (target) {

@@ -609,5 +582,34 @@ var sources = Array.prototype.slice.call(arguments, 1);

return target;
},
calculateLineSize: function (line) {
var size = { height: 1, width: 0 };
line.forEach(function (outputEntry) {
switch (outputEntry.style) {
case 'text':
size.width += String(outputEntry.args[0]).length;
break;
case 'block':
var blockSize = utils.calculateSize(outputEntry.args[0]);
size.width += blockSize.width;
size.height = Math.max(blockSize.height, size.height);
break;
}
});
return size;
},
calculateSize: function (lines) {
var size = { height: 0, width: 0 };
lines.forEach(function (line) {
var lineSize = utils.calculateLineSize(line);
size.height += lineSize.height;
size.width = Math.max(size.width, lineSize.width);
});
return size;
}
};
module.exports = utils;
},{}],7:[function(require,module,exports){

@@ -614,0 +616,0 @@ 'use strict';

{
"name": "magicpen",
"version": "1.0.0",
"version": "1.0.1",
"description": "Styled output in both consoles and browsers",

@@ -5,0 +5,0 @@ "main": "./lib/MagicPen.js",

@@ -359,3 +359,3 @@ /*global describe, it, beforeEach*/

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div>&gt;&lt;</div>\n' +

@@ -369,3 +369,3 @@ '</div>'

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">Hello</span>' +

@@ -381,3 +381,3 @@ '&nbsp;' +

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">Hello</span></div>\n' +

@@ -391,3 +391,3 @@ ' <div><span style="color: green">world</span></div>\n' +

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">Hello</span></div>\n' +

@@ -405,3 +405,3 @@ ' <div><span style="color: red">world</span></div>\n' +

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">Hello</span></div>\n' +

@@ -416,3 +416,3 @@ ' <div>&nbsp;&nbsp;beautiful</div>\n' +

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">&lt;foo&nbsp;&amp;&nbsp;&quot;bar&quot;&gt;</span></div>\n' +

@@ -429,3 +429,3 @@ '</div>');

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">Danger</span>&nbsp;<span style="color: red">danger</span></div>\n' +

@@ -440,3 +440,3 @@ '</div>');

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div>Hello&nbsp;<span style="color: red">world!</span></div>\n' +

@@ -454,3 +454,3 @@ '</div>');

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: gray">&nbsp;//&nbsp;</span>First&nbsp;line</div>\n' +

@@ -469,4 +469,4 @@ ' <div><span style="color: gray">&nbsp;//&nbsp;</span>Second&nbsp;line</div>\n' +

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
' <div><span style="color: red">Hello</span><div style="display: inline-block; vertical-align: top"><div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red">Hello</span><div style="display: inline-block; vertical-align: top"><div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: gray">&nbsp;//&nbsp;</span>This&nbsp;is&nbsp;a</div>\n' +

@@ -486,3 +486,3 @@ ' <div><span style="color: gray">&nbsp;//&nbsp;</span>&nbsp;&nbsp;multiline&nbsp;comment</div>\n' +

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: #bada55">Hello&nbsp;world</span></div>\n' +

@@ -495,3 +495,3 @@ '</div>');

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="background-color: #333">Hello&nbsp;world</span></div>\n' +

@@ -504,3 +504,3 @@ '</div>');

expect(pen.removeFormatting().toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div>Hello&nbsp;world</div>\n' +

@@ -587,3 +587,3 @@ '</div>');

expect(pen.toString('html'), 'to equal',
'<div style="font-family: monospace">\n' +
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div>' +

@@ -733,3 +733,3 @@ '<span style="color: gray">H</span>' +

writeFibWithPen(pen);
expect(pen.toString('html'), 'to equal', '<div style="font-family: monospace">\n' +
expect(pen.toString('html'), 'to equal', '<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: black; font-weight: bold">function</span>&nbsp;<span style="color: red; font-weight: bold">fib</span>&nbsp;{</div>\n' +

@@ -736,0 +736,0 @@ ' <div>&nbsp;&nbsp;<span style="color: black; font-weight: bold">var</span>&nbsp;i=0,&nbsp;fibs&nbsp;=&nbsp;[<span style="color: cyan">0</span>,&nbsp;<span style="color: cyan">1</span>];</div>\n' +

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