Socket
Socket
Sign inDemoInstall

@blaze-react/utils

Package Overview
Dependencies
Maintainers
5
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blaze-react/utils - npm Package Compare versions

Comparing version 0.3.9 to 0.3.28

lib/ErrorMessage.js

2

lib/index.js

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

var react_1 = __importDefault(require("react"));
var ErrorMessage_1 = __importDefault(require("./ErrorMessage"));
var uniqueId_1 = __importDefault(require("./uniqueId"));

@@ -24,2 +25,3 @@ exports["default"] = (function (ChildComponent) {

var utils = {
ErrorMessage: ErrorMessage_1["default"],
classNames: classnames_1["default"],

@@ -26,0 +28,0 @@ uniqueId: uniqueId_1["default"]

38

lib/uniqueId.js
"use strict";
exports.__esModule = true;
var generateKey = function (element) {
var key = unescape(encodeURIComponent(JSON.stringify(element)));
try {
return btoa(key);
var UniqueId = /** @class */ (function () {
function UniqueId() {
var _this = this;
this.uniqueId = function (element) {
var key = "uid-" + _this.generateKey(element);
var allKeys = Object.keys(_this.keys);
if (allKeys.includes(key)) {
key = key + "_" + allKeys.length;
}
_this.keys[key] = key;
return key;
};
this.keys = {};
}
catch (_a) {
return Buffer.from(key).toString("base64");
}
};
var uniqueId = function (element) {
var keys = {};
var key = "uid-" + generateKey(element);
keys[key] = key;
return key;
};
exports["default"] = uniqueId;
UniqueId.prototype.generateKey = function (element) {
var key = unescape(encodeURIComponent(JSON.stringify(element)));
return typeof btoa === "function"
? btoa(key)
: Buffer.from(key).toString("base64");
};
return UniqueId;
}());
var uniqId = new UniqueId();
exports["default"] = uniqId.uniqueId;
{
"name": "@blaze-react/utils",
"version": "0.3.9",
"version": "0.3.28",
"publishConfig": {

@@ -36,3 +36,3 @@ "access": "public"

},
"gitHead": "b2b459a9b55fa739b5f1d27f87a027d259ba3a9b"
"gitHead": "5decb509b9bad29eb110ac7dfb35b09df1dc71bb"
}

@@ -1,18 +0,31 @@

const generateKey = (element: any): string => {
const key = unescape(encodeURIComponent(JSON.stringify(element)));
class UniqueId {
private keys: object;
try {
return btoa(key);
} catch {
return Buffer.from(key).toString("base64");
constructor() {
this.keys = {};
}
};
const uniqueId = (element: any) => {
const keys = {};
const key = `uid-${generateKey(element)}`;
keys[key] = key;
return key;
};
public uniqueId = (element: any): string => {
let key: string = `uid-${this.generateKey(element)}`;
export default uniqueId;
const allKeys: string[] = Object.keys(this.keys);
if (allKeys.includes(key)) {
key = `${key}_${allKeys.length}`;
}
this.keys[key] = key;
return key;
};
private generateKey(element: any): string {
const key: string = unescape(encodeURIComponent(JSON.stringify(element)));
return typeof btoa === "function"
? btoa(key)
: Buffer.from(key).toString("base64");
}
}
const uniqId = new UniqueId();
export default uniqId.uniqueId;

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