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

figlet

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

figlet - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

fonts/BlurVision ASCII.flf

36

lib/figlet.js

@@ -1232,9 +1232,15 @@ /*

*/
me.loadFont(fontName, function (err, fontOpts) {
if (err) {
next(err);
return;
}
return new Promise(function(resolve, reject) {
me.loadFont(fontName, function (err, fontOpts) {
if (err) {
if (next) next(err);
reject(err);
return;
}
next(null, fontOpts, figFonts[fontName].comment);
if (next) {
next(null, fontOpts, figFonts[fontName].comment);
}
resolve([fontOpts, figFonts[fontName].comment]);
});
});

@@ -1399,4 +1405,6 @@ };

if (figFonts[fontName]) {
next(null, figFonts[fontName].options);
return;
if (next) {
next(null, figFonts[fontName].options);
}
return Promise.resolve();
}

@@ -1411,3 +1419,3 @@

fetch(figDefaults.fontPath + "/" + fontName + ".flf")
return fetch(figDefaults.fontPath + "/" + fontName + ".flf")
.then(function (response) {

@@ -1422,3 +1430,5 @@ if (response.ok) {

.then(function (text) {
next(null, me.parseFont(fontName, text));
if (next) {
next(null, me.parseFont(fontName, text));
}
})

@@ -1448,3 +1458,3 @@ .catch(next);

fonts
return fonts
.reduce(function (promise, name) {

@@ -1468,5 +1478,3 @@ return promise.then(function () {

if (next) {
next();
}
if (next) next();
});

@@ -1473,0 +1481,0 @@ };

@@ -18,23 +18,31 @@ /*

figlet.loadFont = function (name, next) {
if (figlet.figFonts[name]) {
next(null, figlet.figFonts[name].options);
return;
}
return new Promise(function(resolve, reject) {
if (figlet.figFonts[name]) {
next && next(null, figlet.figFonts[name].options);
resolve(figlet.figFonts[name].options);
return;
}
fs.readFile(
path.join(fontDir, name + ".flf"),
{ encoding: "utf-8" },
function (err, fontData) {
if (err) {
return next(err);
}
fs.readFile(
path.join(fontDir, name + ".flf"),
{ encoding: "utf-8" },
function (err, fontData) {
if (err) {
next && next(err);
reject(err);
return;
}
fontData = fontData + "";
try {
next(null, figlet.parseFont(name, fontData));
} catch (error) {
next(error);
fontData = fontData + "";
try {
var font = figlet.parseFont(name, fontData);
next && next(null, font);
resolve(font);
} catch (error) {
next && next(error);
reject(error);
}
}
}
);
);
});
};

@@ -65,16 +73,21 @@

figlet.fonts = function (next) {
var fontList = [];
fs.readdir(fontDir, function (err, files) {
// '/' denotes the root folder
if (err) {
return next(err);
}
return new Promise(function(resolve, reject) {
var fontList = [];
fs.readdir(fontDir, function (err, files) {
// '/' denotes the root folder
if (err) {
next && next(err);
reject(err);
return;
}
files.forEach(function (file) {
if (/\.flf$/.test(file)) {
fontList.push(file.replace(/\.flf$/, ""));
}
files.forEach(function (file) {
if (/\.flf$/.test(file)) {
fontList.push(file.replace(/\.flf$/, ""));
}
});
next && next(null, fontList);
resolve(fontList);
});
next(null, fontList);
});

@@ -81,0 +94,0 @@ };

{
"name": "figlet",
"version": "1.7.0",
"version": "1.8.0",
"description": "Creates ASCII Art from text. A full implementation of the FIGfont spec.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -57,3 +57,4 @@ ```

- Options - Either a string indicating the font name or an options object (description below).
- Callback - A function to execute with the generated ASCII Art.
- Callback - Optional function to execute with the generated ASCII Art.
- Return value is a promise that resolves to generated ASCII Art.

@@ -97,2 +98,23 @@ Example:

Similary you can use Promise API:
```js
try {
console.log(
await figlet.text("Boo!", {
font: "Ghost",
horizontalLayout: "default",
verticalLayout: "default",
width: 80,
whitespaceBreak: true,
})
);
} catch (err) {
console.log("Something went wrong...");
console.dir(err);
}
```
This will print the same output.
### textSync

@@ -215,2 +237,15 @@

The function also return a promise that return an array with two values:
```js
try {
const [options, headerComment] = await figlet.metadata("Standard");
console.dir(options);
console.log(headerComment);
} catch (err) {
console.log("something went wrong...");
console.dir(err);
}
```
### fonts

@@ -231,2 +266,4 @@

`fonts` is Node.js only.
### fontsSync

@@ -240,2 +277,4 @@

same as `fonts`, `fontsSync` is Node.js only.
### parseFont

@@ -387,2 +426,3 @@

<td align="center" valign="top" width="14.28%"><a href="https://github.com/timhudson"><img src="https://avatars.githubusercontent.com/u/122594?v=4?s=100" width="100px;" alt="Tim Hudson"/><br /><sub><b>Tim Hudson</b></sub></a><br /><a href="#code-timhudson" title="Code">๐Ÿ’ป</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Lev-Shapiro"><img src="https://avatars.githubusercontent.com/u/96536068?v=4?s=100" width="100px;" alt="Lev-Shapiro"/><br /><sub><b>Lev-Shapiro</b></sub></a><br /><a href="#code-Lev-Shapiro" title="Code">๐Ÿ’ป</a> <a href="#example-Lev-Shapiro" title="Examples">๐Ÿ’ก</a></td>
</tr>

@@ -399,2 +439,4 @@ </tbody>

- 2024.10.08 v1.8.0 Added support for promises for loadFont, preloadedFonts, and metadata methods. 5 fonts added: DiamFont, RubiFont, CosMike2, BlurVision ASCII, and Shaded Blocky.
- 2023.10.01 v1.7.0 Added support for promises for text method.
- 2023.04.08 v1.6.0 Added npx support (ex: npx figlet test).

@@ -401,0 +443,0 @@ - 2021.08.11 v1.5.2 Minor bug fixes.

Sorry, the diff of this file is not supported yet

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