# jaci

> a plugin for creating CLI user-input as promises for node.js

Latest version **0.1.1** (published 2025-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install jaci
pnpm add jaci
yarn add jaci
bun add jaci
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2025-03-22 |
| First published | 2019-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | angga2oioi |
| Maintainers | angga2oioi |
| Keywords | command, line, prompt |

## Links

- npm: https://www.npmjs.com/package/jaci
- Repository: https://github.com/angga2oioi/jaci
- Homepage: https://github.com/angga2oioi/jaci#readme
- Issues: https://github.com/angga2oioi/jaci/issues
- npm.io page: https://npm.io/package/jaci

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2025-03-22
- 0.1.0 — 2025-03-11
- 0.0.4 — 2019-04-07
- 0.0.3 — 2019-04-02
- 0.0.2 — 2019-04-02
- 0.0.1 — 2019-04-02

## README

# jaci
a plugin for creating CLI user-input as promises for node.js

## Installation
``` npm install jaci --save ```

Then initialize using 

``` 
const jaci = require("jaci"); 
```

## Method
### string(question,[option])
Accept all kind of user input
### password(question,[option])
Accept all kind of user input but hide it
### alpha(question,[option])
only accept alphabet character
### alphanum(question,[option])
only accept alphanumeric character
### number(question,[option])
only accept number
### regex(question,[option])
set your own regex to test user input, please refer to option below.
### done()
finish reading user input, you have to call this method at the end of your promise chain/catch to exit the prompt.

## Options
- option.default[string][optional], the default value if user did not enter anything
- option.required[boolean][optional][default:true], if this is set to ``` false ``` then user won't be asked again if they did not input anything
- option.reject[string][optional],reject user input if the input contain any of the character you set here
- option.min[integer][optional][default:0], set minimum length (minimum value for ```number``` method) of user input, if it's ```0``` then there is no minimum;
- option.max[integer][optional][default:0], set maximum length (maximum value for ```number``` method) of user input, if it's ```0``` then there is no maximum;
- option.muted[boolean][optional][default:false(true for ```password``` method], hide user input
- option.confirm[object][optional][default:{true:'Y',false:'N'}], only available for ```confirm``` method, you can set how user answer your true/false question.
- option.regex[regex][required],only available for ```regex``` method.

## Example
```
const jaci = require("jaci");
jaci.string("string : ",{required:false})
.then((res)=>{
    console.log(res);
    return jaci.password("password :")
})
.then((res)=>{
    console.log(res);
    return jaci.alpha("alpha :")
})
.then((res)=>{
    console.log(res);
    return jaci.alphanum("alphanum :")
})
.then((res)=>{
    console.log(res);
    return jaci.number("number :")
})
.then((res)=>{
    console.log(res);
    return jaci.regex("regex:",{regex:/^[A-Za-z]+$/})
})
.then((res)=>{
    console.log(res);
    return jaci.confirm("confirm (Yea/Nay):",{confirm:{true:"Y",false:"N"}})
})
.then((res)=>{
    console.log(res);
    jaci.done();
    return;
})
.catch((e)=>{
    console.log("error",e);
    jaci.done();
})
```

---
_Source: https://npm.io/package/jaci · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
