🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@rauschma/helpers

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rauschma/helpers - npm Package Compare versions

Comparing version

to
0.4.0

dist/src/browser/dom.d.ts

2

dist/src/lang/regexp.js

@@ -44,3 +44,3 @@ const { raw } = String;

raw `\|`,
// Omitted – not allowed by /u
// Omitted – not currently allowed by /u
// raw`\-`, // inside character classes (square brackets)

@@ -47,0 +47,0 @@ ];

export declare function insertVariables(variables: Map<string, string>, pattern: string): string;
export declare function removePrefix(str: string, prefix: string): string;
export declare function removePrefixMaybe(str: string, prefix: string): string;
export declare function removeSuffix(str: string, suffix: string): string;
export declare function removeSuffixMaybe(str: string, suffix: string): string;
export declare function isEmptyLine(str: string): boolean;
//# sourceMappingURL=string.d.ts.map

@@ -26,2 +26,14 @@ import { assertTrue } from '../typescript/type.js';

}
export function removeSuffix(str, suffix) {
assertTrue(str.endsWith(suffix));
return str.slice(0, -suffix.length);
}
export function removeSuffixMaybe(str, suffix) {
if (str.endsWith(suffix)) {
return str.slice(0, -suffix.length);
}
else {
return str;
}
}
const RE_EMTPY_LINE = /^[\t \r\n]*$/u;

@@ -28,0 +40,0 @@ export function isEmptyLine(str) {

@@ -21,2 +21,3 @@ /**

export declare function assertTrue(value: boolean, message?: string): asserts value;
export declare function toNonNullable<T>(value: T, message?: string): NonNullable<T>;
export declare function assertNonNullable<T>(value: T, message?: string): asserts value is NonNullable<T>;

@@ -23,0 +24,0 @@ type TypeofLookupTable = {

@@ -29,2 +29,9 @@ //#################### Class ####################

}
export function toNonNullable(value, message) {
if (value === undefined || value === null) {
message ??= 'Value must not be undefined or null';
throw new TypeError('Failed: ' + message);
}
return value;
}
export function assertNonNullable(value, message) {

@@ -31,0 +38,0 @@ if (value === undefined || value === null) {

{
"name": "@rauschma/helpers",
"version": "0.3.0",
"version": "0.4.0",
"type": "module",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -46,3 +46,3 @@ const {raw} = String;

raw`\|`,
// Omitted – not allowed by /u
// Omitted – not currently allowed by /u
// raw`\-`, // inside character classes (square brackets)

@@ -49,0 +49,0 @@ ];

@@ -31,2 +31,14 @@ import { assertTrue } from '../typescript/type.js';

export function removeSuffix(str: string, suffix: string) {
assertTrue(str.endsWith(suffix));
return str.slice(0, -suffix.length);
}
export function removeSuffixMaybe(str: string, suffix: string) {
if (str.endsWith(suffix)) {
return str.slice(0, -suffix.length);
} else {
return str;
}
}
const RE_EMTPY_LINE = /^[\t \r\n]*$/u;

@@ -33,0 +45,0 @@ export function isEmptyLine(str: string): boolean {

@@ -48,2 +48,10 @@ //#################### Class ####################

export function toNonNullable<T>(value: T, message?: string): NonNullable<T> {
if (value === undefined || value === null) {
message ??= 'Value must not be undefined or null';
throw new TypeError('Failed: ' + message);
}
return value;
}
export function assertNonNullable<T>(value: T, message?: string): asserts value is NonNullable<T> {

@@ -50,0 +58,0 @@ if (value === undefined || value === null) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet