Socket
Socket
Sign inDemoInstall

yu-node

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yu-node - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

2

index.d.ts

@@ -5,3 +5,3 @@ // emptyDir,rmDir,getAllFiles,request,session,token

declare function rmDir(dirPath:string):boolean;
declare function getAllFiles(dirPath:string, recursion?:boolean):string[];
declare function getAllFiles(dirPath:string, ext?:string ,recursion?:boolean):string[];
declare function request(url:string,options:Object):Promise<Object>;

@@ -8,0 +8,0 @@ declare function session(options:Object):(ctx:any,next:Function)=>Promise<any>;

const fs = require('fs');
const path = require('path');
const { getType } = require('yu-util');
exports.getAllFiles = (dirPath, recursion=true) => {
exports.getAllFiles = (dirPath, ext, recursion=true) => {
getType(ext)==='Boolean' && (recursion = ext);
ext = getType(ext)==='String' ? ext : '*';
let arr = [];

@@ -19,3 +22,5 @@ const bool = fs.existsSync(dirPath); //判断目录是否存在

}else{
arr.push(child);
let file = path.parse(dirent.name);
let bool = (ext==='*' || file.ext==='.'+ext) ? true :false;
bool && arr.push(child);
}

@@ -22,0 +27,0 @@ });

{
"name": "yu-node",
"version": "1.1.2",
"version": "1.1.3",
"description": "仅用于node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

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