{ "data": [ { "id": "all", "type": "snippet", "attributes": { "fileName": "all.md", "text": "Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise.\r\n\r\nUse `Array.every()` to test if all elements in the collection return `true` based on `fn`.\r\nOmit the second argument, `fn`, to use `Boolean` as a default.", "codeBlocks": [ "const all = (arr, fn = Boolean) => arr.every(fn);", "all([4, 2, 3], x => x > 1); // true\r\nall([1, 2, 3]); // true" ], "tags": [ "array", "function" ] }, "meta": { "archived": false, "hash": "69ea1bb81e034e198af4c61f9440f4e125e3828cbf36fe0ec6efb9da9f98710b" } }, { "id": "any", "type": "snippet", "attributes": { "fileName": "any.md", "text": "Returns `true` if the provided predicate function returns `true` for at least one element in a collection, `false` otherwise.\r\n\r\nUse `Array.some()` to test if any elements in the collection return `true` based on `fn`.\r\nOmit the second argument, `fn`, to use `Boolean` as a default.", "codeBlocks": [ "const any = (arr, fn = Boolean) => arr.some(fn);", "any([0, 1, 2, 0], x => x >= 2); // true\r\nany([0, 0, 1, 0]); // true" ], "tags": [ "array", "function" ] }, "meta": { "archived": false, "hash": "3788d0787d355e1e8c3014cb3e61055351eba582cb5866bd25f754c37b0e7ba2" } }, { "id": "approximatelyEqual", "type": "snippet", "attributes": { "fileName": "approximatelyEqual.md", "text": "Checks if two numbers are approximately equal to each other.\r\n\r\nUse `Math.abs()` to compare the absolute difference of the two values to `epsilon`.\r\nOmit the third parameter, `epsilon`, to use a default value of `0.001`.", "codeBlocks": [ "const approximatelyEqual = (v1, v2, epsilon = 0.001) => Math.abs(v1 - v2) < epsilon;", "approximatelyEqual(Math.PI / 2.0, 1.5708); // true" ], "tags": [ "math" ] }, "meta": { "archived": false, "hash": "2b68e79d3ebb806379c3b84ae70152e033297d6e4fd4bc779b10be81ca2fc0cf" } }, { "id": "arrayToHtmlList", "type": "snippet", "attributes": { "fileName": "arrayToHtmlList.md", "text": "Converts the given array elements into `