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

@ulu/utils

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ulu/utils - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

5

CHANGELOG.md
# Change Log
## 0.0.16
- (Added) String > extractMatchDetails() Provides details about regex match for string for replacement/usage
## 0.0.14

@@ -4,0 +9,0 @@

@@ -140,2 +140,26 @@ /**

});
}
/**
* Function that matches regex against string and returns details helpful for replacing/using/highlighting a single match within a string
* @param {String} string The string to extract from
* @param {Regex} regex The regular expression to match against
* @returns {Object|Null} If match return object with { matched, startIndex, endIndex, before, after }, when no match is found this return null
*/
export function extractMatchDetails(string, regex) {
const match = string.match(regex);
if (match) {
const matched = match[0];
const startIndex = match.index;
const endIndex = matchIndex + matched.length;
return {
matched,
startIndex,
endIndex,
before: str.slice(0, startIndex),
after: str.slice(endIndex)
};
} else {
return null;
}
}

19

package.json
{
"name": "@ulu/utils",
"version": "0.0.15",
"description": "Low level utility library",
"version": "0.0.16",
"description": "A collection of helpful utility functions for common JavaScript development and browser DOM manipulation tasks",
"keywords": [
"array",
"Utilities"
"utility",
"utilities",
"helper",
"function",
"tool",
"library",
"utils",
"library",
"Javascript",
"string",
"dom",
"number",
"random",
"regex"
],

@@ -9,0 +22,0 @@ "author": "Joseph Scherben <jscherbe@gmail.com>",

@@ -73,2 +73,9 @@ /**

export function titleCase(string: string, exceptions?: any[], defaults?: any[]): string;
/**
* Function that matches regex against string and returns details helpful for replacing/using/highlighting a single match within a string
* @param {String} string The string to extract from
* @param {Regex} regex The regular expression to match against
* @returns {Object|Null} If match return object with { matched, startIndex, endIndex, before, after }, when no match is found this return null
*/
export function extractMatchDetails(string: string, regex: Regex): any | null;
//# sourceMappingURL=string.d.ts.map
local/wildcard-match/wildcard-match.js

Sorry, the diff of this file is not supported yet

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