|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
573 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | import { toNumber } from '../util/toNumber.mjs';
|
|---|
| 2 | import { toString } from '../util/toString.mjs';
|
|---|
| 3 |
|
|---|
| 4 | function multiply(value, other) {
|
|---|
| 5 | if (value === undefined && other === undefined) {
|
|---|
| 6 | return 1;
|
|---|
| 7 | }
|
|---|
| 8 | if (value === undefined || other === undefined) {
|
|---|
| 9 | return value ?? other;
|
|---|
| 10 | }
|
|---|
| 11 | if (typeof value === 'string' || typeof other === 'string') {
|
|---|
| 12 | value = toString(value);
|
|---|
| 13 | other = toString(other);
|
|---|
| 14 | }
|
|---|
| 15 | else {
|
|---|
| 16 | value = toNumber(value);
|
|---|
| 17 | other = toNumber(other);
|
|---|
| 18 | }
|
|---|
| 19 | return value * other;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | export { multiply };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.