Socket
Socket
Sign inDemoInstall

ignorefs

Package Overview
Dependencies
Maintainers
1
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ignorefs - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3-next.1704144413.ef3666beaf99a7c1876fd301e5d2a6e24dd50676

59

edition-deno/index.ts

@@ -145,28 +145,4 @@ // builtin

/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(
path: Path | string,
opts: Options = {
ignoreUndesiredBasenames: true,
}
) {
// adjust path
if (typeof path === 'string') {
if (!path) throw new Error('ignorefs: path cannot be empty')
const result: Path = {}
if (isAbsolute(path)) result.absolutePath = path
else result.relativePath = path
result.basename = getBasename(path)
path = result
} else {
// verify
if (path.absolutePath && !isAbsolute(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path')
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path')
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename')
}
// handle deprecations
/** Verify options and upgrade deprecations, returns dereferenced copy */
export function upgradeOptions(opts: Options): Options {
opts = Object.assign({}, opts)

@@ -220,5 +196,32 @@ if (opts.ignoreHiddenFiles != null) {

}
return opts
}
// return result
return isIgnoredPath(path, opts)
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(
path: Path | string,
opts: Options = {
ignoreUndesiredBasenames: true,
}
) {
// adjust path
if (typeof path === 'string') {
if (!path) throw new Error('ignorefs: path cannot be empty')
const result: Path = {}
if (isAbsolute(path)) result.absolutePath = path
else result.relativePath = path
result.basename = getBasename(path)
path = result
} else {
// verify
if (path.absolutePath && !isAbsolute(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path')
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path')
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename')
}
// upgrade options and return result from modern api
return isIgnoredPath(path, upgradeOptions(opts))
}

@@ -84,28 +84,4 @@ // builtin

}
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(path, opts = {
ignoreUndesiredBasenames: true,
}) {
// adjust path
if (typeof path === 'string') {
if (!path)
throw new Error('ignorefs: path cannot be empty');
const result = {};
if (isAbsolute(path))
result.absolutePath = path;
else
result.relativePath = path;
result.basename = getBasename(path);
path = result;
}
else {
// verify
if (path.absolutePath && !isAbsolute(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path');
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path');
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename');
}
// handle deprecations
/** Verify options and upgrade deprecations, returns dereferenced copy */
export function upgradeOptions(opts) {
opts = Object.assign({}, opts);

@@ -147,4 +123,31 @@ if (opts.ignoreHiddenFiles != null) {

}
// return result
return isIgnoredPath(path, opts);
return opts;
}
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(path, opts = {
ignoreUndesiredBasenames: true,
}) {
// adjust path
if (typeof path === 'string') {
if (!path)
throw new Error('ignorefs: path cannot be empty');
const result = {};
if (isAbsolute(path))
result.absolutePath = path;
else
result.relativePath = path;
result.basename = getBasename(path);
path = result;
}
else {
// verify
if (path.absolutePath && !isAbsolute(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path');
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path');
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename');
}
// upgrade options and return result from modern api
return isIgnoredPath(path, upgradeOptions(opts));
}

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.isIgnoredPath = void 0;
exports.upgradeOptions = exports.isIgnoredPath = void 0;
// builtin

@@ -92,28 +92,4 @@ const path_1 = require("path");

exports.isIgnoredPath = isIgnoredPath;
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
function isIgnoredPathCompatibility(path, opts = {
ignoreUndesiredBasenames: true,
}) {
// adjust path
if (typeof path === 'string') {
if (!path)
throw new Error('ignorefs: path cannot be empty');
const result = {};
if ((0, path_1.isAbsolute)(path))
result.absolutePath = path;
else
result.relativePath = path;
result.basename = (0, path_1.basename)(path);
path = result;
}
else {
// verify
if (path.absolutePath && !(0, path_1.isAbsolute)(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path');
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path');
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename');
}
// handle deprecations
/** Verify options and upgrade deprecations, returns dereferenced copy */
function upgradeOptions(opts) {
opts = Object.assign({}, opts);

@@ -155,5 +131,33 @@ if (opts.ignoreHiddenFiles != null) {

}
// return result
return isIgnoredPath(path, opts);
return opts;
}
exports.upgradeOptions = upgradeOptions;
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
function isIgnoredPathCompatibility(path, opts = {
ignoreUndesiredBasenames: true,
}) {
// adjust path
if (typeof path === 'string') {
if (!path)
throw new Error('ignorefs: path cannot be empty');
const result = {};
if ((0, path_1.isAbsolute)(path))
result.absolutePath = path;
else
result.relativePath = path;
result.basename = (0, path_1.basename)(path);
path = result;
}
else {
// verify
if (path.absolutePath && !(0, path_1.isAbsolute)(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path');
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path');
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename');
}
// upgrade options and return result from modern api
return isIgnoredPath(path, upgradeOptions(opts));
}
exports.default = isIgnoredPathCompatibility;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.isIgnoredPath = void 0;
exports.upgradeOptions = exports.isIgnoredPath = void 0;
// builtin

@@ -141,29 +141,4 @@ var path_1 = require("path");

exports.isIgnoredPath = isIgnoredPath;
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
function isIgnoredPathCompatibility(path, opts) {
if (opts === void 0) { opts = {
ignoreUndesiredBasenames: true,
}; }
// adjust path
if (typeof path === 'string') {
if (!path)
throw new Error('ignorefs: path cannot be empty');
var result = {};
if ((0, path_1.isAbsolute)(path))
result.absolutePath = path;
else
result.relativePath = path;
result.basename = (0, path_1.basename)(path);
path = result;
}
else {
// verify
if (path.absolutePath && !(0, path_1.isAbsolute)(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path');
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path');
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename');
}
// handle deprecations
/** Verify options and upgrade deprecations, returns dereferenced copy */
function upgradeOptions(opts) {
opts = Object.assign({}, opts);

@@ -202,5 +177,34 @@ if (opts.ignoreHiddenFiles != null) {

}
// return result
return isIgnoredPath(path, opts);
return opts;
}
exports.upgradeOptions = upgradeOptions;
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
function isIgnoredPathCompatibility(path, opts) {
if (opts === void 0) { opts = {
ignoreUndesiredBasenames: true,
}; }
// adjust path
if (typeof path === 'string') {
if (!path)
throw new Error('ignorefs: path cannot be empty');
var result = {};
if ((0, path_1.isAbsolute)(path))
result.absolutePath = path;
else
result.relativePath = path;
result.basename = (0, path_1.basename)(path);
path = result;
}
else {
// verify
if (path.absolutePath && !(0, path_1.isAbsolute)(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path');
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path');
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename');
}
// upgrade options and return result from modern api
return isIgnoredPath(path, upgradeOptions(opts));
}
exports.default = isIgnoredPathCompatibility;

@@ -35,4 +35,6 @@ /** A path to check its ignore status */

export declare function isIgnoredPath(path: Path, opts?: Options): boolean;
/** Verify options and upgrade deprecations, returns dereferenced copy */
export declare function upgradeOptions(opts: Options): Options;
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(path: Path | string, opts?: Options): boolean;
//# sourceMappingURL=index.d.ts.map
{
"title": "IgnoreFS",
"name": "ignorefs",
"version": "5.0.2",
"version": "5.0.3-next.1704144413.ef3666beaf99a7c1876fd301e5d2a6e24dd50676",
"license": "Artistic-2.0",

@@ -6,0 +6,0 @@ "description": "Ignore common and custom patterns of the file system",

@@ -51,3 +51,3 @@ <!-- TITLE/ -->

``` typescript
import * as pkg from 'https://unpkg.com/ignorefs@^5.0.2/edition-deno/index.ts'
import * as pkg from 'https://unpkg.com/ignorefs@^5.0.3/edition-deno/index.ts'
```

@@ -54,0 +54,0 @@ ### [Editions](https://editions.bevry.me "Editions are the best way to produce and consume packages you care about.")

@@ -145,28 +145,4 @@ // builtin

/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(
path: Path | string,
opts: Options = {
ignoreUndesiredBasenames: true,
}
) {
// adjust path
if (typeof path === 'string') {
if (!path) throw new Error('ignorefs: path cannot be empty')
const result: Path = {}
if (isAbsolute(path)) result.absolutePath = path
else result.relativePath = path
result.basename = getBasename(path)
path = result
} else {
// verify
if (path.absolutePath && !isAbsolute(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path')
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path')
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename')
}
// handle deprecations
/** Verify options and upgrade deprecations, returns dereferenced copy */
export function upgradeOptions(opts: Options): Options {
opts = Object.assign({}, opts)

@@ -220,5 +196,32 @@ if (opts.ignoreHiddenFiles != null) {

}
return opts
}
// return result
return isIgnoredPath(path, opts)
/** Compatibility wrapper for {@link isIgnoredPath}, supporting path string, verifying path object and options, and handling option deprecations */
export default function isIgnoredPathCompatibility(
path: Path | string,
opts: Options = {
ignoreUndesiredBasenames: true,
}
) {
// adjust path
if (typeof path === 'string') {
if (!path) throw new Error('ignorefs: path cannot be empty')
const result: Path = {}
if (isAbsolute(path)) result.absolutePath = path
else result.relativePath = path
result.basename = getBasename(path)
path = result
} else {
// verify
if (path.absolutePath && !isAbsolute(path.absolutePath))
throw new Error('ignorefs: path.absolutePath must be an absolute path')
if (path.relativePath && !isRelative(path.relativePath))
throw new Error('ignorefs: path.relativePath must be a relative path')
if (path.basename && !isBasename(path.basename))
throw new Error('ignorefs: path.basename must be a basename')
}
// upgrade options and return result from modern api
return isIgnoredPath(path, upgradeOptions(opts))
}

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