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

hybridsjs / hybrids / 19760852732

28 Nov 2025 10:18AM UTC coverage: 42.528% (-57.4%) from 99.915%
19760852732

Pull #296

github

web-flow
Merge 191660095 into 92ed729fc
Pull Request #296: fix(store): improve `store.record()` support & error messages while defining the model

819 of 1842 branches covered (44.46%)

9 of 9 new or added lines in 1 file covered. (100.0%)

1345 existing lines in 27 files now uncovered.

996 of 2342 relevant lines covered (42.53%)

76.9 hits per line

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

39.29
/src/value.js
1
import { camelToDash } from "./utils.js";
2

3
function reflect(host, value, attrName) {
UNCOV
4
  if (!value && value !== 0) {
×
UNCOV
5
    host.removeAttribute(attrName);
×
6
  } else {
UNCOV
7
    host.setAttribute(attrName, value === true ? "" : value);
×
8
  }
9
}
10

11
export default function value(key, desc) {
12
  const type = typeof desc.value;
246✔
13
  const defaultValue =
14
    type === "object" ? Object.freeze(desc.value) : desc.value;
246!
15

16
  switch (type) {
246!
17
    case "string":
18
      desc.value = (host, value) =>
31✔
19
        value !== undefined ? String(value) : defaultValue;
36✔
20
      break;
31✔
21
    case "number":
UNCOV
22
      desc.value = (host, value) =>
×
UNCOV
23
        value !== undefined ? Number(value) : defaultValue;
×
UNCOV
24
      break;
×
25
    case "boolean":
UNCOV
26
      desc.value = (host, value) =>
×
UNCOV
27
        value !== undefined ? Boolean(value) : defaultValue;
×
UNCOV
28
      break;
×
29
    case "function":
30
      desc.value = defaultValue;
215✔
31
      break;
215✔
32
    default:
UNCOV
33
      desc.value = (_, value = defaultValue) => value;
×
34
  }
35

36
  let observe = desc.observe;
246✔
37

38
  if (desc.reflect) {
246!
UNCOV
39
    const attrName = camelToDash(key);
×
40

41
    const fn =
UNCOV
42
      typeof desc.reflect === "function"
×
43
        ? (host, value, attrName) =>
UNCOV
44
            reflect(host, desc.reflect(value), attrName)
×
45
        : reflect;
46

UNCOV
47
    observe = desc.observe
×
48
      ? (host, value, lastValue) => {
UNCOV
49
          fn(host, value, attrName);
×
UNCOV
50
          desc.observe(host, value, lastValue);
×
51
        }
UNCOV
52
      : (host, value) => fn(host, value, attrName);
×
53
  }
54

55
  return {
246✔
56
    ...desc,
57
    observe,
58
    writable: type !== "function" || defaultValue.length > 1,
461✔
59
  };
60
}
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