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

ecamp / hal-json-vuex / 13321877237

13 Feb 2025 10:43PM UTC coverage: 84.708%. Remained the same
13321877237

push

github

web-flow
Update babel monorepo to v7.26.8

159 of 206 branches covered (77.18%)

Branch coverage included in aggregate %.

262 of 291 relevant lines covered (90.03%)

740.07 hits per line

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

84.62
/src/LoadingStoreCollection.js
1
import LoadingStoreValue from './LoadingStoreValue'
2

3
/**
4
 * Returns a placeholder for an array that has not yet finished loading from the API. The array placeholder
5
 * will respond to functional calls (like .find(), .map(), etc.) with further LoadingStoreCollections or
6
 * LoadingStoreValues. If passed the existingContent argument, random access and .length will also work.
7
 * @param arrayLoaded     Promise that resolves once the array has finished loading
8
 * @param existingContent optionally set the elements that are already known, for random access
9
 */
10
class LoadingStoreCollection {
11
  constructor (arrayLoaded, existingContent = []) {
48✔
12
    const singleResultFunctions = ['find']
51✔
13
    const arrayResultFunctions = ['map', 'flatMap', 'filter']
51✔
14
    this._meta = { load: arrayLoaded }
51✔
15
    singleResultFunctions.forEach(func => {
51✔
16
      existingContent[func] = (...args) => {
51✔
17
        const resultLoaded = arrayLoaded.then(array => array[func](...args))
×
18
        return new LoadingStoreValue(resultLoaded)
×
19
      }
20
    })
21
    arrayResultFunctions.forEach(func => {
51✔
22
      existingContent[func] = (...args) => {
153✔
23
        const resultLoaded = arrayLoaded.then(array => array[func](...args))
15✔
24
        return new LoadingStoreCollection(resultLoaded)
15✔
25
      }
26
    })
27
    return existingContent
51✔
28
  }
29
}
30

31
export default LoadingStoreCollection
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