[Pkg-javascript-commits] [node-jade] 71/72: Fix browser compatibility (#155)

Jelmer Vernooij jelmer at moszumanska.debian.org
Sun Jul 3 18:03:32 UTC 2016


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

jelmer pushed a commit to annotated tag upstream/1.0.0
in repository node-jade.

commit fd5596ebe60087cd4c0be8fc26b88f6ecb4880e2
Author: Rico Sta. Cruz <rstacruz at users.noreply.github.com>
Date:   Fri May 6 21:28:06 2016 +0800

    Fix browser compatibility (#155)
---
 index.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index 0b3e9e4..c12d7f9 100644
--- a/index.js
+++ b/index.js
@@ -13,8 +13,13 @@ tr.normalizeFn = normalizeFn;
 tr.normalizeFnAsync = normalizeFnAsync;
 tr.normalize = normalize;
 tr.normalizeAsync = normalizeAsync;
-tr.readFile = Promise.denodeify(fs.readFile);
-tr.readFileSync = fs.readFileSync;
+if (fs.readFile) {
+  tr.readFile = Promise.denodeify(fs.readFile);
+  tr.readFileSync = fs.readFileSync;
+} else {
+  tr.readFile = function () { throw new Error('fs.readFile unsupported'); };
+  tr.readFileSync = function () { throw new Error('fs.readFileSync unsupported'); };
+}
 
 function normalizeFn(result) {
   if (typeof result === 'function') {

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



More information about the Pkg-javascript-commits mailing list