Skip to content

Commit

Permalink
Polyfilling isInteger. Resolves #8. (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning authored May 20, 2020
1 parent 977ad68 commit 59838bb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion public-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports.setPublicPath = function setPublicPath(
if (
typeof rootDirectoryLevel !== "number" ||
rootDirectoryLevel <= 0 ||
!Number.isInteger(rootDirectoryLevel)
!isInteger(rootDirectoryLevel)
) {
throw Error(
"systemjs-webpack-interop: setPublicPath(systemjsModuleName, rootDirectoryLevel) must be called with a positive integer 'rootDirectoryLevel'"
Expand Down Expand Up @@ -70,3 +70,10 @@ function resolveDirectory(urlString, rootDirectoryLevel) {
}

exports.resolveDirectory = resolveDirectory;

// borrowed from https://github.com/parshap/js-is-integer/blob/master/index.js
const isInteger =
Number.isInteger ||
function isInteger(val) {
return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
};

0 comments on commit 59838bb

Please sign in to comment.