Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@thi.ng/strings
Advanced tools
This project is part of the @thi.ng/umbrella monorepo.
Various higher-order, configurable string formatting & utility functions, some memoized. Please sources / docstrings for now.
Partially based on Clojure version of thi.ng/strf.
STABLE - used in production
yarn add @thi.ng/strings
Package sizes (gzipped): ESM: 2.2KB / CJS: 2.4KB / UMD: 2.3KB
Several demos in this repo's /examples directory are using this package.
A selection:
Basic crypto-currency candle chart with multiple moving averages plots
rstream based spreadsheet w/ S-expression formula DSL
XML/HTML/SVG to hiccup/JS conversion
// create a custom string formatter
const fmt = defFormat([
"Price: ",
{ usd: "$", gbp: "£", eur: "€" },
float(2),
" (",
percent(2),
" off)"
]);
// use format
fmt("usd", 1.2345, 0.5);
// Price: $1.23 (50.00% off)
fmt("eur", 1.2345, 0.25)
// Price: €1.23 (25.00% off)
defFormat
format
hstr
ignore
interpolate
str
camel
capitalize
kebab
lower
snake
slugify
upper
float
floatFixedWidth
maybeParseFloat
maybeParseInt
percent
radix
uuid
B8
/ B16
/ B32
- binary / bitstring presetsU8
/ U16
/ U24
/ U32
/ U64
- hex format presets (unsigned values)center
padLeft
padRight
truncate
truncateLeft
wrap
Z2
/ Z3
/ Z4
- zero-pad presetsunits
- define new unit w/ magnitudes & suffixesbits
bytes
grams
meters
seconds
charRange
repeat
splice
Karsten Schmidt
© 2015 - 2020 Karsten Schmidt // Apache Software License 2.0
FAQs
Various string formatting & utility functions
The npm package @thi.ng/strings receives a total of 3,049 weekly downloads. As such, @thi.ng/strings popularity was classified as popular.
We found that @thi.ng/strings demonstrated a healthy version release cadence and project activity because the last version was released less than 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.