New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

generator-util

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-util - npm Package Compare versions

Comparing version 0.2.6 to 0.2.7

57

index.js

@@ -29,2 +29,3 @@ /*!

require('resolve');
require('resolve-dir');
require('try-open');

@@ -104,2 +105,27 @@ require = fn;

/**
* Return a home-relative filepath
*
* ```js
* utils.homeRelative('foo');
* //=> 'dev/foo'
* ```
* @param {String} `filepath`
* @return {String}
* @api public
*/
utils.homeRelative = function(fp) {
if (typeof fp === 'undefined') {
throw new TypeError('utils.homeRelative expected filepath to be a string');
}
var dir = path.resolve(utils.resolveDir(fp));
var home = path.resolve(utils.resolveDir('~/'));
fp = path.relative(home, dir);
if (fp.charAt(0) === '/') {
fp = fp.slice(1);
}
return fp;
};
/**
* Return true if a filepath exists on the file system.

@@ -123,4 +149,12 @@ *

/**
* Return true if a filepath exists and is a directory.
*
* @param {String} `filepath`
* @return {Boolean}
* @api public
*/
utils.isDirectory = function(fp) {
return fs.statSync(fp).isDirectory();
return utils.exists(fp) && fs.statSync(fp).isDirectory();
};

@@ -307,2 +341,12 @@

if (opts.cwd) {
try {
var modulepath = utils.resolve.sync(name, {basedir: opts.cwd});
if (modulepath) {
resolveCache[name] = modulepath;
return modulepath;
}
} catch (err) {}
}
var filepath = find.resolveModule(name, opts);

@@ -315,3 +359,3 @@ if (!utils.exists(filepath)) return;

try {
var modulepath = utils.resolve.sync(filepath);
modulepath = utils.resolve.sync(filepath);
if (modulepath) {

@@ -338,2 +382,3 @@ resolveCache[name] = modulepath;

utils.tryRequire = function(name, options) {
var opts = utils.extend({}, options);
var fn;

@@ -345,4 +390,6 @@

var filepath = utils.tryResolve(name, opts);
if (!filepath) return;
try {
fn = require(name);
fn = require(filepath);
if (fn) return (requireCache[name] = fn);

@@ -353,6 +400,4 @@ } catch (err) {

var filepath = utils.tryResolve(name, options);
if (!filepath) return;
try {
fn = require(filepath);
fn = require(name);
if (fn) return (requireCache[name] = fn);

@@ -359,0 +404,0 @@ } catch (err) {

21

package.json
{
"name": "generator-util",
"description": "Utils for `generate` generators.",
"version": "0.2.6",
"version": "0.2.7",
"homepage": "https://github.com/jonschlinkert/generator-util",

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

"resolve": "^1.1.7",
"resolve-dir": "^0.1.0",
"try-open": "^0.1.0"

@@ -55,11 +56,3 @@ },

],
"lintDeps": {
"ignore": []
},
"verb": {
"toc": true,
"layout": "default",
"plugins": [
"gulp-format-md"
],
"related": {

@@ -75,4 +68,12 @@ "list": [

]
}
},
"toc": true,
"layout": "default",
"plugins": [
"gulp-format-md"
]
},
"lintDeps": {
"ignore": []
}
}
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