5 Commits 34f2d12483 ... 833fdb445b

Auteur SHA1 Message Date
  Herby Vojčík 833fdb445b v0.2.0 il y a 5 mois
  Herby Vojčík 0bfed1dfb9 Update author email. il y a 5 mois
  Herby Vojčík f07a2a3e4d Add resolveBy. il y a 5 mois
  Herby Vojčík b1bd95e861 Rename. il y a 5 mois
  Herby Vojčík ebe7f1c83f Change type to module. il y a 5 mois
3 fichiers modifiés avec 6 ajouts et 33 suppressions
  1. 0 24
      lib/node.js
  2. 5 9
      package.json
  3. 1 0
      src/deferred.js

+ 0 - 24
lib/node.js

@@ -1,24 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
-    value: true
-});
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-/*
- * Deferred pattern built on top of Promise.
- */
-
-var Deferred = function Deferred() {
-    var _this = this;
-
-    _classCallCheck(this, Deferred);
-
-    this.promise = new Promise(function (resolve, reject) {
-        _this.resolve = resolve;
-        _this.reject = reject;
-    });
-};
-
-exports.default = Deferred;

+ 5 - 9
package.json

@@ -1,10 +1,10 @@
 {
   "name": "deferred-lite",
-  "version": "0.1.1",
+  "version": "0.2.0",
   "description": "Deferred pattern on top of Promise",
-  "main": "lib/node.js",
+  "type": "module",
+  "main": "src/deferred.js",
   "scripts": {
-    "build": "babel src --presets es2015 --out-dir lib",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "repository": {
@@ -14,14 +14,10 @@
   "keywords": [
     "deferred"
   ],
-  "author": "Herbert Vojčík <herby@mailbox.sk>",
+  "author": "Herbert Vojčík <herby@eleison.sk>",
   "license": "MIT",
   "bugs": {
     "url": "https://lolg.it/herby/deferred-lite/issues"
   },
-  "homepage": "https://lolg.it/herby/deferred-lite#readme",
-  "devDependencies": {
-    "babel-cli": "^6.9.0",
-    "babel-preset-es2015": "^6.9.0"
-  }
+  "homepage": "https://lolg.it/herby/deferred-lite#readme"
 }

+ 1 - 0
src/node.js → src/deferred.js

@@ -7,6 +7,7 @@ export default class Deferred {
         this.promise = new Promise((resolve, reject) => {
             this.resolve = resolve;
             this.reject = reject;
+            this.resolveBy = fn => resolve(fn());
         });
     }
 }