New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rsvg

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsvg - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

src/Autocrop.cc

13

index.js

@@ -65,3 +65,6 @@ 'use strict';

} catch (error) {
self.trigger('error', error);
if (error.message !== self.lastErrorMessage) {
self.lastErrorMessage = error.message;
self.emit('error', new Error('Rsvg close failure: ' + error.message));
}
return;

@@ -174,2 +177,3 @@ }

} catch (error) {
this.lastErrorMessage = error.message;
callback(new Error('Rsvg write failure: ' + error.message));

@@ -234,3 +238,8 @@ return;

Rsvg.prototype.autocrop = function() {
return this.handle.autocrop();
var area = this.handle.autocrop();
area.x = area.x.toFixed(3) * 1;
area.y = area.y.toFixed(3) * 1;
area.width = area.width.toFixed(3) * 1;
area.height = area.height.toFixed(3) * 1;
return area;
};

@@ -237,0 +246,0 @@

2

package.json
{
"name": "rsvg",
"version": "0.2.2",
"version": "0.2.3",
"description": "Parse SVG files and render them as PNG, PDF, SVG, or raw memory buffer images.",

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

@@ -11,3 +11,5 @@

[![Build Status](https://travis-ci.org/walling/node-rsvg.png?branch=master)](https://travis-ci.org/walling/node-rsvg)
## Basic Usage

@@ -14,0 +16,0 @@

@@ -91,2 +91,11 @@ 'use strict';

loadInvalidSVG.should.throw(/load failure/i);
// Regression test on 2014-01-16.
onerror = sinon.spy();
svg = new Rsvg();
svg.on('error', onerror);
svg.end('<svg width="100" height="100"></svg>invalid');
onerror.should.have.been.calledOnce;
onerror.lastCall.args.should.have.length(1);
onerror.lastCall.args[0].should.match(/write failure/);
});

@@ -102,2 +111,3 @@ });

new Rsvg('<svg width="314" height="1"/>').width.should.equal(314);
new Rsvg('<svg width="257" height="2"/>').width.should.equal(257);
});

@@ -109,2 +119,3 @@ });

new Rsvg('<svg width="1" height="413"/>').height.should.equal(413);
new Rsvg('<svg width="2" height="752"/>').height.should.equal(752);
});

@@ -114,8 +125,73 @@ });

describe('dimensions()', function() {
it('gives the size of the whole image');
it('gives the size and position of specific elements');
it('gives the size of the whole image', function() {
new Rsvg('<svg width="314" height="257"/>').dimensions().should.deep.equal({
x: 0,
y: 0,
width: 314,
height: 257
});
new Rsvg('<svg width="17" height="19"/>').dimensions().should.deep.equal({
x: 0,
y: 0,
width: 17,
height: 19
});
});
it('gives the size and position of specific elements', function() {
var svg = new Rsvg();
svg.write('<svg width="12" height="10">');
svg.write('<rect x="-2" y="3" width="7" height="5" id="r1"/>');
svg.write('<rect x="8" y="4" width="4" height="6" id="r2"/>');
svg.write('<circle cx="8" cy="3" r="3" id="circ"/>');
svg.write('</svg>');
svg.end();
svg.dimensions().should.deep.equal({
x: 0,
y: 0,
width: 12,
height: 10
});
svg.dimensions(null).should.deep.equal(svg.dimensions());
svg.dimensions('#r1').should.deep.equal({
x: -2,
y: 3,
width: 7,
height: 5
});
svg.dimensions('#r2').should.deep.equal({
x: 8,
y: 4,
width: 4,
height: 6
});
svg.dimensions('#circ').should.deep.equal({
x: 5,
y: 0,
width: 6,
height: 6
});
});
});
describe('hasElement()', function() {
it('determines whether an element with the given ID exists');
it('determines whether an element with the given ID exists', function() {
var svg = new Rsvg();
svg.write('<svg width="12" height="10">');
svg.write('<rect x="-2" y="3" width="7" height="5" id="r1"/>');
svg.write('<rect x="8" y="4" width="4" height="6" id="r2"/>');
svg.write('<circle cx="8" cy="3" r="3" id="circ"/>');
svg.write('</svg>');
svg.end();
svg.hasElement().should.be.false;
svg.hasElement(null).should.be.false;
svg.hasElement('#r1').should.be.true;
svg.hasElement('#r2').should.be.true;
svg.hasElement('#circ').should.be.true;
svg.hasElement('#foo').should.be.false;
svg.hasElement('r1').should.be.false;
});
});

@@ -122,0 +198,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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