GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — The result object is not typed as ResultSet in TypeScript · Issue #3469 · josdejong/mathjs Closed Labels buggood first issueRelatively localized/straightforward changes that would provide a good introduction to mathjs codehelp wantedtypescript DescriptionThe issues section is used only for bug reports. Please use the Discussions section to ask questions and share ideas and suggestions. Describe the bug Moreover I'd add some reference in the docs explaining that if formula is composed of multiple lines or multiple expressions, the returned result is not the last result but rather all the results as a ResultSet. To Reproduce Consider the snippet below where I try to get the result of a user-provided formula, all is working correctly but const result = evaluate(field.impactsFormula, scope) if (typeof result === 'number') { fieldData = result } else if ( isResultSet(result) && typeof result.valueOf().at(-1) === 'number' ) { // When there are multiple expressions, even just var assignments, mathjs returns // an array of results, so let's consider the last one as the right result fieldData = result.valueOf().at(-1) } else { return { success: false, error: `Formula "${field.impactsFormula}" did not return a number: ${result}`, } } Activity
MetadataMetadataAssigneesLabelsbuggood first issueRelatively localized/straightforward changes that would provide a good introduction to mathjs codehelp wantedtypescript TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |