# kodepos.js

> A simple Node.js module to search postal code (kode pos) in Indonesia.

Latest version **1.1.2** (published 2020-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install kodepos.js
pnpm add kodepos.js
yarn add kodepos.js
bun add kodepos.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2020-04-25 |
| First published | 2020-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dwi Rizki Irawan |
| Maintainers | drizki |
| Keywords | pos, kode pos, postal code, zip, zip code, zip code indonesia, indonesia, pos indonesia, kode pos indonesia |

## Links

- npm: https://www.npmjs.com/package/kodepos.js
- Repository: https://github.com/drizki/kodepos.js
- Homepage: https://github.com/drizki/kodepos.js#readme
- Issues: https://github.com/drizki/kodepos.js/issues
- npm.io page: https://npm.io/package/kodepos.js

## Dependencies (1)

- [jenis](https://npm.io/package/jenis.md) ^0.0.2

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2020-04-25
- 1.1.1 — 2020-04-19
- 1.0.1 — 2020-04-18
- 1.0.0 — 2020-04-14

## README

![kodepos.js](https://i.ibb.co/4fSV6vV/kodepos-js.png)

[![kodepos.js](https://img.shields.io/npm/dm/kodepos.js)](https://www.npmjs.com/package/kodepos.js)

A simple Node.js module to search postal code (kode pos) in Indonesia.

### Installation

```shell
npm install --save kodepos.js
```

Use this module in server environment as it contain relatively large json dataset. If you want to use it on client side, make sure to use compression. Haven't test it though.

### Usage

#### kodepos.search()

```javascript
const kodepos = require("kodepos.js");

const query = "bandung";
const limit = 10;
const exact = false; // Should match query? if false, LIKE (similar in SQL) method is used.

const search = kodepos.search(query, limit, exact);
console.log(search);
```

#### kodepos.searchBy()

```javascript
const kodepos = require("kodepos.js");

const scope = "city"; // Check table below for available values
const query = "bandung";
const limit = 10;
const exact = true; // Should match query? if false, LIKE (similar in SQL) method is used.

const searchBy = kodepos.search(scope, query, limit, exact);
console.log(searchBy);
```

| Method     | Param | Type   | Required | Default | Description                         |
| ---------- | ----- | ------ | -------- | ------- | ----------------------------------- |
| search()   | query | String | True     | None    | The query of search operation       |
|            | limit | Number | False    | 10      | Results limit. Set 0 to return all  |
|            | exact | Bool   | False    | False   | Should search to match query?       |
| searchBy() | scope | String | True     | None    | province / city / urban / disctrict |
|            | query | String | True     | None    | The query of search operation       |
|            | limit | Number | False    | 10      | Results limit. Set 0 to return all  |
|            | exact | Bool   | False    | False   | Should search to match query?       |

### Returns

```javascript
{
  count: Number,
  results: Array
}
```

### Test

Clone this repository and run:

```shell
npm test
```

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