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

ts-commons

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-commons - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

4

dist/utils/string.utils.d.ts

@@ -91,3 +91,7 @@ export declare class StringUtils {

static subString(str: string, start: number, end?: number): string;
static startWith(str: string, prefix: string): boolean;
static startWithIgnoreCase(str: string, prefix: string): boolean;
static endWith(str: string, suffix: string): boolean;
static endWithIgnoreCase(str: string, suffix: string): boolean;
static isWhitespace(ch: string): boolean;
}

@@ -251,2 +251,32 @@ "use strict";

};
StringUtils.startWith = function (str, prefix) {
if (!object_utils_1.ObjectUtils.isString(str) || !object_utils_1.ObjectUtils.isString(prefix)) {
return false;
}
// return str.indexOf(prefix) === 0;
// according to https://leonax.net/p/5806/use-string-startswith-and-endswith-in-javascript/
return str.slice(0, prefix.length) === prefix;
};
StringUtils.startWithIgnoreCase = function (str, prefix) {
if (!object_utils_1.ObjectUtils.isString(str) || !object_utils_1.ObjectUtils.isString(prefix)) {
return false;
}
var useStr = str.toLocaleLowerCase();
var usePrefix = prefix.toLocaleLowerCase();
return useStr.slice(0, usePrefix.length) === usePrefix;
};
StringUtils.endWith = function (str, suffix) {
if (!object_utils_1.ObjectUtils.isString(str) || !object_utils_1.ObjectUtils.isString(suffix)) {
return false;
}
return str.indexOf(suffix, str.length - suffix.length) !== -1;
};
StringUtils.endWithIgnoreCase = function (str, suffix) {
if (!object_utils_1.ObjectUtils.isString(str) || !object_utils_1.ObjectUtils.isString(suffix)) {
return false;
}
var useStr = str.toLocaleLowerCase();
var useSuffix = suffix.toLocaleLowerCase();
return useStr.indexOf(useSuffix, useStr.length - useSuffix.length) !== -1;
};
StringUtils.isWhitespace = function (ch) {

@@ -253,0 +283,0 @@ return " \f\n\r\t\v\u00A0\u2028\u2029".indexOf(ch) > -1;

2

package.json
{
"name": "ts-commons",
"version": "0.0.12",
"version": "0.0.13",
"description": "common methods for typescript",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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