Socket
Socket
Sign inDemoInstall

abstract-image

Package Overview
Dependencies
Maintainers
12
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-image - npm Package Compare versions

Comparing version 3.2.5 to 3.2.6

12

lib/exporters/react-svg-export-image.js

@@ -24,2 +24,3 @@ "use strict";

const R = __importStar(require("ramda"));
const B64 = __importStar(require("base64-js"));
const React = __importStar(require("react"));

@@ -76,7 +77,10 @@ const AbstractImage = __importStar(require("../model/index"));

case "svg":
const svg = Buffer.from(component.data
.reduce((a, b) => a + String.fromCharCode(b), "")
.replace('<?xml version="1.0" encoding="utf-8"?>', "")).toString("base64");
const svg = String.fromCharCode(...component.data).replace('<?xml version="1.0" encoding="utf-8"?>', "");
const bytes = [];
for (let i = 0; i < svg.length; ++i) {
bytes.push(svg.charCodeAt(i));
}
const base64 = B64.fromByteArray(new Uint8Array(bytes));
return [
React.createElement("image", { key: key, x: component.topLeft.x, y: component.topLeft.y, width: component.bottomRight.x - component.topLeft.x, height: component.bottomRight.y - component.topLeft.y, id: makeIdAttr(component.id), href: `data:image/svg+xml;base64,${svg}` }),
React.createElement("image", { key: key, x: component.topLeft.x, y: component.topLeft.y, width: component.bottomRight.x - component.topLeft.x, height: component.bottomRight.y - component.topLeft.y, id: makeIdAttr(component.id), href: `data:image/svg+xml;base64,${base64}` }),
];

@@ -83,0 +87,0 @@ default:

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSVG = void 0;
const B64 = __importStar(require("base64-js"));
function createSVG(image, pixelWidth, pixelHeight) {

@@ -23,5 +43,8 @@ const imageElements = image.components.map((c) => abstractComponentToSVG(c));

case "svg":
const svg = Buffer.from(component.data
.reduce((a, b) => a + String.fromCharCode(b), "")
.replace('<?xml version="1.0" encoding="utf-8"?>', "")).toString("base64");
const svg = String.fromCharCode(...component.data).replace('<?xml version="1.0" encoding="utf-8"?>', "");
const bytes = [];
for (let i = 0; i < svg.length; ++i) {
bytes.push(svg.charCodeAt(i));
}
const base64 = B64.fromByteArray(new Uint8Array(bytes));
return createElement("image", {

@@ -32,3 +55,3 @@ x: component.topLeft.x.toString(),

height: (component.bottomRight.y - component.topLeft.y).toString(),
href: `data:image/svg+xml;base64,${svg}`,
href: `data:image/svg+xml;base64,${base64}`,
}, []);

@@ -35,0 +58,0 @@ default:

{
"name": "abstract-image",
"version": "3.2.5",
"version": "3.2.6",
"description": "Dynamically create images using code or JSX and render to any format",

@@ -18,2 +18,3 @@ "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-image",

"dependencies": {
"base64-js": "^1.2.0",
"react": "^16.12.0",

@@ -23,6 +24,7 @@ "react-dom": "^16.12.0"

"devDependencies": {
"@types/base64-js": "^1.2.5",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0"
},
"gitHead": "d3aedc5af38a03a20d7ea6a311271d7993db37bc"
"gitHead": "7084fbe526a3e55123d4c152dfe358a080b95f00"
}

@@ -0,1 +1,2 @@

import * as B64 from "base64-js";
import * as AbstractImage from "../model/index";

@@ -31,7 +32,8 @@

case "svg":
const svg = Buffer.from(
component.data
.reduce((a, b) => a + String.fromCharCode(b), "")
.replace('<?xml version="1.0" encoding="utf-8"?>', "")
).toString("base64");
const svg = String.fromCharCode(...component.data).replace('<?xml version="1.0" encoding="utf-8"?>', "");
const bytes = [];
for (let i = 0; i < svg.length; ++i) {
bytes.push(svg.charCodeAt(i));
}
const base64 = B64.fromByteArray(new Uint8Array(bytes));
return createElement(

@@ -44,3 +46,3 @@ "image",

height: (component.bottomRight.y - component.topLeft.y).toString(),
href: `data:image/svg+xml;base64,${svg}`,
href: `data:image/svg+xml;base64,${base64}`,
},

@@ -47,0 +49,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

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