
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
Powerful string interpolation tool library
-Supports positional and dictionary interpolation -Supports multiple error handling mechanisms -Support for null value processing mechanism -Support filter chain processing of input variable values -Support variable prefix suffix -98%+unit test coverage
import {FlexVars} from "flexvars"
const flexvars = new FlexVars({
filters:{
currency:{
args:["prefix","suffix","sign"],
default:{prefix:"USD ",suffix:"",sign:"$"}
next:(value:any,args:Record<string,any>,context:FlexFilterContext)=>{
return `${args.prefix}${args.sign}${value}${args.suffix}`
}
}
}
})
const _ = flexvars.replace
console.log(_("hello {}","flexvars"))
// => hello flexvars
console.log(_("I am {}","tom")).toBe("I am tom")
// => I am tom
console.log(_("{ value | currency}",100)).toBe("USD $100"))
// => USD $100
console.log(_("{ value | currency('RMB','¥','元')}",100)).toBe("RMB ¥100元"))//
// => RMB ¥100元
console.log(_("{ value | currency({prefix:'EUR '',suffix:''',sign:'€'})}",100)).toBe("RMB €100"))
// => EUR €100
flexvars.addFilter({
name:"add",
args:["step"],
default:{step:1},
next(value:any,args:Record<string,any>,context:FlexFilterContext){
return parseInt(value)+args.step
}
})
// call chaining
console.log(_("{ value | add}",100)).toBe("101")
console.log(_("{ value | add|add }",100)).toBe("102")
console.log(_("{ value | add(2)|add(3) }",100)).toBe("105")
console.log(_("{ value | add(2)|add(3)|add(4) }",100)).toBe("109")
FAQs
Powerful string interpolation tool library
The npm package flexvars receives a total of 125 weekly downloads. As such, flexvars popularity was classified as not popular.
We found that flexvars demonstrated a healthy version release cadence and project activity because the last version was released less than 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 now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.