
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A collection of useful and efficient JavaScript/TypeScript utility tools for modern development.
npm install neo-tools
# or
yarn add neo-tools
# or
pnpm add neo-tools
debounce(fn, delay)Delays the execution of a function until after a specified delay. Useful for scenarios like input validation or search suggestions.
import { debounce } from 'neo-tools';
const debouncedSearch = debounce((query: string) => {
console.log('Searching for:', query);
}, 300);
// Will only execute after user stops typing for 300ms
debouncedSearch('hello');
debouncedSearch('hello world'); // Previous call is cancelled
Parameters:
fn (Function): The function to debouncedelay (number): The delay in milliseconds (default: 300)fibonacci(n)Efficiently computes the nth Fibonacci number using an iterative approach with BigInt support for large numbers.
import { fibonacci } from 'neo-tools';
console.log(fibonacci(0)); // 0n
console.log(fibonacci(1)); // 1n
console.log(fibonacci(10)); // 55n
console.log(fibonacci(100)); // 354224848179261915075n
Parameters:
n (number): The index (n >= 0) of the Fibonacci sequence to computeReturns:
throttle(fn, delay)Limits the execution rate of a function, ensuring it's not called more than once in a specified delay period.
import { throttle } from 'neo-tools';
const throttledScroll = throttle(() => {
console.log('Scroll event fired');
}, 100);
window.addEventListener('scroll', throttledScroll);
Parameters:
fn (Function): The function to throttledelay (number): The delay in milliseconds (default: 300)Stack<T>A Last In First Out (LIFO) stack implementation using linked lists.
import { Stack } from 'neo-tools';
const stack = new Stack<number>();
stack.push(1);
stack.push(2);
stack.push(3);
console.log(stack.pop()); // 3
console.log(stack.peek()); // 2
console.log(stack.size()); // 2
console.log(stack.isEmpty()); // false
Methods:
push(value: T): void - Add an element to the toppop(): T | null - Remove and return the top elementpeek(): T | null - View the top element without removingisEmpty(): boolean - Check if stack is emptysize(): number - Get the number of elementsQueue<T>A First In First Out (FIFO) queue implementation using linked lists.
import { Queue } from 'neo-tools';
const queue = new Queue<string>();
queue.enqueue('first');
queue.enqueue('second');
queue.enqueue('third');
console.log(queue.dequeue()); // 'first'
console.log(queue.peek()); // 'second'
console.log(queue.size()); // 2
// Dequeue multiple items at once
const items = queue.dequeueCount(2); // ['second', 'third']
Methods:
enqueue(value: T): void - Add an element to the reardequeue(): T | null - Remove and return the front elementdequeueCount(count: number): T[] - Remove and return multiple elementspeek(): T | null - View the front element without removingisEmpty(): boolean - Check if queue is emptysize(): number - Get the number of elementsLinkedList<T>A doubly linked list implementation supporting efficient insertions, removals, and traversal.
import { LinkedList } from 'neo-tools';
const list = new LinkedList<number>();
list.append(1);
list.append(2);
list.append(3);
console.log(list.size()); // 3
console.log(list.find(2)?.value); // 2
list.remove(2);
console.log(list.size()); // 2
list.prepend(0);
console.log(list.find(0)?.next?.value); // 1
// Insert after a node
const node = list.find(1);
list.insertAfter(node!, 1.5);
console.log(list.find(1.5)?.prev?.value); // 1
// Iterate through the list
for (const value of list) {
console.log(value);
}
Methods:
append(value: T): void - Add an element to the endprepend(value: T): void - Add an element to the beginningremove(value: T): boolean - Remove the first occurrence of a valuefind(value: T): ListNode<T> | null - Find the first node with the given valuefindLast(value: T): ListNode<T> | null - Find the last node with the given valueinsertAfter(node: ListNode<T>, value: T): void - Insert a value after the given nodeinsertBefore(node: ListNode<T>, value: T): void - Insert a value before the given nodeclear(): void - Remove all elementssize(): number - Get the number of elementsisEmpty(): boolean - Check if the list is emptyindexOf(value: T): number - Get the index of the first occurrencelastIndexOf(value: T): number - Get the index of the last occurrencePromiseQueue<T>A queue for managing concurrent promise execution with configurable concurrency limits.
import { PromiseQueue } from 'neo-tools';
// Create a queue with concurrency limit of 3
const promiseQueue = new PromiseQueue<string>([], 3);
// Add tasks to the queue
promiseQueue.enqueue(() => fetch('/api/data1').then(r => r.text()));
promiseQueue.enqueue(() => fetch('/api/data2').then(r => r.text()));
promiseQueue.enqueue(() => fetch('/api/data3').then(r => r.text()));
// Process all tasks (returns Promise)
const results = await promiseQueue.processQueue();
console.log(results); // ['data1', 'data2', 'data3']
// Or process with iterator for streaming results
for await (const batch of promiseQueue.processQueueIterator()) {
console.log('Batch completed:', batch);
}
Constructor:
constructor(initialTasks?, concurrentLimit?) - Create a new promise queue
initialTasks (Array): Initial array of promise-returning functionsconcurrentLimit (number): Maximum concurrent promises (default: 5)Methods:
enqueue(task: () => Promise<T>): void - Add a promise-returning functionprocessQueue(): Promise<T[] | void> - Execute all tasks and return resultsprocessQueueIterator(): AsyncGenerator<T[] | void> - Execute tasks with streaming resultsclear(): void - Clear all pending taskssize: number - Get the number of pending tasksnpm run build
npm test
MIT © Mykyta Matsapura
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Made with ❤️ for the JavaScript/TypeScript community
FAQs
Collection of useful and efficient JS tools
We found that neo-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.