Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

templates

Package Overview
Dependencies
Maintainers
3
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

templates - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

45

lib/utils.js

@@ -33,2 +33,3 @@ 'use strict';

lazy('layouts');
lazy('dest');

@@ -345,2 +346,46 @@ // glob/matching utils

/**
* Create a dest function to use on an instance of view.
* Useful in a getter method on `view.dest`.
*
* @param {Object} `view` An instance of View
* @return {Function} Function suitable for `file.dest` in the [dest][] plugin.
*/
utils.destWrapper = function destWrapper(view) {
if (typeof view._dest === 'function') {
return view._dest;
}
return function (dir, options, cb) {
// when function is called with just the callback
if (typeof dir === 'function' && arguments.length === 1) {
cb = dir;
dir = '';
options = {};
}
if (typeof options === 'function') {
cb = options;
options = {};
}
var opts = utils.extend({
cwd: view.cwd || process.cwd(),
mode: (view.stat ? view.stat.mode : null),
dirMode: null,
overwrite: true
}, options);
if (view._dest && typeof view._dest === 'string') {
var orig = dir;
dir = function (file) {
file.path = view._dest;
return typeof orig === 'function' ? orig(file) : orig;
};
}
return utils.dest.normalize(dir, view, opts, cb);
};
};
/**
* Rename a file

@@ -347,0 +392,0 @@ */

@@ -29,2 +29,3 @@ 'use strict';

this.define('_content', null);
this.define('_dest', null);
this.isView = true;

@@ -45,2 +46,13 @@

this.define('dest', {
configurable: true,
enumerable: false,
get: function () {
return utils.destWrapper(this);
},
set: function (val) {
this._dest = val;
}
});
this.options = this.options || {};

@@ -47,0 +59,0 @@ this.locals = this.locals || {};

3

package.json
{
"name": "templates",
"description": "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.",
"version": "0.1.16",
"version": "0.1.17",
"homepage": "https://github.com/jonschlinkert/templates",

@@ -29,2 +29,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"define-property": "^0.2.5",
"dest": "^0.2.1",
"en-route": "^0.7.3",

@@ -31,0 +32,0 @@ "engine-base": "^0.1.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc