If there is, without error checking.
yarn add aru
npm i -S aru
Or access to releases page. Then, download the latest version.
import aru from 'aru';
const aru = require('aru');
or
<script src="https://unpkg.com/aru/dist/aru.js"></script>
<script src="path/tp/aru.js"></script>
key
:string
value
:any
Set a value
. (Do noting if catch error)
key
:string
Get the value
.
key
:string
Wheter key exists.
key
:string
cb
:function
If there is no that key
, execute cb
key
:string
cb
:function
If there is that key
, execute cb
aru('str', 'str');
aru('str'); // 'str'
aru.has('str'); // true
aru.left('str', () => 'str'); // null
aru.right('str', () => 'str'); // 'str'
aru('func', () => 'func');
aru('func'); // 'func'
aru.has('func'); // true
aru.left('func', () => 'func'); // null
aru.right('func', () => 'func'); // 'func'
await aru('resolve', Promise.resolve('resolve'));
aru('resolve'); // 'resolve'
aru.has('resolve'); // true
aru.left('resolve', () => 'resolve') // null
aru.right('resolve', () => 'resolve') // 'resolve'
await aru('promise:reject', Promise.reject('reject'));
aru('reject'); // null
aru.has('reject') // false
aru.left('reject', () => 'reject') // 'reject'
aru.right('reject', () => 'reject') // null
The MIT License (MIT)
Copyright (c) 2017 nju33 nju33.ki@gmail.com