
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@abcnews/alternating-case-to-object
Advanced tools
Convert an alternating case string to a JSON object
A function to convert alternating case ("ALTERNATINGcase"
) strings to objects
({alternating: 'case'}
) and vice versa.
The ACTO string format supports numbers, bools, nulls, and lowercase strings (a-z0-9), as standalone values or as arrays.
This library provides a parse
and stringify
method to convert objects from
and to strings respectively.
npm i @abcnews/alternating-case-to-object
import {parse, stringify} from '@abcnews/alternating-case-to-object'
stringify({
prop: 'value',
second: 'thing',
allowed: true,
things: [100, 101],
});
// "PROPvalueSECONDthingALLOWEDyesTHINGS100THINGS101"
Props in the config will be renamed if they occur in this object. Note the
propMap is the same format as you pass to parse()
, so the map is applied in
the opposite direction.
stringify(
{
'kebab-case': 'value',
},
{
propMap: {
kebabcase: 'kebab-case',
},
}
);
// "KEBABCASEvalue"
parse('PROPvalueSECONDthingALLOWEDyesTHINGS100');
// >>>
{
prop: 'value',
second: 'thing',
allowed: true,
things: 100
}
"true"
, "yes"
, "false"
& "no"
will be converted to the booleans true
, true
, false
& false
, respectively.parse('GROUPfirstGROUPsecondGROUPthird');
// >>>
{
group: ['first', 'second', 'third'];
}
Every value in a prop which appears multiple times must be of the same type or an exception will be thrown. For example, this will throw:
parse('AtrueAstr');
Props in this array will always be returned as arrays, even if they occur in the config string zero or one time.
parse('AtrueAfalseBvalueAtrueDvalue', {
arrayProps: ['a', 'b', 'c']
});
// >>>
{
a: [true, false, true],
b: ['value'],
c: [],
d: 'value'
}
Props in the config will be renamed if they occur in this object.
parse('CAMELCASEtrueKEBABCASE100', {
propMap: {
camelcase: 'camelCase',
kebabcase: 'kebab-case'
}
});
// >>>
{
camelCase: true,
'kebab-case': 100
}
FAQs
Convert an alternating case string to a JSON object
The npm package @abcnews/alternating-case-to-object receives a total of 910 weekly downloads. As such, @abcnews/alternating-case-to-object popularity was classified as not popular.
We found that @abcnews/alternating-case-to-object demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.