FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mathjs/src/error/DimensionError.js at develop · garora/mathjs · GitHub
garora
/
mathjs
Public
forked from
josdejong/mathjs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
mathjs
/
src
/
error
/
DimensionError.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (27 loc) · 1.14 KB
Breadcrumbs
mathjs
/
src
/
error
/
DimensionError.js
Copy path
File metadata and controls
31 lines (27 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Create a range error with the message:
* 'Dimension mismatch (<actual size> != <expected size>)'
*
@param
{
number | number[]
} actual The actual size
*
@param
{
number | number[]
} expected The expected size
*
@param
{
string
} [relation='!='] Optional relation between actual
* and expected size: '!=', '<', etc.
*
@extends
RangeError
*/
export
function
DimensionError
(
actual
,
expected
,
relation
)
{
if
(
!
(
this
instanceof
DimensionError
)
)
{
throw
new
SyntaxError
(
'Constructor must be called with the new operator'
)
}
this
.
actual
=
actual
this
.
expected
=
expected
this
.
relation
=
relation
this
.
message
=
'Dimension mismatch ('
+
(
Array
.
isArray
(
actual
)
?
(
'['
+
actual
.
join
(
', '
)
+
']'
)
:
actual
)
+
' '
+
(
this
.
relation
||
'!='
)
+
' '
+
(
Array
.
isArray
(
expected
)
?
(
'['
+
expected
.
join
(
', '
)
+
']'
)
:
expected
)
+
')'
this
.
stack
=
(
new
Error
(
)
)
.
stack
}
DimensionError
.
prototype
=
new
RangeError
(
)
DimensionError
.
prototype
.
constructor
=
RangeError
DimensionError
.
prototype
.
name
=
'DimensionError'
DimensionError
.
prototype
.
isDimensionError
=
true
Back
|
FazBrowse Home
|
New Git URL