Skip to content

Commit

Permalink
eslint: fix no-throw-literal
Browse files Browse the repository at this point in the history
manual fixes
  • Loading branch information
NovemLinguae committed Dec 4, 2024
1 parent 6994d0b commit 8f1796d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"no-new": "warn",
"no-return-assign": "warn",
"no-script-url": "warn",
"no-throw-literal": "warn",
"no-unused-expressions": "warn",
"no-use-before-define": "warn",
"no-useless-concat": "warn",
Expand Down
8 changes: 4 additions & 4 deletions morebits.js
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,7 @@ Morebits.array = {
*/
uniq: function(arr) {
if (!Array.isArray(arr)) {
throw 'A non-array object passed to Morebits.array.uniq';
throw new Error('A non-array object passed to Morebits.array.uniq');
}
return arr.filter((item, idx) => arr.indexOf(item) === idx);
},
Expand All @@ -1600,7 +1600,7 @@ Morebits.array = {
*/
dups: function(arr) {
if (!Array.isArray(arr)) {
throw 'A non-array object passed to Morebits.array.dups';
throw new Error('A non-array object passed to Morebits.array.dups');
}
return arr.filter((item, idx) => arr.indexOf(item) !== idx);
},
Expand All @@ -1615,7 +1615,7 @@ Morebits.array = {
*/
chunk: function(arr, size) {
if (!Array.isArray(arr)) {
throw 'A non-array object passed to Morebits.array.chunk';
throw new Error('A non-array object passed to Morebits.array.chunk');
}
if (typeof size !== 'number' || size <= 0) { // pretty impossible to do anything :)
return [ arr ]; // we return an array consisting of this array.
Expand Down Expand Up @@ -5231,7 +5231,7 @@ Morebits.status.onError = function(handler) {
if (typeof handler === 'function') {
Morebits.status.errorEvent = handler;
} else {
throw 'Morebits.status.onError: handler is not a function';
throw new Error('Morebits.status.onError: handler is not a function');
}
};

Expand Down

0 comments on commit 8f1796d

Please sign in to comment.