Merge pull request #1110 from yohix/fix-typos

Fix typos across 30-seconds-of-code repo
This commit is contained in:
Angelos Chalaris
2020-03-24 08:34:42 +02:00
committed by GitHub
8 changed files with 8 additions and 8 deletions

View File

@ -65,7 +65,7 @@
"type": "snippetListing",
"title": "countVowels",
"attributes": {
"text": "Retuns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n",
"text": "Returns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n",
"tags": [
"string",
"beginner"

View File

@ -106,7 +106,7 @@
"type": "snippet",
"attributes": {
"fileName": "countVowels.md",
"text": "Retuns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n",
"text": "Returns `number` of vowels in provided string.\n\nUse a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.\n\n",
"codeBlocks": {
"es6": "const countVowels = str => (str.match(/[aeiou]/gi) || []).length;",
"es5": "var countVowels = function countVowels(str) {\n return (str.match(/[aeiou]/gi) || []).length;\n};",

View File

@ -915,7 +915,7 @@
"type": "glossaryTerm",
"title": "Recursion",
"attributes": {
"text": "Recursion is the repeated application of a process. \nIn JavaScript, recursion involves functions that call themselves repeatedly until they reach a base condition. \nThe base condition breaks out of the recursion loop because otherwise the function would call itself indefinitely. \nRecursion is very useful when working with nested data, especially when the nesting depth is dynamically defined or unkown.\n",
"text": "Recursion is the repeated application of a process. \nIn JavaScript, recursion involves functions that call themselves repeatedly until they reach a base condition. \nThe base condition breaks out of the recursion loop because otherwise the function would call itself indefinitely. \nRecursion is very useful when working with nested data, especially when the nesting depth is dynamically defined or unknown.\n",
"tags": [
"Recursion"
]

View File

@ -1858,7 +1858,7 @@
"type": "snippetListing",
"title": "haveSameContents",
"attributes": {
"text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n",
"text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n",
"tags": [
"array",
"intermediate"

View File

@ -3039,7 +3039,7 @@
"type": "snippet",
"attributes": {
"fileName": "haveSameContents.md",
"text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n",
"text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n",
"codeBlocks": {
"es6": "const haveSameContents = (a, b) => {\n for (const v of new Set([...a, ...b]))\n if (a.filter(e => e === v).length !== b.filter(e => e === v).length) return false;\n return true;\n};",
"es5": "function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nvar haveSameContents = function haveSameContents(a, b) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var v = _step.value;\n if (a.filter(function (e) {\n return e === v;\n }).length !== b.filter(function (e) {\n return e === v;\n }).length) return {\n v: false\n };\n };\n\n for (var _iterator = new Set([].concat(_toConsumableArray(a), _toConsumableArray(b)))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return true;\n};",

View File

@ -6,7 +6,7 @@ tags: array,intermediate
Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.
Use a `for...of` loop over a `Set` created from the values of both arrays.
Use `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.
Use `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.
Return `false` if the counts do not match for any element, `true` otherwise.
```js

View File

@ -3,7 +3,7 @@ title: countVowels
tags: string,beginner
---
Retuns `number` of vowels in provided string.
Returns `number` of vowels in provided string.
Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a `string`.

View File

@ -1202,7 +1202,7 @@
" return true;",
"};"
],
"description": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n"
"description": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurrences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n"
},
"head": {
"prefix": "30s_head",