0.1.3 • Published 5 years ago

vwxy v0.1.3

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

vwxy

A to get function.

github npm:version typescript ci:status document:typedoc license browserslist code style: prettier

Usage

/**
 * To prepare of using the `vwxy`
 * ```bash
 * yarn add vwxy
 * ```
 */
import vwxy, {VwxyValue} from 'vwxy';

or

<script src="https://unpkg.com/vwxy/vwxy.js"></script>
<script>
  // Can use the `vwxy` here.
</script>

Example

const baz = vwxy<{
  foo: {
    bar: {
      baz: VwxyValue<number>;
    };
  };
}>().foo.bar.baz(123);

expect(
  baz({
    foo: {bar: {baz: 33}},
  }),
).toBe(33);
expect(baz({foo: {xxx: 33}})).toBe(123);
const value = vwxy<{
  arr: {
    value: VwxyValue<string>;
  }[];
}>().arr[1].value('bar');

expect(value({arr: [{value: 'foo'}, {value: 'baz'}]})).toBe('baz');
expect(value({arr: [{value: 'foo'}]})).toBe('bar');

Edit example