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

relative

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relative - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

17

index.js
'use strict';
var isObject = require('isobject');
var path = require('path');

@@ -42,4 +43,4 @@ var fs = require('fs');

a = normalize(a);
b = normalize(b);
a = unixify(a);
b = unixify(b);

@@ -72,4 +73,4 @@ // if `a` had a slash, add it back

relative.toBase = function toBase(base, fp) {
base = normalize(base);
fp = normalize(fp);
base = unixify(base);
fp = unixify(fp);

@@ -84,3 +85,3 @@ var res = fp.slice(base.length);

/**
* Normalize slashes in paths. This is necessary b/c
* Normalize slashes in paths to unix slashes. This is necessary since
* paths are not calculated the same by node.js when

@@ -90,3 +91,3 @@ * windows paths are used.

function normalize(str) {
function unixify(str) {
return str.replace(/[\\\/]+/g, '/');

@@ -145,3 +146,3 @@ }

if (stat != null && typeof stat === 'object') {
if (isObject(stat) && typeof stat.isDirectory === 'function') {
return stat.isDirectory();

@@ -168,2 +169,2 @@ }

return !isDir(fp, stat);
}
}
{
"name": "relative",
"description": "Get the relative filepath from path A to path B. Calculates from file-to-directory, file-to-file, directory-to-file, and directory-to-directory.",
"version": "3.0.1",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"version": "3.0.2",
"homepage": "https://github.com/jonschlinkert/relative",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"repository": "jonschlinkert/relative",

@@ -24,5 +22,8 @@ "bugs": {

},
"dependencies": {
"isobject": "^2.0.0"
},
"devDependencies": {
"mocha": "^2.1.0",
"should": "^5.0.0"
"mocha": "*",
"should": "*"
},

@@ -40,3 +41,15 @@ "keywords": [

"resolve"
]
}
],
"verb": {
"related": {
"list": [
"cwd",
"export-files",
"is-absolute",
"is-relative",
"is-dotfile",
"global-prefix"
]
}
}
}
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