'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var pkg = require( './../package.json' ).name;
var capitalize = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
	var str;
	var out;
	var i;

	b.tic();
	for ( i = 0; i < b.iterations; i++ ) {
		str = String.fromCharCode( i%126 ) + 'eep boop';
		out = capitalize( str );
		if ( !isString( out ) ) {
			b.fail( 'should return a string' );
		}
	}
	b.toc();
	if ( !isString( out ) ) {
		b.fail( 'should return a string' );
	}
	b.pass( 'benchmark finished' );
	b.end();
});

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var fromCodePoint = require( '@stdlib/string/from-code-point' );
var pkg = require( './../package.json' ).name;
var capitalize = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
	var str;
	var out;
	var i;

	b.tic();
	for ( i = 0; i < b.iterations; i++ ) {
		str = fromCodePoint( i%126 ) + 'eep boop';
		out = capitalize( str );
		if ( !isString( out ) ) {
			b.fail( 'should return a string' );
		}
	}
	b.toc();
	if ( !isString( out ) ) {
		b.fail( 'should return a string' );
	}
	b.pass( 'benchmark finished' );
	b.end();
});

Use string utility