
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
Dead simple cross-language string formatter
No dependencies, O(N*m)
import (
"fmt"
"github.com/thanhpk/stringf"
)
func main() {
str := stringf.Format("hi {name}, here is your number {{2108}.", map[string]string{
"name": "Kieu Thanh", // key should not contains spaces
})
fmt.Println(str)
}
// hi Kieu Thanh, here is your number {2108.
var stringf = require("stringf")
var str = stringf.Format("hi #name, here is your number {{2108.", {
name: "Thanh",
})
console.log(str)
// hi Kieu Thanh, here is your number {2108.
go test
npm test
| String | Parameter map | Output |
|---|---|---|
| hi {name} | name: Thanh | hi Thanh |
| hi {num} | num: 2108 | hi 2108 |
| {{abc} | abc: bcd | {abc |
a string, s
a map string to string, paramMap
a string with param replaced
let ESCCHAR ← '{', ESCCHAREND ← '}', i ← 0, output ← ""
while i < length(s) do
if s[i] = ESCCHAR then
let j ← i + 1
while j <= length(s) and s[j] = ESCCHAR do
j ← j + 1
if (j - i) mod 2 = 0 then
output ← output + ESCCHAR
if (j - i) mod 2 ≠ 0 then
let param ← "" (parse parameter key)
while j < length(s) and s[j] ≠ ESCCHAREND do
param ← param + s[j]
j ← j + 1
if length(param) > 0 then
output ← output + paramMap[param]
if j = length(s) then
return output
else if s[j = ESCCHAREND then
j ← j + 1
i ← j
output ← output + s[i]
i ← i + 1
return output
FAQs
Dead simple string formatter
The npm package stringf receives a total of 5 weekly downloads. As such, stringf popularity was classified as not popular.
We found that stringf 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.

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.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.