Welcome to ntils
ntils is a powerful JavaScript library packed with dozens of useful APIs designed to simplify your development process. Whether you’re building web apps, mobile apps, or just need some handy functions, ntils has got you covered.
Get Started with ntils
// Initialize ntils
import * as ntils from 'ntils';
console.log('ntils library initialized');
Useful API Examples
1. Array Utilities
// Check if array includes a certain element
const numbers = [1, 2, 3, 4, 5];
const includesThree = ntils.arrayIncludes(numbers, 3);
console.log(includesThree); // true
2. String Utilities
// Capitalize a string
const str = 'hello world';
const capitalizedStr = ntils.capitalize(str);
console.log(capitalizedStr); // Hello World
3. Object Utilities
// Deep clone an object
const obj = { name: 'John', age: 30 };
const clonedObj = ntils.deepClone(obj);
console.log(clonedObj); // { name: 'John', age: 30 }
4. Function Utilities
// Debounce a function
const logMsg = () => console.log('Debounced');
const debouncedLogMsg = ntils.debounce(logMsg, 2000);
debouncedLogMsg();
5. Promise Utilities
// Sleep for a specified duration
const sleep = async () => {
await ntils.sleep(2000);
console.log('Slept for 2 seconds');
};
sleep();
Build a Simple App Using ntils
import * as ntils from 'ntils';
// Sample function using ntils APIs
const runApp = () => {
const numbers = [1, 2, 3, 4, 5];
const includesThree = ntils.arrayIncludes(numbers, 3);
const str = 'hello world';
const capitalizedStr = ntils.capitalize(str);
const obj = { name: 'John', age: 30 };
const clonedObj = ntils.deepClone(obj);
const logMsg = () => console.log('Debounced');
const debouncedLogMsg = ntils.debounce(logMsg, 2000);
debouncedLogMsg();
const sleep = async () => {
await ntils.sleep(2000);
console.log('Slept for 2 seconds');
};
sleep();
console.log({ includesThree, capitalizedStr, clonedObj });
};
runApp();
ntils provides a rich set of APIs that help you with everyday development tasks. The above examples illustrate just a small portion of what ntils has to offer. Start using ntils today and see how it can improve your development workflow.
Hash: a4c75c65b741dd8f65ceb842da8c8d8f5a854ec9a6982f01fcf9a157b6a6e8ab