
Research
Namastex.ai npm Packages Hit with TeamPCP-Style CanisterWorm Malware
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.
Convert an unknown type to a string, boolean, or number (integer, or float)
$ npm install --save astype
import as from 'astype';
as.number('1'); // 1
as.integer('55.1'); // 55
as.boolean(0); // false
as.string(true); // "true"
number(...) (aliases: double(), float())
integer(...)
boolean(...) (aliases: bool())string(...)This will set the behavior anytime a conversion is used.
This allows simplier syntax when using the same rules.
as.setGlobal({
number: { ... },
boolean: { ... },
string: { ... }
});
You can also unset global options as well.
Passing an empty object or null will unset all options under that key.
as.unsetGlobal({
number: { ... },
boolean: { ... },
string: { ... }
})
You can also pass through options in the conversion, these will override any global options.
as.number(..., { ... })
numberallowNull (default: true)
true: conversion can return the value nullfalse: conversion will return 0 if nullallowUndefined (default: true)
true: conversion can return the value undefinedfalse: conversion will return 0 if undefinedallowNaN (default: true)
true: conversion can return the value NaNfalse: conversion will return 0 if NaNallowInfinity (default: true)
true: conversion can return the value Infinityfalse: conversion will return 0 if InfinityallowFindInString (default: true)
true: conversion can will pick out numbers from a stringfalse: conversion will return NaN if allowNaN is true,
otherwise 0allowDecimals (default: true)
true: will allow decimal places in numbers
(eg: '1.9' => 1.9)false: will truncate decimal places
(eg: '1.9' => 1)booleanallowNull (default: true)
true: conversion can return the value nullfalse: conversion will return 0 if nullallowUndefined (default: true)
true: conversion can return the value undefinedfalse: conversion will return 0 if undefinedparseString (default: true)
true: will parse the strings "true" and "false" to true
and false respectivelyfalse: will parse the string to a boolean (Boolean("string"))convertNumbers (default: true)
true: if the input is a number (or string that is a number),
it will parse as a number first, then convert to a booleanfalse: will parse the string to a boolean (Boolean(1))stringallowNull (default: true)
true: conversion can return the value nullfalse: conversion will return 0 if nullallowUndefined (default: true)
true: conversion can return the value undefinedfalse: conversion will return 0 if undefinedMIT © Tyler Stewart
FAQs
Convert unknown type to certain type
The npm package astype receives a total of 128 weekly downloads. As such, astype popularity was classified as not popular.
We found that astype 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.
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
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.