# is-json-promise

> Check if string is JSON basing on PROMISE instead of TRY-CATCH

Latest version **1.0.7** (published 2016-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-json-promise
pnpm add is-json-promise
yarn add is-json-promise
bun add is-json-promise
```

## 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.0.7 |
| Published | 2016-11-22 |
| First published | 2016-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Abdennour TOUMI |
| Maintainers | abdennour |
| Keywords | is-json, string, json, promise, then, babel, ES7 |

## Links

- npm: https://www.npmjs.com/package/is-json-promise
- Repository: https://github.com/abdennour/is-json-promise
- Homepage: https://github.com/abdennour/is-json-promise#readme
- Issues: https://github.com/abdennour/is-json-promise/issues
- npm.io page: https://npm.io/package/is-json-promise

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.7 (latest) — 2016-11-22
- 1.0.6 — 2016-11-22
- 1.0.5 — 2016-11-21
- 1.0.4 — 2016-11-21
- 1.0.3 — 2016-11-21
- 1.0.2 — 2016-11-21
- 1.0.1 — 2016-11-21
- 1.0.0 — 2016-11-21
- 0.0.1 — 2016-11-21

## README

[![Build Status](https://travis-ci.org/abdennour/is-json-promise.svg?branch=master)](https://travis-ci.org/abdennour/is-json-promise)

# Use

```js
import 'is-json-promise';
// or: require('is-json-promise')

String.IsJSON(`iam here`)
   .then((object) => console.info(object))
   .catch((error) => alert('Waww, i cannot be JSON')) ; // promise will run catch
```   
or

```js
import 'is-json-promise';

String.IsJSON(`{"welcome":"Hello"}`)
   .then((object) => console.info(object)) // promise will run "then"
   .catch((error) => alert('Waww, i cannot be JSON')) ;
```

# Safe import :

It will not extend the `String` class with a static method , but it will give you this method as a function :

```js
import {IsJSON} from 'is-json-promise/safe';
//or: const {IsJSON}= require("is-json-promise/safe");

IsJSON(`{"welcome":"Hello"}`)
   .then((object) => console.info(object)) // promise will run "then"
   .catch((error) => alert('Waww, i cannot be JSON')) ;
```

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