File tree Expand file tree Collapse file tree 7 files changed +3516
-2806
lines changed Expand file tree Collapse file tree 7 files changed +3516
-2806
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ category : ' @Browser'
3+ ---
4+
5+ # speak
6+
7+ speaks a message.
8+
9+ ## Usage
10+
11+ ``` ts
12+ import { speak } from ' @use-kit/functions'
13+
14+ speak (' Hi!' )
15+ ```
Original file line number Diff line number Diff line change 1+ export const speak = (
2+ text : string ,
3+ lang = 'en-US' ,
4+ rate = 1.0 ,
5+ pitch = 1.0 ,
6+ volume = 1.0 ) => {
7+ if ( typeof window !== 'undefined' && 'speechSynthesis' in window ) {
8+ try {
9+ const utterance = new SpeechSynthesisUtterance ( text )
10+ utterance . lang = lang
11+ utterance . rate = rate
12+ utterance . pitch = pitch
13+ utterance . volume = volume
14+ window . speechSynthesis . speak ( utterance )
15+ return true
16+ }
17+ catch ( error ) {
18+ return false
19+ }
20+ }
21+ else {
22+ console . warn ( 'Speech synthesis is not supported in this environment.' )
23+ return false
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ ---
2+ category : ' @Browser'
3+ ---
4+
5+ # speak
6+
7+ speaks a message.
8+
9+ ## Usage
10+
11+ ``` ts
12+ import { speak } from ' @use-kit/functions'
13+
14+ speak (' Hi!' )
15+ ```
Original file line number Diff line number Diff line change 1+ ---
2+ category : ' @Core'
3+ ---
4+
5+ # cacheField
6+
7+ Cache a field value.
8+
9+ ## Usage
10+
11+ <!-- ```ts
12+ import { cacheField } from '@vueuse/core'
13+
14+ const { value, set } = cacheField()
15+ set('foo', 'bar')
16+ value.value // 'bar'
17+ ``` -->
18+
19+ ``` ts
20+ import { cacheField } from ' @use-kit/functions'
21+
22+ const ret = await cacheField (' a' , ' test' )
23+ ```
Original file line number Diff line number Diff line change 1- // TODO:
1+ ---
2+ category : ' @Core'
3+ ---
4+
5+ # isValidJSON
6+
7+ Validates if a string is a valid JSON.
8+
9+ ## Usage
10+
11+ ``` ts
12+ import { isValidJSON } from ' @use-kit/functions'
13+
14+ isValidJSON (' { "foo": "bar" }' ) // true
15+ ```
Original file line number Diff line number Diff line change 11// TODO:
2+ ---
3+ category: '@Core '
4+ ---
5+
6+ # stringByteSize
7+
8+ Checks if a string is of a certain length.
9+
10+ ## Usage
11+
12+ ``` ts
13+ import { stringByteSize } from ' @use-kit/functions'
14+
15+ stringByteSize (' ' ) // 0
16+ stringByteSize (' a' ) // 1
17+ stringByteSize (' ab' ) // 2
18+ stringByteSize (' abc' ) // 3
19+ stringByteSize (' abcd' ) // 4
20+ stringByteSize (' abcde' ) // 5
21+ stringByteSize (' 😜' ) // 4
22+ ```
You can’t perform that action at this time.
0 commit comments