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

melchor629 / node-flac-bindings / 18667190468

20 Oct 2025 10:56PM UTC coverage: 91.129% (-0.01%) from 91.139%
18667190468

Pull #71

github

web-flow
Merge 005e21c18 into a8aaaa9a1
Pull Request #71: chore(deps): bump vite from 7.1.5 to 7.1.11

161 of 206 branches covered (78.16%)

Branch coverage included in aggregate %.

5027 of 5487 relevant lines covered (91.62%)

37219.93 hits per line

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

88.46
/src/mappings/native_iterator.cpp
1
#include "native_iterator.hpp"
2
#include "../flac_addon.hpp"
3
#include "native_async_iterator.hpp"
4

5
namespace flac_bindings {
6

7
  using namespace Napi;
8

9
  void NativeIterator::init(const Napi::Env& env, FlacAddon& addon) {
21✔
10
    Function constructor = DefineClass(
21✔
11
      env,
12
      "NativeIterator",
13
      {
14
        InstanceMethod("next", &NativeIterator::next),
21✔
15
      });
16

17
    addon.nativeIteratorConstructor = Persistent(constructor);
21✔
18
  }
21✔
19

20
  Napi::Value NativeIterator::newIterator(Napi::Env env, const IteratorFunction& impl) {
55✔
21
    EscapableHandleScope scope(env);
55✔
22
    auto& constructor = env.GetInstanceData<FlacAddon>()->nativeIteratorConstructor;
55✔
23
    auto obj = constructor.New({External<IteratorFunction>::New(env, new IteratorFunction(impl))});
55✔
24
    return scope.Escape(obj);
110✔
25
  }
55✔
26

27
  NativeIterator::NativeIterator(const CallbackInfo& info): ObjectWrap<NativeIterator>(info) {
55✔
28
    impl = info[0].As<External<IteratorFunction>>().Data();
55✔
29
  }
55✔
30

31
  NativeIterator::~NativeIterator() {
×
32
    delete impl;
×
33
  }
×
34

35
  Napi::Value NativeIterator::next(const CallbackInfo& info) {
242✔
36
    auto res = (*impl)(info.Env(), pos);
242✔
37
    auto returnObject = Object::New(info.Env());
242✔
38

39
    if (res.has_value()) {
242✔
40
      returnObject["done"] = booleanToJs(info.Env(), false);
187✔
41
      returnObject["value"] = res.value();
187✔
42
      pos += 1;
187✔
43
    } else {
44
      returnObject["done"] = booleanToJs(info.Env(), true);
55✔
45
    }
46

47
    return returnObject;
242✔
48
  }
49

50
}
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