Skip to content

Commit

Permalink
Merge pull request #220 from designfrontier/feature/add-naming
Browse files Browse the repository at this point in the history
Adds a name attribute for easy identification
  • Loading branch information
mde authored Dec 3, 2016
2 parents 49264e0 + 706987b commit 54f7653
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var scopeOptionWarned = false;
var _VERSION_STRING = require('../package.json').version;
var _DEFAULT_DELIMITER = '%';
var _DEFAULT_LOCALS_NAME = 'locals';
var _NAME = 'ejs';
var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)';
var _OPTS = [ 'cache', 'filename', 'delimiter', 'scope', 'context',
'debug', 'compileDebug', 'client', '_with', 'root', 'rmWhitespace',
Expand Down Expand Up @@ -806,6 +807,16 @@ if (require.extensions) {

exports.VERSION = _VERSION_STRING;

/**
* Name for detection of EJS.
*
* @readonly
* @type {String}
* @public
*/

exports.name = _NAME;

/* istanbul ignore if */
if (typeof window != 'undefined') {
window.ejs = exports;
Expand Down
10 changes: 10 additions & 0 deletions test/ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,3 +982,13 @@ suite('examples', function () {
});
});
});

suite('meta information', function () {
test('has a version', function () {
assert.strictEqual(ejs.VERSION, require('../package.json').version);
});

test('had a name', function () {
assert.strictEqual(ejs.name, 'ejs');
});
});

0 comments on commit 54f7653

Please sign in to comment.