New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

conversikit

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conversikit - npm Package Compare versions

Comparing version 1.7.2 to 1.7.3

67

index.js

@@ -1,50 +0,3 @@

const toConvertArrayJson = async (value) => {
try {
if (typeof value != "object" || value.length === 0) {
return {};
}
let finalJson = {};
for (let i = 0; i < value.length; i++) {
if (finalJson.hasOwnProperty(value[i])) {
finalJson[`d_${value[i]}`] = value[++i] || '';
continue;
}
finalJson[value[i]] = value[++i] || '';
}
return finalJson;
} catch (error) {
return {};
}
}
let data = [
"name", "Ankit",
"roll", "10",
"age", "17",
"gender", "Male",
"address", "123 Main Street",
"city", "Exampleville",
"state", "ABC",
"zipcode", "12345",
"email", "ankit@example.com",
"phone", "555-555-5555",
"parent_name", "Parent Name",
"parent_phone", "555-555-5556",
"parent_email", "parent@example.com",
"guardian_name", "Guardian Name",
"guardian_phone", "555-555-5557",
"guardian_email", "guardian@example.com",
"emergency_contact", "Emergency Contact",
"emergency_phone", "555-555-5558",
"emergency_relationship", "Relative",
"class", "10th Grade",
"section", "A",
"school", "Random High School"
]
console.log("data == ", toConvertArrayJson(data));
module.exports = {

@@ -110,3 +63,23 @@ toConvertUpperCase: async (value) => {

}
},
toConvertJsonArray: async (value) => {
try {
let key = Object.keys(value);
let allData = [];
//convert into array format
for (let i = 0; i < key.length; i++) {
allData.push(key[i]);
allData.push(value[key[i]])
}
return allData
} catch (error) {
console.log("error = ", error.message);
return [];
}
}
}
{
"name": "conversikit",
"version": "1.7.2",
"version": "1.7.3",
"description": "convert anything",

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

@@ -13,2 +13,4 @@ # conversikit

<b>toConvertJsonArray(array) :-</b> Convert a Json to array format.
<h1>Example</h1>

@@ -121,2 +123,24 @@

</code>
<h1> Convert JSON to Array</h1>
<code>
const conversikit = require('conversikit');
let data = { "name": "arun", "email": "iit1.pradhan3517@gmail.com" }
let data = await conversikit.toConvertJsonArray(data);
console.log("Result = ",data);
</code>
<h5>Output ---></h5>
<code>
Result = [ 'name', 'arun', 'email', 'iit1.pradhan3517@gmail.com' ]
</code>
<center><h1>Thank You</h1></center>
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