New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@riadh-adrani/str-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@riadh-adrani/str-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

32

dist/cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isString = exports.isNotEmpty = exports.isEmpty = exports.isNotBlank = exports.isBlank = exports.ellipsify = exports.capitalize = void 0;
/**
* Capitalize the first charater of the given string and return it as a new value.
*
* Does not override the given string
* @param str source
*/
const capitalize = (str) => {

@@ -14,8 +8,2 @@ return `${str.substring(0, 1).toUpperCase()}${str.substring(1)}`;

exports.capitalize = capitalize;
/**
* Reduce and append ellipsis to the given string when its length exceeds `max`.
* @param str source.
* @param max the maximum length allowed before reducing.
* @param ellipsis `optional` customize ellipsis.
*/
const ellipsify = (str, max, ellipsis = '...') => {

@@ -27,6 +15,2 @@ if (str.length <= max)

exports.ellipsify = ellipsify;
/**
* Checks if the given string is blank, which is the one having no characters after being trimmed.
* @param str source.
*/
const isBlank = (str) => {

@@ -36,12 +20,4 @@ return str.trim() === '';

exports.isBlank = isBlank;
/**
* Checks if the given string is not blank, which is the one having no characters after being trimmed.
* @param str source.
*/
const isNotBlank = (str) => !(0, exports.isBlank)(str);
exports.isNotBlank = isNotBlank;
/**
* Checks if the given string is empty.
* @param str source.
*/
const isEmpty = (str) => {

@@ -51,12 +27,4 @@ return str.length === 0;

exports.isEmpty = isEmpty;
/**
* Checks if the given string is not empty.
* @param str source.
*/
const isNotEmpty = (str) => !(0, exports.isEmpty)(str);
exports.isNotEmpty = isNotEmpty;
/**
* Checks if the given object is a string.
* @param obj object
*/
const isString = (obj) => {

@@ -63,0 +31,0 @@ return typeof obj === 'string';

@@ -1,16 +0,4 @@

/**
* Capitalize the first charater of the given string and return it as a new value.
*
* Does not override the given string
* @param str source
*/
export const capitalize = (str) => {
return `${str.substring(0, 1).toUpperCase()}${str.substring(1)}`;
};
/**
* Reduce and append ellipsis to the given string when its length exceeds `max`.
* @param str source.
* @param max the maximum length allowed before reducing.
* @param ellipsis `optional` customize ellipsis.
*/
export const ellipsify = (str, max, ellipsis = '...') => {

@@ -21,32 +9,12 @@ if (str.length <= max)

};
/**
* Checks if the given string is blank, which is the one having no characters after being trimmed.
* @param str source.
*/
export const isBlank = (str) => {
return str.trim() === '';
};
/**
* Checks if the given string is not blank, which is the one having no characters after being trimmed.
* @param str source.
*/
export const isNotBlank = (str) => !isBlank(str);
/**
* Checks if the given string is empty.
* @param str source.
*/
export const isEmpty = (str) => {
return str.length === 0;
};
/**
* Checks if the given string is not empty.
* @param str source.
*/
export const isNotEmpty = (str) => !isEmpty(str);
/**
* Checks if the given object is a string.
* @param obj object
*/
export const isString = (obj) => {
return typeof obj === 'string';
};

4

package.json

@@ -8,7 +8,7 @@ {

},
"version": "1.0.0",
"version": "1.0.1",
"type": "module",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"types": "dist/index.d.ts",
"exports": {

@@ -15,0 +15,0 @@ ".": {

@@ -1,2 +0,2 @@

# str-utils
# str-utils [![npm](https://img.shields.io/npm/v/@riadh-adrani/str-utils?str=blue)](https://www.npmjs.com/package/@riadh-adrani/str-utils) [![CI/CD](https://github.com/RiadhAdrani/str-utils/actions/workflows/actions.yml/badge.svg)](https://github.com/RiadhAdrani/str-utils/actions/workflows/actions.yml)

@@ -3,0 +3,0 @@ Javascript string utilities.

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