Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
dev-utils-ts
Advanced tools
This repository contains a collection of useful utility functions to simplify your day-to-day coding tasks. These functions are designed to enhance your development workflow and improve code readability. Feel free to explore and integrate them into your projects! 🚀
To use these utility functions in your project, simply install the package from npm:
npm install dev-utils-ts
withTempDirs
This function creates temporary directories, executes the provided callback function, and then cleans up all directories thereafter.
import {withTempDirs} from 'dev-utils-ts';
async function myFunction() {
try {
const result = await withTempDirs(['/tmp/dir1', '/tmp/dir2'], async () => {
// Your code that requires temporary directories goes here...
return 'Result of your awesome function';
});
console.log('Result:', result);
} catch (error) {
console.error('Error:', error);
}
}
replaceMultiple
This function replaces all occurrences of match strings with corresponding replacement strings in a given string.
import {replaceMultiple} from 'dev-utils-ts';
const originalString = 'Hello world! This is a beautiful day.';
const matchStrings = ['world', 'beautiful', 'day'];
const replacementStrings = ['universe', 'wonderful', 'morning'];
const modifiedString = replaceMultiple(originalString, matchStrings, replacementStrings);
console.log(modifiedString);
// Output: 'Hello universe! This is a wonderful morning.'
Contributions to this repository are welcome! Feel free to open an issue or submit a pull request with your improvement ideas. 💪
FAQs
utils which are required by developers in day today work
We found that dev-utils-ts demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.