This package has been deprecated

Author message:

end of development

aru

0.1.0 • Public • Published

aru

XO code style

If there is, without error checking.

Install or Download

yarn add aru
npm i -S aru

Or access to releases page. Then, download the latest version.

Usage

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>

API

aru(key, value): promise or undefined

  • key: string
  • value: any

Set a value. (Do noting if catch error)

aru(key): value-type or null

  • key: string

Get the value.

aru.has(key): boolean

  • key: string

Wheter key exists.

aru.left(key, cb): return-value-of-cb or null

  • key: string
  • cb: function

If there is no that key, execute cb

aru.right(key, cb): type-of-return-value-of-cb or null

  • key: string
  • cb: function

If there is that key, execute cb

Example

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

LICENSE

The MIT License (MIT)

Copyright (c) 2017 nju33 nju33.ki@gmail.com

Dependents (1)

Package Sidebar

Install

npm i aru

Weekly Downloads

7

Version

0.1.0

License

MIT

Last publish

Collaborators

  • nju33