direct-algorithm
Advanced tools
+15
| const fs = require("fs"); | ||
| module.exports = function copyDir( src , dest , path ){ | ||
| const files = fs.readdirSync( src ); | ||
| for( let i = 0 ; i < files.length ; i++ ){ | ||
| if( fs.statSync( src + "/" + files[i] ).isDirectory() ){ | ||
| fs.mkdirSync( dest + "/" + files[i] ); | ||
| console.log( "created " + path + "/" + files[i] ); | ||
| copyDir( src + "/" + files[i] , dest + "/" + files[i] , path + "/" + files[i] ); | ||
| } | ||
| else { | ||
| fs.copyFileSync( src + "/" + files[i] , dest + "/" + files[i] ); | ||
| console.log( "created " + path + "/" + files[i] ); | ||
| } | ||
| } | ||
| } |
+3
-7
| { | ||
| "name": "direct-algorithm", | ||
| "version": "0.0.1", | ||
| "description": "\"algorithm libary of Direct.js\"", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "version": "0.0.2", | ||
| "description": "algorithm libary of Direct.js", | ||
| "keywords": [ | ||
| "\"algorithm\"" | ||
| "" | ||
| ], | ||
@@ -12,0 +8,0 @@ "author": "Eric Deng", |
| function jsonToUrlencoded( json ){ | ||
| if( Object.keys( json ).length === 0 ){ | ||
| return ""; | ||
| } | ||
| var jsonString = JSON.stringify( json ); | ||
| jsonString = jsonString.slice( 1 , jsonString.length - 1 ); | ||
| var jsonArray = jsonString.split(','); | ||
| var resString = ""; | ||
| for( var i = 0 ; i < jsonArray.length - 1; i ++ ){ | ||
| var [ key , value ] = jsonArray[i].split(':'); | ||
| key = key.slice( 1 , key.length -1 ); | ||
| if( value[0] === '"' ){ | ||
| value = value.slice( 1 , value.length -1 ); | ||
| } | ||
| resString += `${key}=${value}&`; | ||
| } | ||
| var [ key , value ] = jsonArray[i].split(':'); | ||
| key = key.slice( 1 , key.length -1 ); | ||
| if( value[0] === '"' ){ | ||
| value = value.slice( 1 , value.length - 1); | ||
| } | ||
| resString += `${key}=${value}`; | ||
| return resString; | ||
| } | ||
| module.exports = jsonToUrlencoded; |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
2
-33.33%752
-30.95%15
-40%2
100%