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

mini-svg-data-uri

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-svg-data-uri - npm Package Compare versions

Comparing version 1.0.3 to 1.1.3

10

index.js

@@ -1,3 +0,3 @@

const shorterNames = require('./shorter-css-color-names');
const REGEX = {
var shorterNames = require('./shorter-css-color-names');
var REGEX = {
whitespace: /\s+/g,

@@ -20,3 +20,3 @@ urlHexPairs: /%[\dA-F]{2}/g,

function colorCodeToShorterNames(string) {
Object.keys(shorterNames).forEach(function(key, i) {
Object.keys(shorterNames).forEach(function(key) {
if (shorterNames[key].test(string)) {

@@ -52,2 +52,6 @@ string = string.replace(shorterNames[key], key);

svgToTinyDataUri.toSrcset = function toSrcset(svgString) {
return svgToTinyDataUri(svgString).replace(/ /g, '%20');
}
module.exports = svgToTinyDataUri;
{
"name": "mini-svg-data-uri",
"version": "1.0.3",
"version": "1.1.3",
"description": "Small, efficient encoding of SVG data URIs for CSS, HTML, etc.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -58,2 +58,12 @@ Mini SVG `data:` URI

* The default output **does not work inside `srcset` attributes**. Use the `.toSrcset` method for that:
```js
var srcsetExample = html`
<picture>
<source srcset="${svgToMiniDataURI.toSrcset(svg)}">
<img src="${svgToMiniDataURI(svg)}">
</picture>`;
```
* The resulting Data URI should be wrapped with double quotes: `url("…")`, `<img src="…">`, etc.

@@ -60,0 +70,0 @@

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