[Pkg-javascript-commits] [less.js] 42/285: Use native Promises when available

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.0.0
in repository less.js.

commit 815d609223adbfb588ee3dbdb19454c56e42a9f5
Author: Forbes Lindesay <forbes.lindesay at red-gate.com>
Date:   Tue May 20 15:39:04 2014 +0100

    Use native Promises when available
---
 lib/less/index.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/less/index.js b/lib/less/index.js
index 058bfd9..879a64d 100644
--- a/lib/less/index.js
+++ b/lib/less/index.js
@@ -1,4 +1,4 @@
-var Promise = require('promise');
+var PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise;
 var less = require("./non-node-index.js");
 
 less.render = function (input, options, callback) {
@@ -22,7 +22,7 @@ less.render = function (input, options, callback) {
             callback(null, css);
         });
     } else {
-        return new Promise(function (resolve, reject) {
+        return new PromiseConstructor(function (resolve, reject) {
             parser.parse(input, function (e, root) {
                 if (e) { return reject(e); }
                 try { resolve(root.toCSS(options)); }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list