summaryrefslogtreecommitdiffstats
path: root/dgbuilder/dgeflows/node_modules/ejs/ejs.js
diff options
context:
space:
mode:
authorTimoney, Daniel (dt5972) <dtimoney@att.com>2017-02-15 10:37:53 -0500
committerTimoney, Daniel (dt5972) <dtimoney@att.com>2017-02-15 10:40:37 -0500
commit324ee36fe31763e507b422ab0a88e4230045e205 (patch)
treed0b04520f6657601c918ce63fd27575977624187 /dgbuilder/dgeflows/node_modules/ejs/ejs.js
parentf0c97e8db427481e28c0a16b789bc73801b35e47 (diff)
Initial commit for OpenECOMP SDN-C OA&M
Change-Id: I7ab579fd0d206bf356f36d52dcdf4f71f1fa2680 Signed-off-by: Timoney, Daniel (dt5972) <dtimoney@att.com> Former-commit-id: 2a9f0edd09581f907e62ec4689b5ac94dd5382ba
Diffstat (limited to 'dgbuilder/dgeflows/node_modules/ejs/ejs.js')
-rw-r--r--dgbuilder/dgeflows/node_modules/ejs/ejs.js924
1 files changed, 924 insertions, 0 deletions
diff --git a/dgbuilder/dgeflows/node_modules/ejs/ejs.js b/dgbuilder/dgeflows/node_modules/ejs/ejs.js
new file mode 100644
index 00000000..389e45e4
--- /dev/null
+++ b/dgbuilder/dgeflows/node_modules/ejs/ejs.js
@@ -0,0 +1,924 @@
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+(function (process){
+/*
+ * EJS Embedded JavaScript templates
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+'use strict';
+
+var fs = require('fs')
+ , utils = require('./utils')
+ , jsCache = {}
+ , _VERSION_STRING = require('../package.json').version
+ , _DEFAULT_DELIMITER = '%'
+ , _DEFAULT_LOCALS_NAME = 'locals'
+ , _REGEX_STRING = '(<%%|<%=|<%-|<%#|<%|%>|-%>)'
+ , _OPTS = [ 'cache', 'filename', 'delimiter', 'scope', 'context'
+ , 'debug', 'compileDebug', 'client', '_with'
+ ]
+ , _TRAILING_SEMCOL = /;\s*$/;
+
+exports.localsName = _DEFAULT_LOCALS_NAME;
+
+exports.resolveInclude = function(name, filename) {
+ var path = require('path')
+ , dirname = path.dirname
+ , extname = path.extname
+ , resolve = path.resolve
+ , includePath = resolve(dirname(filename), name)
+ , ext = extname(name);
+ if (!ext) {
+ includePath += '.ejs';
+ }
+ return includePath;
+}
+
+
+// Returns a possibly cached template function, set by options.cache.
+// `template` is the string of EJS to compile.
+// If template is undefined then the file specified in options.filename is
+// read.
+function handleCache(options, template) {
+ var fn
+ , path = options.filename
+ , hasTemplate = template !== undefined;
+
+ if (options.cache) {
+ if (!path) {
+ throw new Error('cache option requires a filename');
+ }
+ fn = jsCache[path];
+ if (fn) {
+ return fn;
+ }
+ if (!hasTemplate) {
+ template = fs.readFileSync(path, {encoding: 'utf8'});
+ }
+ }
+ else if (!hasTemplate) {
+ if (!path) {
+ throw new Error('Internal EJS error: no file name or template '
+ + 'provided');
+ }
+ template = fs.readFileSync(path, {encoding: 'utf8'});
+ }
+ fn = exports.compile(template.trim(), options);
+ if (options.cache) {
+ jsCache[path] = fn;
+ }
+ return fn;
+}
+
+function includeFile(path, options) {
+ var opts = utils.shallowCopy({}, options || /* istanbul ignore next */ {});
+ if (!opts.filename) {
+ throw new Error('`include` requires the \'filename\' option.');
+ }
+ opts.filename = exports.resolveInclude(path, opts.filename);
+ return handleCache(opts);
+}
+
+function includeSource(path, options) {
+ var opts = utils.shallowCopy({}, options || {})
+ , includePath
+ , template;
+ if (!opts.filename) {
+ throw new Error('`include` requires the \'filename\' option.');
+ }
+ includePath = exports.resolveInclude(path, opts.filename);
+ template = fs.readFileSync(includePath).toString().trim();
+
+ opts.filename = includePath;
+ var templ = new Template(template, opts);
+ templ.generateSource();
+ return templ.source;
+}
+
+function rethrow(err, str, filename, lineno){
+ var lines = str.split('\n')
+ , start = Math.max(lineno - 3, 0)
+ , end = Math.min(lines.length, lineno + 3);
+
+ // Error context
+ var context = lines.slice(start, end).map(function (line, i){
+ var curr = i + start + 1;
+ return (curr == lineno ? ' >> ' : ' ')
+ + curr
+ + '| '
+ + line;
+ }).join('\n');
+
+ // Alter exception message
+ err.path = filename;
+ err.message = (filename || 'ejs') + ':'
+ + lineno + '\n'
+ + context + '\n\n'
+ + err.message;
+
+ throw err;
+}
+
+function cpOptsInData(data, opts) {
+ _OPTS.forEach(function (p) {
+ if (typeof data[p] != 'undefined') {
+ opts[p] = data[p];
+ }
+ });
+ delete data.__expressRender__;
+}
+
+function compile(template, opts) {
+ var templ;
+
+ // v1 compat
+ // 'scope' is 'context'
+ // FIXME: Remove this in a future version
+ if (opts && opts.scope) {
+ if (!opts.context) {
+ opts.context = opts.scope;
+ }
+ delete opts.scope;
+ }
+ templ = new Template(template, opts);
+ return templ.compile();
+}
+exports.compile = compile;
+
+// template, [data], [opts]
+// Have to include an empty data object if you want opts and no data
+exports.render = function (template, data, opts) {
+ data = data || {};
+ opts = opts || {};
+ var fn;
+
+ // No options object -- if there are optiony names
+ // in the data, copy them to options
+ if (arguments.length == 2) {
+ cpOptsInData(data, opts);
+ }
+
+ fn = handleCache(opts, template);
+ return fn.call(opts.context, data);
+};
+
+// path, [data], [opts], cb
+// Have to include an empty data object if you want opts and no data
+exports.renderFile = function () {
+ var args = Array.prototype.slice.call(arguments)
+ , path = args.shift()
+ , cb = args.pop()
+ , data = args.shift() || {}
+ , opts = args.pop() || {}
+ , result
+ , failed = false;
+
+ // No options object -- if there are optiony names
+ // in the data, copy them to options
+ if (arguments.length == 3) {
+ cpOptsInData(data, opts);
+ }
+ opts.filename = path;
+
+ try {
+ result = handleCache(opts)(data);
+ }
+ catch(err) {
+ return process.nextTick(function () {
+ cb(err);
+ });
+ }
+ process.nextTick(function () {
+ cb(null, result);
+ });
+};
+
+exports.clearCache = function () {
+ jsCache = {};
+};
+
+function Template(text, opts) {
+ opts = opts || {};
+ var options = {};
+ this.templateText = text;
+ this.mode = null;
+ this.truncate = false;
+ this.currentLine = 1;
+ this.source = '';
+ options.client = opts.client || false;
+ options.escapeFunction = opts.escape || utils.escapeXML;
+ options.compileDebug = opts.compileDebug !== false;
+ options.debug = !!opts.debug;
+ options.filename = opts.filename;
+ options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER;
+ options._with = typeof opts._with != 'undefined' ? opts._with : true;
+ options.cache = opts.cache || false;
+ this.opts = options;
+
+ this.regex = this.createRegex();
+}
+
+Template.modes = {
+ EVAL: 'eval'
+ , ESCAPED: 'escaped'
+ , RAW: 'raw'
+ , COMMENT: 'comment'
+ , LITERAL: 'literal'
+};
+
+Template.prototype = new function () {
+ this.createRegex = function () {
+ var str = _REGEX_STRING
+ , delim = utils.escapeRegExpChars(this.opts.delimiter);
+ str = str.replace(/%/g, delim);
+ return new RegExp(str);
+ };
+
+ this.compile = function () {
+ var src
+ , fn
+ , opts = this.opts
+ , escape = opts.escapeFunction;
+
+ if (!this.source) {
+ this.generateSource();
+ var prepended = 'var __output = [];';
+ if (opts._with !== false) {
+ prepended += ' with (' + exports.localsName + ' || {}) { ';
+ }
+ this.source = prepended + this.source;
+ if (opts._with !== false) {
+ this.source += '}';
+ }
+ this.source += ';return __output.join("").trim();';
+ }
+
+ if (opts.compileDebug) {
+ src = 'var __line = 1' +
+ ', __lines = ' + JSON.stringify(this.templateText) +
+ ', __filename = ' + (opts.filename ?
+ JSON.stringify(opts.filename) : 'undefined') +
+ '; try {' +
+ this.source + '} catch (e) { rethrow(e, __lines, __filename, __line); }';
+ }
+ else {
+ src = this.source;
+ }
+
+ if (opts.debug) {
+ console.log(src);
+ }
+
+ if (opts.client) {
+ if (escape !== utils.escapeXML) {
+ src = 'escape = escape || ' + escape.toString() + ';\n' + src;
+ }
+ else {
+ src = utils.escapeFuncStr
+ + 'escape = escape || '
+ + escape.toString() + ';\n'
+ + src;
+ }
+ if (opts.compileDebug) {
+ src = 'rethrow = rethrow || ' + rethrow.toString() + ';\n' + src;
+ }
+ }
+
+ try {
+ fn = new Function(exports.localsName + ', escape, include, rethrow', src);
+ }
+ catch(e) {
+ if (e instanceof SyntaxError) {
+ if (opts.filename) {
+ e.message += ' in ' + opts.filename;
+ }
+ e.message += ' while compiling ejs';
+ throw e;
+ }
+ }
+
+ if (opts.client) {
+ return fn;
+ }
+
+ // Return a callable function which will execute the function
+ // created by the source-code, with the passed data as locals
+ return function (data) {
+ var include = function (path, includeData) {
+ var d = utils.shallowCopy({}, data);
+ if (includeData) {
+ d = utils.shallowCopy(d, includeData);
+ }
+ return includeFile(path, opts)(d);
+ };
+ return fn(data || {}, escape, include, rethrow);
+ };
+
+ };
+
+ this.generateSource = function () {
+ var self = this
+ , matches = this.parseTemplateText()
+ , d = this.opts.delimiter;
+
+ if (matches && matches.length) {
+ matches.forEach(function (line, index) {
+ var closing
+ , include
+ , includeOpts
+ , includeSrc;
+ // If this is an opening tag, check for closing tags
+ // FIXME: May end up with some false positives here
+ // Better to store modes as k/v with '<' + delimiter as key
+ // Then this can simply check against the map
+ if ( line.indexOf('<' + d) === 0 // If it is a tag
+ && line.indexOf('<' + d + d) !== 0) { // and is not escaped
+ closing = matches[index + 2];
+ if (!(closing == d + '>' || closing == '-' + d + '>')) {
+ throw new Error('Could not find matching close tag for "' + line + '".');
+ }
+ }
+ // HACK: backward-compat `include` preprocessor directives
+ if ((include = line.match(/^\s*include\s+(\S+)/))) {
+ includeOpts = utils.shallowCopy({}, self.opts);
+ includeSrc = includeSource(include[1], includeOpts);
+ includeSrc = ';(function(){' + includeSrc + '})();';
+ self.source += includeSrc;
+ }
+ else {
+ self.scanLine(line);
+ }
+ });
+ }
+
+ };
+
+ this.parseTemplateText = function () {
+ var str = this.templateText
+ , pat = this.regex
+ , result = pat.exec(str)
+ , arr = []
+ , firstPos
+ , lastPos;
+
+ while (result) {
+ firstPos = result.index;
+ lastPos = pat.lastIndex;
+
+ if (firstPos !== 0) {
+ arr.push(str.substring(0, firstPos));
+ str = str.slice(firstPos);
+ }
+
+ arr.push(result[0]);
+ str = str.slice(result[0].length);
+ result = pat.exec(str);
+ }
+
+ if (str) {
+ arr.push(str);
+ }
+
+ return arr;
+ };
+
+ this.scanLine = function (line) {
+ var self = this
+ , d = this.opts.delimiter
+ , newLineCount = 0;
+
+ function _addOutput() {
+ if (self.truncate) {
+ line = line.replace('\n', '');
+ }
+
+ // Preserve literal slashes
+ line = line.replace(/\\/g, '\\\\');
+
+ // Convert linebreaks
+ line = line.replace(/\n/g, '\\n');
+ line = line.replace(/\r/g, '\\r');
+
+ // Escape double-quotes
+ // - this will be the delimiter during execution
+ line = line.replace(/"/g, '\\"');
+ self.source += ';__output.push("' + line + '");';
+ }
+
+ newLineCount = (line.split('\n').length - 1);
+
+ switch (line) {
+ case '<' + d:
+ this.mode = Template.modes.EVAL;
+ break;
+ case '<' + d + '=':
+ this.mode = Template.modes.ESCAPED;
+ break;
+ case '<' + d + '-':
+ this.mode = Template.modes.RAW;
+ break;
+ case '<' + d + '#':
+ this.mode = Template.modes.COMMENT;
+ break;
+ case '<' + d + d:
+ this.mode = Template.modes.LITERAL;
+ this.source += ';__output.push("' + line.replace('<' + d + d, '<' + d) + '");';
+ break;
+ case d + '>':
+ case '-' + d + '>':
+ if (this.mode == Template.modes.LITERAL) {
+ _addOutput();
+ }
+
+ this.mode = null;
+ this.truncate = line.indexOf('-') === 0;
+ break;
+ default:
+ // In script mode, depends on type of tag
+ if (this.mode) {
+ // If '//' is found without a line break, add a line break.
+ switch (this.mode) {
+ case Template.modes.EVAL:
+ case Template.modes.ESCAPED:
+ case Template.modes.RAW:
+ if (line.lastIndexOf('//') > line.lastIndexOf('\n')) {
+ line += '\n';
+ }
+ }
+ switch (this.mode) {
+ // Just executing code
+ case Template.modes.EVAL:
+ this.source += ';' + line;
+ break;
+ // Exec, esc, and output
+ case Template.modes.ESCAPED:
+ // Add the exec'd, escaped result to the output
+ // Have to prevent the string-coercion of `undefined` and `null`
+ // in the `escape` function -- making a `join` call like below unnecessary
+ this.source += ';__output.push(escape(' +
+ line.replace(_TRAILING_SEMCOL, '').trim() + '))';
+ break;
+ // Exec and output
+ case Template.modes.RAW:
+ // Add the exec'd result to the output
+ // Using `join` here prevents string-coercion of `undefined` and `null`
+ // without filtering out falsey values like zero
+ this.source += ';__output.push(' +
+ line.replace(_TRAILING_SEMCOL, '').trim() + ')';
+ break;
+ case Template.modes.COMMENT:
+ // Do nothing
+ break;
+ // Literal <%% mode, append as raw output
+ case Template.modes.LITERAL:
+ _addOutput();
+ break;
+ }
+ }
+ // In string mode, just add the output
+ else {
+ _addOutput();
+ }
+ }
+
+ if (self.opts.compileDebug && newLineCount) {
+ this.currentLine += newLineCount;
+ this.source += ';__line = ' + this.currentLine + ';';
+ }
+ };
+};
+
+// Express support
+exports.__express = exports.renderFile;
+
+// Add require support
+/* istanbul ignore else */
+if (require.extensions) {
+ require.extensions['.ejs'] = function (module, filename) {
+ filename = filename || /* istanbul ignore next */ module.filename;
+ var options = {
+ filename: filename
+ , client: true
+ }
+ , template = fs.readFileSync(filename).toString().trim()
+ , fn = compile(template, options);
+ module._compile('module.exports = ' + fn.toString() + ';', filename);
+ };
+}
+
+exports.VERSION = _VERSION_STRING;
+
+/* istanbul ignore if */
+if (typeof window != 'undefined') {
+ window.ejs = exports;
+}
+
+}).call(this,require('_process'))
+},{"../package.json":6,"./utils":2,"_process":5,"fs":3,"path":4}],2:[function(require,module,exports){
+/*
+ * EJS Embedded JavaScript templates
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+'use strict';
+
+var regExpChars = /[|\\{}()[\]^$+*?.]/g;
+
+exports.escapeRegExpChars = function (string) {
+ // istanbul ignore if
+ if (!string) {
+ return '';
+ }
+ return String(string).replace(regExpChars, '\\$&');
+};
+
+var encodeHTMLRules = {
+ '&': '&amp;'
+ , '<': '&lt;'
+ , '>': '&gt;'
+ , '"': '&#34;'
+ , "'": '&#39;'
+ }
+ , matchHTML = /[&<>\'"]/g;
+
+exports.escapeFuncStr =
+ 'var encodeHTMLRules = {'
++ '"&": "&amp;"'
++ ', "<": "&lt;"'
++ ', ">": "&gt;"'
++ ', \'"\': "&#34;"'
++ ', "\'": "&#39;"'
++ '}'
++ ', matchHTML = /[&<>\'"]/g;';
+
+exports.escapeXML = function (markup) {
+ return markup == undefined
+ ? ''
+ : String(markup)
+ .replace(matchHTML, function(m) {
+ return encodeHTMLRules[m] || m;
+ });
+};
+
+exports.shallowCopy = function (to, from) {
+ for (var p in from) {
+ to[p] = from[p];
+ }
+ return to;
+};
+
+
+},{}],3:[function(require,module,exports){
+
+},{}],4:[function(require,module,exports){
+(function (process){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length - 1; i >= 0; i--) {
+ var last = parts[i];
+ if (last === '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Split a filename into [root, dir, basename, ext], unix version
+// 'root' is just a slash, or nothing.
+var splitPathRe =
+ /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
+var splitPath = function(filename) {
+ return splitPathRe.exec(filename).slice(1);
+};
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+ var resolvedPath = '',
+ resolvedAbsolute = false;
+
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0) ? arguments[i] : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string') {
+ throw new TypeError('Arguments to path.resolve must be strings');
+ } else if (!path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+ }
+
+ // At this point the path should be resolved to a full absolute path, but
+ // handle relative paths to be safe (might happen when process.cwd() fails)
+
+ // Normalize the path
+ resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+ var isAbsolute = exports.isAbsolute(path),
+ trailingSlash = substr(path, -1) === '/';
+
+ // Normalize the path
+ path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+// posix version
+exports.isAbsolute = function(path) {
+ return path.charAt(0) === '/';
+};
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ if (typeof p !== 'string') {
+ throw new TypeError('Arguments to path.join must be strings');
+ }
+ return p;
+ }).join('/'));
+};
+
+
+// path.relative(from, to)
+// posix version
+exports.relative = function(from, to) {
+ from = exports.resolve(from).substr(1);
+ to = exports.resolve(to).substr(1);
+
+ function trim(arr) {
+ var start = 0;
+ for (; start < arr.length; start++) {
+ if (arr[start] !== '') break;
+ }
+
+ var end = arr.length - 1;
+ for (; end >= 0; end--) {
+ if (arr[end] !== '') break;
+ }
+
+ if (start > end) return [];
+ return arr.slice(start, end - start + 1);
+ }
+
+ var fromParts = trim(from.split('/'));
+ var toParts = trim(to.split('/'));
+
+ var length = Math.min(fromParts.length, toParts.length);
+ var samePartsLength = length;
+ for (var i = 0; i < length; i++) {
+ if (fromParts[i] !== toParts[i]) {
+ samePartsLength = i;
+ break;
+ }
+ }
+
+ var outputParts = [];
+ for (var i = samePartsLength; i < fromParts.length; i++) {
+ outputParts.push('..');
+ }
+
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
+
+ return outputParts.join('/');
+};
+
+exports.sep = '/';
+exports.delimiter = ':';
+
+exports.dirname = function(path) {
+ var result = splitPath(path),
+ root = result[0],
+ dir = result[1];
+
+ if (!root && !dir) {
+ // No dirname whatsoever
+ return '.';
+ }
+
+ if (dir) {
+ // It has a dirname, strip trailing slash
+ dir = dir.substr(0, dir.length - 1);
+ }
+
+ return root + dir;
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPath(path)[2];
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPath(path)[3];
+};
+
+function filter (xs, f) {
+ if (xs.filter) return xs.filter(f);
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (f(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// String.prototype.substr - negative index don't work in IE8
+var substr = 'ab'.substr(-1) === 'b'
+ ? function (str, start, len) { return str.substr(start, len) }
+ : function (str, start, len) {
+ if (start < 0) start = str.length + start;
+ return str.substr(start, len);
+ }
+;
+
+}).call(this,require('_process'))
+},{"_process":5}],5:[function(require,module,exports){
+// shim for using process in browser
+
+var process = module.exports = {};
+var queue = [];
+var draining = false;
+
+function drainQueue() {
+ if (draining) {
+ return;
+ }
+ draining = true;
+ var currentQueue;
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ var i = -1;
+ while (++i < len) {
+ currentQueue[i]();
+ }
+ len = queue.length;
+ }
+ draining = false;
+}
+process.nextTick = function (fun) {
+ queue.push(fun);
+ if (!draining) {
+ setTimeout(drainQueue, 0);
+ }
+};
+
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+process.version = ''; // empty string to avoid regexp issues
+
+function noop() {}
+
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+// TODO(shtylman)
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+process.umask = function() { return 0; };
+
+},{}],6:[function(require,module,exports){
+module.exports={
+ "name": "ejs",
+ "description": "Embedded JavaScript templates",
+ "keywords": [
+ "template",
+ "engine",
+ "ejs"
+ ],
+ "version": "2.2.3",
+ "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
+ "contributors": [
+ "Timothy Gu <timothygu99@gmail.com> (https://timothygu.github.io)"
+ ],
+ "license": "Apache-2.0",
+ "main": "./lib/ejs.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mde/ejs.git"
+ },
+ "bugs": "https://github.com/mde/ejs/issues",
+ "homepage": "https://github.com/mde/ejs",
+ "dependencies": {},
+ "devDependencies": {
+ "browserify": "^8.0.3",
+ "uglify-js": "^2.4.16",
+ "mocha": "^2.1.0",
+ "jake": "^8.0.0",
+ "istanbul": "~0.3.5"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "mocha",
+ "coverage": "istanbul cover node_modules/mocha/bin/_mocha"
+ }
+}
+},{}]},{},[1]);