mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-29 04:17:05 +02:00
TERMINAL: Fix original alias syntax (#545)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user