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.10.0 to 4.11.0

14

lib/MagicPen.js

@@ -280,6 +280,7 @@ /*global window*/

MagicPen.prototype.alt =
MagicPen.prototype.raw = function (options) {
var format = this.format;
if (!format) {
throw new Error('The raw method is only supported on pen where the format has already been set');
throw new Error('The alt method is only supported on pen where the format has already been set');
}

@@ -290,3 +291,3 @@

if (!outputProperty) {
throw new Error('Raw output is not specified for format: ' + format + ' and no fallback method is given');
throw new Error('Output is not specified for format: ' + format + ' and no fallback method is given');
}

@@ -305,4 +306,4 @@

var pen = this.clone();
var originalRaw = pen.raw;
pen.raw = function (arg) {
var originalAlt = pen.alt;
pen.raw = pen.alt = function (arg) {
if (isRawOutput(arg) || typeof arg !== 'object') {

@@ -313,3 +314,3 @@ var content = arg;

}
return originalRaw.call(this, arg);
return originalAlt.call(this, arg);
};

@@ -332,3 +333,4 @@ outputProperty.call(pen, pen);

throw new Error('Properties on a raw object must be a pen, a function that writes to a pen, a string or an object with the structure\n' +
throw new Error('Arguments for the alt method must be an object with properties of the form:\n' +
'a pen, a function that writes to a pen, a string or an object with the structure:\n' +
'{ width: <number>, height: <number>, content: <string function() {}|string> }');

@@ -335,0 +337,0 @@ };

@@ -620,6 +620,7 @@ /*!

MagicPen.prototype.alt =
MagicPen.prototype.raw = function (options) {
var format = this.format;
if (!format) {
throw new Error('The raw method is only supported on pen where the format has already been set');
throw new Error('The alt method is only supported on pen where the format has already been set');
}

@@ -630,3 +631,3 @@

if (!outputProperty) {
throw new Error('Raw output is not specified for format: ' + format + ' and no fallback method is given');
throw new Error('Output is not specified for format: ' + format + ' and no fallback method is given');
}

@@ -645,4 +646,4 @@

var pen = this.clone();
var originalRaw = pen.raw;
pen.raw = function (arg) {
var originalAlt = pen.alt;
pen.raw = pen.alt = function (arg) {
if (isRawOutput(arg) || typeof arg !== 'object') {

@@ -653,3 +654,3 @@ var content = arg;

}
return originalRaw.call(this, arg);
return originalAlt.call(this, arg);
};

@@ -672,3 +673,4 @@ outputProperty.call(pen, pen);

throw new Error('Properties on a raw object must be a pen, a function that writes to a pen, a string or an object with the structure\n' +
throw new Error('Arguments for the alt method must be an object with properties of the form:\n' +
'a pen, a function that writes to a pen, a string or an object with the structure:\n' +
'{ width: <number>, height: <number>, content: <string function() {}|string> }');

@@ -1359,2 +1361,3 @@ };

process.version = ''; // empty string to avoid regexp issues
process.versions = {};

@@ -1361,0 +1364,0 @@ function noop() {}

{
"name": "magicpen",
"version": "4.10.0",
"version": "4.11.0",
"description": "Styled output in both consoles and browsers",

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

@@ -465,3 +465,3 @@ # MagicPen

### raw(...)
### alt(...)

@@ -488,4 +488,4 @@ If you need something completely custom, you can specify the actual

If the format of the pen is not defined the fallback property will be used.
The fallback method can be specified the following way:
If the format of the pen is not defined the fallback property will be
used. The fallback method can be specified the following way:

@@ -539,10 +539,10 @@ * As string, that will just be appended to the pen without styling.

If you're already in raw mode, you can add more raw output by passing the
content directly to the `raw` method:
If you're already inside an alt method, you can add more alt output by passing the
content directly to the `alt` method:
```javascript
pen.raw({
pen.alt({
html: function () {
this.text('Hello');
this.raw({
this.alt({
height: 100,

@@ -554,3 +554,3 @@ width: 100,

this.i().block(function () {
this.raw(function () {
this.alt(function () {
this.text('it even works in blocks');

@@ -557,0 +557,0 @@ });

Sorry, the diff of this file is too big to display

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