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
// https://raw.githubusercontent.com/dwyl/english-words/master/words_dictionary.json | |
var list = JSON.parse(document.querySelector("pre").textContent); | |
var allWords = Object.keys(list); | |
var allowed = allWords.filter(({ length }) => length > 3); | |
function increaseLetterCount(letters, letter) { | |
if (!letters[letter]) { | |
letters[letter] = 0; | |
} |
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
// isNonNullObject() | |
console.log('Testing isNonNullObject() ...'); | |
console.assert(isNonNullObject({}), "An Object should be a non-null object"); | |
console.assert(isNonNullObject([]), "An Array should be a non-null object"); | |
console.assert(isNonNullObject(new WeakMap()), "A WeakMap should be a non-null object"); | |
console.assert(!isNonNullObject(null), "null should not be a non-null object"); | |
console.assert(!isNonNullObject(''), "A String should not be a non-null object"); | |
console.log('... complete!'); | |
// isIterable() | |
console.log('Testing isIterable() ...'); |
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
<!doctype html> | |
<html lang="en-GB"> | |
<head> | |
<title>Testing reactivity</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1,width=device-width"> | |
</head> |
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
/** | |
* Takes an element and finds the parent element that would scroll. | |
* | |
* @param {Element} element | |
* Element whose scrolling parent should be returned. | |
* @return {Element|null} | |
* Parent element that scrolls. If no parent can be found, null is | |
* returned. | |
*/ | |
function getScrollingParent(element) { |
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
/** | |
* Finds any matches within the given object that satisfy the given search | |
* function. | |
* | |
* @param {Object} object | |
* Object to search. | |
* @param {Function} search | |
* Function that will identify a match. The function is passed the | |
* key, the value, and the full path. If it returns any truthy value | |
* then the result will be considered a match. |