Manipulate strings without stress.
No future updates are planned. Feel free to continue using it, but expect no support.
This is a package for the command-line JSON processor jq
. Install the package in your jq project/package directory with jqnpm
:
jqnpm install joelpurra/jq-stress
import "joelpurra/jq-stress" as Stress;
# Stress::remove(str)
"Hello World!" | Stress::remove(" World!") # "Hello"
# Stress::replace(str; replacement)
"Hello World!" | Stress::replace("World"; "Beautiful") # "Hello Beautiful!"
# Stress::reverse
# Note: does not, just like 'jq', take Unicode combining marks and astral symbols into account.
"Hello World!" | Stress::reverse # "!dlroW olleH"
Stress::isEmpty
"" | Stress::isEmpty # true
"a" | Stress::isEmpty # false
Stress::isEmpty(fallback)
"" | Stress::isEmpty("omg") # "omg"
"a" | Stress::isEmpty("omg") # "a"
Stress::isNullOrEmpty
null | Stress::isNullOrEmpty # true
"" | Stress::isNullOrEmpty # true
"a" | Stress::isNullOrEmpty # false
Stress::isNullOrEmpty(fallback)
null | Stress::isNullOrEmpty("omg") # "omg"
"" | Stress::isNullOrEmpty("omg") # "omg"
"a" | Stress::isNullOrEmpty("omg") # "a"
Stress::isNullOrWhitespace
null | Stress::isNullOrWhitespace # true
"" | Stress::isNullOrWhitespace # true
" \\\\u0009\\\\u000B" | Stress::isNullOrWhitespace # true
"a" | Stress::isNullOrWhitespace # false
Stress::isNullOrWhitespace(fallback)
null | Stress::isNullOrWhitespace("omg") # "omg"
"" | Stress::isNullOrWhitespace("omg") # "omg"
" \\\\u0009\\\\u000B" | Stress::isNullOrWhitespace("omg") # "omg"
"a" | Stress::isNullOrWhitespace("omg") # "a"
- Fix Unicode combining marks and astral symbols reversing with code from Mathias Bynens'
esrever
.
Copyright (c) 2015 Joel Purra https://joelpurra.com/ All rights reserved.
When using jq-stress, comply to the MIT license. Please see the LICENSE file for details.