Datasets:
File size: 15,304 Bytes
e209e66 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | {"added": "2026-12-05", "author": "BrowserSync/browser-sync", "created": "2019", "id": "35821139436d536984ace259", "license": "Apache-2.0", "source": "code_search_net", "text": "Plugin init\n\nfunction (ui, bs) {\n ui.throttle = networkThrottle.init(ui, bs);\n ui.listen(\"network-throttle\", ui.throttle);\n }", "token_count": 37}
{"added": "2026-12-05", "author": "Xrew/bobril-chartjs", "created": "2019", "id": "df3b9a1c8cdc5727d3b6ae92", "license": "MIT", "source": "code_search_net", "text": "Get bar index from the given dataset index accounting for the fact that not all bars are visible\n\nfunction(datasetIndex) {\n\t\t\tvar barIndex = 0;\n\t\t\tvar meta, j;\n\n\t\t\tfor (j = 0; j < datasetIndex; ++j) {\n\t\t\t\tmeta = this.chart.getDatasetMeta(j);\n\t\t\t\tif (meta.bar && this.chart.isDatasetVisible(j)) {\n\t\t\t\t\t++barIndex;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn barIndex;\n\t\t}", "token_count": 99}
{"added": "2026-12-05", "author": "tangrams/tangram", "created": "2019", "id": "1232a746b122cf505453b63b", "license": "MIT", "source": "code_search_net", "text": "Simplified version of Leaflet's flyTo, for short animations zooming around a point\n\nfunction (layer, targetCenter, targetZoom) {\n map._stop();\n\n var startZoom = map._zoom;\n\n targetCenter = L.latLng(targetCenter);\n targetZoom = targetZoom === undefined ? startZoom : targetZoom;\n targetZoom = Math.min(targetZoom, map.getMaxZoom()); // don't go past max zoom\n\n var start = Date.now(),\n duration = 75;\n\n function frame() {\n var t = (Date.now() - start) / duration;\n\n if (t <= 1) {\n // reuse internal flyTo frame to ensure these animations are canceled like others\n map._flyToFrame = L.Util.requestAnimFrame(frame, map);\n setZoomAroundNoMoveEnd(layer, targetCenter, startZoom + (targetZoom - startZoom) * t);\n } else {\n setZoomAroundNoMoveEnd(layer, targetCenter, targetZoom)\n ._moveEnd(true);\n }\n }\n\n map._moveStart(true);\n\n frame.call(map);\n return map;\n }", "token_count": 235}
{"added": "2026-12-05", "author": "chge/tasty", "created": "2019", "id": "2fd95198a6dc99f21ca545d5", "license": "MIT", "source": "code_search_net", "text": "Executes queue.\n@method now\n@returns {Promise}\n@example\nit('types name into field', () => {\nclick('Name');\ntype('John Doe');\n\nreturn now();\n});\n@example\nit('works with async callbacks', (done) => {\nclick('Name');\ntype('John Doe');\n\nnow().then(done, done.fail);\n});\n@example\nit('works with async functions', async () => {\nclick('Name');\ntype('John Doe');\n\nawait now();\n});\n \nAdds function(s) to execution queue.\n@method now\n@param {...Function} functions Functions to add.\n@throws {TypeError}\n@example\nit('chooses behavior', () => {\nnow(\n() => now.text('Welcome back')\n.then(\n() => now.click('Log in'),\n() => now.click('Sign up')\n)\n);\n\nreturn now();\n});\n\nfunction now() {\r\n\t\tif (arguments.length) {\r\n\t\t\tenqueue.apply(\r\n\t\t\t\tnull,\r\n\t\t\t\tArray.prototype.map.call(arguments, (item) => {\r\n\t\t\t\t\tif (!instance(item, Function)) {\r\n\t\t\t\t\t\tthrow new TypeError('pass functions to now()');\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn item;\r\n\t\t\t\t})\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\tconst queue = now.queue;\r\n\t\t\tnow.queue = [];\r\n\r\n\t\t\treturn queue.reduce(\r\n\t\t\t\t(chain, item) => chain.then(item),\r\n\t\t\t\tPromise.resolve()\r\n\t\t\t);\r\n\t\t}\r\n\t}", "token_count": 279}
{"added": "2026-12-05", "author": "skerit/json-dry", "created": "2019", "id": "a9d7209f1dbda4b9fe538e1f", "license": "MIT", "source": "code_search_net", "text": "Convert from a dried object\n\n@author Jelle De Loecker <jelle@develry.be>\n@since 1.0.0\n@version 1.0.4\n\n@param {Object} value\n\n@return {Object}\n\nfunction parse(object, reviver) {\n\n\tvar undry_paths = new Map(),\n\t retrieve = {},\n\t reviver,\n\t result,\n\t holder,\n\t entry,\n\t temp,\n\t seen,\n\t path,\n\t key,\n\t old = {};\n\n\t// Create the reviver function\n\treviver = generateReviver(reviver, undry_paths);\n\n\tif (typeof object == 'string') {\n\t\tobject = JSON.parse(object);\n\t}\n\n\tif (!object || typeof object != 'object') {\n\t\treturn object;\n\t}\n\n\tresult = walk(object, reviver);\n\n\tif (result == null) {\n\t\treturn result;\n\t}\n\n\t// To remember which objects have already been revived\n\tseen = new WeakMap();\n\n\t// Maybe paths need another round of undrying\n\tundry_paths.extra_pass = [];\n\n\t// Iterate over all the values that require some kind of function to be revived\n\tundry_paths.forEach(function eachEntry(entry, path) {\n\n\t\tvar path_array = entry.drypath,\n\t\t path_string = path_array.join('.');\n\n\t\t// Regenerate this replacement wrapper first\n\t\tregenerate(result, null, entry, seen, retrieve, undry_paths, old, path_array.slice(0));\n\n\t\tif (entry.unDryConstructor) {\n\t\t\tentry.undried = entry.unDryConstructor.unDry(entry.value, false);\n\t\t} else if (entry.unDryFunction) {\n\t\t\tentry.undried = entry.unDryFunction(entry, null, entry.value);\n\t\t} else {\n\t\t\tentry.undried = entry.value;\n\t\t}\n\n\t\t// Remember the old wrapper entry, some other references\n\t\t// may still point to it's children\n\t\told[path_string] = entry;\n\n\t\tif (entry.drypath && entry.drypath.length) {\n\t\t\tsetPath(result, entry.drypath, entry.undried);\n\t\t}\n\t});\n\n\tfor (var i = 0; i < undry_paths.extra_pass.length; i++) {\n\t\tentry = undry_paths.extra_pass[i];\n\t\tholder = entry[0];\n\t\ttemp = entry[1];\n\t\tpath = entry[2];\n\n\t\tfor (key in holder) {\n\t\t\tif (holder[key] == temp) {\n\t\t\t\tholder[key] = temp.undried;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tpath.pop();\n\n\t\t// Annoying workaround for some circular references\n\t\tif (path.length && path[path.length - 1] == 'value') {\n\t\t\tpath.pop();\n\t\t}\n\n\t\tif (path.length) {\n\n\t\t\t// Get the other holder\n\t\t\tholder = retrieveFromPath(result, path);\n\n\t\t\t// If the holder object was not found in the result,\n\t\t\t// it was probably a child of ANOTHER holder that has already been undried & replaces\n\t\t\t// Just get the value from the object containing old references\n\t\t\tif (!holder) {\n\t\t\t\tholder = getFromOld(old, path);\n\t\t\t}\n\n\t\t\tfor (key in holder) {\n\t\t\t\tif (holder[key] == temp) {\n\t\t\t\t\tholder[key] = temp.undried;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Only now we can resolve paths\n\tresult = regenerate(result, result, result, seen, retrieve, undry_paths, old, []);\n\n\tif (result.undried != null && result.dry) {\n\t\treturn result.undried;\n\t}\n\n\treturn result;\n}", "token_count": 764}
{"added": "2026-12-05", "author": "SAP/openui5", "created": "2019", "id": "d4b382a825d9b8e32e4dac8a", "license": "Apache-2.0", "source": "code_search_net", "text": "This is the main function that handles the hash change event.\n\n@private\n\nfunction onHashChange(sHash){\n\t\t\tvar oRoute, iStep, oParsedHash, iNewHashIndex, sNavType;\n\n\t\t\t//handle the nonbookmarkable hash\n\t\t\tif (currentHash === undefined) {\n\t\t\t\t//url with hash opened from bookmark\n\t\t\t\toParsedHash = parseHashToObject(sHash);\n\n\t\t\t\tif (!oParsedHash || !oParsedHash.bBookmarkable) {\n\t\t\t\t\tif (jQuery.isFunction(defaultHandler)) {\n\t\t\t\t\t\tdefaultHandler(jQuery.sap.history.NavType.Bookmark);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (sHash.length === 0) {\n\t\t\t\tif (jQuery.isFunction(defaultHandler)) {\n\t\t\t\t\tdefaultHandler(jQuery.sap.history.NavType.Back);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//application restored from bookmark with non-empty hash, and later navigates back to the first hash token\n\t\t\t\t//the defaultHandler should be triggered\n\t\t\t\tiNewHashIndex = hashHistory.indexOf(sHash);\n\t\t\t\tif (iNewHashIndex === 0) {\n\t\t\t\t\toParsedHash = parseHashToObject(sHash);\n\t\t\t\t\tif (!oParsedHash || !oParsedHash.bBookmarkable) {\n\t\t\t\t\t\tif (jQuery.isFunction(defaultHandler)) {\n\t\t\t\t\t\t\tdefaultHandler(jQuery.sap.history.NavType.Back);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//need to handle when iNewHashIndex equals -1.\n\t\t\t\t//This happens when user navigates out the current application, and later navigates back.\n\t\t\t\t//In this case, the hashHistory is an empty array.\n\n\n\t\t\t\tif (isVirtualHash(sHash)) {\n\t\t\t\t\t//this is a virtual history, should do the skipping calculation\n\t\t\t\t\tif (isVirtualHash(currentHash)) {\n\t\t\t\t\t\t//go back to the first one that is not virtual\n\t\t\t\t\t\tiStep = calcStepsToRealHistory(sHash, false);\n\t\t\t\t\t\twindow.history.go(iStep);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar sameFamilyRegex = new RegExp(escapeRegExp(currentHash + skipSuffix) + \"[0-9]*$\");\n\t\t\t\t\t\tif (sameFamilyRegex.test(sHash)) {\n\t\t\t\t\t\t\t//going forward\n\t\t\t\t\t\t\t//search forward in history for the first non-virtual hash\n\t\t\t\t\t\t\t//if there is, change to that one window.history.go\n\t\t\t\t\t\t\t//if not, stay and return false\n\t\t\t\t\t\t\tiStep = calcStepsToRealHistory(sHash, true);\n\t\t\t\t\t\t\tif (iStep) {\n\t\t\t\t\t\t\t\twindow.history.go(iStep);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twindow.history.back();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//going backward\n\t\t\t\t\t\t\t//search backward for the first non-virtual hash and there must be one\n\t\t\t\t\t\t\tiStep = calcStepsToRealHistory(sHash, false);\n\t\t\t\t\t\t\twindow.history.go(iStep);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (iNewHashIndex === -1) {\n\t\t\t\t\t\tsNavType = jQuery.sap.history.NavType.Unknown;\n\t\t\t\t\t\thashHistory.push(sHash);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (hashHistory.indexOf(currentHash, iNewHashIndex + 1) === -1) {\n\t\t\t\t\t\t\tsNavType = jQuery.sap.history.NavType.Forward;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsNavType = jQuery.sap.history.NavType.Back;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\n\t\t\t\t\toParsedHash = parseHashToObject(sHash);\n\t\t\t\t\tif (oParsedHash) {\n\t\t\t\t\t\toRoute = findRouteByIdentifier(oParsedHash.sIdentifier);\n\n\t\t\t\t\t\tif (oRoute) {\n\t\t\t\t\t\t\toRoute.action.apply(null, [oParsedHash.oStateData, sNavType]);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tLog.error(\"hash format error! The current Hash: \" + sHash);\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}", "token_count": 787}
{"added": "2026-12-05", "author": "webduinoio/webduino-blockly", "created": "2019", "id": "4aaa68f8b2bbbd465cc1b09b", "license": "MIT", "source": "code_search_net", "text": "Block for creating a list with one element repeated.\n@this Blockly.Block\n\nfunction() {\n this.jsonInit({\n \"message0\": Blockly.Msg.LISTS_REPEAT_TITLE,\n \"args0\": [\n {\n \"type\": \"input_value\",\n \"name\": \"ITEM\"\n },\n {\n \"type\": \"input_value\",\n \"name\": \"NUM\",\n \"check\": \"Number\"\n }\n ],\n \"output\": \"Array\",\n \"colour\": Blockly.Blocks.lists.HUE,\n \"tooltip\": Blockly.Msg.LISTS_REPEAT_TOOLTIP,\n \"helpUrl\": Blockly.Msg.LISTS_REPEAT_HELPURL\n });\n }", "token_count": 133}
{"added": "2026-12-05", "author": "zohararad/sails-rest", "created": "2019", "id": "01e223573d34dd6ca8e93474", "license": "MIT", "source": "code_search_net", "text": "Create record(s)\n@param {String} connection - connection identifier\n@param {String} collection - collection name. appended to API pathname.\nFor example, given the api `http://localhost:8080/api/v1`,\na collection named `user` will resolve to `http://localhost:8080/api/v1/user`.\n@param {Array<Object>} values - values of records to create.\n@param {Function} cb - function to call with query results.\n\nfunction (connection, collection, values, cb) {\n return Connection.create(connections[connection], collection, values, cb);\n }", "token_count": 119}
{"added": "2026-12-05", "author": "MaartenDesnouck/google-apps-script", "created": "2019", "id": "bd2ecc6db6d0776381a32983", "license": "MIT", "source": "code_search_net", "text": "Push the local google script file back to remote\n\n@param {google.auth.OAuth2} auth - An authorized OAuth2 client.\n@param {String} projectId - Id of the Google Apps Script project.\n@returns {Promise} - A promise resolving no value\n\nfunction getDeployments(auth, projectId) {\n return new Promise((resolve, reject) => {\n const script = google.script('v1');\n script.projects.deployments.list({\n auth,\n scriptId: projectId,\n }, (error, deployments) => {\n if (error) {\n triageGoogleError(error, 'getDeployments').then((triaged) => {\n reject(triaged);\n }).catch((notTriaged) => {\n reject(notTriaged);\n });\n } else {\n resolve(deployments.data);\n }\n return;\n });\n });\n}", "token_count": 177}
{"added": "2026-12-05", "author": "sreenaths/em-tgraph", "created": "2019", "id": "245bd4af30c104e4120ed759", "license": "MIT", "source": "code_search_net", "text": "Tip supports 3 visual entities in the tooltip. Title, description text and a list.\n_setData sets all these based on the passed data object\n@param data {Object} An object of the format\n{\ntitle: \"tip title\",\ntext: \"tip description text\",\nkvList: {\npropertyName1: \"property value 1\",\n..\npropertyNameN: \"property value N\",\n}\n}\n\nfunction _setData(data) {\n _element.find('.tip-title').html(data.title || \"\");\n _element.find('.tip-text').html(data.text || \"\");\n _element.find('.tip-text')[data.text ? 'show' : 'hide']();\n _element.find('.tip-list').html(_createList(data.kvList) || \"\");\n}", "token_count": 150}
{"added": "2026-12-05", "author": "hiproxy/step-flow", "created": "2019", "id": "a2cb7685d559556425a44318", "license": "MIT", "source": "code_search_net", "text": "执行错误处理函数\n\n@private\n@param {Error} err 错误信息\n@param {Object} ctx 上下文对象\n@param {Object} thisArg this对象\n@returns {StepFlow}\n\nfunction (err, ctx, thisArg) {\n this.errorHanders.forEach(function (fn) {\n fn.call(thisArg, err, ctx);\n });\n\n return this;\n }", "token_count": 82}
{"added": "2026-12-05", "author": "Wtower/ng-gentelella", "created": "2019", "id": "274602d4a8da426c1474a1fd", "license": "MIT", "source": "code_search_net", "text": "if the plugin is active register processDatapoints method\n\nfunction processOptions(plot, options) {\n\t\t\tif (options.series.curvedLines.active) {\n\t\t\t\tplot.hooks.processDatapoints.unshift(processDatapoints);\n\t\t\t}\n\t\t}", "token_count": 52}
|