Tag, lint, build

This commit is contained in:
Angelos Chalaris
2017-12-14 23:00:38 +02:00
parent 7c0e044e03
commit aafeaaabda
2 changed files with 32 additions and 3 deletions

View File

@ -74,7 +74,7 @@
* [Standard deviation](#standard-deviation)
### Media
* [Speech_synthesis (experimental)](#speech_synthesis-experimental)
* [Speech synthesis (experimental)](#speech-synthesis-experimental)
### Object
* [Object from key value pairs](#object-from-key-value-pairs)
@ -99,6 +99,7 @@
* [Is string](#is-string)
* [Is symbol](#is-symbol)
* [Measure time taken by function](#measure-time-taken-by-function)
* [Number to array of digits](#number-to-array-of-digits)
* [Ordinal suffix of number](#ordinal-suffix-of-number)
* [Random integer in range](#random-integer-in-range)
* [Random number in range](#random-number-in-range)
@ -818,7 +819,22 @@ const standardDeviation = (arr, usePopulation = false) => {
[⬆ back to top](#table-of-contents)
## Media
undefined
### Speech synthesis (experimental)
Use `SpeechSynthesisUtterance.voice` and `indow.speechSynthesis.getVoices()` to convert a message to speech.
Use `window.speechSynthesis.speak()` to play the message.
Learn more about the [SpeechSynthesisUtterance interface of the Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance).
```js
const speak = message => {
const msg = new SpeechSynthesisUtterance(message);
msg.voice = window.speechSynthesis.getVoices()[0];
window.speechSynthesis.speak(msg);
};
// speak('Hello, World') -> plays the message
```
[⬆ back to top](#table-of-contents)
## Object
@ -1051,6 +1067,18 @@ const timeTaken = callback => {
[⬆ back to top](#table-of-contents)
### Number to array of digits
Convert the number to a string, use `split()` to convert build an array.
Use `Array.map()` and `parseInt()` to transform each value to an integer.
```js
const digitize = n => (''+n).split('').map(i => parseInt(i));
// digitize(2334) -> [2, 3, 3, 4]
```
[⬆ back to top](#table-of-contents)
### Ordinal suffix of number
Use the modulo operator (`%`) to find values of single and tens digits.

View File

@ -49,6 +49,7 @@ is-symbol:utility
last-of-list:array
measure-time-taken-by-function:utility
median-of-array-of-numbers:array
number-to-array-of-digits:utility
object-from-key-value-pairs:object
object-to-key-value-pairs:object
ordinal-suffix-of-number:utility
@ -68,7 +69,7 @@ shuffle-array:array
similarity-between-arrays:array
sleep:function
sort-characters-in-string-(alphabetical):string
speech_synthesis-(experimental):media
speech-synthesis-(experimental):media
standard-deviation:math
sum-of-array-of-numbers:array
swap-values-of-two-variables:utility