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

svg-sprite

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-sprite - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

example.js

26

lib/svg-sprite.js

@@ -25,3 +25,4 @@ 'use strict';

winston = require('winston'),
pretty = require('prettysize');
pretty = require('prettysize'),
util = require('util');

@@ -81,2 +82,3 @@ /**

* @return {SVGSpriter} Self reference
* @throws {Error} In case an invalid file should be added
*/

@@ -92,18 +94,28 @@ SVGSpriter.prototype.add = function(file, name, svg) {

// Argument validation
var error = null;
if (arguments.length < 3) {
this.error('SVGSpriter.add: You must provide 3 arguments');
error = 'SVGSpriter.add: You must provide 3 arguments';
}
if (!file.length) {
this.error('SVGSpriter.add: "%s" is not a valid absolute file name', file);
error = util.format('SVGSpriter.add: "%s" is not a valid absolute file name', file);
}
if (!name.length) {
this.error('SVGSpriter.add: "%s" is not a valid relative file name', name);
error = util.format('SVGSpriter.add: "%s" is not a valid relative file name', name);
}
if (!svg.length) {
this.error('SVGSpriter.add: You must provide SVG contents');
error = 'SVGSpriter.add: You must provide SVG contents';
}
if (file.substr(-name.length) != name) {
this.error('SVGSpriter.add: "%s" is not the local part of "%s"', name, file);
error = util.format('SVGSpriter.add: "%s" is not the local part of "%s"', name, file);
}
// In case of an error: Throw it!
if (error) {
var e = new Error(error);
e.name = 'ArgumentError';
e.errno = 1419945903;
this.error(error, e);
throw e;
}
// Instanciate a vinyl file

@@ -348,3 +360,3 @@ file = new File({

this.info('Created ' + _.pairs(exts).map(function(ext){
return ext[1] + ' × ' + ext[0].substr(1);
return ext[1] + ' x ' + ext[0].substr(1);
}).join(', '));

@@ -351,0 +363,0 @@

@@ -550,3 +550,3 @@ 'use strict';

// Ensure the shape has been complmented before
// Ensure the shape has been complemented before
if (!this.svg.ready) {

@@ -553,0 +553,0 @@ var error = new Error('Shape namespace cannot be set before complementing');

{
"name": "svg-sprite",
"version": "1.0.1",
"version": "1.0.2",
"author": {

@@ -5,0 +5,0 @@ "name": "Joschi Kuphal",

@@ -910,2 +910,5 @@ svg-sprite [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url]

#### v1.0.2 Maintenance release
* Improved error handling
#### v1.0.1 Maintenance release

@@ -912,0 +915,0 @@ * Updated module depencencies

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