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

simplesvg

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplesvg - npm Package Compare versions

Comparing version 0.0.10 to 0.1.0

dist/simplesvg.js

31

index.js

@@ -18,12 +18,3 @@ module.exports = svg;

var attributes = Object.keys(attrBag);
for (var i = 0; i < attributes.length; ++i) {
var attributeName = attributes[i];
var value = attrBag[attributeName];
if (attributeName === 'link') {
svgElement.link(value);
} else {
svgElement.attr(attributeName, value);
}
}
svgElement.attr(attrBag);

@@ -92,4 +83,22 @@ return svgElement;

}
if (typeof name === 'string') {
// someone wants to get value of an attribute:
return svgElement.getAttributeNS(null, name);
}
return svgElement.getAttributeNS(null, name);
if (typeof name !== 'object') throw new Error('attr() expects to have either string or object as first argument');
var attrBag = name;
var attributes = Object.keys(attrBag);
for (var i = 0; i < attributes.length; ++i) {
var attributeName = attributes[i];
var value = attrBag[attributeName];
if (attributeName === 'link') {
svgElement.link(value);
} else {
svgElement.attr(attributeName, value);
}
}
return svgElement;
}

@@ -96,0 +105,0 @@

{
"name": "simplesvg",
"version": "0.0.10",
"version": "0.1.0",
"description": "A very simple svg wrapper, inspired by original vivagraph",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "browserify -s sivg ./index.js > dist/simplesvg.js && uglifyjs dist/simplesvg.js > dist/simplesvg.min.js"
},

@@ -9,0 +10,0 @@ "keywords": [

@@ -5,2 +5,20 @@ # simplesvg

# usage
This API is still not very stable. But here is quick example:
``` js
var svg = require('simplesvg');
var circle = svg('circle', {
r: 21,
cx: 42,
cy: 42,
stroke: '#000',
fill: 'deepskyblue'
});
// `circle` is a regular DOM element, you can append it to parent:
document.getElementById('scene').appendChild(circle);
```
# install

@@ -7,0 +25,0 @@

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