Skip to content

lbb00/valkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Value Kit

Npm Bundlephobia Coverage Typescript License Npm download

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} resolver={(v) => v} render={(v) => <div>{v}</div>} />

Vue

  • Valkit
  • ValkitResolve
<script setup>
  import { Valkit } from 'valkit/vue'
</script>

<template>
  <Valkit :value="1" :resolver="(v) => v">
    <template #default="{ value }">
      <div>{{ value }}</div>
    </template>
  </Valkit>
</template>

About

Value kit for JavaScript, Vue and React.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published