New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

direct-algorithm

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

direct-algorithm - npm Package Compare versions

Comparing version
0.0.1
to
0.0.2
+15
copyDir.js
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;