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

@siteimprove/alfa-string

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

@siteimprove/alfa-string - npm Package Compare versions

Comparing version 0.93.8 to 0.94.0

18

CHANGELOG.md
# @siteimprove/alfa-string
## 0.94.0
### Minor Changes
- **Added:** A `String.and` combinator for chaining transformers is now available. ([#1712](https://github.com/Siteimprove/alfa/pull/1712))
- **Added:** A `String.removePunctuation` transformer is now available. ([#1712](https://github.com/Siteimprove/alfa/pull/1712))
- **Added:** A `String.hasSoftWrapOpportunity` predicate is now available. ([#1710](https://github.com/Siteimprove/alfa/pull/1710))
- **Added:** A `String.Transformer` type alias is now available. ([#1712](https://github.com/Siteimprove/alfa/pull/1712))
### Patch Changes
- **Added:** The function `String.toLowerCase` was added. ([#1707](https://github.com/Siteimprove/alfa/pull/1707))
It just calls the built in `.toLowerCase` function but returns `Lowercase<string>`.
## 0.93.8

@@ -4,0 +22,0 @@

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

export declare namespace String {
type Transformer = (input: string) => string;
function and(...transformers: Array<Transformer>): Transformer;
/**

@@ -23,2 +25,11 @@ * Adds two spaces at the start of each line.

/**
* Removes all punctuation (underscore, hyphen, brackets, quotation marks, etc)
*
* @remarks
* This removes the Unicode classes P (punctuation), S (symbols),
* and Cf (formatting characters).
*/
function removePunctuation(input: string): string;
function toLowerCase<T extends string = string>(input: T): Lowercase<T>;
/**
* Checks whether the input contains only whitespace

@@ -31,3 +42,15 @@ */

function hasWhitespace(input: string): boolean;
/**
* Checks whether the string contains soft break points
* {@link https://drafts.csswg.org/css-text/#line-breaking}
*
* @remarks
* Spaces are always soft break points. Other are hard to correctly detect.
* We do not want here to have a full break point detection which, based on
* language, requires lexical analysis.
* We accept punctuation as soft break points since they would act so in most
* Western languages.
*/
function hasSoftWrapOpportunity(input: string): boolean;
}
//# sourceMappingURL=string.d.ts.map

@@ -6,2 +6,6 @@ /**

(function (String) {
function and(...transformers) {
return (input) => transformers.reduce((input, transformer) => transformer(input), input);
}
String.and = and;
/**

@@ -29,2 +33,17 @@ * Adds two spaces at the start of each line.

/**
* Removes all punctuation (underscore, hyphen, brackets, quotation marks, etc)
*
* @remarks
* This removes the Unicode classes P (punctuation), S (symbols),
* and Cf (formatting characters).
*/
function removePunctuation(input) {
return input.replace(/\p{P}|\p{S}|\p{Cf}/gu, "");
}
String.removePunctuation = removePunctuation;
function toLowerCase(input) {
return input.toLowerCase();
}
String.toLowerCase = toLowerCase;
/**
* Checks whether the input contains only whitespace

@@ -43,3 +62,18 @@ */

String.hasWhitespace = hasWhitespace;
/**
* Checks whether the string contains soft break points
* {@link https://drafts.csswg.org/css-text/#line-breaking}
*
* @remarks
* Spaces are always soft break points. Other are hard to correctly detect.
* We do not want here to have a full break point detection which, based on
* language, requires lexical analysis.
* We accept punctuation as soft break points since they would act so in most
* Western languages.
*/
function hasSoftWrapOpportunity(input) {
return /\s|\p{P}/u.test(input);
}
String.hasSoftWrapOpportunity = hasSoftWrapOpportunity;
})(String || (String = {}));
//# sourceMappingURL=string.js.map

5

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://alfa.siteimprove.com",
"version": "0.93.8",
"version": "0.94.0",
"license": "MIT",

@@ -28,3 +28,6 @@ "description": "Utilities for manipulating strings",

"registry": "https://npm.pkg.github.com/"
},
"devDependencies": {
"@siteimprove/alfa-test": "^0.94.0"
}
}
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