mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
DOCUMENTATION: Add more information for deprecated nFormat API (#1762)
This commit is contained in:
@@ -1635,7 +1635,8 @@ export const ns: InternalAPI<NSFull> = {
|
||||
nFormat: (ctx) => (_n, _format) => {
|
||||
deprecationWarning(
|
||||
"ns.nFormat",
|
||||
"Use ns.formatNumber, formatRam, formatPercent, or js builtins like Intl.NumberFormat instead.",
|
||||
"Use ns.formatNumber, ns.formatRam, ns.formatPercent, or JS built-in objects/functions (e.g., Intl namespace) instead. " +
|
||||
"Check the NS API documentation for details.",
|
||||
);
|
||||
const n = helpers.number(ctx, "n", _n);
|
||||
const format = helpers.string(ctx, "format", _format);
|
||||
|
||||
14
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
14
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -7637,16 +7637,22 @@ export interface NS {
|
||||
formatPercent(n: number, fractionalDigits?: number, suffixStart?: number): string;
|
||||
|
||||
/**
|
||||
* Format a number using the numeral library. This function is deprecated and will be removed in 2.4.
|
||||
* @deprecated Use ns.formatNumber, formatRam, or formatPercent instead. Will be removed in 2.4.
|
||||
* Format a number using the numeral library. This function is deprecated and will be removed in a later version.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* Use alternatives:
|
||||
*
|
||||
* - NS APIs: ns.formatNumber, ns.formatRam, ns.formatPercent
|
||||
*
|
||||
* - JS built-in objects/functions: Intl.NumberFormat, Intl.PluralRules, Intl.Locale, etc.
|
||||
*
|
||||
* @remarks
|
||||
* RAM cost: 0 GB
|
||||
*
|
||||
* Converts a number into a string with the specified format options.
|
||||
* See http://numeraljs.com/#format for documentation on format strings supported.
|
||||
*
|
||||
* This function is deprecated and will be removed in 2.3.
|
||||
*
|
||||
* @param n - Number to format.
|
||||
* @param format - Formatting options. See http://numeraljs.com/#format for valid formats.
|
||||
* @returns Formatted number.
|
||||
|
||||
Reference in New Issue
Block a user