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

gmaclennan / rpc-reflector / 5445117558

pending completion
5445117558

Pull #14

github

web-flow
Merge 17b259ccc into fd25289e0
Pull Request #14: Fixes for non-node environments

137 of 150 branches covered (91.33%)

Branch coverage included in aggregate %.

11 of 11 new or added lines in 4 files covered. (100.0%)

273 of 281 relevant lines covered (97.15%)

1044.42 hits per line

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

76.19
/lib/is-message-port-like.js
1
module.exports = isMessagePortLike
9✔
2

3
/**
4
 * Check if a value is a MessagePort-like object with `on` and `postMessage`
5
 * methods
6
 *
7
 * @param {any} value
8
 * @returns {value is (MessagePort | MessagePortNode | MessagePortLike)}
9
 */
10
function isMessagePortLike(value) {
11
  if (typeof value !== 'object' || value === null) return false
273!
12
  if (
273!
13
    typeof window !== 'undefined' &&
273!
14
    'MessagePort' in window &&
15
    value instanceof window.MessagePort
16
  ) {
17
    return true
×
18
  } else if (
273✔
19
    typeof value.on === 'function' &&
819✔
20
    typeof value.off === 'function' &&
21
    typeof value.postMessage === 'function'
22
  ) {
23
    return true
132✔
24
  }
25
  return false
141✔
26
}
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