
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
tscript-helpers
Advanced tools
import { bool } from 'tscript-helpers/utils'
bool([]) == true
bool({}) == true
import { cast } from 'tscript-helpers/utils'
cast.toBool() // cast to boolean
cast.asBool() // cast to boolean or undefined
cast.toBool('yes', { extend:false }) // true
cast.toBool('no', { extend:false }) // false
cast.toBool('none', { extend:true }) // false
cast.toBool('none', { extend:false }) // Error
cast.asBool('abc123', { extend:false, undefine:true }) // undefined
cast.asBool('abc123', { extend:false, undefine:false }) // Error
// no black box definition
function toBool(x:undefined|null|boolean|number|string, props:{ force:boolean }) {
if (['true','1','t','y','yes'].includes(String(x).toLowerCase())) return true
if (['false','0','f','n','no'].includes(String(x).toLowerCase())) return false
if (props.force) {
if (['undefined','null','none','nan',''].includes(String(x).toLowerCase())) return false
}
throw new Error('BOOLEAN_CASTING_FAILED')
}
// no black box definition
function asBool(x:undefined|null|boolean|number|string, props:{ extend:boolean, undefine:boolean }) {
if (['true','1','t','y','yes'].includes(String(x).toLowerCase())) return true
if (['false','0','f','n','no'].includes(String(x).toLowerCase())) return false
if (props.extend) {
if (['undefined','null','none','nan',''].includes(String(x).toLowerCase())) return false
}
if (props.undefine) {
return undefined
}
throw new Error('BOOLEAN_CASTING_FAILED')
}
import { compact } from 'tscript-helpers/utils'
compact(-10) // -10
compact(100) // 100
compact(1000) // 1K
compact(1025) // 1K
compact(1075) // 1.1K
compact(1250) // 1.3K
compact(1500) // 1.5K
compact(10_000) // 10K
compact(123_000) // 120K
compact(125_000) // 130K
import { Counter } from 'tscript-helpers/utils'
const { getValue, increment, decrement, reset } = new Counter({ initial:0 })
import { Paginator } from 'tscript-helpers/utils'
const { pagination } = Paginator()
const feat = TRPC.procedure.input(zod.object({
cursor: zod.number().default(pagination.initialPage), // 1) initialPage
})).query(async ({ input }) => {
const data = await prismaClient.table.query({
...pagination.calcPrisma(input.limit, input.cursor), // 2) calcPrisma
})
return { data, ...pagination.calcTRPC(data.length, input.limit, input.cursor) } // 3) calcTPRC
})
import { optional_call } from 'tscript-helpers/utils'
let pipe
pipe = optional_call(pipe, 'modifier', arg) // pipe = pipe.modifier(arg)
pipe = optional_call(pipe, 'modifier', undefined) // pipe = pipe
import { stringify } from 'tscript-helpers/utils'
stringify(['https://domain.com', 'endpoint', 'ID'], { abc:123, def:456 }) // https://domain.com/endpoint/ID?abc=123&def=456
// no black box definition
export function stringify(left:string[], right:Record<string, undefined|null|boolean|number|string>) {
return [
left.filter(Boolean).join('/'),
Object
.entries(right)
.filter(([k, v]) => (k != '') && (v != undefined))
.map(([k, v]) => k+'='+v)
.filter(Boolean).join('&')
].filter(Boolean).join('?')
}
import { SELECT } from 'tscript-helpers/SQL'
const QUERY = SELECT(['*'], 'Table', { where:'ColA = 123', orderby:['RAND()'], limit:10, offset:10 })
console.log('>> QUERY:', QUERY)
>> QUERY:
SELECT *
FROM Table
WHERE ColA = 123
ORDER BY RAND()
LIMIT 10
OFFSET 10
import { useCounter } from 'tscript-helpers/hooks'
const { value, setValue, reset, increment, decrement } = useCounter({ initial: 0 })
import { usePersistedState } from 'tscript-helpers/hooks'
const { data, isLoading } = TRPCNext.feature.useQuery()
const [ data2, __ ] = usePersistedState(data, [])
import { If } from 'tscript-helpers/JSX'
const Component = () => (
<>
<If cond={true} > <p>Render</p> </If>
<If cond={false}> <p>Disabled</p> </If>
</>
)
FAQs
TScript Helpers Library
We found that tscript-helpers 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.