Skip to content
This repository has been archived by the owner on Sep 28, 2018. It is now read-only.

Commit

Permalink
ES6/ES2015/Babel + Webpack compatibility (#65)
Browse files Browse the repository at this point in the history
Solve a transpiling issue with Babel where it may be evaluated in contexts with no global `this` defined.
  • Loading branch information
therufa authored and inexorabletash committed Jan 5, 2017
1 parent ad69423 commit 8c43765
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 10 additions & 2 deletions lib/encoding-indexes.js

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions lib/encoding.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// This is free and unencumbered software released into the public domain.
// See LICENSE.md for more information.

// If we're in node require encoding-indexes and attach it to the global.
/**
* @fileoverview Global |this| required for resolving indexes in node.
* @suppress {globalThis}
*/
if (typeof module !== "undefined" && module.exports &&
!this["encoding-indexes"]) {
require("./encoding-indexes.js");
}

(function(global) {
'use strict';

// If we're in node require encoding-indexes and attach it to the global.
if (typeof module !== "undefined" && module.exports &&
!global["encoding-indexes"]) {
global['encoding-indexes'] = require("./encoding-indexes.js");
}

//
// Utilities
//
Expand Down Expand Up @@ -3306,4 +3306,7 @@ if (typeof module !== "undefined" && module.exports &&
EncodingIndexes: global["encoding-indexes"]
};
}
}(this));

// For strict environments where `this` inside the global scope
// is `undefined`, take a pure object instead
}(this || {}));

0 comments on commit 8c43765

Please sign in to comment.