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

@ms-cloudpack/path-utilities

Package Overview
Dependencies
Maintainers
2
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/path-utilities - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

lib/isFileSync.d.ts

17

CHANGELOG.json

@@ -5,3 +5,18 @@ {

{
"date": "Tue, 15 Nov 2022 08:12:36 GMT",
"date": "Sat, 03 Dec 2022 08:10:22 GMT",
"tag": "@ms-cloudpack/path-utilities_v2.0.0",
"version": "2.0.0",
"comments": {
"major": [
{
"author": "dake.3601@gmail.com",
"package": "@ms-cloudpack/path-utilities",
"commit": "9fae6cbdb788baac8236abc9eb44eb1d3296b7e0",
"comment": "Changed name from isFile and isFolder to specify sync and added async versions"
}
]
}
},
{
"date": "Tue, 15 Nov 2022 08:13:12 GMT",
"tag": "@ms-cloudpack/path-utilities_v1.1.1",

@@ -8,0 +23,0 @@ "version": "1.1.1",

# Change Log - @ms-cloudpack/path-utilities
This log was last generated on Tue, 15 Nov 2022 08:12:36 GMT and should not be manually modified.
This log was last generated on Sat, 03 Dec 2022 08:10:22 GMT and should not be manually modified.
<!-- Start content -->
## 2.0.0
Sat, 03 Dec 2022 08:10:22 GMT
### Major changes
- Changed name from isFile and isFolder to specify sync and added async versions (dake.3601@gmail.com)
## 1.1.1
Tue, 15 Nov 2022 08:12:36 GMT
Tue, 15 Nov 2022 08:13:12 GMT

@@ -11,0 +19,0 @@ ### Patches

export { intermediateToSourcePath } from './intermediateToSourcePath.js';
export { isFileSync } from './isFileSync.js';
export { isFile } from './isFile.js';
export { isFolderSync } from './isFolderSync.js';
export { isFolder } from './isFolder.js';

@@ -4,0 +6,0 @@ export { sourceToIntermediatePath } from './sourceToIntermediatePath.js';

export { intermediateToSourcePath } from './intermediateToSourcePath.js';
export { isFileSync } from './isFileSync.js';
export { isFile } from './isFile.js';
export { isFolderSync } from './isFolderSync.js';
export { isFolder } from './isFolder.js';

@@ -4,0 +6,0 @@ export { sourceToIntermediatePath } from './sourceToIntermediatePath.js';

4

lib/intermediateToSourcePath.js
import path from 'path';
import { isFile } from './isFile.js';
import { isFileSync } from './isFileSync.js';
import { slash } from '@ms-cloudpack/path-string-parsing';

@@ -34,3 +34,3 @@ /**

const resolvedPath = path.resolve(rootPath, candidate);
return isFile(resolvedPath);
return isFileSync(resolvedPath);
});

@@ -37,0 +37,0 @@ // Re-add the leading period.

@@ -1,1 +0,1 @@

export declare function isFile(filePath: string): boolean;
export declare function isFile(filePath: string): Promise<boolean>;

@@ -1,5 +0,5 @@

import { lstatSync } from 'fs';
export function isFile(filePath) {
import fs from 'fs';
export async function isFile(filePath) {
try {
const stat = lstatSync(filePath);
const stat = await fs.promises.stat(filePath);
return stat.isFile();

@@ -6,0 +6,0 @@ }

@@ -6,12 +6,12 @@ import { describe, it, expect } from '@jest/globals';

describe('isFile', () => {
it('returns true on a file', () => {
expect(isFile(filePath)).toBeTruthy();
it('returns true on a file', async () => {
expect(await isFile(filePath)).toBeTruthy();
});
it('returns false on a folder', () => {
expect(isFile(folderPath)).toBeFalsy();
it('returns false on a folder', async () => {
expect(await isFile(folderPath)).toBeFalsy();
});
it('returns false on a missing file', () => {
expect(isFile(path.join(folderPath, 'does-not-exist.txt'))).toBeFalsy();
it('returns false on a missing file', async () => {
expect(await isFile(path.join(folderPath, 'does-not-exist.txt'))).toBeFalsy();
});
});
//# sourceMappingURL=isFile.test.js.map

@@ -1,1 +0,1 @@

export declare function isFolder(itemPath: string): boolean;
export declare function isFolder(itemPath: string): Promise<boolean>;
import fs from 'fs';
export function isFolder(itemPath) {
export async function isFolder(itemPath) {
try {
return fs.lstatSync(itemPath)?.isDirectory();
const stat = await fs.promises.stat(itemPath);
return stat.isDirectory();
}

@@ -6,0 +7,0 @@ catch (e) {

@@ -6,12 +6,12 @@ import { describe, it, expect } from '@jest/globals';

describe('isFolder', () => {
it('returns true on a folder', () => {
expect(isFolder(folderPath)).toBeTruthy();
it('returns true on a folder', async () => {
expect(await isFolder(folderPath)).toBeTruthy();
});
it('returns false on a file', () => {
expect(isFolder(path.join(filePath, '../package.json'))).toBeFalsy();
it('returns false on a file', async () => {
expect(await isFolder(path.join(filePath, '../package.json'))).toBeFalsy();
});
it('returns false on a missing file', () => {
expect(isFolder(path.join(folderPath, 'does-not-exist.txt'))).toBeFalsy();
it('returns false on a missing file', async () => {
expect(await isFolder(path.join(folderPath, 'does-not-exist.txt'))).toBeFalsy();
});
});
//# sourceMappingURL=isFolder.test.js.map
{
"name": "@ms-cloudpack/path-utilities",
"version": "1.1.1",
"version": "2.0.0",
"description": "Utilities for resolving paths between source/intermediate/output locations in Cloudpack.",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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