import { _, it, lift } from 'param.macro'
const log = console.log(..._)
log([0, 1, 0, 1].filter(!!it))
// -> [1, 1]
const heroes = [
{ name: 'bob', getPower: () => ({ level: 9001 }) },
{ name: 'joe', getPower: () => ({ level: 4500 }) }
]
log(heroes.find(it.getPower().level > 9000))
// -> { name: 'bob', getPower: [Function] }
const greet = `Hello, ${_}!`
greet('world') |> it.toUpperCase() |> log
// -> HELLO, WORLD!
const log = (..._arg) => {
return console.log(..._arg)
}
log(
[0, 1, 0, 1].filter(_it => {
return !!_it
})
) // -> [1, 1]
const heroes = [
{
name: 'bob',
getPower: () => ({
level: 9001
})
},
{
name: 'joe',
getPower: () => ({
level: 4500
})
}
]
log(
heroes.find(_it2 => {
return _it2.getPower().level > 9000
})
) // -> { name: 'bob', getPower: [Function] }
const greet = _arg2 => {
return `Hello, ${_arg2}!`
}
greet('world') |>
(_it3 => {
return _it3.toUpperCase()
}) |>
log // -> HELLO, WORLD!
Array [ 1 1 ]
Object { "getPower": [Function getPower] "name": "bob" }
"HELLO, WORLD!"