2.0.2 • Published 1 year ago

extract-first-json v2.0.2

Weekly downloads
8
License
MIT
Repository
github
Last release
1 year ago

If I should maintain this repo, please ⭐️

DM me on Twitter if you have questions or suggestions.


Installation

yarn add extract-first-json
npm install extract-first-json
pnpm add extract-first-json

Usage

import { extractJSON, extractJSONObject, extractJSONArray } from "extract-first-json";

const string = `Example: { "ok": true }`;

const arrayString = `Example: [{ "ok": true }]`;

extractJSON(string); // { ok: true }

extractJSONObject(string); // { ok: true }

extractJSONArray(arrayString); // [{ "ok": true }]
  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.

MIT