Sha256: 2b7a7603696c63cf02f9d91aab14d6e60f5f6dfa17c94151bd464aecdb72c56d

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 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)
 * @namespace Utils
 * @name getName
 */

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

2 entries across 2 versions & 2 rubygems

Version Path
mdarray-sol-0.1.0-java node_modules/chai/lib/chai/utils/getName.js
select_all-rails-0.3.1 node_modules/chai/lib/chai/utils/getName.js