A collection of useful TypeScript code snippets and algorithms including sorting utilities
npx @tessl/cli install tessl/npm-codinasion@2025.2.0codinasion is a collection of useful TypeScript code snippets and algorithms designed to provide common programming utilities and algorithmic implementations. The package focuses on well-documented, tested, and reusable functions for various computational tasks.
npm install codinasionimport { helloWorld, bubbleSort } from "codinasion";For CommonJS:
const { helloWorld, bubbleSort } = require("codinasion");import { helloWorld, bubbleSort } from "codinasion";
// Simple hello world utility
helloWorld(); // Outputs: "Hello World"
// Sort an array of numbers
const numbers = [5, 3, 8, 4, 2];
const sorted = bubbleSort(numbers);
console.log(sorted); // Output: [2, 3, 4, 5, 8]
// Handle undefined input gracefully
const emptySorted = bubbleSort(undefined);
console.log(emptySorted); // Output: []codinasion is organized into functional modules:
helloWorldSimple utility function that logs "Hello World" to the console.
function helloWorld(): void;Mathematical sorting algorithms for array manipulation and ordering.
/**
* Sorts an array of numbers using the bubble sort algorithm.
* @param arr - Array of numbers to sort. If undefined, returns empty array.
* @returns Sorted array of numbers in ascending order.
*/
function bubbleSort(arr: number[] | undefined): number[];// All functions are exported directly from main module
type SortableArray = number[] | undefined;
type SortedArray = number[];import { bubbleSort } from "codinasion";
// Sort positive numbers
const numbers = [5, 3, 8, 4, 2];
const sorted = bubbleSort(numbers);
console.log(sorted); // [2, 3, 4, 5, 8]
// Handle negative numbers
const mixed = [-1, 3, -5, 2];
const sortedMixed = bubbleSort(mixed);
console.log(sortedMixed); // [-5, -1, 2, 3]
// Empty and single element arrays
console.log(bubbleSort([])); // []
console.log(bubbleSort([42])); // [42]import { bubbleSort } from "codinasion";
// Graceful handling of undefined input
const result = bubbleSort(undefined);
console.log(result); // []
// Function modifies input array in-place and returns it
const original = [3, 1, 2];
const sorted = bubbleSort(original);
console.log(original === sorted); // true (same array reference)import { helloWorld } from "codinasion";
// Simple console output for testing or demonstration
helloWorld(); // Logs: "Hello World"