Socket
Socket
Sign inDemoInstall

custom-fonts-in-emails

Package Overview
Dependencies
82
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.5 to 2.0.6

.travis.yml

22

index.js
const fs = require('fs');
const path = require('path');
const pkgDir = require('pkg-dir');
const $ = require('cheerio');

@@ -9,5 +8,7 @@ const Lipo = require('lipo');

const _ = require('lodash');
const debug = require('debug')('custom-fonts-in-emails');
const isSANB = require('is-string-and-not-blank');
const levenshtein = require('fast-levenshtein');
const osFonts = require('os-fonts');
const pkgDir = require('pkg-dir');

@@ -18,2 +19,4 @@ const useTypes = ['user', 'local', 'network', 'system'];

const cache = {};
let defaults = {

@@ -188,2 +191,9 @@ text: '',

options = setOptions(options);
const hash = safeStringify(options);
if (cache[hash]) {
debug(`found cache result for ${hash}`);
return cache[hash];
}
const textToSvg = TextToSvg.loadSync(options.fontPath);

@@ -201,3 +211,5 @@ const str = textToSvg.getSVG(options.text, options.textToSvg);

$svg = applyAttributes($svg, options.attrs);
return $.html($svg);
const result = $.html($svg);
cache[hash] = result;
return result;
} catch (err) {

@@ -211,2 +223,3 @@ throw err;

options = setOptions(options);
const str = svg(options);

@@ -377,3 +390,3 @@ const $svg = $(str);

const nodeModuleFonts = osFonts.getFontsInDirectorySync(
path.join(pkgDir.sync(__dirname), 'node_modules')
path.join(pkgDir.sync(), 'node_modules')
);

@@ -416,3 +429,4 @@ for (let i = 0; i < nodeModuleFonts.length; i++) {

getAvailableFontPaths,
getAvailableFontNames
getAvailableFontNames,
cache
};

4

package.json
{
"name": "custom-fonts-in-emails",
"description": "An extremely easy way to use custom fonts in emails without having to use art software. Made for Lad.",
"version": "2.0.5",
"version": "2.0.6",
"author": "Nick Baugh <niftylettuce@gmail.com>",

@@ -17,3 +17,5 @@ "bugs": "https://github.com/ladjs/custom-fonts-in-emails/issues",

"cheerio": "^1.0.0-rc.2",
"debug": "^4.1.1",
"fast-levenshtein": "^2.0.6",
"fast-safe-stringify": "^2.0.7",
"is-string-and-not-blank": "^0.0.2",

@@ -20,0 +22,0 @@ "lipo": "^0.0.10",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc