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 🙏

© 2026 – Pkg Stats / Ryan Hefner

incognito-js-helper

v1.0.1

Published

A simple and flexible package that provides various string utilities including converting strings to uppercase, lowercase, and counting words.

Readme

Incognito Helper: My string and array utilities

A lightweight and powerful JavaScript utility library that provides over 50+ functions for working with strings and arrays.

📦 Installation

Install via npm:

npm install incognito-js-helper

🚀 Usage

Import the package in your JavaScript project:

const utils = require('incognito-js-helper');

🔹 String Functions

1️⃣ toUpperCase(str)

Converts a string to uppercase.

console.log(utils.toUpperCase("hello world"));  // "HELLO WORLD"

2️⃣ toLowerCase(str)

Converts a string to lowercase.

console.log(utils.toLowerCase("HELLO WORLD"));  // "hello world"

3️⃣ capitalize(str)

Capitalizes the first letter of a string.

console.log(utils.capitalize("hello"));  // "Hello"

4️⃣ reverseString(str)

Reverses the characters in a string.

console.log(utils.reverseString("hello"));  // "olleh"

5️⃣ removeWhitespace(str)

Removes leading and trailing whitespace from a string.

console.log(utils.removeWhitespace("  hello  "));  // "hello"

6️⃣ replaceAll(str, find, replace)

Replaces all occurrences of a substring.

console.log(utils.replaceAll("apple banana apple", "apple", "orange"));  // "orange banana orange"

7️⃣ countWords(str)

Counts the number of words in a string.

console.log(utils.countWords("Hello world!"));  // 2

8️⃣ contains(str, substr)

Checks if a string contains another substring.

console.log(utils.contains("hello world", "world"));  // true

9️⃣ truncate(str, length)

Truncates a string to a given length.

console.log(utils.truncate("Hello, this is a long text", 10));  // "Hello, thi..."

🔟 camelCase(str)

Converts a string to camelCase.

console.log(utils.camelCase("hello world"));  // "helloWorld"

🔹 explode(str, delimiter)

Splits a string into an array based on a delimiter.

console.log(utils.explode("apple,banana,grape", ","));  // ["apple", "banana", "grape"]

🔹 implode(arr, separator)

Joins an array into a single string.

console.log(utils.implode(["apple", "banana", "grape"], "-"));  // "apple-banana-grape"

🔹 startsWith(statement, word)

checks in string if it starts with the specified string

console.log(utils.startsWith("Hello, world!", "Hello")); // true

🔹 endsWith(statement, string)

checks in string if it ends with the specified string

console.log(arrayUtils.endsWith("Hello, world!", "world!")); // true

🔹 snakeCase(str)

Converts a string to snake_case.

console.log(arrayUtils.snakeCase("Hello World Example"));
// Output: "hello_world_example"

🔹 kebabCase(str)

Converts a string to kebab-case.

console.log(arrayUtils.kebabCase("Hello World Example"));
// Output: "hello-world-example"

🔹 randomString(str)

Generates a random alphanumeric string of the given length.

console.log(arrayUtils.randomString(10));
// Output: "aB3dE9fGhJ" (random output)

🔹 titleCase(str)

Converts a string to Title Case.

console.log(arrayUtils.titleCase("hello world example"));
// Output: "Hello World Example"

🔹 isPalindrome(str)

Checks if a string is a palindrome.

console.log(arrayUtils.isPalindrome("madam"));
// Output: true

console.log(arrayUtils.isPalindrome("hello"));
// Output: false

🔹 explode(delimiter, str)

Splits a string into an array based on the given delimiter.

console.log(arrayUtils.explode(",", "apple,banana,grape"));
// Output: ["apple", "banana", "grape"]

🔹 implode(delimiter, arr)

Joins an array into a string using the given delimiter.

console.log(arrayUtils.implode("-", ["apple", "banana", "grape"]));
// Output: "apple-banana-grape"

🔹 Array Functions

1️⃣ uniqueArray(arr)

Removes duplicate values from an array.

console.log(utils.uniqueArray([1, 2, 2, 3, 4, 4, 5]));  // [1, 2, 3, 4, 5]

2️⃣ flattenArray(arr)

Flattens a nested array.

console.log(utils.flattenArray([1, [2, [3, 4], 5]]));  // [1, 2, 3, 4, 5]

3️⃣ chunkArray(arr, size)

Splits an array into chunks of a given size.

console.log(utils.chunkArray([1, 2, 3, 4, 5], 2));  // [[1, 2], [3, 4], [5]]

4️⃣ shuffleArray(arr)

Randomly shuffles elements in an array.

console.log(utils.shuffleArray([1, 2, 3, 4, 5]));

5️⃣ arrayIntersection(arr1, arr2)

Finds common elements between two arrays.

console.log(utils.arrayIntersection([1, 2, 3], [2, 3, 4]));  // [2, 3]

6️⃣ arrayDifference(arr1, arr2)

Finds elements unique to the first array.

console.log(utils.arrayDifference([1, 2, 3], [2, 3, 4]));  // [1]

7️⃣ sortNumeric(arr)

Sorts an array of numbers in ascending order.

console.log(utils.sortNumeric([5, 1, 4, 2]));  // [1, 2, 4, 5]

8️⃣ sortAlphabetic(arr)

Sorts an array of strings alphabetically.

console.log(utils.sortAlphabetic(["banana", "apple", "cherry"]));  // ["apple", "banana", "cherry"]

9️⃣ randomElement(arr)

Returns a random element from an array.

console.log(utils.randomElement(["apple", "banana", "cherry"]));

🔟 addElement(arr, element, index)

Adds an element to an array at a specific index.

let arr = [1, 2, 3, 5];
console.log(arrayUtils.addElement(arr, 4, 3));
// Output: [1, 2, 3, 4, 5]

console.log(arrayUtils.addElement(arr, 6)); // Adds 6 at the end
// Output: [1, 2, 3, 4, 5, 6]

🏆 Full List of Functions

String Functions:

  • toUpperCase
  • toLowerCase
  • capitalize
  • reverseString
  • removeWhitespace
  • replaceAll
  • countWords
  • contains
  • startsWith
  • endsWith
  • truncate
  • camelCase
  • snakeCase
  • kebabCase
  • titleCase
  • randomString
  • isPalindrome
  • explode
  • implode

Array Functions:

  • uniqueArray
  • flattenArray
  • chunkArray
  • shuffleArray
  • arrayIntersection
  • arrayDifference
  • sortNumeric
  • sortAlphabetic
  • randomElement
  • addElement

📜 License

This package is open-source and released under the MIT License.


This README now includes all the functions you wanted with proper descriptions and examples. Let me know if you need any refinements! 🚀