-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/docs: Add types for testPattern util and document it (fix: #16091)…
… (#16092) * docs: Document testPattern util * feat(ui): add types for patterns utils
- Loading branch information
1 parent
6ec4520
commit a092524
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ The `opts` parameter is optional and can be a String (mimeType) or an Object wit | |
|
||
* **mimeType** (optional) | ||
|
||
Examples: 'application/octect-stream' (default), 'text/plain', 'application/json', 'text/plain;charset=UTF-8', 'video/mp4', 'image/png', 'application/pdf' | ||
Examples: 'application/octet-stream' (default), 'text/plain', 'application/json', 'text/plain;charset=UTF-8', 'video/mp4', 'image/png', 'application/pdf' | ||
[https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) | ||
|
||
* **byteOrderMark** (optional) | ||
|
@@ -475,3 +475,24 @@ node.addEventListener('click', evt => { | |
event.stopAndPrevent(evt) | ||
}) | ||
``` | ||
|
||
## testPattern | ||
|
||
Test against particular patterns. | ||
|
||
```js | ||
import { patterns } from 'quasar' | ||
|
||
const { testPattern } = patterns | ||
|
||
testPattern.email('[email protected]') // true | ||
testPattern.email('foo') // false | ||
|
||
testPattern.hexColor('#fff') // true | ||
testPattern.hexColor('#ffffff') // true | ||
testPattern.hexColor('#FFF') // true | ||
testPattern.hexColor('#gggggg') // false | ||
|
||
// See the full list of patterns here: | ||
// https://github.com/quasarframework/quasar/blob/dev/ui/src/utils/patterns.js | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { EmbeddedValidationRule } from "../api/validation"; | ||
|
||
interface Patterns { | ||
/** | ||
* Test against particular patterns. | ||
*/ | ||
testPattern: Record<EmbeddedValidationRule, (value: any) => boolean>; | ||
} | ||
|
||
export declare const patterns: Patterns; |