@types/regenerate
- Version 1.4.3
- Published
- 7.82 kB
- No dependencies
- MIT license
Install
npm i @types/regenerate
yarn add @types/regenerate
pnpm add @types/regenerate
Overview
TypeScript definitions for regenerate
Index
Functions
function regenerate
regenerate: typeof regenerate;
The main Regenerate constructor. Calling this function creates a new set that gets a chainable API.
Any arguments passed to
regenerate()
will be added to the set right away.Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted, as well as arrays containing values of these types.
It’s also possible to pass in a Regenerate instance. Doing so adds all code points in that instance to the new set.
Classes
class regenerate
class regenerate {}
constructor
constructor(...values: readonly RegenerateArgValueOrArray[]);
property version
static readonly version: string;
A string representing the semantic version number.
method add
add: ( value: RegenerateArgValueOrArray, ...rest: readonly RegenerateArgValueOrArray[]) => this;
Any arguments passed to
add()
are added to the set.Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted, as well as arrays containing values of these types.
It’s also possible to pass in a Regenerate instance. Doing so adds all code points in that instance to the current set.
method addRange
addRange: (start: string | number, end: string | number) => this;
Adds a range of code points from
start
toend
(inclusive) from the set.Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted.
Parameter start
The start of the range to add.
Parameter end
The end of the range to add.
method clone
clone: () => regenerate;
Returns a clone of the current code point set.
Any actions performed on the clone won’t mutate the original set.
method contains
contains: (codePoint: string | number) => boolean;
Returns
true
if the given value is part of the set, andfalse
otherwise.Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted.
Parameter codePoint
The codepoint to check for
method intersection
intersection: (argument: regenerate | readonly number[]) => this;
Removes any code points from the set that are not present in both the set and the given
codePoints
array.Parameter argument
must be an array of numeric code point values, i.e. numbers, or a Regenerate instance.
method remove
remove: ( value: RegenerateArgValueOrArray, ...rest: readonly RegenerateArgValueOrArray[]) => this;
Any arguments passed to
remove()
are removed from the set.Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted, as well as arrays containing values of these types.
It’s also possible to pass in a Regenerate instance. Doing so removes all code points in that instance from the current set.
method removeRange
removeRange: (start: string | number, end: string | number) => this;
Removes a range of code points from
start
toend
(inclusive) from the set.Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted.
Parameter start
The start of the range to remove.
Parameter end
The end of the range to remove.
method toArray
toArray: () => number[];
Returns a sorted array of unique code points in the set.
valueOf
method toRegExp
toRegExp: (flags?: string) => RegExp;
Returns a regular expression that matches all the symbols mapped to the code points within the set.
Parameter flags
The
flags
parameter to be passed to the regular expression.
method toString
toString: (options?: regenerate.ToStringOptions) => string;
Returns a string representing (part of) a regular expression that matches all the symbols mapped to the code points within the set.
Parameter options
The optional
options
object
method valueOf
valueOf: () => number[];
Returns a sorted array of unique code points in the set.
toArray
Interfaces
interface ToStringOptions
interface ToStringOptions {}
property bmpOnly
readonly bmpOnly?: boolean | undefined;
When
bmpOnly
is set totrue
, the output matches surrogates individually, regardless of whether they’re lone surrogates or just part of a surrogate pair.This simplifies the output, but it can only be used in case you’re certain the strings it will be used on don’t contain any astral symbols.
property hasUnicodeFlag
readonly hasUnicodeFlag?: boolean | undefined;
When
hasUnicodeFlag
is set totrue
, the output makes use of Unicode code point escapes (\u{…}
) where applicable.This simplifies the output at the cost of compatibility and portability, since it means the output can only be used as a pattern in a regular expression with the ES6
u
flag enabled.See Also
https://mathiasbynens.be/notes/es6-unicode-regex
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/regenerate
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/regenerate)
- HTML<a href="https://www.jsdocs.io/package/@types/regenerate"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3895 ms. - Missing or incorrect documentation? Open an issue for this package.