'use strict';

// MODULES //

var isString = require( '@stdlib/utils/is-string' ).isPrimitive;


// VARIABLES //

var CAPITALS_REGEX = /^[A-Z]/;


// MAIN //

/**
* Tests if a value is a string having an uppercase first character.
*
* @param {*} value - value to test
* @returns {boolean} boolean indicating whether value is a string with an uppercase first character
*
* @example
* var bool = isCapitalized( 'Hello' );
* // returns true
* @example
* var bool = isCapitalized( 'WORLD' );
* // returns true
* @example
* var bool = isCapitalized( '!' );
* // returns false
* @example
* var bool = isCapitalized( 'salt and light' );
* // returns false
*/
function isCapitalized( value ) {
	if ( isString( value ) ) {
		return CAPITALS_REGEX.test( value );
	}
	return false;
} // end FUNCTION isCapitalized()


// EXPORTS //

module.exports = isCapitalized;

@@ -19,24 +19,134 @@
 MODULES //%0A%0A
+var lowercase = require( '@stdlib/string/lowercase' );%0Avar uppercase = require( '@stdlib/string/uppercase' );%0A
 var isString
@@ -204,58 +204,8 @@
 ;%0A%0A%0A
-// VARIABLES //%0A%0Avar CAPITALS_REGEX = /%5E%5BA-Z%5D/;%0A%0A%0A
 // M
@@ -739,16 +739,25 @@
 lue ) %7B%0A
+%09var ch;%0A
 %09if ( is
@@ -776,47 +776,106 @@
 e ) 
-) %7B%0A%09%09return CAPITALS_REGEX.test( value
+&& value !== '' ) %7B%0A%09%09ch = value%5B 0 %5D;%0A%09%09return ( ch === uppercase( ch ) && ch !== lowercase( ch )
  );%0A

Refactor implementation