Sha256: 461bd3757c6c0a20a64f0e73fe88393c4f54d1eca9c21584c1308e7a7c62b737

Contents?: true

Size: 429 Bytes

Versions: 8

Compression:

Stored size: 429 Bytes

Contents

/*!
 * Chai - getName utility
 * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
 * MIT Licensed
 */

/**
 * # getName(func)
 *
 * Gets the name of a function, in a cross-browser way.
 *
 * @param {Function} a function (usually a constructor)
 */

module.exports = function (func) {
  if (func.name) return func.name;

  var match = /^\s?function ([^(]*)\(/.exec(func);
  return match && match[1] ? match[1] : "";
};

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ende-0.5.22 components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.21 components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.6 components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.5 components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.4 components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.3 components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.2 components/chaijs/chai/1.9.1/lib/chai/utils/getName.js
ende-0.5.1 components/chaijs/chai/1.9.1/lib/chai/utils/getName.js