Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Create a function which is the intersection of two other functions. Like the && operator, if the first is truthy, the second is never called, otherwise the return value from the second is returned.
function lazyIntersection(fn1, fn2) { return function (param) { return fn1(param) && fn2(param); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lazyIntersection (fn1, fn2) {\n return function (param) {\n return fn1(param) && fn2(param)\n }\n}", "function and(x) {\n return function(y) {\n return x && y;\n };\n }", "function intersection(a, b){\n return(\n // replace this line with your code\n );\n}", "function andWrappe...
[ "0.75988007", "0.6950811", "0.681826", "0.6688605", "0.66456413", "0.66456413", "0.66456413", "0.66456413", "0.6629008", "0.65834016", "0.65752256", "0.63430524", "0.63117045", "0.6303526", "0.6285732", "0.616086", "0.61520785", "0.60362303", "0.60107607", "0.5980461", "0.596...
0.7558619
7
A function which does nothing
function noop(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doNothing() {}", "function doNothing() {}", "function doNothing() {}", "function doNothing() {}", "function doNothing() {}", "function doNothing() { }", "function no_op () {}", "function noop () {}", "function noop () {}", "function noop () {}", "function noop () {}", "function noop ...
[ "0.8793988", "0.8793988", "0.8793988", "0.8793988", "0.8793988", "0.8647934", "0.8624792", "0.8503297", "0.8503297", "0.8503297", "0.8503297", "0.8503297", "0.8503297", "0.8503297", "0.8503297", "0.85012114", "0.84579474", "0.84579474", "0.84579474", "0.84579474", "0.84579474...
0.8475556
39
A function which is always happy
function always(){return true}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nope() {}", "function nope() {}", "function StupidBug() {}", "function check() {}", "function notGood() { // if I have a function called not good\n return Math.random() // & this not good functioin is going to return // Mayh dot random\n}", "function VeryBadError() {}", "function dummy(){}"...
[ "0.66139454", "0.66139454", "0.65683144", "0.65512323", "0.6497628", "0.6386442", "0.62016225", "0.62016225", "0.62016225", "0.61650074", "0.6158426", "0.6133558", "0.6114283", "0.6083694", "0.60647416", "0.60647416", "0.60647416", "0.60628074", "0.60449886", "0.6041852", "0....
0.58053166
54
Create a function which always returns the same value var return3 = functor(3); return3() // gives 3 return3() // still gives 3 return3() // will always give 3
function functor(val){ return function(){ return val; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function functor (val) {\n return function () {\n return val\n }\n}", "function functor(x){\n\treturn function(){\n\t\treturn x;\n\t};\n}", "function functor(v) {\n return typeof v === 'function' ? v : function() {\n return v\n }\n }", "function functor(v) {\r\n return typeof v === 'f...
[ "0.74988925", "0.732461", "0.68002474", "0.67617923", "0.66669136", "0.65427643", "0.63732994", "0.6012958", "0.59469205", "0.59189856", "0.5875753", "0.586091", "0.58082867", "0.58082867", "0.58082867", "0.58082867", "0.58082867", "0.58082867", "0.57525474", "0.5696657", "0....
0.7680797
6
This file defines some loosely associated syntactic sugar for Javascript programming Returns true if the given candidate is of type T
function isOfType(T, maybeSomething){ return maybeSomething && maybeSomething.constructor === T; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is(v, t) { return typeof v === t; }", "function T(){\n\treturn true;\n}", "function C(t,e){return typeof t===e}", "function F(t) {\n return \"object\" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));\n}", "function an(t) {\n ...
[ "0.6773658", "0.62126726", "0.609657", "0.5995941", "0.59920883", "0.5960605", "0.59325045", "0.58843726", "0.58728945", "0.58728945", "0.58728945", "0.5862482", "0.58479786", "0.58479786", "0.5841718", "0.58264315", "0.5798158", "0.5798158", "0.57959735", "0.5780585", "0.576...
0.0
-1
I don't like saying this: foo !=== undefined because of the doublenegative. I find this: defined(foo) easier to read.
function defined( value ) { return value !== undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function defined (arg) { return arg !== undefined}", "function defined (value) {\n return value !== undefined\n}", "function defined (value) {\n\t return typeof value !== 'undefined'\n\t}", "function defined(v)\n{\n\treturn (typeof(v) != 'undefined');\n}", "function defined$1(obj) {\n return typeof obj ...
[ "0.8395529", "0.8015126", "0.79062027", "0.77575314", "0.76798534", "0.7638963", "0.7592784", "0.75598925", "0.7470066", "0.7392402", "0.73504394", "0.73242307", "0.7288666", "0.72472495", "0.72472495", "0.72472495", "0.72472495", "0.72472495", "0.7231309", "0.72265005", "0.7...
0.81839603
7
Returns true if object o has a key named like every property in the properties array. Will give false if any are missing, or if o is not an object.
function hasAllProperties(fieldList, o) { return (o instanceof Object) && all(function (field) { return (field in o); }, fieldList); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasProps(o) {\n for (i in o) return true;\n }", "function has( object, propNames ) {\n\t\t\t\t\tfor( var i = 0; i < propNames.length; ++i ) {\n\t\t\t\t\t\tif( object.hasOwnProperty( propNames ) )\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\t...
[ "0.77182394", "0.74548626", "0.722142", "0.7131655", "0.7111317", "0.70374644", "0.69880354", "0.6985772", "0.6972305", "0.69522864", "0.6932267", "0.6927867", "0.684966", "0.684966", "0.6809011", "0.67923915", "0.678954", "0.67798823", "0.677731", "0.6772354", "0.6770766", ...
0.66436183
73
Like cons in Lisp
function cons(x, xs) { /* Internally lists are linked 2-element Javascript arrays. Ideally the return here would be Object.freeze([x,xs]) so that bugs related to mutation are found fast. However, cons is right on the critical path for performance and this slows oboe-mark down b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cons(head, tail) {\n return { head, tail };\n}", "function cons (x, xs) {\n /* Internally lists are linked 2-element Javascript arrays.\n\n Ideally the return here would be Object.freeze([x,xs])\n so that bugs related to mutation are found fast.\n However, cons is right on the critical ...
[ "0.73749775", "0.69625324", "0.6743581", "0.66580504", "0.6459964", "0.6441842", "0.6375029", "0.6245835", "0.62455195", "0.61603737", "0.58383864", "0.581819", "0.57794046", "0.5750345", "0.5690643", "0.56327784", "0.5557596", "0.5557596", "0.5548432", "0.54966044", "0.54858...
0.7093369
7
Converts an array to a list asList([a,b,c]) is equivalent to: cons(a, cons(b, cons(c, emptyList)))
function arrayAsList(inputArray){ return reverseList( inputArray.reduce( flip(cons), emptyList ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayAsList (inputArray) {\n return reverseList(\n inputArray.reduce(\n Object(__WEBPACK_IMPORTED_MODULE_0__functional__[\"e\" /* flip */])(cons),\n emptyList\n )\n )\n}", "function arrayToList(array = []) {\n let list = null;\n let i = array.length;\n while (i > 0) list = pre...
[ "0.7748862", "0.7040961", "0.69599897", "0.6929483", "0.68886787", "0.67573625", "0.67573625", "0.67573625", "0.67396533", "0.67245305", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.6650379", "0.665037...
0.7979384
6
Convert a list back to a js native array
function listAsArray(list){ return foldR( function(arraySoFar, listItem){ arraySoFar.unshift(listItem); return arraySoFar; }, [], list ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toArray(list) {\r\n\t return Array.prototype.slice.call(list || [], 0);\r\n\t}", "function toArray(list)\r\n{\r\n return list;\r\n // return Array.prototype.slice.call(list || [], 0);\r\n}", "function toArray(list){\n var array = Array(list.length);\n for(let i=0; i < list.length; i++){\n ...
[ "0.76975906", "0.7671008", "0.7663175", "0.76201445", "0.74471706", "0.7360083", "0.73347", "0.72843766", "0.7191045", "0.713175", "0.71242034", "0.7116337", "0.7063999", "0.705601", "0.6979862", "0.696368", "0.69499534", "0.69499534", "0.6948027", "0.6917901", "0.6911496", ...
0.71514964
16
Map a function over a list
function map(fn, list) { return list ? cons(fn(head(list)), map(fn,tail(list))) : emptyList ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function map(list, fn) { // ⭐ Important function! ⭐\n let output = [];\n for (let i = 0, l = list.length; i < l; i += 1) {\n let mapped = fn(list[i]);\n output.push(mapped);\n }\n return output;\n}", "function map(list, func) {\n var result_list = new Array();\n for (var i = 0; i < list....
[ "0.83730376", "0.82014376", "0.8185137", "0.8118739", "0.81147003", "0.8036077", "0.785059", "0.7441468", "0.7393876", "0.73890585", "0.73749095", "0.7355015", "0.7315491", "0.7278402", "0.7236497", "0.72036546", "0.71878934", "0.71641165", "0.7133308", "0.7127343", "0.711582...
0.81153446
11
Return a list like the one given but with the first instance equal to item removed
function without(list, test, removedFn) { return withoutInner(list, removedFn || noop); function withoutInner(subList, removedFn) { return subList ? ( test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remDupItem(arr) {\n return arr.filter((value, index, self) => {\n return self.indexOf(value) === index;\n })\n}", "function remove (lista) {\n lista.shift();\n return lista;\n}", "function removeDuplicate(items){\n let newItems = items.filter((element,index) => items.indexOf(ele...
[ "0.6901831", "0.6843859", "0.6701577", "0.6604539", "0.6604539", "0.6501595", "0.6422362", "0.6412378", "0.6371361", "0.6366875", "0.63510007", "0.63443476", "0.626875", "0.6268128", "0.6263658", "0.6260805", "0.6233951", "0.6211543", "0.6194384", "0.6158153", "0.61479163", ...
0.0
-1
Returns true if the given function holds for every item in the list, false otherwise
function all(fn, list) { return !list || ( fn(head(list)) && all(fn, tail(list)) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "every(callback) {\r\n for (let i = 0; i < this.array.length; i++) {\r\n const item = this.array[i];\r\n if (!callback(item)) return false;\r\n }\r\n return true;\r\n }", "@expression(\"every item (of|in) <List> (where|with) <method>\", {\n\t\ttypes: [ List, Function ...
[ "0.7580521", "0.74182856", "0.72775483", "0.7224811", "0.71851826", "0.7140929", "0.70988935", "0.7006851", "0.6979306", "0.6963859", "0.6869331", "0.68570554", "0.6845952", "0.68298227", "0.68298227", "0.68298227", "0.6796007", "0.67856354", "0.6738587", "0.67159575", "0.670...
0.7220579
11
Call every function in a list of functions with the same arguments This doesn't make any sense if we're doing pure functional because it doesn't return anything. Hence, this is only really useful if the functions being called have sideeffects.
function applyEach(fnList, args) { if( fnList ) { head(fnList).apply(null, args); applyEach(tail(fnList), args); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function callTogether () {\n var funcs = arguments\n var length = funcs.length\n var index = length\n\n if (!length) {\n return function () {}\n }\n\n return function () {\n length = index\n\n while (length--) {\n var fn = funcs[length]\n if (typeof fn === 'function') {\n var result...
[ "0.69970524", "0.6863128", "0.6816724", "0.66131234", "0.6569332", "0.6461589", "0.62659895", "0.6260036", "0.62070847", "0.6202451", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101", "0.6152101",...
0.6780823
9
Reverse the order of a list
function reverseList(list){ // js re-implementation of 3rd solution from: // http://www.haskell.org/haskellwiki/99_questions/Solutions/5 function reverseInner( list, reversedAlready ) { if( !list ) { return reversedAlready; } return reverseInner(tail(list), cons(head(list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverseList(list) {\n return list.reverse();\n}", "function reverseList(list) {\n return list.reverse()\n}", "function reverse(list) {\n var t=0;\n j=list.length-1;\n for (let i = 0; i < list.length-1; i++) {\n t = list[j];\n list[j]=list[i];\n list[i]=t;\n j=j-1;...
[ "0.83162236", "0.8291335", "0.79337966", "0.77167106", "0.742674", "0.741191", "0.72173846", "0.71763325", "0.7175601", "0.71672726", "0.7164818", "0.7079948", "0.7075892", "0.7021559", "0.7015061", "0.6995807", "0.69235563", "0.6920119", "0.69078356", "0.69077224", "0.690450...
0.719716
14
js reimplementation of 3rd solution from:
function reverseInner( list, reversedAlready ) { if( !list ) { return reversedAlready; } return reverseInner(tail(list), cons(head(list), reversedAlready)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "static private internal function m121() {}", "private public function m246() {}", "protected internal function m252() {}", "function Ze(){if(ea)t.innerHTML=ha;else if(ia)t.innerHTML=ia;$e();eb&&hb.call(window,eb);nb();eb=-1;bb=[];cb={};ac=j;Zb=0;$b=[];w.Cc();Bb=0;Cb=[...
[ "0.55060774", "0.519085", "0.5177391", "0.51607513", "0.51258755", "0.5085455", "0.5085455", "0.50399077", "0.50358045", "0.5035341", "0.49879134", "0.4933404", "0.4891191", "0.4852665", "0.48520368", "0.48452288", "0.48315334", "0.48226088", "0.48220694", "0.48151147", "0.48...
0.0
-1
This is a slightly hackedup browser only version of clarinet some features removed to help keep browser Oboe under the 5k microlibrary limit plug directly into event bus For the original go here: We receive the events: STREAM_DATA STREAM_END We emit the events: SAX_KEY SAX_VALUE_OPEN SAX_VALUE_CLOSE FAIL_EVENT
function clarinet(eventBus) { "use strict"; var // shortcut some events on the bus emitSaxKey = eventBus(SAX_KEY).emit, emitValueOpen = eventBus(SAX_VALUE_OPEN).emit, emitValueClose = eventBus(SAX_VALUE_CLOSE).emit, emitFail = eventBus(FAIL_EVENT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clarinet(eventBus) {\n \"use strict\";\n \n var \n // shortcut some events on the bus\n emitSaxKey = eventBus(SAX_KEY).emit,\n emitValueOpen = eventBus(SAX_VALUE_OPEN).emit,\n emitValueClose = eventBus(SAX_VALUE_CLOSE).emit,\n emitFail = even...
[ "0.63723", "0.63723", "0.63723", "0.63723", "0.63723", "0.63723", "0.63723", "0.63723", "0.6200149", "0.54786485", "0.5399548", "0.5308736", "0.5250425", "0.51647264", "0.5151726", "0.5127914", "0.509503", "0.50791407", "0.5064688", "0.5034435", "0.5014174", "0.5006272", ...
0.63723
6
based on gist XmlHttpRequest's getAllResponseHeaders() method returns a string of response headers according to the format described here: This method parses that string into a userfriendly key/value pair object.
function parseResponseHeaders(headerStr) { var headers = {}; headerStr && headerStr.split('\u000d\u000a') .forEach(function(headerPair){ // Can't use split() here because it does the wrong thing // if the header value has the string ": " in it. var index = headerPair.index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseResponseHeaders (headerStr) {\n var headers = {}\n if (!headerStr) {\n return headers\n }\n var headerPairs = headerStr.split('\\u000d\\u000a')\n for (var i = 0; i < headerPairs.length; i++) {\n var headerPair = headerPairs[i]\n // Can't use split() here because it does the wrong thing\...
[ "0.7906773", "0.78304", "0.7823705", "0.78013664", "0.7781234", "0.7740536", "0.7309563", "0.68755865", "0.6615988", "0.6526599", "0.63809764", "0.6303385", "0.6279102", "0.62313837", "0.60724264", "0.60378855", "0.6026536", "0.60099024", "0.6008887", "0.599122", "0.5881012",...
0.77097905
14
NB: defaultPort only knows http and https. Returns undefined otherwise.
function defaultPort(protocol) { return {'http:':80, 'https:':443}[protocol]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function defaultPort (protocol) {\n return { 'http:': 80, 'https:': 443 }[protocol]\n }", "function getPort() {\n var self = this;\n if (typeof self.parameters.port === 'undefined') {\n return self.parameters.secure ? 443 : 80;\n } else {\n return self.parameters.port;\n }\n}", "f...
[ "0.80205727", "0.7563534", "0.7462488", "0.7457083", "0.73891723", "0.71261823", "0.71261823", "0.7111824", "0.7111824", "0.7111824", "0.7111824", "0.7111824", "0.7001307", "0.7001307", "0.69261515", "0.69261515", "0.6809958", "0.6751132", "0.6746687", "0.6702916", "0.6686953...
0.7992585
7
turn any url into an object like window.location
function parseUrlOrigin(url) { // url could be domain-relative // url could give a domain // cross origin means: // same domain // same port // some protocol // so, same everything up to the first (single) slash // if such is given // // can ignore everything after that ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getURL(){\n\treturn window.location;\n}", "function getURL() {\r\n let loc = document.location.href;\r\n\r\n if (loc.indexOf('?') > 0) {\r\n let getString = loc.split('?')[1];\r\n let GET = getString.split('&');\r\n var get = {};\r\n for (var i = 0, l = GET.length; i < l; i++) {\r\n v...
[ "0.7168802", "0.6980835", "0.66454315", "0.6543351", "0.64324903", "0.6417766", "0.64092934", "0.63982195", "0.6387629", "0.6354991", "0.6350919", "0.6336872", "0.6335471", "0.629181", "0.6284114", "0.62786704", "0.62773997", "0.62751645", "0.6256467", "0.6215567", "0.6215260...
0.0
-1
Handle input from the underlying xhr: either a state change, the progress event or the request being complete.
function handleProgress() { var textSoFar = xhr.responseText, newText = textSoFar.substr(numberOfCharsAlreadyGivenToCallback); /* Raise the event for new text. On older browsers, the new text is the whole response. On newer/better on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleChange(){\n\t\t\t// Error handles\n\t\t\tif(xhr.readyState === this.DONE && xhr.status !== 200){\n\t\t\t\tconsole.log('check yoself');\n\t\t\t}\n\t\t\t// success handles\n\t\t\tif(xhr.readyState === this.DONE && xhr.status === 200){\n\t\t\t\tcallback(xhr.response);\n\t\t\t}\n\n\t\t}", "function ma...
[ "0.71741384", "0.70290154", "0.6651119", "0.6563888", "0.6489219", "0.6361185", "0.63318425", "0.63318425", "0.63318425", "0.6318282", "0.622369", "0.62059164", "0.61914027", "0.61797065", "0.61635816", "0.61635816", "0.6151782", "0.61453617", "0.6109659", "0.6097769", "0.607...
0.6765535
9
Create a new set of handlers for clarinet's events, bound to the emit function given.
function incrementalContentBuilder( oboeBus ) { var emitNodeOpened = oboeBus(NODE_OPENED).emit, emitNodeClosed = oboeBus(NODE_CLOSED).emit, emitRootOpened = oboeBus(ROOT_PATH_FOUND).emit, emitRootClosed = oboeBus(ROOT_NODE_FOUND).emit; function arrayIndicesAreKeys( possiblyInconsistentAscen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setEventHandlers() {\n // Socket.IO\n socket.sockets.on(\"connection\", onSocketConnection);\n SearchServices.emptyArray();\n}", "addHandler(handler) {\n handlers.push(handler);\n }", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "funct...
[ "0.60162807", "0.59198093", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005", "0.58742005"...
0.0
-1
Add a new value to the object we are building up to represent the parsed JSON
function appendBuiltContent( ancestorBranches, key, node ){ nodeOf( head( ancestorBranches))[key] = node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addToBody() {\n data.body = data.body || {};\n // ignore if we already have a value\n if (data.body[key] == null) {\n data.body[key] = val;\n }\n }", "add(value) {\n\t\tif (isPlainObject(value)) {\n\t\t\tthis.configs.unshift(value)\n\t\t\tthis.value = undefined\...
[ "0.589984", "0.5827374", "0.57594264", "0.57410395", "0.57189107", "0.5718347", "0.5718347", "0.5702696", "0.5665872", "0.5627998", "0.5615002", "0.5604617", "0.5559264", "0.55332005", "0.55120605", "0.54997903", "0.5492454", "0.5460905", "0.5436327", "0.54239994", "0.542272"...
0.0
-1
For when the current node ends.
function nodeClosed( ascent ) { emitNodeClosed( ascent); return tail( ascent) || // If there are no nodes left in the ascent the root node // just closed. Emit a special event for this: emitRootClosed(nodeOf(head(ascent))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function curNodeFinished( ) {\n\n notify(TYPE_NODE, ascent);\n \n // pop the complete node and its path off the lists: \n ascent = tail(ascent);\n }", "end() {\n Object.assign(this.previousState, this.state); // Save the previous sta...
[ "0.74007154", "0.73811567", "0.7371685", "0.6843512", "0.68070084", "0.66719574", "0.6626852", "0.6626852", "0.66255826", "0.66111773", "0.6608724", "0.65346825", "0.6479581", "0.6474933", "0.64612496", "0.64287907", "0.6421802", "0.63968533", "0.6391798", "0.63905036", "0.63...
0.60341114
48
Create an evaluator function for a named path node, expressed in the JSONPath like: foo ["bar"] [2]
function nameClause(previousExpr, detection ) { var name = detection[NAME_INDEX], matchesName = ( !name || name == '*' ) ? always : function(ascent){return headKey(ascent) == name}; return lazyIntersection(matchesNa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ArrowFunctionExpression(path) {}", "function evalPath(obj, path) {\n return path.split('.').reduce(function(o, i) { return o[i];}, obj);\n}", "getValueInPath(json, path) {\n const pathElements = this.pathUtilService.toPathArray(path);\n let value = json;\n pathElements.forEach(pathElement...
[ "0.58563656", "0.5739383", "0.5542098", "0.5450437", "0.5438747", "0.5384162", "0.52791005", "0.49930495", "0.49887633", "0.4964851", "0.48464173", "0.48293936", "0.48037493", "0.48005408", "0.47923967", "0.47923967", "0.4791957", "0.47838977", "0.47735286", "0.47735286", "0....
0.0
-1
Expression for $, returns the evaluator function
function capture( previousExpr, detection ) { // extract meaning from the detection var capturing = !!detection[CAPTURING_INDEX]; if (!capturing) return previousExpr; // don't wrap at all, return given expr as-is return lazyIntersection(previousExpr, head)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dollarize(expr)\n{\n return \"$\" + format(expr,2);\n}", "function evaluateExpression(exp) {\n if (exp[0] !== \"=\") {\n return exp;\n }\n\n exp = exp.substring(1, exp.length);\n\n if (/^SUM/.test(exp)) {\n exp = expandSUM(exp);\n }\n\n exp = exp.replace(/[A-Z]+\\d+/g, get...
[ "0.6573683", "0.6452749", "0.62766623", "0.62178916", "0.6049129", "0.5983303", "0.5860527", "0.5847688", "0.56853384", "0.56812155", "0.56760406", "0.56517303", "0.5645944", "0.56447023", "0.56249875", "0.560887", "0.56030357", "0.5602373", "0.5588021", "0.5578448", "0.55066...
0.0
-1
Create an evaluator function that moves onto the next item on the lists. This function is the place where the logic to move up a level in the ascent exists. Eg, for JSONPath ".foo" we need skip1(nameClause(always, [,'foo']))
function skip1(previousExpr) { if( previousExpr == always ) { /* If there is no previous expression this consume command is at the start of the jsonPath. Since JSONPath specifies what we'd like to find but not necessarily everything leading down to it, when r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function skip1 (previousExpr) {\n if (previousExpr === __WEBPACK_IMPORTED_MODULE_0__functional__[\"a\" /* always */]) {\n /* If there is no previous expression this consume command\n is at the start of the jsonPath.\n Since JSONPath specifies what we'd like to find but not\n ...
[ "0.6616627", "0.5416469", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.5247743", "0.51649463", "0.5151691", "0.51413643", "0.5135252", "0.5097351", "0.49185744", ...
0.65968895
8
return true if the ascent we have contains only the JSON root, false otherwise
function notAtRoot(ascent){ return headKey(ascent) != ROOT_PATH; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isJSON(obj) {\r\n if (typeof (obj) == \"object\") {\r\n return 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }", "function isJSON(data) {\n try {\n JSON.parse(data);\n }catch(e) {\n return false;\n }\n return true;\n}", "function isVa...
[ "0.61117065", "0.6029608", "0.60144085", "0.5995258", "0.59930354", "0.59815115", "0.5976131", "0.5975452", "0.59481204", "0.58864963", "0.58667254", "0.5866289", "0.58188725", "0.5807038", "0.58011293", "0.57774764", "0.5768746", "0.5768746", "0.57407194", "0.57364196", "0.5...
0.6078217
8
Create an evaluator function for the .. (double dot) token. Consumes zero or more levels of the ascent, the fewest that are required to find a match when given to previousExpr.
function skipMany(previousExpr) { if( previousExpr == always ) { /* If there is no previous expression this consume command is at the start of the jsonPath. Since JSONPath specifies what we'd like to find but not necessarily everything leading down to it, when runni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDotPathFromNode(options) {\n var _a;\n const { node, evaluate, typescript, environment, statementTraversalStack } = options;\n if (typescript.isIdentifier(node)) {\n return node.text;\n }\n else if ((_a = typescript.isPrivateIdentifier) === null || _a === void 0 ? void 0 : _a.call...
[ "0.5316061", "0.49628133", "0.49313617", "0.49199823", "0.4909075", "0.48230675", "0.48168963", "0.48130304", "0.4802653", "0.4788958", "0.4767422", "0.4763958", "0.47448003", "0.47201136", "0.4710723", "0.47067407", "0.4705106", "0.46932685", "0.4690048", "0.46785685", "0.46...
0.0
-1
Generate an evaluator for ! matches only the root element of the json and ignores any previous expressions since nothing may precede !.
function rootExpr() { return function(ascent){ return headKey(ascent) == ROOT_PATH; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createNotEvaluator(node) {\n var $1 = createEvaluator(node);\n return typeof $1 === 'function' ? notEvaluator : !$1;\n\n function notEvaluator(ctx, writer) {\n return !$1(ctx, writer);\n }\n }", "function ExpressionEval() {\n var binops = {\n '||': function (a, b) { return a || b; ...
[ "0.56023103", "0.5406631", "0.5382024", "0.5335556", "0.5156768", "0.5156447", "0.5143948", "0.51302236", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", "0.5089478", ...
0.477996
37
Generate a statement wrapper to sit around the outermost clause evaluator. Handles the case where the capturing is implicit because the JSONPath did not contain a '$' by returning the last node.
function statementExpr(lastClause) { return function(ascent) { // kick off the evaluation by passing through to the last clause var exprMatch = lastClause(ascent); return exprMatch === true ? head(ascent) : exprMatch; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function statementExpr (lastClause) {\n return function (ascent) {\n // kick off the evaluation by passing through to the last clause\n var exprMatch = lastClause(ascent)\n\n return exprMatch === true ? Object(__WEBPACK_IMPORTED_MODULE_1__lists__[\"g\" /* head */])(ascent) : exprMatch\n }\n }...
[ "0.63579416", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.5401887", "0.52725816", "0.52232015", "0.52232015", "0.52232015", "0.52232015", "0.52232015", "0.519107...
0.6311603
8
If jsonPath matches the given detector function, creates a function which evaluates against every clause in the clauseEvaluatorGenerators. The created function is propagated to the onSuccess function, along with the remaining unparsed JSONPath substring. The intended use is to create a clauseMatcher by filling in the f...
function generateClauseReaderIfTokenFound ( tokenDetector, clauseEvaluatorGenerators, jsonPath, parserGeneratedSoFar, onSuccess) { var detected = tokenDetector(jsonPath); if(detected) { var com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateClauseReaderIfTokenFound (\n\n tokenDetector, clauseEvaluatorGenerators,\n\n jsonPath, parserGeneratedSoFar, onSuccess) {\n var detected = tokenDetector(jsonPath)\n\n if (detected) {\n var compiledParser = expressionsReader(\n clauseEvaluatorGenerators,\n parserGener...
[ "0.634297", "0.6208099", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.6202606", "0.53537863", "0.4782626", "0.4782626", "0.4782626", "0.4782626", "0.4782626", "...
0.6549258
7
Partially completes generateClauseReaderIfTokenFound above.
function clauseMatcher(tokenDetector, exprs) { return partialComplete( generateClauseReaderIfTokenFound, tokenDetector, exprs ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateClauseReaderIfTokenFound (\n\n tokenDetector, clauseEvaluatorGenerators,\n\n jsonPath, parserGeneratedSoFar, onSuccess) {\n var detected = tokenDetector(jsonPath)\n\n if (detected) {\n var compiledParser = expressionsReader(\n clauseEvaluatorGenerators,\n parserGener...
[ "0.67965674", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.6767186", "0.5382165", "0.4913544", "0.4723725", "0.47176737", "0.4543239", "0.44298536", "0.4394967", ...
0.52355874
20
One of two possible values for the onSuccess argument of generateClauseReaderIfTokenFound. When this function is used, generateClauseReaderIfTokenFound simply returns the compiledParser that it made, regardless of if there is any remaining jsonPath to be compiled.
function returnFoundParser(_remainingJsonPath, compiledParser){ return compiledParser }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateClauseReaderIfTokenFound (\n \n tokenDetector, clauseEvaluatorGenerators,\n \n jsonPath, parserGeneratedSoFar, onSuccess) {\n \n var detected = tokenDetector(jsonPath);\n\n if(detected) {\n ...
[ "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.80287653", "0.8012364", "0.6327343", "0.62015283", "0.60240227", "0.60240227", "0.60240227", "0.60240227", ...
0.61956275
21
Recursively compile a JSONPath expression. This function serves as one of two possible values for the onSuccess argument of generateClauseReaderIfTokenFound, meaning continue to recursively compile. Otherwise, returnFoundParser is given and compilation terminates.
function compileJsonPathToFunction( uncompiledJsonPath, parserGeneratedSoFar ) { /** * On finding a match, if there is remaining text to be compiled * we want to either continue parsing using a recursive call to * compileJsonPathToFunction. Otherwise,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateClauseReaderIfTokenFound (\n \n tokenDetector, clauseEvaluatorGenerators,\n \n jsonPath, parserGeneratedSoFar, onSuccess) {\n \n var detected = tokenDetector(jsonPath);\n\n if(detected) {\n ...
[ "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.69768965", "0.6945963", "0.6889788", "0.5653222", "0.55420923", "0.55420923", "0.55420923", "0.55420923", ...
0.67835414
20
pubSub is a curried interface for listening to and emitting events. If we get a bus: var bus = pubSub(); We can listen to event 'foo' like: bus('foo').on(myCallback) And emit event foo like: bus('foo').emit() or, with a parameter: bus('foo').emit('bar') All functions can be cached and don't need to be bound. Ie: var fo...
function pubSub(){ var singles = {}, newListener = newSingle('newListener'), removeListener = newSingle('removeListener'); function newSingle(eventName) { return singles[eventName] = singleEventPubSub( eventName, newListener, removeListener ); } /** pu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pubSub(){\n\n var singles = {},\n newListener = newSingle('newListener'),\n removeListener = newSingle('removeListener'); \n \n function newSingle(eventName) {\n return singles[eventName] = singleEventPubSub(\n eventName, \n newListener, \n removeListener\...
[ "0.7430885", "0.7430885", "0.7430885", "0.7430885", "0.7430885", "0.7430885", "0.7430885", "0.7430885", "0.73830247", "0.6907088", "0.63652253", "0.6086315", "0.6078042", "0.6039775", "0.576464", "0.57152355", "0.56897426", "0.5669603", "0.5658855", "0.5658855", "0.5658855", ...
0.75117713
3
pubSub instances are functions
function pubSubInstance( eventName ){ return singles[eventName] || newSingle( eventName ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pubSub(){\n\n var singles = {},\n newListener = newSingle('newListener'),\n removeListener = newSingle('removeListener'); \n \n function newSingle(eventName) {\n return singles[eventName] = singleEventPubSub(\n eventName, \n newListener, \n removeListener\...
[ "0.676691", "0.676691", "0.676691", "0.676691", "0.676691", "0.676691", "0.676691", "0.676691", "0.6489005", "0.6489005", "0.6489005", "0.6489005", "0.6489005", "0.63558584", "0.63038236", "0.6264795", "0.625232", "0.6224788", "0.6218758", "0.6162536", "0.616151", "0.613087...
0.56808877
50
The pattern adaptor listens for newListener and removeListener events. When patterns are added or removed it compiles the JSONPath and wires them up. When nodes and paths are found it emits the fullyqualified match events with parameters ready to ship to the outside world
function patternAdapter(oboeBus, jsonPathCompiler) { var predicateEventMap = { node:oboeBus(NODE_CLOSED) , path:oboeBus(NODE_OPENED) }; function emitMatchingNode(emitMatch, node, ascent) { /* We're now calling to the outside world where Lisp-style lists will...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function patternAdapter (oboeBus, jsonPathCompiler) {\n var predicateEventMap = {\n node: oboeBus(__WEBPACK_IMPORTED_MODULE_0__events__[\"d\" /* NODE_CLOSED */]),\n path: oboeBus(__WEBPACK_IMPORTED_MODULE_0__events__[\"f\" /* NODE_OPENED */])\n }\n\n function emitMatchingNode (emitMatch, node, ascent) {\n...
[ "0.6901327", "0.58182406", "0.5745328", "0.53384614", "0.52777344", "0.5240512", "0.508282", "0.5075026", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", "0.5039639", ...
0.7014771
7
The instance API is the thing that is returned when oboe() is called. it allows: listeners for various events to be added and removed the http response header/headers to be read
function instanceApi(oboeBus, contentSource){ var oboeApi, fullyQualifiedNamePattern = /^(node|path):./, rootNodeFinishedEvent = oboeBus(ROOT_NODE_FOUND), emitNodeDrop = oboeBus(NODE_DROP).emit, emitNodeSwap = oboeBus(NODE_SWAP).emit, /** * Add any kind of listener that the inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function instanceApi(oboeBus, contentSource){\n\n var oboeApi,\n fullyQualifiedNamePattern = /^(node|path):./,\n rootNodeFinishedEvent = oboeBus(ROOT_NODE_FOUND),\n emitNodeDrop = oboeBus(NODE_DROP).emit,\n emitNodeSwap = oboeBus(NODE_SWAP).emit,\n\n /**\n * Add any kind of l...
[ "0.68714124", "0.68714124", "0.68714124", "0.68714124", "0.68714124", "0.68714124", "0.68714124", "0.68714124", "0.67776656", "0.62446517", "0.62446517", "0.59331083", "0.59331083", "0.59331083", "0.5833038", "0.5799106", "0.57375556", "0.5679064", "0.5664272", "0.5662554", "...
0.6867638
12
Add a callback, wrapped in a try/catch so as to not break the execution of Oboe if an exception is thrown (fail events are fired instead) The callback is used as the listener id so that it can later be removed using .un(callback)
function addProtectedCallback(eventName, callback) { oboeBus(eventName).on(protectedCallback(callback), callback); return oboeApi; // chaining }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addForgettableCallback (event, callback, listenerId) {\n // listenerId is optional and if not given, the original\n // callback will be used\n listenerId = listenerId || callback\n\n var safeCallback = protectedCallback(callback)\n\n event.on(function () {\n var discard = false\n\n ...
[ "0.69107604", "0.6849764", "0.6849764", "0.6849764", "0.6849764", "0.6849764", "0.6849764", "0.6849764", "0.6849764", "0.6820724", "0.6820724", "0.6820724", "0.6820724", "0.6820724", "0.6404324", "0.635013", "0.635013", "0.62883174", "0.6267179", "0.6200398", "0.6193693", "...
0.55120593
92
Add a callback where, if .forget() is called during the callback's execution, the callback will be deregistered
function addForgettableCallback(event, callback, listenerId) { // listenerId is optional and if not given, the original // callback will be used listenerId = listenerId || callback; var safeCallback = protectedCallback(callback); event.on( function() { var discard = false; oboeApi.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addForgettableCallback (event, callback, listenerId) {\n // listenerId is optional and if not given, the original\n // callback will be used\n listenerId = listenerId || callback\n\n var safeCallback = protectedCallback(callback)\n\n event.on(function () {\n var discard = false\n\n ...
[ "0.71893555", "0.7107586", "0.7107586", "0.7107586", "0.7107586", "0.7107586", "0.7107586", "0.7107586", "0.7107586", "0.69110847", "0.662487", "0.6546015", "0.6506391", "0.6485147", "0.6439077", "0.6379735", "0.63584894", "0.6355854", "0.6348124", "0.6312686", "0.6211697", ...
0.7106817
13
wrap a callback so that if it throws, Oboe.js doesn't crash but instead throw the error in another event loop
function protectedCallback( callback ) { return function() { try{ return callback.apply(oboeApi, arguments); }catch(e) { setTimeout(function() { throw new Error(e.message); }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function protectedCallback( callback ) {\n return function() {\n try{\n return callback.apply(oboeApi, arguments);\n }catch(e) {\n setTimeout(function() {\n throw e;\n });\n }\n }\n }", "function protectedCallback( callback ) {\n ...
[ "0.7148635", "0.7148635", "0.7148635", "0.7148635", "0.7148635", "0.7148635", "0.7148635", "0.7148635", "0.712668", "0.7098952", "0.70512164", "0.67851603", "0.6775269", "0.6601724", "0.65425014", "0.6532404", "0.63503176", "0.63503176", "0.6340014", "0.631407", "0.6310713", ...
0.71079695
13
Add several listeners at a time, from a map
function addMultipleNodeOrPathListeners(eventId, listenerMap) { for( var pattern in listenerMap ) { addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addListenersMap(eventId, listenerMap) {\n \n for( var pattern in listenerMap ) {\n addPathOrNodeCallback(eventId, pattern, listenerMap[pattern]);\n }\n }", "function addMultipleNodeOrPathListeners (eventId, listenerMap) {\n for (var pattern in listenerMap) {\n addSingleNode...
[ "0.7370457", "0.72480965", "0.71066004", "0.71066004", "0.71066004", "0.71066004", "0.71066004", "0.71066004", "0.71066004", "0.71066004", "0.68510836", "0.6316753", "0.62786466", "0.62594193", "0.62594193", "0.62594193", "0.62594193", "0.6241098", "0.6241098", "0.61383075", ...
0.71485764
5
implementation behind .onPath() and .onNode()
function addNodeOrPathListenerApi( eventId, jsonPathOrListenerMap, callback ){ if( isString(jsonPathOrListenerMap) ) { addSingleNodeOrPathListener(eventId, jsonPathOrListenerMap, callback); } else { addMultipleNodeOrPathListeners(eventId, jsonPathOrListenerMap); } return oboeApi; // chain...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function highlightNodepathsOnclick(){\n //ADD ACTIONS THE NODE RECTANGLES\n d3.select('.interactive_diagram.' + view).selectAll('.node')\n .select('rect')\n .attr('class', 'nodeRect')\n .on('click', function(){\n thisClass = d3.select(this.parentNode).attr('id')\n ...
[ "0.57486075", "0.5668443", "0.5506875", "0.5445956", "0.5444757", "0.5434858", "0.5404133", "0.5399508", "0.5363098", "0.5351464", "0.530865", "0.5281499", "0.5277041", "0.52224565", "0.51341814", "0.5128124", "0.51210994", "0.511097", "0.5100407", "0.50853884", "0.5080509", ...
0.47496733
95
This file sits just behind the API which is used to attain a new Oboe instance. It creates the new components that are required and introduces them to each other.
function wire (httpMethodName, contentSource, body, headers, withCredentials){ var oboeBus = pubSub(); // Wire the input stream in if we are given a content source. // This will usually be the case. If not, the instance created // will have to be passed content from an external source. if( conten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "defineComponents() {\r\n this.components.forEach(Component => {\r\n this[Component.name] = new Component();\r\n });\r\n }", "static async createAndInit() {\n let comp = Reflect.construct(this, arguments);\n // build default required components\n await Promise.all(resolveRequiredC...
[ "0.6045134", "0.6004787", "0.60019886", "0.5886537", "0.58695185", "0.581961", "0.57956123", "0.5748645", "0.57175845", "0.57175845", "0.57175845", "0.57175845", "0.57175845", "0.57175845", "0.57175845", "0.57175845", "0.5698912", "0.5682357", "0.5682357", "0.5682357", "0.568...
0.0
-1
Updates the position of the popper, computing the new offsets and applying the new style. Prefer `scheduleUpdate` over `update` because of performance reasons.
function update() { // if popper is destroyed, don't perform any further update if (this.state.isDestroyed) { return; } var data = { instance: this, styles: {}, arrowStyles: {}, attributes: {}, flipped: false, offsets: {} }; // compute reference element offsets data.offsets.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n\t // if popper is destroyed, don't perform any further update\n\t if (this.state.isDestroyed) {\n\t return;\n\t }\n\t\n\t var data = {\n\t instance: this,\n\t styles: {},\n\t arrowStyles: {},\n\t attributes: {},\n\t flipped: false,\n\t offsets: {}\n\t };\n\t\n\t // ...
[ "0.8125151", "0.80976886", "0.8093828", "0.8093828", "0.8093828", "0.8093828", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", "0.8075733", ...
0.0
-1
Setup needed event listeners used to update the popper position
function setupEventListeners(reference, options, state, updateBound) { // Resize event listener on window state.updateBound = updateBound; getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); // Scroll event listener on scroll parents var scrollElement = getScrollParent(refe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function g(e){if(Q.popperInstance?(y()||Q.popperInstance.scheduleUpdate(),Q.props.livePlacement&&!y()&&Q.popperInstance.enableEventListeners()):(Q.popperInstance=v(),Q.props.livePlacement||Q.popperInstance.disableEventListeners())\n/**\n * If the instance previously had followCursor behavior, it will be\n ...
[ "0.6769328", "0.64210093", "0.64043796", "0.6225007", "0.61851645", "0.6183115", "0.61671126", "0.6155106", "0.6139235", "0.6106033", "0.6097217", "0.60809004", "0.60684043", "0.6066761", "0.6035161", "0.60333353", "0.60276574", "0.602691", "0.6025185", "0.6017188", "0.601718...
0.0
-1
It will add resize/scroll events and start recalculating position of the popper element when they are triggered.
function enableEventListeners() { if (!this.state.eventsEnabled) { this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "adoptPositionOnResize() {\n if (this.adoptOnResize) {\n\n /**\n * Get app event manager\n * @type {ApplicationEventManager|{subscribe, eventList}}\n */\n const appEventManager = this.view.controller.root().eventManager;\n\n appEventManager.subscribe({\n event: {name: appE...
[ "0.6576275", "0.6570369", "0.6539556", "0.6458064", "0.6442035", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "0.6428648", "...
0.0
-1
Remove event listeners used to update the popper position
function removeEventListeners(reference, state) { // Remove resize event listener on window getWindow(reference).removeEventListener('resize', state.updateBound); // Remove scroll event listener on scroll parents state.scrollParents.forEach(function (target) { target.removeEventListener('scroll', state.upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_removeEvents () {\n this.container.classList.remove(\"tooltiped\");\n\n this.container.removeEventListener(\"mouseenter\", this._mouseOver);\n this.container.removeEventListener(\"mousemove\", this._mouseMove);\n this.container.removeEventListener(\"mouseleave\", this._mouseOut);\n ...
[ "0.6902162", "0.6785765", "0.6785765", "0.6785765", "0.6770545", "0.6743059", "0.6592434", "0.6507296", "0.6457278", "0.6452451", "0.6450113", "0.64127916", "0.63347775", "0.629248", "0.62742007", "0.62729037", "0.6259061", "0.62421805", "0.6237802", "0.62315637", "0.62195307...
0.0
-1
It will remove resize/scroll events and won't recalculate popper position when they are triggered. It also won't trigger `onUpdate` callback anymore, unless you call `update` method manually.
function disableEventListeners() { if (this.state.eventsEnabled) { cancelAnimationFrame(this.scheduleUpdate); this.state = removeEventListeners(this.reference, this.state); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(){ // if popper is destroyed, don't perform any further update\nif(this.state.isDestroyed){return;}var data={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:false,offsets:{}}; // compute reference element offsets\ndata.offsets.reference = getReferenceOffsets(this.state,this.popper,this...
[ "0.74907076", "0.73391247", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565", "0.73081565"...
0.0
-1
if it's past the high water mark, we can push in some more. Also, if we have no data yet, we can stand some more bytes. This is to work around cases where hwm=0, such as the repl. Also, if the push() triggered a readable event, and the user called read(largeNumber) such that needReadable was set, then we ought to push ...
function needMoreData(state) { return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function push(){if(pushes>PUSHCOUNT)return;if(pushes++===PUSHCOUNT){console.error(\" push(EOF)\");return r.push(null)}console.error(\" push #%d\",pushes);r.push(new Buffer(PUSHSIZE))&&setTimeout(push)}", "tryPush() {\n\t\t// Get the total length of what would be pushed.\n\t\tconst amountToPush = Math.min(thi...
[ "0.65653986", "0.6405496", "0.63930243", "0.6381185", "0.6351084", "0.6351084", "0.62424386", "0.6213466", "0.6170956", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", "0.6165223", ...
0.0
-1
This function is designed to be inlinable, so please take care when making changes to the function body.
function howMuchToRead(n, state) { if (n <= 0 || state.length === 0 && state.ended) return 0; if (state.objectMode) return 1; if (n !== n) { // Only flow one buffer at a time if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; } // If we're asking for more...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient final protected i...
[ "0.68351024", "0.6708617", "0.66855526", "0.6600842", "0.6528807", "0.6307707", "0.630425", "0.6260026", "0.62104523", "0.61227286", "0.6071386", "0.59882206", "0.5980916", "0.5911053", "0.5898686", "0.5881848", "0.58807147", "0.57519734", "0.5730368", "0.5719172", "0.5713398...
0.0
-1
Don't emit readable right away in sync mode, because this can trigger another read() call => stack overflow. This way, it might trigger a nextTick recursion warning, but that's not so bad.
function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug(\"emitReadable\",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}", "function emitReadable(stream){var state=stream._re...
[ "0.7173571", "0.71170074", "0.71170074", "0.6980179", "0.6934476", "0.6922057", "0.69034296", "0.689672", "0.68849534", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", "0.6875077", ...
0.0
-1
at this point, the user has presumably seen the 'readable' event, and called read() to consume some data. that may have triggered in turn another _read(n) call, in which case reading = true if it's in progress. However, if we're not ended, or reading, and the length < hwm, then go ahead and try to read some more preemp...
function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; pna.nextTick(maybeReadMore_, stream, state); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_read() {\r\n\t\tthis._readingPaused = false\r\n\t\tsetImmediate(this._onReadable.bind(this))\r\n\t}", "_onReadable() {\r\n\t\t// Read all the data until one of two conditions is met\r\n\t\t// 1. there is nothing left to read on the socket\r\n\t\t// 2. reading is paused because the consumer is slow\r\n\t\twhile ...
[ "0.7300052", "0.6974782", "0.6769168", "0.6744609", "0.6744609", "0.67427224", "0.67427224", "0.6721973", "0.6689743", "0.6663656", "0.6653636", "0.661804", "0.6567068", "0.6501023", "0.65002793", "0.65002793", "0.6484555", "0.64682436", "0.6466185", "0.6383739", "0.6382004",...
0.0
-1
if the dest has an error, then stop piping into it. however, don't suppress the throwing behavior for this.
function onerror(er) { debug('onerror', er); unpipe(); dest.removeListener('error', onerror); if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onerror(er){debug(\"onerror\",er);unpipe();dest.removeListener(\"error\",onerror);if(EElistenerCount(dest,\"error\")===0)dest.emit(\"error\",er)}", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make ...
[ "0.7603308", "0.72068506", "0.72068506", "0.72068506", "0.71479124", "0.71479124", "0.71421456", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628", "0.7124628...
0.0
-1
Both close and finish should trigger unpipe, but only once.
function onclose() { dest.removeListener('finish', onfinish); unpipe(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onclose() {\n\t dest.removeListener('finish', onfinish);\n\t unpipe();\n\t }", "function onclose() {\n\t dest.removeListener('finish', onfinish);\n\t unpipe();\n\t }", "function onclose() {\n\t dest.removeListener('finish', onfinish);\n\t unpipe();\n\t }", "function onclose() {\...
[ "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "0.7979085", "...
0.0
-1
Pluck off n bytes from an array of buffers. Length is the combined lengths of all the buffers in the list. This function is designed to be inlinable, so please take care when making changes to the function body.
function fromList(n, state) { // nothing buffered if (state.length === 0) return null; var ret; if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { // read it all, truncate the list if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n\n if (...
[ "0.6563371", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.656192", "0.6561...
0.0
-1
Extracts only enough buffered data to satisfy the amount requested. This function is designed to be inlinable, so please take care when making changes to the function body.
function fromListPartial(n, list, hasStrings) { var ret; if (n < list.head.data.length) { // slice is the same for buffers and strings ret = list.head.data.slice(0, n); list.head.data = list.head.data.slice(n); } else if (n === list.head.data.length) { // first chunk is a perfect match ret = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _sliceBuffer(amount) {\n var newBuffer = _itemsWaitingToBeRendered.slice(amount, _itemsWaitingToBeRendered.length);\n var returnedObjArray = _itemsWaitingToBeRendered.slice(0, amount);\n _itemsWaitingToBeRendered = newBuffer;\n return returnedObjArray;\n }", "async readWait(length...
[ "0.6209323", "0.61768126", "0.58687115", "0.58042675", "0.5688525", "0.5554308", "0.5505683", "0.5505683", "0.5499924", "0.5499924", "0.54970366", "0.5488623", "0.54546213", "0.5450439", "0.54464406", "0.54464406", "0.54258555", "0.54189175", "0.54189175", "0.54189175", "0.54...
0.0
-1
Copies a specified amount of characters from the list of buffered data chunks. This function is designed to be inlinable, so please take care when making changes to the function body.
function copyFromBufferString(n, list) { var p = list.head; var c = 1; var ret = p.data; n -= ret.length; while (p = p.next) { var str = p.data; var nb = n > str.length ? str.length : n; if (nb === str.length) ret += str;else ret += str.slice(0, n); n -= nb; if (n === 0) { if (nb ===...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null;}else{list...
[ "0.7564124", "0.7564124", "0.7564124", "0.75156564", "0.75060433", "0.68538785", "0.67488784", "0.67161846" ]
0.0
-1
Copies a specified amount of bytes from the list of buffered data chunks. This function is designed to be inlinable, so please take care when making changes to the function body.
function copyFromBuffer(n, list) { var ret = Buffer.allocUnsafe(n); var p = list.head; var c = 1; p.data.copy(ret); n -= p.data.length; while (p = p.next) { var buf = p.data; var nb = n > buf.length ? buf.length : n; buf.copy(ret, ret.length - n, 0, nb); n -= nb; if (n === 0) { if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null;}else{list...
[ "0.7122601", "0.7122601", "0.7122601", "0.6895171", "0.6870083", "0.6341161", "0.631309", "0.63096833" ]
0.0
-1
It seems a linked list but it is not there will be only 2 of these for each stream
function CorkedRequest(state) { var _this = this; this.next = null; this.entry = null; this.finish = function () { onCorkedFinish(_this, state); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isStream(){\n return this.iterators.length > 0 && this.iterators[0].streamer && Util.isStreamer(this.iterators[0].streamer);\n }", "prnt() {\n console.log(this.size);\n let current = this.head;\n while (current != null) {\n console.log(current);\n current = current.next;\n ...
[ "0.60576123", "0.59735316", "0.5972365", "0.5896054", "0.5849009", "0.58082956", "0.5805648", "0.5792137", "0.578226", "0.57460773", "0.57413405", "0.572402", "0.5713699", "0.57122636", "0.56944346", "0.5675198", "0.56636626", "0.5654803", "0.5649838", "0.5644347", "0.5619762...
0.0
-1
Checks that a usersupplied chunk is valid, especially for the particular mode the stream is in. Currently this means that `null` is never accepted and undefined/nonstring values are only allowed in object mode.
function validChunk(stream, state, chunk, cb) { var valid = true; var er = false; if (chunk === null) { er = new TypeError('May not write null values to stream'); } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError(\"May not write null values to stream\")}else if(typeof chunk!==\"string\"&&chunk!==undefined&&!state.objectMode){er=new TypeError(\"Invalid non-string/buffer chunk\")}if(er){stream.emit(\"error\",er);processNe...
[ "0.80096054", "0.7968847", "0.795917", "0.79461217", "0.79094326", "0.7904343", "0.78482634", "0.7832999", "0.7832999", "0.78115803", "0.7805349", "0.78041327", "0.78041327", "0.7804074", "0.7804074", "0.7795851", "0.7795851", "0.7795851", "0.7795851", "0.7795851", "0.7793008...
0.0
-1
if we're already writing something, then just put this in the queue, and wait our turn. Otherwise, call _write If we return false, then we need a drain event, so set that flag.
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { if (!isBuf) { var newChunk = decodeChunk(state, chunk, encoding); if (chunk !== newChunk) { isBuf = true; encoding = 'buffer'; chunk = newChunk; } } var len = state.objectMode ? 1 : chunk.length; state.length += l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit('drain');}}// if there's something in the buffer waiting, then process it", "function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit('drain');}}// if the...
[ "0.71422184", "0.71422184", "0.71422184", "0.71422184", "0.69713527", "0.69501936", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584", "0.68877584"...
0.0
-1
Must force callback to be called on nextTick, so that we don't emit 'drain' before the write() consumer gets the 'false' return value, and has a chance to attach a 'drain' listener.
function onwriteDrain(stream, state) { if (state.length === 0 && state.needDrain) { state.needDrain = false; stream.emit('drain'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit(\"drain\")}}", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen); // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and...
[ "0.68664694", "0.6841498", "0.6840857", "0.6840857", "0.6840857", "0.6840857", "0.68192726", "0.6765496", "0.6765496", "0.67577946", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", "0.6721162", ...
0.0
-1
if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) { state.bufferProcessing = true; var entry = state.bufferedRequest; if (stream._writev && entry && entry.next) { // Fast case, write everything using _writev() var l = state.bufferedRequestCount; var buffer = new Array(l); var holder = state.corkedRequestsFree;...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processBuffer () {\n this.ready = true\n this._triggerBuffer()\n this.queue.waterfall(() => this.buffer.guardian)\n }", "function drainBuffer(cb) {\n if (!state.buffer.length)\n return cb()\n var done = multicb()\n var wait = false\n state.buffer.forEach(function(entry) {\n if (ha...
[ "0.6989099", "0.6406414", "0.63613397", "0.620778", "0.60211736", "0.59515584", "0.59415096", "0.59415096", "0.59415096", "0.59415096", "0.59035516", "0.5865887", "0.58270913", "0.58201474", "0.58172125", "0.5805252", "0.5790036", "0.5763926", "0.5763926", "0.5763926", "0.576...
0.0
-1
undocumented cb() API, needed for core, not for public API
function destroy(err, cb) { var _this = this; var readableDestroyed = this._readableState && this._readableState.destroyed; var writableDestroyed = this._writableState && this._writableState.destroyed; if (readableDestroyed || writableDestroyed) { if (cb) { cb(err); } else if (err && (!this._wri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback(){}", "function cb () {\n\t\tcallback();\n\t}", "function callback(cb){\n\n cb(1);\n}", "function callbackDriver() {\n cb();\n }", "function _...
[ "0.7930102", "0.7930102", "0.7930102", "0.7930102", "0.7930102", "0.7879179", "0.77457297", "0.7326767", "0.7235456", "0.71511483", "0.71451867", "0.71451867", "0.71291524", "0.7034352", "0.7026779", "0.7000611", "0.69736856", "0.6935611", "0.69217", "0.68071514", "0.68071514...
0.0
-1
alternative to using Object.keys for old browsers
function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getKeys(obj) {\n return Object.keys(obj); // Yes it is builtin!\n }", "function Object_keys(obj) {\n\t if (Object.keys) return Object.keys(obj)\n\t else {\n\t var res = [];\n\t for (var key in obj) res.push(key);\n\t return res;\n\t }\n\t}", "function keys(obj){\n return Object....
[ "0.7382736", "0.7311627", "0.723966", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7109948", "0.69957906", "0.69584274", "0.6930815", "0.6926222", "0.6915537", "0.6879077", "0.68776375", "0.686874", ...
0.0
-1
alternative to using Object.keys for old browsers
function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getKeys(obj) {\n return Object.keys(obj); // Yes it is builtin!\n }", "function Object_keys(obj) {\n\t if (Object.keys) return Object.keys(obj)\n\t else {\n\t var res = [];\n\t for (var key in obj) res.push(key);\n\t return res;\n\t }\n\t}", "function keys(obj){\n return Object....
[ "0.7382736", "0.7311627", "0.723966", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7199875", "0.7109948", "0.69957906", "0.69584274", "0.6930815", "0.6926222", "0.6915537", "0.6879077", "0.68776375", "0.686874", ...
0.0
-1
N = Cpu cost, r = Memory cost, p = parallelization cost
function scrypt (key, salt, N, r, p, dkLen, progressCallback) { if (N === 0 || (N & (N - 1)) !== 0) throw Error('N must be > 0 and a power of 2') if (N > MAX_VALUE / 128 / r) throw Error('Parameter N is too large') if (r > MAX_VALUE / 128 / p) throw Error('Parameter r is too large') var XY = new Buffer(256 * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async algo(n){\n\n let req = n, share = new fairShare(),\n a = bigInteger(1), b = bigInteger(0);\n\n while (n--){\n let temp = a;\n a = a.plus(b);\n b = temp;\n // Let other functions run in parallell after 10 ms\n await share.do(); \n }\n\n return {\n reques...
[ "0.617971", "0.5852715", "0.5770459", "0.56166726", "0.5553332", "0.5541551", "0.55018795", "0.5499858", "0.5483202", "0.5376632", "0.5332307", "0.52873677", "0.52873677", "0.5277538", "0.51817155", "0.51817155", "0.5175055", "0.5135511", "0.5125466", "0.5125466", "0.51188487...
0.0
-1
all of these functions are actually moved to the top due to function hoisting
function smix (B, Bi, r, N, V, XY) { var Xi = 0 var Yi = 128 * r var i B.copy(XY, Xi, Bi, Bi + Yi) for (i = 0; i < N; i++) { XY.copy(V, i * Yi, Xi, Xi + Yi) blockmix_salsa8(XY, Xi, Yi, r) if (tickCallback) tickCallback() } for (i = 0; i < N; i++) { var offset = Xi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hoist() {\n console.log('hoisted to the top');\n}", "function helloWorld(){ //get copied and hoisted to the top of the scope\n console.log('Hello World!'); //allowing us to call the function before it's declaration\n}", "function hello(){\n console.log(\"Function Declaration\")\n} // func...
[ "0.68883157", "0.64120466", "0.631026", "0.6258022", "0.62202233", "0.6198456", "0.6083302", "0.60707563", "0.60558033", "0.6022499", "0.60112804", "0.6007009", "0.5938625", "0.5938506", "0.5919878", "0.5858189", "0.5823486", "0.57766974", "0.575116", "0.5747199", "0.57468486...
0.0
-1
naive approach... going back to loop unrolling may yield additional performance
function blockxor (S, Si, D, Di, len) { for (var i = 0; i < len; i++) { D[Di + i] ^= S[Si + i] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function am1(i,x,w,j,c,n){while(--n>=0){var v=x*this[i++]+w[j]+c;c=Math.floor(v/0x4000000);w[j++]=v&0x3ffffff;}return c;}// am2 avoids a big mult-and-extract completely.", "function each( x, F, i0, i1 )\n{\n var len = x.length, argslen = arguments.length;\n if ( argslen < 4 ) i1 = len-1;\n if ( 0 > i1 )...
[ "0.60422426", "0.5839054", "0.5658", "0.555318", "0.55467045", "0.5534915", "0.5534915", "0.5534915", "0.5534915", "0.5534915", "0.5534915", "0.5534915", "0.55305535", "0.55211693", "0.5482966", "0.54633415", "0.54633415", "0.54633415", "0.54633415", "0.54633415", "0.54633415...
0.0
-1
prototype class for hash functions
function Hash (blockSize, finalSize) { this._block = Buffer.alloc(blockSize) this._finalSize = finalSize this._blockSize = blockSize this._len = 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Hash() {}", "function Hash() {}", "function Hash() {\r\n}", "function Hashers() {\n}", "GetHashCode() {\n\n }", "_generateHash() {\n\n }", "hash() {\n return this.is()\n }", "function Hasher()\n{\n this.truckHash = {};\n}", "calculateHash(){\n return SHA256(this.index + this.pr...
[ "0.8444925", "0.8444925", "0.8012337", "0.7593274", "0.7441991", "0.7378374", "0.73555523", "0.7269683", "0.71957415", "0.718947", "0.7186965", "0.71654564", "0.7144473", "0.71247315", "0.70964617", "0.7088249", "0.70709276", "0.7060434", "0.70601094", "0.7054379", "0.702781"...
0.0
-1
oldstyle streams. Note that the pipe method (the only relevant part of this class) is overridden in the Readable class.
function Stream() { EE.call(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pipe(stream) {\n var cache, scope = this;\n if(stream) {\n // add to the pipeline\n this.fuse(stream);\n // ensure return values are also added to the pipeline\n cache = stream.pipe;\n stream.pipe = function(/* dest */) {\n // restore cached method when called\n this.pipe = cach...
[ "0.73901516", "0.7193427", "0.6899974", "0.6535375", "0.6493014", "0.6414353", "0.6313415", "0.62904894", "0.62847817", "0.62847817", "0.6234615", "0.621473", "0.61951", "0.61840194", "0.61840194", "0.6139886", "0.6127902", "0.6105061", "0.6105061", "0.6087349", "0.6048191", ...
0.0
-1
don't leave dangling pipes when there are errors.
function onerror(er) { cleanup(); if (EE.listenerCount(this, 'error') === 0) { throw er; // Unhandled stream error in pipe. } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function brokenPipe() {\n throw Error('artoo.asyncStore: broken pipe.');\n }", "function onerror(error) {\n cleanup();\n if (!hasListeners(this, 'error'))\n throw error; // Unhandled stream error in pipe.\n }", "function onerror(er){debug(\"onerror\",er);unpipe();dest.removeListener(\"e...
[ "0.69866925", "0.6516497", "0.6399389", "0.6383316", "0.63701004", "0.63701004", "0.63701004", "0.63701004", "0.63701004", "0.6333437", "0.6292604", "0.6285128", "0.6285128", "0.6274714", "0.6233449", "0.62333864", "0.6221305", "0.62146306", "0.62146306", "0.62146306", "0.621...
0.0
-1
remove all the event listeners that were added.
function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeListeners() {}", "removeListeners() {}", "removeListeners() {}", "function removeEventListeners(){\n _.forEach(unlistenCallbacks, function(unlisten){\n unlisten();\n });\n unlistenCallbacks = [];\n }", "_clearListeners() {\n for (let liste...
[ "0.8521039", "0.8521039", "0.8521039", "0.8423259", "0.8304111", "0.8296624", "0.8282094", "0.8274838", "0.82720345", "0.8261525", "0.81342524", "0.8060971", "0.8031993", "0.7983937", "0.7970812", "0.7962308", "0.7867754", "0.78554255", "0.7834158", "0.77878404", "0.77458024"...
0.0
-1
Checks if xhr.status is readable and nonzero, indicating no error. Even though the spec says it should be available in readyState 3, accessing it throws an exception in IE8
function statusValid (xhr) { try { var status = xhr.status return (status !== null && status !== 0) } catch (e) { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}", "function statusValid(xhr) {\n\t try {\n\t var status = xhr.status;\n\t return (status !== null && status !== 0)\n\t } catch (e) {\n\t return false\n\t }\n\t}", "function statusValid(xhr...
[ "0.76944554", "0.7642186", "0.7642186", "0.7642186", "0.7642186", "0.7620682", "0.75975233", "0.75910103", "0.7461752", "0.7454964", "0.74421275", "0.74421275", "0.68347436", "0.68347436", "0.64446664", "0.6420513", "0.63909286", "0.63909286", "0.63909286", "0.63909286", "0.6...
0.7580257
59
Note: this is trying to follow closely the specs on
function Wallet(accounts) { this._accounts = accounts; this.length = 0; this.defaultKeyName = "web3js_wallet"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private internal fun...
[ "0.65735775", "0.6569077", "0.61930424", "0.6163832", "0.607972", "0.6011979", "0.6003035", "0.5947865", "0.5781278", "0.57507074", "0.5686922", "0.5671824", "0.5660459", "0.5621922", "0.56209224", "0.5594231", "0.5558814", "0.55069256", "0.5480001", "0.538758", "0.53446937",...
0.0
-1
Could use `inherits` module, but don't want to move from single file architecture yet.
function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inherit(){}", "function SuperclassBare() {}", "function SuperclassBare() {}", "function inherited() { }", "function inheritsFrom(child, parent){\nchild.prototype = Object.create(parent.prototype);\n}", "function inheritFrom(subfn,superfn) {\n\tvar r = function () {}\n\tr.prototype = superfn.prot...
[ "0.7401219", "0.72619385", "0.72619385", "0.6934079", "0.66181535", "0.64842397", "0.64601207", "0.63533044", "0.6344312", "0.6344312", "0.6324127", "0.6324127", "0.61254305", "0.61223876", "0.61002636", "0.6075639", "0.6069061", "0.6068982", "0.6067097", "0.6064537", "0.6064...
0.0
-1
CooleyTukey algorithm for FFT slightly revisited to rely on looping instead of recursion
function FFTM (x, y) { this.x = x; this.y = y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new...
[ "0.65960276", "0.61707294", "0.6046245", "0.6024058", "0.591965", "0.5886135", "0.5844562", "0.57781076", "0.5776535", "0.5705395", "0.5627977", "0.55873555", "0.55716103", "0.54662615", "0.5454135", "0.5342888", "0.5325684", "0.53189063", "0.53038526", "0.5275213", "0.526511...
0.0
-1
Could use `inherits` module, but don't want to move from single file architecture yet.
function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inherit(){}", "function SuperclassBare() {}", "function SuperclassBare() {}", "function inherited() { }", "function inheritsFrom(child, parent){\nchild.prototype = Object.create(parent.prototype);\n}", "function inheritFrom(subfn,superfn) {\n\tvar r = function () {}\n\tr.prototype = superfn.prot...
[ "0.73977566", "0.72600657", "0.72600657", "0.69314426", "0.66141313", "0.64813936", "0.64593697", "0.63513047", "0.6343339", "0.6343339", "0.6322658", "0.6322658", "0.6122129", "0.6120975", "0.6094837", "0.6072585", "0.60704786", "0.606606", "0.6066017", "0.6063663", "0.60636...
0.0
-1
CooleyTukey algorithm for FFT slightly revisited to rely on looping instead of recursion
function FFTM (x, y) { this.x = x; this.y = y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new...
[ "0.6596648", "0.61723727", "0.6049048", "0.6027027", "0.59230334", "0.588856", "0.58478546", "0.5781408", "0.5778739", "0.57072663", "0.5629663", "0.5589972", "0.55750215", "0.546834", "0.5458209", "0.534628", "0.5325675", "0.53214645", "0.53055155", "0.52779263", "0.5268738"...
0.0
-1
Expose a W3C WebSocket class with just one or two arguments.
function W3CWebSocket(uri, protocols) { var native_instance; if (protocols) { native_instance = new NativeWebSocket(uri, protocols); } else { native_instance = new NativeWebSocket(uri); } /** * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket * class). Since it is an Object i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new nativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new nativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * cl...
[ "0.6760427", "0.6760427", "0.6760427", "0.6743547", "0.67294335", "0.6565041", "0.6548172", "0.6525932", "0.6482224", "0.6263772", "0.60869074", "0.5882771", "0.58564913", "0.5782865", "0.5733972", "0.5733023", "0.5662076", "0.5645864", "0.5604057", "0.5604057", "0.5604057", ...
0.67553383
21
will load the data & process the response in a special response object
function loadFunc() { if (aborted) return var status clearTimeout(timeoutTimer) if(options.useXDR && xhr.status===undefined) { //IE8 CORS GET successful response doesn't have a status field, but body is fine status = 200 } else { status = (xhr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadResponse() {\n var status = getStatusCode()\n var error = errorFromStatusCode(status)\n var response = {\n body: getBody(),\n statusCode: status,\n statusText: xhr.statusText,\n raw: xhr\n }\n ...
[ "0.72902954", "0.7258423", "0.7258423", "0.7258423", "0.72424245", "0.72424245", "0.7240427", "0.63209057", "0.6219048", "0.62032735", "0.6201897", "0.61649305", "0.6085497", "0.6084738", "0.60131925", "0.60039425", "0.60039425", "0.60039425", "0.60039425", "0.5997273", "0.59...
0.57858837
65
Public List all owner's sources
list(owner, callback) { this.userlib.get(owner, (err, doc) => { if (err) { callback(false, err); return; } if (doc) { callback(true, doc.repos); } else { callback(false, "user_not_found"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSources() {\n return query(\n `SELECT id, name\n FROM source\n WHERE deleted_at IS NULL\n ORDER BY name;`\n );\n}", "get sources() {\n const sources = []\n for (let i = 0; i < this._sections.length; i++) {\n for (let j = 0; j < this._sections[i].consumer.sources.length; j++) ...
[ "0.70886004", "0.66991025", "0.6295513", "0.62473124", "0.6233252", "0.61679846", "0.6167376", "0.615289", "0.61109155", "0.6002933", "0.5951923", "0.59334373", "0.589267", "0.5868626", "0.58072287", "0.5807199", "0.574084", "0.5708651", "0.56614", "0.5635201", "0.563027", ...
0.61211747
8
List limited to repository/branch
ownerIdFromPath(local_path) { let owner_path = local_path.replace(app_config.build_root, ""); owner_path = owner_path.replace(app_config.data_root, ""); owner_path = owner_path.replace("/", ""); // drop only first leading slash let owner_path_array = owner_path.split("/"); let owner_id = owner_path_array[0]; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async list({ limit, page, order }) {\n page = page >= 1000 ? 1000 : page;\n const offset = (page - 1) * limit;\n const result = await this.ctx.model.Repos.findAndCountAll({\n attributes: [ 'id', 'title', 'slug', 'cover', 'trends',\n 'stargazers_count', 'description', 'owner', 'repo' ],\n ...
[ "0.6469209", "0.63184047", "0.60503703", "0.5966497", "0.5905534", "0.5788125", "0.5721986", "0.5629356", "0.5578269", "0.55779505", "0.556658", "0.5542678", "0.55204886", "0.5518541", "0.5478721", "0.5390996", "0.53858715", "0.5368728", "0.5357702", "0.53555536", "0.53452015...
0.0
-1
Add (do not break, works)
get_inner_path(temp_path) { let directories = fs.readdirSync(temp_path).filter( file => fs.lstatSync(path.join(temp_path, file)).isDirectory() ); let inner_path = temp_path + "/"; if (typeof (directories[0]) !== "undefined" && directories[0] !== null) inner_path = temp_path + "/" + directories[0]; retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add() {}", "add(element) {}", "_add () {\n throw new Error('not implemented')\n }", "add(element){\n this.addLast(element);\n }", "function add(a, b) {}", "quickAdd() {\n }", "function addItemOne(a) {\n a.push(1);\n}", "function add(a, b) {\n // TODO return\n}", "add(t...
[ "0.792965", "0.7115272", "0.6861346", "0.67046577", "0.6683906", "0.6622569", "0.6570633", "0.65441203", "0.6456867", "0.64467716", "0.6411876", "0.6402887", "0.63625896", "0.63625896", "0.63625896", "0.63275784", "0.63213384", "0.6310649", "0.62810606", "0.6277463", "0.62623...
0.0
-1
incoming can be origin/main, origin/master or whatever
normalizedBranch(source, error_callback) { if (typeof (source.branch) === "undefined") source.branch = "main"; let sanitized_branch = sanitka.branch(source.branch); if (sanitized_branch === null) { error_callback(true, "invalid_branch_name"); return false; } return sanitized_branch.replace("origin/", ""); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "applyIncoming(mut) {\n if (!mut) {\n return false;\n }\n\n (0, _debug.default)('Applying mutation %s -> %s to rev %s', mut.previousRev, mut.resultRev, this.HEAD && this.HEAD._rev);\n this.HEAD = mut.apply(this.HEAD); // Eliminate from incoming set\n\n this.incoming = this.incoming.filter(m => m...
[ "0.54831874", "0.5409054", "0.5140901", "0.5092019", "0.5079084", "0.50726074", "0.5030245", "0.50278413", "0.49260223", "0.49144474", "0.48978403", "0.48749295", "0.48720658", "0.48682556", "0.48605427", "0.485587", "0.48549077", "0.4826907", "0.4823952", "0.48238832", "0.48...
0.46473026
37
Performs prefetch to temporary directory, required for inferring target platform and verification.
add(source, callback) { source.source_id = uuidV1(); let TEMP_PATH = this.getTempPath(source.owner, source.source_id); let sanitized_branch = this.normalizedBranch(source, callback); if ((sanitized_branch === false) || (sanitized_branch === null)) { console.log("source add rejected: source_branch_insane",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function __prefetch()\n{\n let a = $(\"a\");\n let temp_hrefs = [];\n for(let i = 0;i < a.length;i++)\n {\n let target_href = a.eq(i).attr(\"href\");\n (\n (\n target_href.indexOf(\"#\") > -1\n ||\n temp_hrefs.indexOf(target_href) > ...
[ "0.6074456", "0.58222103", "0.58222103", "0.5820116", "0.5817573", "0.5817573", "0.57865304", "0.57837564", "0.57723796", "0.57723796", "0.57723796", "0.57409155", "0.57134944", "0.5696529", "0.5696529", "0.56763476", "0.55568784", "0.55568784", "0.55020857", "0.5487784", "0....
0.0
-1
Wrapper function ported from TinyColor.prototype.toHsv Keep it here because of `hsv.h 360`
function toHsv(_ref) { var r = _ref.r, g = _ref.g, b = _ref.b; var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHsv)(r, g, b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v }; } // Wrapper function ported from TinyColor.prototype.toHexString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = (0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__/* .rgbToHsv */ .py)(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n} // Wrapper function ported from TinyColor.prototype.toHexString", "function...
[ "0.83774793", "0.82852036", "0.82584816", "0.8169522", "0.79492146", "0.7867053", "0.7805655", "0.77956563", "0.77460635", "0.7743693", "0.76975024", "0.7687316", "0.7664174", "0.7641208", "0.76240814", "0.761016", "0.75787646", "0.7571822", "0.7562682", "0.7557727", "0.75548...
0.8268542
3
Keep it here because of the prefix ``
function toHex(_ref2) { var r = _ref2.r, g = _ref2.g, b = _ref2.b; return "#".concat((0,_ctrl_tinycolor__WEBPACK_IMPORTED_MODULE_0__.rgbToHex)(r, g, b, false)); } // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Unquote() {\r\n}", "function QuasiQuotation() {\r\n}", "get BackQuote() {}", "function UnquoteSplicing() {\r\n}", "get DoubleQuote() {}", "function Quotation() {\r\n}", "set BackQuote(value) {}", "set DoubleQuote(value) {}", "protected internal function m252() {}", "getPrefixCode() {\n ...
[ "0.63309675", "0.6233163", "0.61210287", "0.6066564", "0.59532225", "0.5848087", "0.57648164", "0.57269603", "0.5685497", "0.5572246", "0.5562987", "0.5518413", "0.5516849", "0.55016756", "0.5497893", "0.54934084", "0.540317", "0.5402242", "0.5284475", "0.52763253", "0.526641...
0.0
-1
Amount in range [0, 1] Assume color1 & color2 has no alpha, since the following src code did so.
function mix(rgb1, rgb2, amount) { var p = amount / 100; var rgb = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b }; return rgb; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mix(rgb1, rgb2, amount) {\n\t var p = amount / 100;\n\t var rgb = {\n\t r: (rgb2.r - rgb1.r) * p + rgb1.r,\n\t g: (rgb2.g - rgb1.g) * p + rgb1.g,\n\t b: (rgb2.b - rgb1.b) * p + rgb1.b\n\t };\n\t return rgb;\n\t}", "function blendColors(c0, c1, p) {\n var f=parseInt(c0.slice(1),16),\n ...
[ "0.68238217", "0.67386776", "0.6579737", "0.6540807", "0.65278196", "0.649321", "0.6489897", "0.6484452", "0.64774275", "0.64754015", "0.6463482", "0.64076734", "0.63966805", "0.63825095", "0.63819957", "0.6378682", "0.635968", "0.6350862", "0.63456756", "0.6345458", "0.63402...
0.6798873
5
Converts an RGB color to hex Assumes r, g, and b are contained in the set [0, 255] Returns a 3 or 6 character hex
function rgbToHex(r, g, b, allow3Char) { var hex = [ (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)), ]; // Return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rgbToHex(R,G,B) { return toHex(R)+toHex(G)+toHex(B); }", "function rgbToHex(r, g, b) {\n return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n}", "function rgbToHex (r, g, b) {\n var hx = '#' + componentToHex(r) + componentToHex(g) + componentToHex(b);\n return (hx);\n}", ...
[ "0.8535074", "0.85345495", "0.84982824", "0.84879977", "0.84827095", "0.84819466", "0.84819466", "0.842716", "0.8418632", "0.8404896", "0.8385006", "0.8378727", "0.83203596", "0.8315497", "0.8312856", "0.8309431", "0.8309431", "0.8299537", "0.8284026", "0.82609487", "0.825706...
0.82117903
25
Converts an RGBA color plus alpha transparency to hex Assumes r, g, b are contained in the set [0, 255] and a in [0, 1]. Returns a 4 or 8 character rgba hex eslintdisablenextline maxparams
function rgbaToHex(r, g, b, a, allow4Char) { var hex = [ (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)), (0,_util...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rgbaToHex(r, g, b, a, allow4Char) {\n var hex = [pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16)), pad2(convertDecimalToHex(a))]; // Return a 4 character hex if possible\n\n if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) ==...
[ "0.81385815", "0.81385815", "0.8100027", "0.8100027", "0.8086763", "0.8086763", "0.80630445", "0.80630445", "0.80630445", "0.80630445", "0.80630445", "0.80630445", "0.80544746", "0.8053278", "0.8052186", "0.8047436", "0.8039667", "0.7997449", "0.79923034", "0.7979143", "0.797...
0.80129755
20
Converts an RGBA color to an ARGB Hex8 string Rarely used, but required for "toFilter()"
function rgbaToArgbHex(r, g, b, a) { var hex = [ (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(convertDecimalToHex(a)), (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)), (0,_util__WEBPACK_IM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rgbaToArgbHex(r, g, b, a) {\n var hex = [pad2(convertDecimalToHex(a)), pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16))];\n return hex.join(\"\");\n } // `equals`", "function rgbaToArgbHex(r, g, b, a) {\n var hex = [pad2(convertDecimalToHex(a)),...
[ "0.7523151", "0.7523151", "0.7476324", "0.74546045", "0.7450691", "0.7429915", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "0.74243015", "...
0.7346802
57
Converts a decimal to a hex value
function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n }", "function convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n }", "function convertDecimalToHex(d) {\n return Math.round(parseFloat(d) ...
[ "0.7570578", "0.75610775", "0.7552267", "0.74836814", "0.7474269", "0.7474269", "0.7474269", "0.7474269", "0.7474269", "0.7474269", "0.7462278", "0.7462278", "0.7453795", "0.7453795", "0.7453795", "0.7283163", "0.7283163", "0.72519004", "0.7245713", "0.72197133", "0.72148067"...
0.7564213
39
Converts a hex value to a decimal
function convertHexToDecimal(h) { return parseIntFromHex(h) / 255; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hexToDec (hex) {\n var sum = 0;\n var hexObj = {\n 0: 0,\n 1: 1,\n 2: 2,\n 3: 3,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 7,\n 8: 8,\n 9: 9,\n \"A\": 10,\n \"B\": 11,\n \"C\": 12,\n \"D\": 13,\n \"E\": 14,\n \"F\": 15, \n };\n function inner(hex, i) {\n hex = hex.toUpperCase();\...
[ "0.7797104", "0.74350196", "0.74350196", "0.73822236", "0.73822236", "0.73822236", "0.73686624", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114", "0.72933114",...
0.7170235
60
Parse a base16 hex value into a base10 integer
function parseIntFromHex(val) { return parseInt(val, 16); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseIntFromHex(val) {\n return parseInt(val, 16);\n }", "function parseIntFromHex(val) {\n return parseInt(val, 16);\n }", "function parseIntFromHex(val) {\n return parseInt(val, 16);\n }", "function parseIntFromHex(val) {\n return ...
[ "0.7453103", "0.7401537", "0.7292341", "0.7292341", "0.7292341", "0.7292341", "0.7292341", "0.7292341", "0.72538376", "0.7245991", "0.72157973", "0.72157973", "0.72157973", "0.72157973", "0.72030795", "0.72030795", "0.72030795", "0.72030795", "0.7200418", "0.71430445", "0.714...
0.7245617
48
Given a string or object, convert that input to RGB Possible string inputs: ``` "red" "f00" or "f00" "ff0000" or "ff0000" "ff000000" or "ff000000" "rgb 255 0 0" or "rgb (255, 0, 0)" "rgb 1.0 0 0" or "rgb (1, 0, 0)" "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" "hsl(0, 100%, 5...
function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format = false; if (typeof color === 'string') { color = stringInputToObject(color); } if (typeof color === 'object') { if (isVali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stringToRGB (theString) {\r // we assume a comma separated string, just because of course...\r var tmp = theString.split(\",\");\r var r = tmp[0]? tmp[0]:0;\r var g = tmp[1]? tmp[1]:0;\r var b = tmp[2]? tmp[2]:0;\r return [r/255,g/255,b/255];\r}", "function stringToRGB (theString) {\r ...
[ "0.76472414", "0.76472414", "0.75490546", "0.7542776", "0.7453686", "0.74114347", "0.73499805", "0.7217451", "0.718424", "0.7180899", "0.7178058", "0.71579874", "0.71579874", "0.7155907", "0.7155598", "0.7149316", "0.7149316", "0.7130603", "0.711712", "0.711712", "0.711712", ...
0.7161777
13
Check to see if it looks like a CSS unit (see `matchers` above for definition).
function isValidCSSUnit(color) { return Boolean(matchers.CSS_UNIT.exec(String(color))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}", "function isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}", "function isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}", "function isValidCSSUnit(color) {\n return !!matchers.C...
[ "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065", "0.80806065"...
0.7945731
44
Take input from [0, n] and return it as [0, 1]
function bound01(n, max) { if (isOnePointZero(n)) { n = '100%'; } var isPercent = isPercentage(n); n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n))); // Automatically convert percentage into number if (isPercent) { n = parseInt(String(n * max), 10) / 100; } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function first(n){\n let arry = [];\n for(let i = 0; i < n; i++){\n arry[i] = i + 1;\n }\n return arry;\n}", "function nthElement(input, n = 0) {\n if (n == 0) {\n return input[0];\n } else if (n < 0) {\n return [];\n } else {\n if (n > input.length) {\n return input;\n }\n let newA...
[ "0.7176856", "0.66951865", "0.6602432", "0.6598989", "0.65064687", "0.64608216", "0.64596313", "0.637851", "0.63469803", "0.63451666", "0.63358194", "0.6318725", "0.629972", "0.6296661", "0.62725896", "0.6225704", "0.62238985", "0.6213238", "0.6191847", "0.6179377", "0.617937...
0.0
-1