New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lodash.capitalize

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.capitalize - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

45

index.js

@@ -40,6 +40,6 @@ /**

/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');

@@ -56,2 +56,24 @@ /** Detect free variable `global` from Node.js. */

/**
* Converts an ASCII `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
}
/**
* Checks if `string` contains Unicode symbols.
*
* @private
* @param {string} string The string to inspect.
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
*/
function hasUnicode(string) {
return reHasUnicode.test(string);
}
/**
* Converts `string` to an array.

@@ -64,5 +86,18 @@ *

function stringToArray(string) {
return string.match(reComplexSymbol);
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string);
}
/**
* Converts a Unicode `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
/** Used for built-in method references. */

@@ -73,3 +108,3 @@ var objectProto = Object.prototype;

* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.

@@ -162,3 +197,3 @@ */

var strSymbols = reHasComplexSymbol.test(string)
var strSymbols = hasUnicode(string)
? stringToArray(string)

@@ -165,0 +200,0 @@ : undefined;

2

package.json
{
"name": "lodash.capitalize",
"version": "4.2.0",
"version": "4.2.1",
"description": "The lodash method `_.capitalize` exported as a module.",

@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/",

@@ -1,2 +0,2 @@

# lodash.capitalize v4.2.0
# lodash.capitalize v4.2.1

@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.capitalize` exported as a [Node.js](https://nodejs.org/) module.

See the [documentation](https://lodash.com/docs#capitalize) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.capitalize) for more details.
See the [documentation](https://lodash.com/docs#capitalize) or [package source](https://github.com/lodash/lodash/blob/4.2.1-npm-packages/lodash.capitalize) for more details.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc