|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
700 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const toNumber = require('../util/toNumber.js');
|
|---|
| 6 | const toString = require('../util/toString.js');
|
|---|
| 7 |
|
|---|
| 8 | function divide(value, other) {
|
|---|
| 9 | if (value === undefined && other === undefined) {
|
|---|
| 10 | return 1;
|
|---|
| 11 | }
|
|---|
| 12 | if (value === undefined || other === undefined) {
|
|---|
| 13 | return value ?? other;
|
|---|
| 14 | }
|
|---|
| 15 | if (typeof value === 'string' || typeof other === 'string') {
|
|---|
| 16 | value = toString.toString(value);
|
|---|
| 17 | other = toString.toString(other);
|
|---|
| 18 | }
|
|---|
| 19 | else {
|
|---|
| 20 | value = toNumber.toNumber(value);
|
|---|
| 21 | other = toNumber.toNumber(other);
|
|---|
| 22 | }
|
|---|
| 23 | return value / other;
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | exports.divide = divide;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.