All files / node-coap/lib polyfill.js

30% Statements 3/10
16.67% Branches 1/6
100% Functions 1/1
42.86% Lines 3/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                    1x 528x 528x                  
'use strict'
 
/*
* Copyright (c) 2013-2021 node-coap contributors.
*
* node-coap is licensed under an MIT +no-false-attribs license.
* All rights not explicitly granted in the MIT license are reserved.
* See the included LICENSE file for more details.
*/
 
exports.compareBuffers = function (buf1, buf2) {
  Eif (Buffer.compare)
    return Buffer.compare(buf1, buf2)
  else {
    if (buf1.length != buf2.length) return -1
    for (var i = 0; i < buf1.length; i++) {
      if (buf1[i] != buf2[i]) return -1
    }
    return 0
  }
}