🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@rainbowatcher/js-utils

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rainbowatcher/js-utils - npm Package Compare versions

Comparing version
0.0.5
to
0.0.6
+44
-37
dist/index.cjs
'use strict';
function isEmpty$1(arrayLike) {
return arrayLike ? arrayLike.length === 0 : true;
}
function isNotEmpty$1(arrayLike) {
return !isEmpty$1(arrayLike);
}
const lists = {
__proto__: null,
isEmpty: isEmpty$1,
isNotEmpty: isNotEmpty$1
};
function isUndefined(obj) {
return typeof obj === "undefined";
}
const isAsyncFunction = (fn) => {
function isAsyncFunction(fn) {
if (!fn)
return false;
return Object.getPrototypeOf(fn)[Symbol.toStringTag] === "AsyncFunction";
};
}
exports.Strings = void 0;
((Strings2) => {
Strings2.isString = (obj) => typeof obj === "string";
function isEmpty(str, trim = false) {
if (isUndefined(str))
return true;
if (!(0, Strings2.isString)(str))
throw new TypeError("Strings.isEmpty accepts only string type parameters");
return trim ? str.trim().length === 0 : str.length === 0;
}
Strings2.isEmpty = isEmpty;
function isNotEmpty(str, trim = false) {
return !isEmpty(str, trim);
}
Strings2.isNotEmpty = isNotEmpty;
function toUpperCase(str) {
if (isUndefined(str))
return void 0;
if (!(0, Strings2.isString)(str))
throw new TypeError("Strings.toUpperCase accepts only string type parameters");
return str?.toUpperCase();
}
Strings2.toUpperCase = toUpperCase;
})(exports.Strings || (exports.Strings = {}));
function isString(obj) {
return typeof obj === "string";
}
function isEmpty(str, trim = false) {
if (isUndefined(str))
return true;
if (!isString(str))
throw new TypeError("Strings.isEmpty accepts only string type parameters");
return trim ? str.trim().length === 0 : str.length === 0;
}
function isNotEmpty(str, trim = false) {
return !isEmpty(str, trim);
}
function toUpperCase(str) {
if (isUndefined(str))
return void 0;
if (!isString(str))
throw new TypeError("Strings.toUpperCase accepts only string type parameters");
return str?.toUpperCase();
}
exports.Lists = void 0;
((Lists2) => {
function isEmpty(arrayLike) {
return arrayLike ? arrayLike.length === 0 : true;
}
Lists2.isEmpty = isEmpty;
function isNotEmpty(arrayLike) {
return !isEmpty(arrayLike);
}
Lists2.isNotEmpty = isNotEmpty;
})(exports.Lists || (exports.Lists = {}));
const str = {
__proto__: null,
isEmpty: isEmpty,
isNotEmpty: isNotEmpty,
isString: isString,
toUpperCase: toUpperCase
};
exports.Lists = lists;
exports.Strings = str;
exports.isAsyncFunction = isAsyncFunction;
exports.isUndefined = isUndefined;

@@ -1,25 +0,41 @@

declare namespace Strings {
const isString: (obj: any) => boolean;
/**
* checks if a string is empty or not
* @param str input string
* @param trim trim white space in string
* @returns true for empty false for not
*/
function isEmpty(str: string | undefined, trim?: boolean): boolean;
function isNotEmpty(str: string | undefined, trim?: boolean): boolean;
/**
* Takes a parameter str that can either be a string or undefined type and returns the parameter str in upper case letters
*/
function toUpperCase(str: string | undefined): string | undefined;
declare function isEmpty$1<T>(arrayLike: ArrayLike<T> | undefined): boolean;
declare function isNotEmpty$1<T>(arrayLike: ArrayLike<T> | undefined): boolean;
declare namespace lists {
export {
isEmpty$1 as isEmpty,
isNotEmpty$1 as isNotEmpty,
};
}
declare function isUndefined(obj: any): boolean;
declare const isAsyncFunction: (fn: Function | undefined) => boolean;
declare function isString(obj: any): boolean;
/**
* checks if a string is empty or not
* @param str input string
* @param trim trim white space in string
* @returns true for empty false for not
*/
declare function isEmpty(str: string | undefined, trim?: boolean): boolean;
declare function isNotEmpty(str: string | undefined, trim?: boolean): boolean;
/**
* Takes a parameter str that can either be a string or undefined type and returns the parameter str in upper case letters
*/
declare function toUpperCase(str: string | undefined): string | undefined;
declare namespace Lists {
function isEmpty<T>(arrayLike: ArrayLike<T> | undefined): boolean;
function isNotEmpty<T>(arrayLike: ArrayLike<T> | undefined): boolean;
declare const str_isEmpty: typeof isEmpty;
declare const str_isNotEmpty: typeof isNotEmpty;
declare const str_isString: typeof isString;
declare const str_toUpperCase: typeof toUpperCase;
declare namespace str {
export {
str_isEmpty as isEmpty,
str_isNotEmpty as isNotEmpty,
str_isString as isString,
str_toUpperCase as toUpperCase,
};
}
export { Lists, Strings, isAsyncFunction, isUndefined };
declare function isUndefined(obj: any): boolean;
declare function isAsyncFunction(fn: Function | undefined): boolean;
export { lists as Lists, str as Strings, isAsyncFunction, isUndefined };

@@ -0,47 +1,52 @@

function isEmpty$1(arrayLike) {
return arrayLike ? arrayLike.length === 0 : true;
}
function isNotEmpty$1(arrayLike) {
return !isEmpty$1(arrayLike);
}
const lists = {
__proto__: null,
isEmpty: isEmpty$1,
isNotEmpty: isNotEmpty$1
};
function isUndefined(obj) {
return typeof obj === "undefined";
}
const isAsyncFunction = (fn) => {
function isAsyncFunction(fn) {
if (!fn)
return false;
return Object.getPrototypeOf(fn)[Symbol.toStringTag] === "AsyncFunction";
};
}
var Strings;
((Strings2) => {
Strings2.isString = (obj) => typeof obj === "string";
function isEmpty(str, trim = false) {
if (isUndefined(str))
return true;
if (!(0, Strings2.isString)(str))
throw new TypeError("Strings.isEmpty accepts only string type parameters");
return trim ? str.trim().length === 0 : str.length === 0;
}
Strings2.isEmpty = isEmpty;
function isNotEmpty(str, trim = false) {
return !isEmpty(str, trim);
}
Strings2.isNotEmpty = isNotEmpty;
function toUpperCase(str) {
if (isUndefined(str))
return void 0;
if (!(0, Strings2.isString)(str))
throw new TypeError("Strings.toUpperCase accepts only string type parameters");
return str?.toUpperCase();
}
Strings2.toUpperCase = toUpperCase;
})(Strings || (Strings = {}));
function isString(obj) {
return typeof obj === "string";
}
function isEmpty(str, trim = false) {
if (isUndefined(str))
return true;
if (!isString(str))
throw new TypeError("Strings.isEmpty accepts only string type parameters");
return trim ? str.trim().length === 0 : str.length === 0;
}
function isNotEmpty(str, trim = false) {
return !isEmpty(str, trim);
}
function toUpperCase(str) {
if (isUndefined(str))
return void 0;
if (!isString(str))
throw new TypeError("Strings.toUpperCase accepts only string type parameters");
return str?.toUpperCase();
}
var Lists;
((Lists2) => {
function isEmpty(arrayLike) {
return arrayLike ? arrayLike.length === 0 : true;
}
Lists2.isEmpty = isEmpty;
function isNotEmpty(arrayLike) {
return !isEmpty(arrayLike);
}
Lists2.isNotEmpty = isNotEmpty;
})(Lists || (Lists = {}));
const str = {
__proto__: null,
isEmpty: isEmpty,
isNotEmpty: isNotEmpty,
isString: isString,
toUpperCase: toUpperCase
};
export { Lists, Strings, isAsyncFunction, isUndefined };
export { lists as Lists, str as Strings, isAsyncFunction, isUndefined };
{
"name": "@rainbowatcher/js-utils",
"version": "0.0.5",
"version": "0.0.6",
"description": "Opinionated collection of common JavaScript / TypeScript utils by @rainbowatcher",

@@ -34,13 +34,13 @@ "author": "rainbowatcher <rainbow-w@qq.com>",

"devDependencies": {
"@antfu/eslint-config-ts": "^0.36.0",
"@antfu/eslint-config-ts": "^0.39.3",
"@commitlint/types": "^17.4.4",
"changelogen": "^0.5.0",
"commitlint": "^17.4.4",
"eslint": "^8.34.0",
"lint-staged": "^13.1.2",
"changelogen": "^0.5.3",
"commitlint": "^17.6.3",
"eslint": "^8.41.0",
"lint-staged": "^13.2.2",
"simple-git-hooks": "^2.8.1",
"typescript": "^4.9.5",
"unbuild": "^1.1.1",
"vite": "^4.1.1",
"vitest": "^0.29.0"
"typescript": "^5.0.4",
"unbuild": "^1.2.1",
"vite": "^4.3.9",
"vitest": "^0.31.1"
},

@@ -47,0 +47,0 @@ "simple-git-hooks": {