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

autoresolve

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autoresolve - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

4

CHANGELOG.md

@@ -0,3 +1,7 @@

0.0.2 / 2012-07-17
------------------
* Bug fix: error if an absolute directory was passed in.
0.0.1 / 2012-07-17
------------------
* Inital release.

6

lib/autoresolve.js

@@ -8,3 +8,5 @@ var fs = require('fs'),

module.exports = function(package) {
module.exports = function(packagePath) {
if (packagePath.indexOf('.') === 0 || packagePath.indexOf('/') === 0)
return packagePath;
var DIR = process.cwd();

@@ -28,4 +30,4 @@ var found = false;

//console.log(DIR);
return path.join(DIR, package);
return path.join(DIR, packagePath);
}
{
"name" : "autoresolve",
"version" : "0.0.1",
"version" : "0.0.2",
"description" : "A simple module to auto resolve module paths.",

@@ -5,0 +5,0 @@ "homepage" : [

@@ -10,2 +10,3 @@ Node.js - autoresolve

var somepack = require(path.join(process.cwd(), 'lib/models/customer'));
```

@@ -12,0 +13,0 @@ Installation

var assert = require('assert'),
P = require('../lib/autoresolve');
P = require('../lib/autoresolve'),
fs = require('fs');

@@ -7,6 +8,21 @@ var T = function(expr) { assert(expr); };

describe('+ P()', function(){
it("should return the proper path.", function(){
it("should return the proper relative path.", function(){
var customer = require(P('lib/models/customer'));
T(customer.getName() === 'JP');
});
it ("should return the absolute path.", function(done){
var path = P('lib/models/customer.js');
var fdr = fs.createReadStream(path);
var fdw = fs.createWriteStream('/tmp/customer.js');
fdr.on('end', function(){
var customer = require(P('/tmp/customer'));
fs.unlinkSync('/tmp/customer.js');
T(customer.getName() === 'JP');
done();
});
fdr.pipe(fdw);
})
});
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