
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.
@umatch/language
Advanced tools
Simple internationalization framework
Check out tests/language.test.ts for an in-depth example of how to use this library.
Replaces all occurrences of {{ value }} in all strings inside target object (which may be nested) with the corresponding value in the replacements object (dictionary).
Throws an error if an entry is not in the dictionary. This can be avoided by whitelisting specific keys, or all of them, via the allowedLeftovers parameter.
Automatically chooses between the "zero", "one" or "many" options for an entry If the entry only has keys with those names and the dictionary has a count property that is a number. Example:
const obj = {
one: 'You have a new match, {{ name }}!',
many: 'You have {{ count }} new matches, {{ name }}!',
};
// returns 'You have a new match, Bob!'
deepReplace(obj, { name: 'Bob', count: 1 });
// returns 'You have 2 new matches, Bob!'
deepReplace(obj, { name: 'Bob', count: 2 });
If the entry equivalent to the count missing, throws an error. For example:
// throws "Missing translation for count 'zero'"
deepReplace(obj, { name: 'Bob', count: 0 });
Finally, if not all keys in the target are "zero", "one" or "many", behaves normally.
const obj2 = {
one: 'You have a new match, {{ name }}!',
many: 'You have {{ count }} new matches, {{ name }}!',
too_many: 'WOW! You have over 9000 new matches, {{ name }}!',
};
// returns {
// one: "You have a new match, Bob!",
// many: "You have 0 new matches, Bob!",
// too_many: "WOW! You have over 9000 new matches, Bob!"
// }
deepReplace(obj2, { name: 'Bob', count: 0 });
FAQs
Simple internationalization framework
The npm package @umatch/language receives a total of 65 weekly downloads. As such, @umatch/language popularity was classified as not popular.
We found that @umatch/language demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.