svgicons2svgfont
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "svgicons2svgfont", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Read a set of SVG icons and ouput a SVG font", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/nfroidure/svgicons2svgfont", |
@@ -131,3 +131,3 @@ # svgicons2svgfont | ||
Type: `Function` | ||
Default value: `false` | ||
Default value: `console.log` | ||
@@ -139,3 +139,3 @@ Allows you to provide your own logging function. Set to `function(){}` to | ||
Type: `Function` | ||
Default value: `false` | ||
Default value: `console.error` | ||
@@ -142,0 +142,0 @@ Allows you to provide your own error logging function. Set to `function(){}` to |
var fs = require('fs'); | ||
var util = require("util"); | ||
var path = require("path"); | ||
var util = require('util'); | ||
var path = require('path'); | ||
@@ -11,5 +11,5 @@ var Readable = require('stream').Readable; | ||
// Constructor | ||
function SVGIconsDirStream(dir) { | ||
function SVGIconsDirStream(dir, options) { | ||
var getMetadata = require('../src/metadata')(options); | ||
var _this = this; | ||
var code = 0xE001; | ||
var files; | ||
@@ -34,8 +34,5 @@ | ||
file = files.shift(); | ||
matches = path.basename(file).match(/^(?:u([0-9a-f]{4})\-)?(.*).svg$/i); | ||
svgIconStream = fs.createReadStream(file); | ||
svgIconStream.metadata = { | ||
unicode: String.fromCharCode(matches[1] ? parseInt(matches[1], 16) : code++), | ||
name: matches[2] | ||
}; | ||
var metadata = getMetadata(file); | ||
svgIconStream.metadata = metadata; | ||
if(!_this.push(svgIconStream)) { | ||
@@ -42,0 +39,0 @@ return; |
@@ -399,6 +399,3 @@ /* | ||
delete glyph.running; | ||
(glyph.unicode instanceof Array ? | ||
glyph.unicode : | ||
[glyph.unicode] | ||
).forEach(function(unicode, i){ | ||
glyph.unicode.forEach(function(unicode, i){ | ||
_this.push('\ | ||
@@ -405,0 +402,0 @@ <glyph glyph-name="' + glyph.name + (i == 0 ? '' : '-' + i) + '"\n\ |
@@ -11,3 +11,3 @@ var svgicons2svgfont = require(__dirname + '/../src/index.js'); | ||
' -o ' + __dirname + '/results/originalicons-cli.svg' + | ||
'-- ' + __dirname + '/fixtures/originalicons/*.svg ', | ||
' ' + __dirname + '/fixtures/originalicons/*.svg ', | ||
function(err) { | ||
@@ -14,0 +14,0 @@ if(err) { |
@@ -346,2 +346,15 @@ var assert = require('assert'); | ||
it("should fail when providing unicode value with duplicates", function(done) { | ||
var svgIconStream = fs.createReadStream(__dirname + '/fixtures/cleanicons/account.svg'); | ||
svgIconStream.metadata = { | ||
name: 'test', | ||
unicode: ['\uE002','\uE002'] | ||
}; | ||
SVGIcons2SVGFontStream().on('error', function(err) { | ||
assert.equal(err instanceof Error, true); | ||
assert.equal(err.message, 'Given codepoints for the glyph "test" contain duplicates.'); | ||
done(); | ||
}).write(svgIconStream); | ||
}); | ||
it("should fail when providing the same codepoint twice", function(done) { | ||
@@ -348,0 +361,0 @@ var svgIconStream = fs.createReadStream(__dirname + '/fixtures/cleanicons/account.svg'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
282318
107
1378
12