![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
string.format
Advanced tools
Readme
Add to JS String.prototype .format()
method which accepts as parameter an object or an array with values to be substituted in the string, based on a pattern.
String.format uses JSON.decycled for show Objects as String without circular references errors and some related problems.
For Date object format you can use Date.format
require('string.format');
var text = "Hello {name} {lastname}!";
var params = {
name:'Homer',
lastname:'Simpson'
};
console.log("01 -- " + text.format(params));
//>> 01 -- Hello Homer Simpson!
var text = "Hello {user.name} {user.lastname}! {msg}";
var params = {
user:{
name:'Homer',
lastname:'Simpson'
},
msg:'How are you?'
};
console.log("02 -- " + text.format(params));
//>> 02 -- Hello Homer Simpson! How are you?
var text = "Option one:{0},two:{1},three:{2}.";
var params = ['start','stop','restart'];
console.log("03 -- " + text.format(params));
//>> 03 -- Option one:start,two:stop,three:restart.
var text = "Your tags: {tags}, and your config:{config}.";
var params = {
tags:['yellow','astronaut','donuts','ouch!'],
config:{
skin:'yellow',
hair:false,
intellectual:undefined
}
};
console.log("04 -- " + text.format(params));
//>> 04 -- Your tags: ["yellow","astronaut","donuts","ouch!"], and your config:{"skin":"yellow","hair":false}.
##Example
MIT
Añade a String.prototype de JS el método .format()
que acepta como parámetro un objeto o un array con valores que serán sustituidos en el string en base a un patrón de sustitución.
String.format utiliza JSON.decycled para monstar objetos como strings sin errores de referencia circular y otros problemas relacionados.
Para ampliar las funciones de String.format en el caso de objetos Date puede resultarte util Date.format
MIT
FAQs
String prototype method -> 'Hello {name}!'.format({name:'Homer'});
We found that string.format demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.