-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert project to an ES module (#28)
* Replace simple-assert with a throw * Convert project to ES module * Simplify karma config * Remove unused dependencies * Set `engines` key to node >= 12 * Remove `.travis.yml` * Add back dependencies that are actually needed * Update eslint and friends * Remove obsolete build npm script Co-authored-by: Keith Cirkel <[email protected]>
- Loading branch information
Showing
7 changed files
with
8,993 additions
and
169 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
'use strict'; | ||
|
||
/* ! | ||
* Chai - getFuncName utility | ||
* Copyright(c) 2012-2016 Jake Luer <[email protected]> | ||
* MIT Licensed | ||
*/ | ||
|
||
/** | ||
* ### .getFuncName(constructorFn) | ||
* | ||
|
@@ -19,26 +11,28 @@ | |
* @api public | ||
*/ | ||
|
||
var toString = Function.prototype.toString; | ||
var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/; | ||
const { toString } = Function.prototype; | ||
const functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*/)]+\*\/\s*)*([^\s(/]+)/; | ||
function getFuncName(aFunc) { | ||
if (typeof aFunc !== 'function') { | ||
return null; | ||
} | ||
|
||
var name = ''; | ||
let name = ''; | ||
if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') { | ||
// Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined | ||
var match = toString.call(aFunc).match(functionNameMatch); | ||
// eslint-disable-next-line prefer-reflect | ||
const match = toString.call(aFunc).match(functionNameMatch); | ||
if (match) { | ||
name = match[1]; | ||
[ name ] = match; | ||
} | ||
} else { | ||
// If we've got a `name` property we just use it | ||
// eslint-disable-next-line prefer-destructuring | ||
name = aFunc.name; | ||
} | ||
|
||
return name; | ||
} | ||
|
||
module.exports = getFuncName; | ||
export { getFuncName }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = function configureKarma(config) { | ||
config.set({ | ||
basePath: '.', | ||
browsers: [ 'ChromeHeadless' ], | ||
frameworks: [ 'mocha' ], | ||
files: [ | ||
{ pattern: './index.js', type: 'module' }, | ||
{ pattern: './test/*.js', type: 'module' }, | ||
], | ||
reporters: [ 'progress' ], | ||
colors: true, | ||
autoWatch: false, | ||
singleRun: true, | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.