mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 04:27:04 +00:00
fix(evaluators): fix mathjs matrix output type (#5270)
Some checks failed
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
deploy client docs / Build (push) Has been cancelled
Some checks failed
auto-merge / push-commit (push) Waiting to run
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
deploy client docs / Build (push) Has been cancelled
This commit is contained in:
parent
b4ee396b58
commit
00301815d5
16
packages/core/evaluators/src/utils/__tests__/mathjs.test.ts
Normal file
16
packages/core/evaluators/src/utils/__tests__/mathjs.test.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* This file is part of the NocoBase (R) project.
|
||||||
|
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||||
|
* Authors: NocoBase Team.
|
||||||
|
*
|
||||||
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||||
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import mathjs from '../mathjs';
|
||||||
|
|
||||||
|
describe('evaluators > mathjs', () => {
|
||||||
|
it('matrix type should be to array', () => {
|
||||||
|
expect(mathjs('range(1, 3, 1)')).toEqual([1, 2, 3]);
|
||||||
|
});
|
||||||
|
});
|
@ -20,6 +20,9 @@ export default evaluate.bind(
|
|||||||
}
|
}
|
||||||
return math.round(result, 9);
|
return math.round(result, 9);
|
||||||
}
|
}
|
||||||
|
if (result instanceof math.Matrix) {
|
||||||
|
return result.toArray();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
{ replaceKey: true },
|
{ replaceKey: true },
|
||||||
|
Loading…
Reference in New Issue
Block a user