![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@thi.ng/strings
Advanced tools
This project is part of the @thi.ng/umbrella monorepo.
Various (80+) string formatting, word wrapping & utility functions, some higher-order, some memoized.
Partially based on Clojure version of thi.ng/strf.
defFormat
/ format
interpolate
/ interpolateKeys
escape
/ unescape
join
/ splice
/ split
repeat
stringify
radix
int
/ intLocale
float
/ floatFixedWidth
maybeParseFloat
/ maybeParseInt
percent
uuid
vector
B8
/ B16
/ B32
- fixed size binary formattersU8
/ U16
/ U24
/ U32
/ U64
- fixed size hex formattersZ2
/ Z3
/ Z4
- fixed sized zero padded number formatterslower
/ upper
/ capitalize
camel
/ kebab
/ snake
/ upperSnake
slugify
/ slugifyGH
isAnsi
/ isAnsiEnd
/ isAnsiStart
stripAnsi
lengthAnsi
wordWrap
/ wordWrapLine
/ wordWrapLines
SPLIT_PLAIN
/ SPLIT_ANSI
center
padLeft
/ padRight
truncate
/ truncateLeft
/ truncateRight
trim
wrap
spacesToTabs
/ spacesToTabsLine
tabsToSpaces
/ tabsToSpacesLine
charRange
ALPHA
/ ALPHA_NUM
/ DIGITS
/ LOWER
/ UPPER
/ HEX
BOM
/ ESCAPES
/ ESCAPES_REV
WS
/ PUNCTUATION
units
bits
/ bytes
grams
meters
seconds
ruler
/ grid
hstr
- Hollerith stringscomputeCursorPos
STABLE - used in production
Search or submit any issues for this package
yarn add @thi.ng/strings
ES module import:
<script type="module" src="https://cdn.skypack.dev/@thi.ng/strings"></script>
For Node.js REPL:
# with flag only for < v16
node --experimental-repl-await
> const strings = await import("@thi.ng/strings");
Package sizes (gzipped, pre-treeshake): ESM: 4.38 KB
Several demos in this repo's /examples directory are using this package.
A selection:
Screenshot | Description | Live demo | Source |
---|---|---|---|
![]() | Basic crypto-currency candle chart with multiple moving averages plots | Demo | Source |
Basic SPA example with atom-based UI router | Demo | Source | |
![]() | rstream based spreadsheet w/ S-expression formula DSL | Demo | Source |
![]() | XML/HTML/SVG to hiccup/JS conversion | Demo | Source |
// 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)
Karsten Schmidt
If this project contributes to an academic publication, please cite it as:
@misc{thing-strings,
title = "@thi.ng/strings",
author = "Karsten Schmidt",
note = "https://thi.ng/strings",
year = 2015
}
© 2015 - 2021 Karsten Schmidt // Apache Software License 2.0
FAQs
Various string formatting & utility functions
The npm package @thi.ng/strings receives a total of 1,159 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 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.