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

nodeplusplus / xregex-template / 91e33cb3-6927-4a5a-b950-8a65e8171027

pending completion
91e33cb3-6927-4a5a-b950-8a65e8171027

Pull #16

circleci

Unknown Committer
Unknown Commit Message
Pull Request #16: Bump json5 from 2.1.3 to 2.2.3

48 of 48 branches covered (100.0%)

Branch coverage included in aggregate %.

64 of 64 relevant lines covered (100.0%)

7.11 hits per line

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

100.0
/src/helpers/parseKeyValue.ts
1
import { unflatten } from "flat";
3✔
2

3
import { GenericObject } from "../types";
4

5
export function parseKeyValue(
3✔
6
  templates: string[],
7
  separator = "="
2✔
8
): GenericObject {
9
  const pairs = templates
3✔
10
    .filter(filter.bind(null, separator))
11
    .map(split.bind(null, separator));
12
  const options = Object.assign({}, ...pairs);
3✔
13
  return unflatten(options, { object: false });
3✔
14
}
15

16
function filter(separator: string, template?: string) {
17
  return template && template.includes(separator);
5✔
18
}
19

20
function split(separator: string, pairs: string): GenericObject {
21
  const [key, value] = pairs.split(separator).map((p) => p.trim());
10✔
22
  return { [key]: value };
5✔
23
}
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

© 2025 Coveralls, Inc