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

packpath

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

packpath - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

.npmignore

6

CHANGELOG.md

@@ -0,3 +1,9 @@

0.1.0 / 2013-01-29
------------------
* Updated dev deps.
* Changed 4 spaces to 2.
* Clean up.
0.0.1 / 2012-08-02
------------------
* Initial release

42

lib/packpath.js

@@ -5,35 +5,31 @@ var fs = require('fs')

if (typeof fs.existsSync === 'undefined'){
fs.existsSync = path.existsSync; //make Node v0.4 -> v0.8 compatible
}
if (typeof fs.existsSync === 'undefined')
fs.existsSync = path.existsSync; //make Node v0.4 -> v0.8 compatible
function packageFind(paths) {
var foundDir = null, dir = null;
if (!paths) return null;
if (paths) {
for (var i = 0; i < paths.length; ++i){
dir = path.dirname(paths[i]);
if (fs.existsSync(path.join(dir, 'package.json'))){
foundDir = dir;
break;
}
}
}
return foundDir;
for (var i = 0; i < paths.length; ++i){
var dir = path.dirname(paths[i]);
if (fs.existsSync(path.join(dir, 'package.json')))
return dir;
}
return null;
}
module.exports.self = function() {
if (selfModule)
return packageFind(selfModule.paths);
else
return null;
if (selfModule)
return packageFind(selfModule.paths);
else
return null;
}
module.exports.parent = function() {
if (selfModule.parent)
return packageFind(selfModule.parent.paths);
else
return null;
if (selfModule.parent)
return packageFind(selfModule.parent.paths);
else
return null
}
{
"name" : "packpath",
"version" : "0.0.1",
"description" : "Find the path(s) package.json.",
"homepage" : [
"https://github.com/jprichardson/node-packpath"
],
"repository" : {
"type" : "git",
"url" : "https://github.com/jprichardson/node-packpath"
},
"keywords" : ["require", "package", "path", "resolve", "package.json"],
"author" : "JP Richardson <jprichardson@gmail.com>",
"licenses" : [ {
"type" : "MIT",
"url" : "http://github.com/jprichardson/node-packpath/raw/master/LICENSE"
}],
"devDepdencies":{
"mocha": "1.3.x"
},
"main" : "./lib/packpath",
"scripts": {
"test": "mocha test"
"name": "packpath",
"version": "0.1.0",
"description": "Find the path(s) package.json.",
"homepage": [
"https://github.com/jprichardson/node-packpath"
],
"repository": {
"type": "git",
"url": "https://github.com/jprichardson/node-packpath"
},
"keywords": [
"require",
"package",
"path",
"resolve",
"package.json",
"find"
],
"author": "JP Richardson <jprichardson@gmail.com>",
"licenses": [
{
"type": "MIT",
"url": "http://github.com/jprichardson/node-packpath/raw/master/LICENSE"
}
}
],
"devDepdencies": {
"mocha": "*"
},
"main": "./lib/packpath",
"scripts": {
"test": "mocha test"
},
"devDependencies": {
"testutil": "~0.4.0"
}
}

@@ -1,23 +0,21 @@

var assert = require('assert');
var faux_module_parent = require('faux-module-parent');
var testutil = require('testutil')
, faux_module_parent = require('faux-module-parent');
var T = function(expr) { assert(expr); }
describe('packpath', function(){
describe('+ self()', function(){
it('should return the directory of the package.json for faux-module-self', function(){
//console.log(faux_module_parent.self());
//console.log(faux_module_parent.selfFromPackPath());
T(faux_module_parent.self() === faux_module_parent.selfFromPackPath());
});
});
describe('+ self()', function(){
it('should return the directory of the package.json for faux-module-self', function(){
//console.log(faux_module_parent.self());
//console.log(faux_module_parent.selfFromPackPath());
EQ (faux_module_parent.self(), faux_module_parent.selfFromPackPath())
})
})
describe('+ parent()', function(){
it('should return the directory of the package.json for faux-module-parent', function(){
//console.log(faux_module_parent.parent());
//console.log(faux_module_parent.parentFromPackPath());
T(faux_module_parent.parent() === faux_module_parent.parentFromPackPath());
});
});
});
describe('+ parent()', function(){
it('should return the directory of the package.json for faux-module-parent', function(){
//console.log(faux_module_parent.parent());
//console.log(faux_module_parent.parentFromPackPath());
EQ (faux_module_parent.parent(), faux_module_parent.parentFromPackPath())
})
})
})
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