Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
db1d2acb47 | |||
920552ea23 | |||
dd05708f28 | |||
d97abe443d |
4
.snyk
Normal file
4
.snyk
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||||
|
version: v1.13.1
|
||||||
|
ignore: {}
|
||||||
|
patch: {}
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartfile",
|
"name": "@pushrocks/smartfile",
|
||||||
"version": "6.0.9",
|
"version": "6.0.11",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartfile",
|
"name": "@pushrocks/smartfile",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "6.0.9",
|
"version": "6.0.11",
|
||||||
"description": "offers smart ways to work with files in nodejs",
|
"description": "offers smart ways to work with files in nodejs",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
|
@ -257,16 +257,9 @@ export let toVinylSync = function(filePathArg, options = {}) {
|
|||||||
* lists Folders in a directory on local disk
|
* lists Folders in a directory on local disk
|
||||||
* @returns Promise with an array that contains the folder names
|
* @returns Promise with an array that contains the folder names
|
||||||
*/
|
*/
|
||||||
export let listFolders = function(pathArg: string, regexFilter?: RegExp): Promise<string[]> {
|
export let listFolders = (pathArg: string, regexFilter?: RegExp): Promise<string[]> => {
|
||||||
let done = plugins.smartpromise.defer<string[]>();
|
const done = plugins.smartpromise.defer<string[]>();
|
||||||
let folderArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
const folderArray = listFoldersSync(pathArg, regexFilter);
|
||||||
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
|
||||||
});
|
|
||||||
if (regexFilter) {
|
|
||||||
folderArray = folderArray.filter(fileItem => {
|
|
||||||
return regexFilter.test(fileItem);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
done.resolve(folderArray);
|
done.resolve(folderArray);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
@ -275,8 +268,8 @@ export let listFolders = function(pathArg: string, regexFilter?: RegExp): Promis
|
|||||||
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
* @returns an array with the folder names as strings
|
* @returns an array with the folder names as strings
|
||||||
*/
|
*/
|
||||||
export let listFoldersSync = function(pathArg: string, regexFilter?: RegExp): string[] {
|
export let listFoldersSync = (pathArg: string, regexFilter?: RegExp): string[] => {
|
||||||
let folderArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
let folderArray = plugins.fsExtra.readdirSync(pathArg).filter((file) => {
|
||||||
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||||
});
|
});
|
||||||
if (regexFilter) {
|
if (regexFilter) {
|
||||||
|
Reference in New Issue
Block a user