[Pkg-javascript-commits] [node-jade] 14/72: refactor(inputformats): Move from a function to a property

Jelmer Vernooij jelmer at moszumanska.debian.org
Sun Jul 3 18:03:25 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 ec25458760b18376c8df16b24fbb3d017b65d292
Author: Rob Loach <robloach at gmail.com>
Date:   Sun Apr 5 12:12:38 2015 -0400

    refactor(inputformats): Move from a function to a property
---
 README.md                                  | 2 +-
 index.js                                   | 8 +-------
 test/index.js                              | 2 +-
 test/{input-format.js => input-formats.js} | 4 ++--
 4 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index f149b9c..b4983cf 100644
--- a/README.md
+++ b/README.md
@@ -92,7 +92,7 @@ Transform a file asynchronously. If a callback is provided, it is called as `cal
 ### `.inputFormats`
 
 ```js
-var formats = transformer.inputFormats();
+var formats = transformer.inputFormats;
 => ['md', 'markdown']
 ```
 
diff --git a/index.js b/index.js
index 576d4b7..ba00b9c 100644
--- a/index.js
+++ b/index.js
@@ -94,6 +94,7 @@ function Transformer(tr) {
   this._tr = tr;
   this.name = this._tr.name;
   this.outputFormat = this._tr.outputFormat;
+  this.inputFormats = this._tr.inputFormats || [this.name];
 }
 
 var fallbacks = {
@@ -325,10 +326,3 @@ Transformer.prototype.renderFileAsync = function (filename, options, locals, cb)
     }.bind(this)), cb);
   }
 };
-
-/**
- * inputFormats
- */
-Transformer.prototype.inputFormats = function() {
-  return this._tr.inputFormats || [this._tr.name];
-};
diff --git a/test/index.js b/test/index.js
index 0fefd3d..b724f43 100644
--- a/test/index.js
+++ b/test/index.js
@@ -38,4 +38,4 @@ require('./compile-file-client');
 require('./compile-file-client-async');
 require('./render');
 require('./render-async');
-require('./input-format');
+require('./input-formats');
diff --git a/test/input-format.js b/test/input-formats.js
similarity index 85%
rename from test/input-format.js
rename to test/input-formats.js
index d2f836a..5952142 100644
--- a/test/input-format.js
+++ b/test/input-formats.js
@@ -16,7 +16,7 @@ test('inputFormats - with tr.inputFormats', function (override) {
       return str;
     }
   });
-  assert.deepEqual(tr.inputFormats(), ['html', 'htm']);
+  assert.deepEqual(tr.inputFormats, ['html', 'htm']);
 });
 
 test('inputFormats - without tr.inputFormats', function (override) {
@@ -27,5 +27,5 @@ test('inputFormats - without tr.inputFormats', function (override) {
       return str;
     }
   });
-  assert.deepEqual(tr.inputFormats(), ['test']);
+  assert.deepEqual(tr.inputFormats, ['test']);
 });

-- 
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