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.21 to 0.0.22

string/contains.cjs

2

package.json

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

},
"version": "0.0.21"
"version": "0.0.22"
}

@@ -27,2 +27,23 @@ # CoreFunc

arraySortStrings(["c", "a", "b"]);
```
```
---
Discover more:
- 🔎[Consono](https://consono.js.org)🔎 -
The most informative and correct variable inspector for JavaScript on the web.
- 🌠[OF](https://of.js.org)🌠 - Promise wrapper with some sugar.
- 🔩[Local Storage Fallback](https://github.com/r37r0m0d3l/fallback-local-storage)🔩 -
Universal localStorage fallback.
- 🔄[Publish Subscribe](https://publish-subscribe.js.org)🔄 -
JavaScript implementation of the Publish-Subscribe pattern.
Or find useful these tools:
- 🧾[JSON Sorter](https://r37r0m0d3l.github.io/json_sort)🧾 - Neat online JSON sorter.
---

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

import fnLowerCase from "lodash-es/lowerCase";
import castToString from "../cast/to/string";
import stringClearReferences from "./clearReferences";

@@ -10,8 +11,14 @@ /**

*/
function contains(haystack, needle, isStrict = false) {
export default function stringContains(haystack: string, needle: string, isStrict: boolean = false): boolean {
const strHaystack = castToString(haystack).normalize();
const strNeedle = castToString(needle).normalize();
if (isStrict) {
stringClearReferences(strHaystack);
stringClearReferences(strNeedle);
return haystack.includes(needle);
}
return fnLowerCase(haystack).includes(fnLowerCase(needle));
const contains = strHaystack.toLowerCase().includes(strNeedle.toLowerCase());
stringClearReferences(strHaystack);
stringClearReferences(strNeedle);
return contains;
}
export default contains;
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