Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] functions: name MID args #3399

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/functions/arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export function arg(definition: string, description: string = ""): ArgDefinition
function makeArg(str: string): ArgDefinition {
let parts = str.match(ARG_REGEXP)!;
let name = parts[1].trim();
if (!name) {
throw new Error(`Function argument definition is missing a name: '${str}'.`);
}
let types: ArgType[] = [];
let isOptional = false;
let isRepeating = false;
Expand Down
4 changes: 2 additions & 2 deletions src/functions/module_engineering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const DEFAULT_DELTA_ARG = 0;
export const DELTA: AddFunctionDescription = {
description: _lt("Compare two numeric values, returning 1 if they're equal."),
args: [
arg(" (number)", _lt("The first number to compare.")),
arg(` (number, default=${DEFAULT_DELTA_ARG})`, _lt("The second number to compare.")),
arg("number1 (number)", _lt("The first number to compare.")),
arg(`number2 (number, default=${DEFAULT_DELTA_ARG})`, _lt("The second number to compare.")),
],
returns: ["NUMBER"],
compute: function (
Expand Down
5 changes: 4 additions & 1 deletion src/functions/module_financial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ export const AMORLINC: AddFunctionDescription = {
_lt("The single period within life for which to calculate depreciation.")
),
arg("rate (number)", _lt("The deprecation rate.")),
arg(" (number, optional)", _lt("An indicator of what day count method to use.")),
arg(
"day_count_convention (number, optional)",
_lt("An indicator of what day count method to use.")
),
],
returns: ["NUMBER"],
compute: function (
Expand Down
4 changes: 2 additions & 2 deletions src/functions/module_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ export const MID: AddFunctionDescription = {
args: [
arg("text (string)", _lt("The string to extract a segment from.")),
arg(
" (number)",
"starting_at (number)",
_lt(
"The index from the left of string from which to begin extracting. The first character in string has the index 1."
)
),
arg(" (number)", _lt("The length of the segment to extract.")),
arg("extract_length (number)", _lt("The length of the segment to extract.")),
],
returns: ["STRING"],
compute: function (
Expand Down