New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aru

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aru

If there is, without error checking

0.1.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

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

Keywords

commonjs

FAQs

Package last updated on 18 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts