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

walk-sync

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

walk-sync - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

4

CHANGELOG.md
# master
# 2.2.0
* add globOptions to provide the capability to configure string globs with all minimatch options passed to `globs` and `ignored`
# 2.1.0

@@ -4,0 +8,0 @@

3

index.d.ts
/// <reference types="node" />
import fsNode = require('fs');
import { IMinimatch } from 'minimatch';
import { IMinimatch, IOptions as MinimatchOptions } from 'minimatch';
declare type Optionalize<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;

@@ -15,2 +15,3 @@ declare function walkSync(baseDir: string, inputOptions?: Optionalize<walkSync.Options, 'fs'> | (string | IMinimatch)[]): string[];

fs: typeof fsNode;
globOptions?: MinimatchOptions;
}

@@ -17,0 +18,0 @@ class Entry {

@@ -6,2 +6,3 @@ 'use strict';

const path = require("path");
const minimatch_1 = require("minimatch");
function walkSync(baseDir, inputOptions) {

@@ -72,2 +73,10 @@ const options = handleOptions(inputOptions);

}
function applyGlobOptions(globs, options) {
return globs === null || globs === void 0 ? void 0 : globs.map(glob => {
if (typeof glob === 'string') {
return new minimatch_1.Minimatch(glob, options);
}
return glob;
});
}
function handleRelativePath(_relativePath) {

@@ -110,4 +119,5 @@ if (_relativePath == null) {

try {
const globs = options.globs;
const ignorePatterns = options.ignore;
const globOptions = options.globOptions;
const ignorePatterns = (isDefined(globOptions)) ? applyGlobOptions(options.ignore, globOptions) : options.ignore;
const globs = (isDefined(globOptions)) ? applyGlobOptions(options.globs, globOptions) : options.globs;
let globMatcher;

@@ -114,0 +124,0 @@ let ignoreMatcher;

{
"name": "walk-sync",
"description": "Get an array of recursive directory contents",
"version": "2.1.0",
"version": "2.2.0",
"author": "Jo Liss <joliss42@gmail.com>",

@@ -23,3 +23,4 @@ "main": "index.js",

"ensure-posix-path": "^1.1.0",
"matcher-collection": "^2.0.0"
"matcher-collection": "^2.0.0",
"minimatch": "^3.0.4"
},

@@ -26,0 +27,0 @@ "devDependencies": {

@@ -90,2 +90,6 @@ # node-walk-sync

As an alternative to string globs, you can pass an array of precompiled
[`minimatch.Minimatch`](https://github.com/isaacs/minimatch#minimatch-class)
instances. This is faster and allows to specify your own globbing options.
* `includeBasePath` (default: false): Pass `true` to include the basePath in the output.

@@ -108,2 +112,6 @@ *note: this flag is only for `walkSync(..)` not `walkSync.entries(..)`*

```
* `globOptions`: Pass any options for [Minimatch](https://www.npmjs.com/package/minimatch) that will be applied to all items in `globs` and `ignore` that are strings.
If items in `globs` or `ignore` are instances of `minimatch.Minimatch`, the `globOptions` will not be applied.

@@ -110,0 +118,0 @@ ## Background

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