Skip to content

Commit

Permalink
feat: offer ES module interop default export (svg#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleyayers authored and GreLI committed Sep 15, 2018
1 parent e7b8a6c commit 3e2fd44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/svgo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var CONFIG = require('./svgo/config.js'),
encodeSVGDatauri = require('./svgo/tools.js').encodeSVGDatauri,
JS2SVG = require('./svgo/js2svg.js');

var SVGO = module.exports = function(config) {
var SVGO = function(config) {
this.config = CONFIG(config);
};

Expand Down Expand Up @@ -77,3 +77,7 @@ SVGO.prototype._optimizeOnce = function(svgstr, info, callback) {
SVGO.prototype.createContentItem = function(data) {
return new JSAPI(data);
};

module.exports = SVGO;
// Offer ES module interop compatibility.
module.exports.default = SVGO;
4 changes: 4 additions & 0 deletions test/jsapi/_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ describe('svgo object', function() {
item.should.be.empty;
});

it('should have ES module interop default property', function() {
SVGO.should.equal(SVGO.default);
});

});

0 comments on commit 3e2fd44

Please sign in to comment.