# Function Name

> [Regular expression][regexp] to capture a function name.


<section class="usage">

## Usage

``` javascript
var RE_FUNCTION_NAME = require( '@stdlib/regexp/function-name' );
```

#### RE_FUNCTION_NAME

[Regular expression][regexp] to capture a `function` name.

``` javascript
function beep() {
    return 'boop';
}

var str = RE_FUNCTION_NAME.exec( beep.toString() )[ 1 ];
// returns 'beep'
```

</section>

<!-- /.usage -->


<section class="examples">

## Examples

<!-- eslint-disable func-names, no-restricted-syntax, no-empty-function -->

``` javascript
var RE_FUNCTION_NAME = require( '@stdlib/utils/regexp/function-name' );

function fname( fcn ) {
    return RE_FUNCTION_NAME.exec( fcn.toString() )[ 1 ];
}

var f = fname( Math.sqrt );
// returns 'sqrt'

f = fname( Int8Array );
// returns 'Int8Array'

f = fname( Object.prototype.toString );
// returns 'toString'

f = fname( function () {} );
// returns ''
```

</section>

<!-- /.examples -->


<section class="links">

[regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

</section>

<!-- /.links -->
