Socket
Socket
Sign inDemoInstall

fs-jetpack

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-jetpack - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

4

CHANGELOG.md

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

# 2.2.1 (2019-01-20)
- `find()` no longer crashes on ENOENT (e.g. when one of the files has been deleted by other process).
- Added check if a parameter `newName` passed to `rename()` isn't a path.
# 2.2.0 (2018-10-13)

@@ -2,0 +6,0 @@ - Added ignoreCase option to `find()` and `copy()` methods.

9

lib/find.js

@@ -86,3 +86,3 @@ "use strict";

(itemPath, item) => {
if (itemPath !== path && matchesAnyOfGlobs(itemPath)) {
if (item && itemPath !== path && matchesAnyOfGlobs(itemPath)) {
if (

@@ -140,3 +140,8 @@ (item.type === "file" && options.files === true) ||

const data = walker.read();
if (data && data.path !== path && matchesAnyOfGlobs(data.path)) {
if (
data &&
data.item &&
data.path !== path &&
matchesAnyOfGlobs(data.path)
) {
const item = data.item;

@@ -143,0 +148,0 @@ if (

@@ -11,2 +11,8 @@ "use strict";

validate.argument(methodSignature, "newName", newName, ["string"]);
if (pathUtil.basename(newName) !== newName) {
throw new Error(
`Argument "newName" passed to ${methodSignature} should be a filename, not a path. Received "${newName}"`
);
}
};

@@ -13,0 +19,0 @@

{
"name": "fs-jetpack",
"description": "Better file system API",
"version": "2.2.0",
"version": "2.2.1",
"author": "Jakub Szwacz <jakub@szwacz.com>",

@@ -6,0 +6,0 @@ "dependencies": {

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

import * as pathUtil from "path";
import * as fse from "fs-extra";

@@ -113,15 +114,32 @@ import { expect } from "chai";

describe('"newName" argument', () => {
tests.forEach(test => {
it(test.type, () => {
expect(() => {
test.method("abc", undefined);
}).to.throw(
`Argument "newName" passed to ${
test.methodName
}(path, newName) must be a string. Received undefined`
);
describe("type check", () => {
tests.forEach(test => {
it(test.type, () => {
expect(() => {
test.method("abc", undefined);
}).to.throw(
`Argument "newName" passed to ${
test.methodName
}(path, newName) must be a string. Received undefined`
);
});
});
});
describe("shouldn't be path, just a filename", () => {
const pathToTest = pathUtil.join("new-name", "with-a-slash");
tests.forEach(test => {
it(test.type, () => {
expect(() => {
test.method("abc", pathToTest);
}).to.throw(
`Argument "newName" passed to ${
test.methodName
}(path, newName) should be a filename, not a path. Received "${pathToTest}"`
);
});
});
});
});
});
});
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