npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

conversikit

v1.8.15

Published

convert anything

Downloads

42

Readme

CONVERSIKIT is a versatile JavaScript library that provides a wide range of functions for converting and transforming text and data. Whether you need to change letter casing, convert between different data formats, apply camel case formatting, or handle CSV and TSV data, CONVERSIKIT has you covered.

Overview

CONVERSIKIT is designed to simplify data processing and text manipulation tasks in your JavaScript projects. It offers a set of easy-to-use functions, each tailored for specific data transformation needs.

Features

  • Case Conversion: Easily convert text to uppercase, lowercase, or capitalize case to meet your formatting requirements.

  • JSON and Array Conversion: Seamlessly switch between JSON and array data structures, making data interchange more convenient.

  • Camel Case Formatting: Convert strings to camel case, a common practice in JavaScript coding.

  • CSV and TSV Handling: Efficiently work with CSV (Comma-Separated Values) and TSV (Tab-Separated Values) data, both for reading and writing.

Functions

toConvertUpperCase(string)

  • Converts all letters in the input string to uppercase.

toConvertLowerCase(string)

  • Converts all letters in the input string to lowercase.

toConvertCapitalizeCase(string)

  • Converts the input string into capitalize case.

toConvertArrayJson(array)

  • Converts an array to JSON format.

toConvertJsonArray(array)

  • Converts JSON data to an array format.

toConvertCamelCase(string)

  • Converts a string into camel case.

toConvertCSVFile(data, fileName)

  • Converts an array of JSON data into a CSV file.

toConvertCSVToJson(path)

  • Converts a CSV file into JSON format.

toConvertTSVToJson(path)

  • Converts a TSV (Tab-Separated Values) file into JSON format. This function is designed to take a path to a TSV file as its parameter and convert the content of the TSV file into a JSON format. It reads the TSV file, parses its contents, and returns the data as an array of JSON objects.

Examples

const conversikit = require("conversikit");

async function example() {
  const data = await conversikit.toConvertUpperCase("thank you my man"); // "THANK YOU MY MAN"
  const data1 = await conversikit.toConvertLowerCase("thank you my Man"); // "thank you my man"
  const data2 = await conversikit.toConvertCapitalizeCase("thank you my Man"); // "Thank You My Man"

  console.log(data);
  console.log(data1);
  console.log(data2);
}

example();

Convert Array to JSON

const conversikit = require("conversikit");

const data = [
  "name",
  "Ankit",
  "roll",
  "10",
  // ... (other key-value pairs)
];

const jsonData = await conversikit.toConvertArrayJson(data);
console.log("Result =", jsonData);

Output:

Result = {
  name: "Ankit",
  roll: "10",
  // ... (other key-value pairs)
};

Note: If duplicate keys are present in the array, they will be handled gracefully.

Convert String into Camel Case

const conversikit = require("conversikit");

const data = "thank you";
const data1 = "";
const data2 = "thank";
const data3 = "we are programmer";

const result = await conversikit.toConvertCamelCase(data); // "thankYou"
const result1 = await conversikit.toConvertCamelCase(data1); // ""
const result2 = await conversikit.toConvertCamelCase(data2); // "thank"
const result3 = await conversikit.toConvertCamelCase(data3); // "weAreProgrammer"

Convert Array JSON Data to CSV File

const conversikit = require("conversikit");

const data = [
  { name: "test1", age: 10 },
  { name: "test2", age: 30 },
  // ... (other objects)
];

const filename = "example.csv";
await conversikit.toConvertCSVFile(data, filename);

Convert CSV to JSON

const conversikit = require("conversikit");
const data = await conversikit.toConvertCSVToJson("give your file path name"); // e.g., "data.csv"

Output:

Result = [
  { name: 1, age: 10, dob: "12-08-1997" },
  { name: "thank", age: 90, dob: "12-09-1995" },
];

Convert TSV to JSON

const conversikit = require("conversikit");
const data = await conversikit.toConvertTSVToJson("give your file path name"); // e.g., "data.csv"

Name    Age   City
John    30    New York
Alice   25    Los Angeles
Bob     35    Chicago

Output:

Result = [
  {
    "Name": "John",
    "Age": "30",
    "City": "New York"
  },
  {
    "Name": "Alice",
    "Age": "25",
    "City": "Los Angeles"
  },
  {
    "Name": "Bob",
    "Age": "35",
    "City": "Chicago"
  }
];

Author

Arun Pradhan.

Other

Feel free to reach out for questions, feedback, or contributions.