
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.