New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@purinton/path

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

@purinton/path - npm Package Compare versions

Comparing version
1.0.5
to
1.0.6
+5
-4
index.cjs

@@ -39,3 +39,3 @@ const { fileURLToPath } = require('url');

*/
function pathFn(metaOrDir, ...segments) {
const path = (metaOrDir, ...segments) => {
const dir = getCurrentDirname(metaOrDir);

@@ -46,7 +46,8 @@ if (!dir) {

return pathJoin(dir, ...segments);
}
};
module.exports = pathFn;
module.exports.default = pathFn;
module.exports = path;
module.exports.default = path;
module.exports.path = path;
module.exports.getCurrentFilename = getCurrentFilename;
module.exports.getCurrentDirname = getCurrentDirname;

@@ -25,5 +25,7 @@ /**

*/
export default function path(
export const path: (
metaOrDir: ImportMeta | string,
...segments: string[]
): string;
) => string;
export default path;

@@ -39,3 +39,3 @@ import { fileURLToPath } from 'url';

*/
export default function path(metaOrDir, ...segments) {
const path = (metaOrDir, ...segments) => {
const dir = getCurrentDirname(metaOrDir);

@@ -46,2 +46,5 @@ if (!dir) {

return pathJoin(dir, ...segments);
}
};
export default path;
export { path };
{
"name": "@purinton/path",
"type": "module",
"version": "1.0.5",
"version": "1.0.6",
"description": "An ESM/Jest friendly path utility.",

@@ -6,0 +6,0 @@ "main": "index.cjs",

+10
-12

@@ -39,13 +39,10 @@ # @purinton/path

You can pass either `import.meta` (recommended for ESM) or `__dirname` (if available) as the first argument:
```js
// Example for ESM (module JS) usage
// Import the path utility from the installed package
import path from '@purinton/path';
// or import { path } from '@purinton/path'; // identical
// Using import.meta (recommended for ESM)
// for ESM, we need to pass import.meta
const envFile = path(import.meta, ".env");
// Or, if __dirname is available (e.g. in some ESM environments)
// const envFile = path(__dirname, ".env");
console.log(envFile);

@@ -56,10 +53,10 @@ ```

CommonJS should pass `__dirname` as the first argument:
```js
// Example for CommonJS usage
// Import the path utility from the installed package
const path = require('@purinton/path');
// or const { path } = require('@purinton/path'); // identical
// Get the absolute path to a .env file in the same directory as this file
// for CommonJS, we need to pass __dirname
const envFile = path(__dirname, '.env');
console.log(envFile);

@@ -89,3 +86,4 @@ ```

export function getCurrentDirname(metaOrDir?: ImportMeta | string, dirnameFn?: (path: string) => string): string;
export default function path(metaOrDir: ImportMeta | string, ...segments: string[]): string;
export const path: (metaOrDir: ImportMeta | string, ...segments: string[]) => string;
export default path;
```

@@ -92,0 +90,0 @@