Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@corefunc/corefunc

Package Overview
Dependencies
Maintainers
1
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@corefunc/corefunc - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

string/compare.cjs

2

package.json

@@ -61,3 +61,3 @@ {

},
"version": "0.0.20"
"version": "0.0.21"
}

@@ -1,25 +0,29 @@

import fnLowerCase from "lodash-es/lowerCase";
import fnToString from "lodash-es/toString";
import castToString from "../cast/to/string";
import stringClearReferences from "./clearReferences";
/**
* Compare two strings
* @param {string} stringFirst
* @param {string} stringSecond
* @param {string} first
* @param {string} second
* @param {boolean} isStrict
* @returns {boolean}
*/
function compare(stringFirst, stringSecond, isStrict = false) {
let stringOne = fnToString(stringFirst);
let stringTwo = fnToString(stringSecond);
export default function stringCompare(first: string, second: string, isStrict: boolean = false): boolean {
let stringOne = castToString(first).normalize();
let stringTwo = castToString(second).normalize();
if (stringOne.length !== stringTwo.length) {
stringClearReferences(stringOne);
stringClearReferences(stringTwo);
return false;
}
if (isStrict) {
return stringOne.localeCompare(stringTwo) === 0;
const isSame = stringOne.localeCompare(stringTwo) === 0;
stringClearReferences(stringOne);
stringClearReferences(stringTwo);
return isSame;
}
stringOne = fnLowerCase(stringOne);
stringTwo = fnLowerCase(stringTwo);
return stringOne === stringTwo;
const isSame = stringOne.toLowerCase().localeCompare(stringTwo.toLowerCase()) === 0;
stringClearReferences(stringOne);
stringClearReferences(stringTwo);
return isSame;
}
export default compare;
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