Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. /* !
  3. * Chai - getFuncName utility
  4. * Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>
  5. * MIT Licensed
  6. */
  7. /**
  8. * ### .getFuncName(constructorFn)
  9. *
  10. * Returns the name of a function.
  11. * When a non-function instance is passed, returns `null`.
  12. * This also includes a polyfill function if `aFunc.name` is not defined.
  13. *
  14. * @name getFuncName
  15. * @param {Function} funct
  16. * @namespace Utils
  17. * @api public
  18. */
  19. var toString = Function.prototype.toString;
  20. var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
  21. function getFuncName(aFunc) {
  22. if (typeof aFunc !== 'function') {
  23. return null;
  24. }
  25. var name = '';
  26. if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {
  27. // Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined
  28. var match = toString.call(aFunc).match(functionNameMatch);
  29. if (match) {
  30. name = match[1];
  31. }
  32. } else {
  33. // If we've got a `name` property we just use it
  34. name = aFunc.name;
  35. }
  36. return name;
  37. }
  38. module.exports = getFuncName;