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

@dreygur/messenger-group-avatar

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dreygur/messenger-group-avatar - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

119

lib/cjs/index.js

@@ -83,12 +83,14 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var tempPath, processed, i, combined, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
var tempPath, processed, i, combined, _a, _b, _c, _d, i, _e, _f, _g, _h, i, j, e_1;
return __generator(this, function (_j) {
switch (_j.label) {
case 0:
_a.trys.push([0, 5, , 6]);
if (images.length < 3)
throw new Error('Must provide at least 3 images');
_j.trys.push([0, 15, , 16]);
if (images.length < 2)
throw new Error('Must provide at least 2 images');
if (images.length > 3)
images = images.splice(2);
tempPath = path_1.default.join(process.cwd(), 'temp');
processed = [];
for (i = 0; i < 3; i++) {
for (i = 0; i < images.length; i++) {
processed.push(path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-").concat(i, ".jpeg")));

@@ -98,30 +100,77 @@ }

fs_1.default.mkdirSync(tempPath);
// Resie the images
return [4 /*yield*/, resizeImage({ inImage: images[0], out: processed[0] })];
combined = path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
if (!(images.length < 3)) return [3 /*break*/, 6];
_a = images;
_b = [];
for (_c in _a)
_b.push(_c);
_d = 0;
_j.label = 1;
case 1:
// Resie the images
_a.sent();
return [4 /*yield*/, resizeImage({ inImage: images[1], width: 225, height: 225, out: processed[1] })];
if (!(_d < _b.length)) return [3 /*break*/, 4];
_c = _b[_d];
if (!(_c in _a)) return [3 /*break*/, 3];
i = _c;
return [4 /*yield*/, resizeImage({ inImage: images[parseInt(i)], out: processed[parseInt(i)] })];
case 2:
_a.sent();
return [4 /*yield*/, resizeImage({ inImage: images[2], width: 225, height: 225, out: processed[2] })];
_j.sent();
_j.label = 3;
case 3:
_a.sent();
combined = path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([
{
input: processed[1],
top: 0,
left: 225,
},
{
input: processed[2],
top: 225,
left: 225,
},
])
.toFile(combined)];
case 4:
_a.sent();
_d++;
return [3 /*break*/, 1];
case 4: return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([
{
input: processed[1],
top: 0,
left: 225,
}
])
.toFile(combined)];
case 5:
_j.sent();
return [3 /*break*/, 14];
case 6:
_e = images;
_f = [];
for (_g in _e)
_f.push(_g);
_h = 0;
_j.label = 7;
case 7:
if (!(_h < _f.length)) return [3 /*break*/, 12];
_g = _f[_h];
if (!(_g in _e)) return [3 /*break*/, 11];
i = _g;
j = parseInt(i);
if (!(j === 0)) return [3 /*break*/, 9];
return [4 /*yield*/, resizeImage({ inImage: images[i], out: processed[i] })];
case 8:
_j.sent();
return [3 /*break*/, 11];
case 9: return [4 /*yield*/, resizeImage({ inImage: images[j], width: 225, height: 225, out: processed[j] })];
case 10:
_j.sent();
_j.label = 11;
case 11:
_h++;
return [3 /*break*/, 7];
case 12: return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([
{
input: processed[1],
top: 0,
left: 225,
},
{
input: processed[2],
top: 225,
left: 225,
},
])
.toFile(combined)];
case 13:
_j.sent();
_j.label = 14;
case 14:
// Delete temporary files

@@ -135,6 +184,6 @@ try {

return [2 /*return*/, combined];
case 5:
e_1 = _a.sent();
case 15:
e_1 = _j.sent();
throw e_1;
case 6: return [2 /*return*/];
case 16: return [2 /*return*/];
}

@@ -141,0 +190,0 @@ });

@@ -83,12 +83,14 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var tempPath, processed, i, combined, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
var tempPath, processed, i, combined, _a, _b, _c, _d, i, _e, _f, _g, _h, i, j, e_1;
return __generator(this, function (_j) {
switch (_j.label) {
case 0:
_a.trys.push([0, 5, , 6]);
if (images.length < 3)
throw new Error('Must provide at least 3 images');
_j.trys.push([0, 15, , 16]);
if (images.length < 2)
throw new Error('Must provide at least 2 images');
if (images.length > 3)
images = images.splice(2);
tempPath = path_1.default.join(process.cwd(), 'temp');
processed = [];
for (i = 0; i < 3; i++) {
for (i = 0; i < images.length; i++) {
processed.push(path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-").concat(i, ".jpeg")));

@@ -98,30 +100,77 @@ }

fs_1.default.mkdirSync(tempPath);
// Resie the images
return [4 /*yield*/, resizeImage({ inImage: images[0], out: processed[0] })];
combined = path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
if (!(images.length < 3)) return [3 /*break*/, 6];
_a = images;
_b = [];
for (_c in _a)
_b.push(_c);
_d = 0;
_j.label = 1;
case 1:
// Resie the images
_a.sent();
return [4 /*yield*/, resizeImage({ inImage: images[1], width: 225, height: 225, out: processed[1] })];
if (!(_d < _b.length)) return [3 /*break*/, 4];
_c = _b[_d];
if (!(_c in _a)) return [3 /*break*/, 3];
i = _c;
return [4 /*yield*/, resizeImage({ inImage: images[parseInt(i)], out: processed[parseInt(i)] })];
case 2:
_a.sent();
return [4 /*yield*/, resizeImage({ inImage: images[2], width: 225, height: 225, out: processed[2] })];
_j.sent();
_j.label = 3;
case 3:
_a.sent();
combined = path_1.default.join(tempPath, "".concat(process.hrtime.bigint().toString(), "-combined.jpeg"));
return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([
{
input: processed[1],
top: 0,
left: 225,
},
{
input: processed[2],
top: 225,
left: 225,
},
])
.toFile(combined)];
case 4:
_a.sent();
_d++;
return [3 /*break*/, 1];
case 4: return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([
{
input: processed[1],
top: 0,
left: 225,
}
])
.toFile(combined)];
case 5:
_j.sent();
return [3 /*break*/, 14];
case 6:
_e = images;
_f = [];
for (_g in _e)
_f.push(_g);
_h = 0;
_j.label = 7;
case 7:
if (!(_h < _f.length)) return [3 /*break*/, 12];
_g = _f[_h];
if (!(_g in _e)) return [3 /*break*/, 11];
i = _g;
j = parseInt(i);
if (!(j === 0)) return [3 /*break*/, 9];
return [4 /*yield*/, resizeImage({ inImage: images[i], out: processed[i] })];
case 8:
_j.sent();
return [3 /*break*/, 11];
case 9: return [4 /*yield*/, resizeImage({ inImage: images[j], width: 225, height: 225, out: processed[j] })];
case 10:
_j.sent();
_j.label = 11;
case 11:
_h++;
return [3 /*break*/, 7];
case 12: return [4 /*yield*/, (0, sharp_1.default)(processed[0])
.composite([
{
input: processed[1],
top: 0,
left: 225,
},
{
input: processed[2],
top: 225,
left: 225,
},
])
.toFile(combined)];
case 13:
_j.sent();
_j.label = 14;
case 14:
// Delete temporary files

@@ -135,6 +184,6 @@ try {

return [2 /*return*/, combined];
case 5:
e_1 = _a.sent();
case 15:
e_1 = _j.sent();
throw e_1;
case 6: return [2 /*return*/];
case 16: return [2 /*return*/];
}

@@ -141,0 +190,0 @@ });

{
"name": "@dreygur/messenger-group-avatar",
"description": "Avatar generator that looks like messenger group chat default avatar",
"version": "0.0.6",
"version": "0.0.7",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "./lib/cjs/index.js",

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