
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.
serialized-tags
Advanced tools
Read plain objects and turn plain strings into fast i18n-ready template strings
serialized-tags is a fast and lightweight tag template parser for primitive objects and values, it comes with support for
Arrays, Objects, Strings, and Value, all four being wrapped in classes implementing the same interface, reducing the
need to check values in your code.
The nature of this parser is to allow developers to use language files in the format of their convenience (JSON, YAML...) and pass the output through this to parse the strings and prepare everything for later usage.
In a near future, this package will have a branch for webpack to allow developers use this on their web applications!
As mentioned before, you can use (parsed) JSON objects for this package, given this file:
{
"hello": "Hello {0}!",
"actions.hug": "{0} just hugged {1}!",
"actions.pat": "{1} just got patted by {0}!",
"actions.other": [
"Hello {0}! Came back for more pats?",
"Bye {0}! I will see you later!"
]
}
You would parse this using the following code:
// Import the package
const serializedTags = require('serialized-tags');
// Assume jsonString is a string containing the previous JSON
// We will parse it into an object so serializedTags can work with it
const json = JSON.parse(jsonString);
// Parse with serializedTags
const parsed = new serializedTags.parse(json);
And now, we save it somewhere! Let's use parsed now!
const salute = parsed.get('hello').display(['world']);
// -> Hello world!
const hug = parsed.get('actions.hug').display(['kyra', 'OSS']);
// -> kyra just hugged OSS!
const pat = parsed.get('actions.pat').display(['the reader', 'kyra']);
// -> kyra just got patted by the reader!
const otherSalute = parsed.get('actions.other').first().display(['kyra']);
// Identical to: parsed.get('actions.other').get(0).display(['kyra']);
// -> Hello kyra! Came back for more pats?
const otherBye = parsed.get('actions.other').last().display(['kyra']);
// Identical to: parsed.get('actions.other').get(1).display(['kyra']);
// -> Bye kyra! I will see you later!
// Or even, randoms!
const otherRandom = parsed.get('actions.other').random().display(['kyra']);
// -> Hello kyra! Came back for more pats?
// -> Bye kyra! I will see you later!
FAQs
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.