valkit
v0.0.3
Published
valkit
Downloads
1,129
Maintainers
Readme
Value Kit
Usage
Core
valkit(value, resolver)
valkitResolve(value, resolver)
valkitIs(value, predicate)
valkitSafe(value, fallback)
import { valkit, valkitResolve, valkitIs, valkitSafe } from 'valkit'
valkit(1, (v) => v) // 1
valkit(
() => 1,
(v) => v
) // 1
valkitIs(1, (v) => v === 1) // true
valkitSafe(1) // 1
valkitSafe(() => {
throw new Error('test')
}, 1) // 1
React
Valkit
ValkitResolve
import { Valkit } from 'valkit/react'
;<Valkit value={1} handler={(v) => v} render={(v) => <div>{v}</div>} />
Vue
Valkit
ValkitResolve
<script setup>
import { Valkit } from 'valkit/vue'
</script>
<template>
<Valkit :value="1" :handler="(v) => v">
<template #default="{ value }">
<div>{{ value }}</div>
</template>
</Valkit>
</template>