TERMINAL: Fix original alias syntax (#545)

This commit is contained in:
Snarling
2023-05-29 06:54:16 -04:00
committed by omuretsu
parent 7f852373d8
commit 5f2a1c3f27
11 changed files with 48 additions and 23 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
import { Settings } from "../Settings/Settings";
import { isString } from "./helpers/isString";
import { isString } from "./helpers/string";
/*
Converts a date representing time in milliseconds to a string with the format H hours M minutes and S seconds
-7
View File
@@ -1,7 +0,0 @@
/**
* Checks whether the value passed in can be considered a string.
* @param value The value to check if it is a string.
*/
export function isString(value: unknown): value is string {
return typeof value === "string" || value instanceof String;
}
+17
View File
@@ -0,0 +1,17 @@
// We can probably get rid of isString in favor of just checking typeof value==="string".
// We are not and should not ever be using `new String()` for anything. Will remove in 2.3.1
/**
* Checks whether the value passed in can be considered a string.
* @param value The value to check if it is a string.
*/
export function isString(value: unknown): value is string {
return typeof value === "string" || value instanceof String;
}
/** Removes a single layer of matching single or double quotes, if present. */
export function trimQuotes(value: string): string {
if (value.length < 2) return value;
if (value.at(0) !== value.at(-1)) return value;
if (value.at(0) !== "'" && value.at(0) !== '"') return value;
return value.substring(1, value.length - 1);
}