Travis build: 1102 [cron]

This commit is contained in:
30secondsofcode
2019-04-08 15:31:34 +00:00
parent 27b26630ab
commit 46d53eb35d
7 changed files with 191 additions and 57 deletions

View File

@ -386,7 +386,7 @@
"archived": false
},
"meta": {
"hash": "01f1ea63f0660c6cd189722d2bf4ee10a651649d14338ca6dca7037106faaf61"
"hash": "a54a645ae51358e2a652adcd19b465e5da0c39d1ebf7a3a393b92cb2c8762883"
}
},
{
@ -1374,6 +1374,21 @@
"hash": "72c557bd9def493e3a138705f5cb66f993228bd7e51b11fa84f85841bc035524"
}
},
{
"id": "formToObject",
"type": "snippetListing",
"attributes": {
"tags": [
"browser",
"object",
"intermediate"
],
"archived": false
},
"meta": {
"hash": "2bb4becd71bb5d71e6581e9d944fb44cca6c2c6441fe169fbc1b83e8ed48b4a6"
}
},
{
"id": "forOwn",
"type": "snippetListing",
@ -3407,7 +3422,7 @@
"archived": false
},
"meta": {
"hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e"
}
},
{
@ -3779,7 +3794,7 @@
"archived": false
},
"meta": {
"hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11"
}
},
{
@ -3960,6 +3975,21 @@
"hash": "a69e2913ccc5c7ca2100de571087a44c14b7ca475154740bace342852357b379"
}
},
{
"id": "serializeForm",
"type": "snippetListing",
"attributes": {
"tags": [
"browser",
"string",
"intermediate"
],
"archived": false
},
"meta": {
"hash": "2667730d717644182036005fffd041cb6f44173d1dc64e8d75ccf491a66e1ebb"
}
},
{
"id": "setStyle",
"type": "snippetListing",

View File

@ -568,7 +568,7 @@
},
"meta": {
"archived": false,
"hash": "01f1ea63f0660c6cd189722d2bf4ee10a651649d14338ca6dca7037106faaf61"
"hash": "a54a645ae51358e2a652adcd19b465e5da0c39d1ebf7a3a393b92cb2c8762883"
}
},
{
@ -2025,6 +2025,28 @@
"hash": "72c557bd9def493e3a138705f5cb66f993228bd7e51b11fa84f85841bc035524"
}
},
{
"id": "formToObject",
"type": "snippet",
"attributes": {
"fileName": "formToObject.md",
"text": "Encode a set of form elements as an `object`.\n\nUse the `FormData` constructor to convert the HTML `form` to `FormData`, `Array.from()` to convert to an array.\nCollect the object from the array, using `Array.prototype.reduce()`.",
"codeBlocks": {
"es6": "const formToObject = form =>\n Array.from(new FormData(form)).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value\n }),\n {}\n );",
"es5": "function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar formToObject = function formToObject(form) {\n return Array.from(new FormData(form)).reduce(function (acc, _ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n\n return _objectSpread({}, acc, _defineProperty({}, key, value));\n }, {});\n};",
"example": "formToObject(document.querySelector('#form')); // { email: 'test@email.com', name: 'Test Name' }"
},
"tags": [
"browser",
"object",
"intermediate"
]
},
"meta": {
"archived": false,
"hash": "2bb4becd71bb5d71e6581e9d944fb44cca6c2c6441fe169fbc1b83e8ed48b4a6"
}
},
{
"id": "forOwn",
"type": "snippet",
@ -5006,7 +5028,7 @@
"codeBlocks": {
"es6": "const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));",
"es5": "var pipeAsyncFunctions = function pipeAsyncFunctions() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n\n return function (arg) {\n return fns.reduce(function (p, f) {\n return p.then(f);\n }, Promise.resolve(arg));\n };\n};",
"example": "const sum = pipeAsyncFunctions(\n x => x + 1,\n x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n x => x + 3,\n async x => (await x) + 4\n);\n(async () => {\n console.log(await sum(5)); // 15 (after one second)\n})();"
"example": "const sum = pipeAsyncFunctions(\n x => x + 1,\n x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n x => x + 3,\n async x => (await x) + 4\n);\n(async() => {\n console.log(await sum(5)); // 15 (after one second)\n})();"
},
"tags": [
"adapter",
@ -5017,7 +5039,7 @@
},
"meta": {
"archived": false,
"hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e"
}
},
{
@ -5553,7 +5575,7 @@
"fileName": "remove.md",
"text": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`).",
"codeBlocks": {
"es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];",
"es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];",
"es5": "var remove = function remove(arr, func) {\n return Array.isArray(arr) ? arr.filter(func).reduce(function (acc, val) {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, []) : [];\n};",
"example": "remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]"
},
@ -5564,7 +5586,7 @@
},
"meta": {
"archived": false,
"hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11"
}
},
{
@ -5829,6 +5851,28 @@
"hash": "a69e2913ccc5c7ca2100de571087a44c14b7ca475154740bace342852357b379"
}
},
{
"id": "serializeForm",
"type": "snippet",
"attributes": {
"fileName": "serializeForm.md",
"text": "Encode a set of form elements as a query string.\n\nUse the `FormData` constructor to convert the HTML `form` to `FormData`, `Array.from()` to convert to an array, passing a map function as the second argument.\nUse `Array.prototype.map()` and `window.encodeURIComponent()` to encode each field's value.\nUse `Array.prototype.join()` with appropriate argumens to produce an appropriate query string.",
"codeBlocks": {
"es6": "const serializeForm = form =>\n Array.from(new FormData(form), field => field.map(encodeURIComponent).join('=')).join('&');",
"es5": "var serializeForm = function serializeForm(form) {\n return Array.from(new FormData(form), function (field) {\n return field.map(encodeURIComponent).join('=');\n }).join('&');\n};",
"example": "serializeForm(document.querySelector('#form')); // email=test%40email.com&name=Test%20Name"
},
"tags": [
"browser",
"string",
"intermediate"
]
},
"meta": {
"archived": false,
"hash": "2667730d717644182036005fffd041cb6f44173d1dc64e8d75ccf491a66e1ebb"
}
},
{
"id": "setStyle",
"type": "snippet",