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

@morui/shared-utils

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morui/shared-utils - npm Package Compare versions

Comparing version 2.0.5 to 2.0.8

dist/chunk-7XVYWEVW.mjs

1

dist/index.d.ts

@@ -10,2 +10,3 @@ export { Dict, __DEV__, __TEST__, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isFunction, isNumeric, isObject } from './assertion.js';

export { Timer } from './types.js';
export { FILE_EXTENSION, HEX_REGEXP, IPFS_PREFIX, URL_PREFIX, buildExternalAssetFilePath, getEnvValue, getExternalAssetFilePath, parseEnvJson, regexp, replaceQuotes } from './env.js';
import 'react';

@@ -23,5 +23,10 @@ "use strict";

__export(src_exports, {
FILE_EXTENSION: () => FILE_EXTENSION,
HEX_REGEXP: () => HEX_REGEXP,
IPFS_PREFIX: () => IPFS_PREFIX,
URL_PREFIX: () => URL_PREFIX,
__DEV__: () => __DEV__,
__TEST__: () => __TEST__,
arrayToObject: () => arrayToObject,
buildExternalAssetFilePath: () => buildExternalAssetFilePath,
callAll: () => callAll,

@@ -38,2 +43,4 @@ callAllHandlers: () => callAllHandlers,

extractProperty: () => extractProperty,
getEnvValue: () => getEnvValue,
getExternalAssetFilePath: () => getExternalAssetFilePath,
getKeyValue: () => getKeyValue,

@@ -51,5 +58,8 @@ getMargin: () => getMargin,

omitObject: () => omitObject,
parseEnvJson: () => parseEnvJson,
range: () => range,
regexp: () => regexp,
removeEvents: () => removeEvents,
renameProp: () => renameProp,
replaceQuotes: () => replaceQuotes,
safeAriaLabel: () => safeAriaLabel,

@@ -296,7 +306,63 @@ safeText: () => safeText,

}
// src/env.ts
function isBrowser() {
return typeof window !== "undefined";
}
var URL_PREFIX = /^https?:\/\//i;
var IPFS_PREFIX = /^ipfs:\/\//i;
var HEX_REGEXP = /^(?:0x)?[\da-fA-F]+$/;
var FILE_EXTENSION = /\.([\da-z]+)$/i;
var regexp = {
URL_PREFIX,
IPFS_PREFIX,
HEX_REGEXP,
FILE_EXTENSION
};
var replaceQuotes = (value) => value == null ? void 0 : value.replaceAll("'", '"');
var getEnvValue = (envName) => {
const envs = isBrowser() ? window.__envs : process.env;
if (isBrowser() && (envs == null ? void 0 : envs.NEXT_PUBLIC_APP_INSTANCE) === "pw") {
const storageValue = localStorage.getItem(envName);
if (typeof storageValue === "string") {
return storageValue;
}
}
return replaceQuotes(envs == null ? void 0 : envs[envName]);
};
var parseEnvJson = (env) => {
try {
return JSON.parse(env || "null");
} catch (error) {
return null;
}
};
var getExternalAssetFilePath = (envName) => {
const parsedValue = getEnvValue(envName);
if (!parsedValue) {
return;
}
return buildExternalAssetFilePath(envName, parsedValue);
};
var buildExternalAssetFilePath = (name, value) => {
var _a;
try {
const fileName = name.replace(/^NEXT_PUBLIC_/, "").replace(/_URL$/, "").toLowerCase();
const url = new URL(value);
const fileExtension = (_a = url.pathname.match(regexp.FILE_EXTENSION)) == null ? void 0 : _a[1];
return `/assets/${fileName}.${fileExtension}`;
} catch (error) {
return;
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FILE_EXTENSION,
HEX_REGEXP,
IPFS_PREFIX,
URL_PREFIX,
__DEV__,
__TEST__,
arrayToObject,
buildExternalAssetFilePath,
callAll,

@@ -313,2 +379,4 @@ callAllHandlers,

extractProperty,
getEnvValue,
getExternalAssetFilePath,
getKeyValue,

@@ -326,5 +394,8 @@ getMargin,

omitObject,
parseEnvJson,
range,
regexp,
removeEvents,
renameProp,
replaceQuotes,
safeAriaLabel,

@@ -331,0 +402,0 @@ safeText,

2

package.json
{
"name": "@morui/shared-utils",
"version": "2.0.5",
"version": "2.0.8",
"description": "A set of MorUI utilities",

@@ -5,0 +5,0 @@ "keywords": [

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