
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
@toa.io/generic
Advanced tools
Library is for internal use only. Barely documented. If you really need to understand something, see tests.
range(input: string): number[]
Transforms:
1-3 into [1, 2, 3]1..3 into [1, 2, 3]1-3, 5, 10..12 into [1, 2, 3, 5, 10, 11, 12]See tests.
shards(input: string): string[]
Transforms amqp://shard{0-2}.domain.com into:
[
'amqp://shard0.domain.com',
'amqp://shard1.domain.com',
'amqp://shard2.domain.com'
]
Uses range.
See tests.
entries(object: object): [key, value][]
Object.entries including Symbols.
generate(generate: function): object
generate function's signature is (segments: string[], value?: any): any | void
segments are nested property names, used to access the generated object and optional value is
passed if property was assigned with a value.
const generator = (segments, [key, value]) => {} // any property is an object
const object = generate(generator)
const _0 = object.a // will call callback with (['a'])
const _1 = object.a.b // (['a', 'b'])
object.a.b.c = 1 // (['a', 'b', 'c'], 1)
echo(input: string, variables?: Record<string, string>): string
Returns the input string.
Substitutes variables to a placeholders following ${NAME} syntax.
If no variables are passed, then environment variables are used.
process.env['FOO'] = 'bar'
const output = echo('foo: ${FOO}')
console.log(output) // foo: bar
const variables = { foo: 'world' }
const output = echo('hello ${foo}', variables)
console.log(output) // hello world
echo(input: string, values: string[]): string
When the second argument is an Array, its values are substituted to a placeholders following {N} syntax.
echo('make {0} not {1}', ['love', 'war'])
map(object: object, transformation: Function): object
Deeply maps an object to a new object using given key-value transformation function.
(key, value) => [key, value] | undefined
If the transformation function returns undefined then the current key-value pair will remain unchanged.
plain(candidate: any): boolean
Returns true if an argument is a POJO, false otherwise.
FAQs
Toa Generic Tools
The npm package @toa.io/generic receives a total of 1,881 weekly downloads. As such, @toa.io/generic popularity was classified as popular.
We found that @toa.io/generic 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.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.