diff --git a/index.js b/index.js deleted file mode 100644 index ee62f3a..0000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/retry'); \ No newline at end of file diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..6615177 --- /dev/null +++ b/index.mjs @@ -0,0 +1,2 @@ +import retry from './lib/retry.mjs' +export default retry diff --git a/lib/retry.js b/lib/retry.mjs similarity index 96% rename from lib/retry.js rename to lib/retry.mjs index 5e85e79..2fe9da6 100644 --- a/lib/retry.js +++ b/lib/retry.mjs @@ -1,4 +1,6 @@ -var RetryOperation = require('./retry_operation'); +import RetryOperation from './retry_operation.mjs' + +var exports = {} exports.operation = function(options) { var timeouts = exports.timeouts(options); @@ -98,3 +100,5 @@ exports.wrap = function(obj, options, methods) { obj[method].options = options; } }; + +export default exports diff --git a/lib/retry_operation.js b/lib/retry_operation.mjs similarity index 99% rename from lib/retry_operation.js rename to lib/retry_operation.mjs index 105ce72..2c03fb7 100644 --- a/lib/retry_operation.js +++ b/lib/retry_operation.mjs @@ -21,7 +21,6 @@ function RetryOperation(timeouts, options) { this._cachedTimeouts = this._timeouts.slice(0); } } -module.exports = RetryOperation; RetryOperation.prototype.reset = function() { this._attempts = 1; @@ -160,3 +159,5 @@ RetryOperation.prototype.mainError = function() { return mainError; }; + +export default RetryOperation diff --git a/package.json b/package.json index 4e72bef..bd601f6 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "directories": { "lib": "./lib" }, - "main": "index.js", + "main": "index.mjs", "engines": { "node": ">= 4" },