PHP 7.4.33
Preview: index.js Size: 725 B
/var/www/receipt-app-backend-bitkit.dk/httpdocs/node_modules/stubs/index.js
'use strict'

module.exports = function stubs(obj, method, cfg, stub) {
  if (!obj || !method || !obj[method])
    throw new Error('You must provide an object and a key for an existing method')

  if (!stub) {
    stub = cfg
    cfg = {}
  }

  stub = stub || function() {}

  cfg.callthrough = cfg.callthrough || false
  cfg.calls = cfg.calls || 0

  var norevert = cfg.calls === 0

  var cached = obj[method].bind(obj)

  obj[method] = function() {
    var args = [].slice.call(arguments)
    var returnVal

    if (cfg.callthrough)
      returnVal = cached.apply(obj, args)

    returnVal = stub.apply(obj, args) || returnVal

    if (!norevert && --cfg.calls === 0)
      obj[method] = cached

    return returnVal
  }
}

Directory Contents

Dirs: 0 × Files: 4
Name Size Perms Modified Actions
725 B lrw-r--r-- 2026-05-06 08:23:44
Edit Download
518 B lrw-r--r-- 2026-05-06 08:23:44
Edit Download
1.39 KB lrw-r--r-- 2026-05-06 08:23:44
Edit Download
3.51 KB lrw-r--r-- 2026-05-06 08:23:44
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).