🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@rg-dev/stdlib

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rg-dev/stdlib - npm Package Compare versions

Comparing version
1.0.23
to
1.0.24
+3
-6
lib/common-env.cjs

@@ -99,4 +99,3 @@ var __defProp = Object.defineProperty;

orElseThrow(msg) {
if (this.value === void 0)
throw new Error(msg || "Value is empty");
if (this.value === void 0) throw new Error(msg || "Value is empty");
return this.value;

@@ -112,4 +111,3 @@ }

ifPresent(action) {
if (this.value === void 0)
return;
if (this.value === void 0) return;
try {

@@ -154,4 +152,3 @@ action(this.value);

var _a;
if (!safe)
return;
if (!safe) return;
try {

@@ -158,0 +155,0 @@ const result = safe();

@@ -64,4 +64,3 @@ // src/promise-retry.ts

orElseThrow(msg) {
if (this.value === void 0)
throw new Error(msg || "Value is empty");
if (this.value === void 0) throw new Error(msg || "Value is empty");
return this.value;

@@ -77,4 +76,3 @@ }

ifPresent(action) {
if (this.value === void 0)
return;
if (this.value === void 0) return;
try {

@@ -119,4 +117,3 @@ action(this.value);

var _a;
if (!safe)
return;
if (!safe) return;
try {

@@ -123,0 +120,0 @@ const result = safe();

@@ -222,4 +222,3 @@ var __create = Object.create;

emit(data, event) {
if (!this.isOpen)
return;
if (!this.isOpen) return;
try {

@@ -290,4 +289,3 @@ let payload = "";

const { value, done } = await reader.read();
if (done)
break;
if (done) break;
buffer += decoder.decode(value, { stream: true });

@@ -298,4 +296,3 @@ let lines = buffer.split("\n");

line = line.trim();
if (!line)
continue;
if (!line) continue;
if (line.startsWith("event:")) {

@@ -345,9 +342,6 @@ eventName = line.slice(6).trim();

async function checkIfDirExistsOrThrow(path2) {
if (!path2)
throw "path is empty";
if (!path2) throw "path is empty";
path2 = removeQuotes(path2);
if (!await fs.pathExists(path2))
throw new Error(`path ${path2} not exists`);
if (!(await fs.stat(path2)).isDirectory())
throw new Error(`${path2} is a file, require dir`);
if (!await fs.pathExists(path2)) throw new Error(`path ${path2} not exists`);
if (!(await fs.stat(path2)).isDirectory()) throw new Error(`${path2} is a file, require dir`);
}

@@ -364,7 +358,5 @@ function createTempDir() {

async function throwIfDirNotEmpty(dir_path) {
if (!await fs.pathExists(dir_path))
throw new Error("dir not exists");
if (!await fs.pathExists(dir_path)) throw new Error("dir not exists");
const isEmpty = await fs.readdir(dir_path).then((x) => x.length === 0);
if (!isEmpty)
throw new Error(`dir ${dir_path} must be empty`);
if (!isEmpty) throw new Error(`dir ${dir_path} must be empty`);
}

@@ -379,9 +371,6 @@ async function checkCommandExistsOrThrow(cmd) {

async function checkIfFileExistsOrThrow(the_path) {
if (!the_path)
throw "path is empty";
if (!the_path) throw "path is empty";
the_path = removeQuotes(the_path);
if (!await fs.pathExists(the_path))
throw new Error(`path ${the_path} not exists`);
if (!(await fs.stat(the_path)).isFile())
throw new Error(`${the_path} is a dir, require file`);
if (!await fs.pathExists(the_path)) throw new Error(`path ${the_path} not exists`);
if (!(await fs.stat(the_path)).isFile()) throw new Error(`${the_path} is a dir, require file`);
}

@@ -388,0 +377,0 @@ function removeQuotes(str) {

@@ -10,4 +10,3 @@ var __create = Object.create;

}) : x)(function(x) {
if (typeof require !== "undefined")
return require.apply(this, arguments);
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');

@@ -212,4 +211,3 @@ });

emit(data, event) {
if (!this.isOpen)
return;
if (!this.isOpen) return;
try {

@@ -280,4 +278,3 @@ let payload = "";

const { value, done } = await reader.read();
if (done)
break;
if (done) break;
buffer += decoder.decode(value, { stream: true });

@@ -288,4 +285,3 @@ let lines = buffer.split("\n");

line = line.trim();
if (!line)
continue;
if (!line) continue;
if (line.startsWith("event:")) {

@@ -335,9 +331,6 @@ eventName = line.slice(6).trim();

async function checkIfDirExistsOrThrow(path2) {
if (!path2)
throw "path is empty";
if (!path2) throw "path is empty";
path2 = removeQuotes(path2);
if (!await fs.pathExists(path2))
throw new Error(`path ${path2} not exists`);
if (!(await fs.stat(path2)).isDirectory())
throw new Error(`${path2} is a file, require dir`);
if (!await fs.pathExists(path2)) throw new Error(`path ${path2} not exists`);
if (!(await fs.stat(path2)).isDirectory()) throw new Error(`${path2} is a file, require dir`);
}

@@ -354,7 +347,5 @@ function createTempDir() {

async function throwIfDirNotEmpty(dir_path) {
if (!await fs.pathExists(dir_path))
throw new Error("dir not exists");
if (!await fs.pathExists(dir_path)) throw new Error("dir not exists");
const isEmpty = await fs.readdir(dir_path).then((x) => x.length === 0);
if (!isEmpty)
throw new Error(`dir ${dir_path} must be empty`);
if (!isEmpty) throw new Error(`dir ${dir_path} must be empty`);
}

@@ -369,9 +360,6 @@ async function checkCommandExistsOrThrow(cmd) {

async function checkIfFileExistsOrThrow(the_path) {
if (!the_path)
throw "path is empty";
if (!the_path) throw "path is empty";
the_path = removeQuotes(the_path);
if (!await fs.pathExists(the_path))
throw new Error(`path ${the_path} not exists`);
if (!(await fs.stat(the_path)).isFile())
throw new Error(`${the_path} is a dir, require file`);
if (!await fs.pathExists(the_path)) throw new Error(`path ${the_path} not exists`);
if (!(await fs.stat(the_path)).isFile()) throw new Error(`${the_path} is a dir, require file`);
}

@@ -378,0 +366,0 @@ function removeQuotes(str) {

{
"name": "@rg-dev/stdlib",
"version": "1.0.23",
"version": "1.0.24",
"description": "",

@@ -60,5 +60,5 @@ "scripts": {

"node-fetch": "^3.3.2",
"tsup": "^8.0.1",
"typescript": "^4.9.5"
"tsup": "^8.5.0",
"typescript": "^5.9.2"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display