• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thednp / color-picker / 10945029288

19 Sep 2024 04:24PM UTC coverage: 96.234% (-3.0%) from 99.203%
10945029288

push

github

thednp
fix ci error

469 of 509 branches covered (92.14%)

Branch coverage included in aggregate %.

732 of 739 relevant lines covered (99.05%)

59.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/ts/util/isValidJSON.ts
1
import { isString } from '@thednp/shorty';
2

3
/**
4
 * Check if a string is valid JSON string.
5
 *
6
 * @param str the string input
7
 * @returns the query result
8
 */
9
const isValidJSON = (str: unknown): str is string => {
1✔
10
  if (!isString(str)) return false;
23!
11
  try {
23✔
12
    JSON.parse(str);
23✔
13
  } catch (e) {
14
    return false;
23✔
15
  }
16
  return true;
×
17
};
18

19
export default isValidJSON;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc