Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
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._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._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._readableState;state.needReadable=false;if(!state.emittedReadable){debug('emitReadable',state.flowing);state.emittedReadable=true;if(state.sync)pna.nextTick(emitReadable_,stream);else emitReadable_(stream);}}", "function emitReadable(stream){var state=stream._readableState;debug('emitReadable',state.needReadable,state.emittedReadable);state.needReadable=false;if(!state.emittedReadable){debug('emitReadable',state.flowing);state.emittedReadable=true;process.nextTick(emitReadable_,stream);}}", "function emitReadable$1(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug$1('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) nextTick(emitReadable_$1, stream);else emitReadable_$1(stream);\n }\n}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (state.emittedReadable)\n\t return;\n\t\n\t state.emittedReadable = true;\n\t if (state.sync)\n\t process.nextTick(function() {\n\t emitReadable_(stream);\n\t });\n\t else\n\t emitReadable_(stream);\n\t}", "function emitReadable$2(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug$2('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextickArgs.nextTick(emitReadable_$2, stream);else emitReadable_$2(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (state.emittedReadable)\n\t return;\n\n\t state.emittedReadable = true;\n\t if (state.sync)\n\t process.nextTick(function() {\n\t emitReadable_(stream);\n\t });\n\t else\n\t emitReadable_(stream);\n\t}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n process.nextTick(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable$1(stream) {\n\t var state = stream._readableState;\n\t debug$2('emitReadable', state.needReadable, state.emittedReadable);\n\t state.needReadable = false;\n\n\t if (!state.emittedReadable) {\n\t debug$2('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t nextTick(emitReadable_$1, stream);\n\t }\n\t}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable) return;\n\n state.emittedReadable = true;\n if (state.sync) process.nextTick(function () {\n emitReadable_(stream);\n });else emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n timers.setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n timers.setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (state.emittedReadable)\n return;\n\n state.emittedReadable = true;\n if (state.sync)\n timers.setImmediate(function() {\n emitReadable_(stream);\n });\n else\n emitReadable_(stream);\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n }", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync)\n\t processNextTick(emitReadable_, stream);\n\t else\n\t emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}" ]
[ "0.7174339", "0.711771", "0.711771", "0.6980705", "0.6934712", "0.692287", "0.6903377", "0.68976504", "0.6884873", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.68748367", "0.6862173", "0.68433994", "0.68276626", "0.68276626", "0.68276626", "0.68276626", "0.68276626", "0.68276626", "0.68276626", "0.6826737", "0.6826737", "0.6826737", "0.6752943", "0.6752943", "0.6745492", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6742714", "0.6740752", "0.6723058", "0.6721585", "0.6721585", "0.6721585", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6717247", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976", "0.6712976" ]
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 preemptively.
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 (!this._readingPaused) {\r\n\t\t\t// First step is reading the 32-bit integer from the socket\r\n\t\t\t// and if there is not a value, we simply abort processing\r\n\t\t\tlet lenBuf = this._socket.read(4)\r\n\t\t\tif (!lenBuf) return\r\n\r\n\t\t\t// Now that we have a length buffer we can convert it\r\n\t\t\t// into a number by reading the UInt32BE value\r\n\t\t\t// from the buffer.\r\n\t\t\tlet len = lenBuf.readUInt32LE()\r\n\t\t\t// ensure that we don't exceed the max size of 256KiB\r\n\t\t\tif (len > 2 ** 18) {\r\n\t\t\t\tthis.socket.destroy(new Error('Max length exceeded'))\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\t// With the length, we can then consume the rest of the body.\r\n\t\t\tlet body = this._socket.read(len)\r\n\r\n\t\t\t// If we did not have enough data on the wire to read the body\r\n\t\t\t// we will wait for the body to arrive and push the length\r\n\t\t\t// back into the socket's read buffer with unshift.\r\n\t\t\tif (!body) {\r\n\t\t\t\tthis._socket.unshift(lenBuf)\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\t// Try to parse the data and if it fails destroy the socket.\r\n\t\t\tlet json\r\n\t\t\ttry {\r\n\t\t\t\tlet message = Buffer.from(body).toString('utf8')\r\n\t\t\t\tif (this.encrypted) {\r\n\t\t\t\t\tmessage = decrypt(this.shkey, message)\r\n\t\t\t\t}\r\n\t\t\t\tjson = JSON.parse(message)\r\n\t\t\t} catch (ex) {\r\n\t\t\t\tthis._socket.destroy()\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\t// Push the data into the read buffer and capture whether\r\n\t\t\t// we are hitting the back pressure limits\r\n\t\t\tlet pushOk = this.push(json)\r\n\r\n\t\t\t// When the push fails, we need to pause the ability to read\r\n\t\t\t// messages because the consumer is getting backed up.\r\n\t\t\tif (!pushOk) this._readingPaused = true\r\n\t\t}\r\n\t}", "function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}", "function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state);}}", "function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state);}}", "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\nif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\nif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\nif(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "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\nif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\nif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\nif(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "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\n\tif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\n\tif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\n\tif(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "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\n if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\n if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\n if(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "function $SYhk$var$howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = $SYhk$var$computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;pna.nextTick(maybeReadMore_,stream,state);}}", "function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;process.nextTick(maybeReadMore_,stream,state);}}", "function $Fj4k$var$howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = $Fj4k$var$computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}// backwards compatibility.", "function howMuchToRead(n, state) {\n if (n <= 0 || (state.length === 0 && state.ended)) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length)\n return state.buffer.head.data.length;\n else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n if (n > state.highWaterMark)\n state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n } // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){\n// Only flow one buffer at a time\nif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}\n// If we're asking for more than the current hwm, then raise the hwm.\nif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;\n// Don't have enough\nif(!state.ended){state.needReadable=true;return 0}return state.length}", "function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }", "function howMuchToRead$1(n, state) {\n\t if (n <= 0 || state.length === 0 && state.ended) return 0;\n\t if (state.objectMode) return 1;\n\n\t if (n !== n) {\n\t // Only flow one buffer at a time\n\t if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n\t } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n\t if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark$1(n);\n\t if (n <= state.length) return n; // Don't have enough\n\n\t if (!state.ended) {\n\t state.needReadable = true;\n\t return 0;\n\t }\n\n\t return state.length;\n\t} // you can override either this method, or the async _read(n) below.", "function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function maybeReadMore(stream, state) {\n\t if (!state.readingMore) {\n\t state.readingMore = true;\n\t process.nextTick(function() {\n\t maybeReadMore_(stream, state);\n\t });\n\t }\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}" ]
[ "0.7301529", "0.69759184", "0.676946", "0.6744838", "0.6744838", "0.6742702", "0.6742702", "0.6721936", "0.6689668", "0.6663449", "0.6654217", "0.6618481", "0.6566745", "0.6501123", "0.65003943", "0.65003943", "0.6484717", "0.6468223", "0.6466056", "0.63834864", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.63818634", "0.6352644", "0.6352546", "0.63452095", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.6333913", "0.63310605", "0.63310605", "0.63310605", "0.63310605" ]
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 sure our error handler is attached before userland ones.", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er) {\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (dest.listenerCount('error') === 0) {\n const s = dest._writableState || dest._readableState;\n if (s && !s.errorEmitted) {\n // User incorrectly emitted 'error' directly on the stream.\n errorOrDestroy(dest, er);\n } else {\n dest.emit('error', er);\n }\n }\n } // Make sure our error handler is attached before userland ones.", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (listenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (listenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (listenerCount(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (listenerCount$1(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }", "function onerror(er) {\n\t debug('onerror', er);\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n\t }" ]
[ "0.7603676", "0.7207491", "0.7207491", "0.7207491", "0.7148509", "0.7148509", "0.71428335", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.71253103", "0.70029324", "0.7000247", "0.69732827", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6962183", "0.6924843", "0.6924843", "0.6909184", "0.6902297", "0.69005877", "0.6891103", "0.6882876", "0.6882876", "0.6882876", "0.68766236", "0.68766236", "0.68723416", "0.68723416", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.68667704", "0.6855798", "0.6855798", "0.6855798", "0.6855798", "0.6855798", "0.6855798", "0.6855798" ]
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() {\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() {\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() {\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() {\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() {\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() {\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() {\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() {\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() {\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() {\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() {\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() {\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() {\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(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener('finish',onfinish);unpipe();}", "function onclose(){dest.removeListener(\"finish\",onfinish);unpipe()}", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }", "function onclose() {\r\n dest.removeListener('finish', onfinish);\r\n unpipe();\r\n }" ]
[ "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.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.79411215", "0.79411215", "0.79411215", "0.79411215", "0.79409623", "0.7933108", "0.78863096", "0.7816656", "0.78133255", "0.78133255", "0.78133255", "0.77925515", "0.77731764", "0.77731764", "0.7731312" ]
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 = state.buffer.head.data;else ret = state.buffer.concat(state.length); state.buffer.clear(); } else { // read part of list ret = fromListPartial(n, state.buffer, state.decoder); } return 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 (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}" ]
[ "0.65626067", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756", "0.65611756" ]
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 = list.shift(); } else { // result spans more than one buffer ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); } return ret; }
{ "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)\n {\n // Create buffer\n let buf = Buffer.alloc(length);\n let received = 0;\n\n while (received < length)\n {\n if (this.receivedBuffers.length > 0)\n {\n let src = this.receivedBuffers[0]\n if (src.length > length - received)\n {\n // Use part of the buffer...\n\n // Copy out the bit we want\n src.copy(buf, received, 0, length - received);\n\n // Split the buffer to extract the part we need\n let subBuf = Buffer.alloc(src.length - (length - received));\n src.copy(subBuf, 0, length - received, length - received + subBuf.length);\n this.receivedBuffers.shift();\n this.receivedBuffers.unshift(subBuf);\n\n // Finished\n received = length;\n }\n else\n {\n // Use the entire buffer\n src.copy(buf, received);\n received += this.receivedBuffers.shift().length;\n }\n }\n else\n {\n // Wait for more data\n await new Promise((resolve, reject) => {\n this.waiter = resolve;\n });\n this.waiter = null;\n }\n }\n return buf;\n }", "consume(n, hasStrings) {\n const data = this.head.data;\n if (n < data.length) {\n // `slice` is the same for buffers and strings.\n const slice = data.slice(0, n);\n this.head.data = data.slice(n);\n return slice;\n }\n if (n === data.length) {\n // First chunk is a perfect match.\n return this.shift();\n } // Result spans more than one buffer.\n\n return hasStrings ? this._getString(n) : this._getBuffer(n);\n }", "need(size) {\n var defered = defer();\n this._missing = size;\n\n var hole = () => {\n if(this._buffer.length < size)\n return;\n this.removeListener('data', hole);\n this._missing = 0;\n defered.resolve();\n };\n\n this.on('data', hole); hole();\n return defered;\n }", "function readNBytes (to_read) {\n function aux(bytes_read, buffer, chunk) {\n if (!chunk.isEOF()) {\n for (var i = 0, b = bytes_read; i < chunk.data().length && b < to_read; i++, b++) {}\n chunk.data().copy(buffer, bytes_read, 0, i);\n bytes_read += i;\n if (bytes_read == to_read) {\n var leftover = chunk.data().slice(i,chunk.data().length);\n return iter.Iteratee.Enough(buffer, leftover.length > 0 ? leftover : undefined);\n } else {\n return iter.Iteratee.Partial(aux.partial(bytes_read, buffer));\n }\n } else {\n return iter.Iteratee.Partial(aux.partial(bytes_read, buffer));;\n }\n };\n return iter.Iteratee.Partial(aux.partial(0, new Buffer(to_read)));\n}", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}", "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\nif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\nif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\nif(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "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\nif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\nif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\nif(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "function handle_data_available(event) {\n if (event.data.size > 0) {\n recordedChunks.push(event.data);\n }\n}", "readRecordsFromBuffer(buffer, count, fileOffset) {\n const records = [];\n let bufferOffset = 0;\n for (let i = 0; i < count; i++) {\n const record = this.readRecordFromBuffer(buffer.slice(bufferOffset), fileOffset + bufferOffset);\n bufferOffset += record.end - record.offset;\n records.push(record);\n }\n return records;\n }", "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\n if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\n if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\n if(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "function $SYhk$var$howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = $SYhk$var$computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "_read(size) {\n if (this.pushedBytesLength >= this.byteLength) {\n this.push(null);\n }\n if (!size) {\n size = this.readableHighWaterMark;\n }\n const outBuffers = [];\n let i = 0;\n while (i < size && this.pushedBytesLength < this.byteLength) {\n // The last buffer may be longer than the data it contains.\n const remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength;\n const remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer;\n const remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers);\n if (remaining > size - i) {\n // chunkSize = size - i\n const end = this.byteOffsetInCurrentBuffer + size - i;\n outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end));\n this.pushedBytesLength += size - i;\n this.byteOffsetInCurrentBuffer = end;\n i = size;\n break;\n }\n else {\n // chunkSize = remaining\n const end = this.byteOffsetInCurrentBuffer + remaining;\n outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end));\n if (remaining === remainingCapacityInThisBuffer) {\n // this.buffers[this.bufferIndex] used up, shift to next one\n this.byteOffsetInCurrentBuffer = 0;\n this.bufferIndex++;\n }\n else {\n this.byteOffsetInCurrentBuffer = end;\n }\n this.pushedBytesLength += remaining;\n i += remaining;\n }\n }\n if (outBuffers.length > 1) {\n this.push(Buffer.concat(outBuffers));\n }\n else if (outBuffers.length === 1) {\n this.push(outBuffers[0]);\n }\n }", "_read(size) {\n if (this.pushedBytesLength >= this.byteLength) {\n this.push(null);\n }\n if (!size) {\n size = this.readableHighWaterMark;\n }\n const outBuffers = [];\n let i = 0;\n while (i < size && this.pushedBytesLength < this.byteLength) {\n // The last buffer may be longer than the data it contains.\n const remainingDataInAllBuffers = this.byteLength - this.pushedBytesLength;\n const remainingCapacityInThisBuffer = this.buffers[this.bufferIndex].byteLength - this.byteOffsetInCurrentBuffer;\n const remaining = Math.min(remainingCapacityInThisBuffer, remainingDataInAllBuffers);\n if (remaining > size - i) {\n // chunkSize = size - i\n const end = this.byteOffsetInCurrentBuffer + size - i;\n outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end));\n this.pushedBytesLength += size - i;\n this.byteOffsetInCurrentBuffer = end;\n i = size;\n break;\n }\n else {\n // chunkSize = remaining\n const end = this.byteOffsetInCurrentBuffer + remaining;\n outBuffers.push(this.buffers[this.bufferIndex].slice(this.byteOffsetInCurrentBuffer, end));\n if (remaining === remainingCapacityInThisBuffer) {\n // this.buffers[this.bufferIndex] used up, shift to next one\n this.byteOffsetInCurrentBuffer = 0;\n this.bufferIndex++;\n }\n else {\n this.byteOffsetInCurrentBuffer = end;\n }\n this.pushedBytesLength += remaining;\n i += remaining;\n }\n }\n if (outBuffers.length > 1) {\n this.push(Buffer.concat(outBuffers));\n }\n else if (outBuffers.length === 1) {\n this.push(outBuffers[0]);\n }\n }", "function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }", "function bufsize() { return rnd(ARRAY_SIZE) * Random.index(smallPowersOfTwo); }", "function bufsize() { return rnd(ARRAY_SIZE) * Random.index(smallPowersOfTwo); }", "function bufsize() { return rnd(ARRAY_SIZE) * Random.index(smallPowersOfTwo); }", "function bufsize() { return rnd(ARRAY_SIZE) * Random.index(smallPowersOfTwo); }", "function bufsize() { return rnd(ARRAY_SIZE) * Random.index(smallPowersOfTwo); }", "function needMoreData(state) {\n return (\n !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0)\n );\n }", "function needMoreData$2(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function $Fj4k$var$howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = $Fj4k$var$computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.", "function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0);}// backwards compatibility.", "_read(size) {\n /*\n console.log(`read called with size ${size}`);\n for (let i = 0; i < this.streams.length; i++) {\n const currentStream = this.streams[i];\n let chunk = currentStream.read();\n if (Buffer.isBuffer(chunk)) {\n chunk = chunk.toString();\n console.log(`chunk for stream ${i}: ${chunk}`);\n }\n }\n */\n /*\n //this[kSource].fetchSomeData(size, (data, encoding) => {\n this.push(Buffer.from(data, encoding));\n console.log(`reading buffer: ${Buffer.from(data, encoding)}`);\n });\n */\n }", "function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }", "function _prepareOutDataBuffer(numberOfExtraBytesNeeded, encodeCtx) {\n if (encodeCtx.outDataCapacity - encodeCtx.outDataSize < numberOfExtraBytesNeeded) {\n // Not enough space - resize buffer.\n const oldOutData = encodeCtx.outData\n encodeCtx.outDataCapacity = Math.max(encodeCtx.outDataCapacity * 2, encodeCtx.outDataCapacity + numberOfExtraBytesNeeded)\n encodeCtx.outData = Buffer.alloc(encodeCtx.outDataCapacity)\n\n oldOutData.copy(encodeCtx.outData, 0, 0, encodeCtx.outDataSize)\n\n if (BJSON_ENCODE_LOGS_LEVEL > 0) {\n K.BJSON._debugLog('resized outData buffer to', encodeCtx.outDataCapacity)\n }\n }\n}", "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\n\tif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length;}// If we're asking for more than the current hwm, then raise the hwm.\n\tif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;// Don't have enough\n\tif(!state.ended){state.needReadable=true;return 0;}return state.length;}// you can override either this method, or the async _read(n) below.", "function needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n }", "function howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (NumberIsNaN(n)) {\n // Only flow one buffer at a time.\n if (state.flowing && state.length) return state.buffer.first().length;\n return state.length;\n }\n if (n <= state.length) return n;\n return state.ended ? state.length : 0;\n} // You can override either this method, or the async _read(n) below.", "function bufferUntil(condition) {\n return stream => _rxjsCompatUmdMin.Observable.create(observer => {\n let buffer = null;\n\n const flush = () => {\n if (buffer != null) {\n observer.next(buffer);\n buffer = null;\n }\n };\n\n return stream.subscribe(x => {\n if (buffer == null) {\n buffer = [];\n }\n\n buffer.push(x);\n\n if (condition(x, buffer)) {\n flush();\n }\n }, err => {\n flush();\n observer.error(err);\n }, () => {\n flush();\n observer.complete();\n });\n });\n}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n }", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n }", "collect () {\n const buf = []\n buf.dataLength = 0\n this.on('data', c => {\n buf.push(c)\n buf.dataLength += c.length\n })\n return this.promise().then(() => buf)\n }", "function needMoreData$1(state) {\n\t return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n\t}", "function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){\n// Only flow one buffer at a time\nif(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}\n// If we're asking for more than the current hwm, then raise the hwm.\nif(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;\n// Don't have enough\nif(!state.ended){state.needReadable=true;return 0}return state.length}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}", "function needMoreData(state) {\n return !state.ended &&\n (state.needReadable ||\n state.length < state.highWaterMark ||\n state.length === 0);\n}" ]
[ "0.620986", "0.6176825", "0.5868571", "0.58036065", "0.5688536", "0.55528647", "0.5504195", "0.5504195", "0.5498154", "0.5498154", "0.54965955", "0.54882735", "0.5452782", "0.5448647", "0.5446132", "0.5446132", "0.54243827", "0.54192686", "0.54192686", "0.54192686", "0.54192686", "0.54192686", "0.5414672", "0.54124796", "0.54080755", "0.5403883", "0.5400139", "0.5397746", "0.5391004", "0.5384041", "0.53830254", "0.5359349", "0.53528583", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.53488564", "0.5346569", "0.5346569", "0.53385186", "0.53385", "0.5337953", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566", "0.53318566" ]
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 === str.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = str.slice(nb); } break; } ++c; } list.length -= c; return ret; }
{ "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.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.", "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.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.", "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.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.", "function $SYhk$var$copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n} // Copies a specified amount of bytes from the list of buffered data chunks.", "function copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n} // Copies a specified amount of bytes from the list of buffered data chunks.", "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.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}", "function copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n }", "function copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while ((p = p.next)) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;\n else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;\n else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n }" ]
[ "0.7563655", "0.7563655", "0.7563655", "0.75149834", "0.7505612", "0.685258", "0.6747803", "0.6714964" ]
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 (nb === buf.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = buf.slice(nb); } break; } ++c; } list.length -= c; return ret; }
{ "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.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.", "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.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.", "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.head=p;p.data=str.slice(nb);}break;}++c;}list.length-=c;return ret;}// Copies a specified amount of bytes from the list of buffered data chunks.", "function copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n} // Copies a specified amount of bytes from the list of buffered data chunks.", "function $SYhk$var$copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n} // Copies a specified amount of bytes from the list of buffered data chunks.", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n }", "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 (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n}", "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 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 if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n }" ]
[ "0.71230704", "0.71230704", "0.71230704", "0.6895239", "0.68703276", "0.6340849", "0.63128674", "0.63093835" ]
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 }\n }", "_doPush(){//This works best for streaming from filesystem (since it is static/finite) and JS generators too...\n var obj;\n\n if( !this.isDiscretized ) {\n while(true) {\n if (!this.isListening || this.pos >= this.iterators.length)\n break;\n //get the data from the current iterator\n obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done)\n break;\n\n this.push(obj.value);\n }\n }\n else{//for discretized flows\n //ensure that our discrete stream length is not more than the number of iterators we have\n this.discreteStreamLength = Math.min(this.discreteStreamLength, this.iterators.length);\n\n if( this.discreteStreamLength == 1 ){//operate on one stream first and then move to the next\n do{\n obj = this.iterators[this.pos].next();\n while( !obj.done ){\n this.streamElements.push(obj.value);\n\n if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){\n this.push(this.streamElements.slice());\n this.streamElements = [];\n }\n\n obj = this.iterators[this.pos].next();\n }\n\n //At this point, if we have elements in the stream, we fill it will nulls since we are instructed to\n //discretize with one iterator\n if( this.streamElements.length > 0 ){\n while(true) {\n this.streamElements.push(null);\n if( this.isDataEndObject.isDataEnd(obj.value, this.streamElements.length) ){\n this.push(this.streamElements.slice());\n this.streamElements = [];\n break;\n }\n }\n }\n\n this.pos++;\n }while( this.pos < this.iterators.length );\n }\n else{\n var ended = []; //we need this since the iterators reset...we need to know the ones that have ended\n //a flag that states if the last check was data end. Because we cannot peek into the iterator, we have to\n //waste one round of iteration to discover that they have all ended which will create null data.\n var justEnded = false;\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n ended.push(false);\n }\n\n do{\n var pack = [];\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n if( ended[i] )\n pack[i] = null;\n else {\n obj = this.iterators[i].next();\n if( obj.done ) {\n ended[i] = true;\n pack[i] = null;\n }\n else\n pack[i] = obj.value;\n }\n }\n\n //check if we just ended on the last iteration and this current sets of data are just nulls\n if( justEnded && Flow.from(pack).allMatch((input) => input == null) )\n break;\n\n this.streamElements.push(pack);\n\n if( this.isDataEndObject.isDataEnd(pack, this.streamElements.length) ){\n justEnded = true;\n this.push(this.streamElements.slice());\n this.streamElements = [];\n\n //check if all items have ended\n if( Flow.from(ended).allMatch((input) => input) )\n break;\n }\n else\n justEnded = false;\n }while(true);\n }\n }\n\n this.isListening = false; //we done processing so stop listening\n this.pos = 0; //reset the pos for other operations\n }", "function list_to_stream(xs) {\n if (is_empty_list(xs)) {\n\treturn [];\n } else {\n\treturn pair(head(xs),function() { return list_to_stream(tail(xs)); });\n }\n}", "function initstream() {\n function Stream( head, tailPromise ) {\n if ( typeof head != 'undefined' ) {\n this.headValue = head;\n }\n if ( typeof tailPromise == 'undefined' ) {\n tailPromise = function () {\n return new Stream();\n };\n }\n this.tailPromise = tailPromise;\n }\n\n // TODO: write some unit tests\n Stream.prototype = {\n empty: function() {\n return typeof this.headValue == 'undefined';\n },\n head: function() {\n if ( this.empty() ) {\n throw new Error('Cannot get the head of the empty stream.');\n }\n return this.headValue;\n },\n tail: function() {\n if ( this.empty() ) {\n throw new Error('Cannot get the tail of the empty stream.');\n }\n // TODO: memoize here\n return this.tailPromise();\n },\n item: function( n ) {\n if ( this.empty() ) {\n throw new Error('Cannot use item() on an empty stream.');\n }\n var s = this;\n while ( n != 0 ) {\n --n;\n try {\n s = s.tail();\n }\n catch ( e ) {\n throw new Error('Item index does not exist in stream.');\n }\n }\n try {\n return s.head();\n }\n catch ( e ) {\n throw new Error('Item index does not exist in stream.');\n }\n },\n length: function() {\n // requires finite stream\n var s = this;\n var len = 0;\n\n while ( !s.empty() ) {\n ++len;\n s = s.tail();\n }\n return len;\n },\n add: function( s ) {\n return this.zip( function ( x, y ) {\n return x + y;\n }, s );\n },\n append: function ( stream ) {\n if ( this.empty() ) {\n return stream;\n }\n var self = this;\n return new Stream(\n self.head(),\n function () {\n return self.tail().append( stream );\n }\n );\n },\n zip: function( f, s ) {\n if ( this.empty() ) {\n return s;\n }\n if ( s.empty() ) {\n return this;\n }\n var self = this;\n return new Stream( f( s.head(), this.head() ), function () {\n return self.tail().zip( f, s.tail() );\n } );\n },\n map: function( f ) {\n if ( this.empty() ) {\n return this;\n }\n var self = this;\n return new Stream( f( this.head() ), function () {\n return self.tail().map( f );\n } );\n },\n concatmap: function ( f ) {\n return this.reduce( function ( a, x ) {\n return a.append( f(x) );\n }, new Stream () );\n },\n reduce: function () {\n var aggregator = arguments[0];\n var initial, self;\n if(arguments.length < 2) {\n if(this.empty()) throw new TypeError(\"Array length is 0 and no second argument\");\n initial = this.head();\n self = this.tail();\n }\n else {\n initial = arguments[1];\n self = this;\n }\n // requires finite stream\n if ( self.empty() ) {\n return initial;\n }\n // TODO: iterate\n return self.tail().reduce( aggregator, aggregator( initial, self.head() ) );\n },\n sum: function () {\n // requires finite stream\n return this.reduce( function ( a, b ) {\n return a + b;\n }, 0 );\n },\n walk: function( f ) {\n // requires finite stream\n this.map( function ( x ) {\n f( x );\n return x;\n } ).force();\n },\n force: function() {\n // requires finite stream\n var stream = this;\n while ( !stream.empty() ) {\n stream = stream.tail();\n }\n },\n scale: function( factor ) {\n return this.map( function ( x ) {\n return factor * x;\n } );\n },\n filter: function( f ) {\n if ( this.empty() ) {\n return this;\n }\n var h = this.head();\n var t = this.tail();\n if ( f( h ) ) {\n return new Stream( h, function () {\n return t.filter( f );\n } );\n }\n return t.filter( f );\n },\n take: function ( howmany ) {\n if ( this.empty() ) {\n return this;\n }\n if ( howmany == 0 ) {\n return new Stream();\n }\n var self = this;\n return new Stream(\n this.head(),\n function () {\n return self.tail().take( howmany - 1 );\n }\n );\n },\n drop: function( n ){\n var self = this;\n\n while ( n-- > 0 ) {\n\n if ( self.empty() ) {\n return new Stream();\n }\n\n self = self.tail();\n }\n\n // create clone/a contructor which accepts a stream?\n return new Stream( self.headValue, self.tailPromise );\n },\n member: function( x ){\n var self = this;\n\n while( !self.empty() ) {\n if ( self.head() == x ) {\n return true;\n }\n\n self = self.tail();\n }\n\n return false;\n },\n toArray: function( n ) {\n var target, result = [];\n if ( typeof n != 'undefined' ) {\n target = this.take( n );\n }\n else {\n // requires finite stream\n target = this;\n }\n target.walk( function ( x ) {\n result.push( x );\n } );\n return result;\n },\n print: function( n ) {\n var target;\n if ( typeof n != 'undefined' ) {\n target = this.take( n );\n }\n else {\n // requires finite stream\n target = this;\n }\n target.walk( function ( x ) {\n //console.log( x );\n } );\n },\n toString: function() {\n // requires finite stream\n return '[stream head: ' + this.head() + '; tail: ' + this.tail() + ']';\n }\n };\n\n Stream.makeOnes = function() {\n return new Stream( 1, Stream.makeOnes );\n };\n Stream.makeNaturalNumbers = function() {\n return new Stream( 1, function () {\n return Stream.makeNaturalNumbers().add( Stream.makeOnes() );\n } );\n };\n Stream.make = function( /* arguments */ ) {\n if ( arguments.length == 0 ) {\n return new Stream();\n }\n var restArguments = Array.prototype.slice.call( arguments, 1 );\n return new Stream( arguments[ 0 ], function () {\n return Stream.make.apply( null, restArguments );\n } );\n };\n Stream.fromArray = function ( array ) {\n if ( array.length == 0 ) {\n return new Stream();\n }\n return new Stream( array[0], function() { return Stream.fromArray(array.slice(1)); } );\n };\n Stream.range = function ( low, high ) {\n if ( typeof low == 'undefined' ) {\n low = 1;\n }\n if ( low == high ) {\n return Stream.make( low );\n }\n // if high is undefined, there won't be an upper bound\n return new Stream( low, function () {\n return Stream.range( low + 1, high );\n } );\n };\n Stream.equals = function ( stream1, stream2 ) {\n if ( ! (stream1 instanceof Stream) ) return false;\n if ( ! (stream2 instanceof Stream) ) return false;\n if ( stream1.empty() && stream2.empty() ) {\n return true;\n }\n if ( stream1.empty() || stream2.empty() ) {\n return false;\n }\n if ( stream1.head() === stream2.head() ) {\n return Stream.equals( stream1.tail(), stream2.tail() );\n }\n };\n return Stream;\n}", "constructor(linkedList) {\n this.ln = linkedList;\n this.curr = null;\n this.first = true;\n }", "function initstream() {\n function Stream(head, tailPromise) {\n if (typeof head != 'undefined') {\n this.headValue = head;\n }\n if (typeof tailPromise == 'undefined') {\n tailPromise = function () {\n return new Stream();\n };\n }\n this.tailPromise = tailPromise;\n }\n\n // TODO: write some unit tests\n Stream.prototype = {\n empty: function () {\n return typeof this.headValue == 'undefined';\n },\n head: function () {\n if (this.empty()) {\n throw new Error('Cannot get the head of the empty stream.');\n }\n return this.headValue;\n },\n tail: function () {\n if (this.empty()) {\n throw new Error('Cannot get the tail of the empty stream.');\n }\n // TODO: memoize here\n return this.tailPromise();\n },\n item: function (n) {\n if (this.empty()) {\n throw new Error('Cannot use item() on an empty stream.');\n }\n var s = this;\n while (n != 0) {\n --n;\n try {\n s = s.tail();\n } catch (e) {\n throw new Error('Item index does not exist in stream.');\n }\n }\n try {\n return s.head();\n } catch (e) {\n throw new Error('Item index does not exist in stream.');\n }\n },\n length: function () {\n // requires finite stream\n var s = this;\n var len = 0;\n\n while (!s.empty()) {\n ++len;\n s = s.tail();\n }\n return len;\n },\n add: function (s) {\n return this.zip(function (x, y) {\n return x + y;\n }, s);\n },\n append: function (stream) {\n if (this.empty()) {\n return stream;\n }\n var self = this;\n return new Stream(self.head(), function () {\n return self.tail().append(stream);\n });\n },\n zip: function (f, s) {\n if (this.empty()) {\n return s;\n }\n if (s.empty()) {\n return this;\n }\n var self = this;\n return new Stream(f(s.head(), this.head()), function () {\n return self.tail().zip(f, s.tail());\n });\n },\n map: function (f) {\n if (this.empty()) {\n return this;\n }\n var self = this;\n return new Stream(f(this.head()), function () {\n return self.tail().map(f);\n });\n },\n concatmap: function (f) {\n return this.reduce(function (a, x) {\n return a.append(f(x));\n }, new Stream());\n },\n reduce: function () {\n var aggregator = arguments[0];\n var initial, self;\n if (arguments.length < 2) {\n if (this.empty()) throw new TypeError(\"Array length is 0 and no second argument\");\n initial = this.head();\n self = this.tail();\n } else {\n initial = arguments[1];\n self = this;\n }\n // requires finite stream\n if (self.empty()) {\n return initial;\n }\n // TODO: iterate\n return self.tail().reduce(aggregator, aggregator(initial, self.head()));\n },\n sum: function () {\n // requires finite stream\n return this.reduce(function (a, b) {\n return a + b;\n }, 0);\n },\n walk: function (f) {\n // requires finite stream\n this.map(function (x) {\n f(x);\n return x;\n }).force();\n },\n force: function () {\n // requires finite stream\n var stream = this;\n while (!stream.empty()) {\n stream = stream.tail();\n }\n },\n scale: function (factor) {\n return this.map(function (x) {\n return factor * x;\n });\n },\n filter: function (f) {\n if (this.empty()) {\n return this;\n }\n var h = this.head();\n var t = this.tail();\n if (f(h)) {\n return new Stream(h, function () {\n return t.filter(f);\n });\n }\n return t.filter(f);\n },\n take: function (howmany) {\n if (this.empty()) {\n return this;\n }\n if (howmany == 0) {\n return new Stream();\n }\n var self = this;\n return new Stream(this.head(), function () {\n return self.tail().take(howmany - 1);\n });\n },\n drop: function (n) {\n var self = this;\n\n while (n-- > 0) {\n\n if (self.empty()) {\n return new Stream();\n }\n\n self = self.tail();\n }\n\n // create clone/a contructor which accepts a stream?\n return new Stream(self.headValue, self.tailPromise);\n },\n member: function (x) {\n var self = this;\n\n while (!self.empty()) {\n if (self.head() == x) {\n return true;\n }\n\n self = self.tail();\n }\n\n return false;\n },\n toArray: function (n) {\n var target,\n result = [];\n if (typeof n != 'undefined') {\n target = this.take(n);\n } else {\n // requires finite stream\n target = this;\n }\n target.walk(function (x) {\n result.push(x);\n });\n return result;\n },\n print: function (n) {\n var target;\n if (typeof n != 'undefined') {\n target = this.take(n);\n } else {\n // requires finite stream\n target = this;\n }\n target.walk(function (x) {\n //console.log( x );\n });\n },\n toString: function () {\n // requires finite stream\n return '[stream head: ' + this.head() + '; tail: ' + this.tail() + ']';\n }\n };\n\n Stream.makeOnes = function () {\n return new Stream(1, Stream.makeOnes);\n };\n Stream.makeNaturalNumbers = function () {\n return new Stream(1, function () {\n return Stream.makeNaturalNumbers().add(Stream.makeOnes());\n });\n };\n Stream.make = function () /* arguments */{\n if (arguments.length == 0) {\n return new Stream();\n }\n var restArguments = Array.prototype.slice.call(arguments, 1);\n return new Stream(arguments[0], function () {\n return Stream.make.apply(null, restArguments);\n });\n };\n Stream.fromArray = function (array) {\n if (array.length == 0) {\n return new Stream();\n }\n return new Stream(array[0], function () {\n return Stream.fromArray(array.slice(1));\n });\n };\n Stream.range = function (low, high) {\n if (typeof low == 'undefined') {\n low = 1;\n }\n if (low == high) {\n return Stream.make(low);\n }\n // if high is undefined, there won't be an upper bound\n return new Stream(low, function () {\n return Stream.range(low + 1, high);\n });\n };\n Stream.equals = function (stream1, stream2) {\n if (!(stream1 instanceof Stream)) return false;\n if (!(stream2 instanceof Stream)) return false;\n if (stream1.empty() && stream2.empty()) {\n return true;\n }\n if (stream1.empty() || stream2.empty()) {\n return false;\n }\n if (stream1.head() === stream2.head()) {\n return Stream.equals(stream1.tail(), stream2.tail());\n }\n };\n return Stream;\n }", "constructor() {\n this._head = null\n this._tail = this._head \n }", "printForward() {\n let current = this.head;\n while(current != null) {\n console.log(current.object);\n current = current.next;\n }\n }", "process(){\n if (this.pos >= this.iterators.length) {\n this.pos = 0;\n return null;\n }\n\n if( !this.isDiscretized ) {\n //##go through the iterators one after the other##\n\n //get the data from the current iterator\n var obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done) {\n this.pos = 0;\n return null;\n }\n\n if (this.next !== null)\n return this.next.pipe(obj.value);\n return obj.value;\n }\n else{//for discretized flows\n //we use this instead of the streamElements cause we don't need to save state.\n //Also, clearing streamElements could affect implementations storing the output\n var streamData = [];\n\n //ensure that our discrete stream length is not more than the number of iterators we have\n this.discreteStreamLength = Math.min(this.discreteStreamLength, this.iterators.length);\n\n if( this.discreteStreamLength == 1 ){//operate on one stream first and then move to the next\n obj = this.iterators[this.pos].next();\n\n //check for the next iterator that has data\n while (obj.done && this.pos < this.iterators.length) {\n this.pos++;\n if (this.pos >= this.iterators.length)\n break;\n\n obj = this.iterators[this.pos].next();\n }\n\n if (obj.done) {\n this.pos = 0;\n return null;\n }\n\n while( !obj.done ){\n streamData.push(obj.value);\n\n if( this.isDataEndObject.isDataEnd(obj.value, streamData.length) ){\n if (this.next !== null)\n return this.next.pipe(streamData);\n return streamData;\n }\n\n obj = this.iterators[this.pos].next();\n }\n\n //At this point, if we have elements in the stream, we fill it will nulls since we are instructed to\n //discretize with one iterator\n if( streamData.length > 0 ){\n while(true) {\n streamData.push(null);\n if( this.isDataEndObject.isDataEnd(obj.value, streamData.length) ){\n if (this.next !== null)\n return this.next.pipe(streamData);\n return streamData;\n }\n }\n }\n }\n else{\n if( !this.recall.ended ) {\n this.recall.ended = []; //we need this since the iterators reset...we need to know the ones that have ended\n //a flag that states if the last check was data end. Because we cannot peek into the iterator, we have to\n //waste one round of iteration to discover that they have all ended which will create null data.\n this.recall.justEnded = false;\n\n for (let i = 0; i < this.discreteStreamLength; i++) {\n this.recall.ended.push(false);\n }\n }\n\n do{\n //check if all items have ended\n if( this.recall.justEnded && Flow.from(this.recall.ended).allMatch((input) => input) )\n break;\n\n var pack = [];\n\n for(let i = 0; i < this.discreteStreamLength; i++){\n if( this.recall.ended[i] )\n pack[i] = null;\n else {\n obj = this.iterators[i].next();\n if( obj.done ) {\n this.recall.ended[i] = true;\n pack[i] = null;\n }\n else\n pack[i] = obj.value;\n }\n }\n\n //check if we just ended on the last iteration and this current sets of data are just nulls\n if( this.recall.justEnded && Flow.from(pack).allMatch((input) => input == null) )\n break;\n\n this.streamElements.push(pack);\n\n if( this.isDataEndObject.isDataEnd(pack, this.streamElements.length) ){\n this.recall.justEnded = true;\n\n try {\n if (this.next !== null)\n return this.next.pipe(this.streamElements.slice());\n return this.streamElements.slice();\n }\n finally{\n this.streamElements = [];\n }\n }\n else\n this.recall.justEnded = false;\n }while(true);\n\n this.pos = 0; //reset the pos variable to allow for reuse\n\n //clear temp fields\n delete this.recall.ended;\n delete this.recall.justEnded;\n //reset temp stream storage variable\n this.streamElements = [];\n\n return null;\n }\n }\n }", "_findStreamId(node) {\n if (!!node.prev) {\n // use id of prev node\n let idx = node.prev.findIndex(prev => prev.id == node.id);\n if (idx == -1) idx = 0;\n node.streamId = node.prev[idx].streamId;\n return false;\n } else {\n // new node\n // check if id is already in use\n if (!this._indices[node.id]) {\n // if not, use this id for the stream\n this._indices[node.id] = true;\n node.streamId = node.id;\n } else {\n // find a new ID\n let count = 0;\n let id;\n do {\n count++;\n id = node.id + '_' + count;\n } while (!!this._indices[id]);\n // console.log(`ID '${node.id}' is already in use. Use '${id}' instead.`);\n // ID is now in use\n this._indices[id] = true;\n node.streamId = id;\n }\n return true;\n }\n }", "list(){\n var cur = this.head;\n\n while (cur) {\n console.log(cur.val);\n cur = cur.next;\n }\n }", "function is_stream(xs) {\n return (array_test(xs) && xs.length === 0)\n\t|| (is_pair(xs) && typeof tail(xs) === \"function\" &&\n is_stream(stream_tail(xs)));\n}", "printList() {\n let n = this.head;\n\n while (n !== null) {\n console.log(n.val);\n n = n.next;\n }\n }", "function outputList(head) {\n let pointer = head;\n while (true) {\n console.log(pointer.value)\n if (pointer.next) {\n pointer = pointer.next;\n } else {\n break;\n }\n }\n}", "printList() {\n let curr = this.head, str = \"\"\n while(curr) {\n str += curr.value + (curr.next && \" -> \")\n curr = curr.next\n }\n console.log(str)\n }", "printList() {\n let current = this.head;\n while (current) {\n console.log(current.data + \" \");\n current = current.next;\n }\n }", "function WhatDoesThisProgramDo(lst) {\n let current = lst.head;\n // console.log('current: ', current)\n while (current !== null) {\n let newNode = current;\n // console.log('newNode: ', newNode)\n while (newNode.next !== null) {\n // this eliminates 2 consecutive same\n if (newNode.next.value === current.value) {\n // skips over following repeated list item \n newNode.next = newNode.next.next;\n }\n else {\n newNode = newNode.next;\n }\n }\n current = current.next; // this triggers outside whle loop to go again and compares. it's like 2 for-loops comparing i + j. but j keeps moving on till the end to find a duplicate that compares to i. If it doesnt, i gets moved to next \"index\" value and the i.next triggers the inner loop, as it does not === null \n }\n }", "*[Symbol.iterator]() {\n\t\tlet node = this.head;\n\t\twhile(node.next !== null){\n\t\t\tyield node;\n\t\t\tnode = node.next;\n\t\t}\n\t}", "relay(stream, streamName) {\n var that = this;\n stream.forEach((value) =>\n that.push(streamName, value)\n );\n }", "function LinkList(){\nthis.head = null;\nthis.tail = null;\n}", "function StreamLikeSequence() {}", "function next(list) {\n if (list._idleNext == list) return null;\n return list._idleNext;\n }", "peek() {\n if (!this._storage.head) {\n throw new Error('__ERROR__ list is empty')\n }\n let currentNode = this._storage.head;\n while (currentNode.next) {\n currentNode = currentNode.next;\n }\n return currentNode;\n }", "print() {\n let current = this.head;\n while (current !== null) {\n console.log(current.data);\n\n current = current.next;\n }\n }", "function SLL(){\n this.head = null;\n\n this.addFront = function(val){\n var oldHead = this.head;\n this.head = new Node(val);\n this.head.next = oldHead;\n return this;\n }\n\n this.printAsArray = function(){\n var runner = this.head;\n var arr = [];\n while (runner){\n arr.push(runner.val);\n runner = runner.next;\n }\n console.log(arr);\n return this;\n }\n}", "log() {\n const arr = [];\n let current = this.head;\n\n while (current) {\n arr.push(current);\n current = current.next;\n }\n\n console.log(arr);\n }", "peek(){\n if(!this.linkedList.head){\n return null;\n }\n return this.linkedList.head.value;\n }", "function _updateStreamList() {\n var streams = playback.createFilteredVideoStreamList(),\n streamsLength = streams.length;\n CadmiumMediaStreams$addMethodsToArray(streams);\n for (var i = 0; i < streamsLength; i++) {\n streams[i].lower = streams[i - 1];\n streams[i].higher = streams[i + 1];\n }\n _videoStreamList = streams;\n }", "function WhatDoesThisProgramDo(lst) {\n let current = lst.head;\n while (current !== null) {\n let newNode = current;\n while (newNode.next !== null) {\n if (newNode.next.value === current.value) {\n newNode.next = newNode.next.next;\n }\n else {\n newNode = newNode.next;\n }\n }\n current = current.next;\n }\n console.log(\"What does this one do? ->\", current)\n}", "function Stream() {\n this.head = new Chunk(this);\n }", "function LinkedLists(){\n\tthis.head=null;\n}", "show () {\n\t\tlet list = [];\n\t\tlet head = this.head;\n\t\twhile (head) {\n\t\t\tlist.push(head.data);\n\t\t\thead = head.next;\n\t\t}\n\t\treturn list;\n\t}", "printList() {\n var curr = this.head;\n var str = \"\";\n while (curr) {\n str += curr.data + \"-->\";\n curr = curr.next;\n }\n console.log(str);\n }", "function stream_member(x, s) {\n if (is_empty_list(s)) {\n return [];\n } else if (head(s) === x) {\n return s;\n } else {\n return stream_member(x, stream_tail(s));\n }\n}", "constructor() {\n this.streams = [];\n }", "constructor() {\n this._head = null\n this._length = 0\n }", "first() {\n return this.head.next;\n }", "printListData() {\n let current = this.head;\n while(current) {\n console.log(current.data);\n current = current.next;\n }\n }", "printListData() {\n let current = this.head;\n while (current) {\n console.log(current.data);\n current = current.next;\n }\n }", "printListData() {\n let current = this.head;\n\n while (current) {\n console.log(current.data);\n current = current.next;\n }\n }", "function updateStreamableList(shortcode) {\n var list = document.getElementById('gifResults');\n var newItemStreamable = document.createElement('li');\n var newLinkStreamable = document.createElement('a');\n newLinkStreamable.href = 'https://streamable.com/' + shortcode\n var newNameStreamable = document.createTextNode(\"Streamable - \" + shortcode);\n newLinkStreamable.appendChild(newNameStreamable);\n newItemStreamable.appendChild(newLinkStreamable);\n list.appendChild(newItemStreamable);\n}", "constructor () {\n this._head = null;\n this._tail = null;\n this._length = 0;\n }", "function display(list) {\n while (list.head !== null) {\n // console.log(list.head.value)\n list.head = list.head.next;\n }\n}", "link(l2){\n if (l2 instanceof LinkItem){\n this.next = l2;\n l2.last = this\n }\n }", "printList() {\n let arr = [];\n let current = this.head;\n while (current) {\n arr.push(current.data);\n current = current.next;\n }\n console.log(arr);\n }", "constructor(value) {\n this.head = {\n value: value,\n next: null,\n }\n //como es el primer elemento apunta a la cabeza\n this.tail = this.head;\n //como forzamos a que haya un valor inicial va el tamaño en 1\n this.length = 1;\n }", "function firstNode()\n {\n var chain = new LinkedList(1000);\n alert('typeof chain.head: ' + typeof chain.head);\n }", "printListData(){\n let current = this.head;\n while(current){\n console.log(current.data);\n current = current.next;\n }\n }", "printList1() {\n var curr = this.head;\n var str = \"\";\n while (curr) {\n str += curr.data + \" \";\n curr = curr.next;\n }\n return str;\n }", "function LinkedList(){\n \n this.first = null;\n \n //Agregar cartas a la baraja. \n this.add = function(symbol,color){\n \n //Se crea el nodo\n let card = new Card(symbol,color); \n let node = new Node(card)\n\n //se agrega si es el primer nodo en entrar. \n if(!this.first)this.first = node;\n //Se recorre hasta encontrar el ultimo para agregarlo. \n else{\n let current = this.first;\n while(current.next)current = current.next;\n current.next = node;\n }\n\n //Fin del add. \n } \n\n // Extraer Nodo. \n this.extract = function(n){\n\n let count = 1;\n //El nodo a extraer es el primero.\n if(n == 1){\n\n //se guarda.\n let card = new Card(this.first.value.symbol,this.first.value.color);\n let send = new Node(card);\n\n //se elimina.\n let queue = this.first.next;\n this.first = queue;\n\n //se envia.\n return send;\n\n // Cuando el n es mayor que el maximo de la lista. \n }else if( n > this.amount){\n return null;\n\n // Cuando es cuallquiera menos el primer nodo.\n }else{\n let current = this.first;\n let previous = null;\n while(current){\n\n //recorrer todos los nodos hasta encontrarlo. \n if(count == n){\n\n //se guarda el nodo a estraer.\n let card = new Card(current.value.symbol,current.value.color)\n let send = new Node(card);\n\n //se elimina el nodo a estraer.\n previous.next = current.next;\n\n //se envia el nodo a estraer.\n return send;\n }\n previous = current;\n current = current.next;\n count ++;\n }\n }\n //Fin de extract \n }\n\n // Buscar un nodo por una posicion.\n this.search = function(n){\n\n count = 1;\n //Cuando el nodo a buscar es el pimero.\n if(n == count){\n \treturn this.first;\n }\n //Cuando es cualquiera menos el primer nodo.\n else{\n current= this.first\n while(current.next){\n\n // recorrer hasta encontrarlo y enviarlo.\n if(n == count) return current;\n else{\n current = current.next;\n count++;\n }\n }\n //cuando es el ultimo de la lista. \n if(n == count)return current;\n\n //Cuando n es mayor al numero maximo de la lista. \n else return null;\n }\n\n //Fin de search\n }\n\n //Obtener el ultimo \n this.last = function(){\n \n last = this.first\n //se recorre hasta encontrar el ultimo\n while(last.next)last = last.next;\n //Se envia \n return last;\n\n //fin de last\n }\n \n // Contar la cantidad cartas en una lista \n this.amount = function(){\n \n // Si no hay nodos en la lista\n if(!this.first)return 0;\n else{\n //Si solo hay 1 nodo\n if(!this.first.next)return 1;\n //Cuando hay varios nodos\n else{\n let current = this.first;\n let count = 1;\n while(current.next){\n current = current.next;\n count++;\n }\n return count;\n }\n }\n\n //Fin de amount \n }\n\n this.searchForId = function(id){\n current = current.first;\n status = false;\n while(current){\n if(current.id = id){\n status = true;\n }\n current = current.next\n }\n return status;\n }\n \n //Vaciar las listas\n this.clear = function(){\n \tthis.first= null; \t\n }\n\n//Fin de la LinkedList \n}", "function stream_to_list(xs) {\n if (is_empty_list(xs)) {\n\treturn [];\n } else {\n\treturn pair(head(xs), stream_to_list(stream_tail(xs)));\n }\n}", "display(){\n var current = this.head;\n\n while(current){\n console.log(current.data);\n current = current.next;\n }\n }", "constructor(value) {\n this.head = {\n value: value,\n next: null,\n };\n // with the first node, there is nothing following it, the tail will also be the head\n this.tail = this.head;\n // keep track of how many nodes\n this.length = 1;\n }", "function LinkedList(){\n this.head = null;\n}", "constructor(){\n this.head = null\n this.length = 0\n }", "constructor(){\n this.head = null\n this.length = 0\n }", "print() {\n let current = this.head;\n while (current) {\n console.log(current.data);\n current = current.next;\n }\n }", "peek() {\n return this.head;\n }", "peek() {\n return this.head;\n }", "constructor(){\n this.head = null;\n this.size = 0;\n }", "function cycleLinkedList() {\n let cycleList = new LinkedList();\n cycleList.insertLast('cat');\n cycleList.insertLast('dog');\n cycleList.insertLast('test');\n cycleList.insertLast('info');\n cycleList.insertLast('final');\n cycleList.insertLast('cat');\n cycleList.cycle('final');\n console.log('Should display true below');\n console.log(cycleList.cycleList());\n}", "function WhatDoesThisProgramDo(lst) {\n let current = lst.head; // Node 1\n while (current !== null) {\n let newNode = current;\n while (newNode.next !== null) {\n if (newNode.next.value === current.value) {\n newNode.next = newNode.next.next;\n } else {\n newNode = newNode.next;\n }\n }\n current = current.next;\n }\n}", "dedupeSeen() {\n if (this.isEmpty()) {\n return this;\n }\n\n const seen = {};\n let runner = this.head;\n seen[this.head.data] = true;\n\n while (runner && runner.next) {\n if (seen.hasOwnProperty(runner.next.data)) {\n runner.next = runner.next.next;\n } else {\n seen[runner.next.data] = true;\n runner = runner.next;\n }\n }\n return this;\n }", "[ITERATOR] () {\n const next = () => {\n const value = this.read()\n const done = value === null\n return { value, done }\n }\n return { next }\n }", "[ITERATOR] () {\n const next = () => {\n const value = this.read()\n const done = value === null\n return { value, done }\n }\n return { next }\n }", "[ITERATOR] () {\n const next = () => {\n const value = this.read()\n const done = value === null\n return { value, done }\n }\n return { next }\n }", "[ITERATOR] () {\n const next = () => {\n const value = this.read()\n const done = value === null\n return { value, done }\n }\n return { next }\n }", "[ITERATOR] () {\n const next = () => {\n const value = this.read()\n const done = value === null\n return { value, done }\n }\n return { next }\n }", "addFirst(object) {\n let newLink = new Link(object);\n if(this.isEmpty())\n this.tail = newLink;\n else\n this.head.prev = newLink;\n newLink.next = this.head;\n this.head = newLink;\n this.length++;\n return true;\n }", "function LinkedList() {\n this.object = null;\n this.next = null;\n }", "constructor() {\n\t\tthis.head = null;\n\t\tthis.tail = null;\n\t\tthis.size = 0;\n\t}", "printForward() {\n if (this.isEmpty()) {\n console.info(\"List is empty!\");\n return;\n }\n\n let node = Object.assign({}, this.head);\n let i = 0;\n let result = 'Print Forward: \\n(';\n let sep = '';\n while (node) {\n result += sep + `\\n [${i}]: ${JSON.stringify(node.data)}`;\n sep = ',';\n i++;\n node = node.next;\n }\n result += '\\n)\\n';\n console.log(result);\n }", "constructor(){\n this.#head = null //Não tem nada no inicio\n this.#tail = null //Não tem nada no fim\n this.#count = 0\n\n //console.log({head:this.#head,tail:this.#tail, count:this.#count})\n }", "constructor(){\n this.head = null;\n this.length = 0;\n }", "constructor(){\n this.head = null;\n this.length = 0;\n }", "constructor() {\n this.head = null;\n this.length = 0;\n }", "constructor() {\n this.head = null;\n this.tail = null;\n }", "constructor() {\n this.head = null;\n this.tail = null;\n }", "constructor() {\n this.head = null;\n this.tail = null;\n }", "findLast() {\n\t\tlet current = this.head;\n\t\tlet previous = this.head;\n\t\tlet count = 0;\n\n\t\twhile (current.next !== null) {\n\t\t\tprevious = current;\n\t\t\tcurrent = current.next;\n\t\t\tcount++;\n\n\t\t\tif (current.next === null) {\n\t\t\t\tconsole.log(current.data);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}", "printList(){\n let count = 0;\n let current = this.head; //start at first node\n while(current){\n console.log(\"node index: \" + count + \" Data: \" + current.data)//output the data at that node\n current = current.next; //current node moves through the list until current is null which stops the while loop\n count++;\n }\n console.log(\"Linked List length: \" + this.size)\n}", "printHeadToTail() {\n if(!this.length) return\n\n let curr = this.head, str = \"\"\n while(curr) {\n str += (curr.value + (curr.next && \" <-> \"))\n curr = curr.next\n }\n console.log(str)\n }", "function linkedListNode(value) {\n return {\n value: value,\n next: null\n }\n}", "function LinkedList(value, next) {\n this.value = value;\n this.next = next;\n}", "function stream_length(xs) {\n if (is_empty_list(xs)) {\n\treturn 0;\n } else {\n\treturn 1 + stream_length(stream_tail(xs));\n }\n}", "getNext() {\n return this.next || null;\n }", "*[Symbol.iterator]() {\n let node = this.head;\n while (node) {\n yield node;\n node = node.next;\n }\n }", "function AddStreamer(arg){\n\t\t// appends the streamer names to the list\n\t\tvar list = document.getElementById(\"my-streamers-list\");\n\t\tvar li = document.createElement(\"li\");\n\t\tvar span = document.createElement(\"span\");\n\t\tspan.innerHTML = \" \";\n\t\tli.innerHTML = arg.name;\n\t// checks if streams is offline\n\t// and sets the circle span class acordingly\n\t$.get(\"https://wind-bow.gomix.me/twitch-api/streams/\" + arg.name, function(data){\n\t\tif (data.stream === null) {\n\t\t\tmyStreamers.filter(function(x){\n\t\t\t\tif(x.name === arg.name) {\n\t\t\t\t\tx[\"state\"] = \"Offline\";\n\t\t\t\t\tli.innerHTML = arg.name;\n\t\t\t\t\tli.appendChild(span);\n\t\t\t\t\tlist.appendChild(li);\n\t\t\t\t};\n\t\t\t});\n\t\t} else if (data.stream === undefined) {\n\t\t\tmyStreamers.filter(function(x){\n\t\t\t\tif(x.name === arg.name) {\n\t\t\t\t\tx[\"state\"] = \"Closed\";\n\t\t\t\t\tli.innerHTML = arg.name;\n\t\t\t\t\tli.appendChild(span);\n\t\t\t\t\tspan.className = \"closed\";\n\t\tlist.appendChild(li);\n\t\t\t\t};\n\t\t\t});\n\t\t} else {\n\t\t\tmyStreamers.filter(function(x){\n\t\t\t\tif(x.name === arg.name) {\n\t\t\t\t\tx[\"state\"] = \"Online\";\n\t\t\t\t\tli.innerHTML = arg.name;\n\t\t\t\t\tli.appendChild(span);\n\t\t\t\t\tlist.appendChild(li);\n\t\t\t\t\tspan.className = \"online\";\n\t\t\t\t};\n\t\t\t});\n\t\t};\n\t});\n}", "printList() \n { \n let curr = this.#_head; \n let str = \"[ \"; \n while (curr!=null) { \n str += curr.data.Value+ \", \"; //.Value \n curr = curr.next; \n } \n str+=\"]\"\n console.log(str); \n }", "function cloneNext(ll) {\n var curll = ll;\n while(curll) {\n curll.next = new Node(curll.value, curll.next);\n curll = curll.next.next;\n }\n\n return ll;\n\n}", "printList() \n { \n var curr = this.head; \n var str = \"\"; \n while (curr) { \n str += curr.element + \" \"; \n curr = curr.next; \n } \n console.log(str); \n }", "function make_list (value, next) {\n\treturn {\n\t\tvalue: value,\n\t\tnext: next\n\t};\n}", "constructor(){\n this.head = null\n this.tail = null\n this.length = 0\n }", "constructor() {\n this.head = null;\n this.tail = null;\n this.length = 0;\n }", "printList() {\n var curr = _head;\n var str = \"\";\n while (curr) {\n str += curr.element + \" \";\n curr = curr.next;\n }\n console.log(str);\n }", "concat(list) {\n\t\tlet runner = this.head;\n\t\twhile (runner.next != null) {\n\t\t\trunner = runner.next;\n\t\t}\n\t\trunner.next = list.head;\n\t\tlist.head = null;\n\t}", "function stream$join() {\n let streams = 0;\n let completes = 0;\n const subs = [];\n let insideStream = () => {}\n return Stream(observer => {\n // first level stream\n const outsideStream = this.subscribe({\n // next\n next: stream => {\n // streams++;\n /// level inside first level\n insideStream = stream.subscribe({\n next: value => {\n // console.log(value, 'ruifuffhfhfhfh')\n observer.next(value)\n observer.complete()\n // if (streams === completes) {\n // observer.complete();\n // }\n },\n complete: observer.complete\n // complete: () => {\n // completes++;\n // if (completes === streams) {\n // observer.complete();\n // }\n // },\n // error: observer.error\n });\n // subs.push(insideStream);\n },\n // complete\n // complete: observer.complete,\n //error\n error: e => observer.error(e)\n }\n );\n return () => {\n outsideStream();\n insideStream()\n // subs.forEach(unsus => unsus())\n }\n });\n}", "peekFirst() {\n return this.head;\n }", "constructor() {\n this.head = null;\n this.length = 0;\n }", "function stream_filter(p, s) {\n if (is_empty_list(s)) {\n\treturn [];\n } else if (p(head(s))) {\n\treturn pair(head(s),\n function() {\n\t\t\treturn stream_filter(p,\n\t\t\t\t\t stream_tail(s));\n });\n } else {\n\treturn stream_filter(p,\n stream_tail(s));\n }\n\t }" ]
[ "0.60562474", "0.5973577", "0.59712476", "0.5895271", "0.58480227", "0.58089036", "0.5804585", "0.5793426", "0.5782114", "0.5744417", "0.57425845", "0.57248867", "0.57130986", "0.5713064", "0.5695168", "0.56762546", "0.566372", "0.5656899", "0.5649103", "0.56442535", "0.562148", "0.56130713", "0.56036496", "0.558313", "0.55822355", "0.5580018", "0.5570468", "0.5551267", "0.5543302", "0.55423206", "0.55369794", "0.5534769", "0.5531256", "0.55176777", "0.55174536", "0.5515137", "0.55134386", "0.55122805", "0.5506946", "0.549515", "0.54890656", "0.5480485", "0.54755", "0.5469676", "0.54572517", "0.5454126", "0.54533213", "0.5450388", "0.54466826", "0.5441722", "0.5428744", "0.54273325", "0.5425871", "0.54228246", "0.5421403", "0.5417218", "0.5417218", "0.541555", "0.5414669", "0.5414669", "0.5408982", "0.54040897", "0.54033667", "0.540107", "0.5398932", "0.5398932", "0.5398932", "0.5398932", "0.5398932", "0.53985256", "0.5396876", "0.5391415", "0.5387", "0.5381376", "0.5377664", "0.53731054", "0.5367191", "0.53638065", "0.53638065", "0.53638065", "0.5353633", "0.5351654", "0.535061", "0.5350263", "0.5344905", "0.53429556", "0.53362924", "0.533489", "0.5330973", "0.53266674", "0.53252476", "0.5319899", "0.53149617", "0.5313415", "0.5310616", "0.53100866", "0.53088796", "0.53080124", "0.5302499", "0.5299248", "0.5295964" ]
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'); } if (er) { stream.emit('error', er); pna.nextTick(cb, er); valid = false; } return valid; }
{ "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);processNextTick(cb,er);valid=false}return valid}", "function $rtWY$var$validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n\n if (er) {\n stream.emit('error', er);\n $rtWY$var$pna.nextTick(cb, er);\n valid = false;\n }\n\n return valid;\n}", "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);processNextTick(cb,er);valid=false;}return valid;}", "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);pna.nextTick(cb,er);valid=false;}return valid;}", "function validChunk(stream,state,chunk,cb){var valid=true;var er=false;// Always throw error if a null is written\n\t// if we are not in object mode then throw\n\t// if it is not a buffer, string, or undefined.\n\tif(chunk===null){er=new TypeError('May not write null values to stream');}else if(!Buffer.isBuffer(chunk)&&typeof chunk!=='string'&&chunk!==undefined&&!state.objectMode){er=new TypeError('Invalid non-string/buffer chunk');}if(er){stream.emit('error',er);processNextTick(cb,er);valid=false;}return valid;}", "function validChunk$1(stream$$1, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream$$1.emit('error', er);\n\t processNextickArgs.nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (\n typeof chunk !== 'string' &&\n chunk !== undefined &&\n !state.objectMode\n ) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n }", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n \n if (!(Buffer.isBuffer(chunk)) &&\n typeof chunk !== 'string' &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n }", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n \n if (!(Buffer.isBuffer(chunk)) &&\n typeof chunk !== 'string' &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n }", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n // Always throw error if a null is written\n // if we are not in object mode then throw\n // if it is not a buffer, string, or undefined.\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n nextTick(cb, er);\n valid = false;\n }\n return valid;\n }", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n // Always throw error if a null is written\n // if we are not in object mode then throw\n // if it is not a buffer, string, or undefined.\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n }", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t\n\t if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n\t var er = new TypeError('Invalid non-string/buffer chunk');\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t\n\t if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {\n\t var er = new TypeError('Invalid non-string/buffer chunk');\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n // Always throw error if a null is written\n // if we are not in object mode then throw\n // if it is not a buffer, string, or undefined.\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n nextTick(cb, er);\n valid = false;\n }\n return valid;\n }", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\n\t if (!(Buffer.isBuffer(chunk)) &&\n\t typeof chunk !== 'string' &&\n\t chunk !== null &&\n\t chunk !== undefined &&\n\t !state.objectMode) {\n\t var er = new TypeError('Invalid non-string/buffer chunk');\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk$2(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextickArgs.nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t pna.nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t pna.nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t pna.nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t processNextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t if (!Buffer.isBuffer(chunk) &&\n\t 'string' !== typeof chunk &&\n\t chunk !== null &&\n\t chunk !== undefined &&\n\t !state.objectMode) {\n\t var er = new TypeError('Invalid non-string/buffer chunk');\n\t stream.emit('error', er);\n\t process.nextTick(function() {\n\t cb(er);\n\t });\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk$1(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n // Always throw error if a null is written\n // if we are not in object mode then throw\n // if it is not a buffer, string, or undefined.\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (!Buffer$c.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n nextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer$4.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n timers.setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n timers.setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n if (!Buffer.isBuffer(chunk) &&\n 'string' !== typeof chunk &&\n chunk !== null &&\n chunk !== undefined &&\n !state.objectMode) {\n var er = new TypeError('Invalid non-string/buffer chunk');\n stream.emit('error', er);\n timers.setImmediate(function() {\n cb(er);\n });\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t var er = false;\n\t // Always throw error if a null is written\n\t // if we are not in object mode then throw\n\t // if it is not a buffer, string, or undefined.\n\t if (chunk === null) {\n\t er = new TypeError('May not write null values to stream');\n\t } else if (!Buffer$1.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n\t er = new TypeError('Invalid non-string/buffer chunk');\n\t }\n\t if (er) {\n\t stream.emit('error', er);\n\t nextTick(cb, er);\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n\t var valid = true;\n\t if (!Buffer$3.isBuffer(chunk) &&\n\t 'string' !== typeof chunk &&\n\t chunk !== null &&\n\t chunk !== undefined &&\n\t !state.objectMode) {\n\t var er = new TypeError('Invalid non-string/buffer chunk');\n\t stream.emit('error', er);\n\t process.nextTick(function() {\n\t cb(er);\n\t });\n\t valid = false;\n\t }\n\t return valid;\n\t}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}", "function validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n processNextTick(cb, er);\n valid = false;\n }\n return valid;\n}" ]
[ "0.80093753", "0.7968506", "0.7958901", "0.79458404", "0.7909733", "0.79038304", "0.78475356", "0.7831503", "0.7831503", "0.781094", "0.78047717", "0.7803307", "0.7803307", "0.78027385", "0.78027385", "0.7795045", "0.7795045", "0.7795045", "0.7795045", "0.7795045", "0.77922916", "0.7773319", "0.77721673", "0.7769673", "0.77570415", "0.77570415", "0.77549666", "0.77549666", "0.77549666", "0.775463", "0.7751973", "0.7751973", "0.7751973", "0.7742746", "0.77362424", "0.77362424", "0.77362424", "0.77362424", "0.77362424", "0.77362424", "0.77362424", "0.7729392", "0.7727215", "0.7727215", "0.7727215", "0.77187306", "0.76962394", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956", "0.76933956" ]
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 += len; var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. if (!ret) state.needDrain = true; if (state.writing || state.corked) { var last = state.lastBufferedRequest; state.lastBufferedRequest = { chunk: chunk, encoding: encoding, isBuf: isBuf, callback: cb, next: null }; if (last) { last.next = state.lastBufferedRequest; } else { state.bufferedRequest = state.lastBufferedRequest; } state.bufferedRequestCount += 1; } else { doWrite(stream, state, false, len, chunk, encoding, cb); } return ret; }
{ "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 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 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 there's something in the buffer waiting, then process it", "function $rtWY$var$onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function $KNil$var$onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n } // if there's something in the buffer waiting, then process it", "function check_queue_write() {\n\tif (intf.intf.queue_write.length < 1) {\n\t\tintf.intf.writing = false;\n\t\treturn false;\n\t}\n\n\tintf.intf.writing = true;\n\treturn true;\n}", "function onwriteDrain$1(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t} // 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\")}}", "function write() {\n\t// Bail if the write queue is invalid\n\tif (!check_queue_write()) return;\n\n\t// Create message from buffer\n\tlet buffer = proto.proto.create(intf.intf.queue_write[intf.intf.queue_write.length - 1]);\n\n\tif (typeof buffer === 'undefined' || buffer === null || buffer === '') return;\n\n\tintf.intf.port.write(buffer, (error) => {\n\t\t// Bail and retry if there was a write error\n\t\tif (error) {\n\t\t\terror_out('writing', error);\n\n\t\t\t// Re-kick it\n\t\t\tsetImmediate(write);\n\n\t\t\treturn;\n\t\t}\n\n\t\tintf.intf.port.drain(() => {\n\t\t\t// After a successful write and drain, remove the last element from the write queue\n\t\t\tintf.intf.queue_write.pop();\n\n\t\t\t// Re-kick it\n\t\t\t// setImmediate(write);\n\t\t\tprocess.nextTick(write);\n\t\t});\n\t});\n}", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "async _write() {\n if (this._writing) return;\n\n // Loop because items may get pushed onto queue while we're writing\n while (this._queue) {\n let q = this._queue;\n const {resolve, reject} = q;\n delete this._queue;\n this._writing = true;\n try {\n // Slice to most recent CLEAR action\n const clearIndex = q.reduce ((a, b, i) => b[0] === CLEAR ? i : a, -1);\n if (clearIndex >= 0) q = q.slice(clearIndex + 1);\n\n // Compose JSON to write\n const json = q.map(action => JSON.stringify(action)).join('\\n');\n\n if (clearIndex >= 0) {\n // If CLEAR, start with new file\n this._nBytes = 0;\n if (!json) {\n await fs.unlink(this.filepath);\n } else {\n const tmpFile = `${this.filepath}.tmp`;\n await fs.writeFile(tmpFile, json + '\\n');\n await fs.rename(tmpFile, this.filepath);\n }\n } else if (json) {\n await fs.appendFile(this.filepath, json + '\\n');\n }\n\n this._nBytes += json.length;\n resolve();\n } catch (err) {\n if (err.code == 'ENOENT') {\n // unlinking non-existent file is okay\n resolve(err);\n } else {\n reject(err);\n }\n } finally {\n this._writing = false;\n }\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}" ]
[ "0.7143378", "0.7143378", "0.7143378", "0.7143378", "0.69726384", "0.6951576", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6889258", "0.6877684", "0.6795231", "0.67313457", "0.64302003", "0.6350551", "0.61741555", "0.6146528", "0.614629", "0.61445713", "0.61445713", "0.6137476", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073", "0.61154073" ]
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 a nonzero prevBufferLen could cause problems on `drain`\n\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }", "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 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 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 there's something in the buffer waiting, then process it", "function $KNil$var$onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }", "function $rtWY$var$onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n\n if (0 === this.writeBuffer.length) {\n this.emit(\"drain\");\n } else {\n this.flush();\n }\n }", "function drain() {\n if (!cb) return;\n if (abort) callback(abort);else if (!buffer.length && ended) callback(ended);else if (buffer.length) callback(null, buffer.shift());\n } // `callback` calls back to waiting sink,", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n if (0 === this.writeBuffer.length) {\n this.emitReserved(\"drain\");\n }\n else {\n this.flush();\n }\n }", "onDrain() {\n this.writeBuffer.splice(0, this.prevBufferLen);\n // setting prevBufferLen = 0 is very important\n // for example, when upgrading, upgrade packet is sent over,\n // and a nonzero prevBufferLen could cause problems on `drain`\n this.prevBufferLen = 0;\n if (0 === this.writeBuffer.length) {\n this.emitReserved(\"drain\");\n }\n else {\n this.flush();\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n } // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n }", "function onwriteDrain$1(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}", "function onwriteDrain(stream, state) {\n\t if (state.length === 0 && state.needDrain) {\n\t state.needDrain = false;\n\t stream.emit('drain');\n\t }\n\t}" ]
[ "0.6865807", "0.68425786", "0.6840534", "0.6840534", "0.6840534", "0.6840534", "0.68187344", "0.6766642", "0.6766642", "0.6757269", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.6720652", "0.66877633", "0.66772115", "0.6656007", "0.6656007", "0.6648094", "0.66354245", "0.66073954", "0.66073954", "0.6564184", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462", "0.6539462" ]
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; holder.entry = entry; var count = 0; var allBuffers = true; while (entry) { buffer[count] = entry; if (!entry.isBuf) allBuffers = false; entry = entry.next; count += 1; } buffer.allBuffers = allBuffers; doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite state.pendingcb++; state.lastBufferedRequest = null; if (holder.next) { state.corkedRequestsFree = holder.next; holder.next = null; } else { state.corkedRequestsFree = new CorkedRequest(state); } state.bufferedRequestCount = 0; } else { // Slow case, write chunks one-by-one while (entry) { var chunk = entry.chunk; var encoding = entry.encoding; var cb = entry.callback; var len = state.objectMode ? 1 : chunk.length; doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. if (state.writing) { break; } } if (entry === null) state.lastBufferedRequest = null; } state.bufferedRequest = entry; state.bufferProcessing = false; }
{ "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 (hasHandled(entry.depId, entry.seq)) {\n // dep has been handled, run it now\n applyMessage(entry.msg, done())\n wait = true\n }\n })\n if (!wait)\n return cb()\n done(cb)\n }", "waitForMessage_() {\n this.wait_(4, buffer => {\n this.wait_(buffer.readUInt32BE(0), buffer => {\n this.push(this.getMessage_(buffer));\n process.nextTick(() => this.waitForMessage_());\n });\n });\n }", "function wait(){}", "function handleFinished() {\n resolve(Buffer.concat(_this.buffers));\n cleanup();\n }", "processQueue_() {\n if (!this.queue_.length) return;\n const [size, callback] = this.queue_[0];\n\n if (this.getBufferSize_() < size) return;\n\n const chunk = this.consumeBuffer_(size);\n this.queue_.shift();\n callback(chunk);\n this.processQueue_();\n }", "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 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 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 there's something in the buffer waiting, then process it", "tryPush() {\n\t\t// Get the total length of what would be pushed.\n\t\tconst amountToPush = Math.min(this.buffer.length, this.requestedSize);\n\n\t\t// Check if it's possible to push right now.\n\t\tif (this.canPush &&\n\t\t\tamountToPush > 0 &&\n\t\t\t(this.initialPass || this.finished || this.buffer.length >= this.initial)) {\n\t\t\tthis.initialPass = true;\n\n\t\t\t// Push the data.\n\t\t\tthis.requestedSize = -1;\n\t\t\tthis.canPush = this.push(Buffer.from(this.buffer.shift(amountToPush)));\n\t\t}\n\n\t\t// Append part of the waiting chunk if possible.\n\t\tif (this.waiting) {\n\t\t\tconst chunk = this.waiting.chunk;\n\t\t\tconst callback = this.waiting.callback;\n\n\t\t\t// Append the data to the buffer.\n\t\t\tconst toPush = Math.min(this.buffer.remaining, chunk.length);\n\t\t\tthis.buffer.push(chunk.slice(0, toPush));\n\n\t\t\t// Adjust the waiting chunk.\n\t\t\tthis.waiting.chunk = chunk.slice(toPush);\n\n\t\t\t// If the waiting chunk is gone, callback and reset.\n\t\t\tif (this.waiting.chunk.length == 0) {\n\t\t\t\tthis.waiting = null;\n\t\t\t\tcallback();\n\t\t\t}\n\n\t\t\t// Try pushing.\n\t\t\tif (toPush > 0) this.tryPush();\n\t\t}\n\t}", "function maybeFinish() {\n if (waiting) return;\n callback();\n }", "function Process_Recvq() {\n\tif (this.queue.length == 0)\n\t\treturn 1;\n\tvar timediff = system.timer - this.time_marker;\n\tif (timediff >= 2) {\n\t\tthis.num_sent = 0;\n\t\tthis.time_marker = system.timer;\n\t}\n\tif (this.throttled) {\n\t\tif (timediff < 2)\n\t\t\treturn 1;\n\t} else if ((timediff <= 2) && (this.num_sent >= 4)) {\n\t\tthis.throttled = true;\n\t\tthis.time_marker = system.timer;\n\t\tjs.setTimeout(Recvq_Unthrottle, 2000, this);\n\t\treturn 1;\n\t}\n\tthis.irc.work(this.queue.shift());\n\tthis.num_sent++;\n\tif (this.queue.length > 0) {\n\t\tjs.setImmediate(Process_Recvq, this);\n\t}\n\treturn 0;\n}", "function drain() {\n if (!cb) return;\n if (abort) callback(abort);else if (!buffer.length && ended) callback(ended);else if (buffer.length) callback(null, buffer.shift());\n } // `callback` calls back to waiting sink,", "function $rtWY$var$onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function handler(buffer) {\n let chunks = buffer.toString().split(\"\\n\");\n\n for (let chunk of chunks) {\n chunk = chunk.replace(/(\\r\\n|\\n|\\r)/gm, \"\").trim();\n\n if (chunk == \"OK\") {\n // if end of message stop listner and return result\n this.removeListener(\"data\", handler);\n resolve(answer);\n\n // if line is busy or another but not error\n } else if (chunk == \"BUSY\" || chunk == \"NO DIAL TONE\" || chunk == \"NO CARRIER\") {\n resolve();\n\n } else if (chunk == \"ERROR\") {\n this.removeListener(\"data\", handler);\n reject(`ERROR result on command - ${command}. Answer - ${chunk}`);\n\n } else {\n // if message is not fully get add to result this chunk\n answer += chunk;\n };\n };\n }", "function Wait_IsWaiting()\n{\n\t//check the counter\n\treturn this.cCounter > 0;\n}", "function drain () {\n if (!cb) return\n\n if (abort) callback(abort)\n else if (!buffer.length && ended) callback(ended)\n else if (buffer.length) callback(null, buffer.shift())\n }", "function drain () {\n if (!cb) return\n\n if (abort) callback(abort)\n else if (!buffer.length && ended) callback(ended)\n else if (buffer.length) callback(null, buffer.shift())\n }", "function drain () {\n if (!cb) return\n\n if (abort) callback(abort)\n else if (!buffer.length && ended) callback(ended)\n else if (buffer.length) callback(null, buffer.shift())\n }", "function drain () {\n if (!cb) return\n\n if (abort) callback(abort)\n else if (!buffer.length && ended) callback(ended)\n else if (buffer.length) callback(null, buffer.shift())\n }", "function drain () {\n if (!cb) return\n\n if (abort) callback(abort)\n else if (!buffer.length && ended) callback(ended)\n else if (buffer.length) callback(null, buffer.shift())\n }", "function pollLineStuff() {\n\n var bufsz = 97, // maximum line length\n bufptr = 0x8046, // start at LINBF\n thrufl = 0x81de, // line input done flag\n len = 0;\n\n if (ccemu.rd(thrufl) === 0) { // buffer is in accepting state\n // leading zero\n ccemu.wr(bufptr, 0x00);\n // stuff until we run out message, or hit a carriage return,\n // or the buffer size limit\n while ((len < bufsz) &&\n (offset < text.length) &&\n (nextCharCode() !== 0x0D)\n ) {\n ccemu.wr(bufptr + 1 + len, nextCharCode());\n offset++; // skip carriage returns between lines\n len++;\n }\n // trailing zero\n ccemu.wr(bufptr + 1 + len, 0x00);\n // set THRUFL to indicate the line is complete\n ccemu.wr(thrufl, 0x0D);\n // check why we ended\n if ((len === bufsz) &&\n (offset < text.length) &&\n (nextCharCode() !== 0x0D)) {\n alert('Input line was too long and got split\\r\\n' +\n '(max length is ' + bufsz + ' characters)');\n }\n if (nextCharCode() === 0x0D) {\n offset++; // skip carriage returns between lines\n }\n if (offset === text.length) {\n offset = -1; // signal that we are done\n }\n }\n }", "function _checkBuffer(inst)\n{\n /* We need to have some kind of EOM signal to know when the ROV server\n * finished responding to a command. For now, we use \"<EOM>\" as a signal.\n */\n if (inst.buffer.indexOf(\"<EOM>\") != -1) {\n var first = inst.buffer.indexOf(\"<BOM>\");\n var last = inst.buffer.indexOf(\"<EOM>\");\n /* There should be <BOM> at the beginning and <EOM> at the end. If\n * something went wrong, we'll dump the buffer to the log file and\n * shutdown the ROV server.\n */\n if (first == -1 || first > last) {\n logger.info(\"ROV Module: invalid buffer content: \" + inst.buffer);\n _exit(inst);\n return (null);\n }\n var message = inst.buffer.slice(first + 5, last);\n inst.buffer = inst.buffer.substr(last + 5);\n return (message);\n }\n\n return (null);\n}", "function processBuffer(self) {\n var messages = self.buffer.split('\\n');\n self.buffer = \"\";\n _.each(messages, function(message){\n if (message.length > 0) {\n var parsed = JSON.parse(message);\n processMessage(self, parsed);\n }\n });\n}", "function waiting(){\n if(waitingFlag == true){\n setTimeout(waiting, 100);\n }\n else\n {\n }\n }", "function processQueue(cb){\n\n}", "function processQueue() {\n emptyQueue = true;\n drainQueue(true);\n }", "function insufficientBuffer(){\n\t\t\t\tif((videoPlayer.buffered.end(0) - videoPlayer.currentTime) < 20){\n\t\t\t\t\tconsole.log(\"need more buffer\");\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn false;\n\t\t\t}", "function pollKeyStuff() {\n var thrufl = 0x81de; // line input done flag\n\n var ch = nextChar();\n if (phase < 0) {\n phase++;\n } else if ((phase === 0) &&\n (ccemu.rd(thrufl) === 0)) { // buffer accepting input\n keybrd.asciiKey(ch); // set it\n phase = 1;\n } else if (phase === 1) {\n keybrd.asciiKey(); // clear it\n // heuristic: delay to allow for line processing\n phase = (ch === '\\r') ? -key_at_a_time_eol_delay : 0;\n offset++;\n if (offset >= text.length) {\n phase = 0;\n offset = -1; // signal that we are done\n }\n }\n }", "function drainBuffer () {\n draining = true;\n\n return co(function* () {\n while (buffer.length >= bufferSize || (lastCallback && buffer.length > 0)) {\n const packet = yield getPacket();\n const res = onPacket(packet);\n if (res instanceof Promise) {\n yield res;\n }\n }\n\n draining = false;\n });\n }", "async triggerOutgoingHandler(buffer) {\n const bufferLength = buffer.size;\n this.executingOutgoingHandlers++;\n this.offset += bufferLength;\n try {\n await this.outgoingHandler(() => buffer.getReadableStream(), bufferLength, this.offset - bufferLength);\n }\n catch (err) {\n this.emitter.emit(\"error\", err);\n return;\n }\n this.executingOutgoingHandlers--;\n this.reuseBuffer(buffer);\n this.emitter.emit(\"checkEnd\");\n }", "async triggerOutgoingHandler(buffer) {\n const bufferLength = buffer.size;\n this.executingOutgoingHandlers++;\n this.offset += bufferLength;\n try {\n await this.outgoingHandler(() => buffer.getReadableStream(), bufferLength, this.offset - bufferLength);\n }\n catch (err) {\n this.emitter.emit(\"error\", err);\n return;\n }\n this.executingOutgoingHandlers--;\n this.reuseBuffer(buffer);\n this.emitter.emit(\"checkEnd\");\n }", "async readWait(length)\n {\n // Create buffer\n let buf = Buffer.alloc(length);\n let received = 0;\n\n while (received < length)\n {\n if (this.receivedBuffers.length > 0)\n {\n let src = this.receivedBuffers[0]\n if (src.length > length - received)\n {\n // Use part of the buffer...\n\n // Copy out the bit we want\n src.copy(buf, received, 0, length - received);\n\n // Split the buffer to extract the part we need\n let subBuf = Buffer.alloc(src.length - (length - received));\n src.copy(subBuf, 0, length - received, length - received + subBuf.length);\n this.receivedBuffers.shift();\n this.receivedBuffers.unshift(subBuf);\n\n // Finished\n received = length;\n }\n else\n {\n // Use the entire buffer\n src.copy(buf, received);\n received += this.receivedBuffers.shift().length;\n }\n }\n else\n {\n // Wait for more data\n await new Promise((resolve, reject) => {\n this.waiter = resolve;\n });\n this.waiter = null;\n }\n }\n return buf;\n }", "function $KNil$var$onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "_continueProcessing() {\n if (this._closed) {\n this.close();\n } else {\n setTimeout(() => this._processMessages(), 100);\n }\n }", "_continueProcessing() {\n if (this._closed) {\n this.close();\n } else {\n setTimeout(() => this._processMessages(), 100);\n }\n }", "_continueProcessing() {\n if (this._closed) {\n this.close();\n } else {\n setTimeout(() => this._processMessages(), 100);\n }\n }", "function eventBuffer() {\n clearTimer();\n setInput(event);\n\n buffer = true;\n timer = window.setTimeout(function () {\n buffer = false;\n }, 650);\n }", "function eventBuffer() {\n clearTimer();\n setInput(event);\n\n buffer = true;\n timer = window.setTimeout(function() {\n buffer = false;\n }, 650);\n }", "function waitCallback() {\n\tvar waitTime = Math.random() * 2 * AVERAGE_WAIT_TIME;\n\tif(waitTime < 1000) {\n\t\twaittime = 1000;\n\t}\n\tsetTimeout(process, waitTime);\n}", "_processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) {}\n }", "_processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) { }\n }", "_processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) { }\n }", "function isProcessing() {\n\t\treturn waitingOnInput || (codec && codec.processing);\n\t}", "function processQueue(){\n\t\trequestAnimFrame(processQueue);\n\t\tvar now = Date.now();\n\t\twhile (msgQueue.length > 0 && msgQueue[0].timetag < now){\n\t\t\tvar first = msgQueue.shift();\n\t\t\tif (first.address === \"_set\"){\n\t\t\t\tfirst.data();\n\t\t\t} else {\n\t\t\t\t_send(first);\n\t\t\t}\n\t\t}\n\t\t//send an update message to all the listeners\n\t\tupdateMessage.data = now - lastUpdate;\n\t\t_send(updateMessage);\n\t\tlastUpdate = now;\n\t}", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it", "function onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it" ]
[ "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.5763926", "0.5763926", "0.5750017", "0.5747552", "0.5737504", "0.56854916", "0.567972", "0.565857", "0.565589", "0.56432647", "0.5631235", "0.56217885", "0.56217885", "0.55827504", "0.55673194", "0.5555841", "0.5555841", "0.5555841", "0.5535247", "0.55352265", "0.5510705", "0.55052155", "0.5497655", "0.5497655", "0.5492325", "0.54891336", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156", "0.54846156" ]
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._writableState || !this._writableState.errorEmitted)) { pna.nextTick(emitErrorNT, this, err); } return this; } // we set destroyed to true before firing error callbacks in order // to make it re-entrance safe in case destroy() is called within callbacks if (this._readableState) { this._readableState.destroyed = true; } // if this is a duplex stream mark the writable part as destroyed as well if (this._writableState) { this._writableState.destroyed = true; } this._destroy(err || null, function (err) { if (!cb && err) { pna.nextTick(emitErrorNT, _this, err); if (_this._writableState) { _this._writableState.errorEmitted = true; } } else if (cb) { cb(err); } }); return this; }
{ "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 _callback(err, data) { _call(callback, err, data); }", "_run(cb) {\n cb();\n }", "_run(cb) {\n cb();\n }", "function callbackWrapper(ch, cb) {\n return cb\n ? function (err, ok) {\n if (err === null) {\n cb(null, ok);\n } else cb(err);\n }\n : function () {};\n}", "function foo(cb) {\n cb();\n}", "function cb3() {\n console.log('cb3');\n}", "function foo(bar, cb) {\n cb(bar)\n}", "function foo(cb){\n console.log(cb); // prints [Function: sayHello]\n cb(); // prints 'Hello World'\n var result = cb()\n console.log(result); //prints 42\n}", "adoptedCallback() { }", "function callback() {\n\n}", "adoptedCallback() {}", "adoptedCallback() {}", "wrap (cb) {\n return function () {\n var args = Array.prototype.slice.call(arguments)\n var next = args.pop()\n\n args.push(function () {\n // if (err) return next(err)\n var iargs = Array.prototype.slice.call(arguments)\n\n next.apply(this, iargs)\n })\n cb.apply(this, args)\n }\n }", "function callback(){\n cb();\n callback = ()=>{};\n }", "function invokeCallback(cb) {\n // invoke cb\n cb();\n}", "_flush(cb) {\n\t return cb()\n\t }", "function example_1_normal(cb) {\n // TODO\n}", "function callbackAsap(cb, err, res) {\n\t asap(function() { cb(err, res); });\n\t}", "_final(cb) {\n logger.debug('ZitiSocket._final entered');\n cb();\n }", "function withCallBack(a, b, cb) {\n cb(a, b);\n}", "static InvokeCallback(cb, ...args)\n\t{\n\t\tif (Boolean(cb) && typeof cb === 'function')\n\t\t{\n\t\t\tconst arg = Array.from ? Array.from(args) : [].slice.call(args);\n\t\t\tcb(...arg);\n\t\t}\n\t}", "function callbackAsap(cb, err, res) {\n asap(function () {\n cb(err, res);\n });\n}", "function mycallback() {}", "function callbackAdd(a, b, cb){\n cb(a+b);\n}", "function demoTask(cb)\n{\n console.log('hello');\n cb();\n}", "function doSomething (cb) {\n cb(null, 'success')\n}", "function another(cb) {\n cb();\n}", "function callback(err, val) {\n var _cb = cb; // if error and pushable passed onClose, call it\n // the first time this stream ends or errors.\n\n if (err && onClose) {\n var c = onClose;\n onClose = null;\n c(err === true ? null : err);\n }\n\n cb = null;\n\n _cb(err, val);\n }", "function callback (err, val) {\n var _cb = cb\n // if error and pushable passed onClose, call it\n // the first time this stream ends or errors.\n if (err && onClose) {\n var c = onClose\n onClose = null\n c(err === true ? null : err)\n }\n cb = null\n _cb(err, val)\n }", "function callback (err, val) {\n var _cb = cb\n // if error and pushable passed onClose, call it\n // the first time this stream ends or errors.\n if (err && onClose) {\n var c = onClose\n onClose = null\n c(err === true ? null : err)\n }\n cb = null\n _cb(err, val)\n }", "function callback (err, val) {\n var _cb = cb\n // if error and pushable passed onClose, call it\n // the first time this stream ends or errors.\n if (err && onClose) {\n var c = onClose\n onClose = null\n c(err === true ? null : err)\n }\n cb = null\n _cb(err, val)\n }", "function callback (err, val) {\n var _cb = cb\n // if error and pushable passed onClose, call it\n // the first time this stream ends or errors.\n if (err && onClose) {\n var c = onClose\n onClose = null\n c(err === true ? null : err)\n }\n cb = null\n _cb(err, val)\n }", "function callback (err, val) {\n var _cb = cb\n // if error and pushable passed onClose, call it\n // the first time this stream ends or errors.\n if (err && onClose) {\n var c = onClose\n onClose = null\n c(err === true ? null : err)\n }\n cb = null\n _cb(err, val)\n }", "function _cb(cb){\n\t\t\t\t return d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t }", "function callback() {\n console.log('yo soy un callback')\n}", "adoptedCallback() {\n\n }", "function callback(fn) {\n return function () {\n fn.apply(this, arguments);\n };\n }", "function _cb(cb){\r\n return d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\r\n }", "function caller(arr,cb){ //here cb is receiving the address of a square function \n let newArr = [];\n for(let i=0;i<arr.length;i++){\n let value = cb(arr[i]);\n newArr.push(value);\n }\n return newArr;\n}", "function cbify (done) {\n return function (err, value) {\n if (err) {\n console.error(err.toString())\n process.exit(1)\n }\n\n return done.apply(this, Array.prototype.slice.call(arguments, 1))\n }\n}", "function _cb(cb){\n return d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n }", "function wrap_cb (fn, P) {\n return function (params) {\n return new P(function (resolve, reject) {\n fn(params, function (err) { return !err ? resolve() : reject(err) })\n })\n }\n}", "function _cb(cb){\r\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\r\n\t\t\t}", "function _cb(cb){\r\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\r\n\t\t\t}", "function _cb(cb){\r\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\r\n\t\t\t}", "function _cb(cb){\r\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\r\n\t\t\t}", "function callback(args) {\n var params,\n cb = args.td.callback;\n if (cb) {\n params = Array.prototype.slice.call(arguments, 1);\n if (isFunction(cb)) {\n cb.apply($this, params);\n } else if (isArray(cb)) {\n if (isFunction(cb[1])) {\n cb[1].apply(cb[0], params);\n }\n }\n }\n }", "function callback(args) {\n var params,\n cb = args.td.callback;\n if (cb) {\n params = Array.prototype.slice.call(arguments, 1);\n if (isFunction(cb)) {\n cb.apply($this, params);\n } else if (isArray(cb)) {\n if (isFunction(cb[1])) {\n cb[1].apply(cb[0], params);\n }\n }\n }\n }", "function callback(args) {\n var params,\n cb = args.td.callback;\n if (cb) {\n params = Array.prototype.slice.call(arguments, 1);\n if (isFunction(cb)) {\n cb.apply($this, params);\n } else if (isArray(cb)) {\n if (isFunction(cb[1])) {\n cb[1].apply(cb[0], params);\n }\n }\n }\n }", "function callback(args) {\n var params,\n cb = args.td.callback;\n if (cb) {\n params = Array.prototype.slice.call(arguments, 1);\n if (isFunction(cb)) {\n cb.apply($this, params);\n } else if (isArray(cb)) {\n if (isFunction(cb[1])) {\n cb[1].apply(cb[0], params);\n }\n }\n }\n }", "function _cb(cb){\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t}", "function _cb(cb){\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t}", "function _cb(cb){\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t}", "function _cb(cb){\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t}", "function _cb(cb){\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t}", "function _cb(cb){\n\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb]===\"function\";\n\t\t\t}", "getCallback(err, hObj, gmo, md, buf) {\n // If there is an error, prepare to exit by setting the ok flag to false.\n if (err) {\n if (err.mqrc == MQC.MQRC_NO_MSG_AVAILABLE) {\n debug_info(\"No more messages available.\");\n } else {\n MQBoilerPlate.reportError(err);\n }\n canExit = true;\n // We don't need any more messages delivered, so cause the\n // callback to be deleted after this one has completed.\n //mq.GetDone(hObj);\n } else {\n if (activeCB) {\n canExit = !activeCB(md, buf);\n }\n }\n }", "function cbFoo() {\n // Let's use closure feature to sit in memory a variable\n // to use later on when the execution context of this function\n // has run\n var greetings = 'Hello';\n\n setTimeout(function() { // anonymous function requested by setTimeout\n // alert(greetings); // uncomment to test\n }, 3000);\n\n}", "function async_io_normal(cb) {\n\n}", "function callbackWrapper(callback) {\n return function(err, result){\n if(err) {\n callback(err);\n } else {\n callback(null, resultToArray(result));\n }\n };\n }", "function cb(){\n console.log(\"i will call u back after 2 sec\");\n}", "function callback(err, r) { console.log(`callback: result=${r}; error=${err}`); }", "function callbackified(){var args=[];for(var i=0;i<arguments.length;i++){args.push(arguments[i]);}var maybeCb=args.pop();if(typeof maybeCb!=='function'){throw new TypeError('The last argument must be of type Function');}var self=this;var cb=function(){return maybeCb.apply(self,arguments);};// In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this,args).then(function(ret){process.nextTick(cb.bind(null,null,ret));},function(rej){process.nextTick(callbackifyOnRejected.bind(null,rej,cb));});}", "function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n \n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb, null, ret) },\n function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) });\n }", "function performer(cb) {\n return cb();\n}", "function callbackified() {\n\t var args = [];\n\t for (var i = 0; i < arguments.length; i++) {\n\t args.push(arguments[i]);\n\t }\n\n\t var maybeCb = args.pop();\n\t if (typeof maybeCb !== 'function') {\n\t throw new TypeError('The last argument must be of type Function');\n\t }\n\t var self = this;\n\t var cb = function() {\n\t return maybeCb.apply(self, arguments);\n\t };\n\t // In true node style we process the callback on `nextTick` with all the\n\t // implications (stack, `uncaughtException`, `async_hooks`)\n\t original.apply(this, args)\n\t .then(function(ret) { nextTick(cb.bind(null, null, ret)); },\n\t function(rej) { nextTick(callbackifyOnRejected.bind(null, rej, cb)); });\n\t }", "function performer(cb) {\n cb();\n }", "function init(cb){\n\n}", "function callbackified(){var args=[];for(var i=0;i<arguments.length;i++){args.push(arguments[i])}var maybeCb=args.pop();if(typeof maybeCb!==\"function\"){throw new TypeError(\"The last argument must be of type Function\")}var self=this;var cb=function(){return maybeCb.apply(self,arguments)};// In true node style we process the callback on `nextTick` with all the\n// implications (stack, `uncaughtException`, `async_hooks`)\noriginal.apply(this,args).then(function(ret){process.nextTick(cb.bind(null,null,ret))},function(rej){process.nextTick(callbackifyOnRejected.bind(null,rej,cb))})}", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function () {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n $QcjV$var$process.nextTick(cb, null, ret);\n }, function (rej) {\n $QcjV$var$process.nextTick($QcjV$var$callbackifyOnRejected, rej, cb);\n });\n }", "function _cb(cb) {\n\t\t\t\t\treturn d && o.callbacks[cb] && typeof o.callbacks[cb] === \"function\";\n\t\t\t\t}", "write(cb) {\n getQueue().write(cb);\n }", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function cb() {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "wait(cb) {\n if (this.msg != null) {\n setImmediate(cb, this.err, this.msg)\n this.msg = null\n } else {\n if (!this.server) {\n throw Error(\"not listening\")\n }\n this.cb = cb\n }\n }", "function hello(callback) {\r\n callback(\"Cnu\");\r\n}", "function batchedCallback(callback) {\n\treturn function(err, res) {\n\t\tReactUpdates.batchedUpdates(callback.bind(null, err, res));\n\t}\n}", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function cb() {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function cb() {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function cb() {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "function Wait_CreateCallback(aCallBack)\n{\n\t//create a function\n\treturn function () { aCallBack[0](aCallBack[1], aCallBack[2], aCallBack[3], aCallBack[4]); };\n}", "function handleCallback(callback, err, result) {\n try {\n callback(err, result);\n } catch (err) {\n process.nextTick(function() {\n throw err;\n });\n }\n}", "function handleCallback(callback, err, result) {\n try {\n callback(err, result);\n } catch (err) {\n process.nextTick(function() {\n throw err;\n });\n }\n}", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function () {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function () {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "function callbackified() {\n var args = [];\n\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n\n var self = this;\n\n var cb = function () {\n return maybeCb.apply(self, arguments);\n }; // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n\n\n original.apply(this, args).then(function (ret) {\n process.nextTick(cb, null, ret);\n }, function (rej) {\n process.nextTick(callbackifyOnRejected, rej, cb);\n });\n }", "function mainFunc(a, b, cb) {\n if (cb && typeof cb === 'function') return cb(a, b);\n \n return false;\n }", "function async_api(f, arg, cb, err) {\n err = err || function(e){ console.log(e); };\n var callback = function(a,b,c,d) {\n var e = api.runtime.lastError;\n if (e) {\n err(e);\n }\n else {\n cb(a,b,c,d);\n }\n };\n try {\n var promise = f.call(null, arg, callback);\n if (promise && promise.then) {\n promise.then(callback);\n }\n } catch(e) {\n err(e);\n }\n}", "function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb, null, ret); },\n function(rej) { process.nextTick(callbackifyOnRejected, rej, cb); });\n }", "function callIt(callback) {\n \tcallback();\n\t}", "function processQueue(cb){\n\n}", "blocker(program, state, callback) {\n return [];\n // yes, we are *not* calling the callback;\n }", "function greeter(fullname,cb){ //cb-call back function\n var message=cb(fullname);\n console.log(`Hello ${message}`);\n}" ]
[ "0.7928905", "0.7928905", "0.7928905", "0.7928905", "0.7928905", "0.7877934", "0.77447444", "0.73254204", "0.7234518", "0.71503025", "0.71441734", "0.71441734", "0.71282893", "0.7032806", "0.70259714", "0.6999851", "0.6972972", "0.6934845", "0.6920968", "0.6806171", "0.6806171", "0.6781161", "0.67739105", "0.6747749", "0.6739198", "0.6720973", "0.6679077", "0.6653771", "0.6650488", "0.66254234", "0.66238225", "0.6617502", "0.66076905", "0.6594917", "0.65938485", "0.65874195", "0.6582809", "0.6560483", "0.6560483", "0.6560483", "0.6560483", "0.6560483", "0.65376675", "0.6514987", "0.6491781", "0.64728796", "0.6452068", "0.6448823", "0.6441155", "0.6422606", "0.6417454", "0.64068586", "0.64068586", "0.64068586", "0.64068586", "0.6392715", "0.6392715", "0.6392715", "0.6392715", "0.6372048", "0.6372048", "0.6372048", "0.6372048", "0.6372048", "0.6372048", "0.6371381", "0.63172543", "0.6298802", "0.6294218", "0.6289831", "0.62802535", "0.62633973", "0.62511915", "0.62442", "0.6242997", "0.621881", "0.6214055", "0.6206681", "0.61992353", "0.61932826", "0.61922026", "0.6183779", "0.6181141", "0.6179666", "0.6176537", "0.61720043", "0.61720043", "0.61720043", "0.61579037", "0.6153562", "0.6153562", "0.61464506", "0.61464506", "0.61464506", "0.61304474", "0.6108685", "0.6106112", "0.6104502", "0.6099984", "0.60951614", "0.6094824" ]
0.0
-1
Do not cache `Buffer.isEncoding` when checking encoding names as some modules monkeypatch it to support additional encodings
function normalizeEncoding(enc) { var nenc = _normalizeEncoding(enc); if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); return nenc || enc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detectUTF8(txt) {\n if(txt) return txt.match(/([\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEF][\\x80-\\xBF][\\x80-\\xBF]|\\xF0[\\x90-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|[\\xF1-\\xF7][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xF8[\\x88-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|[\\xF9-\\xFB][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xFC[\\x84-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xFD[\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF])/) != null;\n return false;\n}", "function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!==\"string\"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error(\"Unknown encoding: \"+enc);return nenc||enc}", "function detectEncoding(samples) {\n var encoding = null;\n if (looksLikeUtf8(samples)) {\n encoding = 'utf8';\n } else if (looksLikeWin1252(samples)) {\n // Win1252 is the same as Latin1, except it replaces a block of control\n // characters with n-dash, Euro and other glyphs. Encountered in-the-wild\n // in Natural Earth (airports.dbf uses n-dash).\n encoding = 'win1252';\n }\n return encoding;\n }", "function encodingIsAsciiCompat(enc) {\n enc = standardizeEncodingName(enc);\n // gb.* selects the Guo Biao encodings\n // big5 in not compatible -- second byte starts at 0x40\n return !enc || /^(win|latin|utf8|ascii|iso88|gb)/.test(enc);\n }", "function testStringEncodings(){\n\t\tvar StringUtils = LanguageModule.StringUtils;\n\t\tvar stringUtils = new StringUtils();\n\t\tvar encodings = stringUtils.stringEncodings;\n\t\texpect(_.isObject(encodings)).to.eql(true);\n\t\texpect(_.has(encodings, \"ASCII\")).to.eql(true);\n\t\texpect(_.has(encodings, \"UTF8_BINARY\")).to.eql(true);\n\t\texpect(_.has(encodings, \"ISO_8859_1\")).to.eql(true);\n\t\texpect(encodings.UTF8_BINARY).to.eql(0);\n\t\texpect(encodings.ASCII).to.eql(1);\n\t\texpect(encodings.ISO_8859_1).to.eql(2);\n\t}", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (\n typeof nenc !== 'string' &&\n (Buffer.isEncoding === isEncoding || !isEncoding(enc))\n )\n throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n }", "function getFullEncoding(spec){return spec.encoding;}", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (\n typeof nenc !== 'string' &&\n (Buffer.isEncoding === isEncoding || !isEncoding(enc))\n )\n throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n }", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (\n typeof nenc !== 'string' &&\n (Buffer.isEncoding === isEncoding || !isEncoding(enc))\n )\n throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n }", "function hasUTF8(input)\n{\n return (input.indexOf('<meta charset=\"utf-8\">') != -1 || input.indexOf('<meta charset=\"UTF-8\">') != -1);\n}", "function isBuffer(_chunk, encoding) {\n return encoding === \"buffer\";\n }", "function getEncodings() {\n iconv.encodingExists('ascii'); // make iconv load its encodings\n return Object.keys(iconv.encodings);\n }", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function isValidName(encodingName) {\n return fixEncoding(encodingName) !== undefined;\n}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer$5.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n\t var nenc = _normalizeEncoding(enc);\n\t if (typeof nenc !== 'string' && (Buffer$1.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n\t return nenc || enc;\n\t}", "function normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer$4.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}" ]
[ "0.6635265", "0.65760595", "0.65354884", "0.6478273", "0.6463494", "0.62667626", "0.62661046", "0.62631136", "0.62570816", "0.6208488", "0.61463493", "0.61388755", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61089295", "0.61030364", "0.60906225", "0.6075715", "0.60034794" ]
0.0
-1
Checks the type of a UTF8 byte, whether it's ASCII, a leading byte, or a continuation byte. If an invalid byte is detected, 2 is returned.
function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; return byte >> 6 === 0x02 ? -1 : -2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function $lrG1$var$utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}", "function utf8CheckByte(byte) {\n if (byte <= 0x7f) return 0;\n else if (byte >> 5 === 0x06) return 2;\n else if (byte >> 4 === 0x0e) return 3;\n else if (byte >> 3 === 0x1e) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n }", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7f) return 0;\n else if (byte >> 5 === 0x06) return 2;\n else if (byte >> 4 === 0x0e) return 3;\n else if (byte >> 3 === 0x1e) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n }", "function utf8CheckByte(byte) {\n if (byte <= 0x7f) return 0;\n else if (byte >> 5 === 0x06) return 2;\n else if (byte >> 4 === 0x0e) return 3;\n else if (byte >> 3 === 0x1e) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n }" ]
[ "0.80071485", "0.7941057", "0.7896804", "0.78160745", "0.78160745", "0.77788097", "0.77684426", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.77556324", "0.7750998", "0.7750462" ]
0.0
-1
Checks at most 3 bytes at the end of a Buffer in order to detect an incomplete multibyte UTF8 character. The total number of bytes (2, 3, or 4) needed to complete the UTF8 character (if applicable) are returned.
function utf8CheckIncomplete(self, buf, i) { var j = buf.length - 1; if (j < i) return 0; var nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 1; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } return nb; } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte){if(byte<=0x7F)return 0;else if(byte>>5===0x06)return 2;else if(byte>>4===0x0E)return 3;else if(byte>>3===0x1E)return 4;return byte>>6===0x02?-1:-2;}// Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function $lrG1$var$utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}", "function $lrG1$var$utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer." ]
[ "0.82110626", "0.82110626", "0.81340784", "0.81340784", "0.8053497", "0.8053497", "0.80296516", "0.8010968", "0.78475666", "0.7843401", "0.7776888", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77501607", "0.77060896" ]
0.0
-1
Validates as many continuation bytes for a multibyte UTF8 character as needed or are available. If we see a noncontinuation byte where we expect one, we "replace" the validated continuation bytes we've seen so far with a single UTF8 replacement character ('\ufffd'), to match v8's UTF8 decoding behavior. The continuation byte check is included three times in the case where all of the continuation bytes for a character exist in the same buffer. It is also done this way as a slight performance increase instead of using a loop.
function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; return '\ufffd'; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3;}return nb;}return 0;}// Validates as many continuation bytes for a multi-byte UTF-8 character as", "function $lrG1$var$utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = $lrG1$var$utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n\n return nb;\n }\n\n return 0;\n} // Validates as many continuation bytes for a multi-byte UTF-8 character as", "function validateUtf8(bytes, start, end) {\n let continuation = 0;\n for (let i = start; i < end; i += 1) {\n const byte = bytes[i];\n if (continuation) {\n if ((byte & FIRST_TWO_BITS) !== CONTINUING_CHAR) {\n return false;\n }\n continuation -= 1;\n }\n else if (byte & FIRST_BIT) {\n if ((byte & FIRST_THREE_BITS) === TWO_BIT_CHAR) {\n continuation = 1;\n }\n else if ((byte & FIRST_FOUR_BITS) === THREE_BIT_CHAR) {\n continuation = 2;\n }\n else if ((byte & FIRST_FIVE_BITS) === FOUR_BIT_CHAR) {\n continuation = 3;\n }\n else {\n return false;\n }\n }\n }\n return !continuation;\n}", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}", "function $lrG1$var$utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "decodeCharAt (pos) {\n let c, c1, c2, c3;\n c = this.readByteAt(pos);\n\n if (c === null) {\n return null;\n }\n\n // Zero continuation (0 to 127)\n if ((c & 0x80) === 0) {\n return {\n code: c,\n value: String.fromCodePoint(c),\n width: 1\n };\n }\n\n // One continuation (128 to 2047)\n if ((c & 0xE0) === 0xC0) {\n c1 = this.readContinuationByte(pos + 1);\n\n if (c1 >= 0) {\n const codePoint = ((c & 0x1F) << 6) | c1;\n\n if (codePoint >= 128) {\n return {\n code: codePoint,\n value: String.fromCodePoint(codePoint),\n width: 2\n };\n }\n }\n } else if ((c & 0xF0) === 0xE0) {\n // Two continuations (2048 to 55295 and 57344 to 65535)\n c1 = this.readContinuationByte(pos + 1);\n c2 = this.readContinuationByte(pos + 2);\n\n if ((c1 | c2) >= 0) {\n const codePoint = ((c & 0x0F) << 12) | (c1 << 6) | c2;\n\n if (codePoint >= 2048 && (codePoint < 55296 || codePoint > 57343)) {\n return {\n code: codePoint,\n value: String.fromCodePoint(codePoint),\n width: 3\n };\n }\n }\n } else if ((c & 0xF8) === 0xF0) {\n // Three continuations (65536 to 1114111)\n c1 = this.readContinuationByte(pos + 1);\n c2 = this.readContinuationByte(pos + 2);\n c3 = this.readContinuationByte(pos + 3);\n\n if ((c1 | c2 | c3) >= 0) {\n const codePoint = ((c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3;\n\n if (codePoint >= 65536 && codePoint <= 1114111) {\n return {\n code: codePoint,\n value: String.fromCodePoint(codePoint),\n width: 4\n };\n }\n }\n }\n\n // invalid character\n return null;\n }", "function checkContinuation(uint8array, start, checkLength) {\n var array = uint8array;\n if (start + checkLength < array.length) {\n while (checkLength--) {\n if ((array[++start] & 0xC0) !== 0x80) return false;\n }\n return true;\n } else {\n return false;\n }\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}", "function utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}" ]
[ "0.79382133", "0.79382133", "0.746637", "0.7310104", "0.7310104", "0.7114822", "0.670945", "0.65889984", "0.6557506", "0.65448034", "0.64812857", "0.64359194", "0.63850605", "0.62734044", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173", "0.5986173" ]
0.0
-1
Attempts to complete a multibyte UTF8 character using bytes from a Buffer.
function utf8FillLast(buf) { var p = this.lastTotal - this.lastNeed; var r = utf8CheckExtraBytes(this, buf, p); if (r !== undefined) return r; if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, p, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, p, 0, buf.length); this.lastNeed -= buf.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function $lrG1$var$utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function $lrG1$var$utf8Text(buf, i) {\n var total = $lrG1$var$utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString(\"utf8\",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString(\"utf8\",i,end)}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}" ]
[ "0.71285844", "0.701326", "0.678287", "0.67024726", "0.6565176", "0.64727366", "0.64727366", "0.6346288", "0.63428015", "0.63428015", "0.6312178", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763", "0.616763" ]
0.0
-1
Returns all complete UTF8 characters in a Buffer. If the Buffer ended on a partial character, the character's bytes are buffered until the required number of bytes are available.
function utf8Text(buf, i) { var total = utf8CheckIncomplete(this, buf, i); if (!this.lastNeed) return buf.toString('utf8', i); this.lastTotal = total; var end = buf.length - (total - this.lastNeed); buf.copy(this.lastChar, 0, end); return buf.toString('utf8', i, end); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
For UTF8, a replacement character is added when ending on a partial character.
function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + '\ufffd'; return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function exchange_chars_utf8(str){\n var newstr = str;\n var bad_chars = [\n chr(0x00C9).concat(\"o\"), chr(0x00C9).concat(\"O\"), chr(0x00C9).concat(\"a\"),\n chr(0x00C9).concat(\"A\"), chr(0x00C9).concat(\"u\"), chr(0x00C9).concat(\"U\"),\n chr(137), chr(136), chr(251) , chr(194).concat(\"a\") ,\n chr(194).concat(\"i\"), chr(194).concat(\"e\"), chr(208).concat(\"c\"), chr(194).concat(\"E\"),\n chr(207).concat(\"c\"), chr(207).concat(\"s\"), chr(207).concat(\"S\"), chr(201).concat(\"i\"),\n chr(200).concat(\"e\"), chr(193).concat(\"e\"), chr(193).concat(\"a\"), chr(193).concat(\"i\"),\n chr(193).concat(\"o\"), chr(193).concat(\"u\"), chr(195).concat(\"u\"), chr(201).concat(\"e\"),\n chr(195).concat(chr(194)), \"&amp;#263;\", \"ä\"\n ];\n // console.log(bad_chars);\n var rep_chars = [\n \"ö\", \"Ö\", \"ä\",\n \"Ä\", \"ü\", \"Ü\",\n \"\" , \"\" , \"ß\", \"á\",\n \"í\", \"é\", \"ç\", \"É\",\n \"č\", \"š\", \"Š\", \"ï\",\n \"ë\", \"è\", \"à\", \"ì\",\n \"ò\", \"ú\", \"û\", \"ë\",\n \"ä\", \"ć\", \"ä\"\n ];\n if(bad_chars.length != rep_chars.length){\n //error\n }\n else{\n var regex;\n for(var i = 0; i < rep_chars.length;i++){\n regex = new RegExp(bad_chars[i], \"g\");\n newstr = newstr.replace(regex, rep_chars[i]);\n }\n }\n return newstr;\n\n}", "function $lrG1$var$utf8Text(buf, i) {\n var total = $lrG1$var$utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n} // For UTF-8, a replacement character is added when ending on a partial", "function replaceLastCharacter(string, character) {\n return string.slice(0, string.length - 1) + character;\n }", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf){var r=buf&&buf.length?this.write(buf):\"\";if(this.lastNeed)return r+\"�\".repeat(this.lastTotal-this.lastNeed);return r}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\uFFFD'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n }", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n }", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n }", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd';\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd';\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd';\n\t return r;\n\t}", "function autoEdUnicodeControlChars(str) { //MAIN FUNCTION describes list of fixes\n \n //Removes unneeded Unicode control characters\n str = str.replace(new RegExp('\\u200E|\\uFEFF|\\u200B', 'gi'), '');\n \n return str;\n}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function utf8End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n\t return r;\n\t}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd'.repeat(this.lastTotal - this.lastNeed);\n return r;\n}", "function utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n }" ]
[ "0.6675062", "0.6675062", "0.6231528", "0.6222556", "0.6221065", "0.6221065", "0.5836165", "0.58046544", "0.58046544", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.56987494", "0.5690213", "0.5690213", "0.5660663", "0.5636449", "0.5636449", "0.55870664", "0.557169", "0.5554909", "0.55448425", "0.55448425", "0.55448425", "0.55369556", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.55352336", "0.552003", "0.552003", "0.552003", "0.552003", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.55137783", "0.5504979" ]
0.0
-1
UTF16LE typically needs two bytes per character, but even if we have an even number of bytes available, we need to check if we end on a leading/high surrogate. In that case, we need to wait for the next two bytes in order to decode the last character properly.
function utf16Text(buf, i) { if ((buf.length - i) % 2 === 0) { var r = buf.toString('utf16le', i); if (r) { var c = r.charCodeAt(r.length - 1); if (c >= 0xD800 && c <= 0xDBFF) { this.lastNeed = 2; this.lastTotal = 4; this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; return r.slice(0, -1); } } return r; } this.lastNeed = 1; this.lastTotal = 2; this.lastChar[0] = buf[buf.length - 1]; return buf.toString('utf16le', i, buf.length - 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isUTF16 (data) {\n var i = 0\n var len = data && data.length\n var pos = null\n var b1, b2, next, prev\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false\n }\n } else {\n b1 = data[0]\n b2 = data[1]\n if (b1 === 0xFF && // BOM (little-endian)\n b2 === 0xFE) {\n return true\n }\n if (b1 === 0xFE && // BOM (big-endian)\n b2 === 0xFF) {\n return true\n }\n\n for (; i < len; i++) {\n if (data[i] === 0x00) {\n pos = i\n break\n } else if (data[i] > 0xFF) {\n return false\n }\n }\n\n if (pos === null) {\n return false // Non ASCII\n }\n\n next = data[pos + 1] // BE\n if (next !== void 0 && next > 0x00 && next < 0x80) {\n return true\n }\n\n prev = data[pos - 1] // LE\n if (prev !== void 0 && prev > 0x00 && prev < 0x80) {\n return true\n }\n }\n\n return false\n }", "function isUTF16(data) {\n var i = 0;\n var len = data && data.length;\n var pos = null;\n var b1, b2, next, prev;\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false;\n }\n } else {\n b1 = data[0];\n b2 = data[1];\n if (b1 === 0xFF && // BOM (little-endian)\n b2 === 0xFE) {\n return true;\n }\n if (b1 === 0xFE && // BOM (big-endian)\n b2 === 0xFF) {\n return true;\n }\n\n for (; i < len; i++) {\n if (data[i] === 0x00) {\n pos = i;\n break;\n } else if (data[i] > 0xFF) {\n return false;\n }\n }\n\n if (pos === null) {\n return false; // Non ASCII\n }\n\n next = data[pos + 1]; // BE\n if (next !== void 0 && next > 0x00 && next < 0x80) {\n return true;\n }\n\n prev = data[pos - 1]; // LE\n if (prev !== void 0 && prev > 0x00 && prev < 0x80) {\n return true;\n }\n }\n\n return false;\n}", "function isUTF16(data) {\n var i = 0;\n var len = data && data.length;\n var pos = null;\n var b1, b2, next, prev;\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false;\n }\n } else {\n b1 = data[0];\n b2 = data[1];\n if (b1 === 0xFF && // BOM (little-endian)\n b2 === 0xFE) {\n return true;\n }\n if (b1 === 0xFE && // BOM (big-endian)\n b2 === 0xFF) {\n return true;\n }\n\n for (; i < len; i++) {\n if (data[i] === 0x00) {\n pos = i;\n break;\n } else if (data[i] > 0xFF) {\n return false;\n }\n }\n\n if (pos === null) {\n return false; // Non ASCII\n }\n\n next = data[pos + 1]; // BE\n if (next !== void 0 && next > 0x00 && next < 0x80) {\n return true;\n }\n\n prev = data[pos - 1]; // LE\n if (prev !== void 0 && prev > 0x00 && prev < 0x80) {\n return true;\n }\n }\n\n return false;\n}", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString(\"utf16le\",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString(\"utf16le\",i,buf.length-1)}", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function lengthBytesUTF16(str) {\nreturn str.length*2;\n}", "function lengthBytesUTF16(str) {\r\n return str.length*2;\r\n}" ]
[ "0.6966989", "0.6922426", "0.6922426", "0.6817468", "0.6748273", "0.6748273", "0.6737087", "0.6737087", "0.6727744", "0.66424835" ]
0.0
-1
For UTF16LE we do not explicitly append special replacement characters if we end on a partial character, we simply let v8 handle that.
function utf16End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) { var end = this.lastTotal - this.lastNeed; return r + this.lastChar.toString('utf16le', 0, end); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $lrG1$var$utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function exchange_chars_utf8(str){\n var newstr = str;\n var bad_chars = [\n chr(0x00C9).concat(\"o\"), chr(0x00C9).concat(\"O\"), chr(0x00C9).concat(\"a\"),\n chr(0x00C9).concat(\"A\"), chr(0x00C9).concat(\"u\"), chr(0x00C9).concat(\"U\"),\n chr(137), chr(136), chr(251) , chr(194).concat(\"a\") ,\n chr(194).concat(\"i\"), chr(194).concat(\"e\"), chr(208).concat(\"c\"), chr(194).concat(\"E\"),\n chr(207).concat(\"c\"), chr(207).concat(\"s\"), chr(207).concat(\"S\"), chr(201).concat(\"i\"),\n chr(200).concat(\"e\"), chr(193).concat(\"e\"), chr(193).concat(\"a\"), chr(193).concat(\"i\"),\n chr(193).concat(\"o\"), chr(193).concat(\"u\"), chr(195).concat(\"u\"), chr(201).concat(\"e\"),\n chr(195).concat(chr(194)), \"&amp;#263;\", \"ä\"\n ];\n // console.log(bad_chars);\n var rep_chars = [\n \"ö\", \"Ö\", \"ä\",\n \"Ä\", \"ü\", \"Ü\",\n \"\" , \"\" , \"ß\", \"á\",\n \"í\", \"é\", \"ç\", \"É\",\n \"č\", \"š\", \"Š\", \"ï\",\n \"ë\", \"è\", \"à\", \"ì\",\n \"ò\", \"ú\", \"û\", \"ë\",\n \"ä\", \"ć\", \"ä\"\n ];\n if(bad_chars.length != rep_chars.length){\n //error\n }\n else{\n var regex;\n for(var i = 0; i < rep_chars.length;i++){\n regex = new RegExp(bad_chars[i], \"g\");\n newstr = newstr.replace(regex, rep_chars[i]);\n }\n }\n return newstr;\n\n}", "function Utf16BeEncoding()\r\n{\r\n // note: false means big-endian.\r\n var myUtf16EncodingBase = new Utf16EncodingBase(false);\r\n \r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n return myUtf16EncodingBase.stringFromBytes(dynamicDataView, beginIdx, size);\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n return myUtf16EncodingBase.stringToBytes(dynamicDataView, beginIdx, str);\r\n }\r\n}", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we", "function Utf16LeEncoding()\r\n{\r\n // note: true means little-endian.\r\n var myUtf16EncodingBase = new Utf16EncodingBase(true);\r\n \r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n return myUtf16EncodingBase.stringFromBytes(dynamicDataView, beginIdx, size);\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n return myUtf16EncodingBase.stringToBytes(dynamicDataView, beginIdx, str);\r\n }\r\n}", "function Utf8Encoding()\r\n{\r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n var aResult = \"\";\r\n var aCode;\r\n var i;\r\n var aValue;\r\n for (i = 0; i < size; i++)\r\n {\r\n aValue = dynamicDataView.getUint8(beginIdx + i);\r\n\r\n // If one byte character.\r\n if (aValue <= 0x7f)\r\n {\r\n aResult += String.fromCharCode(aValue);\r\n }\r\n // If mutlibyte character.\r\n else if (aValue >= 0xc0)\r\n {\r\n // 2 bytes.\r\n if (aValue < 0xe0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x1f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 3 bytes.\r\n else if (aValue < 0xf0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x0f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 4 bytes.\r\n else\r\n {\r\n // turned into two characters in JS as surrogate pair\r\n aCode = (((dynamicDataView.getUint8(beginIdx + i++) & 0x07) << 18) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f)) - 0x10000;\r\n // High surrogate\r\n aResult += String.fromCharCode(((aCode & 0xffc00) >>> 10) + 0xd800);\r\n // Low surrogate\r\n aCode = (aCode & 0x3ff) + 0xdc00;\r\n }\r\n aResult += String.fromCharCode(aCode);\r\n } // Otherwise it's an invalid UTF-8, skipped.\r\n }\r\n \r\n return aResult;\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n var aLength = str.length;\r\n var aResultSize = 0;\r\n var aCode;\r\n var i;\r\n for (i = 0; i < aLength; i++)\r\n {\r\n aCode = str.charCodeAt(i);\r\n if (aCode <= 0x7f)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, aCode);\r\n }\r\n // 2 bytes \r\n else if (aCode <= 0x7ff)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xc0 | (aCode >>> 6 & 0x1f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n // 3 bytes\r\n else if (aCode <= 0xd700 || aCode >= 0xe000)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xe0 | (aCode >>> 12 & 0x0f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n else\r\n // 4 bytes, surrogate pair\r\n {\r\n aCode = (((aCode - 0xd800) << 10) | (str.charCodeAt(++i) - 0xdc00)) + 0x10000;\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xf0 | (aCode >>> 18 & 0x07));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 12 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n }\r\n \r\n return aResultSize;\r\n }\r\n}", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n\n return r;\n }\n\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n} // For UTF-16LE we do not explicitly append special replacement characters if we", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function escapeUTF8(data) {\n return data.replace(xmlReplacer, singleCharReplacer);\n}", "function utf16EncodeAsString(codePoint) {\n ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF);\n if (codePoint <= 65535) {\n return String.fromCharCode(codePoint);\n }\n var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800;\n var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00;\n return String.fromCharCode(codeUnit1, codeUnit2);\n }", "function encodeUTF16BE(input) {\n\t var output = '';\n\t\n\t for (var i = 0; i < input.length; i++) {\n\t var c = input.charCodeAt(i);\n\t\n\t if (c < 0xFFFF) {\n\t output += encodeUnit(c);\n\t } else {\n\t var lead = ((c - 0x10000) >> 10) + 0xD800;\n\t var trail = ((c - 0x10000) & 0x3FF) + 0xDC00;\n\t output += encodeUnit(lead);\n\t output += encodeUnit(trail);\n\t }\n\t }\n\t\n\t return output;\n\t}", "function fixChar(str) {\r\n var newStr = \"\";\r\n for (var i = 0; i < str.length; i++) {\r\n var firstChar = str.charCodeAt(i);\r\n if (firstChar === 0x9 || firstChar === 0xA || firstChar === 0xD\r\n || (firstChar >= 0x20 && firstChar <= 0xD7FF)\r\n || (firstChar >= 0xE000 && firstChar <= 0xFFFD)) {\r\n newStr += str[i];\r\n continue;\r\n }\r\n if (i + 1 === str.length) {\r\n newStr += \"\\uFFFD\";\r\n return newStr;\r\n }\r\n // UTF-16 surrogate characters\r\n var secondChar = str.charCodeAt(i + 1);\r\n if ((firstChar >= 0xD800 && firstChar <= 0xDBFF)\r\n && (secondChar >= 0xDC00 && secondChar <= 0xDFFF)) {\r\n newStr += str[i] + str[i + 1];\r\n i++;\r\n continue;\r\n }\r\n newStr += \"\\uFFFD\";\r\n }\r\n return newStr;\r\n}", "function replaceMisEncodedCharacters(data) {\n const replacements = {\n o_: 'ō',\n u_: 'ū',\n '&amp;': '&',\n }\n\n Object.keys(data).map(key => {\n const newData =\n data[key] &&\n data[key].replace &&\n data[key].replace(\n new RegExp(Object.keys(replacements).join('|'), 'g'),\n match => replacements[match]\n )\n\n if (newData) data[key] = newData\n })\n\n return data\n}", "function UTF16Encoding(cp) { // eslint-disable-line no-unused-vars\n\t\t// 1. Assert: 0 ≤ cp ≤ 0x10FFFF.\n\t\t// 2. If cp ≤ 0xFFFF, return cp.\n\t\tif (cp <= 0xFFFF) {\n\t\t\treturn cp;\n\t\t} else {\n\t\t\t// 3. Let cu1 be floor((cp - 0x10000) / 0x400) + 0xD800.\n\t\t\tvar cu1 = Math.floor((cp - 0x10000) / 0x400) + 0xD800;\n\t\t\t// 4. Let cu2 be ((cp - 0x10000) modulo 0x400) + 0xDC00.\n\t\t\tvar cu2 = ((cp - 0x10000) % 0x400) + 0xDC00;\n\t\t\t// 5. Return the code unit sequence consisting of cu1 followed by cu2.\n\t\t\treturn [cu1, cu2];\n\t\t}\n\t}", "function replaceCodePoint(codePoint) {\n var _a;\n if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {\n return 0xfffd;\n }\n return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;\n}", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial", "function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString(\"utf16le\",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString(\"utf16le\",i,buf.length-1)}", "function nullCharacterInForeignContent(p, token) {\r\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\r\n p._insertCharacters(token);\r\n}", "function autoEdUnicodeControlChars(str) { //MAIN FUNCTION describes list of fixes\n \n //Removes unneeded Unicode control characters\n str = str.replace(new RegExp('\\u200E|\\uFEFF|\\u200B', 'gi'), '');\n \n return str;\n}", "function specialreplace(ent, base){\n var chr = \"\";\n var num = parseInt(ent.replace(/[\\&\\#\\;x]/g, ''), base);\n // see [[UTF-16]] for chars outside the BMP\n // try this with Gothic letters at full volume ^_^\n if (num > 0xFFFF) {\n num -= 0x10000;\n chr = String.fromCharCode(0xD800 + (num >> 10), 0xDC00 + (num & 0x3FF)); \n } else {\n chr = String.fromCharCode(num);\n }\n if (dont_replace.indexOf(chr) == -1) {\n str = str.replace(ent, chr, \"gi\");\n }\n }", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "codeMapReplace(str, ignoreRanges = [], opt) {\n let index = 0;\n let result = '';\n const strContainsChinese = opt.fixChineseSpacing && utils_1.hasChinese(str);\n let lastCharHasChinese = false;\n for (let i = 0; i < str.length; i++) {\n // Get current character, taking surrogates in consideration\n const char = /[\\uD800-\\uDBFF]/.test(str[i]) && /[\\uDC00-\\uDFFF]/.test(str[i + 1])\n ? str[i] + str[i + 1]\n : str[i];\n let s;\n let ignoreFixingChinese = false;\n switch (true) {\n // current character is in ignored list\n case utils_1.inRange(index, ignoreRanges):\n // could be UTF-32 with high and low surrogates\n case char.length === 2 && utils_1.inRange(index + 1, ignoreRanges):\n s = char;\n // if it's the first character of an ignored string, then leave ignoreFixingChinese to true\n if (!ignoreRanges.find((range) => range[1] >= index && range[0] === index)) {\n ignoreFixingChinese = true;\n }\n break;\n default:\n s = this.map[char] || opt.unknown || '';\n }\n // fix Chinese spacing issue\n if (strContainsChinese) {\n if (lastCharHasChinese &&\n !ignoreFixingChinese &&\n !utils_1.hasPunctuationOrSpace(s)) {\n s = ' ' + s;\n }\n lastCharHasChinese = !!s && utils_1.hasChinese(char);\n }\n result += s;\n index += char.length;\n // If it's UTF-32 then skip next character\n i += char.length - 1;\n }\n return result;\n }", "function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}", "function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}", "function replaceChars(buffer, enc, next) {\n //Regex expression to replace it into the string\n let text = buffer.toString();\n text = text.replace(/:\\)/gi, 'joy');\n text = text.replace(/:\\(/gi, 'sorrow');\n this.push(text);\n next();\n}", "function utf16End(buf){var r=buf&&buf.length?this.write(buf):\"\";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString(\"utf16le\",0,end)}return r}", "function nullCharacterInForeignContent(p, token) {\n token.chars = UNICODE.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n }", "function utf8Write(view, offset, string) {\n var byteLength = view.byteLength;\n for(var i = 0, l = string.length; i < l; i++) {\n var codePoint = string.charCodeAt(i);\n\n // One byte of UTF-8\n if (codePoint < 0x80) {\n view.setUint8(offset++, codePoint >>> 0 & 0x7f | 0x00);\n continue;\n }\n\n // Two bytes of UTF-8\n if (codePoint < 0x800) {\n view.setUint8(offset++, codePoint >>> 6 & 0x1f | 0xc0);\n view.setUint8(offset++, codePoint >>> 0 & 0x3f | 0x80);\n continue;\n }\n\n // Three bytes of UTF-8.\n if (codePoint < 0x10000) {\n view.setUint8(offset++, codePoint >>> 12 & 0x0f | 0xe0);\n view.setUint8(offset++, codePoint >>> 6 & 0x3f | 0x80);\n view.setUint8(offset++, codePoint >>> 0 & 0x3f | 0x80);\n continue;\n }\n\n // Four bytes of UTF-8\n if (codePoint < 0x110000) {\n view.setUint8(offset++, codePoint >>> 18 & 0x07 | 0xf0);\n view.setUint8(offset++, codePoint >>> 12 & 0x3f | 0x80);\n view.setUint8(offset++, codePoint >>> 6 & 0x3f | 0x80);\n view.setUint8(offset++, codePoint >>> 0 & 0x3f | 0x80);\n continue;\n }\n throw new Error(\"bad codepoint \" + codePoint);\n }\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function characterReplacer(character) {\n // Replace a single character by its escaped version\n var result = escapeReplacements[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function nullCharacterInForeignContent(p, token) {\n token.chars = unicode.REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function vchar() {\n return wrap('vchar', compareToken(function vcharFunc(tok) {\n var code = tok.charCodeAt(0);\n var accept = (0x21 <= code && code <= 0x7E);\n if (opts.rfc6532) {\n accept = accept || isUTF8NonAscii(tok);\n }\n return accept;\n }));\n }", "function escapeString(s) {\n s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s;\n return s;\n function getReplacement(c) {\n return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));\n }\n }", "function r(e){\n // if variant is present as \\uFE0F\n return m(e.indexOf(y)<0?e.replace(b,\"\"):e)}", "function nullCharacterInForeignContent(p, token) {\n token.chars = REPLACEMENT_CHARACTER;\n p._insertCharacters(token);\n}", "function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n }", "function UnescapeSpecialChars(text) {\n\ntext = text.replace(/7f8137798425a7fed2b8c5703b70d078/gm, \"\\\\\")\ntext = text.replace(/833344d5e1432da82ef02e1301477ce8/gm, \"`\")\ntext = text.replace(/3389dae361af79b04c9c8e7057f60cc6/gm, \"*\")\ntext = text.replace(/b14a7b8059d9c055954c92674ce60032/gm, \"_\")\ntext = text.replace(/f95b70fdc3088560732a5ac135644506/gm, \"{\")\ntext = text.replace(/cbb184dd8e05c9709e5dcaedaa0495cf/gm, \"}\")\ntext = text.replace(/815417267f76f6f460a4a61f9db75fdb/gm, \"[\")\ntext = text.replace(/0fbd1776e1ad22c59a7080d35c7fd4db/gm, \"]\")\ntext = text.replace(/84c40473414caf2ed4a7b1283e48bbf4/gm, \"(\")\ntext = text.replace(/9371d7a2e3ae86a00aab4771e39d255d/gm, \")\")\ntext = text.replace(/01abfc750a0c942167651c40d088531d/gm, \"#\")\ntext = text.replace(/5058f1af8388633f609cadb75a75dc9d/gm, \".\")\ntext = text.replace(/9033e0e305f247c0c3c80d0c7848c8b3/gm, \"!\")\ntext = text.replace(/853ae90f0351324bd73ea615e6487517/gm, \":\")\nreturn text;\n}", "parseEscapeUnicodeJSON (idx) {\n const start = idx;\n const len = this.size;\n const uson = this.input;\n\n /* At least four hexadecimal digits must be present */\n if (len - start < 4) {\n return this.parseError (USON.error.unexpectedEnd, len);\n }\n\n /* Get the code point */\n let codep = parseInt (uson.substr (start, 4), 16);\n\n if (Number.isNaN (codep)) {\n return this.parseError (USON.error.escapeUnicode, start);\n }\n\n idx += 4;\n\n /* Check if it's a surrogate */\n if ((codep & 0xF800) === 0xD800) {\n /* Must be a low surrogate */\n if ((codep & 0xFC00) !== 0xDC00) {\n return this.parseError (USON.error.escapeUnicode, start);\n }\n\n /* Get the high surrogate */\n if (len - start < 10) {\n return this.parseError (USON.error.unexpectedEnd, len);\n }\n\n if (uson[4] !== '\\\\' || uson[5] !== 'u') {\n return this.parseError (USON.error.unexpectedToken, start);\n }\n\n idx += 6;\n const high = parseInt (uson.substr (start + 6, 4), 16);\n\n if (Number.isNaN (high)) {\n return this.parseError (USON.error.escapeUnicode, idx);\n }\n\n if ((codep & 0xFC00) !== 0xD800) {\n return this.parseError (USON.error.escapeUnicode, idx);\n }\n\n codep = (((high & 0x3FF) << 10) + 0x10000) | (codep & 0x3FF);\n }\n\n if (codep > 0x10FFFF) {\n return this.parseError (USON.error.escapeUnicode, start);\n }\n\n this.pos = idx;\n\n return String.fromCodePoint (codep);\n}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function utf16End(buf) {\n\t var r = buf && buf.length ? this.write(buf) : '';\n\t if (this.lastNeed) {\n\t var end = this.lastTotal - this.lastNeed;\n\t return r + this.lastChar.toString('utf16le', 0, end);\n\t }\n\t return r;\n\t}", "function f(e,t){// not handling '\\' and handling \\u2028 or \\u2029 to unicode escape sequence\n// not handling '\\' and handling \\u2028 or \\u2029 to unicode escape sequence\nreturn 8232===(-2&e)?(t?\"u\":\"\\\\u\")+(8232===e?\"2028\":\"2029\"):10===e||13===e?(t?\"\":\"\\\\\")+(10===e?\"n\":\"r\"):String.fromCharCode(e)}", "function surprised(){\n vm.input = vm.input.concat(\"😮\");\n }", "function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n }", "function utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n }", "_transform(chunk, encoding, callback) {\n const transformChunk = chunk.toString()\n .replace(/[a-z]|[A-Z]|[0-9]/g, this.replaceChar);\n this.push(transformChunk)\n callback();\n }", "function replaceSpecialChars(value) {\n return value.replace(/[\\&\\:\\(\\)\\[\\\\\\/]/g, ' ').replace(/\\s{2,}/g, ' ').replace(/^\\s/, '').replace(/\\s$/, '').split(' ').join('*');\n }", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}", "function h$encodeUtf16(str) {\n var n = 0;\n var i;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n n += 2;\n } else {\n n += 4;\n }\n }\n var v = h$newByteArray(n+1);\n var dv = v.dv;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n if(c <= 0xFFFF) {\n dv.setUint16(n, c, true);\n n+=2;\n } else {\n var c0 = c - 0x10000;\n dv.setUint16(n, c0 >> 10, true);\n dv.setUint16(n+2, c0 & 0x3FF, true);\n n+=4;\n }\n }\n dv.setUint8(v.len-1,0); // terminator\n return v;\n}" ]
[ "0.61741793", "0.61722815", "0.6166875", "0.6157539", "0.6157539", "0.60805225", "0.6043108", "0.5879082", "0.5879082", "0.5811586", "0.5811586", "0.5811586", "0.5811586", "0.5811586", "0.5811586", "0.5811586", "0.57904005", "0.57904005", "0.5742406", "0.57081676", "0.5700781", "0.5645901", "0.56017774", "0.56002444", "0.55612546", "0.55612546", "0.5554396", "0.5553093", "0.5535687", "0.55250365", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55190897", "0.55135965", "0.54669845", "0.54669845", "0.54463404", "0.5429949", "0.5412851", "0.54116744", "0.5401387", "0.5401387", "0.5401387", "0.5401387", "0.5399889", "0.5399889", "0.5399889", "0.5399889", "0.5374169", "0.5374169", "0.5374169", "0.5374169", "0.53721225", "0.5347226", "0.5330839", "0.5323344", "0.53180164", "0.5307184", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5282802", "0.5277722", "0.52771103", "0.5255128", "0.525485", "0.52253354", "0.5224232", "0.5220051", "0.5220051", "0.5220051", "0.5220051" ]
0.0
-1
Pass bytes on through for singlebyte encodings (e.g. ascii, latin1, hex)
function simpleWrite(buf) { return buf.toString(this.encoding); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return\"�\".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return\"�\".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return\"�\".repeat(p+2)}}}}", "function Utf8Encoding()\r\n{\r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n var aResult = \"\";\r\n var aCode;\r\n var i;\r\n var aValue;\r\n for (i = 0; i < size; i++)\r\n {\r\n aValue = dynamicDataView.getUint8(beginIdx + i);\r\n\r\n // If one byte character.\r\n if (aValue <= 0x7f)\r\n {\r\n aResult += String.fromCharCode(aValue);\r\n }\r\n // If mutlibyte character.\r\n else if (aValue >= 0xc0)\r\n {\r\n // 2 bytes.\r\n if (aValue < 0xe0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x1f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 3 bytes.\r\n else if (aValue < 0xf0)\r\n {\r\n aCode = ((dynamicDataView.getUint8(beginIdx + i++) & 0x0f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f);\r\n }\r\n // 4 bytes.\r\n else\r\n {\r\n // turned into two characters in JS as surrogate pair\r\n aCode = (((dynamicDataView.getUint8(beginIdx + i++) & 0x07) << 18) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 12) |\r\n ((dynamicDataView.getUint8(beginIdx + i++) & 0x3f) << 6) |\r\n (dynamicDataView.getUint8(beginIdx + i) & 0x3f)) - 0x10000;\r\n // High surrogate\r\n aResult += String.fromCharCode(((aCode & 0xffc00) >>> 10) + 0xd800);\r\n // Low surrogate\r\n aCode = (aCode & 0x3ff) + 0xdc00;\r\n }\r\n aResult += String.fromCharCode(aCode);\r\n } // Otherwise it's an invalid UTF-8, skipped.\r\n }\r\n \r\n return aResult;\r\n }\r\n \r\n this.stringToBytes = function(dynamicDataView, beginIdx, str)\r\n {\r\n var aLength = str.length;\r\n var aResultSize = 0;\r\n var aCode;\r\n var i;\r\n for (i = 0; i < aLength; i++)\r\n {\r\n aCode = str.charCodeAt(i);\r\n if (aCode <= 0x7f)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, aCode);\r\n }\r\n // 2 bytes \r\n else if (aCode <= 0x7ff)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xc0 | (aCode >>> 6 & 0x1f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n // 3 bytes\r\n else if (aCode <= 0xd700 || aCode >= 0xe000)\r\n {\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xe0 | (aCode >>> 12 & 0x0f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n else\r\n // 4 bytes, surrogate pair\r\n {\r\n aCode = (((aCode - 0xd800) << 10) | (str.charCodeAt(++i) - 0xdc00)) + 0x10000;\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0xf0 | (aCode >>> 18 & 0x07));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 12 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode >>> 6 & 0x3f));\r\n dynamicDataView.setUint8(beginIdx + aResultSize++, 0x80 | (aCode & 0x3f));\r\n }\r\n }\r\n \r\n return aResultSize;\r\n }\r\n}", "function EncodeUTF8(cb) {\n this.ondata = cb;\n }", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \"\\uFFFD\";\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \"\\uFFFD\";\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n }", "function encodeBytes(input) {\n switch (input.type.typeClass) {\n case \"bytes\":\n return Conversion.toBytes(input.value.asHex);\n case \"string\": {\n let coercedInput = (input);\n switch (coercedInput.value.kind) {\n case \"valid\":\n return stringToBytes(coercedInput.value.asString);\n case \"malformed\":\n return Conversion.toBytes(coercedInput.value.asHex);\n }\n }\n }\n}", "function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}", "function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}", "function strToU8(str, latin1) {\n var l = str.length;\n if (!latin1 && typeof TextEncoder != 'undefined')\n return new TextEncoder().encode(str);\n var ar = new u8(str.length + (str.length >>> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >>> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}", "function encode_utf8(s) {\n\t return encode_latin1(unescape(encodeURIComponent(s)));\n\t }", "function stringToUTF8Bytes(string) {\r\n return new TextEncoder().encode(string);\r\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function h$encodeUtf8(str) {\n var i, low;\n var n = 0;\n for(i=0;i<str.length;i++) {\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n var c = str.charCodeAt(i);\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n if(c <= 0x7F) {\n n++;\n } else if(c <= 0x7FF) {\n n+=2;\n } else if(c <= 0xFFFF) {\n n+=3;\n } else if(c <= 0x1FFFFF) {\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n n+=5;\n } else {\n n+=6;\n }\n }\n var v = h$newByteArray(n+1);\n var u8 = v.u8;\n n = 0;\n for(i=0;i<str.length;i++) {\n var c = str.charCodeAt(i);\n // non-BMP encoded as surrogate pair in JavaScript string, get actual codepoint\n if (0xD800 <= c && c <= 0xDBFF) {\n low = str.charCodeAt(i+1);\n c = ((c - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;\n i++;\n }\n// h$log(\"### encoding char \" + c + \" to UTF-8: \" + String.fromCodePoint(c));\n if(c <= 0x7F) {\n u8[n] = c;\n n++;\n } else if(c <= 0x7FF) {\n u8[n] = (c >> 6) | 0xC0;\n u8[n+1] = (c & 0x3F) | 0x80;\n n+=2;\n } else if(c <= 0xFFFF) {\n u8[n] = (c >> 12) | 0xE0;\n u8[n+1] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+2] = (c & 0x3F) | 0x80;\n n+=3;\n } else if(c <= 0x1FFFFF) {\n u8[n] = (c >> 18) | 0xF0;\n u8[n+1] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+3] = (c & 0x3F) | 0x80;\n n+=4;\n } else if(c <= 0x3FFFFFF) {\n u8[n] = (c >> 24) | 0xF8;\n u8[n+1] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+4] = (c & 0x3F) | 0x80;\n n+=5;\n } else {\n u8[n] = (c >>> 30) | 0xFC;\n u8[n+1] = ((c >> 24) & 0x3F) | 0x80;\n u8[n+2] = ((c >> 18) & 0x3F) | 0x80;\n u8[n+3] = ((c >> 12) & 0x3F) | 0x80;\n u8[n+4] = ((c >> 6) & 0x3F) | 0x80;\n u8[n+5] = (c & 0x3F) | 0x80;\n n+=6;\n }\n }\n u8[v.len-1] = 0; // terminator\n// h$log(\"### encodeUtf8: \" + str);\n// h$log(v);\n return v;\n}", "function encode_utf8(s) {\r\n\treturn unescape(encodeURIComponent(s));\r\n }", "function encodeUTF8(input) {\n\t var output = \"\";\n\t\n\t for (var i = 0; i < input.length; i++) {\n\t var c = input.charCodeAt(i);\n\t\n\t if (c < 0x80) {\n\t // One byte\n\t output += fromCharCode(c);\n\t } else if (c < 0x800) {\n\t // Two bytes\n\t output += fromCharCode(0xC0 | (c >>> 6));\n\t output += fromCharCode(0x80 | (c & 0x3f));\n\t } else if (c < 0x10000) {\n\t // Three bytes\n\t output += fromCharCode(0xE0 | (c >>> 12));\n\t output += fromCharCode(0x80 | (c >>> 6 & 0x3f));\n\t output += fromCharCode(0x80 | (c & 0x3f));\n\t }\n\t }\n\t\n\t return output;\n\t}", "function $lrG1$var$utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n} // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.", "function convertBytesToString ( bytes ) {\n\n var string = [],\n pos = 0,\n c = 0;\n\n while (\n pos < bytes.length\n ) {\n\n var c1 = bytes[pos++];\n\n if (\n c1 < 128\n ) {\n string[c++] = String.fromCharCode(c1);\n } else if (\n c1 > 191 &&\n c1 < 224\n ) {\n\n var c2 = bytes[pos++];\n\n string[c++] = String.fromCharCode(( c1 & 31 ) << 6 | c2 & 63);\n\n } else if (\n c1 > 239 &&\n c1 < 365\n ) {\n\n var c2 = bytes[pos++];\n var c3 = bytes[pos++];\n var c4 = bytes[pos++];\n var u = ( ( c1 & 7 ) << 18 | ( c2 & 63 ) << 12 | ( c3 & 63 ) << 6 | c4 & 63 ) - 0x10000;\n\n string[c++] = String.fromCharCode(0xD800 + ( u >> 10 ));\n string[c++] = String.fromCharCode(0xDC00 + ( u & 1023 ));\n\n } else {\n\n var c2 = bytes[pos++];\n var c3 = bytes[pos++];\n\n string[c++] = String.fromCharCode(( c1 & 15 ) << 12 | ( c2 & 63 ) << 6 | c3 & 63);\n\n };\n\n };\n\n return(string.join(''));\n\n}", "encodeValue(value) {\n return standardEncoding(value);\n }", "function bytesToString(bytes) {\n if (typeof bytes === \"string\") {\n return bytes;\n } else {\n var str = \"\";\n for (var i = 0; i < bytes.length; ++i) {\n str += String.fromCharCode(bytes[i]);\n }\n return str;\n }\n}", "function genUtf8Char1B() {\n var bin = \"0\" + genBitStr(7);\n var hex = bitStrToHexStr(bin);\n try {\n return hexStrToUtf8Str(hex);\n }\n catch (_a) {\n return genUtf8Char1B();\n }\n }", "function toUtf8Bytes(...args) {\n return ethers_1.utils.toUtf8Bytes(...args);\n}", "function encode(string){\n\n}", "function simpleWrite(buf){return buf.toString(this.encoding)}", "toHex(bytes) {\n return Buffer.from(bytes).toString('hex').toUpperCase();\n }", "function bytesToString(aBytes, aCharset) {\n var converter = Cc[\"@mozilla.org/intl/scriptableunicodeconverter\"].\n createInstance(Ci.nsIScriptableUnicodeConverter);\n LOG(\"bytesToString: converting using charset: \" + aCharset);\n\n try {\n converter.charset = aCharset;\n return converter.convertFromByteArray(aBytes, aBytes.length);\n } catch (ex) {}\n\n return null;\n}", "function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!==\"string\"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error(\"Unknown encoding: \"+enc);return nenc||enc}", "function encode_utf8(s) {\n return unescape(encodeURIComponent(s));\n}", "function encodeUtf8$1(input) {\r\n var encoder = \r\n // tslint:disable-next-line\r\n typeof TextEncoder === 'undefined'\r\n ? // @ts-ignore\r\n new (require('util')).TextEncoder('utf-8') // Node.\r\n : new TextEncoder(); // Browser.\r\n // @ts-ignore\r\n return encoder.encode(input);\r\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xc0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xc0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xc0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n }", "_utf8_encode(string) {\r\n string = string.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n for (var n = 0; n < string.length; n++) {\r\n var c = string.charCodeAt(n);\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n } else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n } else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n\r\n }\r\n return utftext;\r\n }", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\uFFFD'.repeat(p);\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\uFFFD'.repeat(p + 1);\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\uFFFD'.repeat(p + 2);\n }\n }\n }\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\uFFFD'.repeat(p);\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\uFFFD'.repeat(p + 1);\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\uFFFD'.repeat(p + 2);\n }\n }\n }\n}", "function encode_utf8(s) {\r\n var i, necessary = false;\r\n\r\n for (i = 0; i < s.length; i++) {\r\n if ((s.charCodeAt(i) == 0x9D) ||\r\n\t \t(s.charCodeAt(i) > 0xFF)) {\r\n necessary = true;\r\n break;\r\n }\r\n }\r\n if (!necessary) {\r\n return s;\r\n }\r\n return String.fromCharCode(0x9D) + unicode_to_utf8(s);\r\n}", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xc0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xc0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xc0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n }", "function utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xc0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xc0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xc0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n }", "function encode_utf8( s )\n{\n \n return unescape( encodeURIComponent( s ) );\n}", "function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }", "function i(t){var n=t;return e.isBuffer(n)||(n=new e(n)),c.default.encode(n)}", "function utf8CheckExtraBytes(self, buf, p) {\n\t if ((buf[0] & 0xC0) !== 0x80) {\n\t self.lastNeed = 0;\n\t return '\\uFFFD'.repeat(p);\n\t }\n\t if (self.lastNeed > 1 && buf.length > 1) {\n\t if ((buf[1] & 0xC0) !== 0x80) {\n\t self.lastNeed = 1;\n\t return '\\uFFFD'.repeat(p + 1);\n\t }\n\t if (self.lastNeed > 2 && buf.length > 2) {\n\t if ((buf[2] & 0xC0) !== 0x80) {\n\t self.lastNeed = 2;\n\t return '\\uFFFD'.repeat(p + 2);\n\t }\n\t }\n\t }\n\t}", "function utf8CheckExtraBytes(self, buf, p) {\n\t if ((buf[0] & 0xC0) !== 0x80) {\n\t self.lastNeed = 0;\n\t return '\\uFFFD'.repeat(p);\n\t }\n\t if (self.lastNeed > 1 && buf.length > 1) {\n\t if ((buf[1] & 0xC0) !== 0x80) {\n\t self.lastNeed = 1;\n\t return '\\uFFFD'.repeat(p + 1);\n\t }\n\t if (self.lastNeed > 2 && buf.length > 2) {\n\t if ((buf[2] & 0xC0) !== 0x80) {\n\t self.lastNeed = 2;\n\t return '\\uFFFD'.repeat(p + 2);\n\t }\n\t }\n\t }\n\t}", "function bytesToString(bytes) {\n var s = '';\n for (var i = 0; i < bytes.length; i += 1) {\n s += String.fromCharCode(bytes[i]);\n }\n\n return s;\n }", "function getEncoding(character) {\n\treturn getBinary(characterValue(character));\n}", "function getEncoding(character) {\n\treturn getBinary(characterValue(character));\n}", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "encodeValue(value) {\n return standardEncoding(value);\n }", "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "apply_blob(blob) { return Base64.encode(blob) }", "function bytesToSring(bytes) {\n const chars = [];\n for (let i = 0, n = bytes.length; i < n;) {\n chars.push(((bytes[i++] & 0xff) << 8) | (bytes[i++] & 0xff));\n }\n return String.fromCharCode.apply(null, chars);\n}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n\t if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n\t return -1;\n\t}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}", "function utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return -1;\n}" ]
[ "0.6349106", "0.6320545", "0.6203621", "0.6178444", "0.6119716", "0.60451204", "0.595599", "0.5950051", "0.59132457", "0.59132457", "0.59132457", "0.5899401", "0.5895261", "0.58929884", "0.5869207", "0.5869207", "0.5869207", "0.5869207", "0.5787332", "0.5768909", "0.57253253", "0.56925786", "0.5678512", "0.5656023", "0.56498724", "0.56480175", "0.5645428", "0.56312037", "0.56287223", "0.5614477", "0.5606269", "0.5600526", "0.5598578", "0.5579557", "0.5570573", "0.55482966", "0.5535769", "0.5535769", "0.5521237", "0.55125076", "0.5506886", "0.54918236", "0.5490248", "0.5472159", "0.5468524", "0.5468524", "0.546781", "0.5466613", "0.5466613", "0.54558194", "0.54558194", "0.54558194", "0.54558194", "0.54558194", "0.54464406", "0.5443601", "0.54382604", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54369205", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716", "0.54280716" ]
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.keys(obj)\n}", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function keys(obj) {\n if (!isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function getKeys(obj){\n return _.keys(obj)\n }", "function keys(obj) {\n return Object.keys(obj);\n}", "getKeys(obj){\n var keys = [];\n for(var key in obj) keys.push(key);\n return keys;\n }", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n /* this function will take an object as an argument, \n * and output an array containg the object keys. The function takes an empty array,\n * then by using the Object.key() method, it will add the keys to the array and return it*/\n var arr = [];\n arr = Object.keys(object);\n return arr;\n // YOUR CODE ABOVE HERE //\n}", "function keysInObject(obj) {\n return Object.keys(obj);\n }", "function objectKeys(obj) {\n\tif (Object.keys) return Object.keys(obj);\n\n\t// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),\n dontEnums = [\n 'toString',\n 'toLocaleString',\n 'valueOf',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ],\n dontEnumsLength = dontEnums.length;\n\n if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n throw new TypeError('Object.keys called on non-object');\n }\n\n var result = [], prop, i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n return result;\n}", "function keys(obj) {\n // Retrieve all the names of the object's properties.\n // Return the keys as strings in an array.\n // Based on http://underscorejs.org/#keys\n return Object.keys(obj);\n}", "function objectKeys(obj) {\n return Object.keys(obj);\n}", "function objectKeys (obj) {\n return Object.keys(obj)\n}", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n //return an array of the object keys\n return Object.keys(object);\n \n \n \n // YOUR CODE ABOVE HERE //\n}", "function typed_keys(o) {\n return Object.keys(o);\n}", "function keys(o) {\n return Object.keys(o);\n}", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function allKeys(obj) {\n if (!isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n }", "function _getKeys(obj) {\n\tvar keys = [];\n\tfor(var key in obj){\n\t keys.push(key);\n\t}\n\treturn keys;\n }", "function useHyperCube_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n \n //create an empty array to hold keys\n var arr = [];\n // use for in loop to retrieve all of the keys in the object\n for(var key in object){\n arr.push(key);\n \n }\n // return Object.keys(object);\nreturn arr;\n \n \n // YOUR CODE ABOVE HERE //\n}", "function QdtPicassoMiniMap_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function _objectKeys(obj) {\r\n if (Array.isArray(obj)) {\r\n var keys = new Array(obj.length);\r\n for (var k = 0; k < keys.length; k++) {\r\n keys[k] = \"\" + k;\r\n }\r\n return keys;\r\n }\r\n if (Object.keys) {\r\n return Object.keys(obj);\r\n }\r\n var keys = [];\r\n for (var i in obj) {\r\n if (obj.hasOwnProperty(i)) {\r\n keys.push(i);\r\n }\r\n }\r\n return keys;\r\n}", "function keys(obj)\n{\n var keys = [];\n for (var key in obj)\n {\n if (obj.hasOwnProperty(key))\n keys.push(key);\n }\n return keys\n}", "function agh_keys(obj) {\n /*?lwiki\n * @fn agh.keys\n * 指定したオブジェクトに含まれる key を配列にして返します。\n * @param[in] obj 非 null のオブジェクトを指定します。\n * @return key を格納した配列を返します。\n */\n var keys = [];\n try { for (var key in obj) keys.push(key); } catch(e) {}\n return keys;\n }", "function objectKeys(obj) {\n if (typeof obj !== 'object') return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n }", "getObjectKeys(obj){\n\t\tlet arr = '';\n\t\tObject.keys(obj).map(function(keyName, keyIndex) {\t\t\t\n\t\t\tarr = obj[keyName]['name'];\n\t\t})\n\t\treturn arr;\n\t}", "function _keys( obj ) {\n\t\tvar result = [];\n\t\tfor( var key in obj )\n\t\t\tresult.push(key);\n\t\treturn result.sort();\n\t}", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n let obj = [];\n for (var key in object) {\n obj.push(key);\n }\n return obj;\n\n \n \n \n \n // YOUR CODE ABOVE HERE //\n}", "function keysFor(obj) {\n var keys = [],\n key;\n\n if (!obj) {\n return keys;\n }\n\n if (Object.keys) {\n return Object.keys(obj);\n }\n\n for (key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n keys.push(key);\n }\n }\n\n return keys;\n}", "function keys(obj){\n\tvar arr = [];\n\tfor(var key in obj){\n\t\tarr.push(key);\n\t}\n\treturn arr;\n}", "function getKeys(obj){\n\tvar keys = [];\n\tfor(var key in obj){\n\t\tkeys.push(key);\n\t}\n\treturn keys;\n}", "function getKeys(obj) {\r\n var keys = [];\r\n for (var key in obj) {\r\n keys.push(key);\r\n\r\n }\r\n return keys;\r\n }", "function keysFor(obj){\n a = []\n for(i in obj)\n a.push(i)\n return a\n}", "function keys(object) {\n var __keys__ = [], prop;\n for (prop in object) __keys__.push(prop);\n return __keys__;\n}", "function getKeys(obj) {\n var keys;\n if(obj.keys) {\n keys = obj.keys();\n } else {\n keys = [];\n\n for(var k in obj) {\n if(Object.prototype.hasOwnProperty.call(obj, k)) {\n keys.push(k);\n }\n }\n }\n\n return keys;\n}", "function objectKeys(object) {\n if (Object.keys) {\n return Object.keys(object);\n }\n var result = [];\n\n angular.forEach(object, function (val, key) {\n result.push(key);\n });\n return result;\n}", "function objectKeys(object) {\n if (Object.keys) {\n return Object.keys(object);\n }\n var result = [];\n\n angular.forEach(object, function (val, key) {\n result.push(key);\n });\n return result;\n}", "function keys(obj) {\r\n if (!types.isObject(obj)) return []; \r\n var keys = [];\r\n for (var key in obj) if (has(obj, key)) keys.push(key);\r\n return keys;\r\n }", "function keys(obj) {\n if (!is_1.isObject(obj))\n return [];\n return Object.keys(obj);\n}", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n\n//creating new variable called 'keys' that is an array literal\nvar keys = [];\n//assigning value to keys variable using Object.keys(), referencing object passed through function\n keys = Object.keys(object);\n//printing array variable keys to console\nreturn keys;\n \n//returns an error but it works in repl.it\n \n // YOUR CODE ABOVE HERE //\n}", "function keys(o){\n var tmp = new Array();\n for (k in o) tmp.push(k);\n return tmp;\n}", "function keys(object)\n{\n var keys = [];\n for (var k in object) {\n keys.push(k);\n }\n return keys;\n}", "function getObjAllKeys(obj) {\n\t if (!isObject(obj) && !isArray(obj)) {\n\t return [];\n\t }\n\t var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'];\n\t var keys = [];\n\t for (var key in obj) {\n\t if (dontEnums.indexOf(key) < 0) {\n\t keys.push(key);\n\t }\n\t }\n\t keys = keys.sort();\n\t return keys;\n\t}", "function getKeys(object) {\n var keys = [];\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n return keys;\n }", "get keys() {}", "function objectKeys(obj) {\n if (typeof obj !== 'object') return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n return keys;\n }", "function keys() {\n return Object.keys(index);\n}", "function keys(o) {\n\tif (typeof o !== \"object\") throw TypeError();\n\tvar result = [];\n\tfor(var prop in o)\n\t{\n\t\tif (o.hasOwnProperty(prop))\n\t\t\tresult.push(prop);\n\t}\n\treturn result;\n}", "function box_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getKeys(obj) {\n var keys = [];\n\n for(var key in obj) {\n if(obj.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n log(keys.join('\\n'));\n return keys;\n}", "function panel_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function keys(object) {\n var output = [];\n for (var key in object) {\n if (hasKey(object, key)) {\n output.push(key);\n }\n }\n return output;\n}", "function components_image_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getKeys(obj) {\n if (util.isArray(obj)) {\n return \"Object is an array\";\n }\n var keys=[];\n for (var k in obj) {\n keys.push(k);\n }\n return keys;\n}", "function card_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function getKeys(object)\n{\n var i = 0;\n var result = \"\";\n for(var key in object)\n {\n\t i++;\n\t if(object.hasOwnProperty(key))\n\t result += key;\n }\n if(i == 0)\n\t return 0;\n else\n\t return result;\n}", "function baseKeys(object) {\n if (!isPrototype(object)) {\n return Object.keys(Object(object))\n }\n var result = []\n for (var key in Object(object)) {\n if (object.hasOwnProperty(key) && key !== 'constructor') {\n result.push(key)\n }\n }\n return result\n}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function objectKeys(obj)\n\t\t{\n\t\t\tif (typeof obj !== 'object')\n\t\t\t\treturn [];\n\t\t\tvar keys = [];\n\t\t\tfor (var key in obj)\n\t\t\t\tkeys.push(key);\n\t\t\treturn keys;\n\t\t}", "function get_keys(arr,add) {\n if (arr instanceof Array) {\n arr.forEach(function(d){\n if (add) d.d3plus = {}\n for (k in d) {\n if (!vars.data.keys[k] && d[k]) {\n vars.data.keys[k] = typeof d[k]\n }\n }\n })\n }\n else {\n for (var d in arr) {\n for (k in arr[d]) {\n if (!vars.data.keys[k] && arr[d][k]) {\n vars.data.keys[k] = typeof arr[d][k]\n }\n }\n }\n }\n }", "function breadcrumb_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function objectKeys(obj)\n\t\t\t{\n\t\t\t\tif (typeof obj !== 'object')\n\t\t\t\t\treturn [];\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var key in obj)\n\t\t\t\t\tkeys.push(key);\n\t\t\t\treturn keys;\n\t\t\t}", "function getPlainObjectKeys(object) {\r\n var enumerables = new Set();\r\n for (var key in object)\r\n enumerables.add(key); // *all* enumerables\r\n Object.getOwnPropertySymbols(object).forEach(function (k) {\r\n if (Object.getOwnPropertyDescriptor(object, k).enumerable)\r\n enumerables.add(k);\r\n }); // *own* symbols\r\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\r\n // as there is no efficient iterator that returns *all* properties\r\n return Array.from(enumerables);\r\n}", "function keys(object) {\r\n let keys = [];\r\n for (let property in object) {\r\n if (object.hasOwnProperty(property)) {\r\n keys.push(property);\r\n }\r\n }\r\n return keys;\r\n}", "function object_keys (fn, data) {\n var res = []\n Object.keys(data).forEach((key) => {\n Object.keys(data[key]).forEach((key2) => {\n var ret = fn(key, key2, data[key][key2])\n if (ret !== undefined) {\n res.push(ret)\n }\n })\n })\n return res\n}", "function getKeys(obj) {\n\t\t\tvar keys = [];\n\n\t\t\tfor (var key in obj) {\n\t\t\t\tif (obj.hasOwnProperty(key)) keys.push(key);\n\n\t\t\t\t// if our value is also an object\n\t\t\t\tif (getSize(obj[key]) > 0) {\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn keys;\n\t\t}", "function list_item_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function allKeys(obj) {\r\n if (!types.isObject(obj)) return [];\r\n var keys = [];\r\n for (var key in obj) keys.push(key);\r\n return keys;\r\n }", "function getObjectKeys(object) {\n // YOUR CODE BELOW HERE //\n \n // create array literal\n var aObj = [];\n // use key in loop in object and access the key\n for(var key in object){\n //use push method to pus keys into an array literal\n aObj.push(key);\n }\n //return an array that holds keys \n return aObj;\n\n // YOUR CODE ABOVE HERE //\n}", "function getPlainObjectKeys(object) {\n var enumerables = new Set();\n for (var key in object)\n enumerables.add(key); // *all* enumerables\n Object.getOwnPropertySymbols(object).forEach(function (k) {\n if (Object.getOwnPropertyDescriptor(object, k).enumerable)\n enumerables.add(k);\n }); // *own* symbols\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\n // as there is no efficient iterator that returns *all* properties\n return Array.from(enumerables);\n}", "function getPlainObjectKeys(object) {\n var enumerables = new Set();\n for (var key in object)\n enumerables.add(key); // *all* enumerables\n Object.getOwnPropertySymbols(object).forEach(function (k) {\n if (Object.getOwnPropertyDescriptor(object, k).enumerable)\n enumerables.add(k);\n }); // *own* symbols\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\n // as there is no efficient iterator that returns *all* properties\n return Array.from(enumerables);\n}", "function dropdown_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "keys( cb ){\n\t\tlet _keys = Object.keys( this.data );\n\t\tif (cb != null) { cb( null, _keys ); }\n\t\treturn _keys;\n\t}", "function getPlainObjectKeys(object) {\n var enumerables = new Set();\n\n for (var key in object) enumerables.add(key); // *all* enumerables\n\n\n Object.getOwnPropertySymbols(object).forEach(function (k) {\n if (Object.getOwnPropertyDescriptor(object, k).enumerable) enumerables.add(k);\n }); // *own* symbols\n // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add,\n // as there is no efficient iterator that returns *all* properties\n\n return Array.from(enumerables);\n}", "function getKeys(getJsonObject){\r\n\t\treturn Object.keys(getJsonObject);\r\n\t}", "function getObjectKeys(object) {\n // create empty array to hold object keys\n let objectArray= [];\n // use for in loop to iterate through object items \n for( var key in object){\n // push only the keys onto the empty array \n objectArray.push(key);\n }\n \n return objectArray; \n \n \n \n // YOUR CODE ABOVE HERE //\n}", "function menu_menu_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }", "function keysToString(object) {\n var anArr = [];\n \nfor (var key in object){\n anArr.push(key);\n}\nreturn anArr.join(' ');\n}" ]
[ "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.6815395", "0.6800585", "0.67974025", "0.6780875", "0.6780875", "0.6780875", "0.6780875", "0.6780875", "0.6780875", "0.6780875", "0.6780875", "0.6780875", "0.6757194", "0.6732225", "0.67203075", "0.67175066", "0.67067367", "0.6703556", "0.6700156", "0.6693695", "0.6692474", "0.66835606", "0.6670905", "0.66395354", "0.6633382", "0.66309404", "0.6628683", "0.6621594", "0.65862703", "0.65796506", "0.6579602", "0.6579602", "0.6573278", "0.65580255", "0.6554473", "0.65544516", "0.65240645", "0.6498737", "0.64926314", "0.6484409", "0.646911", "0.64623094", "0.6453008", "0.64326495", "0.64302504", "0.6403604", "0.6375096", "0.6366456", "0.63611156", "0.6345339", "0.6344586", "0.6336497", "0.6332259", "0.6332259", "0.6332259", "0.6332259", "0.6332259", "0.6332259", "0.6332259", "0.6328209", "0.6323881", "0.6312797", "0.6307692", "0.62924165", "0.62899655", "0.62738186", "0.62696844", "0.62643623", "0.62503743", "0.6240946", "0.6240946", "0.6232643", "0.6226717", "0.6226717", "0.6221915", "0.6207352", "0.6206601", "0.6201159", "0.6190043", "0.61878604" ]
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.prevHash + this.timestamp + JSON.stringify(this.data));\n }", "hash() {\n return ethereumjs_util_1.rlphash(this.raw());\n }", "calculateHash(){ \r\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\r\n }", "calculateHash(){\r\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\r\n }", "hashVal() {\n return utils.hash(this.serialize());\n }", "createHash() {\n return crypto.createHash(sha256);\n }", "function hash() {\n // Create a hash from a list of arguments by joining them\n return [].join.call(arguments); // Method borrowing : borrow the method from array [].join\n}", "calculateHash(){\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\n }", "calculateHash(){\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)+this.nonce).toString();\n }", "calculateHash(){\n\t\treturn SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\n\t}", "function HashTable() {\n\tthis.table = new Array(137);\n\tthis.simpleHash = simpleHash;\n\tthis.betterHash = betterHash ;\n\tthis.showDistro = showDistro;\n\tthis.put = put;\n\tthis.get = get;\n}", "calculateHash(){\n \n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\n\n }", "_hash(r,c) {\n return (15485867 + r) * 15485867 + c;\n }", "calculateHash() {\n return sha256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\n }", "calculateHash(){\n\t\treturn SHA256(this.index + this.previousHash + this.timestamp + this.data + this.nonce).toString();\n\n\t}", "calculateHash() {\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\n }", "calculateHash() {\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.data)).toString();\n }", "calculateHash() {\n return SHA256(this.timestamp + this.vote + this.voter + this.previousHash).toString();\n }", "function makeHash() {\n return Object.create(null)\n}", "function MyHash() {\n this.current = 0;\n this.keys = new Array();\n this.values = {};\n}", "calculateHash(){\n return SHA256(this.id + this.prevHash + this.timestamp + JSON.stringify(this.transactionList)+this.nonce).toString();\n }", "function Hash (data)\n\t{\n\t\t// Auto instantiate the Hash\n\t\tif (!(this instanceof Hash))\n\t\t\treturn new Hash (data);\n\n\t\tthis.result = 0;\n\t\tif (data !== undefined)\n\t\t\tthis.append (data);\n\t}", "calculateHash() {\n return SHA256(this.timestamp + this.previousHash + JSON.stringify(this.data)).toString();\n }", "hashCode() {\n /*\n * We hash every properties except:\n * - localStoragePurposeConsent object since the consentString is enough to know.\n * - ccpaString as it doesn't contribute to the local storage decision.\n */\n const {localStoragePurposeConsent, ccpaString, ...others} = this;\n return cyrb53Hash(JSON.stringify(others));\n }", "_hash(key) {\n // the'underscore' here is a common standard which is to put 'underscore' here and the javascript world which says this is a private property\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n // console.log(hash)\n }\n return hash;\n }", "calculateHash(){\n return SHA256(this.fromAddress + this.toAddress + this.amount).toString();\n }", "_hash(key) {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n }\n return hash;\n }", "_hash(key) {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n }\n return hash;\n }", "exampleHashMethod( key ) {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n }\n return hash;\n }", "_getHash() {\n return getHash(this.location);\n }", "function SaveHash() { }", "_hash(key){\r\n let hash = 0;\r\n for(let i = 0; i<key.length; i++){\r\n hash = (hash + key.charCodeAt(i) * i)%\r\n this.data.length\r\n }\r\n return hash;\r\n }", "_hash(key){\n let hash = 1\n for(let i=0;i<key.length;i++){\n hash = (hash + key.charCodeAt(i) * i) % this.data.length\n }\n return hash\n }", "function OrderedHash() {\n this._init.apply(this, arguments);\n}", "hash(key) {\n if (typeof (key) !== \"string\")\n key = JSON.stringify(key);\n\n var hash = 0;\n if (key.length == 0) return hash;\n for (var i = 0; i < key.length; i++) {\n let c = key.charCodeAt(i);\n hash = ((hash << 5) - hash) + c;\n hash = hash & hash;\n }\n return hash;\n }", "calculateHash(){\n return SHA256(this.previousHash + this.timestamp + JSON.stringify(this.transactions) + this.nonce).toString();\n }", "hash() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return `${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`;\n }", "_hash(key) {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n }\n return hash;\n }", "hashCode() {\n return 0;\n }", "calculateHash() {\r\n return SHA256(this.index + this.previousHash + this.timestamp + JSON.stringify(this.transactions) + this.nonce).toString();\r\n }", "function newHash() {\n if (!xxhash64 && !xxhash32) return require('crypto').createHash('sha1');\n if (xxhash64) return new (require('xxhash').XXHash64)(0xdeadface);\n return new (require('xxhash'))(0xdeadface);\n}", "_hash(key) { //O(1)\n let hash = 0;\n for (let i = 0; i < key.length; i++) {//grab the length of 'grapes' (key)\n hash = (hash + key.charCodeAt(i) * i) % this.data.length;\n //charCodeAt(): returns an integer between 0 & 65535 \n //this.data.length: ensures the size stays between 0-50 (memory space for hash table)\n console.log(hash); // 0 14 8 44 48 23\n }\n return hash;\n }", "calculateHash() {\n return Base64.stringify(HmacSHA256( this.previousHash + this.timesamp + this.data + this.nonce.toString(), this.index.toString()));\n }", "calculateHash(){\n return SHA256(this.previousHash + this.timestamp + JSON.stringify(this.transactions)+this.nonce).toString();\n \n }", "calculateHash(){\n\t\treturn SHA256(this.previousHash + this.timestamp + JSON.stringify(this.transactions) + this.nonce).toString();\n\t}", "_hash(pt) {\n return (15485867 + pt.X) * 15485867 + pt.Y;\n }", "function jsf_def_Hash() {\n this.length = 0;\n this.items = new Array();\n for (var i = 0; i < arguments.length; i += 2) {\n if (typeof (arguments[i + 1]) != 'undefined') {\n this.items[arguments[i]] = arguments[i + 1];\n this.length++;\n }\n }\n\n this.removeItem = function (in_key) {\n var tmp_previous;\n if (typeof (this.items[in_key]) != 'undefined') {\n this.length--;\n var tmp_previous = this.items[in_key];\n delete this.items[in_key];\n }\n\n return tmp_previous;\n }\n\n this.getItem = function (in_key) {\n return this.items[in_key];\n }\n\n this.setItem = function (in_key, in_value) {\n var tmp_previous;\n if (typeof (in_value) != 'undefined') {\n if (typeof (this.items[in_key]) == 'undefined') {\n this.length++;\n }\n else {\n tmp_previous = this.items[in_key];\n }\n\n this.items[in_key] = in_value;\n }\n\n return tmp_previous;\n }\n\n this.hasItem = function (in_key) {\n return typeof (this.items[in_key]) != 'undefined';\n }\n\n this.clear = function () {\n for (var i in this.items) {\n delete this.items[i];\n }\n\n this.length = 0;\n }\n}", "function hashCode() {\n var hash = 0;\n if (this.length == 0) {\n return hash;\n }\n for (var i = 0; i < this.length; i++) {\n var char = this.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash*100000;\n}", "function Zeta$H(obj){\n\treturn new ZetaHash(obj);\n}", "getHashCode() {\n let hash = this.r || 0;\n hash = (hash * 397) ^ (this.g || 0);\n hash = (hash * 397) ^ (this.b || 0);\n hash = (hash * 397) ^ (this.a || 0);\n return hash;\n }", "calculateHash() {\n return SHA256(\n this.fromAddress + this.toAddress + this.amount + this.timestamp\n ).toString();\n }", "_hash(key) {//Generate a hash for us between 0 and length of array - 1\n\t\t//In real life this is soooo fast that its O(1) even tho there is a loop\n\t\tlet hash = 0;\n\t\tfor (let i=0; i < key.length; i++) {\n\t\t\t//charCodeAt(i) gives character code 0-65535 UTF code\n\t\t\thash = (hash + key.charCodeAt(i) * i) % this.data.length;\n\t\t //concat //get utf code //multiply by idx for duplicate characters to get unique\n\t\t //Mod so it fits in the hash size\n\t\t}\n\t\treturn hash;\n\t}", "_hash(key) {\n\t\tif (!key) {\n\t\t\tthrow new Error('cannot prepare hash without key');\n\t\t\treturn undefined;\n\t\t}\n\t\tconst hash = 0;\n\t\tfor (let i = 0; i < key.length; i++) {\n\t\t\thash = (hash + key.charCodeAt(i) * i) % this.data.length;\n\t\t}\n\t\treturn hash;\n\t}", "calculateHash() {\n return SHA256(\n this.fromAddress + \n this.toAddress +\n this.amount +\n this.timestamp\n ).toString()\n }", "function Hash (blockSize, finalSize) {\n\t this._block = Buffer$4.alloc(blockSize);\n\t this._finalSize = finalSize;\n\t this._blockSize = blockSize;\n\t this._len = 0;\n\t}", "hash(key){\n let hashedSum = 0;\n for(let i=0; i<key.length; i++){\n let hashedChar = i*(key[i].charCodeAt());\n hashedSum = hashedSum + hashedChar;\n }\n let primeHash = hashedSum*599;\n\n return primeHash%(this.size);\n }", "function Hash (blockSize, finalSize) {\n\t this._block = Buffer$8.alloc(blockSize);\n\t this._finalSize = finalSize;\n\t this._blockSize = blockSize;\n\t this._len = 0;\n\t}", "hash(input) {\n var hash = crypto.createHash('SHA256').update(input).digest('base64');\n return hash;\n }", "calculateHash() {\n return SHA256(this.fromAddress + this.toAddress + this.amount + this.timestamp).toString();\n }", "function Hash(blockSize,finalSize){this._block=Buffer.alloc(blockSize);this._finalSize=finalSize;this._blockSize=blockSize;this._len=0;}", "_hash(key) {\n let total = 0;\n let WEIRD_PRIME = 31;\n for (let i = 0; i < Math.min(key.length, 100); i++) {\n let value = key[i].charCodeAt(0) - 96;\n total = (total * WEIRD_PRIME + value) % this.keyMap.length;\n }\n return total;\n }", "function chash(obj) {\n\tvar chash = new CHash();\n\tchash.create(obj);\n\treturn chash;\n} // end chash", "function $H(object) {\n return object instanceof Hash ? object : new Hash(object);\n}", "function GenHash(seed) {\n this.seed = seed || 1;\n }", "function HashTable() {\n\n var table = [];\n\n var loseloseHashCode = function(key){\n var hash = 0;\n for (var i = 0; i < key.length; i++){\n hash += key.charCodeAt(i);\n }\n return hash % 37;\n };\n\n this.put = function(key, value){\n var position = loseloseHashCode(key);\n console.log(position + ' - ' + key);\n table[position] = value;\n };\n\n this.remove = function(key){\n table[loseloseHashCode(key)] = undefined\n };\n\n this.get = function(key){\n return table[loseloseHashCode(key)];\n };\n\n}", "function HashTable(table)\n{\n //Based on the model provided by Dan Allen at http://www.mojavelinux.com/articles/javascript_hashes.html\n this.size = 0;\n this.items = {};\n for (var ident in table) {\n if (table.hasOwnProperty(indent)) {\n this.items[indent] = table[ident];\n this.size++;\n }\n }\n\n this.setItem = function(key, value)\n {\n var previous = undefined;\n if (this.hasItem(key)) {\n previous = this.items[key];\n }\n else {\n this.size++;\n }\n this.items[key] = value;\n return previous;\n }\n\n this.getItem = function(key) {\n if(this.hasItem(key))\n\t\treturn this.items[key];\n\telse\n\t\treturn undefined;\n }\n\n this.hasItem = function(key)\n {\n return this.items.hasOwnProperty(key);\n }\n \n this.removeItem = function(key)\n {\n if (this.hasItem(key)) {\n previous = this.items[key];\n this.size--;\n delete this.items[key];\n return previous;\n }\n else {\n return undefined;\n }\n }\n\n this.keys = function()\n {\n var keys = [];\n for (var k in this.items) {\n if (this.hasItem(k)) {\n keys.push(k);\n }\n }\n return keys;\n }\n\n this.values = function()\n {\n var values = [];\n for (var k in this.items) {\n if (this.hasItem(k)) {\n values.push(this.items[k]);\n }\n }\n return values;\n }\n\n this.clear = function()\n {\n this.items = {}\n this.size = 0;\n }\n}", "function Hash (blockSize, finalSize) {\n\t this._block = Buffer.alloc(blockSize)\n\t this._finalSize = finalSize\n\t this._blockSize = blockSize\n\t this._len = 0\n\t}", "function calculateHash(content) {\n this.hash = bar.utils.sha1(content);\n}", "function SHA256() {\n\n}", "function Hash (blockSize, finalSize) {\n\t this._block = new Buffer(blockSize)\n\t this._finalSize = finalSize\n\t this._blockSize = blockSize\n\t this._len = 0\n\t this._s = 0\n\t}", "function Hash (blockSize, finalSize) {\n\t this._block = new Buffer(blockSize)\n\t this._finalSize = finalSize\n\t this._blockSize = blockSize\n\t this._len = 0\n\t this._s = 0\n\t}", "function caml_hash_double(num) { return caml_hash(10,100,0,num); }" ]
[ "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.6939375", "0.69260967", "0.68874353", "0.68874353", "0.687772", "0.6875385", "0.6839995", "0.681806", "0.6812873", "0.6795725", "0.6776457", "0.6765212", "0.6764101", "0.6738015", "0.6738015", "0.673269", "0.6691311", "0.66796565", "0.6676329", "0.6649253", "0.6627977", "0.6625249", "0.66206247", "0.66202486", "0.6620188", "0.661283", "0.66020894", "0.65989184", "0.659224", "0.65903276", "0.6588097", "0.6563591", "0.6561617", "0.6529662", "0.6526406", "0.6514098", "0.64970535", "0.6485035", "0.64836276", "0.64835775", "0.6482081", "0.64707875", "0.6464436", "0.6461787", "0.6440771", "0.64155215", "0.6415287", "0.641023", "0.6402147", "0.6400252", "0.63990414", "0.63877094", "0.63769853", "0.637368", "0.6365655", "0.63640314", "0.63623327", "0.63623327", "0.6361839" ]
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 = cache;\n // proxy to the outer pipe function (recurses)\n return scope.pipe.apply(scope, arguments);\n }\n stream.pipe.cache = cache;\n }\n return stream;\n}", "function SimplePipeStream() {\n\tvar self = this;\n\tself.readable = true;\n\tself.writable = true;\n\tstream.Stream.call(this);\n}", "function HashPipeStream() {\n\tvar self = this;\n\tself.readable = true;\n\tself.writable = true;\n\tstream.Stream.call(this);\n}", "function pipeStream() {\n var args = _.toArray(arguments);\n var src = args.shift();\n\n return new Promise(function(resolve, reject) {\n var stream = src;\n var target;\n\n while ((target = args.shift()) != null) {\n stream = stream.pipe(target).on('error', reject);\n }\n\n stream.on('finish', resolve);\n stream.on('end', resolve);\n stream.on('close', resolve);\n });\n}", "function OpStream() {\n Readable.call(this, {objectMode: true});\n this.id = null;\n this.open = true;\n}", "function StreamLikeSequence() {}", "function AsyncPipeStream() {\n\tvar self = this;\n\tself.readable = true;\n\tself.writable = true;\n\tstream.Stream.call(this);\n}", "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);}}", "getReadableStream() {\n return new BuffersStream(this.buffers, this.size);\n }", "getReadableStream() {\n return new BuffersStream(this.buffers, this.size);\n }", "function emitReadable(stream){var state=stream._readableState;debug('emitReadable',state.needReadable,state.emittedReadable);state.needReadable=false;if(!state.emittedReadable){debug('emitReadable',state.flowing);state.emittedReadable=true;process.nextTick(emitReadable_,stream);}}", "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 pipe(fs) {\n return function(x) {\n return reduce (T) (x) (fs);\n };\n }", "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._readableState;state.needReadable=false;if(!state.emittedReadable){debug('emitReadable',state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream);}}", "function pipeNext() {\n _this.streaming = true;\n closeCurrent();\n if (_this.index + 1 < _this.sources.length) {\n // Send new stream.\n _this.index += 1;\n const stream = _this.sources[_this.index];\n stream.on(\"end\", pipeNext);\n stream.pipe(_this.target, {\"end\": false});\n _this.currentClosed = false;\n } else {\n // Nothing more to stream.\n if (_this.closeOnEnd) {\n _this.target.end();\n } else {\n }\n // Wait for next stream.\n _this.streaming = false;\n }\n }", "function StreamCombiner(stream) {\n\n // Wrapped stream.\n this.target = stream;\n\n // Input streams to combine.\n this.sources = [];\n\n // Index of currently streaming stream.\n this.index = -1;\n\n // If true then close once there are no streams.\n this.closeOnEnd = false;\n\n this.streaming = false;\n\n // If true stream on this.index ended and was closed.\n this.currentClosed = false;\n\n const _this = this;\n\n // Append given stream to the wrapped stream.\n this.append = function (stream) {\n _this.sources.push(stream);\n if (!_this.streaming) {\n pipeNext();\n }\n };\n\n this.end = function () {\n // Close after the last stream is processed.\n _this.closeOnEnd = true;\n if (!_this.streaming) {\n pipeNext();\n }\n };\n\n // Look for next stream and pipe it.\n function pipeNext() {\n _this.streaming = true;\n closeCurrent();\n if (_this.index + 1 < _this.sources.length) {\n // Send new stream.\n _this.index += 1;\n const stream = _this.sources[_this.index];\n stream.on(\"end\", pipeNext);\n stream.pipe(_this.target, {\"end\": false});\n _this.currentClosed = false;\n } else {\n // Nothing more to stream.\n if (_this.closeOnEnd) {\n _this.target.end();\n } else {\n }\n // Wait for next stream.\n _this.streaming = false;\n }\n }\n\n function closeCurrent() {\n if (_this.index > -1 && !_this.currentClosed) {\n // Close stream under this.index.\n const oldStream = _this.sources[_this.index];\n oldStream.unpipe(_this.target);\n _this.currentClosed = true;\n }\n }\n\n}", "function Stream() {\n EventEmitter.call(this);\n}", "function Stream() {\n EventEmitter.call(this);\n}", "function CollectStream() {\n stream.Transform.call(this);\n this._chunks = [];\n this._transform = (chunk, enc, cb) => { this._chunks.push(chunk); cb(); }\n this.collect = () => { return Buffer.concat(this._chunks); this._chunks = []; }\n}", "function Stream() {\n EventEmitter.call(this);\n }", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function emitReadable$2(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug$2('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) processNextickArgs.nextTick(emitReadable_$2, stream);else emitReadable_$2(stream);\n\t }\n\t}", "function streamFromBody(body) {\n return new stream.Readable({\n read() {\n this.push(body);\n this.push(null);\n },\n });\n}", "function through (write, end) {\n write = write || function (data) { this.emit('data', data) }\n end = end || function () { this.emit('end') }\n\n var ended = false, destroyed = false\n var stream = new Stream(), buffer = []\n stream.buffer = buffer\n stream.readable = stream.writable = true\n stream.paused = false\n stream.write = function (data) {\n write.call(this, data)\n return !stream.paused\n }\n\n function drain() {\n while(buffer.length && !stream.paused) {\n var data = buffer.shift()\n if(null === data)\n return stream.emit('end')\n else\n stream.emit('data', data)\n }\n }\n\n stream.queue = function (data) {\n buffer.push(data)\n drain()\n }\n\n //this will be registered as the first 'end' listener\n //must call destroy next tick, to make sure we're after any\n //stream piped from here.\n //this is only a problem if end is not emitted synchronously.\n //a nicer way to do this is to make sure this is the last listener for 'end'\n\n stream.on('end', function () {\n stream.readable = false\n if(!stream.writable)\n process.nextTick(function () {\n stream.destroy()\n })\n })\n\n function _end () {\n stream.writable = false\n end.call(stream)\n if(!stream.readable)\n stream.destroy()\n }\n\n stream.end = function (data) {\n if(ended) return\n ended = true\n if(arguments.length) stream.write(data)\n _end() // will emit or queue\n }\n\n stream.destroy = function () {\n if(destroyed) return\n destroyed = true\n ended = true\n buffer.length = 0\n stream.writable = stream.readable = false\n stream.emit('close')\n }\n\n stream.pause = function () {\n if(stream.paused) return\n stream.paused = true\n stream.emit('pause')\n }\n stream.resume = function () {\n if(stream.paused) {\n stream.paused = false\n }\n drain()\n //may have become paused again,\n //as drain emits 'data'.\n if(!stream.paused)\n stream.emit('drain')\n }\n return stream\n}", "function $SYhk$var$emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n $SYhk$var$debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) $SYhk$var$pna.nextTick($SYhk$var$emitReadable_, stream);else $SYhk$var$emitReadable_(stream);\n }\n}", "function Stream() {\n EventEmitter.call(this);\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) processNextTick(emitReadable_, stream);\n else emitReadable_(stream);\n }\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n }", "function isReadableStream(val) {\n return val && (typeof val.pipe == \"function\")\n && (typeof val.on== \"function\");\n}", "_is_readable_stream(obj) {\n if (!obj || typeof obj !== 'object') return false;\n return typeof obj.pipe === 'function' && typeof obj._readableState === 'object';\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync)\n processNextTick(emitReadable_, stream);\n else\n emitReadable_(stream);\n }\n }", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n }", "function through (write, end) {\n write = write || function (data) { this.queue(data) }\n end = end || function () { this.queue(null) }\n\n var ended = false, destroyed = false, buffer = []\n var stream = new Stream()\n stream.readable = stream.writable = true\n stream.paused = false\n\n stream.write = function (data) {\n write.call(this, data)\n return !stream.paused\n }\n\n function drain() {\n while(buffer.length && !stream.paused) {\n var data = buffer.shift()\n if(null === data)\n return stream.emit('end')\n else\n stream.emit('data', data)\n }\n }\n\n stream.queue = stream.push = function (data) {\n buffer.push(data)\n drain()\n return stream\n }\n\n //this will be registered as the first 'end' listener\n //must call destroy next tick, to make sure we're after any\n //stream piped from here.\n //this is only a problem if end is not emitted synchronously.\n //a nicer way to do this is to make sure this is the last listener for 'end'\n\n stream.on('end', function () {\n stream.readable = false\n if(!stream.writable)\n process.nextTick(function () {\n stream.destroy()\n })\n })\n\n function _end () {\n stream.writable = false\n end.call(stream)\n if(!stream.readable)\n stream.destroy()\n }\n\n stream.end = function (data) {\n if(ended) return\n ended = true\n if(arguments.length) stream.write(data)\n _end() // will emit or queue\n return stream\n }\n\n stream.destroy = function () {\n if(destroyed) return\n destroyed = true\n ended = true\n buffer.length = 0\n stream.writable = stream.readable = false\n stream.emit('close')\n return stream\n }\n\n stream.pause = function () {\n if(stream.paused) return\n stream.paused = true\n stream.emit('pause')\n return stream\n }\n stream.resume = function () {\n if(stream.paused) {\n stream.paused = false\n }\n drain()\n //may have become paused again,\n //as drain emits 'data'.\n if(!stream.paused)\n stream.emit('drain')\n return stream\n }\n return stream\n}", "function through (write, end) {\n write = write || function (data) { this.queue(data) }\n end = end || function () { this.queue(null) }\n\n var ended = false, destroyed = false, buffer = []\n var stream = new Stream()\n stream.readable = stream.writable = true\n stream.paused = false\n\n stream.write = function (data) {\n write.call(this, data)\n return !stream.paused\n }\n\n function drain() {\n while(buffer.length && !stream.paused) {\n var data = buffer.shift()\n if(null === data)\n return stream.emit('end')\n else\n stream.emit('data', data)\n }\n }\n\n stream.queue = stream.push = function (data) {\n buffer.push(data)\n drain()\n return stream\n }\n\n //this will be registered as the first 'end' listener\n //must call destroy next tick, to make sure we're after any\n //stream piped from here.\n //this is only a problem if end is not emitted synchronously.\n //a nicer way to do this is to make sure this is the last listener for 'end'\n\n stream.on('end', function () {\n stream.readable = false\n if(!stream.writable)\n process.nextTick(function () {\n stream.destroy()\n })\n })\n\n function _end () {\n stream.writable = false\n end.call(stream)\n if(!stream.readable)\n stream.destroy()\n }\n\n stream.end = function (data) {\n if(ended) return\n ended = true\n if(arguments.length) stream.write(data)\n _end() // will emit or queue\n return stream\n }\n\n stream.destroy = function () {\n if(destroyed) return\n destroyed = true\n ended = true\n buffer.length = 0\n stream.writable = stream.readable = false\n stream.emit('close')\n return stream\n }\n\n stream.pause = function () {\n if(stream.paused) return\n stream.paused = true\n stream.emit('pause')\n return stream\n }\n stream.resume = function () {\n if(stream.paused) {\n stream.paused = false\n }\n drain()\n //may have become paused again,\n //as drain emits 'data'.\n if(!stream.paused)\n stream.emit('drain')\n return stream\n }\n return stream\n}", "function through (write, end) {\n write = write || function (data) { this.queue(data) }\n end = end || function () { this.queue(null) }\n\n var ended = false, destroyed = false, buffer = []\n var stream = new Stream()\n stream.readable = stream.writable = true\n stream.paused = false\n\n stream.write = function (data) {\n write.call(this, data)\n return !stream.paused\n }\n\n function drain() {\n while(buffer.length && !stream.paused) {\n var data = buffer.shift()\n if(null === data)\n return stream.emit('end')\n else\n stream.emit('data', data)\n }\n }\n\n stream.queue = stream.push = function (data) {\n buffer.push(data)\n drain()\n return stream\n }\n\n //this will be registered as the first 'end' listener\n //must call destroy next tick, to make sure we're after any\n //stream piped from here.\n //this is only a problem if end is not emitted synchronously.\n //a nicer way to do this is to make sure this is the last listener for 'end'\n\n stream.on('end', function () {\n stream.readable = false\n if(!stream.writable)\n process.nextTick(function () {\n stream.destroy()\n })\n })\n\n function _end () {\n stream.writable = false\n end.call(stream)\n if(!stream.readable)\n stream.destroy()\n }\n\n stream.end = function (data) {\n if(ended) return\n ended = true\n if(arguments.length) stream.write(data)\n _end() // will emit or queue\n return stream\n }\n\n stream.destroy = function () {\n if(destroyed) return\n destroyed = true\n ended = true\n buffer.length = 0\n stream.writable = stream.readable = false\n stream.emit('close')\n return stream\n }\n\n stream.pause = function () {\n if(stream.paused) return\n stream.paused = true\n stream.emit('pause')\n return stream\n }\n stream.resume = function () {\n if(stream.paused) {\n stream.paused = false\n }\n drain()\n //may have become paused again,\n //as drain emits 'data'.\n if(!stream.paused)\n stream.emit('drain')\n return stream\n }\n return stream\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function Stream() {\n this.head = new Chunk(this);\n }", "function emitReadable(stream) {\r\n var state = stream._readableState;\r\n state.needReadable = false;\r\n if (!state.emittedReadable) {\r\n debug('emitReadable', state.flowing);\r\n state.emittedReadable = true;\r\n if (state.sync)\r\n process.nextTick(emitReadable_, stream);\r\n else\r\n emitReadable_(stream);\r\n }\r\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}", "function emitReadable(stream) {\n\t var state = stream._readableState;\n\t state.needReadable = false;\n\t if (!state.emittedReadable) {\n\t debug('emitReadable', state.flowing);\n\t state.emittedReadable = true;\n\t if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n\t }\n\t}" ]
[ "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.60342103", "0.60342103", "0.60342103", "0.60342103", "0.60342103", "0.5980195", "0.59216475", "0.5921494", "0.5870447", "0.5860338", "0.58583355", "0.585715", "0.5855108", "0.5851708", "0.5841389", "0.58346605", "0.5834078", "0.5834078", "0.5834078", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.58092916", "0.5807968", "0.57970077", "0.5784001", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.5774756", "0.57721007", "0.57721007" ]
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(\"error\",onerror);if(EElistenerCount(dest,\"error\")===0)dest.emit(\"error\",er)}", "function onerror(er) {\n\t cleanup();\n\t if (this.listeners('error').length === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EventEmitter.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EventEmitter.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EventEmitter.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EventEmitter.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EventEmitter.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n cleanup();\n if (!this.hasListeners('error')) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (!this.hasListeners('error')) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n\t unpipe();\n\t dest.removeListener('error', onerror);\n\t if (EE.listenerCount(dest, 'error') === 0)\n\t dest.emit('error', er);\n\t }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0) dest.emit('error', er);\n }", "function onerror(er) {\n cleanup();\n if (EventEmitter.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function maybePipeManually() {\n var chunk\n while ((chunk = writer.read())) {\n if (!conn.write(chunk)) {\n break\n }\n }\n }", "function onerror(er) {\n cleanup();\n if (EventEmitter.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n unpipe();\n dest.removeListener('error', onerror);\n if (EE.listenerCount(dest, 'error') === 0)\n dest.emit('error', er);\n }", "function onerror(er) {\n cleanup();\n if (EventEmitter.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (EventEmitter.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (EventEmitter.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (EventEmitter.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er){debug('onerror',er);unpipe();dest.removeListener('error',onerror);if(EElistenerCount(dest,'error')===0)dest.emit('error',er);}// Make sure our error handler is attached before userland ones.", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n\t cleanup();\n\t if (EE.listenerCount(this, 'error') === 0) {\n\t throw er; // Unhandled stream error in pipe.\n\t }\n\t }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (this.listeners('error').length === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }", "function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }" ]
[ "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.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.62146306", "0.6212333", "0.6212333", "0.6212333", "0.6212333", "0.6202309", "0.6202309", "0.6202309", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.6196249", "0.61765504", "0.61765504", "0.61765504", "0.61765504", "0.61765504", "0.61765504", "0.61765504", "0.61765504", "0.61765504", "0.6047003" ]
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', cleanup); source.removeListener('close', cleanup); dest.removeListener('close', cleanup); }
{ "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 listener of this._listeners) {\n listener.remove();\n }\n this._listeners = [];\n }", "_clearListeners() {\n for (const listener of this._listeners) {\n listener.remove();\n }\n this._listeners = [];\n }", "function clearEvents() {\n\t\t\tvar ident;\n\t\t\tfor (ident in listenersByEventId) {\n\t\t\t\tr.removeListener(ident);\n\t\t\t}\n\t\t}", "removeAllEventListeners() {\n this.eventListeners.forEach(({ target, type, boundListener }) => {\n this.log(`Removing \"${type}\" eventlistener`, target);\n target.removeEventListener(type, boundListener);\n });\n this.eventListeners.length = 0;\n }", "removeAllEventListeners() {\n this.eventListeners.forEach(({target, type, boundListener}) => {\n this.log(`Removing \"${type}\" eventlistener`, target);\n target.removeEventListener(type, boundListener);\n });\n this.eventListeners.length = 0;\n }", "removeAllListeners() {\n\t\tfor (let i = 0; i < this.eventHandles_.length; i++) {\n\t\t\tthis.eventHandles_[i].removeListener();\n\t\t}\n\n\t\tthis.eventHandles_ = [];\n\t}", "removeAllListeners() {\n const me = this,\n listeners = me.eventListeners || (me.eventListeners = {});\n\n for (let event in listeners) {\n listeners[event].forEach((cfg) => me.removeListener(event, cfg));\n }\n }", "removeAllListeners() {\n this.listeners = {};\n }", "removeAllListeners() {\n this._onOpen.removeAllListeners();\n this._onMessage.removeAllListeners();\n this._onUnpackedMessage.removeAllListeners();\n this._onResponse.removeAllListeners();\n this._onSend.removeAllListeners();\n this._onClose.removeAllListeners();\n this._onError.removeAllListeners();\n }", "removeAll() {\n this.listeners.forEach(listener => listener.destroy());\n this.listeners = [];\n }", "_removeEventListeners() {\n this.currentEventListeners.forEach(listener => {\n this.domElement.removeEventListener(listener.event, listener.callBack);\n });\n this.currentEventListeners = null;\n }", "removeAllListeners() {\n const listeners = this.eventListeners;\n let i, thisObj;\n\n for (const event in listeners) {\n const bucket = listeners[event]; // We iterate backwards since we call removeListener which will splice out of\n // this array as we go...\n\n for (i = bucket.length; i-- > 0;)\n /* empty */\n {\n const cfg = bucket[i];\n this.removeListener(event, cfg);\n thisObj = cfg.thisObj;\n\n if (thisObj && thisObj.untrackDetachers) {\n thisObj.untrackDetachers(this);\n }\n }\n }\n }", "removeEventListeners() {\n\t\twindow.removeEventListener('resize', this.bindResize);\n\t\tthis.domElement.removeEventListener('click', this.bindClick);\n\t\tTweenMax.ticker.removeEventListener('tick', this.bindRender);\n\t\tEmitter.off('LOADING_COMPLETE', this.bindEnter);\n\t\twindow.removeEventListener('mousemove', this.boundMouseMove);\n\t}", "removeListeners() {\n var descriptor = this.getDescriptor();\n if (descriptor) {\n descriptor.unlisten(DescriptorEventType.ACTIVATED, this.onActivated, false, this);\n descriptor.unlisten(DescriptorEventType.DEACTIVATED, this.onDeactivated, false, this);\n descriptor.unlisten(DescriptorEventType.DEACTIVATED, this.onActivationError, false, this);\n }\n }", "function removeListeners() {\n\t\t$(document).off(EVENT_NAME_KEYPRESS);\n\t\t$(document).off(EVENT_NAME_KEYUP);\n\t}", "_removeListeners() {\n document.removeEventListener('click', this._handleWindowClick);\n window.removeEventListener('resize', this._handleResize);\n this.el.removeEventListener('keydown', this._handleKeyDown);\n document.removeEventListener('blur', this._handleBlur, true);\n document.removeEventListener('focus', this._handleFocus, true);\n document.removeEventListener('spark.visible-children', this._handleVisibleChildren, true);\n }", "removeAllEventListeners () {\n this.eventListeners = [];\n }", "removeAllListeners() {\n this.click = [];\n this.drag = [];\n this.dragStart = [];\n this.dragEnd = [];\n }", "cleanUpEvents() {\n for (let idx in this.eventsToClean) {\n this.eventsToClean[idx].removeCleanupListeners();\n }\n }", "detachListeners () {\n if (this.listenersAttached) {\n window.removeEventListener('resize', this.handleWindowResize)\n window.removeEventListener('mouseup', this.handleMouseUp)\n window.removeEventListener('touchend', this.handleTouchEnd)\n window.removeEventListener('touchcancel', this.handleTouchEnd)\n window.removeEventListener('pointerdown', this.handlePointerEvent)\n window.removeEventListener('pointermove', this.handlePointerEvent)\n window.removeEventListener('pointerup', this.handlePointerEvent)\n window.removeEventListener('pointercancel', this.handlePointerEvent)\n this.listenersAttached = false\n }\n }", "_removeListeners() {\n try {\n WINDOW$1.document.removeEventListener('visibilitychange', this._handleVisibilityChange);\n\n WINDOW$1.removeEventListener('blur', this._handleWindowBlur);\n WINDOW$1.removeEventListener('focus', this._handleWindowFocus);\n\n restoreRecordDroppedEvent();\n\n if (this._performanceObserver) {\n this._performanceObserver.disconnect();\n this._performanceObserver = null;\n }\n } catch (err) {\n this._handleException(err);\n }\n }", "removeEventListeners() {\n this.elementListener.removeEventListener(\"mouseenter\", this.onMouseEnterBind);\n this.elementListener.removeEventListener(\"mouseleave\", this.onMouseLeaveBind);\n this.elementListener.removeEventListener(\"mousemove\", this.onMouseMoveBind);\n\n if (this.gyroscope) {\n window.removeEventListener(\"deviceorientation\", this.onDeviceOrientationBind);\n }\n\n if (this.glare || this.fullPageListening) {\n window.removeEventListener(\"resize\", this.onWindowResizeBind);\n }\n }", "function removeListeners() {\n debug(\"removeListeners\");\n cards().forEach(function(card) {\n card.removeEventListener('click', cardMagic)\n })\n }", "function removeListeners() {\n\t\t\t$element.unbind(START_EV, touchStart);\n\t\t\t$element.unbind(CANCEL_EV, touchCancel);\n\t\t\t$element.unbind(MOVE_EV, touchMove);\n\t\t\t$element.unbind(END_EV, touchEnd);\n\n\t\t\t//we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n\t\t\tif(LEAVE_EV) {\n\t\t\t\t$element.unbind(LEAVE_EV, touchLeave);\n\t\t\t}\n\n\t\t\tsetTouchInProgress(false);\n\t\t}", "function clearListeners(event) {\n if(event) {\n delete listeners[event];\n } else {\n listeners = {};\n }\n }", "function removeListeners() {\n\t\t\t$element.unbind(START_EV, touchStart);\n\t\t\t$element.unbind(CANCEL_EV, touchCancel);\n\t\t\t$element.unbind(MOVE_EV, touchMove);\n\t\t\t$element.unbind(END_EV, touchEnd);\n\t\t\t\n\t\t\t//we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n\t\t\tif(LEAVE_EV) { \n\t\t\t\t$element.unbind(LEAVE_EV, touchLeave);\n\t\t\t}\n\t\t\t\n\t\t\tsetTouchInProgress(false);\n\t\t}", "function removeListeners() {\n\t\t\t$element.unbind(START_EV, touchStart);\n\t\t\t$element.unbind(CANCEL_EV, touchCancel);\n\t\t\t$element.unbind(MOVE_EV, touchMove);\n\t\t\t$element.unbind(END_EV, touchEnd);\n\t\t\t\n\t\t\t//we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n\t\t\tif(LEAVE_EV) { \n\t\t\t\t$element.unbind(LEAVE_EV, touchLeave);\n\t\t\t}\n\t\t\t\n\t\t\tsetTouchInProgress(false);\n\t\t}", "function removeAddedEvents() {\n // remove added native events\n nativeEvents.forEach(function (_ref) {\n var key = _ref.key,\n listener = _ref.listener;\n element.removeEventListener(key, listener);\n });\n nativeEvents = [];\n }", "removeAll()\n {\n this.listeners.length = 0;\n this.errorListeners.length = 0;\n this.validateListeners.length = 0;\n this.createListeners.length = 0;\n this.submitListeners.length = 0;\n }", "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n \n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if(LEAVE_EV) { \n $element.unbind(LEAVE_EV, touchLeave);\n }\n \n setTouchInProgress(false);\n }", "undelegateEvents() {\n this.delegatedEventListeners.forEach(({ type, listener }) => {\n this.el.removeEventListener(type, listener);\n });\n\n this.delegatedEventListeners = [];\n }", "removeAllListeners (eventName) {\n // perform default behavior, preserve fn arity\n if (eventName) {\n super.removeAllListeners(eventName)\n } else {\n super.removeAllListeners()\n }\n // re-add internal events\n this._setupInternalEvents()\n // trigger stop check just in case\n this._onRemoveListener()\n }", "function _clearListeners(arr) {\n if (arr == null || arr._parent == null) {\n return;\n }\n\n for (const key in arr._handlers) {\n arr._parent.removeListener(key, arr._handlers[key]);\n }\n}", "function removeListeners() {\n $element.unbind(START_EV, touchStart);\n $element.unbind(CANCEL_EV, touchCancel);\n $element.unbind(MOVE_EV, touchMove);\n $element.unbind(END_EV, touchEnd);\n\n //we only have leave events on desktop, we manually calculate leave on touch as its not supported in webkit\n if (LEAVE_EV) {\n $element.unbind(LEAVE_EV, touchLeave);\n }\n\n setTouchInProgress(false);\n }", "removeListeners()\n {\n this.cancel.removeEventListener('click', this.destroy);\n }", "removeListeners() {\n const client = MatrixClientPeg.get();\n if (client === null) return;\n\n client.removeListener('sync', this.onSync);\n client.removeListener('Room.timeline', this.onRoomTimeline);\n client.removeListener('Event.decrypted', this.onEventDecrypted);\n client.removeListener('Room.timelineReset', this.onTimelineReset);\n client.removeListener('Room.redaction', this.onRedaction);\n }", "function detachEvents() {\n if (browser.addEventListener) {\n // remove current event listeners\n element.removeEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false);\n element.removeEventListener('mousedown', events, false);\n element.removeEventListener('webkitTransitionEnd', events, false);\n element.removeEventListener('msTransitionEnd', events, false);\n element.removeEventListener('oTransitionEnd', events, false);\n element.removeEventListener('otransitionend', events, false);\n element.removeEventListener('transitionend', events, false);\n root.removeEventListener('resize', events, false);\n } else {\n root.onresize = null;\n }\n }", "destroy() {\n let i;\n for (let type in this._listeners) {\n let arr = this._listeners[type];\n for (i = 0; i < arr.length; i += 1) {\n arr[i] = null;\n }\n }\n }", "unbindEvents() {\n this.toggleListeners.forEach(toggleListener => toggleListener.destroy());\n this.openListeners.forEach(openListener => openListener.destroy());\n this.closeListeners.forEach(closeListener => closeListener.destroy());\n this.radioOpenListeners.forEach(radioOpenListener => radioOpenListener.destroy());\n this.radioCloseListeners.forEach(radioCloseListener => radioCloseListener.destroy());\n this.inputOpenListeners.forEach(inputOpenListener => inputOpenListener.destroy());\n }", "removeEventListeners() {\n this.leafletMap.removeEventListener('click', (event) => {\n this.clickLeafletMap(event);\n })\n this.leafletMap.removeEventListener('mousemove', (event) => {\n this.onMouseMove(event);\n });\n this.leafletMap.removeEventListener('keydown', (event) => {\n this.onKeyPress(event.originalEvent);\n });\n this.leafletMap.removeEventListener('mouseover', (event) => {\n this.onMouseOverLeaflet(event)\n });\n this.leafletMap.removeEventListener('mouseout', (event) => {\n this.onMouseOutLeaflet(event)\n });\n }", "function clearRemainingListeners() {\n observerTestState.toBeEnabled.forEach(function(feature) {\n chrome.accessibilityFeatures[feature.name].onChange.removeListener(\n feature.listener);\n feature.listener = null;\n });\n observerTestState.toBeDisabled.forEach(function(feature) {\n chrome.accessibilityFeatures[feature.name].onChange.removeListener(\n feature.listener);\n feature.listener = null;\n });\n }", "removeEventListeners() {\r\n this.elementListener.removeEventListener(\"mouseenter\", this.onMouseEnterBind);\r\n this.elementListener.removeEventListener(\"mouseleave\", this.onMouseLeaveBind);\r\n this.elementListener.removeEventListener(\"mousemove\", this.onMouseMoveBind);\r\n \r\n if (this.gyroscope) {\r\n window.removeEventListener(\"deviceorientation\", this.onDeviceOrientationBind);\r\n }\r\n \r\n if (this.glare || this.fullPageListening) {\r\n window.removeEventListener(\"resize\", this.onWindowResizeBind);\r\n }\r\n }", "function removeButtonListeners() {\n if (buttons.fw) {\n buttons.fw.removeEventListener('click', handleForwardButtonClick);\n }\n if (buttons.bk) {\n buttons.bk.removeEventListener('click', handleBackwardButtonClick);\n }\n }", "__removeBroadcastEventListeners() {\n let bindEvents = this._bindBroadcastEvents;\n /* istanbul ignore next */\n if (!bindEvents) {\n return;\n }\n\n bindEvents.forEach(item => eventCenter.off(item[0], item[1]));\n this._bindBroadcastEvents = [];\n }", "_removeEventListeners() {\n this.el.removeEventListener('click', this._onClickBound);\n this.el.removeEventListener('keydown', this._onKeydownBound);\n }", "function removeListeners() {\n $(\"#controls\").off(\"click\");\n $(\"#sequence\").off(\"click\");\n}", "detachHandlers() {\n this.templateNext.removeEventListener('click', this.handleNext);\n this.templatePrev.removeEventListener('click', this.handlePrev);\n window.removeEventListener('keydown', this.handleKeyDown);\n window.removeEventListener('resize', this.handleResize)\n }", "function removeEventListeners() {\n\n eventsAreBound = false;\n\n document.removeEventListener('keydown', onDocumentKeyDown, false);\n window.removeEventListener('hashchange', onWindowHashChange, false);\n window.removeEventListener('resize', onWindowResize, false);\n\n dom.wrapper.removeEventListener('touchstart', onTouchStart, false);\n dom.wrapper.removeEventListener('touchmove', onTouchMove, false);\n dom.wrapper.removeEventListener('touchend', onTouchEnd, false);\n\n if (window.navigator.msPointerEnabled) {\n dom.wrapper.removeEventListener('MSPointerDown', onPointerDown, false);\n dom.wrapper.removeEventListener('MSPointerMove', onPointerMove, false);\n dom.wrapper.removeEventListener('MSPointerUp', onPointerUp, false);\n }\n\n if (config.progress && dom.progress) {\n dom.progress.removeEventListener('click', onProgressClicked, false);\n }\n\n if (config.controls && dom.controls) {\n ['touchstart', 'click'].forEach(function (eventName) {\n dom.controlsLeft.forEach(function (el) {\n el.removeEventListener(eventName, onNavigateLeftClicked, false);\n });\n dom.controlsRight.forEach(function (el) {\n el.removeEventListener(eventName, onNavigateRightClicked, false);\n });\n dom.controlsUp.forEach(function (el) {\n el.removeEventListener(eventName, onNavigateUpClicked, false);\n });\n dom.controlsDown.forEach(function (el) {\n el.removeEventListener(eventName, onNavigateDownClicked, false);\n });\n dom.controlsPrev.forEach(function (el) {\n el.removeEventListener(eventName, onNavigatePrevClicked, false);\n });\n dom.controlsNext.forEach(function (el) {\n el.removeEventListener(eventName, onNavigateNextClicked, false);\n });\n });\n }\n\n }", "destroy () {\n this.eventListeners = null;\n }", "_removeEventListeners() {\n window.removeEventListener('deviceorientation', this._onOrientationFound);\n\n this._map\n .off('locationfound', this._onLocationFound, this)\n .off('locationerror', this._onLocationError, this)\n .off('dragstart', this._onDragStart, this)\n .off('moveend', this._onMoveEnd, this);\n }", "function removeListeners() {\r\n modal.yes.removeEventListener(\"click\", backToMenu);\r\n modal.no.removeEventListener(\"click\", backToGame);\r\n }", "function removeRedandYellowListeners(){\n\t\tfor (var i = $boxes.length -1; i>=0;i--){\n\t\t\tvar $box = $($boxes[i]);\n\t\t\t$box.off('click', addRedorYellow);\n\t\t}\n\t}", "_removeEventListeners() {\n\n this.el.removeEventListener('click', this._onClickBound);\n window.removeEventListener('scroll', this._onScrollBound);\n window.removeEventListener('orientationchange', this._onScrollBound);\n document.removeEventListener('spark.visible-children', this._onVisibleBound, true);\n\n if (canObserve)\n this._removeMutationObserver();\n else\n window.removeEventListener('resize', this._onResizeBound);\n }", "removeEventListeners() {\n // Empty in base class.\n }", "removeDragListeners() {}", "removeDragListeners() {}", "destroy() {\n if (Object.values(this.events).length) {\n for (let event in this.events) {\n window.removeEventListener(event.name, event.fn);\n }\n }\n }", "detachAllEvents() {\n this.handledEvents.forEach((value, key) => {\n this.offEvent(key, value.target, value.options);\n });\n }", "unsubscribeEventListeners () {\n // Remove Aurelia event listeners\n this.subscriptions.forEach((subscription) => {\n subscription.dispose();\n });\n this.subscriptions = undefined;\n\n // Remove basic JS event listeners.\n if (this.canvas) {\n this.canvas.removeEventListener(\n 'contextmenu', this.canvasContextMenuHandler\n );\n this.canvas.removeEventListener('mousedown', this.canvasMouseDownHandler);\n this.canvas.removeEventListener('mouseleave', this.canvasMouseUpHandler);\n this.canvas.removeEventListener('mousemove', this.canvasMouseMoveHandler);\n this.canvas.removeEventListener('mouseup', this.canvasMouseUpHandler);\n this.canvas.removeEventListener('mousewheel', this.canvasMouseWheelHandler);\n }\n }", "_cleanToRemovedListeners() {\n const toRemovedListeners = this._toRemovedListeners;\n\n for (let i = 0; i < toRemovedListeners.length; ++i) {\n const selListener = toRemovedListeners[i];\n\n const listeners = this._listenersMap[selListener._getListenerID()];\n\n if (!listeners) {\n continue;\n }\n\n const fixedPriorityListeners = listeners.getFixedPriorityListeners();\n const sceneGraphPriorityListeners = listeners.getSceneGraphPriorityListeners();\n\n if (sceneGraphPriorityListeners) {\n const idx = sceneGraphPriorityListeners.indexOf(selListener);\n\n if (idx !== -1) {\n sceneGraphPriorityListeners.splice(idx, 1);\n }\n }\n\n if (fixedPriorityListeners) {\n const idx = fixedPriorityListeners.indexOf(selListener);\n\n if (idx !== -1) {\n fixedPriorityListeners.splice(idx, 1);\n }\n }\n }\n\n toRemovedListeners.length = 0;\n }", "clearListeners(clearPersistent) {\n if (this._listeners) {\n this._listeners.forEach(e => {\n if (clearPersistent || !e.persistent) {\n GOOGLE_MAP_API.event.removeListener(e.listener);\n e.listener = null;\n }\n });\n this._listeners = this._listeners.filter(e => {\n return e.listener != null;\n });\n }\n }", "removeAllEvents() {\n this.destroy();\n }", "_removeEventListeners () {\n this._socket.removeAllListeners(ConnectionSocket.EVENT_ESTABLISHED)\n this._socket.removeAllListeners(ConnectionSocket.EVENT_CLOSED)\n this._socket.removeAllListeners(ConnectionSocket.EVENT_PEER_CONNECTED)\n this._socket.removeAllListeners(ConnectionSocket.EVENT_PEER_PING)\n this._socket.removeAllListeners(ConnectionSocket.EVENT_PEER_SIGNAL)\n this._rtc.removeAllListeners(ConnectionRTC.EVENT_RTC_SIGNAL)\n this._rtc.removeAllListeners(ConnectionRTC.EVENT_PEER_PING)\n this._rtc.removeAllListeners(ConnectionRTC.EVENT_CLOSED)\n }", "function removeListeners() {\n window.removeEventListener('message', _onParentMessage);\n}", "function _removeEventListeners(target) {\n\t for (var i in this._eventOutput.listeners) {\n\t target.removeEventListener(i, this.eventForwarder);\n\t }\n\t }", "function dettachEvents() {\n // Remove custom events from the window\n window.removeEventListener(\"touch\", handleInteruption, false);\n window.removeEventListener(\"mousewheel\", handleInteruption, false);\n window.removeEventListener(\"mousedown\", handleInteruption, false);\n}", "cleanup() {\n const { ws, udp } = this.sockets;\n\n if (ws) {\n ws.removeAllListeners('error');\n ws.removeAllListeners('ready');\n ws.removeAllListeners('sessionDescription');\n ws.removeAllListeners('speaking');\n }\n\n if (udp) udp.removeAllListeners('error');\n\n this.sockets.ws = null;\n this.sockets.udp = null;\n }", "removeEventListeners(){\n\t\tif(!this.document) {\n\t\t\treturn;\n\t\t}\n\t\tDOM_EVENTS.forEach(function(eventName){\n\t\t\tthis.document.removeEventListener(eventName, this._triggerEvent, { passive: true });\n\t\t}, this);\n\t\tthis._triggerEvent = undefined;\n\t}", "destroy() {\n this.listeners = null;\n }", "cleanEchoListeners() {\n this.echoListeners.forEach(element => {\n window.Echo.private(\n element.channel\n ).stopListening(element.event);\n });\n }", "function unRegisterEventHandlers() {\n\tlet event_keys = Object.keys(registered_event_handlers);\n\tevent_keys.forEach(function(key) {\n\t\tlet event_obj = registered_event_handlers[key];\n\t\tif (typeof event_obj.id !== \"undefined\") {\n\t\t\t$(event_obj.dom_node).off(event_obj.event,\"#\"+event_obj.id);\n\t\t} else if (typeof event_obj.class !== \"undefined\") {\n\t\t\t$(event_obj.dom_node).off(event_obj.event,\".\"+event_obj.class);\n\t\t} else {\n\t\t\t$(event_obj.dom_node).off(event_obj.event);\n\t\t}\n\t});\n\tregistered_event_handlers = [];\n}", "removeFinWindowEventListeners() {\n finsembleWindow.removeEventListener(\"maximized\", this.onWindowMaximized);\n finsembleWindow.removeEventListener(\"restored\", this.onWindowRestored);\n finsembleWindow.removeEventListener(\"blurred\", this.onWindowBlurred);\n finsembleWindow.removeEventListener(\"focused\", this.onWindowFocused);\n finsembleWindow.removeEventListener(\"close-requested\", this.close);\n finsembleWindow.removeEventListener(\"minimized\", this.onWindowMinimized);\n }", "__detatchListeners() {\n if (qx.bom.History.SUPPORTS_HASH_CHANGE_EVENT) {\n qx.bom.Event.removeNativeListener(\n window,\n \"hashchange\",\n this.__checkOnHashChange\n );\n } else {\n qx.event.Idle.getInstance().removeListener(\n \"interval\",\n this.__onHashChange,\n this\n );\n }\n }", "function _removeEventListeners(target) {\n for (var i in this._eventOutput.listeners) {\n target.removeEventListener(i, this.eventForwarder);\n }\n }", "detach() {\n for (const container of this.containers) {\n container.removeEventListener('webkitmouseforcewillbegin', this[onMouseForceWillBegin], false);\n container.removeEventListener('webkitmouseforcedown', this[onMouseForceDown], false);\n container.removeEventListener('mousedown', this[onMouseDown], true);\n container.removeEventListener('webkitmouseforcechanged', this[onMouseForceChange], false);\n }\n\n document.removeEventListener('mousemove', this[onMouseMove]);\n document.removeEventListener('mouseup', this[onMouseUp]);\n }", "function removePlayFunctions() {\n play.removeEventListener(\"click\", scrollDown);\n play.removeEventListener(\"click\", generatedGridRows);\n play.removeEventListener(\"click\", randomise);\n play.removeEventListener(\"click\", newGame);\n play.removeEventListener(\"click\", squareSize);\n play.removeEventListener(\"click\", checkerboard);\n play.removeEventListener(\"click\", addFlags);\n play.removeEventListener(\"click\", assignRelativePosition);\n play.removeEventListener(\"click\", assignHTML);\n play.removeEventListener(\"click\", bombIcon);\n play.removeEventListener(\"click\", flags);\n}", "function removeListeners() {\n for (var i = 0; i < cards.length; i++) {\n card = cards[i];\n card.removeEventListener(\"click\", revealCard);\n card.removeEventListener(\"click\", cardOpen);\n card.removeEventListener(\"click\", winner);\n card.classList.add(\"open\", \"disabled\", \"match\");\n }\n}", "function cleanupEvents() {\n if (eventRegistry) {\n for (var i = 0; i < eventRegistry.length; i++) {\n var evt = eventRegistry[i];\n removeEvent(evt.element, evt.type, evt.handler, evt.useCapture);\n }\n // unlink circular refrences so they can be GC'd\n eventRegistry = null;\n removeEvent(window, \"unload\", cleanupEvents, false);\n }\n}", "removeEvents() {\n }", "_cleanToRemovedListeners() {\n const toRemovedListeners = this._toRemovedListeners;\n\n for (let i = 0; i < toRemovedListeners.length; ++i) {\n const selListener = toRemovedListeners[i];\n\n const listeners = this._listenersMap[selListener._getListenerID()];\n\n if (!listeners) {\n continue;\n }\n\n const fixedPriorityListeners = listeners.getFixedPriorityListeners();\n const sceneGraphPriorityListeners = listeners.getSceneGraphPriorityListeners();\n\n if (sceneGraphPriorityListeners) {\n const idx = sceneGraphPriorityListeners.indexOf(selListener);\n\n if (idx !== -1) {\n sceneGraphPriorityListeners.splice(idx, 1);\n }\n }\n\n if (fixedPriorityListeners) {\n const idx = fixedPriorityListeners.indexOf(selListener);\n\n if (idx !== -1) {\n fixedPriorityListeners.splice(idx, 1);\n }\n }\n }\n\n toRemovedListeners.length = 0;\n }", "function clearEvents() {\n $._clearEvents();\n}", "unWireEvent() {\n this.viewerContainer.removeEventListener('scroll', this.scrollHandler);\n this.viewerContainer.removeEventListener('mousedown', this.onMouseDownInternal);\n this.viewerContainer.removeEventListener('mousemove', this.onMouseMoveInternal);\n if (!Browser.isDevice) {\n this.editableDiv.removeEventListener('keypress', this.onKeyPressInternal);\n if (Browser.info.name === 'chrome') {\n this.editableDiv.removeEventListener('textInput', this.onTextInput);\n }\n }\n else {\n this.editableDiv.removeEventListener('input', this.onTextInputInternal);\n }\n this.editableDiv.removeEventListener('paste', this.onPaste);\n this.viewerContainer.removeEventListener('contextmenu', this.onContextMenu);\n this.editableDiv.removeEventListener('blur', this.onFocusOut);\n this.editableDiv.removeEventListener('keydown', this.onKeyDownInternal);\n this.editableDiv.removeEventListener('compositionstart', this.compositionStart);\n this.editableDiv.removeEventListener('compositionupdate', this.compositionUpdated);\n this.editableDiv.removeEventListener('compositionend', this.compositionEnd);\n this.viewerContainer.removeEventListener('mouseup', this.onMouseUpInternal);\n if (!isNullOrUndefined(this.iframe)) {\n this.iframe.removeEventListener('load', this.onIframeLoad);\n }\n this.viewerContainer.removeEventListener('dblclick', this.onDoubleTap);\n window.removeEventListener('resize', this.onWindowResize);\n window.removeEventListener('keyup', this.onKeyUpInternal);\n window.removeEventListener('mouseup', this.onImageResizer);\n window.removeEventListener('touchend', this.onImageResizer);\n }", "detachListeners() {\n this.#outInterface.off('line', this.lineListener);\n this.#errInterface.off('line', this.errorListener);\n this.#child.off('exit', this.exitListener);\n this.#child.removeAllListeners('close');\n }", "function removeListeners() {\r\n gameOverModal.btn.removeEventListener(\"click\", backToMenu);\r\n }", "remove() {\n //remove handlers of any atomic data defined here\n const {source, handler} = this.events;\n source.remove();\n //reset `this.events` \n this.events = {};\n }", "remove() {\n //remove handlers of any atomic data defined here\n const {source, handler} = this.events;\n source.remove();\n //reset `this.events` \n this.events = {};\n }", "reset() {\n const {\n listeners\n } = this;\n const len = listeners.length;\n\n if (len > 0) {\n for (let i = 0; i < len; i += 1) {\n const set = listeners[i];\n const pos = ArrayIndexOf.call(listeners[i], this);\n ArraySplice.call(set, pos, 1);\n }\n\n listeners.length = 0;\n }\n }", "clearListeners(clearPersistent) {\n if (google) {\n if (this._listeners) {\n this._listeners.forEach((e) => {\n if (clearPersistent || !e.persistent) {\n google.maps.event.removeListener(e.listener);\n e.listener = null;\n }\n });\n this._listeners = this._listeners.filter((e) => {\n return e.listener != null;\n });\n }\n }\n }", "function unsubscribeAll() {\n uninstallGlobalHandler();\n handlers = [];\n }", "function unsubscribeAll() {\n uninstallGlobalHandler();\n handlers = [];\n }", "function unsubscribeAll() {\n uninstallGlobalHandler();\n handlers = [];\n }", "function _removeEventListeners(target) {\n for (var i in this.eventHandler.listeners) {\n target.removeEventListener(i, this.eventForwarder);\n }\n }", "reset() {\n const {\n listeners\n } = this;\n const len = listeners.length;\n\n if (len > 0) {\n for (let i = 0; i < len; i += 1) {\n const set = listeners[i];\n const pos = ArrayIndexOf$1.call(listeners[i], this);\n ArraySplice$1.call(set, pos, 1);\n }\n\n listeners.length = 0;\n }\n }", "destroy() {\n\t\tfor(const [event, listener] of this.listeners) this.client.removeListener(event, listener);\n\t\tthis.listeners.clear();\n\t}", "destroy() {\n this.removeDomListeners()\n // 238-4\n this.unsubscribers.forEach(unsub => unsub())\n }", "destroy() {\n this.removeDOMListeners();\n this.unsubscribers.forEach((unsub) => unsub());\n }", "unlisten() {\n [\"change\"].forEach(name => {\n this.el_.removeEventListener(name, this.handler_, false)\n })\n\n /* Final reset */\n this.reset()\n }" ]
[ "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.77127075", "0.76607066", "0.765541", "0.7617221", "0.7613077", "0.76037747", "0.7597112", "0.75908387", "0.7576728", "0.7576728", "0.7564958", "0.75427777", "0.7532681", "0.7532363", "0.7519867", "0.75016695", "0.7500645", "0.74816656", "0.74798834", "0.7459843", "0.7455189", "0.7415441", "0.73867166", "0.7375581", "0.73475134", "0.73333454", "0.73327196", "0.7296553", "0.72810817", "0.7273378", "0.7258178", "0.7256101", "0.724964", "0.72429645", "0.72342956", "0.7226727", "0.72203916", "0.72167826", "0.72167826", "0.721651", "0.72135526", "0.71928513", "0.7171641", "0.7163562", "0.7158529", "0.7157283", "0.71553653", "0.7137832", "0.71377355", "0.7131727", "0.71247625", "0.711803", "0.7117867", "0.71073794", "0.7094401", "0.70929146", "0.7081614", "0.7073633", "0.7066863", "0.706411", "0.7063485", "0.70622534", "0.70618063", "0.7050111", "0.70472974", "0.70451516", "0.703912", "0.7025666", "0.7025666", "0.7022917", "0.7018219", "0.70165515", "0.70165515", "0.70165515", "0.7014341", "0.7003827", "0.6988489", "0.697822", "0.69753283", "0.6973915" ]
0.0
-1
SEND TO PET PAGE
function petClicked(id) { window.location.href = ("./pet.html?" + id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendMessage(target, page, title) {\n if ('twitter' === target) {\n document.location.href = `https://twitter.com/intent/tweet?original_referer=${encodeURI(page)}&text=${encodeURI(title) + ' @DevMindFr'}&tw_p=tweetbutton&url=${encodeURI(page)}`;\n }\n else if ('linkedin' === target) {\n document.location.href = `https://www.linkedin.com/shareArticle?mini=true&url=${encodeURI(page)}&text=${encodeURI(title)}`;\n }\n }", "function Send_URL(URL){\r\n var attribute={};\r\n\t\t attribute.hasDate =new Date().format(\"yyyy-MM-dd h:mm:ss\");\r\n //attribute.begin = (new Date()).getTime();\r\n //attribute.end = (new Date()).getTime();\r\n attribute.hasType=\"Ouverture_Page\";\r\n attribute.hasSubject=\"obsel of action Website_visited \";\r\n attribute.hasDocument_URL = URL;\r\n\t\t attribute.hasDocument_Title = document.title;\r\n\t kango.dispatchMessage('obsel',attribute);\r\n }", "function thankYouPage() {\r\n app.getView().render('subscription/emarsys_thankyou');\r\n}", "function print() {\n message += \"<h2>\" + parkList[pick].name + \"</h2>\" + parkList[pick].picture + \"<p>\" + parkList[pick].description + \"</p>\";\n document.write(message);\n}", "function forwardMsgToPage(serialNumber, resp, err, name) {\n var senderInfo = messagesFromPage[serialNumber];\n if (senderInfo) {\n chrome.tabs.sendMessage(senderInfo.sender.id,\n {\n \"src\": \"background\",\n \"logo\": \"dfd\",\n \"serialNumber\": serialNumber,\n \"resp\": resp,\n \"error\": err,\n \"name\": name\n });\n\n //delete messagesFromPage[serialNumber];\n }\n\n}", "function ir_a_mi_partido() {\n location.href = \"mi_partido.html?id=\" + id;\n }", "function setPage() {\n document.body.innerHTML = this.response;\n send = document.getElementById('send');\n let field = document.getElementById('message');\n send.addEventListener(\"click\", function () {\n let message = field.value;\n mySocket.send(username + \" \" + message);\n });\n\n field.addEventListener(\"keyup\", function (event) {\n if (event.key === 'Enter') {\n send.click();\n }\n });\n }", "function printToPage(msg) {\n\t\tif(document.getElementById(\"message\") != null){\n\t\t\tdocument.getElementById(\"message\").innerHTML = msg;\n\t\t}\n\t\telse{\n\t\tvar message = \"<p id=\\\"message\\\">\" + msg + \"<\\p>\";\n\t\t$(\"#result\").append(message);\n\t\t}\n\t}", "function displayPage(res, page) {\n\t\tres.sendFile(path.join(__dirname, page));\n\t}", "function writeToPage(msg) {\n results.innerHTML = msg;\n}", "function sendTo(e, url) {\n\n var label, text, model;\n\n e.preventDefault();\n e.stopPropagation();\n\n hideCategoryNav();\n\n text = /build/gi.test(e.target.textContent) ? \"Build Your Lexus\" : e.target.textContent;\n label = e.target.getAttribute(\"data-label\") || \"Category not found\";\n model = e.target.getAttribute(\"data-model\") || \"Model data not found\";\n\n if (typeof fireTag === \"function\") {\n onGlobalNavModelClick(\"Model Flyout\", \"CTA Click\", label, text, model);\n }\n\n window.location.href = url;\n }", "function sendhelp() {\n window.location.href = \"#helpzone\";\n}", "function sfjsendPMTo(recipient, name, title, reply)\n{\n\tvar toField = document.getElementById('pmmembers');\n\tvar titleField = document.getElementById('pmtitle');\n\tvar isreply = document.getElementById('pmreply');\n\n\ttoField.value = recipient;\n\ttitleField.value = title;\n\tisreply.value = reply;\n\tsfjaddpmUser('pmmembers');\t\n\tsfjtoggleLayer('sfpostform');\n}", "function submitPet(pet) {\n $.post(\"/api/pets\", pet, function() {\n window.location.href = \"/owners\";\n });\n }", "function sendDriverMsg\n(\n ride,\n msg\n)\n{\n var ownerId = ride.ownerId;\n \n // get the driver name and contact number, email \n var owner = getOwnerByOwnerId(ownerId, true);\n\n var phoneNumber = $('response returnVal phone1',owner).text(); \n var name = $('response returnVal firstName',owner).text()\n +' '+ $('response returnVal lastName'\n ,owner).text(); \n phoneNumber = phoneNumber.split('-').join('');\n \n// msg = \"Your offer was accepted by the rider. Please login \" +\n// \"into airppnd to see the status of the ride. \" + \n// SITE_URL; \n// var msg = $('#messageContent').val() +'\\n'+' '+ SITE_URL+\n// 'confirmRider.php' + link;\n var hasSent = sendTextMessage(phoneNumber, msg);\n return hasSent; \n}", "function sendPage(res, page) {\n var loginDomain = Config.get(\"https.enabled\")\n ? Config.get(\"https.full-address\")\n : Config.get(\"http.full-address\");\n var csrfToken = typeof res.req.csrfToken === 'function'\n ? res.req.csrfToken() : '';\n var baseUrl = getBaseUrl(res);\n var locals = {};\n locals.loggedIn = locals.loggedIn || !!res.user;\n locals.loginName = locals.loginName || res.user ? res.user.name : false;\n locals.superadmin = locals.superadmin || res.user ? res.user.global_rank >= 255 : false;\n\n var navData = {\n baseUrl, csrfToken, loginDomain\n , loggedIn: locals.loggedIn, loginName: locals.loginName\n , superAdmin: locals.superadmin\n }\n var documentData = {\n head: {\n title: Config.get(\"html-template.title\"),\n description: Config.get(\"html-template.description\"),\n author: \"Calvin 'calzoneman' 'cyzon' Montgomery\",\n page: page\n },\n body: {\n page\n , nav: navData\n }\n }\n var html = HtmlDocument.renderDocument(documentData);\n res.send(html);\n}", "function displayText(pageType) {\n window.location = pageType + \".html\";\n}", "function guestPage() {\n $('button, input, .inputs').attr('disabled', 'disabled');\n $('#message').text('You are not a member of this space, so cannot edit. ');\n var link = $('<a>')\n .attr('href', host)\n .text('Visit the space.');\n $('#message').append(link).fadeIn();\n}", "function sendToViewer(type, direction, distance, posX, posY, posZ, modelurl){\r\n\t var dweeturl = \"****\";\r\n\t if (modelurl=='' || modelurl==null){\r\n\t \tmodelurl = 'objects/other/h614.obj';\r\n\t }\r\n \t $.ajax({\r\n\t\t type: \"POST\",\r\n\t\t url: dweeturl,\r\n\t\t data: {\"type\": type,\"direction\": direction, \"distance\": distance, \"posX\": posX, \"posY\": posY, \"posZ\": posZ, \"modelurl\": modelurl}\r\n\t}).done(function() {});\r\n}", "function postDetails(){\n\twindow.location.href = \"../html/post.html\";\n\t\n}", "function deliverWebPage(req, res){\n p_renderPage(req, res, 'Create a Service Object...');\n }", "function pot(extraLives) {\n view.fadeOut();\n\n ws.send(JSON.stringify({\n type: \"pot\",\n extraLives: extraLives\n }));\n }", "function onClickSubmit() {\n location.href = \"./student-submit-quest.html?questid=\" + questID + \"&userid=\" + userID;\n}", "function sendTodoButton(sender_psid){\n response = {\n \"attachment\":{\n \"type\":\"template\",\n \"payload\":{\n \"template_type\":\"button\",\n \"text\": \"TODO\",\n \"buttons\":[\n {\n \"type\":\"web_url\",\n \"url\":\"https://marvin-assistant.herokuapp.com/todo\",\n \"title\":\"TODO\",\n \"webview_height_ratio\": \"tall\",\n \"messenger_extensions\": true,\n \"fallback_url\": \"https://www.google.com\"\n }\n ]\n }\n }\n };\n sendMessage(sender_psid, response);\n}", "function addCPNlinkToPage(){\n\t\tcpn_url = location.href.match(/^(http.+\\/)[^\\/]+$/ )[1]+\"/savefiles/\"+$('#model_name').val()+\".cpn\";\n\n\t\t$.get(cpn_url).done(function() { \n \t\tsay('<a href=\"'+cpn_url+'\">CPN file</a> created');\n \t\t}).fail(function() { \n \t\tsay('CPN file does not exist!');\n \t\t});\t\t\n\t}", "function pot(extraLives) {\n view.fadeOut();\n\n ws.send(JSON.stringify({\n action: \"pot\",\n extraLives: extraLives\n }));\n }", "function send() {\n window.location.href = \"/add\";\n}", "function goSend(itemId) {\n if (itemId != null) {\n var id = new String(itemId);\n window.location = g_appServerUrl + \"TellFriendAlbum.flow?selectedExternalKey=\" + id;\n }\n}", "async function sendToPage() {\n await addToCollection();\n res.redirect('/results');\n }", "function writeToPage(passwd) {\n\n var pswdLable = document.createElement('h1');\n pswdLable.textContent = \"Your Password Is:\";\n pswdLable.setAttribute(\"style\", \"text-align:center; color:rgb(88, 88, 88);\");\n document.body.appendChild(pswdLable);\n\n var pswdData = document.createElement('p');\n pswdData.textContent = passwd;\n pswdData.setAttribute(\"style\", \"text-align:center; font-size:2vw; color:rgb(88, 88, 88);\");\n document.body.appendChild(pswdData);\n }", "function Petprofile(pet){\n pet = pet.replace(\"pet \", \"\");\n window.location = \"https://dragon-monkeys.firebaseapp.com/petprofile-page.html?Pet=\" + pet;\n}", "function printClick(){\r\n\tvar pnr=$(\"#pnrNo\").text();\r\n\tvar jrnydate=$(\"#jrnydateid\").text();\r\n\tpnr=pnr+\"^B^\"+jrnydate+\"^0\";\r\n\twindow.open(faces_context()+'/printTicket.jsf?pnr='+pnr,null,'menubar=no,location=no,scrollbars=yes,resizable=yes,height=600,width=800');\t\t\r\n\t\r\n}", "function addMoney() {\n window.location.href = \"wallet.html\";\n}", "function onSprayAndPrayClick() {\r\n\r\n vaultDweller.currentAttackMode = \"sprayAndPray\";\r\n\toutput = \"<p> You switch your weapon over to full-auto. <span class=\\\"update\\\">Click the target you want to fire at! </span></p>\";\r\n\t\r\n\tLogInfo(output);\r\n\t/*\r\n\t\r\n\tOld code\r\n\t// Pimp that gun\r\n AKS74u.addAttachment(attachments[5]);\r\n\r\n // Give it to a dude\r\n vaultDweller.arm(AKS74u);\r\n vaultDweller.attack(mingvase);\r\n\ttargetingOverlay(mingvase);\r\n\t*/\r\n}", "function s_sendVirtualPageName(newPageName,newChannel){\n\tdefaultChannelName = \"\" + newPageName.split(\":\")[0];\n\ts_sendOmnitureInfo(newPageName,(typeof newChannel!= \"undefined\")?newChannel:defaultChannelName);\n}", "preparingEmailSending() {\n const url = 'mailto:' + this.state.email + '?subject=Your Storj mnemonic&body=' + this.state.mnemonic;\n Linking.openURL(url); \n }", "async handle ({ email, username, bets, total }) {\r\n await Mail.send(\r\n ['emails.new_bets'],\r\n { username, bets, total },\r\n (message) => {\r\n message\r\n .to(email)\r\n .from('[email protected]', 'TGL | BETS')\r\n .subject('Novas apostas');\r\n }\r\n ); }", "function writePingToPage() {\n if ($(\"#atData\").val() != \"\") {\n if ($(\"#atData\").val() == getTextData(\"/data/send_at.html\")) {\n timeoutID = setTimeout(function () {\n if ($(\"#atData\").val() == getTextData(\"/data/send_at.html\")) {\n clearInterval(intervalID);\n // clickStyle('stop');\n }\n timeoutID = \"not_time\";\n }, 1000);\n }\n }\n if (timeoutID == \"not_time\") {\n var $atData = $(\"#atData\");\n $atData[0].scrollTop = $atData[0].scrollHeight;\n $atData.val(getTextData(\"/data/send_at.html\"));\n }\n }", "function link_to_article(pid)\r\n{\r\n temp = prompt(link_to_article_prompt, show_article_url+pid);\r\n return false;\r\n}", "function doSend()\n{\n window.location.href = \"doreminder.php\";\n}", "function sendData() {\n\tvar packed = \"\";\n\tpacked += escape(selectedName);\n\tpacked += \",\";\n\tpacked += escape(selectedSrc);\n\twindow.location = \"ConsumAparell2.html?\"+packed;\n}", "function doSentMessages() {\r\n\tdoMessagesComm();\r\n\treplaceLinkByHref({\r\n\t\t\"inboxMessages.html\":[\"Inbox messages\",\"Gelen Mesajlar\"],\r\n\t\t\"composeMessage.html\":[\"Compose Message\",\"Mesaj yaz\"]\r\n\t});\r\n}", "function sendTweet() {\n var tweet = quote.text + \"\\n - \" + quote.author;\n console.log(tweet.slice(0, 136) + '...');\n tweet.length < 141 ? twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(tweet) : twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(tweet.slice(0, 137) + '...');\n\n window.open(twtLink, '_blank');\n}", "click() {\n this.sendAction('deal', this.get('result'));\n }", "function goMessage(req, res){\n req.session.pagename = \"Profile Settings\";\n req.session.header = \"Profile Settings\";\n req.session.link = '/settings'\n req.session.back = \"Profile Settings\";\n res.redirect('/message');\n res.end();\n}", "function Action()\r\n{\r\n\tweb.url(\r\n\t\t{\r\n\t\t\tname : 'WebTours', \r\n\t\t\turl : 'http://localhost:1080/WebTours/', \r\n\t\t\tresource : 0, \r\n\t\t\trecContentType : 'text/html', \r\n\t\t\treferer : '', \r\n\t\t\tsnapshot : 't1.inf', \r\n\t\t\tmode : 'HTML'\r\n\t\t}\r\n\t);\r\n\r\n\tlr.thinkTime(20);\r\n\r\n\tweb.submitForm(\r\n\t\t{\r\n\t\t\tname : 'login.pl', \r\n\t\t\tsnapshot : 't2.inf', \r\n\t\t\titemData : [\r\n\t\t\t\t{name : 'username', value : 'jojo'},\r\n\t\t\t\t{name : 'password', value : 'bean'},\r\n\t\t\t\t{name : 'login.x', value : '68'},\r\n\t\t\t\t{name : 'login.y', value : '6'}\r\n\t\t\t]\r\n\t\t}\r\n\t);\r\n\r\n\tweb.image(\r\n\t\t{\r\n\t\t\tname : 'Search Flights Button', \r\n\t\t\talt : 'Search Flights Button', \r\n\t\t\tsnapshot : 't3.inf'\r\n\t\t}\r\n\t);\r\n\r\n\tweb.submitForm(\r\n\t\t{\r\n\t\t\tname : 'reservations.pl', \r\n\t\t\tsnapshot : 't4.inf', \r\n\t\t\titemData : [\r\n\t\t\t\t{name : 'depart', value : 'Denver'},\r\n\t\t\t\t{name : 'departDate', value : '09/22/2020'},\r\n\t\t\t\t{name : 'arrive', value : 'London'},\r\n\t\t\t\t{name : 'returnDate', value : '09/23/2020'},\r\n\t\t\t\t{name : 'numPassengers', value : '1'},\r\n\t\t\t\t{name : 'roundtrip', value : '<OFF>'},\r\n\t\t\t\t{name : 'seatPref', value : 'None'},\r\n\t\t\t\t{name : 'seatType', value : 'Coach'},\r\n\t\t\t\t{name : 'findFlights.x', value : '39'},\r\n\t\t\t\t{name : 'findFlights.y', value : '10'}\r\n\t\t\t]\r\n\t\t}\r\n\t);\r\n\r\n\tweb.setSocketsOption('SSL_VERSION', 'AUTO');\r\n\r\n\tweb.submitForm(\r\n\t\t{\r\n\t\t\tname : 'reservations.pl_2', \r\n\t\t\tsnapshot : 't5.inf', \r\n\t\t\titemData : \r\n\t\t\t\t[\r\n\t\t\t\t\t{ name : 'outboundFlight', value : '020;338;09/22/2020' }, \r\n\t\t\t\t\t{ name : 'reserveFlights.x', value : '78' }, \r\n\t\t\t\t\t{ name : 'reserveFlights.y', value : '9' }\r\n\t\t\t\t]\r\n\t\t}\r\n\t);\r\n\r\n\tlr.thinkTime(28);\r\n\tweb.submitForm(\r\n\t\t{\r\n\t\t\tname : 'reservations.pl_3', \r\n\t\t\tsnapshot : 't6.inf', \r\n\t\t\titemData : [\r\n\t\t\t\t{name : 'firstName', value : 'Jojo'},\r\n\t\t\t\t{name : 'lastName', value : 'Bean'},\r\n\t\t\t\t{name : 'address1', value : 'agagag'},\r\n\t\t\t\t{name : 'address2', value : '54561'},\r\n\t\t\t\t{name : 'pass1', value : 'Jojo Bean'},\r\n\t\t\t\t{name : 'creditCard', value : '123454567'},\r\n\t\t\t\t{name : 'expDate', value : '21/25'},\r\n\t\t\t\t{name : 'saveCC', value : '<OFF>'},\r\n\t\t\t\t{name : 'buyFlights.x', value : '41'},\r\n\t\t\t\t{name : 'buyFlights.y', value : '10'}\r\n\t\t\t]\r\n\t\t}\r\n\t);\r\n\r\n\tlr.thinkTime(5);\r\n\tweb.image(\r\n\t\t{\r\n\t\t\tname : 'SignOff Button', \r\n\t\t\talt : 'SignOff Button', \r\n\t\t\tsnapshot : 't7.inf'\r\n\t\t}\r\n\t);\r\n\r\n\treturn 0;\r\n}", "function email(name){\n window.location.assign(\"mailto: \" + name);\n }", "function sendPage(uri,bizData,result)\n{\n if (bizData == null)\n bizData = {};\n\n if (result != null)\n {\n var outcome = result.getOutcome();\n var header = result.getHeader();\n var message = result.getMessage();\n var characters = result.getCharacters();\n\n if (message != null || characters != null)\n {\n bizData[\"notice\"] = \"true\";\n bizData[\"outcome\"] = outcome;\n bizData[\"header\"] = header;\n bizData[\"message\"] = message;\n bizData[\"characters\"] = characters;\n }\n\n var errors = result.getErrorString();\n if (errors != null)\n {\n bizData[\"errors\"] = errors;\n }\n }\n\n // just to remember where we came from.\n bizData[\"flow\"] = \"true\";\n cocoon.sendPage(uri,bizData);\n}", "function postPage() {\n window.location = \"../createPost.html\";\n}", "function sendToClient(id, myPayoff, otherPayoff, choice) {\n node.say(\"results\", id, {\n myEarning: myPayoff,\n otherEarning: otherPayoff,\n myBank: getBankTotal(id, node.game.history),\n otherChoice: choice\n });\n //node.say(\"myEarning\", id, myPayoff);\n //node.say(\"otherEarning\", id, otherPayoff);\n //node.say(\"myBank\", id, getBankTotal(id, node.game.history));\n }", "function sendMyTeams(sender_psid){\n DatabaseUtils.getTeams(sender_psid).then(teams =>{\n let tiles = teams.map((team) => {\n return {\n \"title\": team.name,\n \"buttons\":[\n {\n \"type\": \"postback\",\n \"title\": \"Remove\",\n \"payload\": \"delete:\" + team.league+\":\"+team.name+\":\"+team.city\n }\n ]\n }\n });\n tiles = tiles.concat([\n {\n \"title\": \"New Team\",\n \"buttons\":[\n {\n \"type\": \"postback\",\n \"title\": \"Add\",\n \"payload\": \"ADD TEAM\"\n }\n ]\n }\n ]);\n let response = {\n \"attachment\":{\n \"type\":\"template\",\n \"payload\":{\n \"template_type\":\"generic\",\n \"elements\": tiles,\n }\n }\n };\n sendMessage(sender_psid, response);\n });\n}", "printInfos(address, stands, bikes) {\n\n $(\"#infos\").html(\"\");\n let infos = $(\"#infos\");\n\n $(\"<p>\").html(\"Adresse : \" + address).appendTo(infos);\n $(\"<p>\").html(stands + \" places\").appendTo(infos);\n $(\"<p>\").html(bikes + \" vélos disponibles\").appendTo(infos);\n\n //stockage de l'adresse pour l'affichage de la réservation\n //(utilisé par printBooking)\n sessionStorage.setItem(\"bookingAddress\", address);\n }", "function feedback(message, guid){\n // var pid = getPidForUser(guid);\n var session = getSessionForUser(guid);\n var originalguid = getFirstGuid(guid);\n // send to session pages - control page can display\n io.to(session).emit('feedback', {\"message\": message, \"user\": originalguid});\n }", "function launch_easy_print(self, view) {\n var self = this;\n var res_model = view['model'];\n var res_id = view['datarecord'].id;\n var template_id;\n return new Model('pdf.template.generator').call(\"search\", [[\n [\"model_id.model\",\"=\",res_model],\n [\"name\",\"=\",\"default\"] \n ]])\n .done(function (template) {\n console.log('-----temp-----', template, res_model, res_id);\n if(template != false){\n return new Model(\"pdf.template.generator\")\n .call(\"print_template\", [ template[0], res_id])\n .then(function(result){\n view.do_action(result);\n });\n }else{\n // Not found, Warning\n new CrashManager().show_warning({data: {\n exception_type: _t(\"Warning\"),\n message: _t(\"Not found template!, must be template name 'default'\")\n }});\n }\n\n });\n }", "function sendTeams(sender_psid){\n DatabaseUtils.getTeams(sender_psid).then(teams =>{\n let tiles = teams.map((team) => {\n return {\n \"title\": team.name,\n \"buttons\":[\n {\n \"type\": \"postback\",\n \"title\": \"Score\",\n \"payload\": \"score:\" + team.league+\":\"+team.name+\":\"+team.city\n }\n ]\n }\n });\n let response = {\n \"attachment\":{\n \"type\":\"template\",\n \"payload\":{\n \"template_type\":\"generic\",\n \"elements\": tiles,\n }\n }\n };\n sendMessage(sender_psid, response);\n });\n}", "function generateAndSendPage(response)\n{\n\t// Read the comments file\n\t// @error - if there an error\n\t// @data - the data read\n\tfs.readFile(\"comments.txt\", function(error, data)\n\t{\n\t\t// If the read fails\n\t\tif(error) throw error;\n\t\t\n\t\t// The comments data\n\t\tlet commentsData = \"\" + data;\n\n\t\t// Replace the newlines with HTML <br>\n\t\tcommentsData = replaceAll(commentsData, \"\\n\", \"<br>\");\n\t\t\n\t\tlet pageStr = \"\t<!DOCTYPE html>\";\n\t\tpageStr += \"\t<html>\";\n\t\tpageStr += \"\t<head>\";\n\t\tpageStr += \"\t\t<title>Guestbook </title>\";\n\t\tpageStr += \"\t</head>\";\n\t\tpageStr += \"\t<body bgcolor=white>\";\n\t\tpageStr += \"\t <h1>What others have said:</h1><br>\";\n\t\tpageStr += commentsData;\n\t\tpageStr += \"\t <form action='/guestbook' method='post'>\";\n\t\tpageStr += \" \t <label for='comment'>Message:</label>\";\n\t\tpageStr += \"\t <textarea id='comment' name='comment' placeholder='Whats on your mind?'></textarea><br><br>\";\n\t\tpageStr += \" \t <input type='submit' value='Send message' />\";\n\t\tpageStr += \"\t </form>\";\n\t\tpageStr += \"\t</body>\";\n\t\tpageStr += \"</html>\t\";\n\t\t\t\n\t\t// Send the page\n\t\tresponse.send(pageStr);\t\n\t});\n}", "poem(message, connection, args) {\n if (args.length !== 2) {\n message.reply('Format is !sno poem |Poem Name|');\n Speaker.googleSpeak('Wrong!', this.voice, this.volume, connection, Speaker.speak);\n return;\n }\n // Would check here for which poem to grab\n if (args[1].toLowerCase() === 'POEM-NAME') {\n const POEM = '';\n message.channel.send(POEM);\n Speaker.googleSpeak(POEM, this.voice, this.volume, connection, Speaker.speak);\n } else {\n message.reply('Format is !sno poem |Kevin/Seva|');\n Speaker.googleSpeak('Wrong!', this.voice, this.volume, connection, Speaker.speak);\n }\n }", "function sendToFrontEnd(dp){\n colorLib.incToTrafficDB();\n res.send(dp);\n }", "function doSentMessages() {\r\n\tdoMessagesComm();\r\n\treplaceLinkByHref({\r\n\t\t\"inboxMessages.html\":[\"Inbox messages\",\"Bejövő üzenetek\"],\r\n\t\t\"composeMessage.html\":[\"Compose Message\",\"Üzenet Írás\"]\r\n\t});\r\n}", "function goToRoomURL(){\n \tvar number = $.trim($(\"#roomNameInput\").val());\n\t\t$( \"#link\" ).html(\"Calling Room Created\");\n\t\t//window.location = \"https://appr.tc/r/\" + number;\n document.getElementById(\"videobox\").innerHTML = \"<iframe src=\\\"https://appr.tc/r/\" + number + \"\\\" id=\\\"appr\\\"></iframe>\";\n //$( \"#videobox\" ).innerHTML = \"<iframe src=\\\"https://appr.tc/r/\" + number + \"\\\" id=\\\"appr\\\"></iframe>\";\n }", "function printTradingInfo(msg, divID) {\n\tif (msg.request) {\n\t\tvar offerHTML;\n\t\tif (msg.item.offer._id === 'mystery') {\n\t\t\tofferHTML = \"Offered <a href='#'>\"+msg.item.offer.title+\"</a>\";\n\t\t} else {\n\t\t\tofferHTML = \"Offered <a href='#' class='linktoOffer'>\"+msg.item.offer.title+\"</a>\";\n\t\t}\n\t\tvar interestHTML;\n\t\tif (msg.item.interest._id === 'mystery') {\n\t\t\tinterestHTML = \" to <a href='#'>\"+msg.item.interest.title+\"</a>\";\n\t\t} else {\n\t\t\tinterestHTML = \" to <a href='#' class='linktoInterest'>\"+msg.item.interest.title+\"</a>\";\n\t\t}\n\n\t\t$(divID).html(offerHTML + interestHTML);\n\t\t$(\".linktoOffer\").click(function(){\n\t\t\t$.ajax({\n\t\t\t\ttype: \"GET\",\n\t\t\t\turl: \"/listing/users/\"+msg.item.offer._id,\n\t\t\t\tasync: false,\n\t\t\t\tsuccess: function (data) {\n\t\t\t\t\tviewing = data;\n\t\t\t\t}\n\t\t\t});\n\t\t\tgoToListingPage(msg.item.offer._id);\n\t\t});\n\t\t$(\".linktoInterest\").click(function(){\n\t\t\t$.ajax({\n\t\t\t\ttype: \"GET\",\n\t\t\t\turl: \"/listing/users/\"+msg.item.interest._id,\n\t\t\t\tasync: false,\n\t\t\t\tsuccess: function (data) {\n\t\t\t\t\tviewing = data;\n\t\t\t\t}\n\t\t\t});\n\t\t\tgoToListingPage(msg.item.interest._id);\n\t\t});\n\t\t$(divID).show();\n\t} else {\n\t\t$(divID).hide();\n\t}\n}", "function makeOtherPoets(response, type, err, contents, data)\n{\n var result = \"\";\n var row = [];\n var columns = [\"Poet\", \"Title\", \"Year\", \"Notes\"];\n var table = util.getTable();\n\n table.setHTMLClass(\"conq\");\n table.setColumns(columns);\n for(var i = 0; i < data.length; i++)\n {\n row = [];\n row.push(data[i].fullTitle);\n row.push(util.linkify(data[i].title));\n row.push(data[i].yearPublished);\n row.push(util.deNullify(data[i].notes));\n table.addRow(row);\n }\n table.buildHTMLPrintout();\n\n result = table.htmlPrintout;\n contents = util.absRep(contents, \"OTHERPOETS\", result);\n\n fetchPoetryRelated(response, type, err, contents);\n}", "function addPitDataToPage() {\n // pit scouting data\n let pit_data_point = pit_data[selected_team];\n // checks to see if pit data point actually exists\n if (pit_data_point !== undefined) {\n // traverses the pit JSON and runs addButtonData() for each question\n traverseScoutKitJSON(pit_data_point, function(json, p, pi, q, qi) {\n // adds the data to the \"Pit Data\" button\n addButtonData(\"pit\", pi + \"-\" + qi, [\n // returns the question\n function() {\n return q;\n },\n // returns the response to the question\n function() {\n let answer = json[p][q];\n // instead of showing scout id, it shows scout name\n if (q == \"Scout\") {\n answer = scouts[answer];\n }\n return answer;\n }\n ]);\n });\n }\n}", "sendCard() {\n if (!this.props.cardId) {\n this.setState({\n errorMessage: 'Please save card before sending'\n });\n } else if (this.props.recipients.length === 0) {\n this.setState({\n errorMessage: 'Add at least one email to send'\n });\n } else {\n this.updateCard();\n this.setState({ errorMessage: '' });\n window.open(\n `mailto:${this.props.recipients}?subject=${\n this.props.currentUser\n } sent you a postcard!&body=Click on this link to view the postcard: ${CLIENT_BASE_URL}/postcards/${\n this.props.cardId\n }`,\n '_self'\n );\n }\n }", "function sendTo(url) {\n window.location.href = \"/\"\n}", "function useMail(s){\r\n s = s.replace(/\\s+/g, ''); // .replace(/\\[dot\\]/g,\".\")\r\n this.location.href = \"mailto://\" + s + \"?subject=link from fbt-mechatronik.de\" + iAM;\r\n} // useMail", "function postIt() {\n\tupdateButton('Putting together your list..', true);\n\tvar willPay = 0.0;\n\tvar totalm3 = 0.0;\n\tvar m3final = 0.0;\n\tvar finalText = \"<h4>What I'll buy (\" + Object.keys(willTake).length + \"/\" + totalPasted + \")</h4><br><br><table style=\\\"width:100%>\\\" <tr> <th>Item name</th><th>Quantity</th><th>Price per unit</th><th>Total</th></tr>\";\n\temailBody = \"Someone wants to sell you shit, bruh! \\n\\n\";\n\t\n\tfor (var key in willTake) {\n\t\tvar k = willTake[key];\n\t\tvar p = (k.will_pay * k.quantity);\n\t\tvar perm3 = Math.round(((k.buy_max-k.will_pay)/k.m3)*100)/100;\n\t\t\n\t\tif (p)\n\t\t\twillPay += p;\n\t\tm3final += k.m3;\n\t\ttotalm3 += perm3;\n\t\n\t\temailBody += k.item_name + fuckingTabs(k.item_name, 70) + \"x\" + k.quantity.toLocaleString() + fuckingTabs(k.quantity.toString() + \" \", 15) + \"@ \" + k.will_pay.toLocaleString(undefined, { minimumFractionDigits:2}) + \" isk/unit\" + fuckingTabs(k.will_pay.toString(), 40) + \"Total: \" + p.toLocaleString(undefined, { minimumFractionDigits:2}) + \" isk\" + fuckingTabs(p.toString(), 40) + perm3.toLocaleString(undefined, { minimumFractionDigits:2}) + \" isk per m3, at buy prices - \" + (k.m3*k.quantity).toLocaleString(undefined, { minimumFractionDigits:2}) + \" m3 total\\n\";\n\t\tfinalText += \"<tr><td>\" + k.item_name + \"</td><td>\" + k.quantity.toLocaleString() + \"</td><td>\" + k.will_pay.toLocaleString(undefined, { minimumFractionDigits:2 }) + \" isk</td><td>\" + p.toLocaleString(undefined, { minimumFractionDigits:2 }) + \" isk</td></tr>\"\n\t}\n\t\n\temailBody += \"\\nTotal paying: \" + willPay.toLocaleString(undefined, { minimumFractionDigits:2}) + \" isk\\nTotal Profit per m3: \" + totalm3.toLocaleString(undefined, { minimumFractionDigits:2}) + \"isk\\nTotal profit: \" + (totalm3.toLocaleString(undefined, { minimumFractionDigits:2}) * m3final.toLocaleString(undefined, { minimumFractionDigits:2})) + \" isk\\nTotal size: \" + m3final.toLocaleString(undefined, { minimumFractionDigits:2}) + \" m3\";\n\temailBody += \"\\n\\t\\n\\t\\n\\t\";\n\tfinalText += \"<tr height=30px></tr><tr><td>Grand total</td><td><td></td></td><td>\" + willPay.toLocaleString(undefined, { minimumFractionDigits:2}) + \" isk</td></tr></table><br><u><h4>Add the code \\\"\" + uuid + \"\\\" in the contract description.</h4></u>\";\n\tfinalText += \"<input type=\\\"submit\\\" id=\\\"send_email\\\" class=\\\"btn btn-warning btn-block\\\" value=\\\"Looks good!\\\" onclick=\\\"send_email()\\\" />\";\n\tupdateButton('Get a new quote', false);\n\t$('#results').text(\"\");\n\t$('#results').append(finalText);\n}", "function servePokemonPage(req, res, next) {\n console.log(\"serving pokemonpage\");\n console.log(\"function: servePokemonPage\");\n function renderPokepage(id) {\n console.log(\"function: renderPokemonPage\");\n res.render('pokedex/pokemon_page', {\n title: \"Pokémon: Loading\",\n id: id,\n });\n }\n renderPokepage(req.params.id);\n}", "function send() {\n\t\t\t\troot.$51helper.pub('__tvt__' + clientTime);\n\t\t\t\tvar result = JSON.parse(JSON.stringify(isFirstSend ? utils.extend({}, baseAction, commonAction) : utils.extend({}, userAction, extendAction, commonAction)));\n\t\t\t\t// if (utils.obj2url(result).length > 1.8e3 && result.rc && result.rc.length) {\n\t\t\t\t// overflowRecord = result.rc.splice(result.rc.length - 1, 1)\n\t\t\t\t// userAction.rc = overflowRecord.splice(0)\n\t\t\t\t// }\n\t\t\t\tvar serialize = utils.obj2url(result);\n\t\t\t\tvar params = (isFirstSend ? config.url1 : config.url2) + '&rt=' + clientTime + '&' + serialize;\n\t\t\t\tvar img = new Image(1, 1);\n\t\t\t\timg.src = params;\n\t\t\t\tisFirstSend = false;\n\t\t\t\t// 开启 debug 模式\n\t\t\t\tif (localStorage.getItem('__trace__debug__') === '1' && window.console) {\n\t\t\t\t\tconsole.log(JSON.stringify(result, null, 4));\n\t\t\t\t}\n\t\t\t\tuserAction.rc.length = 0;\n\t\t\t\tuserAction.dr = 0;\n\t\t\t\tuserAction.nu = '';\n\t\t\t}", "function go(id, param, jsp) {\r\n\t\tvar url ='';\r\n\t\tif(id==\"nadmuRtVUZ\") {\r\n\t\t\turl = getUrl('nadmuRtVUZ',false);\r\n\t\t} else {\r\n\t\t\turl = getUrl(jsp,false);\r\n\t\t}\r\n\t\tif(id!=\"null\") {url=url+\"?id=\"+id}\r\n\t\tdocument.gotopage.action = url;\r\n\t\tdocument.gotopage.param.value=param;\r\n\t\tdocument.gotopage.jspName.value=jsp;\r\n\t\tdocument.gotopage.submit();\r\n\t}", "function show_correct_order_page_content() {\n\tif (checksameurl(location.href, correctorderpage) == true) {\n\t\tdocument.write(translate_sentence('Success submission! Paypal will send you an automated e-mail notification for your reference. Please check your e-mail inbox for purchase order details and banking transaction options.'));\n\t\tdocument.write('<br/><br/>' + translate_sentence('Thank you again for your purchase!'));\n\t\tsimpleCart.empty();\t//Remove items from cart\n\t}\n}", "function openwebview(sender_psid) {\n let response = {\n attachment: {\n type: \"template\",\n payload: {\n template_type: \"button\",\n text: \"Hello Umthunzi Farmer! Please click the link below.\",\n buttons: [{\n type: \"web_url\",\n // url: SERVER_URL + \"/options\",\n // url: process.env.SERVER_URL,\n url: \"https://umthunzi.justusvoigt.com\",\n title: \"Open Veggi Mart\",\n webview_height_ratio: \"full\",\n messenger_extensions: true\n }]\n }\n }\n };\n return response;\n }", "sendText(e) {\n e.preventDefault();\n\n const { text } = this.state;\n\n // pass variables within the query string\n fetch(\n `http://localhost:5000/send-text?recipient=${text.recipient}&textmessage=${text.textmessage}`\n ).catch((err) => console.error(err));\n\n // close modal\n this.toggle();\n }", "function obMail(a, b) {\n window.location.href = \"mail\" + \n \"to:\" + \n window.atob(a) +\n \"?subject=\" + \n escape(\"Mask Request from Mutual Aid Arlington\") +\n \"&body=\" + \n escape(b)\n ;\n}", "function sendform(context, space, response, username, useremail, station, bulbs, color, showurl, greeting) {\n // get user prefs for this service/space\n response.writeHead(200, {'Content-Type': 'text/html'});\n\n/*\n // read the at home template\n fs.readFile('content/athome.tmpl', 'utf8', send2);\n \n function send2 (err,data) {\n var page;\n if (err) {\n // TBD error no page\n page = \"<h1>SpaceManager missing content/athome.tmpl file\";\n } else {\n page = data;\n }\n };\n*/ response.write(\"<script language=\\\"javascript\\\">\\\nfunction toggle(tx,el) {\\\n\tvar ele = document.getElementById(el);\\\n\tvar text = document.getElementById(tx);\\\n\tif(ele.style.display == \\\"block\\\") {\\\n \t\tele.style.display = \\\"none\\\";\\\n\t\ttext.innerHTML = \\\"Show\\\";\\\n \t}\\\n\telse {\\\n\t\tele.style.display = \\\"block\\\";\\\n\t\ttext.innerHTML = \\\"Hide\\\";\\\n\t}\\\n} \\\n</script>\\\n<a id=\\\"d1\\\" href='javascript:toggle(\\\"d1\\\",\\\"t1\\\");'>Show</a> Scenes\\\n<div id=\\\"t1\\\" style=\\\"display: none\\\">\");\n\n // function generates output given space, username, useremail\n\n // TBD the modes for this user\n var stream = context.dbathomepref.find( {'space':space, 'scene':{$exists:true}}, { _id: 0, 'scene':1,'user':1});\n // handle the stream events\n stream.on(\"data\", processscene);\n stream.on(\"end\", processsceneend);\n\n \n function processscene(item) {\n var name = \"\";\n var userfield = \"\";\n console.log(item);\n if (item.hasOwnProperty(\"user\")) {\n if ((item.user != \"\") && (item.user != useremail))\n return; // skip it\n else if (item.user != \"\") {\n name = \"Your scene\"\n userfield = \",\\\\\\\"user\\\\\\\":\\\\\\\"\"+item.user+\"\\\\\\\"\";\n }\n }\n if (item.hasOwnProperty(\"scene\") && (item.scene != \"\") )\n if (name != \"\")\n name += \" named \" + item.scene;\n else\n name = item.scene;\n response.write(\"<a href='javascript:window.JSInterface.sendMode(\\\"{\\\\\\\"scene\\\\\\\":\\\\\\\"\" + item.scene +\"\\\\\\\"\"+userfield+\"}\\\");'>\" + name + \"</a><br>\");\n //JSON.stringify(item, undefined, 1));\n }\n \n function processsceneend() { \n response.write(\"</div><p></p><a id=\\\"d2\\\" href='javascript:toggle(\\\"d2\\\",\\\"t2\\\");'>Show</a> Preferences\\\n <div id=\\\"t2\\\" style=\\\"display: none\\\">\");\n \t\n response.write(\"<h2>Your At Home Preference Page</h2>\");\n response.write(\"<p>\" + username + \", select your home preferences:<p>\");\n \n response.write('<form name=\"feedback\" method=\"get\" action=\"athome\">');\n response.write('Radio Station: <input type=\"text\" name=\"station\" size=\"25\" value=\"' + station + '\"><p>');\n response.write('Lighbulb Names: <input type=\"text\" name=\"bulbs\" size=\"25\" value=\"' + bulbs + '\"><p>');\n response.write('Light Color (0-99): <input type=\"text\" name=\"color\" size=\"25\" value=\"' + color + '\"><p>');\n response.write('Personal Greeting: <input type=\"text\" name=\"greeting\" size=\"25\" value=\"' + greeting + '\"><p>');\n response.write('Web Site: <input type=\"text\" name=\"url\" size=\"25\" value=\"' + showurl + '\"><p>');\n response.write('<input type=\"hidden\" name=\"user\" value=\"' + useremail + '\">');\n response.write('<input type=\"hidden\" name=\"name\" value=\"' + username + '\">');\n response.write('<input type=\"hidden\" name=\"save\" value=\"1\">');\n response.end('<input type=\"submit\" value=\"Save\"></form></div>');\n }\n}", "function TPROJECT_PTP_RS(id)\n{\n var pParams = tree_getPrintPreferences();\n parent.workframe.location = fRoot+menuUrl+\"?type=reqspec&level=testproject&id=\"+id+args+\"&\"+pParams;\n}", "function sendPC(message,id) {\r\n xmlHttp2 = unsafeWindow.getHTTPObject();\r\n xmlHttp2.open('GET','/Post?u='+id+'&t='+message,true);\r\n xmlHttp2.setRequestHeader(\"Content-Type\", \"text/plain\");\r\n xmlHttp2.setRequestHeader(\"Connection\", \"close\");\r\n xmlHttp2.send(null); \r\n}", "function doPost(e) {\n var data = JSON.parse(e.postData.contents);\n\n if ( data.hasOwnProperty('message') ) {\n var msg = data.message;\n var id = msg.chat.id;\n var msg_id = msg.message_id;\n var name = msg.from.first_name;\n var wholeName;\n var answer;\n var items;\n var borrowed;\n var reply_markup;\n\n if (msg.from.last_name == undefined) {\n wholeName = msg.from.first_name;\n } else {\n wholeName = msg.from.first_name + \" \" + msg.from.last_name;\n }\n\n if ( msg.hasOwnProperty('entities') && msg.entities[0].type == 'bot_command' ) {\n var text = msg.text.replace(/^(\\/[a-zA-Z]+)@Tekiila_lainabot/, '$1');\n\n if ( /^\\/start/.test(text) || /^\\/help/.test(text) ) {\n sendText(id, helpText);\n }\n else if ( /^\\/lainaa/.test(text) ) {\n items = text.slice(8); // removes '/lainaa '\n if (items.length > 0) {\n answer = \"OK \" + name + \", merkkasin '\" + items + \"' sulle lainaan!\";\n SpreadsheetApp.openById(ssId).getSheets()[0].appendRow(['', '', '', items, wholeName, '', '', new Date()]);\n } else {\n answer = \"Niin mitä halusit \" + name + \" lainata? \" +\n \"Kirjoita tavara samalle riville komennon kanssa niin osaan merkata sen lainatuksi.\";\n }\n sendText(id, answer, msg_id, {'remove_keyboard': true, 'selective': true});\n }\n else if ( /^\\/palauta/.test(text) ) {\n items = text.slice(9); // removes '/palauta '\n borrowed = getBorrowed(wholeName);\n\n if (items.length > 0) {\n var sheet = SpreadsheetApp.openById(ssId).getSheets()[0];\n var row = 3;\n var column = 4;\n var rangeValues = sheet.getRange(row, column, sheet.getLastRow(), sheet.getLastColumn()).getValues();\n var searchResult = rangeValues.findItemIndex(items, wholeName); //Row Index - 3\n\n if(searchResult != -1)\n {\n //searchResult + 3 is row index.\n sheet.getRange(searchResult + 3, 9).setValue(new Date());\n answer = \"OK \" + name + \", palautin '\" + items + \"'.\";\n reply_markup = {'remove_keyboard': true, 'selective': true};\n }\n else {\n if (borrowed.items.length == 0) {\n answer = name + \" hei... sä et oo ees lainannu mitään.\";\n }\n else {\n answer = \"Sori \" + name + \", en löytänyt että '\" + items + \"' ois sulla lainassa. \" +\n \"Miten ois joku näistä: \" + \"'\" + borrowed.items.join(\"', '\") + \"'\";\n\n reply_markup = {\n 'keyboard': makeKeyboard(borrowed.items),\n 'resize_keyboard': true,\n 'selective': true\n };\n }\n }\n } else {\n if (borrowed.items.length == 0) {\n answer = name + \" hei... sä et oo ees lainannu mitään.\";\n }\n else {\n answer = \"Niin mitä halusit \" + name + \" palauttaa? \" +\n \"Kirjoita tavara samalle riville komennon kanssa niin merkkaan sen palautetuksi. \" +\n \"Miten ois joku näistä: \" + \"'\" + borrowed.items.join(\"', '\") + \"'\";\n\n reply_markup = {\n 'keyboard': makeKeyboard(borrowed.items),\n 'resize_keyboard': true,\n 'selective': true\n };\n }\n }\n sendText(id, answer, msg_id, reply_markup);\n }\n else if ( /^\\/lainassa/.test(text) ) {\n borrowed = getBorrowed();\n answer = \"<b>Tällä hetkellä on lainassa:</b>\\n\";\n for (var i = 0; i < borrowed.items.length; i++) {\n answer += borrowed.borrower[i] + \": \" + borrowed.items[i] + \"\\n\";\n }\n sendText(id, answer, msg_id, {'remove_keyboard': true, 'selective': true});\n }\n }\n }\n}", "function page_print() {\n\twoas._customized_popup(current, woas.getHTMLDiv(d$(\"woas_wiki_area\")),\n\t\t\t'function go_to(page) { alert(\"'+woas.js_encode(woas.i18n.PRINT_MODE_WARN)+'\");}');\n}", "function viewTickets(agent) {\n agent.add(`Give us the name of the person whom the ticket was issued to.`);\n }", "function makefortmessage(twpro_fort_elementin){\r\nvar twpro_fort_elementid=twpro_fort_elementin.id;\r\nvar twpro_fort_instructions=twpro_fort_elementid.replace('window_fort_battlepage','fortbattle_placement_map')+\"_instructions\";\r\nvar tmparray3=document.getElementById(twpro_fort_instructions).getElementsByTagName('a');\r\nvar tmparray3=tmparray3[0].parentNode;\r\nvar twpro_fort_divplayerid=twpro_fort_elementid.replace('window_fort_battlepage','fortbattle_placement_map')+\"_playerlistdiv\";\r\nn = new Element('a', {'href': \"javascript:makefortlist('\"+twpro_fort_divplayerid+\"');end();\", 'style':'cursor: pointer;'});\r\nn.innerHTML=\"<br/><br/>\"+TWPro.lang.FORTMESSAGE;\r\ntmparray3.appendChild(n);\r\n}", "function sendEmail(){\r\n \t \r\n if(document.getElementById(\"pageType\").value==\"chat\")\r\n \t sendMsgTo(chatCK,\"msgTxt\",\"emailMsg\",\"usrName\", \"CHAT\");\r\n else \r\n \t sendMsgTo(adminCK,\"msgTxt\",\"emailMsg\",\"usrAdmName\",\"ADMIN\");\r\n \t \r\n }", "function sendWindow() {\r\n\tsendWriteAction(actualMessage);\r\n}", "function _print_struk(id,tgl){\r\n\t\tvar path=$('#path').val();\r\n\t\t$.post('print_slip',{\r\n\t\t\t'no_transaksi':id,\r\n\t\t\t'tanggal'\t :tgl},\r\n\t\t\tfunction(result){\r\n\t\t\t\tdocument.location.href=path+'penjualan/return_jual';\r\n\t\t\t})\r\n\t}", "function doGet(e) {\r\n return tg.util.outputText(\"Hanya data POST yang kita proses yak!\");\r\n}", "function prepareButtonUpdateOffer(aid) {\n\tofferToUpdate = aid;\n\twindow.location = 'editoffer.jsp?aid=' + aid;\n\n}", "function UnlockForm(){\n $.get('tickets/ajax/unlock_template.php', function(data){\n\t $(\"#printdiv\").html(data);\n\t\twindow.print();\n\t});\n}", "function sendNutriMessage(recipientID,name){\n getNutri('https://tsechatbot.myshopify.com/admin/products/'+name+'/metafields.json',recipientID,name);\n}", "sendToSite(data){\n this.interface.send(data)\n }", "function onclick_SendInfo() {\n var result = validate();\n if (result == false) {\n return false;\n }\n customer_id = createUpdateCustomer(customer_id);\n var params = {\n custid: customer_id,\n sales_record_id: null,\n invitetoportal: 'T',\n unity: 'T',\n sendinfo: 'T',\n id: 'customscript_sl_lead_capture',\n deploy: 'customdeploy_sl_lead_capture'\n };\n params = JSON.stringify(params);\n var upload_url = baseURL + nlapiResolveURL('suitelet', 'customscript_sl_send_email_module', 'customdeploy_sl_send_email_module') + '&params=' + params;\n window.open(upload_url, \"_self\", \"height=750,width=650,modal=yes,alwaysRaised=yes\");\n}", "function leicht(){\n window.location=\"/Tic_Tac_Toe/views/modien_leicht.html\";\n}", "function reply() {\r\n var fromWhere = JSON.parse(localStorage.getItem(\"emailToView\")).fromWhere;\r\n if (fromWhere == FROM_ADMIN_INBOX) {\r\n linkAdminCompose(fromWhere);\r\n } else if (fromWhere == FROM_STUDENT_INBOX) {\r\n linkStudentCompose(fromWhere);\r\n }\r\n}", "function writeInformation(gotUrl, gotTitle, gotPrice) {\n localStorage.setItem(\"gotUrl\",gotUrl);\n localStorage.setItem(\"gotTitle\",gotTitle);\n localStorage.setItem(\"gotPrice\",gotPrice);\n window.open('orderitem.html','_blank');\n}", "function sendText(message, mobile_number) {\n var scriptToSendText =\n \"window.WAPI.sendMessageToID('\" +\n mobile_number +\n \"@c.us', '\" +\n message.replaceAll(\"BREAK_LINE\", \"\\\\n\") +\n \"',function(data){console.log(data)})\";\n page.evaluate(scriptToSendText);\n console.log(scriptToSendText);\n}", "function sendPage() {\n sendbtn.style.borderBottom = \"solid\";\n sendbtn.style.borderBottomWidth = \"2px\";\n sendbtn.style.borderBottomColor= \"#ffffff\";\n sendbtn.style.color = \"#ffffff\";\n receivebtn.style.color = \"#B2D8D8\";\n histbtn.style.color = \"#B2D8D8\";\n receivebtn.style.borderBottom = \"none\";\n histbtn.style.borderBottom = \"none\";\n gift_sent.style.display = \"none\";\n giftOK.style.display = \"none\";\n giftText.style.display = \"none\";\n send.style.display = \"block\";\n receive.style.display = \"none\";\n buttonNavDiv.style.display = \"block\";\n searchBar.style.display = \"block\";\n sendifo_form.style.display = \"none\";\n gifthistory.style.display = \"none\";\n titleText.innerHTML = \"Gift cards\";\n topnav_button_left.style.visibility = \"visible\";\n \n}", "function sendEmail(address) {\n window.location.href = 'mailto:' + address;\n }", "function createPastie(options) {\n var isPublic = (typeof options.pub !== 'undefined') ? options.pub : true;\n \n Recipe.run(function(recipe) {\n var sel = (!recipe.selection.length)? new Range(0, recipe.length) : recipe.selection\n , output = ''\n , text = recipe.textInRange(sel)\n , form = new FormData();\n \n form.append('paste[body]', text);\n form.append('paste[authorization]', 'burger');\n form.append('paste[restricted]', (isPublic === true)? '0' : '1');\n form.submit('http://www.pastie.org/pastes', function(err, res) {\n if (err) {\n Alert.show('Failed to send to Pastie.', err.message, ['OK']);\n Alert.beep();\n return; \n }\n \n if (res.statusCode !== 302) {\n Alert.show('Failed to send to Pastie. (' + res.statusCode + ')', '', ['OK']);\n return;\n }\n \n if (res.headers.location) {\n handlePastieURL(res.headers.location, isPublic); \n }\n });\n });\n}", "deliver() {\n return \"Deliver by land in a box.\";\n }", "function printEmail(name, site, tld) {\n var at = \"@\";\n $('<a id=\"email\" class=\"pro\" href=\"mailto:' + name + at + site + '.' + tld + '\">' + name + at + site + '.' + tld + '</a>').replaceAll('#email');\n }", "function doPost(e) {\n try {\n if (e.parameters[\"intent\"] == \"lending\") {\n record_data(e);\n return ContentService\n .createTextOutput(\n JSON.stringify({\n \"result\": \"success\",\n \"data\": JSON.stringify(e.parameters)\n }))\n .setMimeType(ContentService.MimeType.JSON);\n } else if (e.parameters[\"intent\"] == \"search\") {\n return ContentService\n .createTextOutput(\n JSON.stringify({\n \"result\": \"success\",\n \"data\": JSON.stringify(search(e.parameters[\"netID\"],2,false))\n }))\n .setMimeType(ContentService.MimeType.JSON);\n } else if (e.parameters[\"intent\"] == \"return\") {\n return ContentService\n .createTextOutput(\n JSON.stringify({\n \"result\": \"success\",\n \"data\": JSON.stringify(search(e.parameters[\"Item\"],3,true))\n }))\n .setMimeType(ContentService.MimeType.JSON);\n } else if (e.parameters[\"intent\"] == \"archive\") {\n return ContentService\n .createTextOutput(\n JSON.stringify({\n \"result\": \"success\",\n \"data\": JSON.stringify(getArchive())\n }))\n .setMimeType(ContentService.MimeType.JSON);\n }\n \n } catch (error) {\n return ContentService\n .createTextOutput(JSON.stringify({\n \"result\": \"error\",\n \"error\": e\n }))\n .setMimeType(ContentService.MimeType.JSON);\n }\n}" ]
[ "0.6328842", "0.56546193", "0.56312555", "0.56266934", "0.5624233", "0.5621727", "0.55679184", "0.5554036", "0.5550344", "0.5519918", "0.551401", "0.5503541", "0.5482589", "0.54467314", "0.54070854", "0.53956085", "0.53907186", "0.53865516", "0.538576", "0.5374538", "0.53677267", "0.53640616", "0.5354301", "0.53471243", "0.534312", "0.5337912", "0.533157", "0.5310564", "0.5305242", "0.53047264", "0.5295276", "0.5280958", "0.52787304", "0.52754086", "0.52421504", "0.5235573", "0.52297884", "0.522401", "0.5213086", "0.5207327", "0.52064073", "0.5205975", "0.52016133", "0.51963246", "0.5188654", "0.51810884", "0.517915", "0.51693493", "0.5165584", "0.51640004", "0.51522166", "0.5151851", "0.51487714", "0.5146914", "0.514466", "0.5141678", "0.5138003", "0.5135514", "0.5135201", "0.51325333", "0.5130911", "0.51237446", "0.51183325", "0.51143026", "0.51119053", "0.5110585", "0.51101846", "0.5109932", "0.5106636", "0.5095017", "0.50944597", "0.50861865", "0.5086151", "0.5080558", "0.507796", "0.5075577", "0.5072377", "0.5070894", "0.50657004", "0.50603807", "0.50583184", "0.5054246", "0.50533587", "0.5050224", "0.5048114", "0.5040327", "0.503895", "0.5038326", "0.5033775", "0.50311214", "0.50291353", "0.5028842", "0.5028545", "0.50255454", "0.5024841", "0.5021232", "0.5013025", "0.5010911", "0.5010544", "0.50080496" ]
0.55455595
9
EVENTS > READ GET DATA
function getPets() { $("#user-pets").empty(); const user = JSON.parse(sessionStorage.user); db.collection("pets").where("user", "==", user.uid).get().then(snapshot => { if (snapshot.size > 0) { snapshot.forEach(snap => { displayPetCard(snap.data(), snap.id, user); }) } else { $("#user-pets").append(`No Pets Yet!`); } $("#preload").fadeOut(() => { $("#user-pets").fadeIn(); }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_data() {}", "GetData() {}", "getData(){}", "function getData (event) {\n var msg = JSON.parse(event.data);\n //console.log(msg);\n // We can select specific JSON groups by using msg.name, where JSON contains \"name\":x\n // Every type MUST have msg.type to determine what else is pulled from it\n switch (msg.type){\n case \"print\": // Print out msg.data\n //console.log(msg.data);\n break;\n case \"battery\":\n $('#battery-voltage').text(msg.data);\n break;\n case \"ping_sensors\":\n $('#ping-display').text(JSON.stringify(msg.data));\n var d = msg.data;\n sensorIndicatorDraw(d.fr,d.r,d.br,d.b,d.bl,d.l,d.fl);\n break;\n }\n }", "async readWait() {\n this.notifyFromServer('onread', { data: this.data });\n return this.data;\n }", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\n\t\t\t// I'm calling updateCallback to tell it I've got new data for it to munch on.\n\t\t\tupdateCallback(newData);\n\t\t}", "function retrieveData(){\ntrainsDatabase.on(\"value\", getData, error); \n}", "getData () {\n }", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\t\t\tupdateCallback(newData);\n\t\t}", "function getData() {\n console.log(data)\n }", "function getData(socket) {\n getTemp()\n getLight()\n getWindowState()\n getHeaterState()\n getArtificialLightIntensity()\n getHumidity()\n\n socket.emit(\"newMeasurements\", readData)\n}", "function getEvents(callback){\n\tfs.readFile('data/data.json', 'utf8', function (err, data) {\n \tif (err) {\n \treturn console.log(err);\n \t}\n \t\tparsedData = JSON.parse(data);\n\t\t callback(parsedData.events)\n\t});\n}", "function getInfo(event) {\n getData();\n addCountdown();\n}", "function getData()\t{\t\n\t\tCORE.LOG.addInfo(\"SKILLS_SYNCH:getData\");\n\t\t_this_.socket.emit('skillsGetData',\n\t\t\t{ \t\t\n\t\t\t\tplayerID:gameData.data.player.playerID\n\t\t\t}\n\t \t);\n\t}", "function GetData() {\n\tif (socket.readyState = 1) {\n\t\tsocket.send(\"GetData?Page=Example2\");\n\t}\n}", "async read() {\n await this.getStream();\n return this.data;\n }", "function getData(event) {\n prevent(event);\n getRecipes(query.value, start, end);\n}", "function getData() {\n if(app.connected) {\n // prepare thingspeak URL\n // set up a thingspeak channel and change the write key below\n var key = 'IKYH9WWZLG5TVYF2'\n var urlTS = 'https://api.thingspeak.com/update?api_key=' + key + '&field1=' + app.heartRate;\n // make the AJAX call\n $.ajax({\n url: urlTS,\n type: \"GET\",\n dataType: \"json\",\n success: onDataReceived,\n error: onError\n });\n }\n\t}", "_read() {\n\n }", "function accessesingData1() {\n\n}", "function accessesingData1() {\n\n}", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "readData() {\n const drive = this.drives[this.currentDrive];\n // The read command can do various things depending on the specific\n // current command, but we only support reading from the diskette.\n switch (this.currentCommand & COMMAND_MASK) {\n case COMMAND_READ:\n // Keep reading from the buffer.\n if (this.sectorData !== undefined && (this.status & STATUS_DRQ) !== 0 && drive.floppyDisk !== undefined) {\n this.data = this.sectorData.data[this.dataIndex];\n this.dataIndex++;\n if (this.dataIndex >= this.sectorData.data.length) {\n this.sectorData = undefined;\n this.status &= ~STATUS_DRQ;\n this.machine.diskDrqInterrupt(false);\n this.machine.eventScheduler.cancelByEventTypeMask(EventScheduler_1.EventType.DISK_LOST_DATA);\n this.machine.eventScheduler.add(EventScheduler_1.EventType.DISK_DONE, this.machine.tStateCount + 64, () => this.done(0));\n }\n }\n break;\n default:\n // Might be okay, not sure.\n throw new Error(\"Unhandled case in readData()\");\n }\n return this.data;\n }", "function readData() {\n\t\t\t\tconsole.log(\"Estado Session:\", sessionService.estadoSesion);\n\t\t\t\tif(sessionService.estadoSesion !== 00){\n\t\t\t\t\tjAlert(mensajeTexto.sesionExpirada, mensajeTexto.controlAcces, function () {\n\t\t\t\t\t\t$state.go('login');\t\n\t\t \t});\n\t\t\t\t}else{\n\t\t\t\t\treadDataSel();\n\t\t\t\t\treadDataQueue();\n\t\t\t\t}\n\t\t\t}", "_read() {\n }", "on_message(message) {\r\n if (message.sender == \"controller/db\" && message.command.startsWith(\"GET\")) {\r\n var session = gui.sessions.restore(message)\r\n if (session == null) return\r\n var data = message.get(\"data\")\r\n if (data.length == 0) return\r\n data = JSON.parse(data)\r\n gui.log_debug(\"loading calendar data: \"+data[0])\r\n scheduler.parse(JSON.parse(data[0]),\"json\")\r\n }\r\n }", "function gotData(data){\n console.log(data);\n}", "function gotRawData(thedata) {\n console.log(\"gotRawData\" + thedata);\n}", "function getData() {\n var ref = firebase.database().ref('Event');\n console.log(ref);\n ref.on('value', gotData, errData);\n}", "function readStock(){\r\n foodStock=dataBase.ref('food');\r\n foodStock.on(\"value\",function(beta){\r\n food=data.val();\r\n })\r\n}", "_read () {}", "_read () {}", "_read () {}", "_read() {}", "_read() {}", "function getData() {\n setSpinner(true);\n var url = config.baseUrl + \"AircraftList.json?lat=\" + userPosition.coords.latitude + \"&lng=\" + userPosition.coords.longitude + \"&fDstL=0&fDstU=\" + config.range;\n httpGetAsync(url, onSuccessGetData, onErrorGetData)\n }", "read() {\n try {\n this._toggleEditThrobber();\n var id = parseInt(document.getElementById('edit_id').value);\n var outputEl = this._clearOutput();\n \n // read data from db\n var jsonObj = this.dao.read(id);\n if (!jsonObj) throw `Error reading experiment data for audiogram ${id}`;\n //console.log(jsonObj)\n this._showOutput(id, jsonObj);\n\n } catch(e) {\n console.log(e);\n alert(e);\n }\n this._toggleEditThrobber();\n }", "function get_page_data() {\n socket.emit('get_page_data', {data: ''});\n //call server to tell we want all data, so we can fill the ui (normally done once on full page load/refresh)\n}", "function readNotes() {\n return data;\n}", "function readEventsData(accountId) {\r\n var rand = Math.random();\r\n var options = { type: \"GET\", url: Data.ServerURL+\"eventList.aspx?userId=\" +accountId + \"&ticket=\" + rand };\r\n\r\n WinJS.xhr(options).done(\r\n function completed(request) {\r\n //remove all items from the list.\r\n list.forEach(function (item) {\r\n list.pop(item);\r\n });\r\n console.log(\"Get eventlist success using Ajax.\");\r\n if (request.responseText != \"\") {\r\n var eventList = JSON.parse(request.responseText);\r\n eventList.forEach(function (item) {\r\n list.push(item);\r\n });\r\n }\r\n \r\n },\r\n function error(request) {\r\n console.log(\"Get eventlist using Ajax error.\");\r\n },\r\n function progress(request) {\r\n\r\n });\r\n }", "function getData(data) {\n var d = new Date();\n var currentDate = (d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate())\n var emitter = new events.EventEmitter();\n unirest.get('http://api.amp.active.com/v2/search/?query=hiking&query=marathon&query=cycling&query=climbing&query=marathon&near=' + data + '&radius=80&country=United+States&current_page=1&per_page=15&kids=false&start_date=' + currentDate + '..&sort=date&api_key=c7uavra377u4dbmbkhs7h52h')\n .header(\"Accept\", \"application/json\")\n .end(function (result) {\n if (result.ok) {\n emitter.emit('end', result.body);\n }\n //failure scenario\n else {\n emitter.emit('error', result.code);\n }\n });\n return emitter;\n}", "function receiveData(once) {\n var ajax = new XMLHttpRequest();\n ajax.onreadystatechange = function () {\n // noinspection EqualityComparisonWithCoercionJS\n if (this.readyState == 4 && this.status == 200) {\n var re = /(var values = new Array[^;]*;)/,\n match = ajax.responseText.match(re);\n if (!match) {\n handleError();\n } else {\n // evaluate values\n eval(match[1]);\n //noinspection JSUnresolvedVariable\n var v = values;\n if (!v) {\n handleError();\n } else {\n handleValues(v);\n // set old values\n oldValues = v;\n // set old date\n oldDate = new Date();\n document.getElementById('updated').innerHTML = 'Last updated ' + dateToString(oldDate);\n }\n }\n var int = wrt.interval;\n if (!once && int > 0) reschedule(int);\n }\n };\n ajax.open('GET', basePath + '/usage_data', true);\n ajax.send();\n }", "function readData(path){\n\t\t\n\t\tfirebase.database().ref(path)\n\t\t.on('value',function(snapshot){\n\n\t\t\tcontext.succeed(snapshot.val());\n\t\t})\n\t}", "function fetchData(){\n console.log('Fetching events at ' + Date.now());\n const CORNELL_EVENTS_URL = url.format('http://events.cornell.edu/calendar.xml');\n request(CORNELL_EVENTS_URL, function (error, response, body) {\n if (!error && response.statusCode == 200) {\n parseString(body.toString(), function (err, result) {\n //Store the data in mongo\n updateData( formatData( result.rss.channel[0].item ) );\n });\n } else {\n console.error('Error in grabbing calendar data');\n console.error(error);\n if (!error){\n console.error('Response Code: ' + response.statusCode);\n }\n }\n });\n}", "getData() {\n \n}", "function gotRawData(thedata) {\n println(\"gotRawData\" + thedata);\n}", "function gotRawData(thedata) {\n println(\"gotRawData\" + thedata);\n}", "function gotRawData(thedata) {\n println(\"gotRawData\" + thedata);\n}", "function getData() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.testDataAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "function getAndProcessData() { \n\t\tchooseFileSource();\n\t}", "function getData(data) {\n return data;\n}", "function getData(data) {\n return data;\n}", "static io_getmediadata(filename, offset, length, fcn) {\n if (window.Settings.enableLog)\n WebUtils.log(\"Web.io_getmediadata({0},{1},{2})\".format(filename, offset, length));\n Database.getmediadata(filename, offset, length, fcn);\n }", "getData () {\n if (data) {\n this.data = data;\n this.emit('change', this.data);\n }\n }", "function getData() {\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: 'scripts/data.txt',\n\t\t\tsuccess: function(data) {\n\t\t\t\t$(\"#messageBox\").html(data);\n\t\t\t},\n\t\t\tcomplete: function() {\n\t\t\t\t// Runs the function every .5 seconds\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tgetData();\n\t\t\t\t}, 500);\n\t\t\t}\t\t\n\t\t});\n\t}", "function gotData(data){\n console.log(\"Recieved from the serial port: \" + data);\n sph = data;\n}", "function gotRawData(thedata) {\n\n // println(\"gotRawData\" + thedata);\n}", "function getData() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.tab2dataAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "function readSerialData(data) {\n console.log(data.toString());\n sendit({method: 'data', data: data.toString()});\n}", "read({ note }, res) {\n console.log(\n `${dateFormat(null, \"isoUtcDateTime\")} - REQUEST read [${note.id}]`\n );\n res.json(results);\n broadcast(results);\n }", "function getResourceData(current){\n\n urlopen.open (current, function (error, response) {\n \n if (error) {\n // an error occurred during reading the file\n session.output.write (\"urlopen error: \" + JSON.stringify(error));\n } else {\n\n response.readAsJSON(function(err, jsonResponse) {\n if (err) throw err;\n\n DetailsArray.push(jsonResponse);\n\n if (--count < 1) done();\n });\n }\n }); // end of urlopen.open()\n}", "function getData() {\n const apiName = 'sbrestapi';\n const path = '/alerts';\n const myInit = {\n // OPTIONAL\n headers: {}, // OPTIONAL\n };\n\n return API.get(apiName, path, myInit).catch(err => {\n console.log('There has been a problem with your fetch operation: ' + err);\n throw err;\n });\n}", "function getData(callback){\n if(dataCached){\n callback(null, dataCached);\n return;\n }\n\n // getDataFromFile(callback);\n\n storageAdapter.fetch(file, function(err, data){\n dataCached = JSON.parse(data);\n console.log('Data retrieved from file');\n\n callback(null, dataCached);\n });\n}", "function getData(id) {\n // the operations\n}", "function getdata() {\n\n var url = `/data`;\n\n d3.json(url).then(function(xx) {\n\n data = []\n // xx.slice(s, e)\n globaldata = xx;\n unfiltered = xx;\n actual = [], minute = []\n \n makedata();\n})\n}", "function _getDataFromFile(){\n\tvar fileData = _openFIle();\n\treturn fileData;\n}", "async getData() {\n const data = await readFile(this.datafile, 'utf8');\n if (!data) return [];\n return JSON.parse(data);\n }", "getdata() {\n return Observable.create((observer) => {\n socket.on('res', (data) => {\n observer.next(data);\n });\n });\n }", "function RequestLoadGeneralData() {\n\n}", "function myData() {\n retrun;\n}", "function requestServerData()\n {\n sendCommand(\"JSON.stringify(Module_GetLastDataNative('\" + pageInstance.aliases.join(\"','\") + \"'));\", handleServerData);\n }", "get data() {\n return this.getData();\n }", "function getTextAndSounds(){//0 indexed\n\t\treturn $.get(\"http://localhost:4730/data\", function(data){\n\t\t})\n\t}", "async getData() {\n const data = await readFile(this.datafile, \"utf8\");\n return JSON.parse(data).medewerkers;\n }", "read(req, res) {\n const params = req.params\n const query = req.query\n if(query.uid && !validator.isInt(query.uid))\n return respJson(400, 'invalid query: uid')\n if(!params.eid)\n return respJson(400, 'invalid param: eid')\n const opts = {}\n opts.event_id = params.eid\n const uri = vstr(url, 5, query.uid || 1)\n return _fetch(uri, opts).then(resp=>res.json(fmtResp(resp)))\n }", "function gotAllData(err) {\n console.log(\"gotAllData()\");\n // report an error, you’d want to do something better than this in production\n if (err) {\n console.log(\"error loading data\");\n console.error(err);\n return;\n }\n // call function to show the data\n showData();\n}", "function retriveData() {\r\n jqueryNoConflict.getJSON(dataSource, renderLocationScreen);\r\n }", "function readSensorData() {\n \t bme280.readSensorData()\n .then((data) => {\n // temperature_C, pressure_hPa, and humidity are returned by default.\n temperature = data.temperature_C + 273.15;\n pressure = data.pressure_hPa * 100;\n humidity = data.humidity / 100;\n dewPoint = calculateDewpoint(data.temperature_C, humidity);\n\n //console.log(`data = ${JSON.stringify(data, null, 2)}`);\n\n // create message\n var delta = createDeltaMessage(temperature, humidity, pressure, dewPoint)\n\n // send temperature\n app.handleMessage(plugin.id, delta)\n\n })\n .catch((err) => {\n console.log(`BME280 read error: ${err}`);\n });\n }", "function getData(data) {\n dataActivity = data.activity;\n dataType = data.type;\n dataAccessibility = data.accessibility;\n dataPrice = data.price;\n dataParticipants = data.participants;\n}", "getData(socketId, eventType, callback) {\n try {\n config.redisClient.get(`cb-socket-${socketId}-data${eventType}`, (err, reply) => {\n callback(err, JSON.parse(reply));\n });\n } catch (err) {\n winston.log('error', {\n error: String(err),\n stack: new Error().stack,\n });\n }\n }", "function getData() {\n var queryParams = {\n propertySelection: \"179,7,10888003,8,\" + $scope.cfg.fieldIdToDisplay,//, // ids of fields to fetch\n queryExpression: \"'7' != 3\" //Status is not rejected\n //queryExpression: \"'8' != developer\" //Status is not rejected\n };\n\n var foo = rxRecordInstanceDataPageResource.withName($scope.cfg.recordDefinitionName);\n foo.get(100, 0, queryParams).then(\n function (allRecords) {\n $scope.myData = allRecords.data;\n }\n );\n }", "function doGet()\n{\n return getParsedDataDisplay();\n}", "function dataLoaded(err,data,m){\n}", "function serialEvent() {\n inData = Number(serial.read());\n}", "function init(){\n getData();\n}", "function getData() {\n let name = qs(\"select\").value;\n let url = URL_BASE + name + \"/\";\n fetch(url)\n .then(checkStatus)\n .then(response => response.json())\n .then(genData)\n .catch(handleError);\n }", "function read(endpoint, Oid, i, Rid, callback)\n{\n\tlwm2mServer.getDevice(endpoint, function (num, device) {\n\t\tvar cb;\n\t\tif (device === undefined){\n\t\t\treturn;\n\t\t}\n\t\tif (callback) {\n\t\t\tcb = callback;\n\t\t} else {\n\t\t\tcb = function (err, res) {\n\t\t\t\tconsole.log(err);\n\t\t\t\thandleResult(endpoint+\":\"+Oid+\"/\"+i+\"/\"+Rid+\"\\t\"+res)(err);\n\t\t\t};\n\t\t}\n\t\tlwm2mServer.read(device.id, Oid, i, Rid, cb);\n});\n}", "function getData() {\n\t\t// Set data values\n\t\t$(\"label\").html(\"Auto Refresh <span class='subtle'>- every \" + REFRESH_RATE/1000 + \" seconds</span>\");\n\t\treturn $.getJSON(SEPTA_URL, dataOptions, displayData);\n\t}", "function getTrackData(fi,chrname,cb) {\n request(fi, function (err, response, body) {\n if (err) return cb(null,null,err);\n return cb(JSON.parse(body),chrname,null);\n });\n}", "readall() {\n let obj = this.read();\n while (!this.done()) obj = this.read();\n return obj;\n }", "read() {}", "onDataChange() {}", "function readData( data ){\n\tlet user_cmd, args, user_cmd_args = data.toString().trim().split(\" \");\n\t// Index 0 will be the cmd and the rest are arguments\n\t[ user_cmd, ...args ] = user_cmd_args; \n\t\n\texecuteCmd( user_cmd, args);\n}", "function readFromDbHandler() {\n var request = indexedDB.open('workerDB');\n var db;\n\n request.onerror = function(err) {\n alert(\"Why didn't you allow my web app to use IndexedDB?!\", err);\n };\n\n request.onsuccess = function(event) {\n db = event.target.result;\n\n db.transaction('devices').objectStore('devices').get(1).onsuccess = function(event) {\n dataHeader.textContent = event.target.result.type;\n };\n };\n }", "function read(id) {\n if (id) {\n return service.datasource.get({ id : id });\n }\n\n service.requests = service.datasource.query();\n return service.requests;\n }", "function do_read() {\n var buf = buffer.slice(offset, offset + length);\n libjs.readAsync(fd, buf, function (res) {\n if (res < 0)\n callback(Error(formatError(res, 'read')));\n else\n callback(null, res, buffer);\n });\n }", "loadData( event, callback ) {\n\n\t\treturn callback( null, {} );\n\n\t}", "function getEventInformation(req, res) {\n\n\tlet eventName = req.query.eventName;\n\n\tif(eventName === undefined) {\n\n\t\treturn res.status(400).json({\n\t\t\tsuccess:false,\n\t\t\tmessage: \"Usage: [GET] eventName=name\"\n\t\t})\n\t}\n\n\tlet x = eventName;\n\teventName = eventName.toLowerCase();\n\n\tdb.child(eventDescription).once('value')\n\t.then((snapshot) => {\n\n\t\tlet allData = snapshot.val();\n\n\t\tfor(let category in allData) {\n\n\t\t\tfor(let event in allData[category]) {\n\n\t\t\t\tlet name = event.toLowerCase();\n\t\t\t\tif(eventName === name) {\n\n\t\t\t\t\t// caching = 12hr (server), 6hr (browser)\n\t\t\t\t\tres.set('Cache-Control', 'public, max-age=21600 , s-maxage=43200');\n\t\t\t\t\treturn res.status(200).json({\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tdata: allData[category][event]\n\t\t\t\t\t})\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn res.status(404).json({\n\t\t\tsuccess: false,\n\t\t\tmessage: `${x} event not found`\n\t\t})\n\t})\n\t.catch((err) => {\n\n\t\treturn res.status(500).json({\n\t\t\tsuccess: false,\n\t\t\tmessage: \"could not fetch event description\",\n\t\t\terr: err\n\t\t})\n\t})\n\n}", "function getData(){\t\r\nvar data;\r\nvar jsonurl = './tnow.json';\r\n$.ajax({\r\n\ttype: \"GET\",\r\n\turl: jsonurl,\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Daten-Stream url\r\n\tdata: data,\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Variable für json Container\r\n\tasync: true,\t\t\t\t\t\t\r\n\tdataType: \"json\",\r\n\tsuccess: function(data){\t\t\t\t\t\t\t\t\t\t// nur ausführen wenn getJson (hier ajax) erfolgreich war sonst zu error:\t\r\n\tlogger('get ./tnow.json');\r\n\tcelsius = data.temperature_record;\r\n\tgrenze();\r\n\t},\r\n\t//error: function(){alert('Der Server antwortet nicht!'); schalter = \"error\";}\r\n\t});\t\r\n}", "function testGet(sender) {\n return http.get({\n // host: 'jsonplaceholder.typicode.com',\n // path: '/posts'\n\t \n\t host: 'api.myjson.com',\n path: '/bins/2gmu8'\n },\n\n function(response) {\n // Continuously update stream with data\n var body = '';\n response.on('data', function(d) {\n body += d;\n });\n \n response.on('end', function() {\n\t\t//console.log(body[0].fName)\n\t\tconsole.log(body)\n\t\t//console.log(body.no)\n\t\tget_object = JSON.stringify(body)\n\t\t//var print = body[0].fName // ERROR : undifined \n\t\tvar print = body.fName\n\t\tconsole.log(print)\n\t\tsendTextMessage(sender, get_object)\n\t\tsendTextMessage(sender, body)\n\t\t//sendTextMessage(sender, print) ERROR : Invalid data\n // Data reception is done, do whatever with it!\n var parsed = JSON.parse(body);\n \n });\n \n });\n}" ]
[ "0.74353325", "0.71248376", "0.68410105", "0.6817295", "0.66842294", "0.6579573", "0.65628755", "0.6562308", "0.6497682", "0.6447957", "0.64449716", "0.64377874", "0.640069", "0.6390636", "0.6384874", "0.6331476", "0.63095504", "0.63089216", "0.63018715", "0.62390536", "0.62390536", "0.6215889", "0.6215889", "0.6212964", "0.6208419", "0.6152916", "0.61227626", "0.61189544", "0.6106229", "0.6099021", "0.60748655", "0.60634184", "0.60634184", "0.60634184", "0.6058187", "0.6058187", "0.60480696", "0.6045098", "0.60433966", "0.60398585", "0.6034204", "0.6033084", "0.60265815", "0.6026397", "0.6025154", "0.6008272", "0.5988175", "0.59698415", "0.59698415", "0.59620243", "0.5957855", "0.5944791", "0.5938419", "0.59346575", "0.5930169", "0.5928716", "0.592443", "0.59213805", "0.5921184", "0.5910385", "0.59080285", "0.58983886", "0.5888362", "0.5886605", "0.588566", "0.5870379", "0.58698976", "0.5861568", "0.5849373", "0.5846744", "0.58458835", "0.58401626", "0.5838331", "0.5824785", "0.58110183", "0.58011425", "0.57972586", "0.5795663", "0.5776336", "0.57743657", "0.57653487", "0.5764995", "0.57618093", "0.575688", "0.5754124", "0.5739246", "0.5737616", "0.57365793", "0.57318914", "0.57309085", "0.57279193", "0.57252276", "0.5722661", "0.5714856", "0.57098544", "0.57088363", "0.5700192", "0.5691717", "0.56772083", "0.5671503", "0.56714654" ]
0.0
-1
> UPDATE OPEN EDIT FORM
function editPet(id) { db.collection("pets").doc(id).get().then(snapshot => { var pet = Object.assign(snapshot.data()); $($("#edit-pet input")[1])[0].value = pet.name; $($("#edit-pet input")[2])[0].value = pet.dob; $($("#edit-pet input")[3])[0].value = pet.sex; $($("#edit-pet input")[4])[0].value = pet.breed; $($("#edit-pet input")[5])[0].value = pet.weight; $("#edit-pet-popup").fadeIn(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _edit() {\n $('name').value = this.name;\n $('key').value = this.key;\n $('action').value = this.action;\n switchToView('edit-form');\n}", "function update_entity_edit() {\n var form_record = Domain.entities[current_entity];\n Forms.init(form_record);\n update_edit_form_display();\n}", "function edit() {\n\trow = $(this).closest(\"tr\"); // Table row that contains the experiment data\n\t$(\"#descr\").val($(\"td:eq(0)\", row).html());\n\t$(\"#expid\").val($(\"td:eq(1)\", row).html()); // Experiment id \n\t$(\"#videourl\").val($(\"td:eq(2)\", row).html());\n\t$(\"#controls\").val($(\"td:eq(3)\", row).html());\n\t$(\"#question\").val($(\"td:eq(4)\", row).html());\n\t$(\"#info\").val($(\"td:eq(5)\", row).html());\n\t$(\"#submit\").val(\"Update\"); // Submit button label\n\t$(\"#action\").val(\"1\"); // Action code for an update\n\t$(\"#videoinfo\").overlay().load(); // Open form as an overlay\n\ttoControls($(\"#controls\").val()); // Fill form controls\n}", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "async edit ({ params, request, response, view }) {\n }", "function openEditDialog(e, eForm) {\n e.preventDefault();\n // Show the dialog\n overlay.classList.remove('visibility');\n //Disable the scrollbar\n document.body.classList.add('model-open');\n // Setting the inputs to the relavent fields\n editDialogUid.value = eForm.elements['uid'].value;\n editDialogHiddenUid.value = eForm.elements['uid'].value;\n editDialogUsername.value = eForm.elements['username'].value;\n editDialogEmail.value = eForm.elements['email'].value;\n editDialogMobile.value = eForm.elements['mobile'].value;\n editDialogAddress.value = eForm.elements['address'].value;\n}", "function ep_Edit() {\n // set the refresh flag\n\tnlapiSetFieldValue('custpage_2663_edit_mode', 'T', false);\n nlapiSetFieldValue('custpage_2663_refresh_page', 'T', false);\n \n // suppress the alert\n setWindowChanged(window, false);\n \n // submit the form -- calls submitForm function\n document.forms.main_form.submit();\n}", "edit() {\n this._enterEditMode();\n }", "function openFormEditKienNghi() {\n showLoadingOverlay(modalIdKienNghi + \" .modal-content\");\n $.ajax({\n type: \"GET\",\n url: editKienNghiUrl,\n data: {\n id: HoSoVuAnID\n },\n success: function (response) {\n $(modalIdKienNghi + \" .modal-content\").html(response);\n\n hideLoadingOverlay(modalIdKienNghi + \" .modal-content\");\n }\n });\n }", "function edit(idx) {\n let fl = fullList[idx];\n document.querySelector(\".item2\").value = fl.item;\n document.querySelector(\".textarea2\").value = fl.info;\n document.querySelector(\".form2\").style.display = \"flex\";\n modal.classList.add(\"open\");\n position = idx;\n}", "function editMode() {\n name.html('<input value=\"' + name.html() + '\"></input>');\n details.html('<input value=\"' + details.html() + '\"></input>');\n actions.html('<button type=\"button\" class=\"btn btn-default btn-xs submit-btn\"><span title=\"Submit\" class=\"glyphicon glyphicon-ok\"></span></button>'\n + '<button type=\"button\" class=\"btn btn-default btn-xs cancel-btn\"><span title=\"Cancel\" class=\"glyphicon glyphicon-remove\"></span></button>');\n }", "function click_edit() {\n\t document.getElementById('submit_edit_paciente').click();\n\t}", "function editClicked() {\n edit = true;\n}", "function openEdit(div, form){\n\tdiv.style.display = \"none\";\n\tform.style.display = \"block\";\n}", "function openEdit(div, form){\n\tdiv.style.display = \"none\";\n\tform.style.display = \"block\";\n}", "async edit({ params, request, response, view }) {}", "function edit() {\n // Update view.\n ctrl.showEditCommitmentForm(scope.commitment);\n }", "function edit() {\n // Update view.\n ctrl.showEditCommitmentForm(scope.commitment);\n }", "edit() {\n }", "function edit(ins_id, q_id) {\n if(!isEdit){\n let componentId = getComponentId(\"preview_\" + q_id);\n enableQuestion(componentId);\n $(\"#update_\" + q_id).removeClass('d-none').addClass('d-block');\n isEdit = true;\n }else{\n warningModal(mustFinishUpdate);\n }\n \n}", "function editar() {\n\n\t$('#mdlAgendamento').modal('toggle');\n\t$('#mdlVerAgendamento').modal('hide');\n\n}", "function editopen(id, url) {\n\t$('#idedit').val(id);\n\t$('#urledit').val(url);\n}", "function edit() {\r\n DlgHelper.AjaxAction(\"/schedule/edit/\", \"POST\", function (data) {\r\n\r\n if (data != null && data != \"\") {\r\n refresh().done(function () { DlgHelper.ShowDialog(\"Изменено: \" + data); });\r\n } else {\r\n DlgHelper.ShowDialogError(\"Неверный ввод...\", 2000);\r\n }\r\n\r\n });\r\n }", "function handleEdit() {\n console.log(\"yes\");\n var currentEntry = $(this).parent(\"td\").parent(\"tr\").data(\"tableRow\");\n console.log(currentEntry);\n window.location.href = \"/update/\" + currentEntry\n }", "function edit() {\n $('#productInfo').trigger('close');\n show(\"editProduct\");\n}", "function openModalEdit() {\n modalEdit.style.display = \"block\"\n }", "function editHistorico(){\r\n submitForm($('#formHistorico').get(0), getContextApp()+'/proposta/editar.action', false);\r\n}", "function fhArrival_editMode() {\n\n\tjQuery('.fhArrival_viewMode').hide();\n\t\n\tjQuery('.fhArrival_viewField').each(function () {\n\t\tvar editField = jQuery(this).attr('data-view-for');\n\t\tjQuery('#' + editField).val(jQuery(this).html());\n\t})\n\t\n\tjQuery('.fhArrival_editMode').show();\n\t\n\tfhArrival_data.currentMode = \"EDIT\";\n\t\n}", "function updateEditPage () {\n\n var nameMap = table.makePermissionMap(true);\n\n // todo: refactor these doubled 4 lines of code.\n // todo: refactor this doubled line of comments.\n var viewSummaryDiv = $(\"#permissions-view-summary\");\n var viewNames = [].concat(nameMap.group.view).concat(nameMap.user.view);\n if (viewNames.length) viewSummaryDiv.find(\".summary-content\").text(viewNames.join(\", \"));\n AJS.setVisible(viewSummaryDiv, viewNames.length);\n\n var editSummaryDiv = $(\"#permissions-edit-summary\");\n var editNames = [].concat(nameMap.group.edit).concat(nameMap.user.edit);\n if (editNames.length) editSummaryDiv.find(\".summary-content\").text(editNames.join(\", \"));\n AJS.setVisible(editSummaryDiv, editNames.length);\n\n /**\n * Updates the hidden fields that submit the edited permissions in the form. The fields are updated with the\n * data in the Permissions table.\n */\n permissionManager.permissionsEdited = false;\n var permissionStrs = permissionManager.makePermissionStrings();\n for (var key in permissionStrs) {\n var updatedPermStr = permissionStrs[key];\n $(\"#\" + key).val(updatedPermStr);\n\n if (permissionManager.originalPermissions[key] != updatedPermStr) {\n permissionManager.permissionsEdited = true;\n }\n }\n }", "function updateEditPage () {\n\n var nameMap = table.makePermissionMap(true);\n\n // todo: refactor these doubled 4 lines of code.\n // todo: refactor this doubled line of comments.\n var viewSummaryDiv = $(\"#permissions-view-summary\");\n var viewNames = [].concat(nameMap.group.view).concat(nameMap.user.view);\n if (viewNames.length) viewSummaryDiv.find(\".summary-content\").text(viewNames.join(\", \"));\n AJS.setVisible(viewSummaryDiv, viewNames.length);\n\n var editSummaryDiv = $(\"#permissions-edit-summary\");\n var editNames = [].concat(nameMap.group.edit).concat(nameMap.user.edit);\n if (editNames.length) editSummaryDiv.find(\".summary-content\").text(editNames.join(\", \"));\n AJS.setVisible(editSummaryDiv, editNames.length);\n\n /**\n * Updates the hidden fields that submit the edited permissions in the form. The fields are updated with the\n * data in the Permissions table.\n */\n permissionManager.permissionsEdited = false;\n var permissionStrs = permissionManager.makePermissionStrings();\n for (var key in permissionStrs) {\n var updatedPermStr = permissionStrs[key];\n $(\"#\" + key).val(updatedPermStr);\n\n if (permissionManager.originalPermissions[key] != updatedPermStr) {\n permissionManager.permissionsEdited = true;\n }\n }\n }", "function openUpdate(id) {\n setIsPut(true);\n setUpdatedItem((prevInput) => {\n return {\n ...prevInput,\n id: id,\n };\n });\n }", "function EditRecordAsComponent(id) {\n document.getElementById('cmsform').target = '_self';\n document.cmsform.id.value = id;\n document.cmsform.pagedef.value = 'tableeditorPopup';\n document.cmsform.submit();\n}", "function runEdit() {\n $(RUN_EDIT).val($(GITHUB_URL).attr('href'));\n $(RUN_EDIT_FORM).submit();\n }", "function runEdit() {\n $(RUN_EDIT).val($(GITHUB_URL).attr('href'));\n $(RUN_EDIT_FORM).submit();\n }", "function printFormEdit() {}", "function runEdit() {\n $(RUN_EDIT).val($(GITHUB_URL).attr('href'))\n $(RUN_EDIT_FORM).submit();\n }", "function edit(){\n\t\treturn M.status == 'edit';\n\t}", "function editForm(username, form_id) {\n const form = getForm(username, form_id, true);\n const lastUpdate = new Date(form.last_updated * 1000);\n const lastUpdated = `${lastUpdate.getDate()}/${lastUpdate.getMonth()}/${lastUpdate.getFullYear()} at ${lastUpdate.getHours()}:${lastUpdate.getMinutes()}:${lastUpdate.getSeconds()}`;\n let html = `<h3>${form.form_name}</h3><small><em>Last updated: ${lastUpdated}</em></small><hr>`;\n html += formConstructor(form, $);\n $(\"#form-preview\").html(html);\n initTooltips();\n }", "function displayEditForm(id) {\n\n const item = reviews.find(item => item[\"entityId\"] === id.toString()); // finds the item that the id is associated with.\n\n document.getElementById('edit-id').value = item.entityId // sets the table id value equal to the value specified.\n document.getElementById('edit-message').value = item.message; // sets the table message value equal to the value specified.\n document.getElementById('edit-starRating').value = item.starRating; // sets the table starRating value equal to the value specified.\n document.getElementById('edit-filePath').value = item.imagePath; // sets the table filepath value equal to the value specified.\n document.getElementById('editForm').style.display = 'block'; // sets the table dispaly value to block.\n}", "function editGo(id) {\r\n db.readTransaction(function(t) {\r\n t.executeSql('SELECT * FROM Contacts WHERE id = ?', [id], function(t, r) {\r\n var row = r.rows.item(0);\r\n if(row) {\r\n var f = element('contForm');\r\n f.elements['lastname'].value = row.lastname;\r\n f.elements['firstname'].value = row.firstname;\r\n f.elements['email'].value = row.email;\r\n f.elements['goButton'].value = 'Update';\r\n f.elements['inputAction'].value = 'update';\r\n f.elements['key'].value = row.id;\r\n f.elements['lastname'].select();\r\n }\r\n });\r\n });\r\n}", "function editForm(famID) {\n // Show the parent form\n $('.add-parent-popup').show();\n $('.overlay').show();\n $('#add-button').hide();\n $('#edit-button').show();\n $(\"#header\").text(\"Edit Parent(s)\");\n $(\"#pin-label\").text(\"PIN #:\")\n $(\"#sign-instructions\").text(\"Please make any changes and click Save Changes.\");\n document.getElementById(\"PIN\").required = false;\n\n // Populate with selected family data\n populateParentData(famID);\n}", "function showEditForm(){\nfrmEditProfile.show();\n}", "showEdit() {\n this.closeFoldersInputs.closeAllInputs();\n this.folder.set('isEdit', true);\n this.set('errors', null);\n }", "function editarFormulario(){\n //Trae la grid para poder actualizar al editar\n listadoCamposFormulario = Ext.getCmp('listadoCamposFormulario');\n if (listadoCamposFormulario.getSelectionModel().hasSelection()) {\n var row = listadoCamposFormulario.getSelectionModel().getSelection()[0];\n \n\n encontrado=1;\n if(ventana==null) \n ventana = Ext.create ('App.miVentanaBanco');\n\n // Precarga el nombre e id seleccionados\n Ext.getCmp('nombreBanco').setValue(row.get('nombre'));\n Ext.getCmp('idBanco').setValue(row.get('id'));\n\n\n ventana.show();\n \n }\n }", "function handle_remote_update() {\n update_edit_form_display()\n //update_entity_tee(current_entity, current_id);\n}", "function Swall_Edit(){\n\n\n}", "function edit(val) {\n resetAll();\n try {\n var data = JSON.parse(val[1]);\n if (val[0] != \"0\") {\n fillControlsFromJson(data[0]);\n \n if (data[0].image != \"\" && data[0].image != null) {\n $(\"#divuploadimage img\").prop(\"src\", data[0].image);\n $(\"#imgItemURL\").prop(\"src\", data[0].image);\n } else {\n $(\"#divuploadimage img\").prop(\"src\", \"\");\n $(\"#imgItemURL\").prop(\"src\", \"\");\n }\n $(\"#cmdSave\").prop(\"CommandArgument\", \"Update\");\n $(\"#lblmainid\").val( data[0].id);\n if (formOperation == \"update\") {\n setformforupdate();\n formOperation = \"\";\n }\n implementers.GetWorkerInfo(data[0].id, function (val) {\n if (val[0] == \"1\") {\n var data = JSON.parse(val[1]);\n $(\"#user_nm\").val(data[0].User_Name);\n $(\"#password\").val(data[0].User_Password);\n } else {\n $(\"#user_nm\").val(\"\");\n $(\"#password\").val(\"\");\n }\n });\n } else {\n showErrorMessage(\"No data found !!\");\n }\n } catch (err) {\n alert(err);\n }\n}", "function edit() {\n\tdocument.getElementById(\"editbtn\").disabled = true;\t\t//Prevent sapm or misclick\n\t$.ajax({\n\t\turl: getapi(),\n\t\ttype: \"POST\",\n\t\tdata: {\n\t\t\tedit:$('#idedit').val(),\n\t\t\turl:$('#urledit').val()\n\t\t},\n\t\tsuccess:function(){\n\t\t\t$('#status').css('display','inline');\n\t\t\t$('#status').attr('class','alert alert-success');\n\t\t\t$('#status').html('Success!');\n\t\t\tsetTimeout(function(){\n\t\t\t\tlocation.reload();\n\t\t\t},2000);\n\t\t},\n\t\terror:function(xhr){\n\t\t\tvar err = eval(\"(\" + xhr.responseText + \")\");\n\t\t\t$('#status').css('display','inline');\n\t\t\t$('#status').attr('class','alert alert-danger');\n\t\t\t$('#status').html(err.error);\n\t\t\tdocument.getElementById(\"editbtn\").disabled = false;\n\t\t}\n\t});\n}", "function setEditForm(that) {\n $('#currency').val(that.attr('data-currency'));\n $('#input-exchange-rate').val(that.attr('data-value'));\n $('#save-exchange-rate').attr('data-rid', that.attr('data-rid'));\n $('#frm-exchange').attr('title', 'Update exchange rate');\n $('#save-exchange-rate').val('Update');\n}", "function edit(val) {\n resetAll();\n try {\n var data = JSON.parse(val[1]);\n if (val[0] != \"0\") {\n fillControlsFromJson(data[0]);\n \n if (data[0].image != \"\" && data[0].image != null) {\n $(\"#divuploadimage img\").prop(\"src\", data[0].image);\n $(\"#imgItemURL\").prop(\"src\", data[0].image);\n } else {\n $(\"#divuploadimage img\").prop(\"src\", \"\");\n $(\"#imgItemURL\").prop(\"src\", \"\");\n }\n $(\"#cmdSave\").prop(\"CommandArgument\", \"Update\");\n $(\"#lblmainid\").val( data[0].id);\n if (formOperation == \"update\") {\n setformforupdate();\n formOperation = \"\";\n }\n //implementers.GetWorkerInfo(data[0].id, function (val) {\n // if (val[0] == \"1\") {\n // var data = JSON.parse(val[1]);\n // $(\"#user_nm\").val(data[0].User_Name);\n // $(\"#password\").val(data[0].User_Password);\n // } else {\n // $(\"#user_nm\").val(\"\");\n // $(\"#password\").val(\"\");\n // }\n //});\n } else {\n showErrorMessage(\"No data found !!\");\n }\n } catch (err) {\n alert(err);\n }\n}", "function fnEdit(strUrl)\n{\t\n $(\"#\"+gridTableId).delegate('a.edit', 'click', function (e) {\n e.preventDefault();\t\t\n\t\t$('#frmForm').bootstrapValidator(\"resetForm\",true); \n iActiveID = $(this).attr(\"row-id\");\n clearForm(\"frmForm\");\n\t\t$(\"#display_img\").removeClass('hide');\n\t\t$(\"#type_id\").removeClass('hide');\n\t\t$(\"#sh\").removeClass('hide');\n\t\t$('#langFormTabs a:first').tab('show').trigger('click');\n\t\t$(\"#youtube_form\").addClass('hide');\n\t\t$(\"#sms_form\").addClass('hide');\n populateEditEntries(iActiveID, strUrl);\n glbControlEnable(true);\n\t\t$('ul#langFormTabs li').each(function(){\n\t\t $(this).find('i').removeClass('fa-check').removeClass('fa-times');\n\t\t});\n\t\t\n });\n\n}", "openUpdate(id) {\n this.setState({\n type_modal: 'update',\n id_current: id\n });\n let name_pk = this.props.pk_key;\n let detail = _.clone(_.find(this.state.data, { [name_pk]: id }));\n Object.keys(detail).forEach(function (item) {\n detail[item] = (detail[item] === null) ? '' : detail[item];\n });\n this.setState({\n row_current: detail\n });\n this.toggleModal();\n }", "function help_edit(id, tit_es, tit_en, cnt_es, cnt_en) {\n\n $('#help_edit').modal('show');\n $('#title_spanish').val(tit_es);\n $('#title_english').val(tit_en);\n $('#cont_spanish').val(cnt_es);\n $('#cont_english').val(cnt_en);\n $('#help_id').val(id);\n\n}", "function editAnswer(value) {\n setId(value.id); \n setEditQuestion(value.question); \n setFlag(true); //making flag as true to display input field\n }", "function editCommandButton() {\n if (commandHasChanges()) {\n //changes -> öffne modal\n $('#resetButtonChanges').attr(\"onclick\", \"$('#uncommitedChangesModal').modal('hide');\");\n $('#discardChangesButton').attr(\"onclick\", \"editCommand()\");\n $('#uncommitedChangesModal').modal('show');\n } else {\n editCommand();\n }\n}", "function EditButton(props) {\n const [open, setOpen] = useState(false);\n\n const handleClickOpen = () => {\n setOpen(true);\n };\n const handleClose = () => {\n setOpen(false);\n };\n const handleAccept = (values) => {\n props.edit(props._id, values);\n setOpen(false);\n setTimeout(() => props.update(), 400);\n };\n return (\n <div>\n <Button size=\"small\" onClick={handleClickOpen}>\n Edit\n </Button>\n <MyForm\n open={open}\n handleClose={handleClose}\n title=\"Edit This Course\"\n submit={handleAccept}\n {...props}\n />\n </div>\n );\n}", "@action\n editRow() {\n set(this, 'isEditRow', true);\n }", "function openEditModal(callFrom) {\n $(\"#title-upload\").val($(\"#\" + callFrom + \"-title\").val());\n $(\"#year-upload\").val($(\"#\" + callFrom + \"-year\").val());\n $(\"#author-upload\").val($(\"#\" + callFrom + \"-author\").val());\n $(\"#category-search\").val($(\"#\" + callFrom + \"-category\").val());\n $(\"#textbook-id\").val($(\"#\" + callFrom + \"-id\").val());\n $(\"#modal-edit\").modal();\n}", "editExisting(inID) {\n\n // Get the task from local storage and set it on the form. If we can't\n // find it then that means the user clicked a category node. In that case,\n // we're just going to toggle it's open/close state.\n const tasks = JSON.parse(localStorage.getItem(\"TasksDB\"));\n const task = tasks[inID];\n if (!task) {\n if ($$(\"moduleTasks-items\").isBranchOpen(inID)) {\n $$(\"moduleTasks-items\").close(inID);\n } else {\n $$(\"moduleTasks-items\").open(inID);\n }\n return;\n }\n\n // Set flag to indicate editing an existing task and show the details.\n wxPIM.isEditingExisting = true;\n wxPIM.editingID = inID;\n\n // Clear the details form.\n $$(\"moduleTasks-detailsForm\").clear();\n\n // Show the form. Note that this has to be done before the call to\n // setValues() below otherwise we get an error due to setting the value of\n // the richtext (my guess is it lazy-builds the DOM and it's not actually\n // there until the show() executes.\n $$(\"moduleTasks-details\").show();\n\n // Special handling for dates.\n if (task.dueDate) {\n task.dueDate = new Date(task.dueDate);\n }\n\n // Populate the form.\n $$(\"moduleTasks-detailsForm\").setValues(task);\n\n // Finally, enable the delete button.\n $$(\"moduleTasks-deleteButton\").enable();\n\n }", "function handleEditButtonPress() {\n var listItemData = $(this).parent(\"td\").parent(\"tr\").data(\"review\");\n var id = listItemData.id;\n // Edit the review via the cms form\n inputReview(id);\n }", "function editRow(rowId) {\n document.getElementById(\"name\").value = studentsArray[rowId].name;\n document.getElementById(\"date\").value = studentsArray[rowId].date;\n document.getElementById(\"status\").value = studentsArray[rowId].status;\n document.getElementById(\"priorty\").value = studentsArray[rowId].priorty;\n let x = document.getElementById(\"update\");\n x.style.display = \"inline\";\n let y = document.getElementById(\"submit\");\n y.style.display = \"none\";\n document.getElementById(\"update\").value = rowId;\n}", "function showEditDiv() {\n\tshowActionDiv('edit');\n}", "handleEdit(id){\n window.location = '/journalists/edit/' + id\n }", "function editSelectedPendInv() {\n PENDINV_ACTION = 'updatePendInv';\n displayPendInvWell();\n fillPendInvWell(SELECTED_PENDINV_ID);\n}", "function displayEditForm() {\n\t\tlet courseId = $(this).attr('data-id');\n\t\tlet editForm = $('#editCourseForm');\n\n\t\tcoursesService.loadCourseById(courseId)\n\t\t\t.then((courseInfo) => {\n\t\t\t\teditForm.find('input[name=\"imageUrl\"]').val(courseInfo['imageUrl']);\n\t\t\t\teditForm.find('input[name=\"price\"]').val(courseInfo['price']);\n\t\t\t\teditForm.find('input[name=\"duration\"]').val(courseInfo['duration']);\n\t\t\t\teditForm.find('input[name=\"place\"]').val(courseInfo['place']);\n\t\t\t\teditForm.attr('data-id', courseInfo._id);\n\t\t\t\teditForm.attr('data-authorId', courseInfo.authorId);\n\t\t\t\teditForm.attr('data-categoryId', courseInfo.categoryId);\n\t\t\t\teditForm.attr('data-likes', courseInfo.likes);\n\t\t\t\teditForm.attr('data-views', courseInfo.views);\n\t\t\t\teditForm.find('textarea[name=\"description\"]').val(courseInfo['description']);\n\t\t\t\tshowView('CourseEdit');\n\t\t\t}).catch(handleError);\n\n\t}", "onClickEditMode() {\n\t\teventEmitter.emit(EVENTS.ToggleEditMode, this.Controls.EDIT_MODE);\n\t}", "function openEditProduct(id){\n console.log(\"Value: \" + $(\"#row-\"+id).find('td').eq(0).html());\n var code = $(\"#row-\"+id).find('td').eq(0).html();\n var model = $(\"#row-\"+id).find('td').eq(1).html();\n var brand = $(\"#row-\"+id).find('td').eq(2).html();\n var type = $(\"#row-\"+id).find('td').eq(3).html();\n var category = $(\"#row-\"+id).find('td').eq(4).html();\n var autoCategory = $(\"#row-\"+id).find('td').eq(5).html();\n var quantity = parseInt($(\"#row-\"+id).find('td').eq(6).html());\n\n $(\"#code\").val(code);\n $(\"#model\").val(model);\n $(\"#brand\").val(brand);\n $(\"#type\").val(type);\n $(\"#category\").val(category);\n $(\"#auto\").val(autoCategory);\n $(\"#quantity\").val(quantity);\n\n $(\"#check-container\").css('display', 'none');\n\n $(\"#modal-product\").modal();\n $(\"#btn-save\").attr(\"onclick\",\"updateProduct(\"+id+\")\");\n}", "function clickEdit(eleObj){\n\t$(\"#feedBackTd\").html('');\n\tvar rowID=$(eleObj).closest('tr').attr('id');\n\t$(\"#merchantId\").val($(\"#merchantId\"+rowID).val());\n\t$(\"#locationId\").val($(\"#locationId\"+rowID).val());\n\t$(\"#productId\").val($(\"#productId\"+rowID).val());\n\t$(\"#stockSearch\").attr('action','showEditStock');\n\t$(\"#stockSearch\").submit();\n}", "showEditForm() {\n this.setState({\n edit: true\n });\n }", "function editData(n) {\n setValue(document.getElementById(\"eg\"), n);\n $('#editlink').hide();\n $('#deletelink').hide();\n $('#unapprovelink').hide();\n $('#dtable').hide();\n $('#etable').show();\n}", "function editItem() {\n var value = localStorage.getItem($(this).attr(\"key\"));\n var item = jQuery.parseJSON(value);\n toggleControls(\"off\");\n $('#displayLink').hide();\n $('#rname').val(item.rname[1]);\n $('#dateadded').val(item.dateadded[1]);\n var radios = $('input[name=\"category\"]:checked').val();\n $('#rtype').val(item.rtype[1]);\n $('#ringredients').val(item.ringredients)[1];\n $('#rdirections').val(item.rdirections)[1];\n save.off(\"click\", storeData);\n $('#submit').val(\"Edit Recipe\");\n var editSubmit = $('#submit');\n editSubmit.on(\"click\");\n editSubmit.attr(\"key\", this.key);\n }", "function editForm(id){\n $('#editForm').modal('show');\n console.log(id)\n _roles_list();\n document.getElementById(\"name2\").value = document.getElementById('detail_name').innerHTML;\n document.getElementById(\"email2\").value = document.getElementById('detail_email').innerHTML;\n document.getElementById(\"phone2\").value = document.getElementById('detail_phone').innerHTML;\n document.getElementById(\"role_body2\").value = document.getElementById('detail_role_id').innerHTML;\n}", "function callToEdit()\n{\n\tvar id = $(this).parents('tr').children('td').children('p.editId').attr('editId');\n\t//var id = $(this).children('p.editId').attr('editId');\n\twindow.location.href = HOST_PATH + \"admin/page/editpage/id/\" + id;\n}", "function EditSpecialOffer(id)\n{\n /**\n Open the panel EditSpecialOffer\n */\n current_id = id;\n var name = document.getElementById('special_offer' + current_id + '_name').innerHTML;\n var percentage = document.getElementById('special_offer' + current_id + '_percentage').innerHTML;\n CreateSpecialOfferPanel(name, percentage, COMMAND_EDIT);\n}", "function postEdit(response) {\n\tif (response == \"OK\") {\n\t\talert(\"Successfull update\");\n\t\t$(\"td:eq(0)\", row).html($(\"#descr\").val());\n\t\t$(\"td:eq(2)\", row).html($(\"#videourl\").val());\n\t\t$(\"td:eq(3)\", row).html($(\"#controls\").val());\n\t\t$(\"td:eq(4)\", row).html($(\"#question\").val());\n\t\t$(\"td:eq(5)\", row).html($(\"#info\").val());\n\t}\n\telse\n\t\talert(\"Action failed\");\n}", "function EditRecordInList(id) {\n document.cmsform.id.value = id;\n document.cmsform.submit();\n}", "editWorkAndEducation(){\n\t\tresources.workAndEducationTab().click();\n\t}", "function editItem(id){\n sendRequest(\n 'usergroups',\n {\n 'action': 'getEditItemForm',\n 'id': id\n }, function(data){\n $('#listcontent').css('display','none');\n $('#editorholder').html(data);\n });\n}", "function btnMostraEditarLocalizacion(id){\n\n $(\"#headerLocalizacion\").html('<i class=\"fa fa-edit\"></i> ACTUALIZAR LOCALIZACION PREDIO');\n $('#formLocalizacion')[0].reset();//limpiar formulario\n $.get('localizacionpredio/'+id+'/edit', function (data) {\n $('#name').val(data.name);\n $('#indice').val(data.indice);\n });\n\n $(\"#btnLocalizacion\").attr('class','btn btn-warning');\n $(\"#method_localizacion\").val('PUT');\n $(\"#formLocalizacion\").attr('action','localizacionpredio/'+id);//fijamos laruta para editar window.location.protocol+'//'+window.location.host+'/closet/'+id);\n $(\"#btnLocalizacion\").html('<i class=\"fa fa-save\"></i> Actualizar ');\n $(\"#formModaLocalizacion\").modal('show');\n }", "function editDB(){\n\t\t\t\titem_name_form = document.getElementById(\"item_name\").value;\n\t\t\t\titem_price_form = document.getElementById(\"price\").value;\n\t\t\t\titem_quantity_form = document.getElementById(\"quantity\").value;\n\t\t\t\titem_barcode_form = document.getElementById(\"barcode\").value;\n\n\t\t\t\tsessionStorage.editStatus=\"edit\";\n\t\t\t\tupdateDB(item_name_form,item_quantity_form,item_price_form,item_barcode_form)\n\t\t\t\t\t.then(function(){\n\t\t\t\t\t\tconsole.log(\"updateDB\");\n\t\t\t\t\t})\n\t\t\t\t\t.catch(function(){\n\n\t\t\t\t\t})\n\n\t\t\t}", "function Update() {\n $('.btn_edit').on('click', function () {\n var ID = $(this).siblings('span').attr('data-ID');\n var NAMA = $(this).siblings('span').attr('data-NAMA');\n var PARENTID = $(this).siblings('span').attr('data-PARENTID');\n var KODE = $(this).siblings('span').attr('data-KODE');\n var LEVEL = $(this).siblings('span').attr('data-LEVEL');\n\n $('#edit_ID').val(ID);\n $('#edit_NAMA').val(NAMA);\n $('#edit_PARENTID').val(PARENTID).trigger('change');\n $('#edit_KODE').val(KODE);\n $('#edit_LEVEL').val(LEVEL);\n\n $(\".JudulForm\").text(\"Ubah Data \" + unit);\n $('#btn_simpandatabaru').addClass('hidden');\n $('#btn_ubahdata').removeClass('hidden');\n\n getlevelunit();\n });\n }", "function editrow(nronip, userid) {\n\t// $(window.document.location).attr('href',\n\t// 'index.php?pg=Eventos/listarEventosMilitar/' + nronip + '&user=' +\n\t// userid);\n\t$.messager.show({\n\t\ttitle : 'Título do Dialog',\n\t\tmsg : 'Mensagem simples NIP: ' + nronip,\n\t\tshowType : 'slide',\n\t\tstyle : {\n\t\t\tright : '',\n\t\t\t//top : document.body.scrollTop + document.documentElement.scrollTop,\n\t\t\tbottom : ''\n\t\t}\n\t});\n}", "function editEvent(event){\n var updateButtons = document.getElementsByClassName(\"update\");\n if(updateButtons.length > 0){\n alert(\"Finish modifying before continuing\");\n return;\n }\n var curRow = this.parentElement.parentElement.parentElement; \n // Replace date field -> form input\n var dateInput = document.createElement(\"input\");\n dateInput.setAttribute(\"value\",curRow.children[0].innerText);\n dateInput.setAttribute(\"type\", \"date\");\n dateInput.setAttribute(\"id\",\"update-date\");\n curRow.children[0].innerText = \"\";\n curRow.children[0].appendChild(dateInput);\n\n // Replace name field -> form input\n var nameInput = document.createElement(\"input\");\n nameInput.setAttribute(\"value\",curRow.children[1].innerText);\n nameInput.setAttribute(\"type\", \"text\");\n nameInput.setAttribute(\"id\",\"update-name\");\n curRow.children[1].innerText = \"\";\n curRow.children[1].appendChild(nameInput);\n\n // Replace reps field -> form input\n var repInput = document.createElement(\"input\");\n repInput.setAttribute(\"value\",curRow.children[2].innerText);\n repInput.setAttribute(\"type\", \"text\");\n repInput.setAttribute(\"id\",\"update-patname\");\n curRow.children[2].innerText = \"\";\n curRow.children[2].appendChild(repInput);\n\n // Replace weight field -> form input\n var weightInput = document.createElement(\"input\");\n weightInput.setAttribute(\"value\",curRow.children[3].innerText);\n weightInput.setAttribute(\"type\", \"number\");\n weightInput.setAttribute(\"id\",\"update-time\");\n weightInput.setAttribute(\"class\",\"num-input\");\n curRow.children[3].innerText = \"\";\n curRow.children[3].appendChild(weightInput);\n\n // Replace edit button -> update button\nvar id = this.previousSibling.value;\n curRow.children[5].innerHTML = '';\n var form = document.createElement('form');\n var updateButton = document.createElement('form');\n var inputId = document.createElement('input');\n inputId.setAttribute('type',\"hidden\");\n inputId.setAttribute('value',id);\n var button = document.createElement('input');\n button.setAttribute('type',\"button\");\n button.setAttribute('value', \"Update\");\n button.setAttribute('class', \"update\");\n form.appendChild(inputId);\n form.appendChild(button);\n curRow.children[5].appendChild(form);\n\n // Add click event to newest update button\n button.addEventListener(\"click\", updateEvent, false);\n event.preventDefault();\n}", "function handleEditRow(id){\n\n // show hidden section to update\n const updateSection = document.querySelector('#update-section');\n updateSection.hidden = false;\n\n // add the button data-id\n document.querySelector('#update-row-btn').dataset.id= id;\n const updateNameInput = document.querySelector('#update-name-input');\n updateNameInput.focus();\n\n}", "function competitorEditForm() {\n\t\tvar idWithString = this.id;\n\t\t//substring to get the id only\n\t\tvar id = idWithString.substr(1);\n\t\t// set value to hidden input \n\t\t$('#competitorId').val(id);\n\t\t// get the current row\n\t\tvar currentRow = $(this).closest(\"tr\");\n\t\t///get value\n\t\tvar competitorName = currentRow.find(\"td:eq(0)\").text(); // get current row 1st TD value\n\t\tcompetitorName = competitorName.trim();\n\t\tvar competitorField = currentRow.find(\"td:eq(1)\").text(); // get current row 2nd TD\n\t\tcompetitorField = competitorField.trim()\n\t\tvar competitorDetail = currentRow.find(\"td:eq(2)\").text(); // get current row 3rd TD\n\t\tcompetitorDetail = competitorDetail.trim();\n\n\n\t\t// insert data to form\n\t\t$('#competitorEditName').val(competitorName);\n\t\t$('#competitorEditField').val(competitorField);\n\t\t$('#competitorEditDetail').val(competitorDetail);\n\n\t}", "function DisplayEditDatainForm(obj) {\n debugger;\n var _this = $(obj).closest(\".main-data\");\n $(\"#firstname\").val(_this.find(\"td\").eq(0).html());\n $(\"#lastname\").val(_this.find(\"td\").eq(1).html());\n $(\"#mobileno\").val(_this.find(\"td\").eq(2).html().trim());\n _this.find(\"td\").eq(3).html().trim() == 'Male' ? $('#male').attr('checked', 'checked') : $('#female').attr('checked', 'checked')\n $(\"#borrower_Id\").val(_this.attr(\"data-id\"));\n\n //change Add Button\n $(\".btn-success\").val(\"Edit\");\n}", "function showEditDialog(tempId) {\n // save the ID to local variable\n guid = tempId;\n // create temp object of turtle in array (based on index argument)\n var tTurtle = turtle[tempId];\n //populate the fields\n $('#uname').val(tTurtle.name);\n $('#uweapon').val(tTurtle.weapon);\n $('#uheadband').val(tTurtle.headband);\n $('#uphrase').val(tTurtle.phrase);\n $('#uattack').val(tTurtle.attack);\n $('#myEditModal').modal(\"show\");\n //\n console.log(\"THE TURTLE TO UPDATE:\", tTurtle);\n console.log(\"THE ID for the turtle to update:\", turtleToUpdate);\n\n }", "function editItemById(smid) {\n THK.DB.findByVideoID(smid, function(res){\n if(res==undefined)\n return ;\n \n g_videoEditID = smid;\n \n // popup a edit window\n j_edit_window = j_edit_window || $(\"#edit_window\");\n j_edit_window.fadeIn(200);\n \n var edit_content = $(\"div#edit_content\");\n edit_content.html($(\n '<label>'+_locale[pn]['videoTitle']+'</label> <input id=\"edit_title\" value=\"'+res.title+'\"></input> <br>' +\n '<!--label>'+_locale[pn]['videoPath']+'</label> <input id=\"edit_dir\" value=\"'+res.dir+'\"></input> <br-->' +\n '<label>'+_locale[pn]['videoComment']+'</label> <textarea id=\"edit_comment\">'+res.comment+'</textarea> <br>' +\n '<input type=\"button\" class=\"submit-button\" value=\"Update\">'\n ));\n \n /* edit_window save button */\n $(\"input.submit-button\").click(function(e){ saveEditInfo(); });\n });\n}", "async function openEditAdd() {\n\n }", "function showResultForEditing(e)\n{\t\n\tvar id = e.data.IdForResult;\n\t//_debug('edit record '+id);\n\tvar\tresult = getResultById(id);\n\t\n\tdocument.getElementById('editid').value = result.id;\n\tdocument.getElementById('editdatetime').value = result.datetime;\n\tdocument.getElementById('editdisplaydate').value = result.displaydate;\n\tdocument.getElementById('editdisplaytime').value = result.displaytime;\n\tdocument.getElementById('editsugar').value = result.sugar;\n\tdocument.getElementById('editinsulinamount').value = result.insulinamount;\n\tdocument.getElementById('editfood').value = result.food;\n\tdocument.getElementById('editexercise').value = result.exercise;\n}", "function editSelectedInv(source) {\n INV_ACTION = 'updateInv';\n clearInvForm();\n displayInvWell();\n fillInvWell(source);\n}", "_openEdit() {\n\t\tconst { about } = this.props;\n\t\tthis.setState({layerOn: true, inputName: about.name, inputBio: about.bio,\n\t\t\tinputLocation: about.location, inputImage: about.image });\n\t}", "function editProduct(id) {\r\n addProductBtn.value = id;\r\n var index = getIndexById(id);\r\n dialogNameField.value = shop.products[index].name ;\r\n dialogPriceField.value = shop.products[index].price;\r\n\r\n dialog.showModal(); \r\n var event = new Event(\"input\");\r\n dialogPriceField.dispatchEvent(event);\r\n dialogNameField.dispatchEvent(event);\r\n }", "function datagrid_edit_row(table, field_id, formurl) {\n\tvar row = datagrid_get_selected_row(table);\n\tif (row) {\n\t\t// get data to send\n\t\tvar field = $('#' + field_id + '_gridvalue');\n\t\tvar field_data = $.evalJSON(field.val());\n\t\tvar row_index = datagrid_get_field_index(table, row);\n\t\tformurl += '&Plomino_datagrid_rowdata=' + $.URLEncode($.toJSON(field_data[row_index]));\n\t\tdatagrid_show_form(field_id, formurl, function(rowdata, raw) {\n\t\t\t// update the field\n\t\t\tfield_data[row_index] = raw;\n\t\t\tfield.val($.toJSON(field_data));\n\n\t\t\t// update the datagrid\n\t\t\ttable.fnUpdate(raw, row_index);\n\t\t});\n\t}\n\telse {\n\t\talert('You must select a row to edit.');\n\t}\n}", "function editModel(data) {\n /// start edit form data prepare\n /// end edit form data prepare\n dataSource.one('sync', function(e) {\n /// start edit form data save success\n /// end edit form data save success\n\n app.mobileApp.navigate('#:back');\n });\n\n dataSource.one('error', function() {\n dataSource.cancelChanges(itemData);\n });\n\n dataSource.sync();\n app.clearFormDomData('edit-item-view');\n }", "function edit() {\n clickTaskEdit(requireCursor());\n }" ]
[ "0.74080265", "0.72648585", "0.70942825", "0.69304895", "0.69304895", "0.69304895", "0.69304895", "0.69304895", "0.69304895", "0.69304895", "0.6856121", "0.6850608", "0.6840631", "0.6821734", "0.67755777", "0.67753345", "0.67721134", "0.67584884", "0.6749332", "0.6749332", "0.6748544", "0.6700315", "0.6700315", "0.66987044", "0.66875297", "0.6674095", "0.6655238", "0.6628591", "0.6619005", "0.659808", "0.65958077", "0.6592109", "0.6583768", "0.6583043", "0.6583043", "0.6562941", "0.65546036", "0.65412676", "0.65412676", "0.65379566", "0.6529963", "0.6523006", "0.6503383", "0.6492234", "0.6489836", "0.6467421", "0.6464024", "0.6442656", "0.6441402", "0.64394057", "0.6425572", "0.64121187", "0.6410019", "0.6403662", "0.64013934", "0.63960767", "0.6377845", "0.6363074", "0.63618743", "0.6358484", "0.63569117", "0.63481385", "0.63479316", "0.6332758", "0.6325926", "0.6321201", "0.631998", "0.6311953", "0.6296674", "0.6296632", "0.6290659", "0.6287868", "0.6283712", "0.6279155", "0.6278909", "0.62754494", "0.6270023", "0.6256243", "0.62541413", "0.62532777", "0.62531626", "0.6248751", "0.6245942", "0.6240489", "0.6237992", "0.6237851", "0.62347627", "0.623442", "0.6220835", "0.6220664", "0.6219118", "0.62168163", "0.6215487", "0.6211114", "0.62093633", "0.62059593", "0.620468", "0.62041974", "0.61983323", "0.6196594", "0.6194127" ]
0.0
-1
> DELETE DELETE MODAL
function deletePet(id) { db.collection("pets").doc(id).get().then(snapshot => { console.log(snapshot.data()); $("#modal-title").html(`Are you sure you want to delete ${snapshot.data().name}?`) $("#confirm-delete").attr("pet", id); var modal = M.Modal.getInstance($("#delete-confirm")); modal.open(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onDeleteClicked() {\n $('<p>')\n .text(_`\n This integration will be permanently removed. This cannot\n be undone.\n `)\n .modalBox({\n buttons: [\n $('<button>')\n .text(_`Cancel`),\n $('<button class=\"danger\">')\n .text(_`Delete Integration`)\n .click(() => this.model.destroy({\n beforeSend: xhr => {\n xhr.setRequestHeader(\n 'X-CSRFToken',\n this.model.collection.options.csrfToken);\n },\n })),\n ],\n title: _`Are you sure you want to delete this integration?`,\n });\n }", "delete() {\n let id = $(\"#rid\").val();\n reReg.delete(id);\n $(\"#editDeleteModal\").modal('hide');\n }", "static onClickRemoveMedia() {\n let $element = $('.context-menu-target'); \n let id = $element.data('id');\n let name = $element.data('name');\n \n UI.confirmModal(\n 'delete',\n 'Delete media',\n 'Are you sure you want to delete the media object \"' + name + '\"?',\n () => {\n $element.parent().toggleClass('loading', true);\n\n HashBrown.Helpers.RequestHelper.request('delete', 'media/' + id)\n .then(() => {\n return HashBrown.Helpers.RequestHelper.reloadResource('media');\n })\n .then(() => {\n HashBrown.Views.Navigation.NavbarMain.reload();\n\n // Cancel the MediaViever view if it was displaying the deleted object\n if(location.hash == '#/media/' + id) {\n location.hash = '/media/';\n }\n })\n .catch(UI.errorModal);\n }\n );\n }", "function handleDelete() {\n setDialogDelete(true);\n setDialog(false);\n }", "function del (e) {\r\n var parent = $(e.target).parent();\r\n var id = parent.attr('id');\r\n parent.remove();\r\n $.ajax({\r\n url: \"core/delete.php\",\r\n type: \"POST\",\r\n dataType: \"text\",\r\n data: \"id=\" + id\r\n });\r\n}", "function openDelete(){\n $('#modalWindow').css('display', 'block');\n $('#confirmDelete').css('display', 'block');\n var domElement = $(this).parent().parent();\n var id = $(domElement).attr(\"id\");\n $('#aceptDelete').click(function(){\n remove(id);\n closeModal();\n });\n }", "_addActionDelete() {\n let btn = this._actions.getElementsByClassName('delete')[0];\n if (btn === undefined) {\n return;\n }\n\n btn.onclick = ((event) => {\n\n let confirm = (() => {\n this._api.removeService(this._api.getSlug());\n this._dialog.hide();\n }).bind(this);\n\n const params = {\n title: this._i18n('actions.delete.item'),\n content: this._i18n('actions.delete.info'),\n actions: [\n {title: this._i18n('dialog.cancel'), attrs: null, className: 'btn-default abort'},\n {title: this._i18n('dialog.confirm'), attrs: [['onclick', confirm]], className: 'btn btn-outline-danger confirm'}\n ],\n _class: 'confirmation-dialog delete'\n };\n\n this._dialog = new Dialog(params);\n this._dialog.show();\n\n }).bind(this);\n\n this._btns.delete = btn;\n }", "onDeleteClick() {\n\t\tconst { id } = this.props.match.params;\n\t\tthis.props.deletePost(id, () => {\n\t\t\tthis.props.history.push('/');\n\t\t});\n\t}", "function deleteModal() {\n\t\t$('#delete-modal .btn-primary').click(function(){\n\t\t\t// wall = $(this).parent().attr('href').substr(5);\n\t\t\t// $(this).parent().parent().remove();\n\t\t\t// $('#page'+wall).remove();\n\t\t\t// if($('#walls-tabs li:not(#wall-new)').length == 0) {\n\t\t\t// \t$('#wall-new').click();\n\t\t\t// }\n\t\t\t// if($('#walls-tabs li.active').length == 0) {\n\t\t\t// \t$('#walls-tabs li:first-child a').tab('show');\n\t\t\t// }\n\t\t\t$.ajax({\n\t\t\t\turl: '../ajax/delete-audiowall-page.php',\n\t\t\t\tdata: { wallid: $('#delete-modal').data('dps-wall-id') },\n\t\t\t\ttype: 'POST',\n\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\tvalue = $.parseJSON(xhr.responseText);\n\t\t\t\t\talert(value.error);\n\t\t\t\t},\n\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\twindow.location.reload(true); \n\t\t\t\t}\n\t\t\t});\n\t\t\trenumberWalls();\n\t\t\treturn(false);\n\t\t});\n\t}", "function BtnDelete() {\n transacionAjax_D_elete(\"D_elete\");\n}", "function postDelete(response) {\n\tif (response == \"OK\") {\n\t\t$(\"h3#h\" + $(\"#expiddel\").val()).remove();\n\t\t$(\"div#h\" + $(\"#expiddel\").val()).remove();\n\t\t$(\"#dialog\").dialog('close');\n\t} else\n\t\talert(\"Action failed\");\n}", "function getDeleteModal(e) {\n e.preventDefault();\n deleteModal.style.display = \"block\";\n // console.log(deleteBlogId);\n}", "function del() {\n $(\"#modal-default\").modal(\"hide\");\n\n // if there are no selected data, close the confirmation alert\n if (_idArray.length === 0) {\n //...\n }\n // submit the data to the server side\n else {\n setTimeout(function () {\n $.ajax({\n \"url\": url,\n \"type\": \"POST\",\n \"data\": {\"ids\": _idArray.toString()},\n \"dataType\": \"JSON\",\n \"success\": function (data) {\n if (data.status === 200) {\n window.location.reload();\n }\n\n // delete failed\n else {\n $(\"#btnModalOk\").unbind();\n $(\"#btnModalOk\").bind(\"click\", function () {\n $(\"#modal-default\").modal(\"hide\");\n });\n\n $(\"#modal-message\").html(data.message);\n $(\"#modal-default\").modal(\"show\");\n\n }\n }\n });\n }, 500);\n }\n }", "clickDelete(){\n let idSelected = this.__modelSelect.getSelectedModel();\n if(idSelected == -1){\n alert(\"You Need To Choose Model to Delete First!!!\");\n return;\n }\n\n //delete the selected model\n this.__modelSelect.deleteSelectedModel();\n this.__clientController.deleteModelById(idSelected);\n }", "function seeModalDelete(id) {\n setData(id);\n setModalDelete(true)\n }", "function initDelete() {\n\t\t\t$list.find('[aria-click=\"delete\"]').on('click', function () {\n\t\t\t\tvar $item = $(this).closest('.item');\n\n\t\t\t\tpopupPrompt({\n\t\t\t\t\ttitle: _t.form.confirm_title,\n\t\t\t\t\tcontent: _t.investor.view.manager.delete_confirm,\n\t\t\t\t\ttype: 'warning',\n\t\t\t\t\tbuttons: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: _t.form.yes,\n\t\t\t\t\t\t\ttype: 'warning',\n\t\t\t\t\t\t\thandle: function () {\n\t\t\t\t\t\t\t\ttoggleLoadStatus(true);\n\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\turl: '/investors/delete/' + $item.data('value'),\n\t\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\t\tcontentType: 'JSON'\n\t\t\t\t\t\t\t\t}).always(function () {\n\t\t\t\t\t\t\t\t\ttoggleLoadStatus(false);\n\t\t\t\t\t\t\t\t}).done(function (data) {\n\t\t\t\t\t\t\t\t\tif (data.status == 0) {\n\t\t\t\t\t\t\t\t\t\t$item.parent().remove();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\tpopupPrompt({\n\t\t\t\t\t\t\t\t\t\t\ttitle: _t.form.error_title,\n\t\t\t\t\t\t\t\t\t\t\tcontent: _t.form.error_content,\n\t\t\t\t\t\t\t\t\t\t\ttype: 'danger'\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}).fail(function () {\n\t\t\t\t\t\t\t\t\tpopupPrompt({\n\t\t\t\t\t\t\t\t\t\ttitle: _t.form.error_title,\n\t\t\t\t\t\t\t\t\t\tcontent: _t.form.error_content,\n\t\t\t\t\t\t\t\t\t\ttype: 'danger'\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: _t.form.no\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t})\n\t\t\t});\n\t\t}", "function deleteNotice(e){\n\tdbIdDel = e.parentElement.parentElement.children[1].getAttribute('pk')\n\tif (confirm(\"Are you sure that you want to delete this?\")) {\n\t\t$('#overlay').css({'display':'block'})\n\t\t$.ajax({\n\t\t\ttype:\"POST\",\n\t\t\turl:'function_manage_video.php',\n\t\t\tdata:{cmd:'delete',pk:parseInt(dbIdDel)},\n\t\t\tsuccess:function(response){\n\t\t\t\tconsole.log(response)\n\t\t\t\tupdateTable()\n\t\t\t},\n\t\t\terror:function(err){\n\t\t\t\tconsole.log(err)\n\t\t\t\talert('Something went wrong. Please try again!')\n\t\t\t}\n\t\t})\n\t}\n}", "function onConfirmDelete() {\n var id = $('#deleteConfirmModal').data('id');\n deleteRow(id);\n $('#deleteConfirmModal').modal('hide');\n}", "function makeDeleteable(){\n\t\t$('.badge-remove').click(function(){\n\t\t\t$('#delete-modal-page').html($(this).parent().text());\n\t\t\t$('#delete-modal').modal('show');\n\t\t\t$('#delete-modal').data( \"dps-wall-id\", $(this).parent().data('dps-wall-id') );\n\t\t});\n\t}", "function handleDeleteButtons() {\n $('a[data-action=\"delete\"]').click(function (event) {\n event.preventDefault();\n const target = this.dataset.target;\n $(target).remove();\n })\n}", "function deleteMenuDeleteClicked() {\n canvas.removeLabel(canvas.getCurrentLabel());\n oPublic.hideDeleteLabel();\n myActionStack.push('deleteLabel', canvas.getCurrentLabel());\n }", "function deleteClicked(event){\n\tif (confirm('Are you sure you want to delete this record?')) {\n\t\tvar site_id = event.target.id.split(\"_\")[1];\n\t\t$.ajax({\n\t\t\ttype: 'put',\n\t\t\turl: '/hs',\n\t\t\tdata: {\n\t\t\t\thostSiteID : site_id,\n\t\t\t\tname : \"\",\n\t\t\t\taddress : \"\",\n\t\t\t\tcity : \"\",\n\t\t\t\tprovince : \"\",\n\t\t\t\tpostalCode : \"\",\n\t\t\t\thoursOfOperation : \"\",\n\t\t\t\tphone : \"\",\n\t\t\t\temail : \"\"\n\t\t\t},\n\t\t\tcomplete: function(response) {\n\t\t\t\tif (response.success == \"false\"){\n\t\t\t\t\talert(response.message);\n\t\t\t\t} else {\n\t\t\t\t\talert(\"Record deleted successfully\");\n\t\t\t\t\tlocation.reload();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function deleteBTN(id) {\n $(\"#modelBTN\").click();\n $(document).on(\"click\", \".modal-delete\", function (e) {\n e.preventDefault();\n $.magnificPopup.close();\n $.ajax({\n type: \"GET\",\n dataType: \"json\",\n url: \"/admin/deleteCategories/\" + id,\n success: function (data) {\n $('#CategoryDataTable').DataTable().ajax.reload();\n if (data) {\n new PNotify({\n title: \"Success!\",\n text: \"Categories Deleted Successfully.\",\n type: \"success\",\n });\n }\n },\n });\n });\n}", "function handleDeleteButtons() {\n $('button[data-action=\"delete\"]').click(function () {\n const target = this.dataset.target;\n $(target).remove();\n });\n}", "function deleteGameModal(e) {\n const modal = document.querySelector(\".game-modal\");\n const closeBtn = document.querySelector(\".close-modal\");\n const confirmDeleteBtn = document.querySelector(\".modal-delete-btn\");\n const game = e.target.dataset.id;\n modal.classList.remove(\"hidden\");\n confirmDeleteBtn.setAttribute(\"href\", \"delete_game/\" + game);\n closeBtn.addEventListener(\"click\", function () {\n modal.classList.add(\"hidden\");\n });\n}", "delete(post) {\n if (confirm('Are you sure?')) {\n this.sendAction('destroyPost', post);\n }\n }", "function deleteButtonHandler(event) {\n deleteContact(event.target.parentNode.getAttribute('data-id'));\n render(contacts);\n}", "function deletePop(actionUrl, id = null, callback_url =false, from_create = null, delete_msg = false)\n{\tconsole.log(delete_msg);\n $(\"#deleteRecord form\").attr('action', actionUrl);\n\t$(\"#deleteRecord #id\").val(id);\n if(delete_msg){\n $(\"#deleteRecord #delete_msg\").html(delete_msg);\n }\n\tif(callback_url){\n $(\"#deleteRecord #callback-path\").val(callback_url);\n }\n\tif(from_create == '1')\n\t{\n\t\t$('#deleteRecord #from_create').val(1);\n\t\t$('#deleteRecord #pageno').val(1);\n\t}\n\t$('#deleteRecord').modal({backdrop: false, keyboard: false});\n}", "function patients_delete(id){\n\t\t\n\t\t\n\t\t$(\"#forDeleteDialog\").dialog({\n\t\t\tshow: \"fade\",\n\t\t\thide: \"fade\",\n\t\t\tmodal: true,\n\t\t\tbuttons:{\n\t\t\t\t\"ok\": function(){\n\t\t\t\t\tvar obj = {\"id\":id};\n\t\t\t\t\t\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\turl: \"patients_delete.php\",\n\t\t\t\t\t\tdata: obj,\n\t\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\t\t$(document.getElementById(id)).remove();\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: function(data){}\n\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t},\n\t\t\t\t\"cancel\": function(){\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\t\n\t}", "function clickCloseBtnAfterDeleteHandler(controller) {\n\tlocation.reload();\n}", "function Delete(e) {\n if (confirm('Are you sure?')) {\n\t console.log(e.data.id);\n $.ajax({ url: '/delete', data: { id: e.data.id }, method: 'POST' })\n .done(function () {\n grid.reload();\n })\n .fail(function () {\n alert('Failed to delete.');\n });\n }\n }", "function deleteTelefoneModal(idDeletar) {\r\n\t$('input[name=idTelefoneEx]').val(idDeletar);\r\n\t$('#excluirTelefoneCurriculo').dialog('open');\r\n}", "function deleteButtonPressed(todo) {\n db.remove(todo);\n}", "function delete_job_work(work_id, certificate) {\n\n $('.biderror .mes').html('<div class=\"message\"><h2>Are you sure you want to delete this work experience?</h2><a id=\"delete\" class=\"mesg_link btn\" >OK</a><button data-fancybox-close=\"\" class=\"btn\">Cancel</button></div>');\n $('#bidmodal').modal('show');\n //$.fancybox.open('<div class=\"message\"><h2>Are you sure you want to delete this work experience?</h2><a id=\"delete\" class=\"mesg_link btn\" >OK</a><button data-fancybox-close=\"\" class=\"btn\">Cancel</button></div>');\n\n $('.message #delete').on('click', function () {\n\n $.ajax({\n type: 'POST',\n url: base_url + 'job/job_work_delete',\n data: 'work_id=' + work_id + '&certificate=' + certificate,\n success: function (data) {\n if (data == 1)\n {\n //$.fancybox.close();\n $('#bidmodal').modal('hide');\n $('.job_work_edit_' + work_id).remove();\n\n }\n\n }\n });//$.ajax end\n });\n}", "function Deleteclick(obj) {\n var rowID = $(obj).attr('id');\n $('#deleteId').val(rowID);\n $('#modal-delete-id').modal('show');\n}", "function deleteAch(value){\n\t$('#deleteBox').modal('hide')\t\n\t$(\"#delButtonIcon\").hide();\n\t$(\"#delButtonText\").text(\"Deleting\");\n\t$(\"#achDeleteLoad\").show();\n\t$(\"#delAchButton\").css(\"background-color\",'#e3342f');\n\t$(\"#delAchButton\").css(\"border-color\",'#e3342f');\n\t$(\"#delAchButton\").css(\"color\",'white');\n\tevent.preventDefault();\n\t$.ajax({\n\t\tmethod: \"DELETE\",\n\t\turl:achDelete,\n\t\tdata:{id:value, _token:token}\n\t}).done(function(response){\n\t\t$(\"#achDeleteMesssage\").show();\n\t\t$(\"#delAchButton\").hide();\n\t\t$(\"#achFormDiv\").slideUp();\n\t});\n\t// achDelete\n}", "function postDelete() {\n console.log('item deleted');\n swal({\n title: \"Dare Approved!\",\n icon: \"success\",\n button: \"Done\"\n })\n .then( () => {\n location.reload();\n })\n }", "function deleteAnswer(deleteButton) {\n $(deleteButton).closest(\"span\").closest(\"div\").closest(\"span\").remove();\n\n if (newCommandIsOpen) {\n setCommitButton(true);\n } else {\n checkCommandInEditMode();\n setCommitButton(false);\n }\n}", "function openDeleteModal() {\n ModalDeleteService.deleteItem(vm.activeDepartment, vm.deleteDepartment);\n }", "function actionDelete(p){\n\tsrc = collection[p].name;\n\t\n\tif($('#'+src).hasClass('isLocked')){\n\t\talert(\"Ce dossier est protégé contre la suppression\");\n\t\treturn false;\n\t}\n\n\tmessage = $('#'+src).hasClass('isDir')\n\t\t? \"Voulez vous supprimer ce dosssier et TOUT son contenu ?\"\n\t\t: \"Voulez vous supprimer ce fichier ?\";\n\n\tif(!confirm(message)){\n\t\t//log_(\"REMOVE CANCELED BY USER\");\n\t\treturn false;\n\t}\n\t\n\tvar get = $.ajax({\n\t\turl: 'helper/action',\n\t\tdataType: 'json',\n\t\tdata: {'action':'remove', 'src':collection[p].url}\n\t});\n\t\n\tget.done(function(r) {\n//\t\tif(r.callBack != null) eval(r.callBack);\n\t\tif(r.success == 'true'){\n\t\t\t$('div[id=\"'+src+'\"]').fadeTo(218,0, function() {\n\t\t\t\t$(this).remove();\n\t\t\t});\n\t\t\tmakeDragAndDrop();\n\t\t}\n\t});\n}", "function _openDeleteModal() {\n return _openGenericModal({\n templateUrl: 'modules/core/views/modal/deleteModal.client.view.html',\n controller: 'deleteModalCtrl'\n });\n }", "function showGalleryDeleteModel(id){\n $('#gallery_delete_id').val(id);\n $('#modal_gallery_delete_confirm').modal('show');\n }", "function deleteTermModal(e) {\n const modal = document.querySelector(\".delete-term-modal\");\n const closeBtn = document.querySelector(\".close-modal\");\n const confirmDeleteBtn = document.querySelector(\".modal-delete-btn\");\n const term = e.target.dataset.id;\n modal.classList.remove(\"hidden\");\n confirmDeleteBtn.setAttribute(\"href\", \"delete_definition/\" + term);\n closeBtn.addEventListener(\"click\", function () {\n modal.classList.add(\"hidden\");\n });\n}", "function deleteClickEvent(e){\n e.stopPropagation();\n e.stopImmediatePropagation();\n var delID = e.target.id.split(\"del\")[1]; //gets record's id\n if(confirm(\"Are you sure you want to delete this record?\")){\n $.ajax({\n type: \"POST\",\n url: \"deleteRow.php\",\n data: {IDtoDelete: delID},\n success: function(data){\n alert(data);\n hideForm(\"div\"+delID);\n }\n })\n }\n }", "function deleteClick() {\r\n if (!confirm('Delete this group?'))\r\n return;\r\n var groupId = Number(hdnGroupId.value);\r\n var o = {\r\n url: groupsUrl + groupId,\r\n success: function (data) {\r\n refreshData();\r\n },\r\n error: function (xhr) {\r\n divMessage.innerText = \"An Error Occurred. Please Try Again.\";\r\n }\r\n };\r\n meta.del(o);\r\n}", "function onRemoveYesClick() {\n // Close the modal.\n onCloseSpanClick();\n \n // Send a \"remove\" message to the server.\n sendMessage(2, currentModelHandle, null, null);\n}", "function delete_message(){\n\t\t$('.delete_message').click(function(e){\n\t\t\te.preventDefault();\n\t\t\tvar message_id = $(this).data('id');\n\t\t\tvar url = $('#messages-select-form').attr('action');\n\n\t\t\tif(confirm('Želite li da obrišete ovu poruku?')){\n\t\t\t\t$.ajax({\n\t\t\t\t\ttype: 'GET',\n\t\t\t\t\turl: url,\n\t\t\t\t\tdata: { message_id:message_id },\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\tif(!data.error){\n\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror: function(data){\n\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\tconsole.log('Some mistake during the sending request.');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "deleteCommand() {\n this.dismiss();\n }", "function editDialogDeleteRemove( actionType ) {\r\n\tvar confirmMessage = 'Remove Asset from project, are you sure?';\r\n\tvar submitAction = 'remove';\r\n\tif ( actionType != 'remove' ) {\r\n\t \tconfirmMessage = 'Delete Asset, are you sure?';\r\n\t \tsubmitAction = 'delete';\r\n\t}\r\n\tif ( confirm(confirmMessage) ) {\r\n\t\t$('form#editForm').attr({action: contextPath+'/assetEntity/'+submitAction}).submit();\r\n\t\treturn true;\r\n\t} else {\r\n\t\treturn false;\r\n\t}\r\n }", "function callModelConfirmDelete() {\n $('.call-modal-confirm-delete-btn').on('click', function() {\n var message = $(this).data('message');\n var form = $(this).parent();\n var modal = $('#modal-confirm-delete');\n modal.find('.modal-body').text(message);\n modal.modal().on('click', '#delete-btn', function() {\n form.submit();\n });\n });\n}", "function btnDelete_click(dep) {\n actualId = dep.id;\n\n const txtDepartamento = document.getElementById(\"txtRemoveName\");\n txtDepartamento.textContent = dep.name;\n\n $(\"#modalDelete\").modal();\n}", "delete() {\n this.props.deleteQuery(this.state.query);\n this.dismiss();\n }", "function deletebut() {\r\n\r\n let delbut = document.createElement('button');\r\n let txt = document.createTextNode('DELETE');\r\n delbut.appendChild(txt);\r\n form.appendChild(delbut);\r\n\r\n delbut.addEventListener('click', deleteelement);\r\n\r\n function deleteelement(e) {\r\n let delli = e.target.closet();\r\n delli.remove();\r\n }\r\n}", "function delete_bot(e){\n $.ajax({\n url: '/api/clients/delete/' + $('#botid').val(),\n type: 'GET',\n success: function (data, textStatus, xhr) {\n $('#modal-pop').modal('toggle');\n }\n });\n}", "handleDelete(e, id) {\r\n e.preventDefault();\r\n\r\n // Show the spinner\r\n this.toggleSpinner();\r\n\r\n this.toggleModal(e);\r\n FetchUtilities.fetchDelete(URL_DELETE + id, \r\n (httpStatus, response) => {\r\n if (httpStatus === 200)\r\n this.props.onSubmit('Announcement permanently deleted.', true)\r\n else\r\n throw new Error('Transaction failed')\r\n }, _=> this.toggleSpinner()\r\n ) \r\n }", "function delete_record(del_url,elm){\n\n\t$(\"#div_service_message\").remove();\n \n \tretVal = confirm(\"Are you sure to remove?\");\n\n if( retVal == true ){\n \n $.post(base_url+del_url,{},function(data){ \n \n if(data.status == \"success\"){\n //success message set.\n service_message(data.status,data.message);\n \n //grid refresh\n refresh_grid();\n \n }\n else if(data.status == \"error\"){\n //error message set.\n service_message(data.status,data.message);\n }\n \n },\"json\");\n } \n \n}", "function delete_record(del_url,elm){\n\n\t$(\"#div_service_message\").remove();\n \n \tretVal = confirm(\"Are you sure to remove?\");\n\n if( retVal == true ){\n \n $.post(base_url+del_url,{},function(data){ \n \n if(data.status == \"success\"){\n //success message set.\n service_message(data.status,data.message);\n \n //grid refresh\n refresh_grid();\n \n }\n else if(data.status == \"error\"){\n //error message set.\n service_message(data.status,data.message);\n }\n \n },\"json\");\n } \n \n}", "function clickDelete (event) {\n console.log(event.target);\n if (event.target.id === 'delete') {\n console.log(event.target);\n event.target.parentNode.remove();\n }\n}", "function cancelRemove() {\n scope.showDeleteModal = false;\n }", "function cancelRemove() {\n scope.showDeleteModal = false;\n }", "function deleteButtonPressed(todo) {\n db.remove(todo);\n }", "function delete_message()\n {\n var activity_id=$('.message.messow.open').attr('id').split('msac')[1];\n var delete_message= confirm(\"Do you really want to delete this message?\");\n if(delete_message)\n {\n $.ajax({\n url: '/messages',\n type:'delete',\n data:{'activity_id':activity_id}\n });\n $('#comment_area').fadeOut('');\n $('.comment-input').hide();\n $('#msac'+activity_id).fadeOut('slow',function(){$(this).remove()});\n }\n }", "function tag_delete_confirm(response){\n\ttag_id = JSON.parse(response);//deserialise the data rturned from the view\n\tif (tag_id > 0) {\n\t\tconsole.log(\"we get the id\")\n\t\t$('#tag_' + tag_id).remove();\n\t\t$('#tag_button_' + tag_id).remove();\n\t}\n}", "function deleteBannerModal( banner_id, banner_name ) {\n\t\n\t$('#modal_banner_id').val(banner_id);\n\t$(\"#banner_alert_msg\").css(\"display\",\"none\");\n\tvar msg = 'Are you sure you wish to delete the banner \"' + banner_name + '\" ?';\n\t$(\"#DeleteBannerModal #msg\").html(msg);\n\t$('#DeleteBannerModal').modal('show');\n\n}", "function ajaxDelete(id, url) {\n\t\t$.ajax({\n\t\t\turl: url,\n\t\t\ttype: 'POST',\n\t\t\tdataType: 'json',\n\t\t\tdata:{\n\t\t\t\t'id':id\n\t\t\t},\n\t\t\tasync: true,\n\t\t\tsuccess: function(){\n\t\t\t\t$work = $('#listWork button[data-id='+id+']').closest('.my-work');\n\t\t\t\t$('#deleteModal .btn-close').click();\n\t\t\t\t$work.fadeOut('slow').remove();\n\t\t\t},\n\t\t\terror: function(error){\n\t\t\t\t$('#deleteModal .btn-close').click();\n\t\t\t\t$('#errorModal #contentError').html(error.responseText);\n\t\t\t\t$('#errorModal').modal('toggle');\n\t\t\t}\n\t\t});\n\t}", "modalProjectDeleteClick() {\n $('#project-delete-modal').modal('show');\n }", "function TournamentDeleteDialog(btfModal) {\n\t\treturn btfModal({\n\t\t\tcontroller: 'tournamentCtrl',\n\t\t controllerAs: 'vmTournament',\n\t\t templateUrl: 'partials/TournamentDeleteDialog.tpl.html'\n\t\t});\n\t}", "function handleDelete(recipe: string, props: State & WrappedActionProps) {\n props.selectRecipe(recipe)\n props.setModal('Confirm_Modal')\n}", "delete() {\n let $self = $(`#${this.idDOM}`);\n if(this.commentSection !== undefined) {\n this.commentSection.delete();\n this.commentSection = undefined;\n }\n $self.remove();\n Object.keys(this.buttons).forEach(type => this.buttons[type].delete());\n }", "function delbase(event){\n var message = 'Are you sure you want to delete the selected table?';\n $(\".messagetxt\").text(message);\n $('#messagebox').modal('show');\n console.log( event.target.id)\n var id = event.target.id\n $(\"#btnconfirm\").click(function(){\n $.ajax({\n url: '/deletebase',\n type: 'POST',\n async: false,\n data: {csrfmiddlewaretoken: window.CSRF_TOKEN, id:id},\n success: function (res) {\n $('#' + id).remove();\n window.location.href = \"/index\";\n },\n error: function (err) {\n console.log(err);\n }\n });\n setTimeout(function(){location.reload();}, 2000);\n });\n}", "function deleteItem(e){\n}", "function deleteCampaignModal( campaign_id, campaign_name ) {\n\t\n\t$('#modal_campaign_id').val(campaign_id);\n\t$(\"#campaign_alert_msg\").css(\"display\",\"none\");\n\tvar msg = 'Are you sure you wish to delete the campaign \"' + campaign_name + '\" ?';\n\t$(\"#DeleteCampaignModal #msg\").html(msg);\n\t$('#DeleteCampaignModal').modal('show');\n\n}", "function deleteUpload(recordid){\n $('#succMsgContainer').hide();\n $('#id').val(recordid);\n $('#aws-delete-file-modal').modal('show');\n}", "_handleButtonDeleteWorkflow()\n {\n Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__WORKFLOW_DELETE, {workflow: this.model});\n }", "function removeItemDialog(message, deleteUrl, parentClass, noRedirect) {\n var modal = $('<div class=\"modal fade\" id=\"removeItemModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">')\n var modalHeader = $('<div class=\"modal-header\"><button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">&times;</button><h2 class=\"modal-title\">Delete Item</h2></div>')\n var modalBody = $('<div class=\"modal-body\"><p>' + message + ' This action cannot be undone.</p></div>')\n //buttons\n var send = $('<a href=\"' + deleteUrl + '\" class=\"btn\">Yes</a>')\n if (noRedirect) {\n send = $('<span class=\"btn\">Yes</span>')\n send.on('click', function(event) {\n event.stopPropagation();\n event.preventDefault();\n $.get(deleteUrl, function(result) {\n window.location.reload()\n })\n })\n }\n\n var cancel = $('<button class=\"btn btn-dismiss\" data-dismiss=\"modal\">Cancel</button>')\n var modalFooter = $('<div class=\"modal-footer\"></div>')\n modalFooter.append(send)\n modalFooter.append(cancel)\n\n var modalDialog = $('<div class=\"modal-dialog\"></div>')\n\n var modalContent = $('<div class=\"modal-classes modal-content\"></div>')\n modalContent.append(modalHeader)\n modalContent.append(modalBody)\n modalContent.append(modalFooter)\n\n modalContent.appendTo(modalDialog)\n modalDialog.appendTo(modal)\n modal.appendTo(parentClass)\n}", "handleDelete(id) {\r\n // Show the spinner\r\n this.props.toggleSpinner();\r\n\r\n this.toggleDeleteModal(undefined);\r\n FetchUtilities.fetchDelete(URL + '/' + id, \r\n (httpStatus, response) => {\r\n if (httpStatus === 200)\r\n this.props.onSubmit('Announcement permanently deleted.', true)\r\n else\r\n throw new Error('Transaction failed')\r\n }, _=> this.props.toggleSpinner()\r\n )\r\n }", "function deleteBtnHandler(e){\n //getting the value of mid\n let mId=e.currentTarget.parentNode.getAttribute(\"data-mId\")\n deleteMediaFromGallery(mId);\n //removing from the databse\n e.currentTarget.parentNode.remove()\n}", "function deletee() {\n\tdocument.getElementById(\"deletebtn\").disabled = true;\t\t//Prevent sapm or misclick\n\t$.ajax({\n\t\turl: getapi(),\n\t\ttype: \"POST\",\n\t\tdata: {\n\t\t\tdelete:$('#deleteid').html(),\n\t\t},\n\t\tsuccess:function(){\n\t\t\tlocation.reload();\n\t\t},\n\t\terror:function(xhr){\n\t\t\tvar err = eval(\"(\" + xhr.responseText + \")\");\n\t\t\talert(err.error);\n\t\t\tdocument.getElementById(\"deletebtn\").disabled = false;\n\t\t}\n\t});\n}", "function closeDelete() {\n document.getElementById(\"deleteForm\").style.display = \"none\";\n}", "'click .delete'() {\n \t\tMeteor.call('lists.remove', this._id, (error) => {\n\t\t\tif (error) {\n\t\t\t\tBert.alert( 'An error occured: ' + error + '! Only the creator of the list can delete it.', 'danger', 'growl-top-right' );\n\t\t\t} else {\n\t\t\t\tBert.alert( 'List removed successfully!', 'success', 'growl-top-right' );\n\t\t\t\tFlowRouter.go('/');\n\t\t\t}\n\t\t});\n\t}", "function promptDelete(id) {\n\n if (confirm(\"Are you sure you want to delete this DVD from your collection?\")) {\n\n $.ajax({\n type: 'DELETE',\n url: 'http://localhost:8080/dvd/' + id,\n });\n $(`#row${id}`).hide();\n };\n}", "function onDeleteHandler(e) {\n props.deleteAllUserData();\n props.loggedOut();\n e.preventDefault();\n setModal(false);\n history.push(\"/\");\n }", "onDeleteClicked(sector_id) {\n this.props.onRemoveSector(this.state.enterprise_id, sector_id).then(res=>{\n this.props.flashSuccess({\n text: \"Se ha eliminado el registro\",\n target: \"list\"\n })\n this.resetForm();\n }).catch(_=>{\n this.props.flashError({\n text: \"Hubo un error eliminando el registro\",\n target: \"list\"\n })\n }); \n }", "function deleteButtonPressed(flashcard) {\n db.remove(flashcard);\n }", "function modal_del_puestos(persona) \r\n{\r\n $('#modal_del_puestos').modal('toggle');\r\n search_puestos(persona);\r\n return false;\r\n}", "async function handleDeleteButtonClickEvent() {\n const personId = selectPersonEl.value;\n\n if (!personId) return;\n\n if (confirm(\"Do you really want to delete this person record?\")) {\n await Person.destroy(personId);\n\n for (let memberRecord of memberRecords) {\n if (selectPersonEl.value === memberRecord.personId) {\n await Member.destroy(personId);\n }\n }\n for (let playerRecord of playerRecords) {\n if (selectPersonEl.value === playerRecord.personId) {\n await Player.destroy(personId);\n }\n }\n for (let coachRecord of coachRecords) {\n if (selectPersonEl.value === coachRecord.personId) {\n await Coach.destroy(personId);\n }\n }\n for (let presidentRecord of presidentRecords) {\n if (selectPersonEl.value === presidentRecord.personId) {\n await President.destroy(personId);\n }\n }\n // remove deleted person from select options\n selectPersonEl.remove( selectPersonEl.selectedIndex);\n }\n}", "function btnClickDelete(id) {\n\tconsole.log('modal-'+id);\n\tvar modal = document.getElementById('modal-'+id);\n modal.style.display = \"block\";\n}", "function deletePost(id){\n \n pointerRef=document.getElementsByName(\"pointerRef\");\n\tfor(let item of pointerRef){\n\t\titem.style.pointerEvents=\"none\";\n\t}; \n newNode.innerHTML=id;\n var delModal=document.getElementById('deleteModal');\n delModal.style.display=\"block\"; \n}", "function handleDeleteButtonPress() {\n var listItemData = $(this).parent(\"td\").parent(\"tr\").data(\"player\");\n var id = listItemData.id;\n $.ajax({\n method: \"DELETE\",\n url: \"/api/players/\" + id\n })\n .done(getPlayers);\n }", "function deleteMessage() {\n var target = $(\".delete-message\")\n target.click(function () {\n $(this).parents(\".box-messaggio\").remove();\n })\n}", "function deleteAfterClick(event){\n event.target.parentNode.remove();\n }", "get deleteModal() {\n return browser.element(\"//form[@data-qa='modal:delete']\");\n }", "function delAdditForm(event) {\n event.target.parentNode.remove();\n}", "function deleteContact() {\n app.f7.actions([[{\n text: 'Delete Contact',\n red: true,\n onClick: function() {\n var contacts = Persistence.getAllContacts();\n _.remove(contacts, { _id: contact._id });\n Persistence.setAllContacts(contacts);\n app.router.load('list'); // reRender main page view\n app.mainView.goBack(\"../index.html\", false);\n app.f7.closeModal();\n }\n }],\n [{\n text: 'Cancel',\n bold: true\n }]]);\n }", "hideDeleteModalDialog() {\n this.props.dispatch({type: CategoryActions.ActionTypes.CATEGORY.HIDE_DELETE_MODAL_DIALOG});\n }", "function deleteItem(divId) {\n if (confirm('Are you sure you want to delete icon with ID: ' + divId)) {\n deleteLink(divId);\n } else {\n // do nothing\n }\n resetModalContent();\n}", "function onBackFromControllerDelete() {\n $('deleteModal').modal('show');\n $('#deleteButton').addClass('d-none');\n\n $('#deleteModal').on('hidden.bs.modal', function() {\n $('#modalAlertDeleteArtist').addClass('d-none');\n $('#deleteButton').removeClass('d-none');\n });\n}", "function handleDeleteListing(e) {\n e.preventDefault();\n // close modal\n $('#myModal').modal('hide');\n console.log('listing deleted')\n console.log(deleteListingId);\n $.ajax({\n method: \"DELETE\",\n url: 'api/listings/' + deleteListingId,\n success: onDeleteSuccess\n })\n}", "function deletePost(e){\n e.preventDefault();\n \n console.log(e.target.parentElement.dataset.id);\n //linha abaixo faz propagação de evento\n if (e.target.parentElement.classList.contains('delete')) {\n const id = e.target.parentElement.dataset.id;\n if (confirm('Are you sure about that?')) {\n http.delete(`http://localhost:3000/posts/${id}`)\n .then(data => {\n ui.showAlert('Post removed', 'alert alert-success');\n getPosts();\n })\n .catch(err => console.log(err));\n }\n }\n}", "function zoto_modal_proxy_delete_album(){\n\tvar header = _('Delete ');\n\tvar question = _('Are you sure you want to delete the selected album(s)?');\n\tvar deny_text = _('wait, I changed my mind');\n\tvar affirm_text = _('go ahead and delete');\n\tthis.modal = new zoto_modal_boolean_confirm({'header':header,'question':question,'affirm_text':affirm_text, 'deny_text':deny_text});\n\tconnect(this.modal, 'AFFIRM_CLICKED', this, 'handle_delete');\n\tthis.album_ids = null;\n}", "function note_delete()\n {\n // grab the .data element of note to delete\n var axe_it = $(this).data(\"_id\");\n $.ajax(\n {\n url: \"/api/notes/\" + axe_it,\n method: \"DELETE\"\n }).then(function()\n {\n // on success, hide the modal\n bootbox.hideAll();\n });\n }" ]
[ "0.7504706", "0.7326092", "0.72281253", "0.7162987", "0.7152994", "0.7130971", "0.709373", "0.70449054", "0.7017481", "0.69576705", "0.69495285", "0.6947013", "0.69406027", "0.6852701", "0.6852077", "0.6836309", "0.68220943", "0.6813955", "0.68135947", "0.68075883", "0.679482", "0.6792625", "0.6788253", "0.6784259", "0.6771795", "0.6751938", "0.6744032", "0.67434126", "0.6737805", "0.6714992", "0.6691766", "0.66912717", "0.6691187", "0.66805464", "0.66783994", "0.66753477", "0.6667265", "0.66603947", "0.6659341", "0.66565037", "0.665018", "0.66501254", "0.66358244", "0.6634874", "0.66212523", "0.66191155", "0.6608127", "0.66080636", "0.660012", "0.65994954", "0.65970826", "0.6595394", "0.65944827", "0.6591929", "0.65858746", "0.657874", "0.657874", "0.65755063", "0.6575048", "0.6575048", "0.6573889", "0.65704346", "0.6570119", "0.6566218", "0.65660167", "0.65622866", "0.65591526", "0.65494955", "0.65412045", "0.6538857", "0.6529889", "0.65184253", "0.6514335", "0.65084016", "0.6501797", "0.6501293", "0.6497102", "0.64928216", "0.6486233", "0.64862156", "0.6483224", "0.64830005", "0.64784557", "0.64711833", "0.64697945", "0.6465757", "0.64621896", "0.6460243", "0.64448005", "0.64298725", "0.6422106", "0.64207447", "0.64117646", "0.6411346", "0.64101344", "0.6410011", "0.64095", "0.640912", "0.6406126", "0.6404351", "0.64021647" ]
0.0
-1
Create new state handler for the HTTP call where we work the information received
function stateHandlerListCategories() { if ( xmlHttpObj.readyState == 4 && xmlHttpObj.status == 200) { var categoriesList = new Array(); var docxml = xmlHttpObj.responseXML; var nodelist = docxml.getElementsByTagName("categoria"); for (var i = 0; i < nodelist.length; i++) { var value = nodelist[i].textContent; if (!checkIfExists(categoriesList, value)) { categoriesList.push(value); }; }; document.getElementById("scategories").innerHTML += CreateSelectHTML(categoriesList); ListBooksByCategory(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getStateHandler(data) {\n print2Console(\"RESPONSE\", data.xml);\n}", "_createState(route, options){\n\n\t}", "function requestState( state ){\n \n console.log(\"REQUESTING STATE \" + state)\n \n var targetURL;\n var targetApplicationState;\n var params;\n var email, password, firstname, lastname;\n var successHandler = function( data ){ \n setApplicationState( ApplicationState.LOGGED_IN );\n $(\"#usernameLink\").html( \"Hello \"+ data.username );\n };\n \n switch ( state ){\n case ApplicationRequest.SIGN_IN:\n targetURL = LOGIN_URL;\n currentRequest = ApplicationRequest.SIGN_IN;\n email\t\t = $(\"#signin [name=email]\").val();\n \tpassword \t= $(\"#signin [name=password]\").val();\n params = {email:email, password:password };\n successHandler = function( data ){ \n setApplicationState( ApplicationState.LOGGED_IN );\n $(\"#usernameLink\").html( \"Hello \"+ data.username );\n };\n break;\n \n case ApplicationRequest.REGISTER:\n targetURL = REGISTER_URL;\n currentRequest = ApplicationRequest.REGISTER;\n email\t\t = $(\"#register [name=email]\").val();\n \tpassword \t= $(\"#register [name=password]\").val();\n \tfirstname\t= $(\"#register [name=firstname]\").val();\n \tlastname\t= $(\"#register [name=lastname]\").val();\n \tparams = { email:email, password:password, firstname:firstname, lastname:lastname };\n \tsuccessHandler = function( data ){ \n setApplicationState( ApplicationState.LOGGED_IN );\n $(\"#usernameLink\").html( \"Hello \"+ data.username );\n };\n break;\n\n case ApplicationRequest.SIGN_OUT:\n targetURL = LOGOUT_URL;\n currentRequest = ApplicationRequest.SIGN_OUT;\n successHandler = function(){ setApplicationState( ApplicationState.LOGGED_OUT ); }\n params: {};\n break;\n }\n \n //there might be potential for fuckups here\n $.ajax({\n\t\t type: \t \"POST\",\n\t\t url: \t targetURL,\n\t\t dataType: \"json\",\n\t\t data: params,\n\t\t success: function($data) {\n \t\t\t\tconsole.log($data.message);\n successHandler($data);\n\t\t },\n\t\t error: function(jqXHR, textStatus, errorThrown){\n \t\t\t\tconsole.log(jqXHR);\n \t\t\t\tconsole.log(textStatus);\n \t\t\t\tconsole.log(errorThrown);\n\t\t\t }\n\t\t});\n\t\t\n \t//false required to prevent default submit behavior\n \treturn false;\n \t\n}", "request1() {\n this.state.handle1();\n }", "call() {\n const response = ((this.user.state.inlineValues || {}).hash || {})[this.value] ||\n new EmptyResponse();\n const handler = ResponseHandlerFactory.getHandler({ response, user: this.user, api: this.api });\n handler.call(() => {});\n }", "handleRequest(body, res) {\r\n const match = body.match(BINARY_STATE);\r\n try {\r\n (match[1] == '1' ? this.on() : this.off()).then((err) => {\r\n if (!err) {\r\n res.end();\r\n } else {\r\n res.statusCode = 500;\r\n }\r\n res.end();\r\n });\r\n } catch(exc) {\r\n this.error('There was an error setting the device state', exc);\r\n res.statusCode = 404;\r\n res.end();\r\n }\r\n }", "function Handler() {\n\t\t\tthis.state = 0;\n\t\t}", "async _handleState(state) {\n async function defaultHandler() {\n throw new Error('Reached Unknown State!');\n }\n\n const StateMap = {\n [States.Parse]: this._handleParse,\n [States.Filter]: this._handleFilter,\n [States.Process]: this._handleProductComparison,\n [States.SwapProxies]: this._handleSwapProxy,\n [States.Abort]: () => States.Stop,\n [States.Error]: () => States.Stop,\n [States.Stop]: () => States.Stop,\n };\n\n const handler = StateMap[state] || defaultHandler;\n return handler.call(this);\n }", "function Handler() {\n\t\t\t\tthis.state = 0;\n\t\t\t}", "constructor () {\n this._handleRequest = this._handleRequest.bind(this)\n }", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function Handler() {}", "function handleData(data){\n switch(state){\n case 0:\n functions.authenticate();\n break;\n case 1:\n functions.processRequest(data);\n break;\n case 2:\n functions.forward(data);\n break;\n case -1:\n default:\n console.log(data.toString());\n break;\n };\n }", "function handler(request, response) {\n let urlObj = url.parse(request.url, true, false)\n\n console.log(`REQUEST URL PATH : ${urlObj.pathname}`);\n console.log(`REQUEST DIRECTORY : ${ROOT_DIR + urlObj.pathname}`);\n console.log(`REQUEST METHOD : ${request.method}`);\n\n let receivedData = \"\"\n\n request.on(\"data\", function (chunk) {\n receivedData += chunk\n })\n\n request.on(\"end\", function () {\n console.log(`REQUEST END`);\n console.log(`receivedData : ${receivedData}`);\n console.log(`type : ${typeof receivedData}`);\n\n if (request.method == \"GET\") {\n\n if (urlObj.pathname === \"/\") {\n urlObj.pathname += \"index.html\"\n }\n\n fs.readFile(ROOT_DIR + urlObj.pathname, function (err, data) {\n if (err) {\n console.log(err);\n response.writeHead(404)\n response.end(JSON.stringify(err))\n }\n\n response.writeHead(200, {\n \"Content-Type\": get_mine(urlObj.pathname)\n })\n\n response.end(data)\n })\n }\n if (request.method == \"POST\") {\n //capture post token json string\n if (urlObj.pathname.indexOf(\"token\") !== -1) {\n // let player = {\n // name: 'bob',\n // color: 'red',\n // balls: team1,\n // teamName:'team1',\n // } \n playerNumber++\n state.playerNumber = playerNumber\n players.push(JSON.parse(receivedData))\n state.players = players\n console.log(`current player: ${playerNumber}`);\n\n\n response.writeHead(200, {\n \"Content-Type\": MIME_TYPES['txt']\n })\n let grantToken = true\n if (playerNumber > 2) {\n grantToken = false\n }\n\n let sendBackObj = {//send back\n token: grantToken,\n state:state\n //let state = {\n // playerNumber:playerNumber,\n // players:[]\n // }\n }\n \n\n\n response.end(JSON.stringify(sendBackObj))\n }\n\n //client emit beforeunload event for calculate current player numbers\n if (urlObj.pathname.indexOf(\"unload\") !== -1) {\n console.log(\"got unload\")\n playerNumber--\n console.log(`unload number:${playerNumber}`)\n \n\n }\n\n }\n\n\n })//request end\n\n}//end handler", "function HttpHandler() {\n\t\t\tthis.activeDeffered = null;\n\t\t}", "async function makeRequestState() {\n\n try {\n const response = await axios.get(url);\n // typeList(response.data);\n console.log(response);\n menuOptionsState(response.data);\n } catch (error) {\n console.error(error);\n }\n}", "function createStateInitializer(inputs) {\n const { requestMethod, requestPath, state, lroResourceLocationConfig, processResult } = inputs;\n return (response) => {\n const { rawResponse } = response;\n state.isStarted = true;\n state.config = inferLroMode({\n rawResponse,\n requestPath,\n requestMethod,\n lroResourceLocationConfig,\n });\n logger.verbose(`LRO: Operation description:`, state.config);\n /** short circuit before polling */\n if (shouldStopPolling({\n rawResponse,\n state,\n info: state.config,\n responseKind: \"Initial\",\n })) {\n state.result = buildResult({\n response: response.flatResponse,\n state: state,\n processResult,\n });\n state.isCompleted = true;\n }\n };\n}", "function new_state_object(options) {\n\n\t\toptions.hold = options.hold > MAX_BOSH_CONNECTIONS ? MAX_BOSH_CONNECTIONS : options.hold;\n\n\t\t// res needs is sorted in 'rid' order.\n\t\toptions.res = [ ];\n\n\t\t//\n\t\t// Contains objects of the form:\n\t\t// { response: <The body element>, sstate: <The stream state object> }\n\t\t//\n\t\toptions.pending = [ ];\n\n\t\t// This is just an array of strings holding the stream names\n\t\toptions.streams = [ ];\n\n\t\t// A set of responses that have been sent by the BOSH server, but\n\t\t// not yet ACKed by the client.\n\t\t// Format: { rid: { response: [Response Object with <body> wrapper], ts: new Date() } }\n\t\toptions.unacked_responses = { };\n\n\t\t// A set of queued requests that will become complete when \"holes\" in the\n\t\t// request queue are filled in by packets with the right 'rids'\n\t\toptions.queued_requests = { };\n\n\t\t// The Max value of the 'rid' (request ID) that has been \n\t\t// sent by BOSH to the client. i.e. The highest request ID\n\t\t// responded to by us.\n\t\toptions.max_rid_sent = options.rid - 1;\n\n\t\tif (options.inactivity) {\n\t\t\t// We squeeze options.inactivity between the min and max allowable values\n\t\t\toptions.inactivity = [ Math.floor(toNumber(options.inactivity)), \n\t\t\t\t\t\t\t\t MAX_INACTIVITY, \n\t\t\t\t\t\t\t\t DEFAULT_INACTIVITY ].sort(dutil.num_cmp)[1];\n\t\t}\n\t\telse {\n\t\t\toptions.inactivity = DEFAULT_INACTIVITY;\n\t\t}\n\n\t\tif (options.wait <= 0 || options.wait > options.inactivity) {\n\t\t\toptions.wait = Math.floor(options.inactivity * 0.8);\n\t\t}\n\n\t\toptions.window = WINDOW_SIZE;\n\n\t\t// There is just 1 inactivity timeout for the whole BOSH session\n\t\t// (as opposed to for each response as it was earlier)\n\t\toptions.timeout = null;\n\n\t\t// This this BOSH session have a pending nextTick() handler?\n\t\toptions.has_next_tick = false;\n\n\t\treturn options;\n\t}", "constructor(){\n super();\n this.state= {\n name:'',\n age:'',\n description:'',\n file:'',\n city:'',\n chkArr:[],\n stayOpen:true,\n apiResponseArr:[],\n cityArr:[\n {\n id:1,\n name:'Noida'\n },\n {\n id:2,\n name:'Gurugram'\n },\n {\n id:3,\n name:'Banglore'\n },\n {\n id:4,\n name:'Hyderabad'\n },\n {\n id:5,\n name:'Coimbtore'\n }\n ]\n }\n this.handleName = this.handleName.bind(this);\n this.getFormData = this.getFormData.bind(this);\n }", "handleTaskResponse(taskName, type, state) {\n // Force a processor break before invoking state change handler; this is done only for directly-invoked\n // tasks which might directly invoke their callback. The purpose if so processing the ready list is\n // alway done breath-first (never depth first). Note this forced break is not required, but it makes the\n // startup order more intuitive for user\n setTimeout(() => {\n this.genericHandlerForStateChange(taskName, type, state);\n }, 0);\n }", "function handleStateRequest(intent, session, response) {\n console.log('State request');\n \n var stateList = getStateAbbrevFromIntent(intent, false);\n \n var speechOutput = '';\n \n var endpoint = 'https://www.govtrack.us/api/v2/role/';\n var queryString = '?state=' + stateList.stateabbrev + '&current=true';\n \n https.get(endpoint + queryString, function (res) {\n var stateResponseString = '';\n console.log('Status Code: ' + res.statusCode);\n\n if (res.statusCode != 200) {\n stateResponseCallback(new Error(\"Non 200 Response\"));\n }\n\n res.on('data', function (data) {\n stateResponseString += data;\n });\n\n res.on('end', function () {\n var stateResponseObject = JSON.parse(stateResponseString);\n\n if (stateResponseObject.error) {\n console.log(\"GovTrack error: \" + stateResponseObject.error.message);\n stateResponseCallback(new Error(stateResponseObject.error.message));\n } else {\n var responsetest = stateResponseObject.meta;\n //If API response length is zero, apologize.\n if (Number(stateResponseObject.objects.length) === 0) {\n speechOutput += \"I'm sorry, I can't look that up right now. Please try again.\"\n }\n //If it's less than 10 names, include their description. Otherwise, just names.\n if (stateResponseObject.objects.length < 10) {\n speechOutput += stateList.state + \" is represented by \"\n for (var i = 0; i < stateResponseObject.objects.length; i++) {\n speechOutput += stateResponseObject.objects[i].person.firstname + \" \" \n + stateResponseObject.objects[i].person.lastname + \", \"\n + stateResponseObject.objects[i].description + \". \";\n }\n } else {\n speechOutput += stateList.state + \" is represented by \"\n for (var i = 0; i < stateResponseObject.objects.length; i++) {\n speechOutput += stateResponseObject.objects[i].person.firstname + \" \" \n + stateResponseObject.objects[i].person.lastname + \", \";\n }\n }\n response.tell(speechOutput);\n }\n });\n }).on('error', function (e) {\n console.log(\"Communications error: \" + e.message);\n stateResponseCallback(new Error(e.message));\n });\n\n if (stateList.error) {\n speechOutput = \"I'm sorry, I can't look that up right now.\";\n response.tell(speechOutput);\n }\n\n}", "initializeState(handler = this._handler, options = {state: GraphObject.stateNew}) {\n handler._deltas = null;\n handler._identifier = undefined;\n handler._state = options.state;\n handler._store = null;\n handler._self = this;\n handler._transaction = null;\n return (handler);\n }", "function getRequestData(type, state, newData){\n var url, method, body;\n switch(type){\n case \"get\":\n url = \"bridge/\"+username+\"/lights\";\n method = \"GET\";\n break;\n case \"update\":\n var value = state.parent();\n var device = value.parent();\n url = \"bridge/\"+username+\"/lights/\" +device.get(\"product\")+\"/state\";\n method = \"PUT\";\n body = {}\n body[value.get(\"name\")] = newData;\n break;\n default:\n break;\n }\n return {\n url: url,\n method: method,\n body: body\n };\n}", "function WI4_State_Constructor(jsonObj)\n{\n\t//create the state object via json\n\tvar wi4State = jsonObj;\n\t//add our variables\n\twi4State.Optimised = false;\n\twi4State.Listeners = [];\n\twi4State.aKeyboardShortcuts = [];\n\twi4State.MapActions = {};\n\twi4State.TriggersData = { TriggerOnInfo: { Count: 0, List: [] }, TriggerOnError: { Count: 0, List: [] }, TriggerOnMouseOver: { Count: 0, List: [] } };\n\t//add function pointers\n\twi4State.Optimise = WI4_State_Optimise;\n\twi4State.InitialiseState = WI4_State_InitialiseState;\n\twi4State.InitialiseSimulation = WI4_State_InitialiseSimulation;\n\twi4State.InitialiseTutorial = WI4_State_InitialiseTutorial;\n\twi4State.Fire_Optimised = WI4_State_Fire_Optimised;\n\twi4State.Notify_Get_ItemList_CallBack = WI4_State_Notify_CallBack;\n\twi4State.Notify_Tut_CallBack = WI4_State_Notify_CallBack;\n\twi4State.GetLogData = WI4_State_GetLogData;\n\twi4State.GetIdEventMap = WI4_State_GetIdEventMap;\n\twi4State.GetMessage = WI4_State_GetMessage;\n\twi4State.GetTriggerMessage = WI4_State_GetTriggerMessage;\n\twi4State.GetPenaltyTriggers = WI4_State_GetPenaltyTriggers;\n\twi4State.GetRegularTriggers = WI4_State_GetRegularTriggers;\n\t//mark it as uninitialised\n\twi4State.UnInitialised = true;\n\t//return the updated object\n\treturn wi4State;\n}", "constructor(log, config) {\n this.createServices = () => {\n const infoService = new Service.AccessoryInformation();\n infoService.setCharacteristic(Characteristic.Manufacturer, 'Favi').setCharacteristic(Characteristic.Model, 'Some Screen').setCharacteristic(Characteristic.SerialNumber, 'Some SN');\n\n const doorService = new Service.GarageDoorOpener(this.name);\n doorService.getCharacteristic(Characteristic.CurrentDoorState).on('get', this.getState);\n doorService.getCharacteristic(Characteristic.TargetDoorState).on('set', this.setState);\n doorService.setCharacteristic(Characteristic.ObstructionDetected, false);\n\n return [infoService, doorService];\n };\n\n this.getServices = () => {\n return [this.infoService, this.doorService];\n };\n\n this.getState = cb => {\n const value = this.getHomekitState();\n this.log.debug(\"GetState returning \", value);\n cb(null, value);\n };\n\n this.getHomekitState = () => {\n // TODO: HTTP state\n let value = Characteristic.CurrentDoorState.STOPPED;\n switch (this.state) {\n case \"open\":\n value = Characteristic.CurrentDoorState.OPEN;\n break;\n case \"opening\":\n value = Characteristic.CurrentDoorState.OPENING;\n break;\n case \"closed\":\n value = Characteristic.CurrentDoorState.CLOSED;\n break;\n case \"closing\":\n value = Characteristic.CurrentDoorState.CLOSING;\n break;\n case \"unknown\":\n value = Characteristic.CurrentDoorState.STOPPED;\n break;\n default:\n this.log.debug(\"Current state is weird!\", this.state);\n break;\n }\n return value;\n /*\n fetch(this.host + '/')\n .then(res => {\n if (!res.ok) {\n throw new Error(res.status + ' ' + res.statusText);\n }\n return res;\n })\n .then(res => res.text())\n .then(text => text.match(/OK([01])/)[1])\n .then(statusText => {\n const powerState = (statusText === \"1\");\n this.lastState = powerState;\n this.lastChecked = Date.now();\n cb(null, powerState);\n });\n */\n };\n\n this.pushCurrentState = () => {\n this.log.debug(\"Pushing out current door state\");\n this.doorService.setCharacteristic(Characteristic.CurrentDoorState, this.getHomekitState());\n };\n\n this.setState = (targetState, cb) => {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n\n this.log.debug(\"SetState target state\", targetState);\n switch (targetState) {\n case Characteristic.TargetDoorState.OPEN:\n this.state = \"opening\";\n this.targetState = \"open\";\n break;\n case Characteristic.TargetDoorState.CLOSED:\n this.state = \"closing\";\n this.targetState = \"closed\";\n break;\n default:\n this.log.debug(\"UNKNOWN TARGET STATE\");\n break;\n }\n\n this.log.debug(\"Set state to \", this.state);\n this.timeout = setTimeout(() => {\n this.state = this.targetState;\n this.pushCurrentState();\n this.timeout = null;\n }, TRAVEL_DURATION_SEC * 1000);\n\n const direction = this.targetState === \"open\" ? \"down\" : \"up\";\n\n const url = this.host + '/' + direction;\n\n this.log.debug('POST' + url);\n\n fetch(url, { method: \"POST\" }).then(_ => {\n cb();\n });\n };\n\n if (!config) {\n log('Ignoring screen - no config');\n return;\n }\n this.log = log;\n\n const { host } = config;\n this.host = host;\n\n this.state = \"unknown\";\n this.targetState = null;\n this.timeout = null;\n\n [this.infoService, this.doorService] = this.createServices();\n }", "requestRemoteData(handler) {\n }", "createState(context) {\n const that = this;\n const body = context.data.payload;\n if (this.runningJob === null && !body.hasOwnProperty('executionId')) {\n context.emit('error', that.cementHelper.brickName, new Error('Creating State failed: no job currently running'));\n } else {\n const statePayload = _.pick(body, ['status', 'message', 'executionId', 'testSuiteId', 'testId']);\n if (!statePayload.hasOwnProperty('executionId') || statePayload.executionId === undefined) {\n statePayload.executionId = this.runningJob.executionId;\n }\n const finishedStates = ['finished', 'canceled', 'acked', 'timeout'];\n if (finishedStates.indexOf(statePayload.status) !== -1) {\n if (this.runningJob !== null) {\n statePayload.index = this.runningJob.currentIndex;\n this.runningJob.active = false;\n } else {\n statePayload.index = 0;\n }\n }\n statePayload.ip = SystemDetails.ip;\n // statePayload.hostname = SystemDetails.hostname;\n statePayload.hostname = SystemDetails.getHostnameAsIS();\n statePayload.timestamp = Date.now();\n const messageJob = {\n nature: {\n type: 'messages',\n quality: 'produce',\n },\n payload: {\n nature: {\n type: 'states',\n quality: 'create',\n },\n payload: statePayload,\n },\n };\n this.cementHelper.createContext(messageJob)\n .on('done', function(brickname, response) {\n context.emit('done', that.cementHelper.brickName, response);\n })\n .publish();\n }\n }", "createRules(state, http) {\n return {\n initial: () => {\n if (state.isEmpty('app')) {\n state.update('app', { foo: 'bar' })\n }\n },\n updateName: newName => state.update('app', { name: newName }),\n thunk: function (data) {\n this.initial();\n this.updateName();\n },\n fetch: () => {\n http.get('/api/my-data').then(data => {\n state.update('app', { data: data })\n })\n }\n }\n }", "function changetState(s,t,i){\n\t\tvar rurl = $('#r').val();\n\t\tvar query='&t='+t+'&i='+i;\n\t\t$.ajax({\n\t\t\ttype: 'POST',\n\t\t\tdataType: \"json\",\n\t\t\turl: URL_STATE+s+query,\n\t\t\tsuccess: function (response) {\n\t\t\t\tvar response = $.parseJSON(JSON.stringify(response));\n\t\t\t\tif(response.error){\n\t\t\t\t\tMessageDialog.show(response.message,'Active');\n\t\t\t\t}else{\t\t\t\t\t\n\t\t\t\t\twindow.location=rurl;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "setRequestState (result) {\n\t\t\tthis.setState({fetchOK : result.ok});\n\t\t\tthis.setState({fetchStatus : result.status});\n\t\t\tthis.setState({fetchRespType : result.type});\n\t\t\tthis.setState({fetchContType : result.headers.get('Content-Type')});\n\t\t\tthis.setState({fetchContLength : result.headers.get('Content-Length')});\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange();\n this.handleAChange();\n this.handleidCapture();\n this.handleimgCapture();\n this.handleConfigChange();\n this.idcaptureVal();\n this.imgcaptureVal();\n }", "function respondToState(){\n\t\t_oldUrl = _currentUrl;\n\t\tif(_useAPI) _currentUrl = cleanUrl(window.location.pathname || \"\");\n\t\telse _currentUrl = cleanUrl(window.location.hash || \"\");\n\t\t//Remove slash in beginning\n\t\tif(_currentUrl == \"/\") _currentUrl = \"\";\n\t\telse if(_currentUrl.indexOf(\"/\") == 0) _currentUrl = _currentUrl.substr(1);\n\t\t//Add slash in end\n\t\tif(_currentUrl.substr(_currentUrl.length-1) != \"/\") _currentUrl = _currentUrl+\"/\";\n\t\tif(_allowCookies || _firstTime) track(); //Track first page. After that only when cookies have been accepted.\n\t\tsetCanonical();\n\t\treadParameters();\n\t\tif(!_firstTime && _oldUrl == _currentUrl){\n\t\t\t//console.log(\"Same url firing statechange\", _oldUrl);\n\t\t\twindow.dispatchEvent(GLBCustomEvent(\"subPageChange\", 0));\n\t\t\treturn;\n\t\t}\n\t\t_firstTime = false;\n\t\tsetTitle();\n\t\t//Pages listening can animIn/Out\n\t\twindow.dispatchEvent(GLBCustomEvent(\"pageChange\", 0));\n\t}", "function Request () {\n var state = Struct({\n config: Struct({\n baseUrl: Value('http://localhost:8100'),\n // X-Auth-Token\n // storage for key will pull the value from local storage whenever it's called\n // so when app start syncing this data to the configuration of request,\n // it'll automatically be inserted in there and sent with all requests\n token: storage.forKey('token')\n })\n });\n\n // TODO: When user logs in, fill in default token\n\n return state;\n}", "received({ state, type }) {\n console.log(\"data\", type);\n switch (type) {\n case \"render\": {\n console.log(\"state\", state);\n appState.currentPlayer = state.current_player_idx;\n Game(state);\n break;\n }\n default: {\n console.log(\"default\");\n break;\n }\n }\n }", "function onRequest() {\n req = new Request(head, body);\n res = new Response();\n\n return runLayer(0).then(onResponse);\n }", "function getReadyStateHandler(xmlHttpRequest)\n{\n\t// an anonymous function returned\n \t// it listens to the XMLHttpRequest instance\n \treturn function()\n\t{\n \tif(xmlHttpRequest.readyState == 4)\n\t\t{\n \t\tif(xmlHttpRequest.status == 200)\n\t\t\t{\n \t\t\talert(xmlHttpRequest.readyState);\n \t\t\n \t\t\tvar res = xmlHttpRequest.responseText;\n \t\t\tvar sp = res.split(\"$\");\n \t\t\tvar content = sp[0].trim();\n \t\t\tvar alist = sp[1].trim();\n \t\t\talert(content);\n \t\t\tif(content==(\"retrieve\"))\n \t\t\t\t{\n \t\t\t\talert(alist);\n \t\t\t\tmakeResponse(alist);\t\n \t\t\t\t}\n \t\t\t\n \t\t\t/*\n \t\t\t * \n \t\t\t \n \t\t\telse if(content==(\"relativecontent\"))\n \t\t\t\t{\n \t\t\t\t\tmakeResponse1(alist);\n \t\t\t\t\t\n \t\t\t\t}\n \t\t\telse if(content==(\"basecontent\"))\n \t\t\t\t{\n \t\t\t\t\tmakeResponse2(alist,sp[2]);\n \t\t\t\t}\n \t\t\telse if(content==\"meaning\")\n \t\t\t\t{\n \t\t\t\t\tmakeResponse3(alist);\t\n \t\t\t\t}\n \t\t\telse if(content == \"addedtag\")\n \t\t\t\t{\n \t\t\t\t\tmakeResponse4(alist);\n \t\t\t\t}\n \t\t\t\n \t\t\t\n \t\t\t*\n \t\t\t*/\n \t\t\t\n \t\t\t\n \t\t\t\t//alert(res);\n \t\t}\n \t\telse\n\t\t\t{\n \t\talert(\"HTTP error \" + xmlHttpRequest.status + \": \" + xmlHttpRequest.statusText);\n \t\t}\n \t}\n \t};\n}", "function createServer(port) {\n let state = 10;\n\n const server = http.createServer(\n (request, response) => {\n switch (request.url) {\n case \"/state\":\n response.write(`{\"state\":${state}}`);\n break;\n case \"/add\":\n state++;\n response.write(`{\"state\":${state}}`);\n break;\n case \"/subtract\":\n state--;\n response.write(`{\"state\":${state}}`);\n break;\n case \"/reset\":\n state = 10;\n response.write(`{\"state\":${state}}`);\n break;\n\n default:\n response.statusCode = 404;\n response.write(\"Not Found Keko\");\n }\n\n response.end();\n }\n // TODO: Write your homework code here\n );\n\n return server;\n}", "function createHandler(eventType) {\n xhr['on' + eventType] = function (event) {\n copyLifecycleProperties(lifecycleProps, xhr, fakeXHR);\n dispatchEvent(fakeXHR, eventType, event);\n };\n }", "inbound(count, obj) {\n console.log(`vat-http.inbound (from browser) ${count}`, obj);\n const p = Promise.resolve(handler[obj.type](obj));\n p.then(\n res => D(commandDevice).sendResponse(count, false, harden(res)),\n rej => D(commandDevice).sendResponse(count, true, harden(rej)),\n );\n }", "_initThriftHandler() {\n // inner msg handler\n let self = this;\n this._innerThriftProcessor = Processor;\n this._innerHandler = {\n call(cmsg, callback) {\n // get params\n let base = cmsg.base,\n caller = cmsg.call,\n service = self._services.get(caller.name);\n self.emit(EVENT.LOG.DEBUG, 'IN ' + JSON.stringify({\n id : base.id, sender: base.sender,\n alias: caller.name, action: caller.action, params: caller.params\n }));\n // set sender\n base.sender = self._id;\n // handler call\n transport.callingHandler(cmsg, service, (err, rmsg) => {\n self.emit(EVENT.LOG.DEBUG, 'OUT ' + (err || rmsg.res));\n callback(err, rmsg);\n });\n }\n };\n }", "handleServiceStateChange(params) {\n let serviceName = params.name;\n let serviceState = params.state;\n this.ServiceStates[serviceName] = {\n state: serviceState\n };\n let firstLogArg = `SERVICE LIFECYCLE: STATE CHANGE: Service ${serviceState}`;\n logger_1.default.system.log(firstLogArg, serviceName);\n //Two messages go out.\n //1. Individual service state. \"Hey, logger is ready\".\n routerClientInstance_1.default.publish(`Finsemble.Service.State.${serviceName}`, { state: serviceState });\n //2. Aggregate service state, keyed by service name. \"Hey here's the state of all services.\".\n routerClientInstance_1.default.publish(Constants.SERVICES_STATE_CHANNEL, this.ServiceStates);\n }", "getProducts(storeName) {\n let buildProducts = (received) => {\n if(received==null)\n alert(\"Server Failed\");\n else {\n let opt = ''+ received.reason;\n if(opt === 'Success') {\n this.setState({products: received.value});\n }\n else {\n alert(\"Cant get Products from store. please try again later\");\n pass(this.props.history,'/storeManagement','',this.props.location.state);\n }\n }\n }\n send('/home/product?store='+storeName, 'GET','', buildProducts) \n }", "sendDataToServer1() {\n //send http-request to hemmo-backend butto\n let host = 'http://127.0.0.1:3001';\n let link = '/data_to_server1';\n\n // host + link = 127.0.0.3000/data_to_server // require that kind of end point to backend to handle http-request\n //FETCH -> POST (head , body -> content-type: JSON ) ,\n let postData = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(this.state),\n };\n\n fetch(host + link, postData)\n .then(resp => {\n return resp.json();\n })\n .then(r => {\n console.log('Fetch done successfuly !');\n //back-end response here\n //*********************************************************************** */\n this.state.additionalValue = 'http-respond, method=POST ' + r;\n this.setState(this.state);\n })\n .catch(err => {\n console.log('404 error, page not found');\n console.log('ERR', err);\n });\n\n console.log('Send http-request to end-point : ' + host + link);\n console.log('current message is :' + this.state.fieldvalue);\n }", "handle() {}", "stateMachine() {\n switch (this.state) {\n case 'START':\n this.start();\n break;\n case 'UPDATE_CONFIGS':\n this.update_Configs();\n break;\n case 'WAIT_AP_RESPONSE':\n this.wait_AssertPlayers_response();\n break;\n case 'PROCESS_PIECE':\n this.client.requestCurrentPlayerBot();\n if(this.newTimer){\n this.newTimer = false;\n this.view.startTimer();\n }\n this.state = 'WAIT_CPB_RESPONSE';\n break;\n case 'WAIT_CPB_RESPONSE':\n this.checkOverTime();\n this.wait_CurrentPlayerBot_response();\n break;\n case 'REQUEST_VALID_CELLS':\n this.request_validCells();\n this.checkOverTime();\n break;\n case 'WAIT_VP_RESPONSE':\n this.wait_validCells_response();\n break;\n case 'SELECT_CELL':\n this.checkOverTime();\n this.selectCell();\n break;\n case 'REQUEST_PLAY_P':\n this.client.requestPlay([this.view.board.selectedCell.column, this.view.board.selectedCell.line, this.selectedPiece.color])\n this.state = 'WAIT_PP_RESPONSE';\n break;\n case 'REQUEST_PLAY_B':\n this.client.requestBotPlay(this.model.level);\n this.state = 'WAIT_PB_RESPONSE';\n break;\n case 'WAIT_PP_RESPONSE':\n this.wait_HumanPlay_response();\n break;\n case 'WAIT_PB_RESPONSE':\n this.wait_BotPlay_response();\n this.checkOverTime();\n break;\n case 'WAIT_ANIMATION_END':\n this.view.stopTimer();\n this.wait_AnimationEnd();\n break;\n case 'WAIT_UNDO':\n this.wait_Undo();\n break;\n case 'WAIT_SP_RESPONSE':\n this.wait_SwitchPlayers_response();\n break;\n case 'WAIT_SP_TIMER':\n this.wait_SwitchPlayers_timer();\n break;\n case 'CHANGE_PLAYER':\n this.view.marker.switchPlayer();\n this.scene.update_CameraRotation();\n this.newTimer = true;\n this.state = 'PROCESS_PIECE';\n this.check_Reset();\n break;\n case 'GAME_OVER':\n this.check_GameMovie();\n this.check_Reset();\n break;\n case 'GAME_MOVIE' :\n this.view_GameMovie();\n break;\n case 'WAIT_GM_1st_ANIMATION_END' :\n this.wait_GM_1st_AnimationEnd();\n break;\n case 'WAIT_GM_ANIMATION_END' :\n this.wait_GM_AnimationEnd();\n break;\n case 'WAIT_GM_CAMERA_ANIMATION_END' :\n this.wait_GM_Camera_AnimationEnd();\n break;\n case 'SMALL_WAIT':\n this.small_Wait();\n break;\n }\n\n }", "go( { parameters, stateChangeCallback, responseCallback } ) {\n\n let fullUrlPlusParams = this.fullUrl + parameters;\n\n let header = new Headers( { 'Content-Type' : 'application/json'} );\n fetch( fullUrlPlusParams, { method: 'get', mode: 'cors', headers : header })\n .then(function (response) {\n if ( stateChangeCallback != null ) {\n stateChangeCallback( \"waiting\");\n }\n return response;\n })\n .then( function( response ) {\n if ( stateChangeCallback != null ) {\n stateChangeCallback(\"pending\");\n }\n return response.json();\n })\n .then( function(data) {\n if ( stateChangeCallback != null ) {\n stateChangeCallback(\"success\");\n }\n responseCallback( data );\n });\n }", "function createState(state) {\n\t return new state(module.exports);\n\t}", "_incoming() {\n this.state.endpoint = this.session.assertedIdentity.uri.user\n this.state.displayName = this.session.assertedIdentity.uri.user\n\n this.state.stats.callId = this.session.request.call_id\n this.app.logger.debug(`${this}incoming call ${this.state.stats.callId} started`)\n super._incoming()\n\n // Setup some event handlers for the different stages of a call.\n this.session.on('accepted', (request) => {\n this._start({message: this.translations.accepted.incoming})\n })\n\n this.session.on('bye', (e) => {\n if (e.getHeader('X-Asterisk-Hangupcausecode') === '58') {\n this.app.notify({\n icon: 'warning',\n message: this.app.$t('code 58: PBX AVPF/encryption issue'),\n type: 'warning',\n })\n }\n\n this.setState({status: 'bye'})\n this._stop({message: this.translations[this.state.status]})\n })\n\n /**\n * The `failed` status is triggered when a call is rejected, but\n * also when an incoming calls keeps ringing for a certain amount\n * of time (60 seconds), and fails due to a timeout. In that case,\n * no `rejected` event is triggered and we need to kill the\n * call ASAP, so a new INVITE for the same call will be accepted by the\n * call module's invite handler.\n */\n this.session.on('failed', (message) => {\n if (typeof message === 'string') message = SIP.Parser.parseMessage(message, this.plugin.sip.ua)\n let reason = message.getHeader('Reason')\n if (reason) {\n reason = this._parseHeader(reason).get('text')\n }\n\n if (reason === 'Call completed elsewhere') {\n this.app.logger.info(`${this}call completed elsewhere: ${this.state.stats.callId}`)\n this.setState({status: 'answered_elsewhere'})\n } else {\n this.app.logger.info(`${this}call rejected: ${this.state.stats.callId}`)\n // `Call completed elsewhere` is not considered to be\n // a missed call and will not end up in the activity log.\n this.app.emit('bg:calls:call_rejected', {call: this.state}, true)\n // We could distinguish here between a CANCEL send by the calling\n // party, or a cancel made by the callee. For now let's use\n // `request_terminated` for both cases.\n if (message.method === 'CANCEL') {\n this.setState({status: 'request_terminated'})\n } else if (message.status_code === 480) {\n // The accepting party terminated the incoming call.\n this.setState({status: 'request_terminated'})\n }\n }\n\n\n this._stop({message: this.translations[this.state.status]})\n })\n\n this.session.on('reinvite', (session, request) => {\n // Seems to be a timing issue in SIP.js. After a transfer,\n // the old name is keps in assertedIdentity, unless a timeout\n // is added.\n setTimeout(() => {\n this.state.displayName = session.assertedIdentity.uri.user\n this.state.endpoint = session.assertedIdentity.uri.user\n }, 0)\n })\n }", "async store({ request, response }) {}", "async create({ request, response, view }) {}", "async handleRequest(request) {\n // Parse the request as JSON\n let parsed;\n try {\n parsed = JSON.parse(request);\n } catch {\n throw new RequestError('invalid JSON');\n }\n\n // Extract the kind and data of the request\n const { kind, data } = parsed;\n\n // Make sure that kind is non-empty (otherwise it could give a strange error message)\n if (!kind) {\n throw new RequestError('kind cannot be empty');\n }\n\n // Make sure that kind is a string (since that's what the functions expect)\n if (typeof kind !== 'string') {\n throw new RequestError('kind must be a string');\n }\n\n // Log out if the message required the user to be logged out first\n if (logoutMessages.includes(kind)) {\n this.logout();\n }\n\n // Handle state-independent messages\n switch (kind) {\n case 'PING':\n return data;\n\n case 'checkInviteLink': {\n const { link } = data;\n\n // Make sure that the link is valid\n const code = security.parseLink(link);\n if (!code) {\n return { valid: false };\n }\n\n // Make sure the link exists\n const info = await requests.checkInviteCode(code);\n if (!info) {\n return { valid: false };\n }\n\n // Send the group name instead of the group ID\n const name = await requests.getGroupName(info.group);\n\n return { valid: true, name, expire: info.expire };\n }\n }\n\n // Have the current login state handle the request\n return await this.state.handleRequest(kind, data);\n }", "function postRequest(state, data){\n var convData = convertData(state, data);\n console.log(\"sending \"+convData);\n var parsedData;\n try{\n parsedData = JSON.parse(convData);\n } catch(e){\n parsedData = convData;\n }\n var requestData = getRequestData(\"update\", state, parsedData);\n $.ajax({\n headers: hueHeader,\n dataType: \"json\",\n contentType: \"application/json\",\n url: baseUrl + requestData.url,\n method: requestData.method,\n data: JSON.stringify(requestData.body)\n })\n \t.done(function(response){\n if(response[0] && response[0].hasOwnProperty(\"success\")){\n saveStateData(state, data);\n }\n \t})\n \t.fail(function(error){\n console.log(\"failed to update state: \"+ state.get(\":id\") + \" - \" +state.get(\"name\"));\n \t});\n}", "handleStateChange(e) {\n const unProcesedKey = e._targetInst.key\n const StateId = unProcesedKey.split('STATE_')[unProcesedKey.split('STATE_').length - 1]\n this.props.fetchCityWatcher({ stateCode: StateId })\n }", "constructor(props) {\n //Call the constrictor of Super class i.e The Component\n super(props);\n //maintain the state required for this component\n this.state = {\n\n res_name: \"\",\n address: \"\",\n cuisine: \"\",\n timings: \"\",\n homeFlag: false\n }\n //Bind the handlers to this class\n //some change \n this.handleLogout = this.handleLogout.bind(this)\n this.res_nameHandler = this.res_nameHandler.bind(this);\n this.addressChangeHandler = this.addressChangeHandler.bind(this);\n this.cuisineChangeHandler = this.cuisineChangeHandler.bind(this);\n this.timingsChangeHandler = this.timingsChangeHandler.bind(this);\n this.submitEvents = this.submitEvents.bind(this);\n\n }", "handleNewRequest(nRequest) {\n\t\tlet data = JSON.parse(nRequest.data)[\"Request\"];\n\t\tthis.setState((prevState, props) => {\n\t\t\tlet match = prevState.tracers.filter(n => n.ID === data.ID);\n\t\t\tif (match.length === 1) {\n\t\t\t\tmatch = match[0];\n\t\t\t\tObject.keys(data).map(n => {\n\t\t\t\t\tif (data[n] !== match[n]) {\n\t\t\t\t\t\tmatch[n] = data[n];\n\n\t\t\t\t\t\t//If the key was the RawRequest, we need to update the currently selected tracer\n\t\t\t\t\t\t//with this value as well.\n\t\t\t\t\t\tif (n === \"RawRequest\") {\n\t\t\t\t\t\t\t//If the matched request has a tracer that is currently selected...\n\t\t\t\t\t\t\tlet selected = match.Tracers.filter(\n\t\t\t\t\t\t\t\tm => m.ID === prevState.tracer.ID\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (selected.length === 1) {\n\t\t\t\t\t\t\t\tprevState.tracer.RawRequest = data[n];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn n;\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tprevState.tracers.push(data);\n\t\t\t\tprevState.ptracers = this.parseVisibleTracers(\n\t\t\t\t\tprevState.tracers\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn prevState;\n\t\t});\n\t}", "addHandler(handler) {\n this.handlers.add(handler);\n handler(this.state);\n }", "addHandler(handler) {\n this.handlers.add(handler);\n handler(this.state);\n }", "function makeRequest(state) {\n fetch(`${url}/grocery-list/show/${state.props.url.match.params.name}`)\n .then((res) => res.json().then((res) => {\n if (res.messages) {\n state.setState((prev) => {return {messages: prev.messages = res.messages}})\n } else {\n state.setState((prev) => {\n return {items: prev.items = res.groceryitems, loading: prev.loading = false}\n })\n }\n }))\n .catch((err) => {\n console.log(err);\n })\n }", "[\"POST_RADIOLOGY_SERVICES\"](state) {\n state.isLoading = true;\n }", "async function initHttpOperation(inputs) {\n const { stateProxy, resourceLocationConfig, processResult, lro, setErrorAsResult } = inputs;\n return initOperation({\n init: async () => {\n const response = await lro.sendInitialRequest();\n const config = inferLroMode({\n rawResponse: response.rawResponse,\n requestPath: lro.requestPath,\n requestMethod: lro.requestMethod,\n resourceLocationConfig,\n });\n return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {}));\n },\n stateProxy,\n processResult: processResult\n ? ({ flatResponse }, state) => processResult(flatResponse, state)\n : ({ flatResponse }) => flatResponse,\n getOperationStatus: getStatusFromInitialResponse,\n setErrorAsResult,\n });\n}", "async function initHttpOperation(inputs) {\n const { stateProxy, resourceLocationConfig, processResult, lro, setErrorAsResult } = inputs;\n return initOperation({\n init: async () => {\n const response = await lro.sendInitialRequest();\n const config = inferLroMode({\n rawResponse: response.rawResponse,\n requestPath: lro.requestPath,\n requestMethod: lro.requestMethod,\n resourceLocationConfig,\n });\n return Object.assign({ response, operationLocation: config === null || config === void 0 ? void 0 : config.operationLocation, resourceLocation: config === null || config === void 0 ? void 0 : config.resourceLocation }, ((config === null || config === void 0 ? void 0 : config.mode) ? { metadata: { mode: config.mode } } : {}));\n },\n stateProxy,\n processResult: processResult\n ? ({ flatResponse }, state) => processResult(flatResponse, state)\n : ({ flatResponse }) => flatResponse,\n getOperationStatus: getStatusFromInitialResponse,\n setErrorAsResult,\n });\n}", "function handleStateChange() {\n if(this.status == 200 && this.readyState == 4) {\n callback.call(this, this);\n }\n }", "addStateListener (stateIndex, fn) {\n // call immediately if already at or passed that state\n if (this.xhttp.readyState >= stateIndex) {\n fn(this.xhttp.responseText, this.xhttp);\n }\n this.stateFns[stateIndex].push(fn);\n }", "function fetch_info(getinfo){\n \n\t\n\tvar xmlhttp = new XMLHttpRequest();\n\tvar url=getinfo.url;\n\t\n\txmlhttp.onreadystatechange = function() {\n\t\tif (xmlhttp.readyState == 4 && xmlhttp.status == 200) {\n\t\t\t\n\t\t\t\n\t\t\tvar data = JSON.parse(xmlhttp.responseText);\n\t\t\t\n\t\t\tswitch(getinfo.action){\n\t\t\t\tcase \"liveweather\":\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tprocessWeather(data);\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tdefault:\n\t\t\t //kept switch for future expansion\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t};\n\txmlhttp.open(\"POST\", url, true);\n\txmlhttp.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\txmlhttp.send(getinfo.data);\n}", "constructor(url, ui)\n\t{\n\t\tconst {sum, isFunction, iterable, resolve, reject, getMicros, isArray} = Helpers;\n\t\tconst commit = request => {\n\t\t\t// create unique request ID\n\t\t\tconst getSignature = (signature = 0) => {\n\t\t\t\tsignature += signature ? 1 : getMicros();\n\t\t\t\t// get new signature if this one is not unique\n\t\t\t\treturn (signature in this.responses) ? getSignature(signature) : signature;\n\t\t\t};\n\t\t\t// pass user request to backend\n\t\t\tconst commit = response => {\n\t\t\t\t// create unique request ID\n\t\t\t\tconst signature = getSignature();\n\t\t\t\t// queue response function\n\t\t\t\tthis.responses[signature] = response;\n\t\t\t\t// commit request\n\t\t\t\tthis.message('action', {...request, signature});\n\t\t\t};\n\t\t\t// capture response\n\t\t\treturn new Promise(commit).then(({result, error}) => error ? reject(error) : resolve(result));\n\t\t};\n\t\tfunction trigger(type, data)\n\t\t{\n\t\t\tconst method = ui[type];\n\t\t\tisFunction(method) && method.call(ui, data);\n\t\t}\n\t\tconst maxTTL = 108000000;\n\t\tconst requestTimeout = () => {\n\t\t\tconst now = getMicros();\n\t\t\tfor (const key of iterable(this.responses, 'keys')) {now > sum(key, maxTTL) && delete this.responses[key];}\n\t\t};\n\t\tconst routes = {\n\t\t\terror:event => {\n\t\t\t\tconsole.error(event);\n\t\t\t\ttrigger('exception', event);\n\t\t\t},\n\t\t\tdown:event => {\n\t\t\t\tconst {timestamp, retries} = event;\n\t\t\t\tconsole.info(timestamp, retries ? `connection lost (${retries} retries)` : 'conection closed');\n\t\t\t\tthis.initialized = false;\n\t\t\t\ttrigger('offline', event);\n\t\t\t},\n\t\t\tup:event => {\n\t\t\t\tconsole.info(event.timestamp, 'connection established');\n\t\t\t\ttrigger('online', event.SessionID);\n\t\t\t},\n\t\t\tconnect:event => {\n\t\t\t\tconsole.info(event.timestamp, 'connection opened');\n\t\t\t\ttrigger('connecting', event);\n\t\t\t},\n\t\t\treconnect:event => {\n\t\t\t\tconsole.info(event.timestamp, 'connection reestablished');\n\t\t\t},\n\t\t\tready:event => {\n\t\t\t\tif (!this.initialized)\n\t\t\t\t{\n\t\t\t\t\t// start polling cycle to clean up dead requests\n\t\t\t\t\tclearInterval(this.freeResources);\n\t\t\t\t\tthis.freeResources = setInterval(() => requestTimeout(), 10000);\n\t\t\t\t\t// request the backend action methods\n\t\t\t\t\tthis.message('methods', {});\n\t\t\t\t}\n\t\t\t\tconsole.info(event.timestamp, 'channel ready');\n\t\t\t},\n\t\t\tmethods:({methods, timestamp}) => {\n\t\t\t\tconsole.info(timestamp, 'imported backend methods');\n\t\t\t\t// default methods to control the local client connection\n\t\t\t\tconst reserved = {\n\t\t\t\t\tsetSessionID:sessionid => (this.SessionID = sessionid),\n\t\t\t\t\tnewSession:() => this.message('newsession', {}),\n\t\t\t\t\tdisconnectSocket:() => this.disconnect(),\n\t\t\t\t\tconnectSocket:() => this.connect(url)\n\t\t\t\t};\n\t\t\t\tconst reducer = (methods, method) => ({...methods, [method]:query => commit({[method]:query})});\n\t\t\t\tconst actions = isArray(methods) ? methods.reduce(reducer, reserved) : reserved;\n\t\t\t\t// expose backend action methods to the frontend\n\t\t\t\ttrigger('up', actions);\n\t\t\t\t// request the complete application state\n\t\t\t\tthis.message('render', {});\n\t\t\t\tthis.initialized = true;\n\t\t\t},\n\t\t\t// sync UI with backend metadata push\n\t\t\tdata:({type, message}) => trigger(type, message),\n\t\t\t// pass return values to committed requests\n\t\t\taction:({signature, result}) => {\n\t\t\t\tif (signature in this.responses)\n\t\t\t\t{\n\t\t\t\t\tconst response = this.responses[signature];\n\t\t\t\t\tisFunction(response) && response.call(ui, result);\n\t\t\t\t\tdelete this.responses[signature];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t// bind UI to backend signals\n\t\tsuper(routes);\n\t\tthis.responses = {};\n\t\t// open connection to server\n\t\tthis.connect(url);\n\t}", "handler(state, { listState, listError, list }) {\n return {\n ...state,\n listState,\n listError,\n list\n }\n }", "function handler() {\n return tslib_1.__awaiter(this, void 0, void 0, function () {\n var git, gitRepoWithApi, releaseTrains;\n return tslib_1.__generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n git = git_client_1.GitClient.get();\n gitRepoWithApi = tslib_1.__assign({ api: git.github }, git.remoteConfig);\n return [4 /*yield*/, active_release_trains_1.fetchActiveReleaseTrains(gitRepoWithApi)];\n case 1:\n releaseTrains = _a.sent();\n // Print the active release trains.\n return [4 /*yield*/, print_active_trains_1.printActiveReleaseTrains(releaseTrains, index_1.getReleaseConfig())];\n case 2:\n // Print the active release trains.\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n }", "function connection_handler(req, res){\n\tconsole.log(`New Request for ${req.url} from ${req.socket.remoteAddress}`);\n\tif (req.url === \"/\"){\n\t\tconst main = fs.createReadStream(\"html/main.html\");\n\t\tres.writeHead(200, {\"Content-Type\":\"text/html\"});\n\t\tmain.pipe(res);\n\t}\n\telse if (req.url.startsWith(\"/search\")){\n\t\tconst user_input = url.parse(req.url, true).query; //take an url object return a js object \n\t\tconsole.log(\"Performing PetFinder API request\");\n\t\t//POST method \n\t\tconst authentication_cache = \"./cache/authentication-res.json\";\n\t\tcache_access_token(authentication_cache, user_input, res);\n\t}\n\telse {\n\t\tres.writeHead(404, {\"Content-Type\":\"text/plain\"});\n\t\tres.write(\"404 Not Found\");\n\t\tres.end();\n\t}\n}", "function fnCreateState() {\n jQuery.ajax({\n type: 'POST',\n url: bittionUrlProjectAndController + 'fnCreateState',\n// async: false,\n dataType: 'json',\n data: {\n data: jQuery('#AdmStateIndexForm').bittionSerializeObjectJson(), controllerId: jQuery('#selectController').val()},\n success: function(response) {\n if (response['status'] === 'SUCCESS') {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n fnRead(jQuery('#selectController').val());\n jQuery('#AdmStateIndexForm').get(0).reset();\n } else {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n }\n jQuery('#modalState').modal('hide');\n },\n error: function(response, status, error) {\n bittionAjaxErrorHandler(response, status, error);\n jQuery('#modalState').modal('hide');\n }\n });\n }", "function http() {\n\tthis.hint = 'url,queryType,dataType,async,data,timeout\\n\\nПри передаче данных в виде аргументов следует соблюдать их порядок, как в примере выше\\n\\nИмя свойств в передаваемом объекте должны быть одноименны с названиями аргументов в примере выше';\n\tthis.control = false;\n\tthis.lastQuery = false;\n\tthis.config = new Object();\n\tthis.defined = {\n\t\turl : '',\n\t\tqueryType : 'POST',\n\t\tdataType : 'json',\n\t\tasync : true,\n\t\tdata : false,\n\t\ttimeout : 500\n\t}\n\tthis.log = new Array();\n\tthis.log.console = true;\n\tthis.log.show = function(){\n\t\tfor (var i=0; i<this.length; i++) {\n\t\t\tconsole.log(this[i]);\n\t\t}\n\t}\n\tthis.log.clean = function(){\n\t\tthis.splice( 0,this.length );\n\t}\n\tthis.fromObject = function(arg) {\n\t\tif( arg != null && typeof(arg) == 'object' && arg.url != undefined ) {\n\t\t\tthis.control = true;\n\t\t\tthis.config.url = arg.url;\n\t\t\targ.queryType ? this.config.queryType = arg.queryType : this.config.queryType = this.defined.queryType;\n\t\t\targ.dataType ? this.config.dataType = arg.dataType : this.config.dataType = this.defined.dataType;\n\t\t\targ.async ? this.config.async = arg.async : this.config.async = this.defined.async;\n\t\t\targ.data ? this.config.data = arg.data : this.config.data = this.defined.data;\n\t\t\targ.timeout ? this.config.timeout = arg.timeout : this.config.timeout = this.defined.timeout;\n\t\t} else {\n\t\t\tif( typeof(arg) == 'string' ) { this.fromArguments(new Array(arg)) }\n\t\t}\n\t}\n\tthis.fromArguments = function(args) {\n\t\tif ( !args[0] ) { console.error('No URL'); return false }\n\t\t\telse { this.config.url = args[0]; this.control = true; }\n\t\tif ( args[1] === undefined ) this.config.queryType = this.defined.queryType;\n\t\t\telse this.config.queryType = args[1];\n\t\tif ( args[2] === undefined ) this.config.dataType = this.defined.dataType;\n\t\t\telse this.config.dataType = args[2];\n\t\tif ( args[3] === undefined ) this.config.async = this.defined.async;\n\t\t\telse this.config.async = args[3];\n\t\tif ( args[4] === undefined ) this.config.data = this.defined.data;\n\t\t\telse this.config.data = args[4];\n\t\tif ( args[5] === undefined ) this.config.timeout = this.defined.timeout;\n\t\t\telse this.config.timeout = args[5];\n\t}\n\tthis.router = function(ARGS){\n\t\tswitch( ARGS.length ) {\n\t\t\tcase 0 : this.lastQuery ? this.control = true : 0; break;\n\t\t\tcase 1 : this.fromObject(ARGS[0]); break;\n\t\t\tdefault : this.fromArguments(ARGS);\n\t\t}\n\t}\n\tthis.request = function() {\n\t\tthis.router(arguments);\n\t\tif( this.control ) {\n\t\t\treturn new Promise( function(resolve,reject) {\n\t\t\t\t$.ajax({\n\t\t\t\t\ttimeout : document.http.config.url,\n\t\t\t\t\turl : document.http.config.url,\n\t\t\t\t\ttype : document.http.config.queryType,\n\t\t\t\t\tdataType : document.http.config.dataType,\n\t\t\t\t\tasync : document.http.config.async,\n\t\t\t\t\tdata : document.http.config.data,\n\t\t\t\t\tsuccess : function( data, control ) { document.http.lastQuery = true; resolve(data) },\n\t\t\t\t\terror : function (xhr, errorType, exception) { var errorMessage = exception || xhr.controlText; reject(errorMessage); },\n\t\t\t\t\tcomplete : function() {\n\t\t\t\t\t\tdocument.http.control = false;\n\t\t\t\t\t\tvar msg = 'Request to ' + document.http.config.url+ ' completed'\n\t\t\t\t\t\tif ( document.http.log.console ) console.log(msg);\n\t\t\t\t\t\tdocument.http.log.push(msg);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} )\n\t\t} else {\n\t\t\tconsole.error('Cannot to request'); return false;\n\t\t}\n\t}\n}", "async inbound(count, rawObj) {\n console.debug(\n `vat-http.inbound (from browser) ${count}`,\n JSON.stringify(rawObj, undefined, 2),\n );\n\n const { type, meta: rawMeta = {} } = rawObj || {};\n const {\n url = '/private/repl',\n channelID: rawChannelID,\n dispatcher = 'onMessage',\n } = rawMeta;\n\n try {\n let channelHandle = channelIdToHandle.get(rawChannelID);\n if (dispatcher === 'onOpen') {\n channelHandle = harden({});\n channelIdToHandle.set(rawChannelID, channelHandle);\n channelHandleToId.set(channelHandle, rawChannelID);\n } else if (dispatcher === 'onClose') {\n channelIdToHandle.delete(rawChannelID);\n channelHandleToId.delete(channelHandle);\n }\n\n const obj = {\n ...rawObj,\n };\n delete obj.meta;\n\n const meta = {\n ...rawMeta,\n channelHandle,\n };\n delete meta.channelID;\n\n if (url === '/private/repl') {\n // Use our local handler object (compatibility).\n // TODO: standardise\n if (handler[type]) {\n D(commandDevice).sendResponse(\n count,\n false,\n await handler[type](obj, meta),\n );\n return;\n }\n }\n\n const urlHandlers = registeredURLHandlers.get(url);\n if (urlHandlers) {\n // todo fixme avoid the loop\n // For now, go from the end to beginning so that handlers\n // override.\n for (let i = urlHandlers.length - 1; i >= 0; i -= 1) {\n // eslint-disable-next-line no-await-in-loop\n const res = await E(urlHandlers[i])[dispatcher](obj, meta);\n\n if (res) {\n D(commandDevice).sendResponse(count, false, harden(res));\n return;\n }\n }\n }\n\n if (dispatcher === 'onMessage') {\n throw Error(`No handler for ${url} ${type}`);\n }\n D(commandDevice).sendResponse(count, false, harden(true));\n } catch (rej) {\n console.debug(`Error ${dispatcher}:`, rej);\n const jsonable = (rej && rej.message) || rej;\n D(commandDevice).sendResponse(count, true, harden(jsonable));\n }\n }", "state() {\n return {\n [namespace]: {\n requestStatus: STATUSES.NOT_STARTED,\n data: null,\n error: null,\n },\n }\n }", "function manageStateChange () {\n if (xhr.readyState === 4) {\n // Two params, http status, response\n onComplete(xhr.status, xhr.response);\n } else {\n onStateChange(xhr.readyState, xhr.response);\n }\n }", "handleNewRequest(query) {\n this.setState({ query: this.state.query })\n }", "_callState(cp) {\n switch (this.state) {\n case State.DATA: {\n this._stateData(cp);\n break;\n }\n case State.RCDATA: {\n this._stateRcdata(cp);\n break;\n }\n case State.RAWTEXT: {\n this._stateRawtext(cp);\n break;\n }\n case State.SCRIPT_DATA: {\n this._stateScriptData(cp);\n break;\n }\n case State.PLAINTEXT: {\n this._statePlaintext(cp);\n break;\n }\n case State.TAG_OPEN: {\n this._stateTagOpen(cp);\n break;\n }\n case State.END_TAG_OPEN: {\n this._stateEndTagOpen(cp);\n break;\n }\n case State.TAG_NAME: {\n this._stateTagName(cp);\n break;\n }\n case State.RCDATA_LESS_THAN_SIGN: {\n this._stateRcdataLessThanSign(cp);\n break;\n }\n case State.RCDATA_END_TAG_OPEN: {\n this._stateRcdataEndTagOpen(cp);\n break;\n }\n case State.RCDATA_END_TAG_NAME: {\n this._stateRcdataEndTagName(cp);\n break;\n }\n case State.RAWTEXT_LESS_THAN_SIGN: {\n this._stateRawtextLessThanSign(cp);\n break;\n }\n case State.RAWTEXT_END_TAG_OPEN: {\n this._stateRawtextEndTagOpen(cp);\n break;\n }\n case State.RAWTEXT_END_TAG_NAME: {\n this._stateRawtextEndTagName(cp);\n break;\n }\n case State.SCRIPT_DATA_LESS_THAN_SIGN: {\n this._stateScriptDataLessThanSign(cp);\n break;\n }\n case State.SCRIPT_DATA_END_TAG_OPEN: {\n this._stateScriptDataEndTagOpen(cp);\n break;\n }\n case State.SCRIPT_DATA_END_TAG_NAME: {\n this._stateScriptDataEndTagName(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPE_START: {\n this._stateScriptDataEscapeStart(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPE_START_DASH: {\n this._stateScriptDataEscapeStartDash(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED: {\n this._stateScriptDataEscaped(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_DASH: {\n this._stateScriptDataEscapedDash(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_DASH_DASH: {\n this._stateScriptDataEscapedDashDash(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN: {\n this._stateScriptDataEscapedLessThanSign(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN: {\n this._stateScriptDataEscapedEndTagOpen(cp);\n break;\n }\n case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME: {\n this._stateScriptDataEscapedEndTagName(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPE_START: {\n this._stateScriptDataDoubleEscapeStart(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED: {\n this._stateScriptDataDoubleEscaped(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH: {\n this._stateScriptDataDoubleEscapedDash(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH: {\n this._stateScriptDataDoubleEscapedDashDash(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN: {\n this._stateScriptDataDoubleEscapedLessThanSign(cp);\n break;\n }\n case State.SCRIPT_DATA_DOUBLE_ESCAPE_END: {\n this._stateScriptDataDoubleEscapeEnd(cp);\n break;\n }\n case State.BEFORE_ATTRIBUTE_NAME: {\n this._stateBeforeAttributeName(cp);\n break;\n }\n case State.ATTRIBUTE_NAME: {\n this._stateAttributeName(cp);\n break;\n }\n case State.AFTER_ATTRIBUTE_NAME: {\n this._stateAfterAttributeName(cp);\n break;\n }\n case State.BEFORE_ATTRIBUTE_VALUE: {\n this._stateBeforeAttributeValue(cp);\n break;\n }\n case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED: {\n this._stateAttributeValueDoubleQuoted(cp);\n break;\n }\n case State.ATTRIBUTE_VALUE_SINGLE_QUOTED: {\n this._stateAttributeValueSingleQuoted(cp);\n break;\n }\n case State.ATTRIBUTE_VALUE_UNQUOTED: {\n this._stateAttributeValueUnquoted(cp);\n break;\n }\n case State.AFTER_ATTRIBUTE_VALUE_QUOTED: {\n this._stateAfterAttributeValueQuoted(cp);\n break;\n }\n case State.SELF_CLOSING_START_TAG: {\n this._stateSelfClosingStartTag(cp);\n break;\n }\n case State.BOGUS_COMMENT: {\n this._stateBogusComment(cp);\n break;\n }\n case State.MARKUP_DECLARATION_OPEN: {\n this._stateMarkupDeclarationOpen(cp);\n break;\n }\n case State.COMMENT_START: {\n this._stateCommentStart(cp);\n break;\n }\n case State.COMMENT_START_DASH: {\n this._stateCommentStartDash(cp);\n break;\n }\n case State.COMMENT: {\n this._stateComment(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN: {\n this._stateCommentLessThanSign(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN_BANG: {\n this._stateCommentLessThanSignBang(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN_BANG_DASH: {\n this._stateCommentLessThanSignBangDash(cp);\n break;\n }\n case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH: {\n this._stateCommentLessThanSignBangDashDash(cp);\n break;\n }\n case State.COMMENT_END_DASH: {\n this._stateCommentEndDash(cp);\n break;\n }\n case State.COMMENT_END: {\n this._stateCommentEnd(cp);\n break;\n }\n case State.COMMENT_END_BANG: {\n this._stateCommentEndBang(cp);\n break;\n }\n case State.DOCTYPE: {\n this._stateDoctype(cp);\n break;\n }\n case State.BEFORE_DOCTYPE_NAME: {\n this._stateBeforeDoctypeName(cp);\n break;\n }\n case State.DOCTYPE_NAME: {\n this._stateDoctypeName(cp);\n break;\n }\n case State.AFTER_DOCTYPE_NAME: {\n this._stateAfterDoctypeName(cp);\n break;\n }\n case State.AFTER_DOCTYPE_PUBLIC_KEYWORD: {\n this._stateAfterDoctypePublicKeyword(cp);\n break;\n }\n case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER: {\n this._stateBeforeDoctypePublicIdentifier(cp);\n break;\n }\n case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED: {\n this._stateDoctypePublicIdentifierDoubleQuoted(cp);\n break;\n }\n case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED: {\n this._stateDoctypePublicIdentifierSingleQuoted(cp);\n break;\n }\n case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER: {\n this._stateAfterDoctypePublicIdentifier(cp);\n break;\n }\n case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS: {\n this._stateBetweenDoctypePublicAndSystemIdentifiers(cp);\n break;\n }\n case State.AFTER_DOCTYPE_SYSTEM_KEYWORD: {\n this._stateAfterDoctypeSystemKeyword(cp);\n break;\n }\n case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER: {\n this._stateBeforeDoctypeSystemIdentifier(cp);\n break;\n }\n case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED: {\n this._stateDoctypeSystemIdentifierDoubleQuoted(cp);\n break;\n }\n case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED: {\n this._stateDoctypeSystemIdentifierSingleQuoted(cp);\n break;\n }\n case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER: {\n this._stateAfterDoctypeSystemIdentifier(cp);\n break;\n }\n case State.BOGUS_DOCTYPE: {\n this._stateBogusDoctype(cp);\n break;\n }\n case State.CDATA_SECTION: {\n this._stateCdataSection(cp);\n break;\n }\n case State.CDATA_SECTION_BRACKET: {\n this._stateCdataSectionBracket(cp);\n break;\n }\n case State.CDATA_SECTION_END: {\n this._stateCdataSectionEnd(cp);\n break;\n }\n case State.CHARACTER_REFERENCE: {\n this._stateCharacterReference(cp);\n break;\n }\n case State.NAMED_CHARACTER_REFERENCE: {\n this._stateNamedCharacterReference(cp);\n break;\n }\n case State.AMBIGUOUS_AMPERSAND: {\n this._stateAmbiguousAmpersand(cp);\n break;\n }\n case State.NUMERIC_CHARACTER_REFERENCE: {\n this._stateNumericCharacterReference(cp);\n break;\n }\n case State.HEXADEMICAL_CHARACTER_REFERENCE_START: {\n this._stateHexademicalCharacterReferenceStart(cp);\n break;\n }\n case State.HEXADEMICAL_CHARACTER_REFERENCE: {\n this._stateHexademicalCharacterReference(cp);\n break;\n }\n case State.DECIMAL_CHARACTER_REFERENCE: {\n this._stateDecimalCharacterReference(cp);\n break;\n }\n case State.NUMERIC_CHARACTER_REFERENCE_END: {\n this._stateNumericCharacterReferenceEnd(cp);\n break;\n }\n default: {\n throw new Error('Unknown state');\n }\n }\n }", "function onRequest(request, response) {\n \n var parsedreq = urlparser.parse(request.url, true);\n console.log(parsedreq.query);\n var req = parsedreq.pathname.split(\"/\");\n\n //var req = urlparser.parse(request.url).pathname.split(\"/\");\n var requestBody = '';\n var space = req[1];\n var thing = req[2];\n var action = req[3];\n console.log(\"Space: \" + space);\n console.log(\"Thing: \" + thing);\n console.log(\"Action: \" + action);\n \n try {\n if(request.method == \"GET\") {\n \n if (space.length == 0) {\n response.writeHead(200, {'Content-Type': 'text/html'});\n response.end(\"<META http-equiv=\\\"refresh\\\" content=\\\"60\\\"><body>\" + userPage() + \"</body>\");\n } else {\n if (thing === \"service\") {\n \n if (parsedreq.query.hasOwnProperty(\"user\")) {\n logEventToDb({'raw': {user: parsedreq.query.user, name: parsedreq.query.name}, 'space':space, 'message': parsedreq.query.name + \" ran service \" + action + \" in space \" + spaceName(space)});\n }\n \n if (action == \"here\") {\n response.writeHead(200, {'Content-Type': 'text/html'});\n response.end(\"<META http-equiv=\\\"refresh\\\" content=\\\"60\\\"><body>\" + services.hereService(context, space, request, response)+\"</body>\");\n } else if (action == \"speak\") {\n response.writeHead(200, {'Content-Type': 'text/html'});\n response.end(services.speakService(context, space, request, response));\n } else if (action == \"hal\") {\n response.writeHead(200, {'Content-Type': 'text/html'});\n response.end(services.halService(context, space, request, response));\n } else if (action == \"stlights\") {\n response.writeHead(200, {'Content-Type': 'text/html'});\n services.stLightsService(context, space, request, response);\n } else if (action == \"athome\") {\n services.atHomeService(context, space, request, response);\n } else {\n response.writeHead(200, {'Content-Type': 'text/html'});\n response.end(services.unknownService(context, space, request, response));\n }\n } else if (space === \"allbrains\") {\n allbrains(response);\n } else if (space === \"spaces\") {\n response.writeHead(200, {'Content-Type': 'application/json'});\n response.end(JSON.stringify(spacemetadata,\n undefined, 1));\n \n } else if (thing === \"users\") {\n response.writeHead(200, {'Content-Type': 'application/json'});\n response.end(JSON.stringify({\"users\": spacemap.hasOwnProperty(space) ? spacemap[space] : new Array(),\n }, undefined, 1));\n } else {\n response.writeHead(400, \"No Space Supplied\", {'Content-Type': 'text/html'});\n response.end('<html><head><title>400</title></head><body>400: URI should end in /Channel</body></html>');\n }\n }\n } else {\n if (request.method == \"PUT\") {\n \n if (space.length == 0) {\n //bad post\n response.writeHead(400, \"No Space Supplied\", {'Content-Type': 'text/html'});\n response.end('<html><head><title>400</title></head><body>400: URI should end in /Channel</body></html>');\n } else {\n request.on('data', function (data) {\n requestBody += data;\n if (requestBody.length > 1e7) {\n response.writeHead(413, \"Request Entity Too Large\", { 'Content-Type': 'text/html' });\n response.end('<html><head><title>413</title></head><body>413: Request Entity Too Large</body></html>');\n }\n });\n request.on('end', processPut);\n \n function processPut() {\n \n // debugging\n console.log(\"Data: \" + requestBody);\n \n var rec = JSON.parse(requestBody);\n \n \n if (action.length > 0) {\n if (action == \"leave\") {\n logEventToDb({'raw': rec, 'space':space, 'message': rec.name + \" left \" + spaceName(space) + \" space\"});\n doExitHooks(space, rec);\n } else if (action == \"enter\") {\n logEventToDb({'raw': rec, 'space':space, 'message': rec.name + \" entered \" + spaceName(space) + \" space\"});\n doEnterHooks(space, rec);\n } else if (action == \"refresh\") {\n logEventToDb({'raw': rec, 'space':space, 'message': rec.name + \" refreshed presence in \" + spaceName(space) + \" space\"});\n doRefreshHooks(space, rec);\n } else if (action == \"signoff\") {\n // space is ignored it should be \"all\"\n doGlobalSpaceExit(rec);\n } else {\n \n // error\n }\n \n // return current space user list on entry or exit\n response.writeHead(200, {'Content-Type': 'application/json'});\n response.end(JSON.stringify({\"users\": spacemap.hasOwnProperty(space) ? spacemap[space] : new Array(),\n }, undefined, 1));\n } else {\n // bad req\n response.writeHead(400, request.method + \" not supported without action\", {'Content-Type': 'text/html'});\n response.end('<html><head><title>400</title></head><body>400: Use GET</body></html>');\n }\n }\n \n \n }\n \n } else {\n //bad post\n response.writeHead(400, request.method + \" not supported\", {'Content-Type': 'text/html'});\n response.end('<html><head><title>400</title></head><body>400: Wait, What?</body></html>');\n }\n }\n }\n catch (e) {\n console.log(e);\n console.log(e.stack);\n response.writeHead(400, request.method + \" not supported\", {'Content-Type': 'text/html'});\n response.end('<html><head><title>400</title></head><body>400: OOPS!</body></html>');\n \n }\n \n \n }", "constructor(props){\n super(props); // calling the constructor of the Super Class\n this.state = {\n input: \"\",\n status: \"\",\n message: \"\",\n }\n\n //Binding is necesssary to make 'this' work during callback\n this.handleDigit = this.handleDigit.bind(this);\n this.handleCal = this.handleCal.bind(this);\n this.handleClr = this.handleClr.bind(this);\n }", "createHandler({ path, disableHealthCheck, onHealthCheck } = {}) {\n // We'll kick off the `willStart` right away, so hopefully it'll finish\n // before the first request comes in.\n const promiseWillStart = this.willStart();\n return async (req, res) => {\n this.graphqlPath = path || '/graphql';\n await promiseWillStart;\n if (typeof apollo_server_core_1.processFileUploads === 'function') {\n await this.handleFileUploads(req, res);\n }\n if (this.isHealthCheckRequest(req, disableHealthCheck)) {\n return this.handleHealthCheck({\n req,\n res,\n onHealthCheck,\n });\n }\n if (this.isPlaygroundRequest(req)) {\n return this.handleGraphqlRequestsWithPlayground({ req, res });\n }\n return this.handleGraphqlRequestsWithServer({ req, res });\n };\n }", "function OnChange(self, state)\n {\n date = self.ViewModel.DateValue()\n time = self.ViewModel.TimeValue()\n args = self.parameters.post_service\n if (self.has_date && self.has_time) {\n args[\"datetime\"] = self.state\n datetime = new Date(self.state);\n args[\"date\"] = date;\n args[\"time\"] = time;\n }\n else if (self.has_date) {\n args[\"date\"] = date;\n }\n else {\n args[\"time\"] = time;\n }\n self.call_service(self, args);\n }", "function postState(req, deviceid, staterec) {\n var sendreq = {};\n var bodyStr = JSON.stringify({state: staterec},\n undefined, 0);\n sendreq.body = bodyStr;\n \n\n sendreq.headers = req.headers;\n sendreq.headers['Content-Length'] = bodyStr.length;\n sendreq.uri = req.uri + \"/\" + deviceid;\n sendreq.method = \"PUT\";\n console.log(req);\n console.log(sendreq);\n request(sendreq, function (err, res, body) {\n console.log(\"SUCCESS: \", bodyStr, err);\n });\n \n}", "clientNewData(state) {\n return state.clientNewData;\n }", "function handleData(stateObj, err, data) {\n var hash = stateObj.hash;\n\n // Assume this must be a connection error, not positive that's only case though (TODO)\n if (err) this.setState({ error: err });\n\n // else if no data received from getTransaction, if the txObj exists remove tx from its current state and callback the txObj that failed\n else if (!data || !data.hash) {\n\n // if txinfo exists for this, yet it failed\n if (hash in this.state.info) {\n // stateObj.type _could_ be overwritten here by state.info[hash].type...\n if (stateObj.hasOwnProperty(\"type\")) this.setState({ accounts: this.delTxState(this.state.accounts, stateObj, false) }); // saved to ls after loadTxData completes\n errors.push(_.merge(stateObj, this.state.info[hash]));\n delete this.state.info[hash];\n this.setState({ info: this.state.info });\n } else errors.push(stateObj); // if txinfo doesn't exist, why are we looking at this?\n\n // else data was received\n } else {\n\n // If unseen by objects (first tx data found for hash), add tx state to pending\n data.hash = utils.formatHex(data.hash);\n if (!(data.hash in this.state.objects)) {\n this.setState({ accounts: this.addTxState(this.state.accounts, {\n hash: data.hash,\n account: data.from,\n type: \"pending\",\n nonce: data.nonce\n }, false) });\n }\n\n this.setState({ objects: _.set(this.state.objects, data.hash, data) });\n }\n\n if (++dataCount == txs.length * methods.length && typeof callback === \"function\") callback(errors.length ? errors : null);\n }", "function success(response) {\n console.log(\"update states success\");\n }", "function PostRequestHandler(HandledRequest, response, request, body) {\n switch (request.url) {\n case '/AuthUser':\n HandledRequest.body = JSON.parse(body);\n HandledRequest.type = 'AuthUser'\n break;\n case '/PriPubKeys':\n HandledRequest.body = JSON.parse(body);\n HandledRequest.type = 'ChangePriPubKey';\n break;\n case '/UpdateCreatePDID':\n HandledRequest.body = JSON.parse(body);\n HandledRequest.type = 'ChangePDID'\n break;\n case '/PDIDToUSB':\n HandledRequest.body = JSON.parse(body);\n HandledRequest.type = 'WritePDID';\n break;\n case '/PostPassword':\n HandledRequest.body = body.split('\\t');\n let cookies = parseCookies(request)\n if (Object.keys(cookies).length === 0 && cookies.constructor === Object) {\n RejectRequest(response, \"smile\")\n } else {\n HandledRequest.cookies = {\n UserID: cookies['user-id'],\n MasterPw: cookies.masterpw,\n Message: JSON.parse(cookies.message),\n }\n HandledRequest.type = 'PostPassword'\n }\n break;\n case '/ChooseUserUSB':\n HandledRequest.body = JSON.parse(body);\n HandledRequest.type = 'ChooseUserUSB';\n break;\n case '/ChooseUserPDID':\n HandledRequest.body = JSON.parse(body);\n HandledRequest.type = 'ChooseUserPDID';\n break;\n default:\n break;\n }\n return HandledRequest;\n}", "onReadyStateChangeHandler() {\n let xhr = window.http;\n if (!xhr.isStateReady() || xhr.options === undefined)\n return;\n let handler = xhr.completionHandlers[xhr.options.url];\n if (handler === undefined)\n return;\n let result = undefined;\n let isJson = xhr.options === undefined ? undefined : xhr.options.isJson === undefined ? false : xhr.options.isJson;\n switch (isJson !== undefined && isJson === true && xhr.xmlHtpRequest.status !== 0) {\n case true:\n console.log(\"response \", xhr.xmlHtpRequest.responseText);\n result = JSON.parse(xhr.xmlHtpRequest.responseText);\n break;\n case false:\n result = xhr.xmlHtpRequest.responseText;\n break;\n }\n handler(result, xhr.xmlHtpRequest.status, this);\n delete xhr.completionHandlers[xhr.options.url];\n xhr.executeNextTask();\n }", "function WebhookPostHandler(session, testing, pageId) {\n if(testing) TEST_MODE = true; // Use sparingly. Currently, only used in callSendAPI\n this.travelSfoPageHandler = new TravelSfoPageHandler();\n this.seaSprayHandler = new SeaSprayHandler(TEST_MODE);\n this.hackshawHandler = new HackshawHandler();\n\tthis.pageId = PageHandler.defaultPageId;\n if(pageId) this.pageId = pageId;\n this.secretManager = new SecretManager();\n this.sessions = Sessions.get();\n if(testing) this.pageHandler = PageHandler.get(\"fbid-test.txt\");\n\telse this.pageHandler = PageHandler.get();\n this.fbidHandler = this.pageHandler.getFbidHandler();\n if(session) {\n logger.info(`WebhookPostHandler: A session with id ${session.sessionId} was passed. Using that in the post hook handler`);\n this.passedSession = session;\n this.session = session;\n logger.info(`WebhookPostHandler: Setting session state`);\n this.sessionState = this.sessions.testing_getState(session);\n }\n this.logOnce = {};\n // Creating this here because the constructor reads a huge file. Creating this here would mean we can simply pass this around, instead of creating it every single time.\n this.airportCodes = new AirportCodes();\n const self = this;\n\t// A Cheap way to trigger data update on changes across processes: Create a monitor that will trigger when files in ~/sessions changes, and reload the session that changed. This way, we don't have to reload sessions all over the place and this will work even across processes (for eg. when we create a new trip as a result of an itinerary or boarding pass email, the main webserver's sessions will automatically be reloaded within a few minutes)\n watch.createMonitor(Sessions.path(), { ignoreDotFiles: true }, function(monitor) {\n monitor.on('changed', function(f) {\n logger.debug(`file ${f} changed. reloading it.`);\n const s = JSON.parse(fs.readFileSync(f, 'utf8'));\n self.sessions.reloadSession(s.sessionId);\n });\n });\n}", "constructor(active) {\n this.request = {};\n this.request.location = window.location;\n this.response = {};\n this.response.render = function(status, path, parent, name, cb) {\n active.render(status, path, parent, name, cb);\n };\n this.response.useComponent = (component, parent) => {\n active.useComponent(component, parent);\n }\n this.response.renderComponent = function(cb, options, finish) {\n active.renderComponent(cb, options, finish);\n };\n this.response.filterContent = function(element, options, cb) {\n active.filterContent(element, options, cb);\n };\n this.response.redirect = function(url) {\n location.replace(url);\n };\n this.getRoutes = {};\n this.postRoutes = {};\n this.putRoutes = {};\n this.deleteRoutes = {};\n this.MainPathName = location.pathname;\n this.useRoutes = {};\n }", "function routeHTTPRequest(entry) {\n // get message. entry.messaging and entry.standby? (check this) array will only ever contain a single message\n let webhook_event;\n\n if(entry.messaging==null) { \n console.log('Entry.messaging array null');\n if(entry.standby==null) {\n console.log('--> Entry.standby array null');\n return;\n } else {\n // standby event occurred; pass event\n console.log('Entry has standby; routing to standby handler:');\n webhook_event = entry.standby[0];\n onStandby(webhook_event.sender.id, entry.id, webhook_event.message);\n return;\n }\n }\n webhook_event = entry.messaging[0];\n\n // log\n console.log(\"Request body:\");\n console.log(webhook_event);\n\n // pass event to appropriate handler\n if (webhook_event.message) {\n console.log('Routing to message handler');\n onMessage(webhook_event.sender.id, entry.id, webhook_event.message);\n } else if (webhook_event.postback) {\n console.log('Routing to postback handler');\n onPostback(webhook_event.sender.id, entry.id, webhook_event.postback);\n } else if (webhook_event.pass_thread_control) {\n console.log(\"--> Handover event does not require action.\");\n } else {\n console.log(\"--> Unrecognized event; no further action taken.\");\n }\n}", "handleRequest(payload, next, end) {\n return __awaiter(this, void 0, void 0, function* () {\n let message;\n let address;\n switch (payload.method) {\n case 'web3_clientVersion':\n try {\n const nodeVersion = yield this._web3Wrapper.getNodeVersionAsync();\n end(null, nodeVersion);\n }\n catch (err) {\n end(err);\n }\n return;\n case 'eth_accounts':\n try {\n const accounts = yield this._web3Wrapper.getAvailableAddressesAsync();\n end(null, accounts);\n }\n catch (err) {\n end(err);\n }\n return;\n case 'eth_sendTransaction':\n const [txParams] = payload.params;\n try {\n const txData = web3_wrapper_1.marshaller.unmarshalTxData(txParams);\n const txHash = yield this._web3Wrapper.sendTransactionAsync(txData);\n end(null, txHash);\n }\n catch (err) {\n end(err);\n }\n return;\n case 'eth_sign':\n [address, message] = payload.params;\n try {\n const signature = yield this._web3Wrapper.signMessageAsync(address, message);\n end(null, signature);\n }\n catch (err) {\n end(err);\n }\n return;\n case 'eth_signTypedData':\n [address, message] = payload.params;\n try {\n const signature = yield this._web3Wrapper.signTypedDataAsync(address, message);\n end(null, signature);\n }\n catch (err) {\n end(err);\n }\n return;\n default:\n next();\n return;\n }\n });\n }", "function processRequest(e){\n //fires 5 times bc fires everytime state changes, but only want when state is done so provide conditions\n // status provides it is okay too.\n if (xhr.readyState == 4 && xhr.status == 200){\n //parse json string for readable response.\n var response = JSON.parse(xhr.responseText);\n \n //print response in popup by sending message to popup with response(term) info.\n chrome.runtime.sendMessage(response);\n }\n }", "processGETRequest(response){\n if (response.readyState === 4 && response.status === 200){\n\n let data = '';\n let error = '';\n\n try {\n data = JSON.parse(response.responseText);\n } catch (e){\n this.setState({\n 'failed': true\n })\n error = 'Not JSON';\n }\n\n if (!data.hasOwnProperty('events')){\n this.setState({\n 'failed': true\n })\n\n error = 'No events property';\n }\n\n if (error !== ''){\n console.log(error);\n console.log(response);\n }\n\n this.setState({\n 'dataReceived': true,\n 'data': this.transformEvents(JSON.parse(response.responseText)['events'])\n });\n }\n else if (response.readyState === 4){\n\n console.log('Response status of '+response.status);\n console.log(response);\n\n this.setState({\n 'failed': true\n })\n }\n }", "function makeHandler(httpRequest, retcode, action)\n{\n\tfunction handler()\n\t{\n\t\tif(httpRequest.readyState === XMLHttpRequest.DONE)\n\t\t{\n\t\t\t//alert(\"done\");\n\t\t\tif(httpRequest.status === retcode)\n\t\t\t{\n\t\t\t\tif(httpRequest.responseText)\n\t\t\t\t\tconsole.log(\"recieved response text: \" + JSON.parse(httpRequest.responseText));\n\t\t\t\telse\n\t\t\t\t\talert(\"I got nothin\");\n\t\t\t\taction(httpRequest.responseText);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\talert(httpRequest.status + \":There was a problem with the request\");\n\t\t\t\tconsole.log(\"Error: \" + JSON.parse(httpRequest.responseText));\n\t\t\t}\n\t\t}\n\t}\n\t//alert(\"function returned\");\n\treturn handler;\n}" ]
[ "0.61279833", "0.61116534", "0.6052916", "0.60059285", "0.57766646", "0.5752508", "0.57008064", "0.56996626", "0.56518334", "0.56311244", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56155086", "0.56084645", "0.5596042", "0.558419", "0.555473", "0.555078", "0.5523992", "0.55076224", "0.54886883", "0.5439732", "0.5414008", "0.5392524", "0.5380635", "0.5331326", "0.53210753", "0.53064847", "0.52908367", "0.52710307", "0.52593255", "0.5255202", "0.5240113", "0.52380526", "0.5226693", "0.5214767", "0.52116364", "0.5207605", "0.5199161", "0.5196198", "0.5191286", "0.5180048", "0.5179785", "0.51737005", "0.5171657", "0.51664776", "0.5150597", "0.51434845", "0.5138004", "0.5135612", "0.5130087", "0.5124298", "0.5119092", "0.5101522", "0.5095568", "0.5086456", "0.50848794", "0.50848794", "0.5078247", "0.50663966", "0.5064911", "0.5064911", "0.5054112", "0.50535226", "0.5043924", "0.50409406", "0.5038411", "0.5031676", "0.5026771", "0.5025586", "0.502505", "0.5018939", "0.50185674", "0.5014383", "0.50127697", "0.50049466", "0.50009805", "0.50009143", "0.50006807", "0.49993217", "0.49949512", "0.49927458", "0.4988713", "0.4985734", "0.49856335", "0.4984194", "0.4983912", "0.49757665", "0.49739578", "0.4964068", "0.49624276", "0.4959173", "0.4954673" ]
0.0
-1
Create new HTTP Call to the service indicated by the argument
function MakeXMLHTTPCallListCategories(method, url) { xmlHttpObj = CreateXmlHttpRequestObject(); if (xmlHttpObj) { xmlHttpObj.open(method, url, true); xmlHttpObj.onreadystatechange = stateHandlerListCategories; xmlHttpObj.send(null); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeRequest(serviceMethod, data, params) {\n return $http({\n method: serviceMethod.httpMethod || 'GET',\n url: getServiceUrl(serviceMethod),\n data: data || {},\n params: params || {}\n });\n }", "function service(arg) {\n if (_typeof(arg) === 'object') {\n // When we add query params, our backend will complain if we don't have a\n // trailing slash.\n var path = arg.path.slice(-1) === '/' ? arg.path : arg.path.concat('/');\n var url = new URL(endpoint.concat(path));\n\n if ('params' in arg) {\n for (var key in arg.params) {\n if (arg.params.hasOwnProperty(key)) {\n var val = arg.params[key];\n url.searchParams.append(key, val);\n }\n }\n }\n\n return url;\n } else {\n return endpoint.concat(arg);\n }\n}", "function factory(app, unused, opt_url) {\n\t return new _service.Service(app, new _xhriopool.XhrIoPool(), opt_url);\n\t}", "function factory(app, unused, opt_url) {\n return new _service.Service(app, new _xhriopool.XhrIoPool(), opt_url);\n}", "function factory(app, unused, opt_url) {\n return new _service.Service(app, new _xhriopool.XhrIoPool(), opt_url);\n}", "function factory(app, unused, opt_url) {\n return new _service.Service(app, new _xhriopool.XhrIoPool(), opt_url);\n}", "function factory(app, unused, opt_url) {\n return new _service.Service(app, new _xhriopool.XhrIoPool(), opt_url);\n}", "http (url, options) {\n return this.robot.http(url, options)\n }", "function makeCall(id,url,data) {\n request=initRequest();\n response=null;\n \n request.open(\"POST\",url,false); \n request.setRequestHeader('Content-type','application/x-www-form-urlencoded;charset=UTF-8;');\n \n request.send(data);\n \n if (request.status == 200) {\n response=request.responseText;\n }\n \n return response;\n\n }", "create(options) {\n const operationArguments = {\n options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(operationArguments, createOperationSpec$2);\n }", "create(options) {\n const operationArguments = {\n options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(operationArguments, createOperationSpec$2);\n }", "function MakeURL(cmd, id)\n {\n if (id === undefined) \n return \"/service/\" + cmd; \n return \"/service/\" + cmd + \"/\" + id;\n }", "create(options) {\n const operationOptions = coreHttp.operationOptionsToRequestOptionsBase(options || {});\n return this.client.sendOperationRequest({ options: operationOptions }, createOperationSpec);\n }", "async sendOperationRequest(operationArguments, operationSpec) {\n const endpoint = operationSpec.baseUrl || this._endpoint;\n if (!endpoint) {\n throw new Error(\"If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.\");\n }\n // Templatized URLs sometimes reference properties on the ServiceClient child class,\n // so we have to pass `this` below in order to search these properties if they're\n // not part of OperationArguments\n const url = getRequestUrl(endpoint, operationSpec, operationArguments, this);\n const request = coreRestPipeline.createPipelineRequest({\n url,\n });\n request.method = operationSpec.httpMethod;\n const operationInfo = getOperationRequestInfo(request);\n operationInfo.operationSpec = operationSpec;\n operationInfo.operationArguments = operationArguments;\n const contentType = operationSpec.contentType || this._requestContentType;\n if (contentType && operationSpec.requestBody) {\n request.headers.set(\"Content-Type\", contentType);\n }\n const options = operationArguments.options;\n if (options) {\n const requestOptions = options.requestOptions;\n if (requestOptions) {\n if (requestOptions.timeout) {\n request.timeout = requestOptions.timeout;\n }\n if (requestOptions.onUploadProgress) {\n request.onUploadProgress = requestOptions.onUploadProgress;\n }\n if (requestOptions.onDownloadProgress) {\n request.onDownloadProgress = requestOptions.onDownloadProgress;\n }\n if (requestOptions.shouldDeserialize !== undefined) {\n operationInfo.shouldDeserialize = requestOptions.shouldDeserialize;\n }\n if (requestOptions.allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n }\n if (options.abortSignal) {\n request.abortSignal = options.abortSignal;\n }\n if (options.tracingOptions) {\n request.tracingOptions = options.tracingOptions;\n }\n }\n if (this._allowInsecureConnection) {\n request.allowInsecureConnection = true;\n }\n if (request.streamResponseStatusCodes === undefined) {\n request.streamResponseStatusCodes = getStreamingResponseStatusCodes(operationSpec);\n }\n try {\n const rawResponse = await this.sendRequest(request);\n const flatResponse = flattenResponse(rawResponse, operationSpec.responses[rawResponse.status]);\n if (options === null || options === void 0 ? void 0 : options.onResponse) {\n options.onResponse(rawResponse, flatResponse);\n }\n return flatResponse;\n }\n catch (error) {\n if (typeof error === \"object\" && (error === null || error === void 0 ? void 0 : error.response)) {\n const rawResponse = error.response;\n const flatResponse = flattenResponse(rawResponse, operationSpec.responses[error.statusCode] || operationSpec.responses[\"default\"]);\n error.details = flatResponse;\n if (options === null || options === void 0 ? void 0 : options.onResponse) {\n options.onResponse(rawResponse, flatResponse, error);\n }\n }\n throw error;\n }\n }", "function http(_x) {\n return _http.apply(this, arguments);\n} // exported for testing", "function http(_x) {\n return _http.apply(this, arguments);\n} // exported for testing", "async callFunction(name, ...args) {\n // See https://github.com/mongodb/stitch-js-sdk/blob/master/packages/core/sdk/src/services/internal/CoreStitchServiceClientImpl.ts\n const body = {\n name,\n arguments: this.argsTransformation ? this.argsTransformation(args) : args\n };\n\n if (this.serviceName) {\n body.service = this.serviceName;\n }\n\n const appRoute = this.fetcher.appRoute;\n\n return this.fetcher.fetchJSON({\n method: 'POST',\n path: appRoute.functionsCall().path,\n body\n });\n }", "AddService(string, string) {\n\n }", "makeRequest(method, resource, params, callback) { console.log(params)\n if (typeof(method) === 'undefined') { \n method = \"GET\";\n resource += '/?' + params;\n }\n const ascendant = this;\n let requestID = uuid()\n var req = https.request({ \n host: this.host,\n\t\t\tport: this.port,\n\t\t\tpath: resource, \n\t\t\tmethod: method,\n\t\t\theaders: this.request_headers\n }, (response) => { \n var data = '';\n response.on('data', (chunk) => data += chunk); // re-assemble fragmented response data\n response.on('end', () => {\n ascendant.callback(response.statusCode, requestID, data);\n });\n }).on('error', (err) => { \n ascendant.callback(0, requestID, err); // this is called when network request fails\n });\n\n // non-GET HTTP(S) reuqests pass arguments as data\n if (method !== \"GET\" && typeof(params) !== 'undefined') {\n req.write(params);\n }\n req.end();\n }", "function httpGet(url) {\n return {\n type: \"httpGet\",\n url\n };\n}", "function makeServiceGetRequestAsync(method, params, cache) {\n var url = serviceUrl + method,\n allParams = mergeObjects(templateQueryParams, params || {});\n\n return makeGetRequestAsync(url, allParams, cache);\n }", "@exposedMethod\n\trequest(options, url=null, json=null) {\n\t\t/*\n\t\t*\tCreate, send, and return a new `Request`. See the `Request`\n\t\t*\tconstructor for the `options` specification.\n\t\t*/\n\t\tif (typeof options == 'string') {\n\t\t\toptions = {url: options};\n\t\t}\n\t\tif (url) {\n\t\t\toptions.method = options.url;\n\t\t\toptions.url = url;\n\t\t}\n\t\tif (json) {\n\t\t\toptions.json = json;\n\t\t}\n\t\treturn new Request(options);\n\t}", "_RESTfulFactory(verb, type, method, params) {\n\n this.httpHelper.blockUI.start();\n\n let paramsName = ['post', 'put'].indexOf(verb) > -1 ? 'data' : 'params';\n\n return this.$http[verb](this._getUrl(type, method), {\n [paramsName]: params\n }).then(this.httpHelper.verify, this.httpHelper.error);\n\n }", "function makeRequest(method, url, headers, body) {\n return $request[method.toLowerCase()](url, { headers, body });\n}", "request_service(name, cb) {\n const rq = {\n type: 'service',\n name: name,\n };\n\n this._req(rq, (rsp) => {\n if (rsp.status != 'ok') {\n return cb(rsp.status);\n }\n\n this.services[name] = rsp.body;\n return cb(null, rsp.body);\n });\n }", "function call(method, url, params, callback) {\n\n var options = { uri: url, method: method }\n\n if (url.match(/subscriptions/)) {\n if (config.clientID && config.clientSecret)\n options.headers = { 'Authorization': 'Basic ' + new Buffer(config.clientID + ':' + config.clientSecret).toString('base64') }\n } else {\n if (config.token)\n options.headers = { 'Authorization': 'Bearer ' + config.token.token.access_token }\n }\n\n options.json = true; // make the JSON response being parsed\n\n if (isEmpty(params)) params = null;\n method == 'GET' ? options.qs = params : options.json = params\n\n if (process.env.DEBUG) console.log('Lelylan Node: Making the HTTP request', options)\n request(options, callback)\n }", "_call_local_service(name, fun, args, cb) {\n if (name in this.services) {\n const rq = {\n type: 'call',\n fun: fun,\n args: args,\n };\n\n return this._req(this.service_socks[name], rq, (rsp) => {\n if (rsp.status != 'ok') return cb(rsp.status);\n return cb(null, rsp.ret);\n });\n }\n return cb('err: no service');\n }", "function createHttpClient() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n options.baseURL = 'https://api.mollie.com:443/v2/';\n options.headers = Object.assign({}, options.headers, {\n Authorization: \"Bearer \".concat(options.apiKey),\n 'Accept-Encoding': 'gzip',\n 'Content-Type': 'application/json',\n 'User-Agent': \"node.js/\".concat(process.version),\n 'X-Mollie-User-Agent': \"mollie/\".concat(version)\n });\n options.httpsAgent = new https.Agent({\n cert: cert\n });\n options.paramsSerializer = options.paramsSerializer || qs.stringify;\n return axios.create(options);\n}", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n } else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n } else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n } else {\n params = new HttpParams({\n fromObject: options.params\n });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, options.body !== undefined ? options.body : null, {\n headers,\n context: options.context,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = (0,rxjs__WEBPACK_IMPORTED_MODULE_0__.of)(req).pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_1__.concatMap)(req => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_2__.filter)(event => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe((0,rxjs_operators__WEBPACK_IMPORTED_MODULE_3__.map)(res => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "function makeRequest(options, responseEndCallback, requestId){\n //console.log('making request to url: ' + options.url);\n var url = options.url,\n path = '';\n\n if(!options.url){\n var randomIndex=Math.floor(Math.random()*options.urls.length);//randomly select an index in the urls array\n url = options.urls[randomIndex];\n //console.log('url: %s randomIndex: %s', url, randomIndex);\n }\n\n //seperate the base url from the path.\n var firstSlashIndex = url.indexOf('/');\n if(firstSlashIndex >= 0){\n path = url.substr(firstSlashIndex);\n url = url.substr(0, firstSlashIndex);\n }\n\n //try using agent to get around ECONNRESET. seems to work!\n //var agent = new http.Agent();\n //agent.maxSockets = 20; //1 socket = 1936/2000 success. 10 socket = 1995/2000 success. 20 socket = 2000/2000 success!\n var agent = options.useAgents ? agentProvider.getAgent() : false; //false;//\n\n //create the request options for the http.request api.\n var requestOptions = {\n hostname: url,\n port: options.port,\n path: path,\n method: options.requestMethod,\n agent:agent, //try to fix ECONNRESET, socket closed issue.\n headers:{\n 'connection': options.connectionHeader, //'close' or 'keep-alive'\n 'requestid': requestId\n }\n };\n\n //initiate the request\n var req = http.request(requestOptions, function(res) {\n //console.log('creating request');\n pound.openConnections++;//increment count to keep track\n pound.requestsGenerated++;\n pound.requestsPerSecond = pound.requestsGenerated / ((new Date().getTime() - pound.startMilliseconds) / 1000);\n //console.log('open connections %s - open', pound.openConnections);\n pound.highestOpenConnectionsAtOneTime = pound.openConnections > pound.highestOpenConnectionsAtOneTime ? pound.openConnections : pound.highestOpenConnectionsAtOneTime;\n\n //console.log('STATUS: ' + res.statusCode);\n //console.log('HEADERS: ' + JSON.stringify(res.headers));\n //res.setEncoding('utf8');\n\n //Indicates that the underlaying connection was terminated before response.end() was called or able to flush.\n res.on('close', function(){ // this isn't getting called.\n console.log('response close called');\n });\n\n res.on('end', function(){\n pound.openConnections--;\n });\n //then you must consume the data from the response object, either by calling response.read() whenever there is a 'readable' event\n res.on('readable', function(message){\n //console.log('readable event fired');\n res.read();\n });\n\n }.bind({requestId:requestId}));\n\n //wait for the response\n /**\n * http://nodejs.org/docs/latest/api/http.html#http_class_http_agent\n * If no 'response' handler is added, then the response will be entirely discarded. However, if you add a 'response' event handler, then you must consume the data from the response object,\n * either by calling response.read() whenever there is a 'readable' event, or by adding a 'data' handler, or by calling the .resume() method.\n * Until the data is consumed, the 'end' event will not fire.\n */\n req.on('response', function(resp){\n //console.log('response received');\n //pound.openConnections--;\n \n pound.responsesReceived++;\n pound.responsesPerSecond = pound.responsesReceived / ((new Date().getTime() - pound.startMilliseconds) / 1000);\n //console.log('open connections %s - close', pound.openConnections);\n if(responseEndCallback){\n responseEndCallback(this.requestId);\n }\n });\n\n //log request errors.\n req.on('error', function(e) {\n pound.requestErrorCount++;\n console.warn('problem with requestId: %s to url: %s message: %s \\n complete: %s', this.requestId, this.url, e.message, JSON.stringify(e));\n }.bind({url:url, requestId:requestId}));\n\n //TODO: allow for request timeouts?\n // req.setTimeout(options.requestTimeout, function(e){\n // console.log('timeout for url %s', this.url);\n // this.req.end();\n // this.req.destroy();\n // }.bind({url:url, req:req}));\n\n // write data to request body\n //req.write('data\\n');\n //req.write('data\\n');\n req.end();\n }", "function createHttpClient() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n options.baseURL = 'https://api.mollie.com:443/v1/';\n\n options.headers = Object.assign({}, options.headers, {\n Authorization: 'Bearer ' + options.apiKey,\n 'Accept-Encoding': 'gzip',\n 'Content-Type': 'application/vnd.mollie.api.v1+json',\n 'User-Agent': 'node.js/' + process.version,\n 'X-Mollie-User-Agent': 'mollie/' + version\n });\n\n options.httpsAgent = new https.Agent({\n cert: fs.readFileSync(path.resolve(__dirname, cert))\n });\n\n options.paramsSerializer = options.paramsSerializer || qs.stringify;\n\n return axios.create(options);\n}", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {\n headers,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__[\"of\"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"concatMap\"])((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])((event) => event instanceof HttpResponse));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"map\"])((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }", "function makeRequest(options) {\n data = options.body;\n // Normalize the request url\n url = utils.trim(options.url);\n var baseUrl = utils.trim(options.baseURL || \"\");\n if (!url && isBrowser && !baseUrl) url = location.href;\n if (url.indexOf(\"http\") !== 0) {\n var isAbsolute = url[0] === \"/\";\n if (!baseUrl && isBrowser) {\n var arr = location.pathname.split(\"/\");\n arr.pop();\n baseUrl = location.protocol + \"//\" + location.host + (isAbsolute ? \"\" : arr.join(\"/\"));\n }\n if (baseUrl[baseUrl.length - 1] !== \"/\") {\n baseUrl += \"/\";\n }\n url = baseUrl + (isAbsolute ? url.substr(1) : url);\n if (isBrowser) {\n\n // Normalize the url which contains the \"..\" or \".\", such as\n // \"http://xx.com/aa/bb/../../xx\" to \"http://xx.com/xx\" .\n var t = document.createElement(\"a\");\n t.href = url;\n url = t.href;\n }\n }\n\n var responseType = utils.trim(options.responseType || \"\");\n var needQuery = [\"GET\", \"HEAD\", \"DELETE\", \"OPTION\"].indexOf(options.method) !== -1;\n var dataType = utils.type(data);\n var params = options.params || {};\n\n // merge url params when the method is \"GET\" (data is object)\n if (needQuery && dataType === \"object\") {\n params = utils.merge(data, params);\n }\n // encode params to String\n params = utils.formatParams(params);\n\n // save url params\n var _params = [];\n if (params) {\n _params.push(params);\n }\n // Add data to url params when the method is \"GET\" (data is String)\n if (needQuery && data && dataType === \"string\") {\n _params.push(data);\n }\n\n // make the final url\n if (_params.length > 0) {\n url += (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + _params.join(\"&\");\n }\n\n engine.open(options.method, url);\n\n // try catch for ie >=9\n try {\n engine.withCredentials = !!options.withCredentials;\n engine.timeout = options.timeout || 0;\n if (responseType !== \"stream\") {\n engine.responseType = responseType;\n }\n } catch (e) {}\n\n var customContentType = options.headers[contentType] || options.headers[contentTypeLowerCase];\n\n // default content type\n var _contentType = \"application/x-www-form-urlencoded\";\n // If the request data is json object, transforming it to json string,\n // and set request content-type to \"json\". In browser, the data will\n // be sent as RequestBody instead of FormData\n if (utils.trim((customContentType || \"\").toLowerCase()) === _contentType) {\n data = utils.formatParams(data);\n } else if (!utils.isFormData(data) && [\"object\", \"array\"].indexOf(utils.type(data)) !== -1) {\n _contentType = 'application/json;charset=utf-8';\n data = JSON.stringify(data);\n }\n //If user doesn't set content-type, set default.\n if (!(customContentType || needQuery)) {\n options.headers[contentType] = _contentType;\n }\n\n for (var k in options.headers) {\n if (k === contentType && utils.isFormData(data)) {\n // Delete the content-type, Let the browser set it\n delete options.headers[k];\n } else {\n try {\n // In browser environment, some header fields are readonly,\n // write will cause the exception .\n engine.setRequestHeader(k, options.headers[k]);\n } catch (e) {}\n }\n }\n\n function onresult(handler, data, type) {\n enqueueIfLocked(responseInterceptor.p, function () {\n if (handler) {\n //如果失败,添加请求信息\n if (type) {\n data.request = options;\n }\n var ret = handler.call(responseInterceptor, data, Promise);\n data = ret === undefined ? data : ret;\n }\n if (!isPromise(data)) {\n data = Promise[type === 0 ? \"resolve\" : \"reject\"](data);\n }\n data.then(function (d) {\n resolve(d);\n }).catch(function (e) {\n reject(e);\n });\n });\n }\n\n function onerror(e) {\n e.engine = engine;\n onresult(responseInterceptor.onerror, e, -1);\n }\n\n function Err(msg, status) {\n this.message = msg;\n this.status = status;\n }\n\n engine.onload = function () {\n try {\n // The xhr of IE9 has not response field\n var response = engine.response || engine.responseText;\n if (response && options.parseJson && (engine.getResponseHeader(contentType) || \"\").indexOf(\"json\") !== -1\n // Some third engine implementation may transform the response text to json object automatically,\n // so we should test the type of response before transforming it\n && !utils.isObject(response)) {\n response = JSON.parse(response);\n }\n\n var headers = engine.responseHeaders;\n // In browser\n if (!headers) {\n headers = {};\n var items = (engine.getAllResponseHeaders() || \"\").split(\"\\r\\n\");\n items.pop();\n items.forEach(function (e) {\n if (!e) return;\n var key = e.split(\":\")[0];\n headers[key] = engine.getResponseHeader(key);\n });\n }\n var status = engine.status;\n var statusText = engine.statusText;\n var _data = { data: response, headers: headers, status: status, statusText: statusText };\n // The _response filed of engine is set in adapter which be called in engine-wrapper.js\n utils.merge(_data, engine._response);\n if (status >= 200 && status < 300 || status === 304) {\n _data.engine = engine;\n _data.request = options;\n onresult(responseInterceptor.handler, _data, 0);\n } else {\n var e = new Err(statusText, status);\n e.response = _data;\n onerror(e);\n }\n } catch (e) {\n onerror(new Err(e.msg, engine.status));\n }\n };\n\n engine.onerror = function (e) {\n onerror(new Err(e.msg || \"Network Error\", 0));\n };\n\n engine.ontimeout = function () {\n onerror(new Err(\"timeout [ \" + engine.timeout + \"ms ]\", 1));\n };\n engine._options = options;\n setTimeout(function () {\n engine.send(needQuery ? null : data);\n }, 0);\n }", "function makeRequest(options) {\n data = options.body;\n // Normalize the request url\n url = utils.trim(options.url);\n var baseUrl = utils.trim(options.baseURL || \"\");\n if (!url && isBrowser && !baseUrl) url = location.href;\n if (url.indexOf(\"http\") !== 0) {\n var isAbsolute = url[0] === \"/\";\n if (!baseUrl && isBrowser) {\n var arr = location.pathname.split(\"/\");\n arr.pop();\n baseUrl = location.protocol + \"//\" + location.host + (isAbsolute ? \"\" : arr.join(\"/\"));\n }\n if (baseUrl[baseUrl.length - 1] !== \"/\") {\n baseUrl += \"/\";\n }\n url = baseUrl + (isAbsolute ? url.substr(1) : url);\n if (isBrowser) {\n\n // Normalize the url which contains the \"..\" or \".\", such as\n // \"http://xx.com/aa/bb/../../xx\" to \"http://xx.com/xx\" .\n var t = document.createElement(\"a\");\n t.href = url;\n url = t.href;\n }\n }\n\n var responseType = utils.trim(options.responseType || \"\");\n var needQuery = [\"GET\", \"HEAD\", \"DELETE\", \"OPTION\"].indexOf(options.method) !== -1;\n var dataType = utils.type(data);\n var params = options.params || {};\n\n // merge url params when the method is \"GET\" (data is object)\n if (needQuery && dataType === \"object\") {\n params = utils.merge(data, params);\n }\n // encode params to String\n params = utils.formatParams(params);\n\n // save url params\n var _params = [];\n if (params) {\n _params.push(params);\n }\n // Add data to url params when the method is \"GET\" (data is String)\n if (needQuery && data && dataType === \"string\") {\n _params.push(data);\n }\n\n // make the final url\n if (_params.length > 0) {\n url += (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + _params.join(\"&\");\n }\n\n engine.open(options.method, url);\n\n // try catch for ie >=9\n try {\n engine.withCredentials = !!options.withCredentials;\n engine.timeout = options.timeout || 0;\n if (responseType !== \"stream\") {\n engine.responseType = responseType;\n }\n } catch (e) {}\n\n var customContentType = options.headers[contentType] || options.headers[contentTypeLowerCase];\n\n // default content type\n var _contentType = \"application/x-www-form-urlencoded\";\n // If the request data is json object, transforming it to json string,\n // and set request content-type to \"json\". In browser, the data will\n // be sent as RequestBody instead of FormData\n if (utils.trim((customContentType || \"\").toLowerCase()) === _contentType) {\n data = utils.formatParams(data);\n } else if (!utils.isFormData(data) && [\"object\", \"array\"].indexOf(utils.type(data)) !== -1) {\n _contentType = 'application/json;charset=utf-8';\n data = JSON.stringify(data);\n }\n //If user doesn't set content-type, set default.\n if (!(customContentType || needQuery)) {\n options.headers[contentType] = _contentType;\n }\n\n for (var k in options.headers) {\n if (k === contentType && utils.isFormData(data)) {\n // Delete the content-type, Let the browser set it\n delete options.headers[k];\n } else {\n try {\n // In browser environment, some header fields are readonly,\n // write will cause the exception .\n engine.setRequestHeader(k, options.headers[k]);\n } catch (e) {}\n }\n }\n\n function onresult(handler, data, type) {\n enqueueIfLocked(responseInterceptor.p, function () {\n if (handler) {\n //如果失败,添加请求信息\n if (type) {\n data.request = options;\n }\n var ret = handler.call(responseInterceptor, data, Promise);\n data = ret === undefined ? data : ret;\n }\n if (!isPromise(data)) {\n data = Promise[type === 0 ? \"resolve\" : \"reject\"](data);\n }\n data.then(function (d) {\n resolve(d);\n }).catch(function (e) {\n reject(e);\n });\n });\n }\n\n function onerror(e) {\n e.engine = engine;\n onresult(responseInterceptor.onerror, e, -1);\n }\n\n function Err(msg, status) {\n this.message = msg;\n this.status = status;\n }\n\n engine.onload = function () {\n try {\n // The xhr of IE9 has not response field\n var response = engine.response || engine.responseText;\n if (response && options.parseJson && (engine.getResponseHeader(contentType) || \"\").indexOf(\"json\") !== -1\n // Some third engine implementation may transform the response text to json object automatically,\n // so we should test the type of response before transforming it\n && !utils.isObject(response)) {\n response = JSON.parse(response);\n }\n\n var headers = engine.responseHeaders;\n // In browser\n if (!headers) {\n headers = {};\n var items = (engine.getAllResponseHeaders() || \"\").split(\"\\r\\n\");\n items.pop();\n items.forEach(function (e) {\n if (!e) return;\n var key = e.split(\":\")[0];\n headers[key] = engine.getResponseHeader(key);\n });\n }\n var status = engine.status;\n var statusText = engine.statusText;\n var _data = { data: response, headers: headers, status: status, statusText: statusText };\n // The _response filed of engine is set in adapter which be called in engine-wrapper.js\n utils.merge(_data, engine._response);\n if (status >= 200 && status < 300 || status === 304) {\n _data.engine = engine;\n _data.request = options;\n onresult(responseInterceptor.handler, _data, 0);\n } else {\n var e = new Err(statusText, status);\n e.response = _data;\n onerror(e);\n }\n } catch (e) {\n onerror(new Err(e.msg, engine.status));\n }\n };\n\n engine.onerror = function (e) {\n onerror(new Err(e.msg || \"Network Error\", 0));\n };\n\n engine.ontimeout = function () {\n onerror(new Err(\"timeout [ \" + engine.timeout + \"ms ]\", 1));\n };\n engine._options = options;\n setTimeout(function () {\n engine.send(needQuery ? null : data);\n }, 0);\n }", "AddService2(string, int, string) {\n\n }", "async sendOperationRequest(operationArguments, operationSpec, callback) {\n var _a;\n if (typeof operationArguments.options === \"function\") {\n callback = operationArguments.options;\n operationArguments.options = undefined;\n }\n const serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;\n const httpRequest = new WebResource();\n let result;\n try {\n const baseUri = operationSpec.baseUrl || this.baseUri;\n if (!baseUri) {\n throw new Error(\"If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.\");\n }\n httpRequest.method = operationSpec.httpMethod;\n httpRequest.operationSpec = operationSpec;\n const requestUrl = URLBuilder.parse(baseUri);\n if (operationSpec.path) {\n requestUrl.appendPath(operationSpec.path);\n }\n if (operationSpec.urlParameters && operationSpec.urlParameters.length > 0) {\n for (const urlParameter of operationSpec.urlParameters) {\n let urlParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, urlParameter, operationSpec.serializer);\n urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter), serializerOptions);\n if (!urlParameter.skipEncoding) {\n urlParameterValue = encodeURIComponent(urlParameterValue);\n }\n requestUrl.replaceAll(`{${urlParameter.mapper.serializedName || getPathStringFromParameter(urlParameter)}}`, urlParameterValue);\n }\n }\n if (operationSpec.queryParameters && operationSpec.queryParameters.length > 0) {\n for (const queryParameter of operationSpec.queryParameters) {\n let queryParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, queryParameter, operationSpec.serializer);\n if (queryParameterValue !== undefined && queryParameterValue !== null) {\n queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter), serializerOptions);\n if (queryParameter.collectionFormat !== undefined &&\n queryParameter.collectionFormat !== null) {\n if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Multi) {\n if (queryParameterValue.length === 0) {\n // The collection is empty, no need to try serializing the current queryParam\n continue;\n }\n else {\n for (const index in queryParameterValue) {\n const item = queryParameterValue[index];\n queryParameterValue[index] =\n item === undefined || item === null ? \"\" : item.toString();\n }\n }\n }\n else if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Ssv ||\n queryParameter.collectionFormat === exports.QueryCollectionFormat.Tsv) {\n queryParameterValue = queryParameterValue.join(queryParameter.collectionFormat);\n }\n }\n if (!queryParameter.skipEncoding) {\n if (Array.isArray(queryParameterValue)) {\n for (const index in queryParameterValue) {\n if (queryParameterValue[index] !== undefined &&\n queryParameterValue[index] !== null) {\n queryParameterValue[index] = encodeURIComponent(queryParameterValue[index]);\n }\n }\n }\n else {\n queryParameterValue = encodeURIComponent(queryParameterValue);\n }\n }\n if (queryParameter.collectionFormat !== undefined &&\n queryParameter.collectionFormat !== null &&\n queryParameter.collectionFormat !== exports.QueryCollectionFormat.Multi &&\n queryParameter.collectionFormat !== exports.QueryCollectionFormat.Ssv &&\n queryParameter.collectionFormat !== exports.QueryCollectionFormat.Tsv) {\n queryParameterValue = queryParameterValue.join(queryParameter.collectionFormat);\n }\n requestUrl.setQueryParameter(queryParameter.mapper.serializedName || getPathStringFromParameter(queryParameter), queryParameterValue);\n }\n }\n }\n httpRequest.url = requestUrl.toString();\n const contentType = operationSpec.contentType || this.requestContentType;\n if (contentType && operationSpec.requestBody) {\n httpRequest.headers.set(\"Content-Type\", contentType);\n }\n if (operationSpec.headerParameters) {\n for (const headerParameter of operationSpec.headerParameters) {\n let headerValue = getOperationArgumentValueFromParameter(this, operationArguments, headerParameter, operationSpec.serializer);\n if (headerValue !== undefined && headerValue !== null) {\n headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter), serializerOptions);\n const headerCollectionPrefix = headerParameter.mapper\n .headerCollectionPrefix;\n if (headerCollectionPrefix) {\n for (const key of Object.keys(headerValue)) {\n httpRequest.headers.set(headerCollectionPrefix + key, headerValue[key]);\n }\n }\n else {\n httpRequest.headers.set(headerParameter.mapper.serializedName ||\n getPathStringFromParameter(headerParameter), headerValue);\n }\n }\n }\n }\n const options = operationArguments.options;\n if (options) {\n if (options.customHeaders) {\n for (const customHeaderName in options.customHeaders) {\n httpRequest.headers.set(customHeaderName, options.customHeaders[customHeaderName]);\n }\n }\n if (options.abortSignal) {\n httpRequest.abortSignal = options.abortSignal;\n }\n if (options.timeout) {\n httpRequest.timeout = options.timeout;\n }\n if (options.onUploadProgress) {\n httpRequest.onUploadProgress = options.onUploadProgress;\n }\n if (options.onDownloadProgress) {\n httpRequest.onDownloadProgress = options.onDownloadProgress;\n }\n if (options.spanOptions) {\n // By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/[email protected] and earlier.\n httpRequest.spanOptions = options.spanOptions;\n }\n if (options.tracingContext) {\n httpRequest.tracingContext = options.tracingContext;\n }\n if (options.shouldDeserialize !== undefined && options.shouldDeserialize !== null) {\n httpRequest.shouldDeserialize = options.shouldDeserialize;\n }\n }\n httpRequest.withCredentials = this._withCredentials;\n serializeRequestBody(this, httpRequest, operationArguments, operationSpec);\n if (httpRequest.streamResponseStatusCodes === undefined) {\n httpRequest.streamResponseStatusCodes = getStreamResponseStatusCodes(operationSpec);\n }\n let rawResponse;\n let sendRequestError;\n try {\n rawResponse = await this.sendRequest(httpRequest);\n }\n catch (error) {\n sendRequestError = error;\n }\n if (sendRequestError) {\n if (sendRequestError.response) {\n sendRequestError.details = flattenResponse(sendRequestError.response, operationSpec.responses[sendRequestError.statusCode] ||\n operationSpec.responses[\"default\"]);\n }\n result = Promise.reject(sendRequestError);\n }\n else {\n result = Promise.resolve(flattenResponse(rawResponse, operationSpec.responses[rawResponse.status]));\n }\n }\n catch (error) {\n result = Promise.reject(error);\n }\n const cb = callback;\n if (cb) {\n result\n .then((res) => cb(null, res._response.parsedBody, res._response.request, res._response))\n .catch((err) => cb(err));\n }\n return result;\n }", "async sendOperationRequest(operationArguments, operationSpec, callback) {\n var _a;\n if (typeof operationArguments.options === \"function\") {\n callback = operationArguments.options;\n operationArguments.options = undefined;\n }\n const serializerOptions = (_a = operationArguments.options) === null || _a === void 0 ? void 0 : _a.serializerOptions;\n const httpRequest = new WebResource();\n let result;\n try {\n const baseUri = operationSpec.baseUrl || this.baseUri;\n if (!baseUri) {\n throw new Error(\"If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.\");\n }\n httpRequest.method = operationSpec.httpMethod;\n httpRequest.operationSpec = operationSpec;\n const requestUrl = URLBuilder.parse(baseUri);\n if (operationSpec.path) {\n requestUrl.appendPath(operationSpec.path);\n }\n if (operationSpec.urlParameters && operationSpec.urlParameters.length > 0) {\n for (const urlParameter of operationSpec.urlParameters) {\n let urlParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, urlParameter, operationSpec.serializer);\n urlParameterValue = operationSpec.serializer.serialize(urlParameter.mapper, urlParameterValue, getPathStringFromParameter(urlParameter), serializerOptions);\n if (!urlParameter.skipEncoding) {\n urlParameterValue = encodeURIComponent(urlParameterValue);\n }\n requestUrl.replaceAll(`{${urlParameter.mapper.serializedName || getPathStringFromParameter(urlParameter)}}`, urlParameterValue);\n }\n }\n if (operationSpec.queryParameters && operationSpec.queryParameters.length > 0) {\n for (const queryParameter of operationSpec.queryParameters) {\n let queryParameterValue = getOperationArgumentValueFromParameter(this, operationArguments, queryParameter, operationSpec.serializer);\n if (queryParameterValue !== undefined && queryParameterValue !== null) {\n queryParameterValue = operationSpec.serializer.serialize(queryParameter.mapper, queryParameterValue, getPathStringFromParameter(queryParameter), serializerOptions);\n if (queryParameter.collectionFormat !== undefined &&\n queryParameter.collectionFormat !== null) {\n if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Multi) {\n if (queryParameterValue.length === 0) {\n // The collection is empty, no need to try serializing the current queryParam\n continue;\n }\n else {\n for (const index in queryParameterValue) {\n const item = queryParameterValue[index];\n queryParameterValue[index] =\n item === undefined || item === null ? \"\" : item.toString();\n }\n }\n }\n else if (queryParameter.collectionFormat === exports.QueryCollectionFormat.Ssv ||\n queryParameter.collectionFormat === exports.QueryCollectionFormat.Tsv) {\n queryParameterValue = queryParameterValue.join(queryParameter.collectionFormat);\n }\n }\n if (!queryParameter.skipEncoding) {\n if (Array.isArray(queryParameterValue)) {\n for (const index in queryParameterValue) {\n if (queryParameterValue[index] !== undefined &&\n queryParameterValue[index] !== null) {\n queryParameterValue[index] = encodeURIComponent(queryParameterValue[index]);\n }\n }\n }\n else {\n queryParameterValue = encodeURIComponent(queryParameterValue);\n }\n }\n if (queryParameter.collectionFormat !== undefined &&\n queryParameter.collectionFormat !== null &&\n queryParameter.collectionFormat !== exports.QueryCollectionFormat.Multi &&\n queryParameter.collectionFormat !== exports.QueryCollectionFormat.Ssv &&\n queryParameter.collectionFormat !== exports.QueryCollectionFormat.Tsv) {\n queryParameterValue = queryParameterValue.join(queryParameter.collectionFormat);\n }\n requestUrl.setQueryParameter(queryParameter.mapper.serializedName || getPathStringFromParameter(queryParameter), queryParameterValue);\n }\n }\n }\n httpRequest.url = requestUrl.toString();\n const contentType = operationSpec.contentType || this.requestContentType;\n if (contentType && operationSpec.requestBody) {\n httpRequest.headers.set(\"Content-Type\", contentType);\n }\n if (operationSpec.headerParameters) {\n for (const headerParameter of operationSpec.headerParameters) {\n let headerValue = getOperationArgumentValueFromParameter(this, operationArguments, headerParameter, operationSpec.serializer);\n if (headerValue !== undefined && headerValue !== null) {\n headerValue = operationSpec.serializer.serialize(headerParameter.mapper, headerValue, getPathStringFromParameter(headerParameter), serializerOptions);\n const headerCollectionPrefix = headerParameter.mapper\n .headerCollectionPrefix;\n if (headerCollectionPrefix) {\n for (const key of Object.keys(headerValue)) {\n httpRequest.headers.set(headerCollectionPrefix + key, headerValue[key]);\n }\n }\n else {\n httpRequest.headers.set(headerParameter.mapper.serializedName ||\n getPathStringFromParameter(headerParameter), headerValue);\n }\n }\n }\n }\n const options = operationArguments.options;\n if (options) {\n if (options.customHeaders) {\n for (const customHeaderName in options.customHeaders) {\n httpRequest.headers.set(customHeaderName, options.customHeaders[customHeaderName]);\n }\n }\n if (options.abortSignal) {\n httpRequest.abortSignal = options.abortSignal;\n }\n if (options.timeout) {\n httpRequest.timeout = options.timeout;\n }\n if (options.onUploadProgress) {\n httpRequest.onUploadProgress = options.onUploadProgress;\n }\n if (options.onDownloadProgress) {\n httpRequest.onDownloadProgress = options.onDownloadProgress;\n }\n if (options.spanOptions) {\n // By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/[email protected] and earlier.\n httpRequest.spanOptions = options.spanOptions;\n }\n if (options.tracingContext) {\n httpRequest.tracingContext = options.tracingContext;\n }\n if (options.shouldDeserialize !== undefined && options.shouldDeserialize !== null) {\n httpRequest.shouldDeserialize = options.shouldDeserialize;\n }\n }\n httpRequest.withCredentials = this._withCredentials;\n serializeRequestBody(this, httpRequest, operationArguments, operationSpec);\n if (httpRequest.streamResponseStatusCodes === undefined) {\n httpRequest.streamResponseStatusCodes = getStreamResponseStatusCodes(operationSpec);\n }\n let rawResponse;\n let sendRequestError;\n try {\n rawResponse = await this.sendRequest(httpRequest);\n }\n catch (error) {\n sendRequestError = error;\n }\n if (sendRequestError) {\n if (sendRequestError.response) {\n sendRequestError.details = flattenResponse(sendRequestError.response, operationSpec.responses[sendRequestError.statusCode] ||\n operationSpec.responses[\"default\"]);\n }\n result = Promise.reject(sendRequestError);\n }\n else {\n result = Promise.resolve(flattenResponse(rawResponse, operationSpec.responses[rawResponse.status]));\n }\n }\n catch (error) {\n result = Promise.reject(error);\n }\n const cb = callback;\n if (cb) {\n result\n .then((res) => cb(null, res._response.parsedBody, res._response.request, res._response))\n .catch((err) => cb(err));\n }\n return result;\n }", "function makeAjaxCall(args, opt_callback) {\n // Make URL parameters from the provided argument dictionary.\n var params = [];\n for (var key in args) {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(args[key]));\n }\n\n // Create a new AJAX request object.\n var req = new XMLHttpRequest();\n req.open('POST', RPC_URL, true);\n req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n\n // If a callback function was provided, set it up to trigger when the call\n // returns succesfully.\n if (opt_callback) {\n req.onreadystatechange = function() {\n if (req.readyState == READY_STATE_COMPLETE &&\n req.status == HTTP_STATUS_OK) {\n opt_callback(req.responseText);\n }\n };\n }\n\n // Issue the AJAX request with the defined parameters.\n req.send(params.join('&'));\n}", "function makeRequest(method, auth, url, qs, data, cb) {\t\t// eslint-disable-line max-params\n\tconst options = {\n\t\tmethod: method,\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t'Authorization': auth\n\t\t},\n\t\turl: url, // for debugging set to: \"https://httpbin.org/get\"\n\t\tqs: qs\n\t}\n\n\tif(data) {\n\t\toptions.body = JSON.stringify(data)\n\t}\n\n\trequest(options, createResponseHandler(cb))\n}", "async request( refUrl, args, json = false){\r\n\t\tlet reqstr;\r\n\t\tlet keys;\r\n\t\tlet idx = 0;\r\n\r\n\t\tif( !refUrl)\r\n\t\t\treturn this.baseUrl;\r\n\t\treqstr = this.baseUrl + refUrl;\r\n\t\tif( args){\r\n\t\t\tif( !json){\r\n\t\t\t\tkeys = Object.keys( args);\r\n\t\t\t\tfor( let elem of keys){\r\n\t\t\t\t\tif( !idx){\r\n\t\t\t\t\t\treqstr+= '?' + elem + '=' + args[elem];\r\n\t\t\t\t\t\tidx = 1;\r\n\t\t\t\t\t}else\r\n\t\t\t\t\t\treqstr+= '&' + elem + '=' + args[elem];\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\treqstr+= '?data=' + JSON.stringify(args);\r\n\t\t\t\tconsole.log( reqstr);\r\n\t\t\t}\t\r\n\t\t}\r\n\t\treturn await this._request( reqstr);\t//get server response\r\n\t}", "function createPatient(requestData)\n{\n //var url = \"http://uclactive.westeurope.cloudapp.azure.com:8080/openmrs/ws/fhir/Patient\";\n var url = \"http://51.140.66.103:8080/openmrs/ws/fhir/Patient\";\n\n var options = {\n uri: url,\n method: 'POST',\n json: requestData,\n headers:{\n 'Authorization': 'Basic ' + new Buffer(\"*****:*****\").toString('base64')\n } \n };\n\n request(options, function (error, response, body) {\n if (!error && (response.statusCode == 200 || response.statusCode == 201)) {\n console.log(body.id) // Print the shortened url.\n } else {\n console.log(\"error: \" + error)\n console.log(\"response.statusCode: \" + response.statusCode)\n console.log(\"response.statusText: \" + response.statusText)\n }\n });\n}", "function createPatient(requestData)\n{\n //var url = \"http://uclactiveserver.westeurope.cloudapp.azure.com:8080/openmrs/ws/fhir/Patient\";\n var url = \"http://51.140.66.103:8080/openmrs/ws/fhir/Patient\";\n\n var options = {\n uri: url,\n method: 'POST',\n json: requestData,\n headers:{\n 'Authorization': 'Basic ' + new Buffer(\"*****:*****\").toString('base64')\n } \n };\n\n request(options, function (error, response, body) {\n if (!error && (response.statusCode == 200 || response.statusCode == 201)) {\n console.log(body.id) // Print the shortened url.\n } else {\n console.log(\"error: \" + error)\n console.log(\"response.statusCode: \" + response.statusCode)\n console.log(\"response.statusText: \" + response.statusText)\n }\n });\n}", "_factoryFunction (...dependencies) {\n\t\tlet serviceInstance = new ShortURLAPI(...dependencies);\n\t\tserviceInstance._BASE_URL = this._baseURL;\n\t\tserviceInstance._USE_CAMEL_CASE = this._isUsingCamelCase;\n\t\treturn serviceInstance;\n\t}", "static create (data, callback = f => f) {\n return createRequest({\n url: this.HOST + this.URL,\n data,\n method: 'POST',\n responseType: 'json',\n callback (e, response) {\n if (e === null && response) {\n callback(e, response);\n } else {\n console.error(e);\n };\n }\n });\n }", "function createApiCall(url, options) {\n //map, converter) {\n options = $.extend({\n converter: function(d) { return d; },\n map: {},\n callback: undefined\n }, options);\n return function(data) {\n return makeCall(url, data, options.callback)\n .then(function(data) {\n data = options.converter(mapData(options.map, data)); return $.Deferred().resolve(data);\n });\n };\n}", "call(moduleName, functionName, params) {\n const override = this.runtime.config(['services', moduleName, 'url'].join('.'));\n const token = this.runtime.service('session').getAuthToken();\n let client;\n if (override) {\n client = new GenericClient({\n module: moduleName,\n url: override,\n token: token\n });\n } else {\n client = new DynamicService({\n url: this.runtime.config('services.service_wizard.url'),\n token: token,\n module: moduleName\n });\n }\n return client.callFunc(functionName, [params]).catch((err) => {\n console.error(\n 'err',\n err instanceof Error,\n err instanceof exceptions.CustomError,\n err instanceof exceptions.AjaxError,\n err instanceof exceptions.ServerError\n );\n if (err instanceof exceptions.AjaxError) {\n console.error('AJAX Error', err);\n throw new utils.JGISearchError('ajax', err.code, err.message, null, {\n originalError: err\n });\n } else if (err instanceof exceptions.RpcError) {\n console.error('RPC Error', err);\n throw new utils.JGISearchError('ajax', err.name, err.message, null, {\n originalError: err\n });\n } else {\n throw new utils.JGISearchError('rpc-call', err.name, err.message, null, {\n originalError: err\n });\n }\n });\n }", "function makeCall(method, url, data = null, callback) {\n\tvar request = new XMLHttpRequest();\n\n\trequest.onreadystatechange = function () {\n\t\tif (request.readyState == XMLHttpRequest.DONE) {\n\t\t\tcallback(request);\n\t\t}\n\t};\n\trequest.open(method, url);\n\n\tif (data == null) {\n\t\trequest.send();\n\t} else {\n\t\trequest.send(data);\n\t}\n}", "static request(method, url, config = {}) {\n return Request.make(method, url, config);\n }", "function GenericRpcRequest(aUrl, aMethod) {\n this.method = aMethod;\n this.url = BaseUrl + aUrl;\n}", "invoke(verb = \"GET\", ...args) {\n // Setup initial conditions.\n verb = verb.toUpperCase();\n args = _.flatten(args);\n args = _.compact(args);\n\n return new Promise((resolve, reject) => {\n // Prepare the URL.\n let url = this.url(args);\n const urlParamsTotal = this.route.keys.length;\n if (urlParamsTotal > 0) {\n // The URL contained parameters that were taken from the args.\n // Remove them from the set of arguments passed in the payload.\n args = _.clone(args);\n args = args.splice(urlParamsTotal, args.length);\n }\n\n if ((verb === \"GET\" || verb === \"DELETE\") && args.length > 0) {\n let msg = `Cannot send arguments to the \"${ this.name }\", REST does not allow you to submit data to a ${ verb } method. Instead use the PUT or POST verbs.`;\n if (urlParamsTotal > 0) { msg += ` This method\"s URL does, however, take parameters (${ this.urlPattern }).`; }\n throw new Error(msg);\n }\n\n // Setup the payload to send.\n let payload = {\n verb: verb,\n method: this.name,\n args: args\n };\n\n // Send to the server.\n let httpMethod = this.http[verb.toLowerCase()];\n httpMethod(url, payload)\n .then((result) => { resolve(result.data); })\n .catch((err) => {\n err = parseError(err);\n reject(err);\n });\n });\n }", "function TaskServiceProxy(uriService) {\r\n this.uriService = uriService;\r\n}", "function openRequest(method, url, options) {\n var req = options.httpStack.createRequest(method, url);\n req.setHeader('Tus-Resumable', '1.0.0');\n var headers = options.headers || {};\n Object.entries(headers).forEach(function (_ref5) {\n var _ref6 = _slicedToArray(_ref5, 2),\n name = _ref6[0],\n value = _ref6[1];\n req.setHeader(name, value);\n });\n if (options.addRequestId) {\n var requestId = uuid();\n req.setHeader('X-Request-ID', requestId);\n }\n return req;\n }", "function HttpServiceService(_http) {\n this._http = _http;\n console.log(\"Service is working\");\n }", "function createApiCallFunc(json)\n{\n return function() {\n var url = getApi(json.api);\n var requestString = JSON.stringify(json.data);\n\n if (json.description) {\n console.log(\"--> \" + json.description);\n }\n\n // requestString = '';\n // console.log('-> ' + url);\n // console.log(requestString);\n\n // var headers = {\n // 'Accept': 'application/json',\n // 'Content-type': 'application/json'\n // // or 'Content-type': 'application/x-www-form-urlencoded'\n // };\n\n this.open(url, {\n encoding: \"utf8\",\n method: json.method,\n data: requestString,\n headers: json.headers\n });\n };\n}", "function httpFactory() {\n\tvar invoker = false;\n\t// Creation de l'invoker :\n\tif (window.XMLHttpRequest) \t\t\t \t // Firefox \n\t\tinvoker = new XMLHttpRequest(); \n\telse if(window.ActiveXObject) { // Internet Explorer \n\t\tinvoker = new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t}\n\telse {\n\t\tvar fail = \"Echec d'instanciation de l'invocateur distant :'( \\n\";\n\t\tfail += \"Votre navigateur ne semble pas supporter l'invocation de méthodes distantes ...\\n\";\n\t\tfail += \"Veuillez utiliser quelque chose d'un peu plus standart, comme Firefox par exemple ^_^ !\\n\";\n\t\talert(fail); \n\t\tinvoker = -1; \n\t\texit(); // On dégage :p\n\t}\n\treturn invoker;\n}", "function HttpService ( $http ) {\r\n\r\n\tvar service = {\r\n\t\tsend: send\r\n\t}\r\n\r\n\treturn service\r\n\r\n function send ( request ) {\r\n\r\n \tvar promise = $http ({\r\n \t\tmethod: \"post\",\r\n \t\turl: \"../API.php\",\r\n \t\theaders: {'Content-Type': 'application/x-www-form-urlencoded'},\r\n \t\tdata: request\r\n \t})\r\n .then ( function ( response ) {\r\n\r\n \t\treturn response.data\r\n \t})\r\n\r\n \treturn promise\r\n }\r\n}", "_makeRequest(operation, method, index, document = '') {\n return new Promise((res, rej) => {\n console.log(`${host}/${index}/${operation}`)\n const options = {\n 'method': method,\n 'url': `${host}/${index}/${operation}`,\n 'headers': {\n 'Authorization': auth,\n 'Content-Type': 'application/json'\n }\n };\n if (document) options.body = JSON.stringify(document)\n request(options, function (error, response) {\n if (error) rej(error);\n res(response.body);\n });\n })\n }", "makeRequest() {\r\n // Get Parameter Values\r\n let requestString = [];\r\n\r\n // Make Request\r\n this.getPrologRequest(requestString, this.handleReply);\r\n }", "function _makeAPIcall(method, url, params,withResults) {\r\n var _method = method;\r\n var _url = url;\r\n var _params = params;\r\n var _withResults = withResults; \r\n return _authToken().then(function (response) {\r\n if (response.error === undefined) {\r\n var _token = response;\r\n $http.defaults.headers.common.Authorization = 'Bearer token: ' + _token;\r\n if (_method == 'get') { \r\n return $http.get(_url, { params: _params })\r\n .then(function (response) { \r\n \r\n return _apiCallSuccess(response, _url,_withResults);\r\n })\r\n .catch(function (response) { \r\n \r\n return _apiCallFail(response, _url)\r\n });\r\n } else {\r\n return $http.post(_url, _params)\r\n .then(function (response) {\r\n return _apiCallSuccess(response, _url,_withResults);\r\n })\r\n .catch(function (response) { \r\n return _apiCallFail(response, _url)\r\n });\r\n }\r\n } else {\r\n return response;\r\n }\r\n\r\n });\r\n\r\n }", "async create(opts) {\n if (typeof opts === \"string\") {\n opts = { service: { service: opts } };\n }\n\n opts = utils.normalizeKeys(opts);\n opts = utils.defaults(opts, this.consul._defaults);\n\n const req = {\n name: \"query.create\",\n path: \"/query\",\n query: {},\n type: \"json\",\n };\n\n this._params(req, opts);\n\n if (!req.body.Service || !req.body.Service.Service) {\n throw this.consul._err(errors.Validation(\"service required\"), req);\n }\n\n utils.options(req, opts, { near: true });\n\n return await this.consul._post(req, utils.body);\n }", "function makeServerCall(library, method, params = {}) {\n let url = getApiCallUrl(library, method, params);\n return httpGet(url).then((body) => {\n try {\n body = JSON.parse(body);\n return body;\n } catch (exc) {\n throw new Error('Received invalid payload from server', exc);\n }\n });\n}", "function performRequest(host, endpoint, method, data, headers, success) {\n var dataString = JSON.stringify(data);\n \n if (method == 'GET') {\n endpoint += '?' + querystring.stringify(data);\n }\n else {\n headers = {\n 'Content-Type': 'application/json',\n 'Content-Length': dataString.length\n };\n }\n var options = {\n host: host,\n path: endpoint,\n method: method,\n headers: headers\n };\n\n var req = https.request(options, function(res) {\n res.setEncoding('utf-8');\n\n var responseString = '';\n\n res.on('data', function(data) {\n responseString += data;\n });\n\n res.on('end', function() {\n// console.log(responseString);\n try{\n var responseObject = JSON.parse(responseString);\n success(responseObject);\n } catch(err) {\n parseString(responseString, function(err, result){\n success(result);\n });\n }\n });\n });\n\n req.write(dataString);\n req.end();\n}", "async register_http( name, host, port, space = 0 ){\n\t\tthis.logger.trace(\"Registering as an HTTP service\", {host, port});\n\t\ttry {\n\t\t\tconst result = await request.post({url: this.base + \"/nodes/\" + name, body: {host, port, spaceAvailable: space}, json: true});\n\t\t\tthis.logger.trace(\"Received result\", result);\n\t\t}catch(e){\n\t\t\tthrow new Error(e.message);\n\t\t}\n\t}", "function MainService() {\n this.httpUrl = 'http://34.93.84.140:3000';\n }", "function getCall(id) {\n return $http.get(baseUrl+\"call/\"+id,{headers:setHeaders()});\n }", "async callApi(opts) {\n console.log(`invoking http call: ${util.inspect(opts)}`);\n\n try {\n var result = await request(opts);\n }\n catch(err) {\n console.error(`error invoking request: ${err.message}, opts: ${opts}`);\n return;\n }\n\n console.log(`got result: ${util.inspect(result)}`);\n return result.response;\n }", "function soapRequest(host, method, arg) {\n var payload = util.format(SOAPPAYLOAD, method, arg, method);\n\n return Q.Promise(function(resolve, reject) {\n request({\n method: 'POST'\n , body: payload\n , uri: 'http://' + host + '/upnp/control/basicevent1'\n , headers: {\n 'Content-Type': 'text/xml; charset=\"utf-8\"'\n , 'Content-Length': payload.length\n , SOAPACTION: '\"urn:Belkin:service:basicevent:1#' + method + '\"'\n }\n\n }, function(err, response) {\n if (err || response.statusCode >= 300) {\n return reject(err || new Error('Invalid Request (' + response.statusMessage + ')'));\n }\n\n resolve(response);\n });\n });\n}", "static async _create() {\n\t\tconst serviceName = Config.str(\"serviceName\");\n\n\t\t// Create the service if it does not exist - otherwise, throw an error\n\t\tlet service = await ECSManager.describeService(serviceName);\n\t\tif (service && service.status !== \"INACTIVE\") {\n\t\t\tthrow new Error(\"Service already exists: \" + serviceName + \". Delete or update instead.\");\n\t\t}\n\n\t\t// Register the task definition first\n\t\tconsole.log(\"CREATE 1) Register Task Definition\");\n\t\tconst taskDefinition = await ECSManager.registerTaskDefinition();\n\t\tconst taskDefinitionArn = taskDefinition.taskDefinition.taskDefinitionArn;\n\n\t\t// Creating a new service\n\t\t// We create a target group to associate this service with an Elastic Load Balancer\n\t\tconsole.log(\"CREATE 2) Create Target Group\");\n\t\tconst targetGroupResponse = await ELBManager.createTargetGroup();\n\t\tconsole.log(\"TargetGroupResponse: \" + JSON.stringify(targetGroupResponse, null, 2));\n\t\tconst targetGroupArn = targetGroupResponse.TargetGroups[0].TargetGroupArn;\n\n\t\t// We create a rule that tells our load balancer when to send requests to our new service\n\t\t// By default, it forwards <SERVICE_NAME>.bespoken.io to the service\n\t\t// This can be changed online in the ECS console\n\t\tconsole.log(\"CREATE 3) Create Rule\");\n\t\tconst rules = await ELBManager.createRule(targetGroupArn);\n\t\tconsole.log(\"Rules: \" + JSON.stringify(rules, null, 2));\n\n\t\t// Create the service\n\t\tconsole.log(\"CREATE 4) Create Service\");\n\t\tservice = await ECSManager.createService(targetGroupArn, taskDefinitionArn);\n\t\treturn service;\n\t}", "async deploy() {\n const { url } = await this.provider.faas.createHttpFunction(this.params)\n this.url = url\n return this\n }", "_request(path, options = {}) {\n return _sendRequest(this.api, path, options);\n }", "function createURI(operation, param){\n\n\tvar createUTCDate = function() {\n\t\tvar date = new Date();\n\n\t\tvar year \t= date.getUTCFullYear();\n\t\tvar month \t= ('0' + (date.getUTCMonth() + 1)).slice(-2);\n\t\tvar d \t\t= ('0' + date.getUTCDate()).slice(-2);\n\t\tvar hour \t= ('0' + date.getUTCHours()).slice(-2);\n\t\tvar minutes = ('0' + date.getUTCMinutes()).slice(-2);\n\t\tvar second \t= ('0' + date.getUTCSeconds()).slice(-2);\n\t\tvar milliSecond = ('00' + date.getUTCMilliseconds()).slice(-3);\n\n\t\treturn encodeURIComponent(util.format('%s-%s-%sT%s:%s:%s.%sZ',year, month, d, hour, minutes, second, milliSecond));\n\t}\n\n\tvar createSignature = function(signature) {\n\t\tvar hmac = crypto.createHmac('SHA256', secretKey);\n\t\thmac.update(signature);\n\t\treturn encodeURIComponent(hmac.digest('base64'));\n\t}\n\n\tvar paramArray = [];\n\tfor( var name in param ) {\n\t\tparamArray.push(util.format('%s=%s',name, encodeURIComponent(param[name])));\n\t}\n\tparamArray.push(util.format('Operation=%s',operation));\n\tparamArray.push(util.format('Service=%s','AWSECommerceService'));\n\tparamArray.push(util.format('Timestamp=%s', createUTCDate()));\n\tparamArray.push(util.format('Version=%s','2011-08-02'));\n\tparamArray.push(util.format('AWSAccessKeyId=%s', accessKey));\n\tparamArray.push('AssociateTag=onakaworld001-22');\n\tparamArray.sort();\n\n\tvar getParameter = paramArray.join('&');\n\tvar signature = createSignature(util.format('GET\\n%s\\n/onca/xml\\n%s' ,amazonApiHost ,getParameter));\n\n\treturn util.format('http://%s/onca/xml?%s&Signature=%s' ,amazonApiHost ,getParameter, signature);\n}", "function openRequest(method, url, options) {\n var req = options.httpStack.createRequest(method, url);\n req.setHeader('Tus-Resumable', '1.0.0');\n var headers = options.headers || {};\n\n for (var name in headers) {\n req.setHeader(name, headers[name]);\n }\n\n if (options.addRequestId) {\n var requestId = (0, _uuid.default)();\n req.setHeader('X-Request-ID', requestId);\n }\n\n return req;\n}", "function makeRequest(options) {\n data = options.body;\n // Normalize the request url\n url = utils.trim(options.url);\n var baseUrl = utils.trim(options.baseURL || \"\");\n if (!url && isBrowser && !baseUrl) url = location.href;\n if (url.indexOf(\"http\") !== 0) {\n var isAbsolute = url[0] === \"/\";\n if (!baseUrl && isBrowser) {\n var arr = location.pathname.split(\"/\");\n arr.pop();\n baseUrl = location.protocol + \"//\" + location.host + (isAbsolute ? \"\" : arr.join(\"/\"))\n }\n if (baseUrl[baseUrl.length - 1] !== \"/\") {\n baseUrl += \"/\"\n }\n url = baseUrl + (isAbsolute ? url.substr(1) : url)\n if (isBrowser) {\n\n // Normalize the url which contains the \"..\" or \".\", such as\n // \"http://xx.com/aa/bb/../../xx\" to \"http://xx.com/xx\" .\n var t = document.createElement(\"a\");\n t.href = url;\n url = t.href;\n }\n }\n\n var responseType = utils.trim(options.responseType || \"\")\n engine.withCredentials = !!options.withCredentials;\n var isGet = options.method === \"GET\";\n if (isGet) {\n if (data) {\n if (utils.type(data) !== \"string\") {\n data = utils.formatParams(data);\n }\n url += (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + data;\n }\n }\n engine.open(options.method, url);\n\n // try catch for ie >=9\n try {\n engine.timeout = options.timeout || 0;\n if (responseType !== \"stream\") {\n engine.responseType = responseType\n }\n } catch (e) {\n }\n\n // If the request data is json object, transforming it to json string,\n // and set request content-type to \"json\". In browser, the data will\n // be sent as RequestBody instead of FormData\n if (!utils.isFormData(data) && [\"object\", \"array\"].indexOf(utils.type(data)) !== -1) {\n options.headers[contentType] = 'application/json;charset=utf-8'\n data = JSON.stringify(data);\n }\n\n for (var k in options.headers) {\n if (k === contentType &&\n (utils.isFormData(data) || !data || isGet)) {\n // Delete the content-type, Let the browser set it\n delete options.headers[k];\n } else {\n try {\n // In browser environment, some header fields are readonly,\n // write will cause the exception .\n engine.setRequestHeader(k, options.headers[k])\n } catch (e) {\n }\n }\n }\n\n function onresult(handler, data, type) {\n enqueueIfLocked(responseInterceptor.p, function () {\n if (handler) {\n //如果失败,添加请求信息\n if (type) {\n data.request = options;\n }\n data = handler.call(responseInterceptor, data, Promise) || data\n }\n if (!isPromise(data)) {\n data = Promise[type === 0 ? \"resolve\" : \"reject\"](data)\n }\n data.then(d => {\n resolve(d)\n }).catch((e) => {\n reject(e)\n })\n })\n }\n\n\n function onerror(e) {\n e.engine = engine;\n onresult(responseInterceptor.onerror, e, -1)\n }\n\n function Err(msg, status) {\n this.message = msg\n this.status = status;\n }\n\n engine.onload = () => {\n // The xhr of IE9 has not response filed\n var response = engine.response || engine.responseText;\n if (options.parseJson && (engine.getResponseHeader(contentType) || \"\").indexOf(\"json\") !== -1\n // Some third engine implementation may transform the response text to json object automatically,\n // so we should test the type of response before transforming it\n && !utils.isObject(response)) {\n response = JSON.parse(response);\n }\n var headers = {};\n var items = (engine.getAllResponseHeaders() || \"\").split(\"\\r\\n\");\n items.pop();\n items.forEach((e) => {\n var key = e.split(\":\")[0]\n headers[key] = engine.getResponseHeader(key)\n })\n var status = engine.status\n var statusText = engine.statusText\n var data = {data: response, headers, status, statusText};\n // The _response filed of engine is set in adapter which be called in engine-wrapper.js\n utils.merge(data, engine._response)\n if ((status >= 200 && status < 300) || status === 304) {\n data.engine = engine;\n data.request = options;\n onresult(responseInterceptor.handler, data, 0)\n } else {\n var e = new Err(statusText, status);\n e.response = data\n onerror(e)\n }\n }\n\n engine.onerror = (e) => {\n onerror(new Err(e.msg || \"Network Error\", 0))\n }\n\n engine.ontimeout = () => {\n onerror(new Err(`timeout [ ${engine.timeout}ms ]`, 1))\n }\n engine._options = options;\n setTimeout(() => {\n engine.send(isGet ? null : data)\n }, 0)\n }", "request(config) {\n config.url = this.makeUrl();\n return this.$http.request(config)\n }", "function CallRestService(request) {\n var script = document.createElement(\"script\");\n script.setAttribute(\"type\", \"text/javascript\");\n script.setAttribute(\"src\", request);\n document.body.appendChild(script);\n}", "function HttpApiService(http) {\n this.http = http;\n }", "function main() {\n setReqURL()\n startMicroservice()\n registerWithCommMgr()\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "function wire (httpMethodName, contentSource, body, headers, withCredentials){\n\n var oboeBus = pubSub();\n \n // Wire the input stream in if we are given a content source.\n // This will usually be the case. If not, the instance created\n // will have to be passed content from an external source.\n \n if( contentSource ) {\n\n streamingHttp( oboeBus,\n httpTransport(), \n httpMethodName,\n contentSource,\n body,\n headers,\n withCredentials\n );\n }\n\n clarinet(oboeBus);\n\n ascentManager(oboeBus, incrementalContentBuilder(oboeBus));\n \n patternAdapter(oboeBus, jsonPathCompiler); \n \n return instanceApi(oboeBus, contentSource);\n}", "sendRequest(url, opts) {\n const { axios, tracer, serviceName } = this;\n const { method } = opts;\n\n return new Promise((resolve, reject) => {\n tracer.scoped(() => {\n tracer.setId(tracer.createChildId());\n const traceId = tracer.id;\n\n tracer.recordServiceName(serviceName);\n tracer.recordRpc(method.toUpperCase());\n tracer.recordBinary('http.url', url);\n tracer.recordAnnotation(new Annotation.ClientSend());\n\n const config = Request.addZipkinHeaders(opts, traceId);\n config.url = url;\n axios.request(config)\n .then(result => {\n tracer.scoped(() => {\n tracer.setId(traceId);\n tracer.recordBinary('http.status_code', result.status.toString());\n tracer.recordAnnotation(new Annotation.ClientRecv());\n });\n resolve(result);\n })\n .catch(err => {\n tracer.scoped(() => {\n tracer.setId(traceId);\n tracer.recordBinary('request.error', err.toString());\n tracer.recordAnnotation(new Annotation.ClientRecv());\n });\n reject(err);\n });\n });\n });\n }", "function CallGetService (data, url, async, callBack) {\n\n\t\t$.ajax ({\n\t\t\ttype: 'POST',\n\t\t\tdataType: 'json',\n\t\t\turl: url,\n\t\t\tdata: data,\n\t\t\tsuccess: function(msg) {\n\n\t\t\t\treturn callBack(msg);\n\n\t\t\t},\n\t\t\terror: function(error) {\n\n\t\t\t\tconsole.log(error);\n\n\t\t\t}\n\t\t});\n\n\t}", "function make_call(query, callback){\n\tvar postRequest = {\n\t host: \"api.trafikinfo.trafikverket.se\",\n\t path: \"/v1/data.json\",\n\t port: 80,\n\t method: \"POST\",\n\t headers: {\n\t 'Content-Type': 'text/xml',\n\t 'Content-Length': Buffer.byteLength(query)\n\t }\n\t};\n\n\tvar buffer = \"\";\n\tvar req = http.request(postRequest, function( res ) {\n\n\t\tconsole.log( res.statusCode );\n\t\tvar buffer = \"\";\n\t\tres.on( \"data\", function( data ) { buffer = buffer + data; } );\n\t\tres.on( \"end\", \n\t\t\tfunction( data ) { \n\t\t\t \tcallback(buffer); //return response values\n\t\t\t} \n\t\t);\n\t});\n\n\treq.on('error', function(e) {\n\t console.log('problem with request: ' + e.message);\n\t});\n\n\treq.write( query );\n\treq.end();\n\n}", "function sendRequest(requestData)\n{\n //var url = \"http://uclactive.westeurope.cloudapp.azure.com:8080/openmrs/ws/fhir/Observation\";\n var url = \"http://51.140.66.103:8080/openmrs/ws/fhir/Observation\";\n\n var options = {\n uri: url,\n method: 'POST',\n json: requestData,\n headers:{\n 'Authorization': 'Basic ' + new Buffer(\"*****:******\").toString('base64')\n } \n };\n\n request(options, function (error, response, body) {\n\n console.log(\"******\");\n console.log(requestData);\n if (!error && (response.statusCode == 200 || response.statusCode == 201)) {\n console.log(body.id) // Print the shortened url.\n } else {\n console.log(\"error: \" + error)\n console.log(\"response.statusCode: \" + response.statusCode)\n console.log(\"response.statusText: \" + response.statusText)\n }\n });\n}", "create(contentLength, options) {\n const operationArguments = {\n contentLength,\n options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(operationArguments, createOperationSpec);\n }", "create(contentLength, options) {\n const operationArguments = {\n contentLength,\n options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})\n };\n return this.client.sendOperationRequest(operationArguments, createOperationSpec);\n }", "function RegisterService(http) {\r\n this.http = http;\r\n //http: Http;\r\n //baseUrl = \"http://13.58.150.195:4300/\";\r\n //demo\r\n this.baseUrl = \"http://18.219.37.107:4300/\";\r\n }" ]
[ "0.6263031", "0.60855097", "0.60048175", "0.58879775", "0.58879775", "0.58879775", "0.58879775", "0.587793", "0.5874425", "0.5817452", "0.5817452", "0.57695204", "0.5751338", "0.57485104", "0.5733879", "0.5733879", "0.5674206", "0.5666082", "0.5647524", "0.5626366", "0.56214625", "0.56111336", "0.55993783", "0.55460703", "0.55432445", "0.55336696", "0.55325013", "0.5520009", "0.5518936", "0.5517808", "0.550735", "0.54759073", "0.54759073", "0.54759073", "0.54759073", "0.54759073", "0.54535097", "0.54535097", "0.5452287", "0.54493356", "0.54493356", "0.5446163", "0.544361", "0.54310334", "0.5417753", "0.53988403", "0.5394646", "0.5393542", "0.53785527", "0.5375687", "0.5369763", "0.53640234", "0.53572285", "0.53151286", "0.5314045", "0.5292658", "0.52827907", "0.5275787", "0.5272002", "0.5271799", "0.5267569", "0.52546096", "0.5250066", "0.5228088", "0.5220798", "0.5220198", "0.5219108", "0.5216968", "0.5206081", "0.5200886", "0.51993895", "0.5190114", "0.5186689", "0.5182828", "0.51810575", "0.5168819", "0.5165542", "0.5148679", "0.514666", "0.51460594", "0.5143324", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5141281", "0.5136799", "0.5131188", "0.5126785", "0.5124658", "0.5121983", "0.5121983", "0.51144433" ]
0.0
-1
The main function for the list categories
function ListCategories () { MakeXMLHTTPCallListCategories("GET", "http://uvm061.dei.isep.ipp.pt/ARQSI/Widget/WidgetAPI/EditorAPI.php?type=GetAllCategories"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayCategory() {\n displayHeading();\n displayList();\n}", "function categories() {\n // assign categories object to a variable\n var categories = memory.categories;\n // loop through categories\n for (category in categories) {\n // call categories render method\n memory.categories[category].render();\n //console.log(memory);\n }\n }", "function _dex_getCategories(){ // Step 1 of 2 – Gets top-level categories\n var t=new Date().getTime(),out={},ar=LibraryjsUtil.getHtmlData(\"http://www.dexknows.com/browse-directory\",/\\\"http:\\/\\/www\\.dexknows\\.com\\/local\\/(\\w+\\/\\\">.+)<\\/a>/gm)//return ar;\n ,i=ar.length;while(i--){ar[i]=ar[i].split('/\">');ar[i][1]=ar[i][1].replace(/&amp;/g,\"&\");out[ar[i][0]]={\"displayName\":ar[i][1]}}\n LibraryjsUtil.write2fb(\"torrid-heat-2303\",\"dex/categories/\",\"put\",out)}//function test(){/*print2doc*/Logger.log(_dex_getCategories())}", "function listCategory(catId, catName, resultitems) {\n // reSetMarkers(); // clean up the category and map state\n // showDialog(false); // hide our info-dialog, if necessary\n //\n resultitems.sort(topicSort); // alphabetical ascending\n var topicIdsToShow = new Array();\n //\n var sideBarCategories = jQuery(\"#categoryListing\");\n sideBarCategories.empty();\n sideBarCategories.append('&nbsp;<b class=\"redTitle\">' +catName + '</b><br/>&nbsp;&nbsp;');\n sideBarCategories.append('<small>('+resultitems.length+ ' Objekte)</small><p/>');\n sideBarCategories.append('<table width=\"240\" cellpadding=\"2\" cellspacing=\"0\" id=\"catListingTable\"></table>');\n for (var i = 0; i < resultitems.length; i++) {\n var nr = i+1;\n jQuery(\"#catListingTable\").append('<tr width=\"100%\" class=\"topicRowDeselected\">'\n + '<td width=\"20px\" class=\"iconCell\" valign=\"center\" align=\"center\">'\n // + '<img src=\"http://www.berlin.de/imperia/md/images/system/icon_punkt_rot.gif\"/></td>'\n + '<b>' + nr + '.</b></td>'\n +' <td>'+resultitems[i].name+'</td></tr>');\n // jQuery(\"#topicRow-\"+topicsToShow[i].id).attr('onclick', 'javascript:showTopicInMap(\"'+topicsToShow[i].id+'\");');\n // jQuery(\"#topicRowHref-\"+topicsToShow[i].id).attr('href', 'javascript:showTopicInMap(\"'+topicsToShow[i].id+'\");');\n // topicIdsToShow.push(topicsToShow[i].id);\n }\n }", "function shop() {\n\tshowCategoriesList();\n}", "function show_all() {\n\tcategories.forEach(category => show(category));\n}", "function displayCategories(categories) {\n\n // empty variable which will contain html string for categories\n let categoriesListingHtml = '';\n\n // variable to create diff id for categories in loop\n let num = 1;\n\n categories['categories'].forEach(category => {\n\n let categoryName = category['category'];\n\n // if not trash categories, concat as string in variable\n if(!trashCategories.includes(categoryName)) {\n categoriesListingHtml += `<li><a id=\"category${num}\" href=\"#\">${categoryName}</a></li>`;\n num++;\n }\n \n });\n\n // add html string to document to display on screen \n document.querySelector('.categories').innerHTML = categoriesListingHtml;\n\n // reset variable so that we can use same category id to add click event listner\n num = 1;\n\n categories['categories'].forEach(category => {\n\n categoryName = category['category'];\n\n if(!trashCategories.includes(categoryName)) {\n\n // add event listener for category, this will be used to get products in that category\n document.getElementById(`category${num}`).addEventListener(\"click\", getProductsInCategory);\n num++;\n }\n \n });\n\n // get products for first category in list\n document.getElementById('category1').click();\n }", "function categories() {\n loadingWheel(true);\n getData(false);\n fetch(dataUrl)\n .then(response => response.json())\n .then(category => {\n let categoryList = category.trivia_categories;\n categoryList.forEach(category => {\n\n let categoryOption = document.createElement(\"option\");\n let categoryName = document.createElement(\"p\");\n let name = document.createTextNode(category.name);\n\n categoryName.appendChild(name);\n categoryOption.appendChild(categoryName);\n categoryOption.id = category.id;\n categoryOption.classList.add(\"category\");\n document.getElementById(\"categoryList\").appendChild(categoryOption);\n });\n loadingWheel(false);\n start.classList.remove(\"hide\");\n })\n .catch(() => console.error());\n}", "async categories() {\n return await this.fetch(\"/categories/list\");\n }", "populateCategories() {\n\t\tthis.m_catMenu.innerHTML = \"\";\n\t\tCONFIG.CATEGORIES.forEach(function(item) {\n\t\t\tGUI.m_catMenu.innerHTML += \"<option value=\\\"\" + item[0] + \"\\\">\" + item[1] + \"</option>\";\n\t\t});\n\t}", "function getCategoryList(){\n $.getJSON(\"json/food.json\",function(data){\n //console.log(data);\n var list = data.data.food_spu_tags;\n countShipping(data.data.poi_info.shipping_fee);\n $.each(list,function(index,val){\n var el = document.createElement(\"div\");\n el.classList.add(\"menu-category-item\");\n var name = val.name, \n icon = val.icon;\n var str = `${icon ? `<img class=\"menu-category-icon\" src=${icon}>`:''}\n ${name}`;\n el.innerHTML = str;\n $(el).data(\"menu\",val);\n $(\".menu-category\").append($(el));\n //init first menu category & menu list\n if(index === 0){\n el.classList.add(\"active-item\");\n getMenuList(val);\n }\n })\n })\n }", "function readCategories_index(obj) {\n // Create tag div for categories\n $.each(obj.categories, function(index, value){\n var category = value.toLowerCase().replace(/ /g, '-');\n\n // Add sidebar\n var temp = `<a class=\"list-group-item list-group-item-action\" \n id=\"list-${category}-list\" \n data-toggle=\"list\" \n href=\"#list-${category}\" \n role=\"tab\" \n aria-controls=\"${category}\">\n ${value}\n </a>`;\n $(\".sidebar-js\").append(temp);\n \n // Add main-content\n temp = `<div class=\"tab-pane fade\" id=\"list-${category}\" role=\"tabpanel\" aria-labelledby=\"list-${category}-list\">\n <h4>${value}</h4>\n <hr>\n <div class=\"card-columns mt-4 list-${category}-js\">\n\n </div>\n </div>`;\n $(\".content-js\").append(temp);\n })\n $(`#list-${obj.categories[0].toLowerCase().replace(/ /g, '-')}-list`).addClass('active')\n $(`#list-${obj.categories[0].toLowerCase().replace(/ /g, '-')}`).addClass('active show')\n}", "function getCategories() {\n $.get(\"/api/categories\", renderCategoryList);\n }", "function listCategoriesOnPage() {\n categories = JSON.parse(JSONtext);\n for (i = 0; i < categories.length; i++) {\n if (categories[i].category == \"Daily\") {\n createAndReturnCategoryDivElement(i, dailyElement);\n }\n if (categories[i].category == \"Fruit & vegetable\") {\n createAndReturnCategoryDivElement(i, fruitVegetableElement);\n }\n if (categories[i].category == \"Meat\") {\n createAndReturnCategoryDivElement(i, meatElement);\n }\n if (categories[i].category == \"Seafood\") {\n createAndReturnCategoryDivElement(i, seafoodElement);\n }\n if (categories[i].category == \"Household & cleaning\") {\n createAndReturnCategoryDivElement(i, houseElement);\n }\n if (categories[i].category == \"Breakfast & cereal\") {\n createAndReturnCategoryDivElement(i, breakfastElement);\n }\n if (categories[i].category == \"Bakery\") {\n createAndReturnCategoryDivElement(i, bakeryElement);\n }\n if (categories[i].category == \"Frozen food\") {\n createAndReturnCategoryDivElement(i, frozenElement);\n }\n if (categories[i].category == \"Snacks Crisps\") {\n createAndReturnCategoryDivElement(i, snacksElement);\n }\n if (categories[i].category == \"Beverages Soda\") {\n createAndReturnCategoryDivElement(i, beveragesElement);\n }\n if (categories[i].category == \"Pasta & rice\") {\n createAndReturnCategoryDivElement(i, pastaElement);\n }\n }\n}", "function callCategories() {\r\n smoothTopScroll();\r\n hideAllBoxes();\r\n activeSet = 0;\r\n document.getElementById(\"pagetitle\").innerHTML = \"Categories\";\r\n Object.keys(categoriesEnum).forEach(function(key) {\r\n generateBox(key, categoriesEnum, 0, categoriesEnum[key], categoriesInfoText);\r\n });\r\n}", "function getCategories() {\n \n // API call to get categories\n fetch(\"https://my-store2.p.rapidapi.com/catalog/categories\", {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-key\": \"ef872c9123msh3fdcc085935d35dp17730cjsncc96703109e1\",\n \"x-rapidapi-host\": \"my-store2.p.rapidapi.com\"\n }\n })\n .then(response => {\n return response.json();\n })\n .then(response => {\n\n // call display catgories to display it on screen\n displayCategories(response);\n })\n .catch(err => {\n console.error(err);\n });\n }", "function clickCategories(e) {\n setList(PRODUCTS[e.target.dataset.category]);\n }", "function CategoryList ({ categories }) {\n if (!categories.length) {\n return null\n }\n\n return (\n <nav className='breadcrumbs push-center'>\n <label>Categories:</label>\n <ul className='category-list'>\n <li>\n <NavLink exact to='/' activeClassName='active'>all</NavLink>\n </li>\n {categories.map(({ name, path }) => (\n <li key={`${name}${path}`}>\n <NavLink exact to={`/${path}`} activeClassName='active'>{name}</NavLink>\n </li>\n ))}\n </ul>\n </nav>\n )\n}", "function get_categories_view() {\r\n\tvar cats = this.get_categories().map(function(obj) {\r\n\t\tvar str = '<a href=\"' + obj.getURI() + '\">' + obj.title + '</a>';\r\n\t\treturn str.replace(/&(?!\\w+;)/g, '&amp;')\r\n\t}).join(', ');\r\n\r\n\treturn this.categories != null ? new XMLList(cats) : '';\r\n}", "function displayCategories(categories) {\r\n let htmlString = '';\r\n\r\n //Creates an 'All' category option\r\n htmlString = htmlString + `<li class=\"category-all\">All</li>`;\r\n $.each(categories, function (i, category) {\r\n htmlString = htmlString + getCategoryItemHTML(category);\r\n });\r\n categoryListEl.html(htmlString);\r\n categoryAll = $(\".category-all\");\r\n categoryAll.on('click', function () {\r\n displayAccom(filteredAccommodation);\r\n });\r\n\r\n //Filter accommodation by category\r\n let categoryItems = $(\".category-item\");\r\n categoryItems.on('click', function () {\r\n let categoryid = $(this).data('categoryid');\r\n let filteredAccomByCategory = filterByCategory(filteredAccommodation, categoryid);\r\n displayAccom(filteredAccomByCategory);\r\n });\r\n}", "function catsort() {\n // If categories have not yet been figured out on this page-load, do so now\n if ($('ul.categories').find('li').length ==0){\n // loop over categories\n var i;for (i = 0; i < taglist().length; i++) { \n // make a header element for this category\n var thisheader = (toTitleCase(taglist()[i]));\n var thiscount = getcounts(taglist()[i]);\n $('.categories').append('<div id=' + i + '><h4 class=\"category\" id=\"'+i+'\"><i class=\"fa fa-lg fa-caret-down fa-caret-right\"></i> ' + thisheader + ' (' + thiscount + ')</h4></div>');\n //identify any posts that belong in this category\n $('.recent>li').each(function() {\n var thisli=$(this).html();\n var thesetags = $(this).find('div.tags').html();\n if(thesetags.indexOf(taglist()[i]) != -1){\n //add these posts under the header\n $('#'+i).after('<li class=\"'+i+'\">'+thisli+'</li>');\n }\n });\n }\n\n // And trigger toggling function now that categories element exists\n $('.category').on('click', function(){\n console.log('clicked ' + this);\n $('.'+$(this).attr('id')).slideToggle();\n $('#'+$(this).attr('id')+' .fa').toggleClass('fa-caret-right');\n });\n\n }\n\n // Show categories list and hide by-date list\n $('.recent').css('display','none');\n $('.categories').css('display','block')\n}", "function getCategories() {\n\trimer.category.find(function(error, value) {\n\t\tif(error) {\n\t\t\tconsole.log(error)\n\t\t}\n\t\telse {\n\t\t\tconsole.log(value)\n\t\t}\n\t})\n}", "function category(result) {\n //Get categories\n const cate = result.map(item => item.category)\n // Remove duplicates or more\n const diferentCategory = (valor, indice, self) => {\n return self.indexOf(valor) === indice;\n }\n let categories = cate.filter(diferentCategory);\n\n //Short categories\n let sortCategories = categories.sort(function (a, b) {\n return a - b;\n });\n\n //Build categories\n for (let i = 0; i < sortCategories.length; i++) {\n $categoryList.innerHTML += `\n <li class=\"catButton\"><a class=\"panel--subitem-button\">${sortCategories[i]}</a></li>\n `\n }\n getCatFilter(result);\n}", "function buildSidebarCategories(all_categories) {\n var sideCat = $('ul#sidebar_categories').empty();\n all_categories.sort(sortName);\n for(i = 0; i < all_categories.length; i++) {\n var cat_item = $('<li>').addClass('hvr-bounce-to-right')\n .append( $('<a>')\n .attr('href', 'blog.html?category=' + all_categories[i].name)\n .html(all_categories[i].name.replace(/_/g,' ').capFirstLetter())\n .append( $('<span>').html(all_categories[i].count) )\n );\n sideCat.append(cat_item);\n }\n $('<div>').addClass('load_all').append(\n $('<a>').attr('href','posts/categories.html').html('All Categories')\n ).insertAfter('ul#sidebar_categories');\n}", "function getCategories() {\n\t// JSON file is called here\n\t$.getJSON(\"/api/categories/\", categories => {\n\t\t$.each(categories, (index, category) => {\n\t\t\tif (category.Category == \"Acupuncture\") {\n\t\t\t\t// List items that are new are added here\n\t\t\t\t$(\"#categoryList\").append(\n\t\t\t\t\t$(\"<a />\")\n\t\t\t\t\t\t.html(category.Category + \" <span class='badge badge-success'>New!</span>\")\n\t\t\t\t\t\t.attr(\"class\", \"dropdown-item\")\n\t\t\t\t\t\t.attr(\"href\", \"#\")\n\t\t\t\t\t\t// Click event added to the anchor\n\t\t\t\t\t\t.on(\"click\", e => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$(\"#catNameHeading\").show();\n\t\t\t\t\t\t\t$(\"#categoryName\").text(category.Category);\n\t\t\t\t\t\t\tgetServices(category.Value);\n\t\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// List items are dynamically populated here\n\t\t\t\t$(\"#categoryList\").append(\n\t\t\t\t\t$(\"<a />\")\n\t\t\t\t\t\t.text(category.Category)\n\t\t\t\t\t\t.attr(\"class\", \"dropdown-item\")\n\t\t\t\t\t\t.attr(\"href\", \"#\")\n\t\t\t\t\t\t.on(\"click\", e => {\n\t\t\t\t\t\t\t// Click event added to the anchor\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t$(\"#catNameHeading\").show();\n\t\t\t\t\t\t\t$(\"#categoryName\").text(category.Category);\n\t\t\t\t\t\t\tgetServices(category.Value);\n\t\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t});\n}", "getCategories() {\n return ['Snacks', 'MainDishes', 'Desserts', 'SideDishes', 'Smoothies', 'Pickles', 'Dhal', 'General']\n }", "async function showCategories() {\n const res = await axios.get(`${MD_BASE_URL}/categories.php`);\n $('<div class=\"col-10\"><h3 class=\"title text-center\">CATEGORIES</h3></div>').appendTo($cateList);\n for (let cate of res.data.categories) {\n generateCatHTML(cate);\n }\n }", "function printAllCategories(categories) {\n let stringbuilderCategories = '<h4>Kategorier</h4><ul class=\"list-group\">';\n categories.forEach(element => stringbuilderCategories += '<li class=\"list-group-item\" onclick=\"getAllQuestions('\n + element.id + ')\"><h5>' + element.categoryName + '</h5></li>');\n stringbuilderCategories += '</ul>'; \n $(\"#FAQCategories\").html(stringbuilderCategories);\n}", "function load_categories(){\n\t\tconnect('GET', 'index.php?q=/books/categories', {})\n\t\t\t.done(function(response){\n\t\t\t\tvar cats = $('#fieldCategory');\n\t\t\t\tcats.html('');\n\t\t\t\tfor (var x in response.data){\n\t\t\t\t\tvar id = response.data[x].id;\n\t\t\t\t\tvar description = response.data[x].description;\n\t\t\t\t\tcats.append(`<option value=\"${id}\">${description}</option>`);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.fail(notify_error);\n\t}", "displayCategories(){\n const categoriesList = cocktail.getCategories()\n .then(categories => {\n const catList = categories.categories.drinks;\n \n // append the first option without value\n const firstOption = document.createElement('option');\n firstOption.textContent = '-- Select --';\n firstOption.value = '';\n document.querySelector('#search').appendChild(firstOption);\n\n // append the other options\n catList.forEach(category => {\n const option = document.createElement('option');\n option.textContent = category.strCategory;\n option.value = category.strCategory.split(' ').join('_');\n document.querySelector('#search').appendChild(option);\n \n });\n\n })\n }", "function showCritCatList() {\n // reSets all Markers, removes all Popups and renders criteria list\n updateCategoryList(crtCritIndex);\n }", "function catsort() {\n // If categories have not yet been figured out on this page-load, do so now\n if ($('ul.categories').find('li').length ==0){\n // loop over categories\n var i;for (i = 0; i < taglist().length; i++) { \n // make a header element for this category\n var thisheader = (toTitleCase(taglist()[i]));\n var thiscount = getcounts(taglist()[i]);\n $('.categories').append('<div><h4 class=\"category\" id=\"c'+i+'c\"><i class=\"fas fa-lg fa-caret-down fa-caret-right\"></i> ' + thisheader + ' (' + thiscount + ')</h4></div>');\n //$('.categories').append('<div id=' + i + '><h4 class=\"category\" id=\"'+i+'\"><i class=\"fas fa-lg fa-caret-down fa-caret-right\"></i> ' + thisheader + ' (' + thiscount + ')</h4></div>');\n //identify any posts that belong in this category\n $('.recent>li').each(function() {\n var thisli=$(this).html();\n var thesetags = $(this).find('div.tags').html();\n if(thesetags.indexOf(taglist()[i]) != -1){\n //add these posts under the header\n $('#c'+i+'c').after('<li class=\"c'+i+'c\">'+thisli+'</li>');\n }\n });\n }\n }\n\n // add toggling function now that elements exist \n $('.categories').find('.category').unbind('click'); // first unbind preexisting versions of this fxn\n $('.category').on('click', function(){\n var catname = $(this).attr('id');\n cattoggle(catname);\n savedrop(catname);\n });\n \n // Show categories list and hide by-date list\n $('.recent').css('display','none');\n $('.categories').css('display','block')\n\n}", "function getCategories() {\n fetch(apiCategorias)\n .then((res) => res.json())\n .then((dataJson) => {\n printCategories(dataJson.trivia_categories);\n })\n .catch((err) => {\n console.error(err);\n });\n}", "function init(){\n buildCategoryImageList();\n }", "static async getAllMainCategories(req, res) {\n const mainCategoryDomain = new MainCategoryDomain();\n mainCategoryDomain.getAllMainCategories(req, res);\n }", "function disneyCategories(){\n //fetch get index for attractions\n \n byCategory()\n}", "function loadCategory(category_list){\n\t\t\n\t\t$.each(category_list, function(index,category) {\n\t\t\t$(\"#itemCategory\").append(\n\t\t $(\"<option class='dynamic-option'></option>\").val(category.category_id).html(category.name)\n\t\t );\n\t\t});\t\n\t}", "function categoryListHandler(e) {\n var parentPath = e.target.id;\n content.style.display = 'block';\n recentActivity.style.display = 'none';\n // update currentParentPath\n currentParentPath = parentPath + '/';\n sendAjaxReq('GET', '/category/all?parent=' + sanitizePath(parentPath), updateAllPanes);\n }", "function getAllCategories() {\n $.get(\"FAQ/GetEveryCategories\", function (output) {\n allCategories = output; \n printAllCategories(output);\n });\n}", "function GetDBCategories(){\n\tif (!window.openDatabase) { \n \t\talert('Databases are not supported in this browser.'); \n \t\treturn; \n \t} \n\n\t$('.category').html('');\n\t\n\tdb.transaction(function(tx) {\n\t\tvar innerJoin = '';\n\t\tvar where = '';\n\t\t\n\t\tif (loggedInUser != 1){\n\t\t\tinnerJoin = ' LEFT JOIN UserLessons ON Lesson.LessonId = UserLessons.lesson_id';\n\t\t\twhere = ' WHERE UserLessons.user_id ='+loggedInUser + ' OR Category.OwnerId = '+loggedInUser;\n\t\t}\n\t\t\n\t\tdoQuery(tx, 'SELECT * FROM Category LEFT JOIN Lesson ON Category.CategoryId = Lesson.CategoryId'+ innerJoin + where +' GROUP BY Category.CategoryName;', [],function(tx,result){\n\t\t\tif (result != null && result.rows != null) {\n\t\t\t\tif (result.rows.length != 0){\n\t\t\t\t for (var i = 0; i < result.rows.length; i++) {\n\t\t \t\t\tvar row = result.rows.item(i);\n\t\t \t\t\tvar catId = row.CategoryId;\n\t\t \t\t\t$('.category').append('<li class=\"cat\" id=\"cat_'+ catId +'\"><span class=\"cat-title\">' + row.CategoryName + '</span></li>');\n\t\t \t\t\t$('.category li#cat_' + catId).append('<img class=\"renameCategoryIcon pointer\" src=\"'+ PATH_IMG +'rename-w.png\" /><img class=\"deleteCategoryIcon pointer\" src=\"'+ PATH_IMG +'delete-w.png\" />');\n\t\t\t\t\t\t\t\t \t\t\t\n\t\t \t\t\tGetDBLessons(catId, setHtmlForLessons); \n\t\t \t\t\tinitBinding();\n\t\t \t}\n\t\t }\n\t\t else {\n\t\t \t$('.category').append('<p class=\"info\">Für dich stehen momentan noch keine Fächer zur Verfügung. Lege ein eigenes Fach an oder bitte den Administrator darum, dir Lektionen zuzuweisen.</p>');\n\t\t }\n\t \t}\n\t\t});\n\t},errorCB,nullHandler);\n\n\treturn;\n}", "function getCategories(){\n\n var output = '';\n\n var arr = new Array();\n \n $.getJSON(datasource,function(data){ \n \n $.each(data.questions, function(i,question){\n\n if (jQuery.inArray(question.category, arr) === -1) { \n output += '<li category=\"'+ question.category + '\"><a href=\"listings.html?category=' + question.category + '\">' + question.category + '</a></li>';\n arr.push(question.category);\n }\n });\n $(\"#listItem\").append(output).listview(\"refresh\");\n });\n\n \n }", "function Categories() {\n const dispatch = useDispatch();\n const category = useSelector((state) => state.categories.categoryList);\n\n \n const activate = (category, description) => {\n dispatch(action.activated(category, description))\n }\n\n return (\n <div>\n <Typography>Browse our Categories</Typography>\n {category.map((item) => {\n return <Button key={item._id} onClick={() => activate(item.name, item.description)}>{ item.name }</Button>\n })}\n </div>\n );\n}", "function getCatCategory() {\n\tvar categories = \"\";\n\tvar listValues = getCategoryValues([\"catVinRouge\", \"catVinBlanc\", \"catVinGrappa\", \"catVinMousseuxRose\", \"catVinPineau\", \"catVinAromatise\"]);\n\tif (listValues != \"\")\n\t\tcategories = \"(@tpcategorie==(\" + listValues + \"))\";\n\t\n\treturn categories;\n}", "function tech() { categoryChoice = TECHNOLOGY;\n getNews()\n}", "function fetchCategoriesForSelect() {\n fetchOperations.fetchCategories().then(forEachCategory);\n }", "function stateHandlerListCategories()\n{ \n if ( xmlHttpObj.readyState == 4 && xmlHttpObj.status == 200) \n {\n var categoriesList = new Array();\n\n \tvar docxml = xmlHttpObj.responseXML;\n \tvar nodelist = docxml.getElementsByTagName(\"categoria\");\n\n \tfor (var i = 0; i < nodelist.length; i++) {\n \t\tvar value = nodelist[i].textContent;\n\n \t\tif (!checkIfExists(categoriesList, value)) \n \t\t{\n \t\t\tcategoriesList.push(value);\n \t\t};\n \t};\n\n \tdocument.getElementById(\"scategories\").innerHTML += CreateSelectHTML(categoriesList);\n ListBooksByCategory();\n }\n}", "function fetchCategories(){\n return fetch(catURL)\n .then(resp => resp.json())\n .then(categories=>{\n categoryData = categories\n displayCategories(categories)\n })\n}", "function getCategories() {\n\tvar categories = getCatDisponibility() + \" \" + getCatCategory() + \" \" + getCatCountries();\n\t\n\treturn categories;\n}", "function addCategoryNames(){\n\tAUTHORIZATION_CODE = JSON.parse(sessionStorage.access);\n\tvar categories = getSpotifyCategory(getCategoryID);\n}", "function printCategory(cat){\n var i;\n //check that |cat| is not null\n if(areReqdArgsNull(cat)){\n\treturn;\n }\n document.write(\"Category: name = \" + cat.name + \"; Options: [\" +cat.options[0]);\n for(i=1; i<cat.options.length; i++){\n\tdocument.write(\", \" + cat.options[i]);\n }\n\n document.write(\"]; Type: \" + cat.type + \"</br>\");\n}", "function populateCategories() {\n if (this.status >= 300) return apiFail();\n\n var data = JSON.parse(this.responseText);\n var categoriesEl = byId('categories');\n\n // empty the current list\n while (categoriesEl.firstChild)\n categoriesEl.removeChild(categoriesEl.firstChild);\n\n data.categories.forEach(function (category, idx) {\n var li = document.createElement('li');\n li.textContent = category.title;\n li.dataset.url = category.productsURL;\n li.onclick = selectCategoryClickHandler;\n categoriesEl.appendChild(li);\n });\n\n selectCategory(categoriesEl.firstChild);\n}", "function initCategories() {\n\tjQuery('.city h3').toggle(\n\t\tfunction() {\n\t\t\tjQuery(this).next(\"ul\").show('fast');\n\t\t\tjQuery(this).addClass('on');\n\t\t\treturn false;\n\t\t},\n\t\tfunction() {\n\t\t\tjQuery(this).next(\"ul\").hide('fast');\n\t\t\tjQuery(this).removeClass('on');\n\t\t\treturn false;\n\t\t}\n\t);\n\tjQuery('.city h3').hover(\n\t\tfunction() {\n\t\t\tjQuery(this).parent().addClass(\"js-hover\");\n\t\t\treturn false;\n\t\t},\n\t\tfunction(argument) {\n\t\t\tjQuery(this).parent().removeClass(\"js-hover\");\n\t\t\treturn false;\n\t\t}\n\t);\n}", "function getCategory()\n{\n\tvar category = new Array([111,'server'], [222,'switcher'], [333,'storage'], [444,'workstation']);\n\treturn category;\n}", "function showMenu(categories){\n console.log(categories);\n //lt - link template\n let lt = document.querySelector(\"#linkTemplate\").content;\n categories.forEach(function(category){\n\n //if a category doesn't contain anything, don't show it\n if(category.count > 0){\n let clone = lt.cloneNode(true);\n let parent = document.querySelector(\"#categorymenu\");\n clone.querySelector(\"a\").textContent=category.name;\n clone.querySelector(\"a\").setAttribute(\"href\", \"index.html?categoryid=\"+category.id)\n parent.appendChild(clone);\n\n }\n });\n\n //http://ioanavladau.com/wp/wp-json/wp/v2/events?categories=8\n\n}", "function allCats() {\n\n let cats = document.querySelector(\"body > main > section > ul\")\n fetch(\"database.json\")\n .then(response => response.json())\n .then(json => {\n Object.entries(json.cats).forEach(entry => {\n const [id, cat] = entry\n const {name, description, image, breed} = cat;\n let li = htmlFactory('li');\n let img = htmlFactory('img', 'src', image)\n let h3 = htmlFactory('h3');\n h3.textContent = name;\n let pOne = htmlFactory('p');\n pOne.innerHTML = `<span>Breed: </span> ${json.breed[breed]}`\n let pTwo = htmlFactory('p');\n pTwo.innerHTML = `<span>Description: </span> ${description}`\n let ul = htmlFactory('ul', 'class', 'buttons');\n let liOne = htmlFactory('li', 'class', 'btn edit');\n let editLink = htmlFactory(\"a\", 'href', `${id}`)\n editLink.textContent = 'Change Info'\n liOne.appendChild(editLink)\n let liTwo = htmlFactory('li', 'class', 'btn delete');\n let deleteLink = htmlFactory(\"a\", 'href', `${id}`)\n deleteLink.textContent = 'New Home'\n liTwo.appendChild(deleteLink)\n ul.append(liOne, liTwo)\n\n li.append(img, h3, pOne, pTwo, ul)\n // console.log(li)\n cats.appendChild(li)\n // let option = document.createElement(\"option\");\n // option.setAttribute(\"value\", key);\n // option.textContent = value;\n // breeds.appendChild(option)\n });\n });\n}", "async function addCategories() {\n\tconst categories = await getCategories({});\n\tconsole.log(categories);\n\n\tfor (let i = 0; i < categories.length; i++) {\n\t\tconst category = document.createElement('div');\n\t\tcategory.classList.add(\"list-group-item\");\n\t\tcategory.classList.add(\"category\");\n\t\tcategory.innerText = categories[i].category;\n\t\tcategorySelect.appendChild(category);\n\t}\n}", "function JAFTING_Category() { this.initialize(...arguments); }", "function getCategoryList(){\n \t\n\t\t$.ajax({\n\t\t\turl:\"http://localhost:8080/flipkart/webapi/category/getAllCategoryList\",\n\t\t\ttype:\"GET\",\n\t\t\tcache:false,\n\t\t\tcontentType:false,\n\t\t\tprocessData: false,\n\t success : function(data){\n\t \t\n\t \tif(data){\n\t \t\tconsole.log(data);\n\t \t\tcategory_list = data;\n\t \t\tloadCategory(data);\n\t \t}\n\t \t\n\t \telse\n\t \t\talert(\"failed to get Categories\");\n\t },\n\t \n\t error : function(data){\n\t \talert(\"failed to get Categories !\");\n\t }\n\t \n\t\t});\n\t}", "function GetCategoriesList() {\n var requestString = 'wscmd=crscategories';\n AjaxRequest('./rs.aspx', requestString, GotCategoriesList, null, 'crscategories');\n}", "function Category() {\n}", "async getAllCategories() {\n const data = await this.get('jokes/categories');\n return data;\n }", "async function getCategory() {\r\n let request = {\r\n method: 'GET',\r\n redirect: 'follow'\r\n }\r\n\r\n if (token === \"\" || typeof token === 'undefined') {\r\n addAgentMessage(\"Sorry I cannot perform that. Please login first!\")\r\n return;\r\n }\r\n\r\n const serverReturn = await fetch(ENDPOINT_URL + '/categories', request);\r\n\r\n if (!serverReturn.ok) {\r\n addAgentMessage(\"There was a problem accessing the list of categories. Please try again!\");\r\n return;\r\n }\r\n\r\n const serverResponse = await serverReturn.json()\r\n\r\n let categories = serverResponse.categories;\r\n\r\n // comma separated; using 'and' to give the assistant a more of human personality \r\n let message = \"We offer products for \" + categories.length + \" total categories: \\n\"\r\n message += categories.splice(0, categories.length - 1).join(', ') + \", and \" + categories[0] + \".\"\r\n addAgentMessage(message);\r\n\r\n\r\n }", "function getList(){\n\t\t\tHistoryService.getList($rootScope.userLogin.token).success(function(res){\n\t\t\t\t$scope.list_categories = res;\n\t\t\t}).error(function(err, status, res){\n\t\t\t\tif (err.detail){\n toastr.error(err.detail);\n }\n for( var key in err){\n var x = 'err.'+key;\n toastr.error(key.toUpperCase()+\": \"+eval(x)[0]);\n }\n\t\t\t});\n\t\t}", "function categoryListeners() {\n\tvar categories = document.getElementById('category_nav').getElementsByTagName('a');\n\tvar category;\n\tvar allCategory = categories[0];\n\taddEvent(allCategory, 'click', displayAllCategory);\n\t\n\t//loop starts one after the first element due to the all link being done \n\tfor(var i = 1; i < categories.length; i++) {\n\t\tcategory = categories[i];\n\t\taddEvent(category, 'click', displayCategoryProducts);\n\t}\n}", "function getCategories() {\r\n\t\t// body...\r\n\t\t$.ajax({\r\n url: URL+'categories/',\r\n type: 'GET',\r\n dataType: 'json',\r\n headers: {\r\n 'auth': '12345'\r\n },\r\n contentType: 'application/json;',\r\n success: function (result) {\r\n // CallBack(result);\r\n console.log(result);\r\n\r\n $.each(result.data, function(key,val){\r\n \tcategories_menu += '<li><a href=\"categories.html?id='+val.idCategories+'\">'+val.categoriesName+'</a></li>';\r\n \tcategories_menu_mm += '<li class=\"page_menu_item menu_mm\"><a href=\"categories.html?id='+val.idCategories+'\">'+val.categoriesName+'</a></li>';\r\n });\r\n $('#menu_categories').append(categories_menu);\r\n $('.page_menu_selection').append(categories_menu_mm);\r\n },\r\n error: function (error) {\r\n \r\n }\r\n });\r\n\t}", "function categoryTable() { }", "function getCategories() {\n $.ajax({\n type: \"GET\",\n url: \"getCategories\",\n success: (data) => makeCategoriesHTML(data)\n })\n}", "retrieveCategories() {\n return call(`${this.__url__}/categories`, {\n headers: {\n 'Content-Type': 'application/json'\n },\n timeout: this.__timeout__\n })\n }", "categ(state,data)\n {\n return state.category=data\n }", "async function showCatFilter() {\n const cates = await getCatsList();\n for (let cate of cates) {\n generateFilterItemHTML(cate, $(\"#catFilter\"));\n }\n }", "function fetch_categories(wiki){\n var cats=[]\n var reg=new RegExp(\"\\\\[\\\\[:?(\"+category_words.join(\"|\")+\"):(.{2,60}?)\\]\\](\\w{0,10})\", \"ig\")\n var tmp=wiki.match(reg)//regular links\n if(tmp){\n var reg2=new RegExp(\"^\\\\[\\\\[:?(\"+category_words.join(\"|\")+\"):\", \"ig\")\n tmp.forEach(function(c){\n c=c.replace(reg2, '')\n c=c.replace(/\\|?[ \\*]?\\]\\]$/i,'')\n if(c && !c.match(/[\\[\\]]/)){\n cats.push(c)\n }\n })\n }\n return cats\n }", "function WR_Shortcode_Product_Categories() {\n\t \tvar button = $( '.sc-cat-list[data-expand=\"true\"]' ).children( 'a' );\n\t \t$( '.sc-cat-list[data-expand=\"true\"] ul' ).hide();\n\n\t \tbutton.on( 'click', function() {\n\t \t\t$( this ).next().slideToggle();\n\t \t} );\n\t }", "function GetCategoriesList(setRn) {\r\n\tvar requestString = 'wscmd=crscategories';\r\n\tAjaxRequest('./rs.aspx', requestString, GotCategoriesList, null, 'crscategories', setRn);\r\n}", "function executeCodeWhenCategoriesLoads () {\n var categories = JSON.parse(event.target.responseText);\n console.log(\"categories\", categories)\n categoriesToDOM(categories);\n}", "function buildCategoryMenu()\n {\n var checkbox_html_start = \"<div class='checkbox category-list'><label><input type='checkbox' class='category-check category' \";\n var checkbox_html_end = \"</label></div>\";\n $.each( categories, function(key,value){\n if(findSubCategory(categories[key]).length > 0)\n {\n var html_content = checkbox_html_start+ \"data-category='\" +value+ \"' />\"+value +\"</label><span class='category-plus'>&nbsp;[+]</span></div>\";\n }\n else\n {\n var html_content = checkbox_html_start+ \"data-category='\" +value+ \"' />\"+value +\"</label></div>\";\n }\n $('#categories-menu').append(html_content);\n if(findSubCategory(categories[key]).length > 0){\n $.each( findSubCategory(categories[key]), function(sub_key, sub_value){\n var html_content = checkbox_html_start+ \"data-category='\" +value+ \"' data-sub-category='\"+sub_value+\"'/>\"+sub_value +checkbox_html_end;\n $('#categories-menu').append(html_content);\n $('#categories-menu div:nth-last-child(1)').last().addClass(\"sub-category event \").css('display','none');\n });\n }\n });\n //$('.category-list').fadeIn(2000);\n }", "function renderCategory(cat) {\n let h3 = document.querySelector('#listCat');\n let category = [\"veg\", \"fish\", \"bird\", \"meat\", \"misc\"]\n let writeCat = [\"Vegetariskt\", \"Fisk\", \"Fågel\", \"Kött\", \"Övrigt\"]\n i = category.indexOf(cat);\n // h3.className = \"listPadding\";\n h3.textContent = writeCat[i];\n\n\n // let div = document.querySelector('.listWrapper');\n // let h3 = document.createElement('h3');\n // let category = [\"veg\", \"fish\", \"bird\", \"meat\", \"misc\"]\n // let writeCat = [\"Vegetariskt\", \"Fisk\", \"Fågel\", \"Kött\", \"Övrigt\"]\n // i = category.indexOf(cat);\n // h3.textContent = writeCat[i];\n\n // div.appendChild(h3);\n\n}", "constructor() {\n\t\tthis.categories = [];\n\t}", "function get_cat(e){\"forum\"==e||\"fjb\"==e?($(\".select-category\").addClass(\"show\"),$.ajax({url:\"/misc/get_categories_search/\"+e,success:function(e){var t=location.href.match(/forumchoice(\\[\\])*=([^&]+)/),s=\"\";t&&(s=t[2]);var a=\"\";for(var o in e)s==e[o].forum_id?(a=\"selected\",$(\"#search_category\").parent().find(\".customSelectInner\").text(e[o].name)):a=\"\",$(\"#search_category\").append('<option data-child-list=\"'+e[o].child_list+'\" value=\"'+e[o].forum_id+'\" '+a+\">\"+e[o].name+\"</option>\")}})):$(\".select-category\").removeClass(\"show\")}", "function NCList() {\n}", "function loadCategories() {\n\tjQuery.post(\n\t\tgetConnectorURL(),\n\t\t{\n\t\t\taction: 'get_categories'\n\t\t},\n\t\tfunction(result) {\n\t\t\tcategories = result.categories;\n\n\t\t\tdb.transaction(\n\t\t\t\tfunction (tx) {\n\t\t\t\t\ttx.executeSql(\"DROP TABLE IF EXISTS categories\");\n\t\t\t\t\ttx.executeSql(\"CREATE TABLE IF NOT EXISTS categories(categoryid INTEGER, category TEXT)\");\n\n\t\t\t\t\tfor (i in categories) {\n\t\t\t\t\t\tconsole.log(categories[i].category);\n\t\t\t\t\t\ttx.executeSql(\"INSERT INTO categories(category) VALUES ('\"+dbEscape(categories[i]['category'])+\"')\");\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdbError,\n\t\t\t\tdbSuccess\n\t\t\t)\n\t\t},\n\t\t'jsonp'\n\t)\t\n}", "get categories() {\n return this.args.categories || this.args.settings || [];\n }", "function createCategoryOptions() {\n for (let category of categories) {\n pageDialog.category.innerHTML +=\n `<option value=\"${category.name}\">${category.name}</option>`;\n }\n }", "function loadCategories() {\n\t\tlet categories = new wp.api.collections.Categories()\n\n\t\tcategories.fetch().done( () => {\n\t\t\tconsole.log(categories);\n\t\t\t\t//clearCategories();\n\t\t\t\tcategories.each( category => loadCategory( category.attributes ) );\n\t\t});\n\t}", "getAllCategories() {\n return this.http.get(this.allCategoryUrl);\n }", "function crearLista(categoryApi, categoryData) {\n var collapse = false,\n htmlCollapsible;\n // creamos el html\n $('#eventList').empty();\n htmlCollapsible = \"<div class='panel-group' id='accordion' role='tablist' aria-multiselectable='true'>\";\n $.each(categoryApi, function (key, value) {\n htmlCollapsible += \"<div class='panel panel-default categorias'><div class='panel-heading' role='tab' id='heading-\" + key + \"'><h4 class='panel-title'>\";\n if (collapse) {\n htmlCollapsible += \"<a class='collapsed' data-toggle='collapse' data-parent='#accordion' href='#collapse-\" + key + \"' aria-expanded='false' aria-controls='collapse-\" + key + \"'>\";\n } else {\n htmlCollapsible += \"<a data-toggle='collapse' data-parent='#accordion' href='#collapse-\" + key + \"' aria-expanded='true' aria-controls='collapse-\" + key + \"'>\";\n }\n htmlCollapsible += categoryData[key];\n if (collapse) {\n htmlCollapsible += \"</a></h4></div><div id='collapse-\" + key + \"' class='panel-collapse collapse' role='tabpanel' aria-labelledby='heading-\" + key + \"'><div class='panel-body'><ul class='event-list'>\";\n } else {\n htmlCollapsible += \"</a></h4></div><div id='collapse-\" + key + \"' class='panel-collapse collapse in' role='tabpanel' aria-labelledby='heading-\" + key + \"'><div class='panel-body'><ul class='event-list'>\";\n }\n htmlCollapsible += value;\n htmlCollapsible += \"</ul></div></div></div>\";\n collapse = true;\n });\n htmlCollapsible += \"</div>\";\n $('#eventList').append(htmlCollapsible);\n collapseExpand();\n $('#accordion').closest(\".panel-group\").find('.panel-collapse').collapse('show');\n $('#loading').hide();\n $('#loadMore').show();\n }", "function addCategoryListener() {\n $('#category-sidebar').on('click', '.category', function() {\n $('.category').removeClass('selectedCategory');\n if ($(this).attr('id') == 'all-categories') {\n getAcronymData(displayAcronymEntries);\n $(this).addClass('selectedCategory');\n //collapses categories list in mobile only\n $('#mobile-category-collapse').collapse('hide');\n } else {\n const categoryId = $(this).attr('id');\n getAcronymData(displayAcronymEntriesByCategory(categoryId));\n $(this).addClass('selectedCategory');\n //collapses categories list in mobile only\n $('#mobile-category-collapse').collapse('hide');\n }\n\n });\n}", "static async getAllCategoriesAndQuestions() {\n categories = [];\n let categoryIds = await Category.getCategoryIds();\n for ( let categoryId of categoryIds ) {\n let fullCategory = await Category.getCategory(categoryId);\n categories.push(fullCategory);\n }\n return categories;\n }", "function updateListCategories (data) {\n\t\t\t\t$(\"#list_categories ul\").html(\"\");\n\t\t\t\t//$(\"#list_categories ul\").html(\"<li class=\\\"\\\">Categorias</li>\");\n\t\t\t\t$.each(data,function(index,value) {\n\t\t\t\t\tdiv=\"\";\n\t\t\t\t\tdiv+=\"<li><a class=\\\"btn btn-inverse btn-small\\\" href=\\\"#\\\" onclick=\\\"editCategory(\" + value.idcat + \");\\\">Editar</a>\"\n\t\t\t\t\tdiv+= value.name + \"</li>\";\n\t\t\t\t\t$(\"#list_categories ul\").append(div);\n\n\t\t\t\t });\n\t\t\t\t //$(\"#list_categories ul\").append(\"<li class=\\\"divider\\\"></li>\");\n\t\t\t\t $(\"#list_categories ul\").append(\"<li><a href=\\\"#\\\" onclick=\\\"editCategory(0)\\\">Añadir nueva...</a></li>\");\n\t}", "function showCategory(urlObj, options) {\n var categoryName = \"\";\n if (urlObj.href.search(\"category-items\") !== -1) {\n if (urlObj.hash != undefined) {\n categoryName = urlObj.hash.replace(/.*category-items=/, \"\");\n }\n }\n if (categoryName) {\n if (savePos !== undefined && savePos > 0) {\n LoadDefaultCatalog(categoryName, savePos, savePos);\n } else {\n LoadDefaultCatalog(categoryName);\n }\n } else {\n LoadDefaultCatalog();\n }\n}", "function getCategories(list, ul) {\n\n xhttp.onreadystatechange = function () {\n if (this.readyState === 4 && this.status === 200) {\n\n //Prendo i valori passati dal server e li metto in un array\n var obj = JSON.parse(xhttp.responseText);\n\n if(list) {\n //Prendo il corpo della tabella in cui inserire le righe\n var tbody = document.getElementById('menu-content2');\n\n //Creo la riga i cui inserire i campi e gli metto lee informazioni\n var li = document.createElement(\"li\");\n li.setAttribute(\"data-toggle\", \"collapse\");\n\n //Creo ina nuova colonna e inserisco ildato, per ogni informazioni richiesta\n var a = document.createElement(\"a\");\n a.appendChild(document.createTextNode(\"Tutto\"));\n a.setAttribute(\"href\", \"#\");\n a.setAttribute(\"onclick\", \"getProducts()\");\n li.appendChild(a);\n\n //Inserisco la riga nela tabella\n tbody.appendChild(li);\n //Inserisco tutti le righe con i relativi corsi.\n for (var i = 0; i < obj.length; i++) {\n //Creo la riga i cui inserire i campi e gli metto lee informazioni\n var li = document.createElement(\"li\");\n li.setAttribute(\"data-toggle\", \"collapse\");\n\n //Creo ina nuova colonna e inserisco ildato, per ogni informazioni richiesta\n var a = document.createElement(\"a\");\n a.appendChild(document.createTextNode(obj[i][\"nome\"]));\n a.setAttribute(\"href\", \"#\");\n a.setAttribute(\"value\", obj[i][\"nome\"]);\n a.setAttribute(\"onclick\", \"getProductsByCategory(this.text)\");\n li.appendChild(a);\n\n //Inserisco la riga nela tabella\n tbody.appendChild(li);\n }\n getProducts();\n }else{\n\n ul.setAttribute(\"required\", \"true\");\n\n //Inserisco tutte le categorie in optio e poi nel select.\n for(var i = 0; i < obj.length; i++){\n var li = document.createElement(\"li\");\n li.setAttribute(\"class\", \"option focus\");\n li.setAttribute(\"style\", \"z-index:0;\");\n li.setAttribute(\"data-value\", obj[i][\"nome\"]);\n li.appendChild(document.createTextNode(obj[i][\"nome\"]));\n ul.appendChild(li);\n }\n }\n }\n }\n xhttp.open(\"POST\", \"/gestionevendita2018/home/getCategories\", true);\n xhttp.send();\n}", "function displayCategories(categoryData) {\n storeLocalCategories(categoryData);\n let html = '';\n if (categoryData.length) {\n categoryData.forEach(category => {\n html +=\n `<div class=\"panel panel-default category\" id=\"${category.id}\" style=\"background-color:${category.color}\">\n <div class=\"panel-body\">\n <h3 class=\"panel-title\">${category.title}</h3>\n <button class=\"option-btn\" type=\"button\" data-toggle=\"modal\"\n data-target=\"#delete-confirm\"\n data-id=\"${category.id}\"\n data-type=\"category\">\n <span class=\"glyphicon glyphicon-remove\">\n </span>\n </button>\n </div>\n </div>`;\n });\n }\n $('#category-list').html(html);\n makeDeleteModalDynamic();\n}", "function categoriesselect(data){\n\tvar pageURL = window.location.href;\n\tvar user_id = pageURL.substr(pageURL.lastIndexOf('/') + 1);\n\tvar home_url = $('#home_url').val();\n\tvar category_id = $(data).attr('id');\n\tvar category_type = $(data).attr('data-cat');\n var result='';\n var sub_cat_name = '';\n var sub_cat_id = '';\n\tif(category_type == 'sub'){\n\t\tvar parent_id = $(data).parents('li').find('.categories').attr('id');\n\t\tvar category_name = $(data).html();\n\t\tvar parent_cat_name = $(data).parents('li').find('.categories').html();\n\t\tif(checkIfCategoryExists_reg(parent_id)){\n\t\t\tvar exists = false;\n\t\t\t$('.added_category ul li .categories').each(function() {\n\t\t\t\tvar search_id = $(this).attr('id');\n\t\t\t\tif(search_id == parent_id){\t\t\t\t\t\n\t\t\t\t\t$(this).siblings('.subcategories').find('li').each(function(){\n\t\t\t\t\t\tsub_cat_id = $(this).find('a').attr('id');\n\t\t\t\t\t\tif(sub_cat_id == category_id){\n\t\t\t\t\t\t\texists = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif(exists == false){\t\t\t\t\t\t\n\t\t\t\t\t\tajaxRequest_reg(user_id,parent_id,category_id); //Ajax request\n\t\t\t\t\t\t$(this).siblings('.subcategories').append('<li><a href=\"javascript:;\" id=\"'+category_id+'\" data-cat=\"sub\">'+category_name+'</a><span class=\"cross_category_reg\"><img src=\"'+home_url+'img/category_cancel.png\" class=\"img-fluid\"></span></li>');\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tif(exists == false){\n\t\t\t\t//$(data).siblings('.checked_category').show();\n\t\t\t\t$(data).siblings('.checked_category').attr('style','display:block');\n\t\t\t}\n\t\t}else{\t\n\t\t\tif(checkNoOfCategories_reg() <= 10){\n\t\t\t\tajaxRequest_reg(user_id,parent_id,category_id); //Ajax request\t\t\n\t\t\t\t$('.added_category_list_heading .added_category ul.added_category_ul').append('<li><a href=\"javascript:;\" id=\"'+parent_id+'\" data-cat=\"parent\" class=\"categories\">'+parent_cat_name+'</a><span class=\"cross_category_reg\"><img src=\"'+home_url+'img/category_cancel.png\" class=\"img-fluid\"></span><ul class=\"subcategories\"><li><a href=\"javascript:;\" id=\"'+category_id+'\" data-cat=\"sub\">'+category_name+'</a><span class=\"cross_category_reg\"><img src=\"'+home_url+'img/category_cancel.png\" class=\"img-fluid\"></span></li></ul></li>');\n\t\t\t\t$(data).siblings('.checked_category').attr('style','display:block');\n\t\t\t}else{\n\t\t\t\t$('.forerror').addClass('disp_none');\n\t\t\t}\n\t\t}\n\n\t}else{\n\t\tif(checkIfCategoryExists_reg(category_id) == false){\n\t\t\tif(checkNoOfCategories_reg() <= 10){\n\t\t\t\tvar category_name = $(data).html();\n\t\t\t\tvar sub_cat = $(data).next('.subcategories').html();\n\t\t\t\tresult = '<li><a href=\"javascript:;\" id=\"'+category_id+'\" data-cat=\"parent\" class=\"categories\">'+category_name+'</a><span class=\"cross_category_reg\"><img src=\"'+home_url+'img/category_cancel.png\" class=\"img-fluid\"></span>';\n\t\t\t\tresult += '<ul class=\"subcategories\">';\n\t\t\t\tif($(data).next('.subcategories').find('li').length == 0){\n\t\t\t\t\tajaxRequest_reg(user_id,category_id,1); //Ajax request\n\t\t\t\t}\n\t\t\t\t$(data).next('.subcategories').find('li').each(function() {\n\t\t\t\t\tsub_cat_name = $(this).find('a').html();\n\t\t\t\t\tsub_cat_id = $(this).find('a').attr('id');\n\t\t\t\t\t$(this).find('.checked_category').show();\n\n\t\t\t\t\tajaxRequest_reg(user_id,category_id,sub_cat_id); //Ajax request\n\n\t\t\t\t\tresult += '<li><a href=\"javascript:;\" id=\"'+sub_cat_id+'\" data-cat=\"sub\">'+sub_cat_name+'</a><span class=\"cross_category_reg\"><img src=\"'+home_url+'img/category_cancel.png\" class=\"img-fluid\"></span></li>';\t\t\t\n\t\t\t\t});\n\t\t\t\tresult += '</li>';\n\t\t\t\t$('.added_category_list_heading .added_category ul.added_category_ul').append(result);\n\t\t\t}else{\n\t\t\t\t$('.forerror').removeClass('disp_none');\n\t\t\t}\n\t\t}\n\t}\n\t$('.added_category_list').removeClass('error');\n\t$('.fill_fields').addClass('disp_none');\n\t$('.add_cat_list').removeClass('error');\n\t$('.forerror').addClass('addcategory');\n\tif($('.added_category_list_heading .added_category ul.added_category_ul').html() != ''){\n\t\t$('#no_categories').hide();\n\t}\n\n\t//if main category select the all main and sub cat selected\n}", "function addCategories(categories) {\n categories.forEach(element => {\n $(\".menu__container\").append(\n `<div id=\"category-${element.id}\" class=\"category\">\n <h3>${element.name}</h3>\n </div>`\n );\n })\n}", "function initiateCategories() \n{\n\tdocument.getElementById(\"categoryTitle\").innerHTML = \"Select Category\";\n\tdocument.getElementById(\"backBtn\").setAttribute(\"disabled\", \"disabled\");\n\n\tsetCategories(strPath);\n}", "async readCategories() {\n let response = await fetch(url + 'get/categories');\n let data = await response.json();\n return data\n }", "function getCategories(res, mysql, context, complete) {\n\t\t\tmysql.pool.query(\"SELECT id, name FROM categories\", function (error, results, fields) {\n\t\t\t\tif (error) {\n\t\t\t\t\tres.write(JSON.stringify(error));\n\t\t\t\t\tres.end();\n\t\t\t\t}\n\t\t\t\tcontext.categories = results;\n\t\t\t\tcomplete();\n\t\t\t});\n\t\t}", "function determineCategory(data) {\n if(category.value === 'astronaut') {\n if(data.results.length !== 0) {\n searchWindow.classList.remove('show');\n addAstronautToDOM(data);\n } else showNoResults();\n } else if(category.value === 'launch') {\n if(data.results.length !== 0) {\n searchWindow.classList.remove('show');\n addLaunchToDOM(data);\n } else showNoResults();\n } else if(category.value === 'expedition') {\n if(data.results.length !== 0) {\n searchWindow.classList.remove('show');\n addExpeditionToDOM(data);\n } else showNoResults();\n } else if(category.value === 'spacecraft') {\n if(data.results.length !== 0) {\n searchWindow.classList.remove('show');\n addSpacecraftToDOM(data);\n } else showNoResults();\n }\n}", "getCategories(req, res) {\n db.items.getAllCategories()\n .then(result => res.status(200).send(result));\n }", "function getMainCategories(isActive) {\n\t\tAdminService.categories().get({ sort: 'name', type: 'article', isActive: isActive }, function (response) {\n\t\t\tif (response.code == 200) {\n\t\t\t\tvm.mainCategoryList = response.data;\n\t\t\t}\n\t\t})\n\t}", "getAllcategory() {\n this.albumcategoryServices.getAll('', '1', '100').subscribe(res => {\n this.categoryList = res.result;\n });\n }" ]
[ "0.7223296", "0.68076", "0.6800256", "0.6795968", "0.6709581", "0.67035073", "0.6653035", "0.65990835", "0.6595726", "0.6589761", "0.65270054", "0.65250266", "0.65180606", "0.6500613", "0.64992934", "0.64796495", "0.6475869", "0.6469602", "0.64653", "0.6465141", "0.6444369", "0.6413326", "0.64084804", "0.6397541", "0.6381039", "0.6366622", "0.6358678", "0.63548875", "0.63388366", "0.6323808", "0.6306866", "0.6306777", "0.6305163", "0.6304188", "0.62767065", "0.62727404", "0.6257731", "0.62545705", "0.62494594", "0.6248196", "0.6221905", "0.62180656", "0.61969113", "0.61947787", "0.6189606", "0.61892915", "0.6182226", "0.61728066", "0.61724997", "0.6155487", "0.6138348", "0.6129203", "0.6128596", "0.6126508", "0.6117926", "0.6116956", "0.6107991", "0.6107479", "0.61025655", "0.6095336", "0.6094351", "0.6087622", "0.6069848", "0.60641915", "0.60553765", "0.60531676", "0.6051148", "0.6049793", "0.6042476", "0.603434", "0.6033212", "0.6031875", "0.60275316", "0.6020495", "0.60175705", "0.6016896", "0.60125446", "0.6001425", "0.60010487", "0.5994007", "0.5993588", "0.5985209", "0.5978528", "0.5974252", "0.59742", "0.59530413", "0.5943081", "0.59428465", "0.59410226", "0.5925343", "0.59212816", "0.5920735", "0.59202325", "0.5916889", "0.5900655", "0.58981365", "0.58964956", "0.58960235", "0.5889534", "0.58821285" ]
0.7217855
1
Riffle Shuffle / 1. Split the deck approximately in half 2. One half in the left hand, the other half in the right hand 3. Riffle the edges of both sets so they intermingle 4. Push the cards together 5. Repeat the process for 6 times or more
function shuffle(deck) { const cutDeckVariant = deck.length / 2 + Math.floor(Math.random() * 9) - 4; const leftHalf = deck.splice(0, cutDeckVariant); let leftCount = leftHalf.length; let rightCount = deck.length - Math.floor(Math.random() * 4); while(leftCount > 0) { const takeAmount = Math.floor(Math.random() * 4); deck.splice(rightCount, 0, ...leftHalf.splice(leftCount, takeAmount)); leftCount -= takeAmount; rightCount = rightCount - Math.floor(Math.random() * 4) + takeAmount; } deck.splice(rightCount, 0, ...leftHalf); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "realShuffle() {\n const shuffled = [];\n\n const {half1, half2} = this.halveDeck();\n\n let onHalf1 = true;\n let counter = 0;\n \n while (half1.length > 0 || half2.length > 0) {\n\n if (onHalf1) {\n\n if (!half1.length) {\n onHalf1 = !onHalf1;\n counter = 0;\n continue;\n }\n\n shuffled.unshift(half1.pop());\n counter++;\n\n if (counter >= 4 || !percentRoll(80)) {\n onHalf1 = !onHalf1;\n counter = 0;\n continue;\n }\n\n } else {\n\n if (!half2.length) {\n onHalf1 = !onHalf1;\n counter = 0;\n continue;\n }\n\n shuffled.unshift(half2.pop());\n counter++;\n\n if (counter >= 4 || !percentRoll(80)) {\n onHalf1 = !onHalf1;\n counter = 0;\n continue;\n }\n\n }\n\n }\n\n this.cards = shuffled;\n }", "shuffle() {\n let remainingCardTobeShuffled = this.deck.length, randomCardSwapIndex;\n\n // Swaps 52 times\n while (remainingCardTobeShuffled) {\n\n // Create a random index to be swapped\n randomCardSwapIndex = Math.floor(Math.random() * remainingCardTobeShuffled--);\n\n // Shortcut in js to swap two elements\n [this.deck[remainingCardTobeShuffled], this.deck[randomCardSwapIndex]] = [this.deck[randomCardSwapIndex], this.deck[remainingCardTobeShuffled]];\n }\n\n }", "function shuffleAndDeck(){\n\tshuffledDeck = listOfCards();\n\n\tfor (var i = 0; i<shuffledDeck.length; i++){\n\t\tif (i % 2 == 1){\n\t\t\tdeck1.push(new Card(shuffledDeck[i]).value);\n\t\t}else{\n\t\t\tdeck2.push(new Card(shuffledDeck[i]).value);\n\t\t}\n\t}\n\n}", "function shuffleDeck(){\n var firstIndex, secondIndex, firstCard, secondCard;\n for(var swaps = 0; swaps < 1000; swaps++){\n firstIndex = Math.floor(Math.random() * 48);\n secondIndex = Math.floor(Math.random() * 48);\n\n firstCard = currentDeck[firstIndex];\n secondCard = currentDeck[secondIndex];\n\n currentDeck[firstIndex] = secondCard;\n currentDeck[secondIndex] = firstCard;\n }\n}", "function shuffleDeck() {\n var firstShuffle = shuffle(deck);\n var secondShuffle = shuffle(firstShuffle);\n deck = shuffle(secondShuffle);\n}", "function shuffleCards() {\r\n shuffle(cardsOrig);\r\n cardsTop = cardsOrig.slice(0);\r\n shuffle(cardsOrig);\r\n cardsBottom = cardsOrig.slice(0);\r\n cards = cardsTop.concat(cardsBottom);\r\n shuffle(cards);\r\n console.log(cards);\r\n}", "function shuffleAndDeal() {\n let currentHand = 0;\n while (deckArray.length > 0) {\n let randomItemIndex = getRandomNumber(0, deckArray.length - 1);\n if (currentHand === 0) {\n firstPlayerHandArray.push(deckArray.splice(randomItemIndex, 1)[0]);\n currentHand = 1;\n } else if (currentHand === 1) {\n secondPlayerHandArray.push(deckArray.splice(randomItemIndex, 1)[0]);\n currentHand = 0;\n }\n }\n}", "function shuffleDeck(x) {\n var i = 0,\n j = 0,\n temp = null;\n for (let i = x.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1));\n temp = x[i];\n x[i] = x[j];\n x[j] = temp;\n }\n}", "shuffleDeck() {\n let n = this.deck.length;\n for (let i = 0; i < n; i++) {\n var r = Math.floor(Math.random() * n);\n this.shuffledCards.push(this.deck[r]);\n this.deck[r] = this.deck[n - 1];\n n--;\n }\n }", "shuffleDeck() {\n\t\t// Loop through the deck and shuffle cards\n \t\tfor (let i = this.mCardDeck.length - 1; i > 0; i--) {\n \tconst j = Math.floor(Math.random() * (i + 1));\n \t[this.mCardDeck[i], this.mCardDeck[j]] = [this.mCardDeck[j], this.mCardDeck[i]];\n \t}\n \t}", "function deal5() { return dealNCards(deepClone(deck52), 5)}", "reshuffle() {\n this._deck = [];\n for(var i = 0; i < 52; i++) {\n\t\t\tthis._deck.push(i);\n\t\t}\n \n this.shuffle();\n }", "function shuffle(cards)\n{\n\t// for loop???\n\t \n}", "static checkEdgeCards(deck) {\n //console.log(invalidCards);\n //console.log(deck[0]);console.log(deck[1]);console.log(deck[2]);\n //console.log(deck[51]);console.log(deck[52]);console.log(deck[53]);\n\n Deck.swap(deck[0], 0);\n Deck.swap(deck[1], 1);\n Deck.swap(deck[2], 2);\n Deck.swap(deck[51], 51);\n Deck.swap(deck[52], 52);\n Deck.swap(deck[53], 53);\n\n //console.log(randomIndex);\n //console.log(newCards);\n }", "function shuffle(deck) {\n for (let i = 0; i < 1000; i++) {\n let location1 = Math.floor((Math.random() * deck.length));\n let location2 = Math.floor((Math.random() * deck.length));\n // selects two random locations in the deck.\n // Math.random() will generate a float between 0 and 1\n // take this number and * by the deck length \n // Math.floor() will take the float and turn it into a whole #\n\n let temp = deck[location1]\n deck[location1] = deck[location2];\n deck[location2] = temp;\n // create a third location so that:\n // temp will take the first location\n // the first card will take the second card\n // the second card will take the first card\n // basically switching the positions.\n }\n}", "function shuffleDeck() { \n deck = [];\n var temp;\n for (var i = 0; i < faces.length; i++) {\n for (var j = 0; j < suits.length; j++) {\n\n if (i > 9) {\n temp = new card(faces[i] + ' of ' + suits[j], faces[i], suits[j], 10);\n }\n else {\n temp = new card(faces[i] + ' of ' + suits[j], faces[i], suits[j], i + 1);\n }\n deck.push(temp);\n }\n }\n}", "function shuffleTheDeck(){\n\tconst shuffledCards = shuffle(allCards);\n\t for (card of shuffledCards){\n\t\tdeck.appendChild(card);\n\t }\n }", "function shuffleDeck(decks)\n{\n for(let j=1; j<=_numberOfDecks; j++)\n {\n for(let i=0; i<=suits.length-1; i++)\n {\n for(let n=0; n<=card.length-1; n++)\n {\n if(card[n]===\"2\" || card[n]===\"3\" || card[n]===\"4\" || card[n]===\"5\" || card[n]===\"6\" || card[n]===\"7\" || card[n]===\"8\" || card[n]===\"9\")\n {\n decks.push({suit: suits[i], cardValue: card[n], numValue: n+1});\n }\n else if(card[n]===\"jack\" || card[n]===\"queen\" || card[n]===\"king\" || card[n]===\"10\")\n {\n decks.push({suit: suits[i], cardValue: card[n], numValue: 10});\n }\n else\n {\n decks.push({suit: suits[i], cardValue: card[n], numValue: 11});\n }\n }\n }\n }\n let arrLength = decks.length;\n for(let i=0; i<arrLength; i++)\n {\n if(decks[i].suit === 'hearts' || decks.suit === 'diamonds')\n {\n decks[i].color = \"red\";\n }\n else\n {\n decks[i].color = \"black\";\n }\n }\n function shuffleCard(decks)\n {\n let i = 0, j = 0, temp = null;\n\n for (i = decks.length - 1; i > 0; i--)\n {\n j = Math.floor(Math.random() * (decks.length));\n temp = decks[i];\n decks[i] = decks[j];\n decks[j] = temp;\n }\n }\n shuffleCard(decks);\n return decks; \n}", "generateRandomCardSet() {\n // clone card list\n let cards = this.cards.slice()\n // shuffle cards\n cards = this.shuffle(cards)\n // pick n number of cards then duplicate\n const tmp = cards.slice(0, 20)\n return this.shuffle(tmp.concat(tmp.slice()))\n }", "function shuffle()\n{\n var vurr_cards=document.getElementsByClassName(\"card\")\n quak_c=0\n startp1=10\n // hand_shake()\n for(var t in vurr_cards)\n {\n var mod_by=100\n var mult=Math.floor(Math.random()*10)\n var rule=[-5,-4,-3,3,4,5]\n var x_random=rule[Math.floor(Math.random()*rule.length)]\n var y_random=rule[Math.floor(Math.random()*rule.length)]\n slide(id_array[t], xpositions[t], (xpositions[t]+x_random*mult)%mod_by, ypositions[t], (ypositions[t]+y_random*mult)%mod_by);\n\n ypositions[t]=(ypositions[t]+y_random*mult)%mod_by\n xpositions[t]=(xpositions[t]+x_random*mult)%mod_by\n document.getElementById(\"output\").innerHTML=total+\" on turn \"+times_dealt+\" x:\"+x_random+ \"y: \"+y_random\n }\n}", "function shuffleDeck(){\n for(let i=0;i<deck.length;i++ ){\n swapIdx=Math.trunc( Math.random() * deck.length);\n let temp =deck[swapIdx];\n deck[swapIdx]=deck[i];\n deck[i]=temp;\n }\n}", "shuffle() {\n if(this.deck.length <= 1) { return; }\n \n for(let idx = 0; idx < this.deck.length - 1; idx++) {\n let idx_random = this.randomIndex(idx, this.deck.length - 1);\n \n if(idx_random !== idx) {\n let swap = this.deck[idx];\n this.deck[idx] = this.deck[idx_random];\n this.deck[idx_random] = swap;\n }\n }\n }", "function shuffleCards() {\n // Call to function to 'stack' cards\n toggleStackedCards();\n const cards = document.querySelectorAll('.card');\n\n // Create an array of values from 0-51 to represent cards in a deck\n const orderedDeck = Array.from(new Array(52), (x, i) => i);\n\n // Use the Fisher-Yates Shuffle algorithm to shuffle these values into a random order\n // in a new array call shuffledDeck\n const shuffledDeck = [];\n let n = orderedDeck.length;\n let i;\n while (n) {\n i = Math.round(Math.random() * (n -= 1));\n shuffledDeck.push(orderedDeck.splice(i, 1)[0]);\n }\n // Create an array of all card classes currently rendered to the dom\n const allCardClasses = [...cards].map((card) => card.classList[1]);\n\n // Pass once over each card element and remove its current card specific class and replace it with\n // the class in the same position from the array of shuffled classes\n cards.forEach((card, j) => {\n card.classList.remove(card.classList[1]);\n card.classList.add(allCardClasses[shuffledDeck[j]]);\n });\n\n // Refetch the array of all cards in the DOM, now shuffled, and correctly updates their\n // absolute positioning to appear spread out again once the cards are unstacked\n const shuffledCards = document.querySelectorAll('.card');\n shuffledCards.forEach((card, j) => {\n card.style.left = `${j * 30}px`;\n });\n}", "deckOfCards() {\n try {\n var suits = [\"♣\", \"♦\", \"♥\", \"♠\"];\n var ranks = [\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"Jack\",\n \"Queen\",\n \"King\",\n \"Ace\"\n ];\n /**\n * To calculate total number of cards\n */\n var totalCards = suits.length * ranks.length;\n /**\n * To create a deck of array\n */\n var cardArray = [];\n for (let currentSuit = 0; currentSuit < suits.length; currentSuit++) {\n for (let currentRank = 0; currentRank < ranks.length; currentRank++) {\n var temp = \"\";\n cardArray.push(temp + ranks[currentRank] + suits[currentSuit]);\n }\n }\n /**\n * To shuffle the deck\n */\n for (let shuffle = 0; shuffle < totalCards; shuffle++) {\n var num = Math.floor(Math.random() * totalCards);\n /**\n * Performing swapping\n */\n var temp = cardArray[shuffle];\n cardArray[shuffle] = cardArray[num];\n cardArray[num] = temp;\n }\n return cardArray;\n } catch (error) {\n console.log(error.message);\n }\n }", "function shuffleDeck() {\n // for 1000 turns\n // switch the values of two random cards\n for (var i = 0; i < 1000; i++) {\n var location1 = Math.floor(Math.random() * deck.length);\n var location2 = Math.floor(Math.random() * deck.length);\n var tmp = deck[location1];\n\n deck[location1] = deck[location2];\n deck[location2] = tmp;\n }\n}", "function shuffleCards(cardsToBeShuffled, gridSize){\n for(let count=0;count<1000;count++){\n let rand1 = Math.floor(Math.random() * gridSize);\n let rand2 = Math.floor(Math.random() * gridSize);\n let tempCard= cardsToBeShuffled[rand1];\n cardsToBeShuffled[rand1] = cardsToBeShuffled[rand2];\n cardsToBeShuffled[rand2] = tempCard;\n \n }\n}", "function shuffle () {\n for(let i=setDeck.length-1; i >= 0; i--){\n let j = Math.floor(Math.random() * i)\n let temp = setDeck[i]\n setDeck[i] = setDeck[j]\n setDeck[j] = temp\n }\n}", "function shuffleDeck(deck){\n for (let i=0; i<deck.length; i++){\n let swapIdx= Math.trunc(Math.random() * deck.length);\n let tmp = deck[swapIdx];\n deck[swapIdx] = deck[i];\n deck[i] = tmp;\n }\n}", "function makeDeck(numDecks) { //14 is for the 2 jokers\n let newDeck = [];\n let sumDeck = [];\n let deck = ['2c', '2d', '2h', '2s', '3c', '3d', '3h', '3s', '4c', '4d', '4h', '4s', '5c', '5d', '5h',\n '5s', '6c', '6d', '6h', '6s', '7c', '7d', '7h', '7s', '8c', '8d', '8h', '8s', '9c', '9d', '9h', '9s', '10c', '10d', '10h',\n '10s', '11c', '11d', '11h', '11s', '12c', '12d', '12h', '12s', '13c', '13d', '13h', '13s', '14j', '14j', '15c', '15d', '15h', '15s'];\n\n for (let i = 0; i < numDecks; i++) {\n sumDeck = sumDeck.concat(deck);\n }\n while (sumDeck.length > 0) {\n let ran = Math.floor((Math.random() * sumDeck.length));\n newDeck.push(sumDeck[ran]);\n sumDeck.splice(ran, 1);\n }\n return newDeck;\n}", "deckOfCards() {\n try {\n var suits = [\"Clubs\", \"Diamonds\", \"Hearts\", \"Spades\"];\n var ranks = [\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"Jack\",\n \"Queen\",\n \"King\",\n \"Ace\"\n ];\n /**\n * To calculate total number of cards\n */\n var totalCards = suits.length * ranks.length;\n /**\n * To create a deck of array\n */\n var cardArray = [];\n for (let currentSuit = 0; currentSuit < suits.length; currentSuit++) {\n for (let currentRank = 0; currentRank < ranks.length; currentRank++) {\n var temp = \"\";\n cardArray.push(temp + ranks[currentRank] + suits[currentSuit]);\n }\n }\n /**\n * To shuffle the deck\n */\n for (let shuffle = 0; shuffle < totalCards; shuffle++) {\n var num = Math.floor(Math.random() * totalCards);\n /**\n * Performing swapping\n */\n var temp = cardArray[shuffle];\n cardArray[shuffle] = cardArray[num];\n cardArray[num] = temp;\n \n }\n return cardArray;\n } catch (error) {\n console.log(error.message);\n }\n }", "shuffle() {\n const { cards } = this;\n for (let i = cards.length - 1; i > 0; i--) {\n // Find a random number in index\n // Assign to variable \"swapIndex,\" \n // Add new card every loop to this index\n const swapIndex = Math.floor(Math.random() * (i + 1)); \n // In this case, i+1 is 52 for cards in the deck\n // Locate current place in array\n const currentCard = this.cards[i];\n // Moves the chosen cards to the front of the array\n // Then swaps with remaining cards\n // Chooses a card from remaining array\n const cardToSwap = this.cards[swapIndex];\n this.cards[i] = cardToSwap;\n this.cards[swapIndex] = currentCard;\n };\n return this;\n }", "function allShuffles(cards){\n if(cards.length==1){\n return [cards];\n }\n var out = []\n for(var i = 0; i < cards.length;i++){\n [cards[0],cards[i]]=[cards[i],cards[0]];\n var temp = allShuffles(cards.slice(1));\n\n for(var shuffle of temp){\n shuffle.push(cards[0])\n out.push(shuffle);\n }\n [cards[0],cards[i]]=[cards[i],cards[0]];\n }\n return out;\n}", "shuffle(deck) {\n for (let i = deck.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n const temp = deck[i];\n deck[i] = deck[j];\n deck[j] = temp;\n }\n return deck;\n }", "shuffle() {\n for(let x = 0; x < 2; x++) { \n for (let i = this.cards.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i\n [this.cards[i], this.cards[j]] = [this.cards[j], this.cards[i]]; // swap elements\n }\n }\n }", "function ShuffledDeck()\n{\n\tlet suits = [\"hearts\", \"diamonds\", \"clubs\", \"spades\"];\n\t\n\tlet unshuffled = [];\n\t\n\tfor(let iSuits = 0; iSuits < 4; iSuits++)\n\t{\n\t\tunshuffled.push(new Card(suits[iSuits], \"Ace\"));\n\t\t\n\t\tfor(let cardNumber = 2; cardNumber <= 10; cardNumber++)\n\t\t{\n\t\t\tunshuffled.push(new Card(suits[iSuits], cardNumber));\n\t\t}\n\t\t\n\t\tunshuffled.push(new Card(suits[iSuits], \"Jack\"));\n\t\tunshuffled.push(new Card(suits[iSuits], \"Queen\"));\n\t\tunshuffled.push(new Card(suits[iSuits], \"King\"));\n\t}\n\t\n\tlet shuffled = [];\n\t\n\twhile(unshuffled.length > 0)\n\t{\n\t\tshuffled.push(unshuffled.splice(Random(0, unshuffled.length - 1), 1)[0]);\n\t}\n\t\n\treturn shuffled;\n}", "function shuffleDeck(){\n\tconst cardsToShuffle = Array.from(document.querySelectorAll('.deck li'));\n\tconst shuffledCards = shuffle(cardsToShuffle);\n\tfor (card of shuffledCards) {\n\t\tdeck.appendChild(card);\n\t}\n}", "shuffle()\n\t{\n\t\tlet temp;\n\t\tlet arraySpot;\n\t\tlet arraySpot2;\n\t\tfor (let x = 0; x < 1000000; x++)\n\t\t{\n\t\t\tarraySpot = Math.floor(Math.random() * this.numCards);\n\t\t\tarraySpot2 = Math.floor(Math.random() * this.numCards);\n\n\t\t\ttemp = this.cards[arraySpot];\n\t\t\tthis.cards[arraySpot] = this.cards[arraySpot2];\n\t\t\tthis.cards[arraySpot2] = temp;\n\t\t}\n\t}", "function shuffleDeck() {\n const shuffleCards = shuffle(cardsList);\n for(card of shuffleCards) {\n deck.appendChild(card);\n }\n}", "shuffle(){\n const deck = this.deck;\n let m = deck.length;\n let i;\n \n while(m){\n i = Math.floor(Math.random() * m--);\n \n [deck[m], deck[i]] = [deck[i], deck[m]];\n }\n \n return this;\n }", "function shuffle(deck) {\n for (var j, x, i = deck.length; i; j = Math.floor(Math.random() * i), x = deck[--i], deck[i] = deck[j], deck[j] = x)\n ;\n return deck;\n}", "function shuffleCards() {\n for (var i = 0; i < 52; i++) {\n var randIndex = getRand();\n if (i == 0) {\n deckCards.arrayOfCards[i] = randIndex;\n } else {\n while (deckCards.arrayOfCards.indexOf(randIndex) != -1) {\n randIndex = getRand();\n }\n deckCards.arrayOfCards[i] = randIndex;\n }\n }\n}", "function setCards(numberOfCards){\n\nvar numberOfMatches = numberOfCards / 2;\n\nshuffle(cardObjects);\n\n // ensure that there are only as many card objects as nessasary\n while(cardObjects.length > numberOfMatches){\n cardObjects.pop();\n }\n\n shuffle(cardObjects);\n\n}", "function testDeck(){\n // check both types of decks\n var noJokers = createDeck(0);\n checkDeck(noJokers);\n var jokers = createDeck(1);\n checkDeck(jokers);\n\n console.log(\"Passed initialization checks\");\n \n // draw all the cards from each deck and validate assumptions about them \n var noJokerCards = [];\n var jokerCards = []; \n\n var card, oldSize;\n for(var i = 0; i < noJokers.size; i++){\n oldSize = noJokers.size;\n card = noJokerCards.push(noJokers.draw);\n\n if(noJokers.cards.indexOf(card) != -1){\n throw new Error(\"noJokers has duplicate\" + card.rank + \" \" + card.suit);\n return;\n }\n if(oldSize <= noJokers.size){\n throw new Error(\"noJokers size innaccurate: is \" + oldSize + \" was \" +\n noJokers.size + \"should be \" + (52 - i));\n return;\n }\n \n checkDeck(noJokers);\n }\n for(var i = 0; i < jokers.size; i++){\n oldSize = jokers.size;\n card = jokerCards.push(jokers.draw);\n\n if(noJokers.cards.indexOf(card) != -1 && card.rank != joker.rank){\n throw new Error(\"jokers has duplicate\" + card.rank + \" \" + card.suit);\n return;\n }\n if(oldSize <= jokers.size){\n throw new Error(\"jokers size innaccurate: is \" + oldSize + \" was \" +\n noJokers.size + \"should be \" + (54 - i));\n return;\n }\n \n checkDeck(jokers);\n }\n\n console.log(\"Passed drawing checks\");\n\n // check shuffling by comparing a shuffled & unshuffled deck\n // there are better ways to do this, but perfect statistical randomness \n // is outside the scope of a non-monetary game\n var refDeck = createDeck(0);\n var testDeck = createDeck(0);\n var otherTestDeck = createDeck(0);\n testDeck.shuffle(); \n otherTestDeck.shuffle(); \n\n var refShuff = 0;\n var shuffOther = 0;\n var refOther = 0;\n for(var i=0; i<52; i++){\n if(refDeck.cards[i].rank == testDeck.cards[i].rank &&\n refDeck.cards[i].suit == testDeck.cards[i].suit){\n refShuff++;\n }\n if(refDeck.cards[i].rank == otherTestDeck.cards[i].rank &&\n refDeck.cards[i].suit == otherTestDeck.cards[i].suit){\n refOther++;\n }\n if(testDeck.cards[i].rank == otherTestDeck.cards[i].rank &&\n testDeck.cards[i].suit == otherTestDeck.cards[i].suit){\n shufffOther++;\n }\n }\n var randThresh = 1.0 / 3.0 ; // % match between two decks that is too high\n if(refShuff > (52 * randThresh) || refOther > (52 * randThresh) ||\n shuffOther > (52 * randThresh)){\n throw new Error(\"shuffling not random enough\");\n return;\n }\n return;\n}", "function shuffle(deck) {\n\n for (var i = 0; i < deck.length; i++) {\n new_i = Math.round(Math.random() * deck.length);\n tmp = deck[new_i];\n deck[new_i] = deck[i];\n deck[i] = tmp;\n }\n}", "shuffle() {\n for (var i = this._deck.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n var temp = this._deck[i];\n this._deck[i] = this._deck[j];\n this._deck [j] = temp;\n }\n }", "function shuffleDec() {\n\tfor (let i = deck.length - 1; i >= 0; i--) {\n\t\tlet j = Math.floor(Math.random() * (i + 1));\n\t\tlet randomizedCards = deck[i];\n\t\tdeck[i] = deck[j];\n\t\tdeck[j] = randomizedCards;\n\t}\n\treturn deck;\n}", "static shuffle(deck){\n\t var randomIndex;\n\t var temp;\n\t for(var i = 0; i < deck.length; i++){\n\t //pick a random index from 0 to deck.length - 1\n\t randomIndex = Math.floor(Math.random() * deck.length);\n\n\t temp = deck[i];\n\t deck[i] = deck[randomIndex];\n\t deck[randomIndex] = temp;\n\n\t }\n\t }", "shuffle(){\n // reset\n let cards = [\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"JACK\",\"QUEEN\",\"KING\",\"ACE\"]\n let jokers = [\"JOKER\",\"JOKER\",\"JOKER\",\"JOKER\"]\n let result = []\n result.push(...jokers)\n for(let i =0; i<8; i++) {\n result.push(...cards)\n }\n\n // shuffle cards Durstenfeld Shuffle\n // https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n this.deck = result\n return this.deck;\n }", "function shuffle(myDeck) {\n for (let i = myDeck.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [myDeck[i], myDeck[j]] = [myDeck[j], myDeck[i]];\n }\n }", "function createDeck()\n{\n var suits = [\"clubs\",\"diamonds\",\"hearts\",\"spades\"];\n \n for (i = 0; i<4;i++)\n {\n for (j = 2; j<15; j++)\n {\n cards.push({\n suit:suits[i],\n value:j \n });\n }\n }\n\n //shuffles the array\n shuffleArray(cards);\n}", "shuffle() {\n const cardDeck = this.cardDeck;\n let cdl = cardDeck.length;\n let i; // Loop through the deck, using Math.random() swap the two items locations in the array\n\n while (cdl) {\n i = Math.floor(Math.random() * cdl--);\n var _ref = [cardDeck[i], cardDeck[cdl]];\n cardDeck[cdl] = _ref[0];\n cardDeck[i] = _ref[1];\n }\n\n return this;\n }", "function splitCards4() {\n let deckCopy = [...deck];\n var equal = deckCopy.length / 4;\n let player1Cards = deckCopy.splice(0, equal);\n let player2Cards = deckCopy.splice(0, equal);\n let player3Cards = deckCopy.splice(0, equal);\n let player4Cards = deckCopy;\n}", "function shuffleDeck() {\n const shuffledCards = shuffle(Array.from($('.deck li')));\n for (card of shuffledCards) {\n deck.append(card);\n }\n}", "function shuffleCards() {\n let shuffledCards = shuffle(cardsArray);\n\n for (let i = 0; i < shuffledCards.length; i++) {\n [].forEach.call(shuffledCards, function(item) {\n deck.appendChild(item);\n });\n }\n}", "function shuffle() {\n randomize(deck);\n renderDeck(deck);\n}", "giveCards() {\n var suit = [\"♣️\", \"♦️\", \"♥️\", \"♠️\"];\n var rank = [\"King\", \"Queen\", \"Jack\", \"Ace\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\"];\n var cards = new Array();\n var n = suit.length * rank.length;\n for (let i = 0; i < suit.length; i++) {//adding of all 52 cards in array\n\n for (let j = 0; j < rank.length; j++) {\n cards.push(\"\" + rank[j]+ suit[i] );\n\n }\n\n }\n var l, temp;\n for (let index = 0; index < n; index++) {//mixing all the cards\n var l = Math.floor(Math.random() * n);\n temp = cards[l];\n cards[l] = cards[index];//swapping cards\n cards[index] = temp;\n\n }\n return cards;\n }", "function shuffleCards(){\n const cardsToShuffle = Array.from(document.querySelectorAll(\".deck li\"));\n const shuffled = shuffle(cardsToShuffle);\n\n for(card of shuffled){\n deck.appendChild(card);\n }\n}", "function getpyraoptscramble(mn) {\n var j = 1, b = [], g = [], f = [], d = [], e = [], k = [], h = [], i = [];\n\n function u() {\n var c, p, q, l, m;\n for (p = 0; p < 720; p++) {\n g[p] = -1;\n d[p] = [];\n for (m = 0; m < 4; m++)d[p][m] = w(p, m)\n }\n g[0] = 0;\n for (l = 0; l <= 6; l++)for (p = 0; p < 720; p++)if (g[p] == l)for (m = 0; m < 4; m++) {\n q = p;\n for (c = 0; c < 2; c++) {\n q = d[q][m];\n if (g[q] == -1)g[q] = l + 1\n }\n }\n for (p = 0; p < 2592; p++) {\n f[p] = -1;\n e[p] = [];\n for (m = 0; m < 4; m++)e[p][m] = x(p, m)\n }\n f[0] = 0;\n for (l = 0; l <= 5; l++)for (p = 0; p < 2592; p++)if (f[p] == l)for (m = 0; m < 4; m++) {\n q = p;\n for (c = 0; c < 2; c++) {\n q = e[q][m];\n if (f[q] == -1)f[q] = l + 1\n }\n }\n for (c = 0; c < j; c++) {\n k = [];\n var t = 0, s = 0;\n q = 0;\n h = [0, 1, 2, 3, 4, 5];\n for (m = 0; m < 4; m++) {\n p = m + n(6 - m);\n l = h[m];\n h[m] = h[p];\n h[p] = l;\n if (m != p)s++\n }\n if (s % 2 == 1) {\n l = h[4];\n h[4] = h[5];\n h[5] = l\n }\n s = 0;\n i = [];\n for (m = 0; m < 5; m++) {\n i[m] = n(2);\n s += i[m]\n }\n i[5] = s % 2;\n for (m = 6; m < 10; m++) {\n i[m] = n(3)\n }\n for (m = 0; m < 6; m++) {\n l = 0;\n for (p = 0; p < 6; p++) {\n if (h[p] == m)break;\n if (h[p] > m)l++\n }\n q = q * (6 - m) + l\n }\n for (m = 9; m >= 6; m--)t = t * 3 + i[m];\n for (m = 4; m >= 0; m--)t = t * 2 + i[m];\n if (q != 0 || t != 0)for (m = mn; m < 99; m++)if (v(q, t, m, -1))break;\n b[c] = \"\";\n for (p = 0; p < k.length; p++)b[c] += [\"U\", \"L\", \"R\", \"B\"][k[p] & 7] + [\"\", \"'\"][(k[p] & 8) / 8] + \" \";\n var a = [\"l\", \"r\", \"b\", \"u\"];\n for (p = 0; p < 4; p++) {\n q = n(3);\n if (q < 2)b[c] += a[p] + [\"\", \"'\"][q] + \" \"\n }\n }\n }\n\n function v(q, t, l, c) {\n if (l == 0) {\n if (q == 0 && t == 0)return true\n } else {\n if (g[q] > l || f[t] > l)return false;\n var p, s, a, m;\n for (m = 0; m < 4; m++)if (m != c) {\n p = q;\n s = t;\n for (a = 0; a < 2; a++) {\n p = d[p][m];\n s = e[s][m];\n k[k.length] = m + 8 * a;\n if (v(p, s, l - 1, m))return true;\n k.length--\n }\n }\n }\n return false\n }\n\n function w(p, m) {\n var a, l, c, s = [], q = p;\n for (a = 1; a <= 6; a++) {\n c = Math.floor(q / a);\n l = q - a * c;\n q = c;\n for (c = a - 1; c >= l; c--)s[c + 1] = s[c];\n s[l] = 6 - a\n }\n if (m == 0)y(s, 0, 3, 1);\n if (m == 1)y(s, 1, 5, 2);\n if (m == 2)y(s, 0, 2, 4);\n if (m == 3)y(s, 3, 4, 5);\n q = 0;\n for (a = 0; a < 6; a++) {\n l = 0;\n for (c = 0; c < 6; c++) {\n if (s[c] == a)break;\n if (s[c] > a)l++\n }\n q = q * (6 - a) + l\n }\n return q\n }\n\n function x(p, m) {\n var a, l, c, t = 0, s = [], q = p;\n for (a = 0; a <= 4; a++) {\n s[a] = q & 1;\n q >>= 1;\n t ^= s[a]\n }\n s[5] = t;\n for (a = 6; a <= 9; a++) {\n c = Math.floor(q / 3);\n l = q - 3 * c;\n q = c;\n s[a] = l\n }\n if (m == 0) {\n s[6]++;\n if (s[6] == 3)s[6] = 0;\n y(s, 0, 3, 1);\n s[1] ^= 1;\n s[3] ^= 1\n }\n if (m == 1) {\n s[7]++;\n if (s[7] == 3)s[7] = 0;\n y(s, 1, 5, 2);\n s[2] ^= 1;\n s[5] ^= 1\n }\n if (m == 2) {\n s[8]++;\n if (s[8] == 3)s[8] = 0;\n y(s, 0, 2, 4);\n s[0] ^= 1;\n s[2] ^= 1\n }\n if (m == 3) {\n s[9]++;\n if (s[9] == 3)s[9] = 0;\n y(s, 3, 4, 5);\n s[3] ^= 1;\n s[4] ^= 1\n }\n q = 0;\n for (a = 9; a >= 6; a--)q = q * 3 + s[a];\n for (a = 4; a >= 0; a--)q = q * 2 + s[a];\n return q\n }\n\n function y(p, a, c, t) {\n var s = p[a];\n p[a] = p[c];\n p[c] = p[t];\n p[t] = s\n }\n\n function n(c) {\n return Math.floor(Math.random() * c)\n }\n\n u();\n ss[0] += b[0];\n}", "shuffleDeck(array) {\n let c = array.length, a, b;\n console.log(c);\n\n while (c){\n b = Math.floor(Math.random() * c--);\n\n\n a = array[c];\n array[c]= array[b];\n array[b] = a;\n }\n return array;\n }", "function createShuffleCards(numberOfDecks) {\n var nonShuffledCards = [ \n 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K',\n 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K',\n 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K',\n 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'\n ];\n\n var shuffledCards = nonShuffledCards;\n var indexShuffledCards = 0;\n \n var cardsObj = {\n getNextCard : function() {\n var nextCard = shuffledCards[indexShuffledCards];\n ++indexShuffledCards;\n return nextCard;\n },\n \n addCard : function(p) {\n p.addCard(this.getNextCard())\n }\n };\n \n /* This shuffle the cards */\n for( var i = 0; i < 52; ++i) {\n var newIdx = Math.floor(Math.random() * 52);\n var tmp = shuffledCards[i];\n shuffledCards[i] = shuffledCards[newIdx];\n shuffledCards[newIdx] = tmp;\n }\n\n return cardsObj;\n}", "function setBoard() {\n const cards = $('.card');\n\n const shuffledCards = shuffle(cards);\n\n for (let i = 0; i < shuffledCards.length; i++) {\n $('.deck').append(shuffledCards[i]);\n }\n}", "shuffleCards(a) {\n for(let i=a.length-1;i>0;i--){\n const j = Math.floor(Math.random() * (i + 1));\n [a[i], a[j]] = [a[j], a[i]];\n }\n }", "function shuffleDeck() {\n let deck = cards.slice(0);\n // increment up\n for (let i = 0; i < deck.length; i++) {\n // Generate random number to make new position for each card in deck\n let randomNum = Math.floor(Math.random() * deck.length);\n\n // Swap card positions\n randomPosition = deck[i];\n deck[i] = deck[randomNum];\n deck[randomNum] = randomPosition;\n }\n return deck;\n}", "function shuffleDeck(){\n const cardstoShuffle = document.querySelectorAll('.deck li');\n console.log(\"Cards to shuffle\", cardstoShuffle);\n const arraytoShuffle = Array.from(cardstoShuffle);\n const shuffledCards = shuffle(arraytoShuffle);\n console.log(\"Shuffled Cards\", shuffledCards);\n for(card of shuffledCards){\n deck.appendChild(card);\n }\n}", "function dealerCards() {\n for (let i = 0; i < 2; i++) {\n let dealerDealtCards = cardDeck.shift();\n dealerHand.push(dealerDealtCards);\n }\n}", "function shuffleDeck(deck) {\n for (let i = 0; i < deck.length; i++) {\n let swapIdx = Math.trunc(Math.random() * deck.length);\n let tmp = deck[swapIdx];\n deck[swapIdx] = deck[i];\n deck[i] = tmp;\n }\n return deck\n}", "function shuffleDeck(){\n const cardsToShuffle=Array.from(document.querySelectorAll('.deck li'));\n const shuffledCards=shuffle(cardsToShuffle);\n for(card of shuffledCards){\n allCards.appendChild(card);\n }\n}", "function sufflePieces() {\n \n var numerot = [];\n while(numerot.length < 16){\n var satunnainen = Math.floor(Math.random() * 16)+ 1;\n if((numerot.includes(satunnainen))===false){\n numerot.push(satunnainen);\n \n }\n }\n \n \n // set all unmovable\n setUnmovable();\n \n var empty = $(\"#empty\");\n empty.removeAttr(\"id\");\n empty.addClass(\"piece\");\n \n \n for(var i =1; i<=16; i++){\n var laatta = $(\".\"+i);\n if(numerot[i-1] === 16){\n laatta.attr(\"id\",\"empty\");\n laatta.removeClass(\"piece\");\n laatta.text(\"\");\n }else{\n laatta.text(numerot[i-1]);\n }\n \n \n }\n \n setMovablePieces();\n\n // Stop the counter\n clearInterval(counter);\n\n // start new counter from 0\n laskuri();\n \n \n }", "shuffle() {\n let len = this.cards.length;\n while(len) {\n // randomly choose a card and move it to the end\n // of the deck\n this.cards.push(\n this.cards.splice( Math.floor( Math.random() * len ), 1 )[0]\n )\n len -= 1\n }\n }", "makeRandomPairs(number) {\n const totalPairs = number * 2;\n const tempArray = [];\n\n while (tempArray.length < totalPairs) {\n const tempRandomCardIndex = this.makeRandomNumber(52);\n\n if (!tempArray.includes(tempRandomCardIndex)) {\n tempArray.push(tempRandomCardIndex, tempRandomCardIndex);\n }\n }\n\n for (let i = tempArray.length - 1; i > 0; i -= 1) {\n const j = this.makeRandomNumber(i + 1);\n const temp = tempArray[i];\n tempArray[i] = tempArray[j];\n tempArray[j] = temp;\n }\n\n tempArray.forEach((cardIndex) => {\n randomCards.push(deck[cardIndex]);\n });\n }", "function Shuffle(deckArray) \r\n {\r\n var i, j, n, temp;\r\n for (i = 0; i < n; i++)\r\n {\r\n for (j = 0; j < deckArray.length; j++)\r\n {\r\n k = Math.floor(Math.random() * deckArray.length);\r\n temp = deckArray[j];\r\n deckArray[j] = deckArray[k];\r\n deckArray[k] = temp;\r\n }\r\n }\r\n return deckArray;\r\n }", "shuffle(cards) {\n for (let i = cards.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1));\n [cards[i], cards[j]] = [cards[j], cards[i]];\n }\n return cards;\n }", "function shuffleCards() {\n clearCards();\n const generatedCards = [];\n while (generatedCards.length < 9) {\n const randomIndex = generateRandomIndex();\n if (!generatedCards.includes(randomIndex) && randomIndex < 9) {\n generatedCards.push(randomIndex);\n createCard(randomIndex);\n }\n }\n\n}", "mapFlipDownCards(cards) {\n if (!cards) return;\n let flatArr = this.getFlatten(cards);\n // let flatArr = cards.flat();\n let cardsNumberOnHand = 5;\n let totalLen = flatArr.length;\n // if cards number is under n, split flipdown card into two row;\n if (totalLen <= cardsNumberOnHand) {\n let mid = Math.floor(totalLen / 2);\n return [flatArr.slice(0, mid), flatArr.slice(mid, totalLen)];\n } else {\n let threeRow = [[], [], []];\n flatArr.map((card, index) => threeRow[index % 3].push(card));\n return threeRow;\n }\n }", "function dealCards() {\n \n //variable for the position in the deck that hasn't been picked\n var notPicked = [];\n for (let i = 0; i < 24;i++) {\n notPicked[i] = i;\n }\n\n\n for (let i = 0; i < 4; i++) { //4 players\n for (let k = 0; k < 5; k++) { // get 5 cards\n\n //pick a random number that is not higher than the number of cards not yet picked\n let randomNumber = Math.floor(Math.random()*notPicked.length);\n\n // switch statement so that each k(card) gets a card for each i(player)\n switch(k) {\n case 0:\n players[i].card1 = euchreDeck[notPicked[randomNumber]];\n break;\n case 1:\n players[i].card2 = euchreDeck[notPicked[randomNumber]];\n break;\n case 2:\n players[i].card3 = euchreDeck[notPicked[randomNumber]];\n break;\n case 3:\n players[i].card4 = euchreDeck[notPicked[randomNumber]];\n break;\n case 4:\n players[i].card5 = euchreDeck[notPicked[randomNumber]];\n break;\n default: console.log(\"error with dealCards() @ Line 92 gameLogic.js\");\n }\n // after the card has been assigned, it is removed from the not picked array\n notPicked.splice(randomNumber, 1);\n }\n }\n // pick a number between 0-3 to randomly select what trump will be out of the remaining 4 cards.\n let randomNumber = Math.floor(Math.random()*4);\n\n // variable for the card flipped over that decides trump.\n trumpCard = euchreDeck[notPicked[randomNumber]];\n\n // console.log(trumpCard);\n\n}", "shuffleCards() {\n let random = 0;\n let temp = 0;\n for (i = 1; i < game.cards.length; i++) {\n random = Math.round(Math.random() * i);\n temp = game.cards[i];\n game.cards[i] = game.cards[random];\n game.cards[random] = temp;\n }\n game.assignData();\n \n }", "function shuffleDeck() {\n var numberArray = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27];\n for(var i = 0 ; i<14; i++){\n var randomNumber = Math.floor(Math.random() * numberArray.length);\n var deckNumberArray = numberArray.splice(randomNumber, 1);\n var deckNumber = deckNumberArray[0];\n playerDeckNumbers.push(deckNumber);\n }\n enemyDeckNumbers = numberArray\n createPlayerCards();\n createEnemyCards();\n $(\"#begin\").text(\"Click here to begin game\")\n checkVansOwned()\n checkUtilitiesOwned()\n checkPropertiesOwnedEnemy()\n checkPropertiesOwnedPlayer()\n checkMortgages()\n checkUnmortgages()\n}", "function refreshDeck() {\n let suitIdx = 0;\n let rankIdx = 0;\n\n while (suitIdx<4) {\n rankIdx = 0;\n while(rankIdx<13) {\n currentDeck.push(`${SUITS[suitIdx]}${RANKS[rankIdx]}`);\n rankIdx += 1;\n }\n suitIdx += 1;\n }\n}", "function checkSingleRiffle2(shuffledDeck, half1, half2) {\n let half1Idx = 0;\n let half2Idx = 0;\n\n for (let i = 0; i < shuffledDeck.length; i++) {\n if (half1Idx < half1.length && shuffledDeck[i] === half1[half1Idx]) {\n half1Idx++;\n } else if (half2Idx < half2.length && shuffledDeck[i] === half2[half2Idx]) {\n half2Idx++;\n } else {\n return false;\n }\n }\n\n return true;\n}", "function radomTiles() {\n for (var i = 1; i < 13; i++) {\n var num = Math.floor(Math.random() * 12)+1; //pick a random number\n if (doubles.includes(num)) { //if the random number has already been chosen lower i by 1 and try again\n i--;\n continue;\n }else{\n doubles.push(num) //add chosen number to doubles array\n flipped.push(dogs[num]) //use random number to pick a dog and add it to flipped array\n\n }\n }\n}", "dealCards(dealer) {\n const curPlayerIndex = this.playerContainer.players.reduce( (index, x, i) => x.isDealer ? i : index, -1);\n let curIndex;\n for (var i = 0; i < 2; i++) {\n for (var j = 0; j < this.playerContainer.players.length; j++) {\n curIndex = (curPlayerIndex + j) % (this.playerContainer.players.length);\n if (this.deck.cards.length) {\n this.playerContainer.players[curIndex].hand.push(this.deck.cards.pop());\n } else {\n this.deck = new Deck();\n this.playerContainer.players[curIndex].hand.push(this.deck.cards.pop());\n }\n }\n }\n }", "function shuffleCards() {\n const shuffle = cards;\n let d = shuffle.length;\n let n;\n while (d) {\n n = Math.floor(Math.random() * (d -= 1));\n [shuffle[d], shuffle[n]] = [shuffle[n], shuffle[d]];\n }\n\n // For each dataObject, replace the previous card and append it to the DOM\n shuffle.forEach((card, i) => {\n const positionFromLeft = i * 30;\n const shuffledCards = document.createElement('div');\n shuffledCards.setAttribute('data-value', card.value);\n shuffledCards.classList.add('card', `${card.suit}-${card.value}`);\n shuffledCards.style.left = `${positionFromLeft}px`;\n cardsWrapper.replaceChild(shuffledCards, cardsWrapper.children[i]);\n });\n}", "function shuffle(thedeck) {\n let ctr = thedeck.length;\n let temp;\n let index;\n while (ctr > 0) {\n index = Math.floor(Math.random() * ctr);\n ctr--;\n temp = thedeck[ctr];\n thedeck[ctr] = thedeck[index];\n thedeck[index] = temp;\n }\n return thedeck;\n}", "function MutateDeck(deck)\n{\n\tlet newDeck = deck.slice();\n\t\n\tfor(let i = 0, n = newDeck.length; i < n; i++)\n\t{\n\t\tif(Random(1, 100) <= _config.features.genetic.mutationRatePercentage)\n\t\t{\n\t\t\tlet swapCard = Random(0, n - 1);\n\t\t\tlet tempCard = new Card(newDeck[i].suit, newDeck[i].type);\n\t\t\t\n\t\t\tnewDeck[i] = new Card(newDeck[swapCard].suit, newDeck[swapCard].type);\n\t\t\tnewDeck[swapCard] = new Card(tempCard.suit, tempCard.type);\n\t\t}\n\t}\n\t\n\treturn newDeck;\n}", "function shuffle(deck) {\n for (var i = deck.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * i);\n var temp = deck[i];\n deck[i] = deck[j];\n deck[j] = temp;\n }\n return deck;\n}", "useCard(cards){\n // check for length\n switch(cards.length){\n case 2: \n // In a pair, the system needs to check if the cards have the same numbers\n if(cards[0][0] === cards[1][0]) return 1;\n else return 0;\n case 3:\n // In a three of a kind, the system needs to check if all three cards have the same number\n if(cards[0][0] === cards[1][0] && cards[0][0] == cards[2][0]) return 2;\n else return 0;\n case 4:\n // In a double pair, the system needs to check if the amount of cards multiply to 4\n // The counter shall count how many of each numbered cards have been selected\n // Example: The counter counted 3 8's and 1 4 || the counter counted 2 K's and 2 Q's\n // Multiplication shall show that only 2 of each card can result to 4 (3*1 = 3, 1^4 = 1, 2*2 = 4, 2*1*1 = 2)\n // This means that 2 of each card is guaranteed to be a double pair\n let counter = {};\n cards.forEach(card => {\n let number = card[0];\n counter[number] ? counter[number]++ : counter[number] = 1;\n })\n if(Object.keys(counter).length === 2){\n const product = Object.values(counter).reduce( (acc,val) => acc * val);\n if(product === 4) return 3;\n else return 0;\n }else{\n return 0;\n }\n case 5:\n // In a combination of 5, the system needs to know various information to determine the hand selected.\n // rank string will be used to order the cards for straights\n const rank = \"234567890JQKA\";\n // sort based on rank\n // the sort method uses a mixture of quicksort and insertion sort\n cards = cards.sort( (a,b) => rank.indexOf(a[0]) - rank.indexOf(b[0]) );\n\n // setup flags to check which combination the player has selected\n let straight = true;\n let flush = true;\n // a flush can be detected with a set, a set with the length greater than 1 is not a flush\n let flushSet = new Set();\n let combination = {};\n\n cards.forEach( (card, i) => {\n let first = rank.indexOf(cards[0][0])\n let val = rank.indexOf(card[0]);\n let suit = card[1];\n\n // In a straight all card values subtracted by the index value of the loop will equal to the\n // lowest value card in the straight. The can only be done in a sorted card array. \n if(val - i !== first) straight = false;\n flushSet.add(suit);\n // If the flush set has more than one suit then its not a flush.\n if(flushSet.size > 1) flush = false;\n let number = card[0];\n combination[number] ? combination[number]++ : combination[number] = 1;\n })\n\n // if both striaght and flush then it is a straight flush.\n if(straight && flush) return 8;\n else if(flush) return 5;\n else if(straight) return 4; \n else if(Object.keys(combination).length === 2){\n let values = Object.values(combination);\n // full house check. The system checks if the object has 3 of the same numbered cards or 2.\n // If it does then it is guaranteed a full house. If not then it is guaranteed a four-of-a-kind.\n // combination cannot be 3-1-1 or anything else because the length of the counter obj must be 2.\n // 5 card possible combinations (1-1-1-1-1, 2-1-1-1, 3-1-1, 2-2-1, 3-2, 4-1). Can see that only the latter 2 have length of 2.\n if(values[0] === 2 || values[0] === 3) return 6;\n else return 7;\n }\n return 0;\n\n default: return 0;\n }\n }", "function shuffle(cardSet) {\n var currentIndex = cardSet.length, temporaryValue, randomIndex\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex)\n currentIndex -= 1;\n // And swap it with the current element.\n temporaryValue = cardSet[currentIndex]\n cardSet[currentIndex] = cardSet[randomIndex]\n cardSet[randomIndex] = temporaryValue\n }\n return cardSet;\n}", "function shuffleCards()\n{\n var i = 0;\n var j = 0;\n var temp = null;\n\n for (i = cards.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1));\n temp = cards[i];\n cards[i] = cards[j];\n cards[j] = temp;\n }\n}", "function shuffleCards()\n{\n var i = 0;\n var j = 0;\n var temp = null;\n\n for (i = cards.length - 1; i > 0; i -= 1) {\n j = Math.floor(Math.random() * (i + 1));\n temp = cards[i];\n cards[i] = cards[j];\n cards[j] = temp;\n }\n}", "function playRound() {\n if (cardValue.indexOf(deck1[0]) > cardValue.indexOf(deck2[0])) {\n moveToBack(deck1, deck1, 1);\n moveToBack(deck2, deck1, 1);\n }\n else if (cardValue.indexOf(deck2[0]) > cardValue.indexOf(deck1[0])) {\n moveToBack(deck1, deck2, 1);\n moveToBack(deck2, deck2, 1);\n }\n else {\n playWar();\n }\n \n n = deck1.length;\n m = deck2.length;\n}", "shuffleDeck() {\n let currentIndex = this.fullDeck.length,\n temporyValue,\n randomIndex;\n\n // while there are cards left\n while (currentIndex > 0) {\n //Pick a remaining element\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n\n // And swap with current element\n temporyValue = this.fullDeck[currentIndex];\n this.fullDeck[currentIndex] = this.fullDeck[randomIndex];\n this.fullDeck[randomIndex] = temporyValue;\n }\n\n return this.fullDeck;\n }", "function deckShuffle() {\n const shuffled = shuffle(Array.from(document.querySelectorAll('.card')));\n shuffled.forEach(function(element) {\n element.remove();\n });\n shuffled.forEach(function(element) {\n cardDeck.appendChild(element)\n });\n}", "function generateCards(){\n shuffle(cardList.concat(cardList)).forEach(createCard);\n}", "function flipCard() {\n\n\tfor(var i = 0; i <= 5; i++)\n\t{\n\t\tif($('#card' + (i + 1)).text() == 'L') {\n\t\t\tvar c = Math.floor((Math.random() * largeValues.length));\n\t\t\tcards.push(largeValues[c]);\n\t\t}else {\n\t\t\tvar c = Math.floor((Math.random() * smallValues.length));\n\t\t\tcards.push(smallValues[c]);\n\t\t}\n\t\t$('#card' + (i + 1)).text(cards[i]);\n\t}\n}", "halveDeck() {\n const trueMidpoint = Math.floor(this.cards.length / 2);\n const actualMidpoint = Math.floor(Math.random() * 10) + (trueMidpoint - 5);\n\n return {\n half1: this.cards.slice(0, actualMidpoint),\n half2: this.cards.slice(actualMidpoint)\n }\n }", "function shuffle(deck) {\n if(deck === undefined || deck === null) {\n return undefined;\n }\n // j is a random integer such that i=<j<deck.length\n for(let i = 0; i < deck.length-1 ; i += 1) {\n let j = randInt(deck.length - i) + i;\n let currentCard = deck[i];\n deck[i] = deck[j];\n deck[j] = currentCard;\n }\n}", "giveCards(){\n var suit=[\"♣️\",\"♦️\", \"♥️\", \"♠️\"];\n var rank=[\"King\",\"Queen\",\"Jack\",\"Ace\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\"];\n var cards=new Array();\n var n=suit.length*rank.length;\n for (let i = 0; i < suit.length; i++) {//adding of all 52 cards in array\n \n for (let j = 0; j < rank.length; j++) {\n cards.push(\"\"+suit[i]+rank[j]);\n \n }\n \n }\n var l,temp;\n for (let index = 0; index < n; index++) {//mixing all the cards\n var l=Math.floor(Math.random()*n);\n temp=cards[l];\n cards[l]=cards[index];//swapping cards\n cards[index]=temp;\n \n }\n return cards;\n }", "function redeal() {\r\n cardCount++\r\n if(cardCount > 40) {\r\n shuffleDeck(cards);\r\n cardCount = 0;\r\n message.innerHTML = \"The deck was shuffled. \";\r\n }\r\n }", "function generateCards() {\n for (var i = 0; i < 2; i++) {\n cardLists = shuffle(cardLists);\n cardLists.forEach(createCard);\n }\n}", "shuffleCards() {\n for (var i = cards.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * (i + 1))\n var temp = cards[i]\n cards[i] = cards[j]\n cards[j] = temp\n }\n }" ]
[ "0.74809545", "0.70599777", "0.6877629", "0.684717", "0.6742009", "0.6713707", "0.66870886", "0.6663174", "0.6644023", "0.66213506", "0.6618641", "0.6616935", "0.66044", "0.66033953", "0.65810484", "0.65407485", "0.65294045", "0.65284795", "0.65015084", "0.64942527", "0.6492186", "0.64628166", "0.64589125", "0.6450212", "0.64472693", "0.6436353", "0.64342964", "0.6425779", "0.641167", "0.64058065", "0.64011234", "0.6395833", "0.63940907", "0.6383833", "0.6383728", "0.63725984", "0.6361982", "0.6355807", "0.6354901", "0.63453835", "0.6340117", "0.6339624", "0.63345987", "0.6332759", "0.6326452", "0.6321555", "0.63212085", "0.63098526", "0.6301498", "0.62995046", "0.62940925", "0.62770164", "0.6247225", "0.6245357", "0.6237771", "0.6235589", "0.62352806", "0.62301695", "0.6227466", "0.6226857", "0.6221343", "0.6210763", "0.62094647", "0.61889964", "0.6180967", "0.6171465", "0.6163764", "0.61575663", "0.61571115", "0.6153743", "0.61478704", "0.61433804", "0.6132738", "0.613222", "0.61313117", "0.61264026", "0.6122346", "0.61189705", "0.61110044", "0.61080945", "0.61045116", "0.6103845", "0.6102594", "0.6099457", "0.6095793", "0.60885835", "0.6082991", "0.60822135", "0.60822135", "0.60797405", "0.60775197", "0.60767126", "0.6076334", "0.6074505", "0.60705215", "0.6069701", "0.60683835", "0.6065504", "0.6064281", "0.6059197" ]
0.7190228
1
rgb2hex(rgb) function is borrowed from
function rgb2hex(rgb){ rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); return "#" + ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[3],10).toString(16)).slice(-2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rgb2hex(rgb){\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return rgb ? \"#\" +\n (\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '#00000000';\n }", "function rgb2hex(rgb) {\r\n return \"#\" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\r\n }", "function convertToHex(rgb) {\n return '#' + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function rgb2hex(rgb) {\n return \"#\" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n }", "function rgb2hex(rgb) {\n if (/^#[0-9A-F]{6}$/i.test(rgb)) return rgb;\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function rgb2hex(rgb){\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n return (rgb && rgb.length === 4) ? \"#\" +\n (\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n return (rgb && rgb.length === 4) ? \"#\" +\n (\"0\" + parseInt(rgb[1], 10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2], 10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';\n}", "function convertToHex(rgb) {\n return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n }", "function rgb2hex(rgb) {\nvar hex = [\nrgb.r.toString(16),\nrgb.g.toString(16),\nrgb.b.toString(16)\n];\n$.each(hex, function(nr, val) {\nif (val.length === 1) hex[nr] = '0' + val;\n});\nreturn '#' + hex.join('');\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n}", "function rgb2hex(rgb){\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n return (rgb && rgb.length === 4) ? \"#\" +\n (\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n //return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function rgb2hex(rgb) {\n if (/^#[0-9A-F]{6}$/i.test(rgb))\n return rgb;\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function convertToHex (rgb) {\n return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function convertToHex (rgb) {\n return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function convertToHex (rgb) {\n return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return \"#\" + hexify(rgb[1]) + hexify(rgb[2]) + hexify(rgb[3]);\n }", "rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return \"#\" + this.hex(rgb[1]) + this.hex(rgb[2]) + this.hex(rgb[3]);\n }", "function rgb2hex(rgb) {\n if (/^#[0-9A-F]{6}$/i.test(rgb)) { return rgb; }\n\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\n if (rgb === null) { return \"N/A\"; }\n\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function rgb2hex(rgb) {\n if (/^#[0-9A-F]{6}$/i.test(rgb)) { return rgb; }\n\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\n if (rgb === null) { return \"N/A\"; }\n\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function _rgb2hex(rgb) {\n\t if ( rgb.search(\"rgb\") == -1 ) {\n\t return rgb;\n\t } else {\n\t rgb = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+))?\\)$/);\n\t function hex(x) {\n\t return (\"0\" + parseInt(x).toString(16)).slice(-2);\n\t }\n\t return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); \n\t }\n\t}", "function rgb2hex(rgb) {\n\tvar hexDigits = new Array(\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"); \n\trgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\tfunction hex(x) {\n\t\treturn isNaN(x) ? \"00\" : String(hexDigits[(x - x % 16) / 16]) + String(hexDigits[x % 16]);\n\t}\n\tif(typeof rgb !== 'undefined' && rgb !== null){\n\t\treturn \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n\t}\n\treturn \"#ffffff\";\n}", "function rgb2Hex(rgb) {\n return \"#\" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "function rgb2hex(rgb) {\n\t\treturn (0x01000000 + rgb).toString(16).substr(-6).toUpperCase();\n\t}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }", "_toHex(rgb) {\r\n if (rgb.indexOf('#') !== -1) {\r\n return rgb;\r\n }\r\n\r\n const result = /rgb\\((\\d+), (\\d+), (\\d+)\\)/g.exec(rgb);\r\n\r\n if (!result) {\r\n return '#FFFFFF';\r\n }\r\n\r\n return '#' + (parseFloat(result[1]).toString(16).padStart(2, '0') +\r\n parseFloat(result[2]).toString(16).padStart(2, '0') +\r\n parseFloat(result[3]).toString(16).padStart(2, '0')).toUpperCase();\r\n }", "function rgb2hex(rgb) {\r\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\r\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\r\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n $val=\"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3])\n return $val.toUpperCase();\n}", "function rgb2hex(rgb) {\r\n\t\tvar hex = [\r\n\t\t\trgb.r.toString(16),\r\n\t\t\trgb.g.toString(16),\r\n\t\t\trgb.b.toString(16)\r\n\t\t];\r\n\t\t$.each(hex, function(nr, val) {\r\n\t\t\tif (val.length === 1) hex[nr] = '0' + val;\r\n\t\t});\r\n\t\treturn '#' + hex.join('');\r\n\t}", "function rgb2hex(rgb){if(/^#[0-9A-F]{6}$/i.test(rgb))return rgb;rgb=rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);function hex(x){return(\"0\"+parseInt(x).toString(16)).slice(-2);}return\"#\"+hex(rgb[1])+hex(rgb[2])+hex(rgb[3]);}// Return it", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n function hex(x) {\n return (\"0\" + parseInt(x).toString(16)).slice(-2);\n }\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n}", "function rgb2hex(rgb) {\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n if (!rgb) {\n return \"#000000\";\n } else {\n return \"#\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n }\n}", "function rgb2hex(rgb) {\r\n var hex = [\r\n rgb.r.toString(16),\r\n rgb.g.toString(16),\r\n rgb.b.toString(16)\r\n ];\r\n $.each(hex, function(nr, val) {\r\n if(val.length === 1) hex[nr] = '0' + val;\r\n });\r\n return '#' + hex.join('');\r\n }", "function rgb2hex(rgb) {\n var hex = [\n rgb.r.toString(16),\n rgb.g.toString(16),\n rgb.b.toString(16)\n ];\n $.each(hex, function(nr, val) {\n if(val.length === 1) hex[nr] = '0' + val;\n });\n return '#' + hex.join('');\n }", "function rgbHex(rgb) {\n let hex = '#';\n for (let i = 0; i < 3; i++) {\n hex += d2h(rgb[i]);\n }\n return hex;\n}", "function rgb2hex(rgb) {\n\t\tvar hex = [\n\t\t\trgb.r.toString(16),\n\t\t\trgb.g.toString(16),\n\t\t\trgb.b.toString(16)\n\t\t];\n\t\t$.each(hex, function(nr, val) {\n\t\t\tif (val.length === 1) hex[nr] = '0' + val;\n\t\t});\n\t\treturn '#' + hex.join('');\n\t}", "function rgb2hex(rgb) {\n\t\tvar hex = [\n\t\t\trgb.r.toString(16),\n\t\t\trgb.g.toString(16),\n\t\t\trgb.b.toString(16)\n\t\t];\n\t\t$.each(hex, function(nr, val) {\n\t\t\tif (val.length === 1) hex[nr] = '0' + val;\n\t\t});\n\t\treturn '#' + hex.join('');\n\t}", "function rgbToHex(rgb){ \r\n\t\tvar hex = Number(rgb).toString(16);\r\n\t\tif (hex.length < 2) {\r\n\t\t hex = \"0\" + hex;\r\n\t\t}\r\n\t\treturn hex;\r\n\t\t}", "function rgbToHex(rgb){\n var hex = Number(rgb).toString(16);\n if (hex.length < 2) {\n hex = \"0\" + hex;\n }\n return hex;\n\n function fullColorHex(r,g,b){\n var red = rgbToHex(r);\n var green = rgbToHex(g);\n var blue = rgbToHex(b);\n return red+green+blue;\n }\n}", "function rgbToHex(rgb) \n {\n var hexCode = \"\"; \n for(var i=0; i < rgb.length; i++)\n {\n var hex = parseInt(rgb[i]).toString(16);\n hex = hex.length == 1 ? \"0\" + hex : hex; \n hexCode += hex;\n }\n\n return \"#\" + hexCode;\n }", "function rgbToHexConverter(rgb) {\n const regex = /[\\(|\\)|r|g|b| ]/g\n let rgbString = rgb.replace(regex, '')\n let rgbArr = new Array();\n rgbArr = rgbString.split(\",\");\n const hex = \"#\" + ((1 << 24) + ((+rgbArr[0]) << 16) + ((+rgbArr[1]) << 8) + (+rgbArr[2])).toString(16).slice(1);\n return hex\n}", "function rgbString2hex(rgb){\r\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\r\n return (rgb && rgb.length === 4) ? '#' +\r\n ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +\r\n ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +\r\n ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\r\n }", "function rgbString2hex(rgb){\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n return (rgb && rgb.length === 4) ? '#' +\n ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +\n ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +\n ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n }", "function colorHex(rgb){\n\tvar colorRgb = rgb;\n\tif(/^(rgb|RGB)/.test(colorRgb)){\n\t\tvar aColor = colorRgb.replace(/(?:\\(|\\)|rgb|RGB)*/g,\"\").split(\",\");\n\t\tvar strHex = \"#\";\n\t\tfor(var i=0; i<aColor.length; i++){\n\t\t\tvar hex = Number(aColor[i]).toString(16);\n\t\t\thex = hex<10 ? 0+''+hex :hex;\n\t\t\tif(hex === \"0\"){\n\t\t\t\thex += hex;\n\t\t\t}\n\t\t\tstrHex += hex;\n\t\t}\n\t\tif(strHex.length !== 7){\n\t\t\tstrHex = colorRgb;\n\t\t}\n\t\treturn strHex;\n\t}else if(COLOR_REG.test(colorRgb)){\n\t\tvar aNum = colorRgb.replace(/#/,\"\").split(\"\");\n\t\tif(aNum.length === 6){\n\t\t\treturn colorRgb;\n\t\t}else if(aNum.length === 3){\n\t\t\tvar numHex = \"#\";\n\t\t\tfor(var i = 0; i < aNum.length; i+=1){\n\t\t\t\tnumHex += (aNum[i] + aNum[i]);\n\t\t\t}\n\t\t\treturn numHex;\n\t\t}\n\t}else{\n\t\treturn colorRgb;\n\t}\n}", "function rgbToHex(rgb){\n rgb = rgb.replace(\"rgb(\", \"\");\n rgb = rgb.replace(\")\", \"\");\n rgb = rgb.split(\",\");\n\n function deciToHex(rgb) {\n const BASE = 16;\n const ALPHABET = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\"];\n\n let rightHex = rgb % BASE;\n let leftHex = (rgb - rightHex) / BASE;\n return ALPHABET[leftHex] + ALPHABET[rightHex];\n }\n\n return '#' + deciToHex(rgb[0]) + deciToHex(rgb[1]) + deciToHex(rgb[2]);\n }", "_convertToHex(rgb) {\n return this._hex(rgb[0]) + this._hex(rgb[1]) + this._hex(rgb[2]);\n }", "rgbToHex(rgb) {\n const result = rgb.match(/\\d+/g);\n\n function hex(x) {\n var digits = new Array(\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\");\n return isNaN(x) ? \"00\" : digits[(x - x % 16 ) / 16] + digits[x % 16];\n }\n\n return \"#\" + hex(result[0]) + hex(result[1]) + hex(result[2]);\n }", "function rgb_to_hex(colorval) {\n var parts = colorval.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n delete(parts[0]);\n for (var i = 1; i < 4; i++) {\n parts[i] = parseInt(parts[i]).toString(16);\n if (parts[i].length == 1) parts[i] = '0' + parts[i];\n }\n return '#' + parts.join('');\n}", "function rgbToHex(hex) {\n\tif (hex == null) return '00';\n\thex = parseInt(hex);\n\tif (hex == 0 || isNaN(hex)) return '00';\n\thex = Math.max(0,hex); hex = Math.min(hex,255); hex=Math.round(hex);\n\treturn '0123456789ABCDEF'.charAt((hex-hex%16)/16)\n\t + '0123456789ABCDEF'.charAt(hex%16);\n}", "function rgbToHex(rgb) {\n hex = rgb.r.toString(16);\n r = hex.length == 1 ? \"0\" + hex : hex;\n hex = rgb.g.toString(16);\n g = hex.length == 1 ? \"0\" + hex : hex;\n hex = rgb.b.toString(16);\n b = hex.length == 1 ? \"0\" + hex : hex;\n return \"#\" + r + g + b;\n }", "function rgbToHex(rgb) {\n hex = rgb.r.toString(16);\n r = hex.length == 1 ? \"0\" + hex : hex;\n hex = rgb.g.toString(16);\n g = hex.length == 1 ? \"0\" + hex : hex;\n hex = rgb.b.toString(16);\n b = hex.length == 1 ? \"0\" + hex : hex;\n return \"#\" + r + g + b;\n}", "function colorRGBToHex(rgb){\n var color = rgb.toString().match(/\\d+/g);\n var hex = \"#\";\n for (var i = 0; i < 3; i++) {\n hex += (\"0\" + Number(color[i]).toString(16)).slice(-2);\n }\n return hex;\n}", "function rgbToHex(rgb) {\n return \"#\" + pad2(rgb.r.toString(16)) + pad2(rgb.g.toString(16)) + pad2(rgb.b.toString(16));\n}", "function rgb2hex(r, g, b) {\n return '#' \n + ('0' + r.toString(16)).slice(-2)\n + ('0' + g.toString(16)).slice(-2)\n + ('0' + b.toString(16)).slice(-2); \n}", "function rgbTohex(r, g, b) {\r\n return \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n}", "function rgbToHex(rgb) {\n const hexR = rgb.r.toString(16).padStart(2, \"0\");\n const hexG = rgb.g.toString(16).padStart(2, \"0\");\n const hexB = rgb.b.toString(16).padStart(2, \"0\");\n\n return \"#\" + hexR + hexG + hexB;\n}", "function rgbToHex(hex){\n return toHex(hex[0])+toHex(hex[1])+toHex(hex[2]);\n}", "function RGBToHex(rgb) {\n // Choose correct separator\n let sep = rgb.indexOf(\",\") > -1 ? \",\" : \" \";\n // Turn \"rgb(r,g,b)\" into [r,g,b]\n rgb = rgb.substr(4).split(\")\")[0].split(sep);\n \n let r = (+rgb[0]).toString(16),\n g = (+rgb[1]).toString(16),\n b = (+rgb[2]).toString(16);\n \n if (r.length == 1)\n r = \"0\" + r;\n if (g.length == 1)\n g = \"0\" + g;\n if (b.length == 1)\n b = \"0\" + b;\n \n return \"#\" + r + g + b;\n }", "function rgbToHex(rgb) {\n let r = rgb.r.toString(16).padStart(2, '0');\n let g = rgb.g.toString(16).padStart(2, '0');\n let b = rgb.b.toString(16).padStart(2, '0');\n return `#${r}${g}${b}`;\n}", "function thememount_rgbToHex( rgb ) {\n\trgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\treturn (rgb && rgb.length === 4) ? \"#\" +\n\t(\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n\t(\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n\t(\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n}", "function rgb2Hex(r, g, b){\n return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1, 7);\n}", "function rgb2Hex(color) {\n // Converts a single value to two-character hexadecimal\n function value2Hex(val) {\n val = Math.round(val).toString(16);\n // Must zero-pad for under-long things\n return color.base == 256 && val.length < 2 ? \"0\" + val : val;\n }\n return \"#\" + value2Hex(color.r) + value2Hex(color.g) + value2Hex(color.b)\n}", "function rgbToHex(R,G,B) { return toHex(R)+toHex(G)+toHex(B); }", "function _convertToHex(rgbArr) {\n if (rgbArr.toString() !== '[object Array]' && rgbArr.length != 3) {\n console.error('rgbArr should be an array with length equals to 3.');\n throw new Error('Invalid parameter');\n }\n var hex = _(rgbArr).map(_hex).reduce(function(prev, curr) {\n return prev + curr;\n });\n return '#' + hex;\n}", "function rgb2hex(color) {\n if (color.substr(0, 1) === '#') {\n return color;\n }\n var digits = /(.*?)rgba{0,1}\\((\\d+), (\\d+), (\\d+)\\)/.exec(color);\n\n if (digits == null) {\n digits = /(.*?)rgba\\((\\d+), (\\d+), (\\d+), (\\d+)\\)/.exec(color);\n }\n\n var red = parseInt(digits[2]);\n var green = parseInt(digits[3]);\n var blue = parseInt(digits[4]);\n\n var rgb = blue | (green << 8) | (red << 16);\n return digits[1] + '#' + (\"000000\" + rgb.toString(16)).slice(-6);\n}", "function rgb2hex(orig) {\n var rgb = orig.replace(/\\s/g, '').match(/^rgba?\\((\\d+),(\\d+),(\\d+)/i);\n return (rgb && rgb.length === 4) ? \"#\" +\n (\"0\" + parseInt(rgb[1], 10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2], 10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3], 10).toString(16)).slice(-2) : orig;\n}", "function rgb2Hex(r, g, b) \n{\n var colourHex = \"\";\n var hexArray = new Array( \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\" );\n var code1 = Math.floor(r*16);\n var code2 = Math.floor(r*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n var code1 = Math.floor(g*16);\n var code2 = Math.floor(g*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n var code1 = Math.floor(b*16);\n var code2 = Math.floor(b*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n return colourHex;\n}", "function rgb2hex(r, g, b) {\r\n return [_rgbToPaddedHex(r), _rgbToPaddedHex(g), _rgbToPaddedHex(b)].join('');\r\n}", "function rgbaToHex(rgb) {\n\trgb = rgb + \"\";\n\trgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\treturn (rgb && rgb.length === 4) ? \"#\" +\n\t\t(\"0\" + parseInt(rgb[1], 10).toString(16)).slice(-2) +\n\t\t(\"0\" + parseInt(rgb[2], 10).toString(16)).slice(-2) +\n\t\t(\"0\" + parseInt(rgb[3], 10).toString(16)).slice(-2) : \"\";\n}", "function rgb2hex(r, g, b) {\n return [_rgbToPaddedHex(r), _rgbToPaddedHex(g), _rgbToPaddedHex(b)].join('');\n}", "function RGBtoHEX() {\n let Red = parseInt(document.querySelector(\"#rangeRed\").value).toString(16);\n let Green = parseInt(document.querySelector(\"#rangeGreen\").value).toString(\n 16\n );\n let Blue = parseInt(document.querySelector(\"#rangeBlue\").value).toString(16);\n Red = Red.padStart(2, 0);\n Green = Green.padStart(2, 0);\n Blue = Blue.padStart(2, 0);\n console.log(308, Red, Green, Blue);\n document.querySelector(\"#HEXvalue3\").innerHTML = `HEX Value: <span>#${\n Red + Green + Blue\n }</span>`;\n}", "function RGBtoHex(r, g, b) {\n\t\treturn \"#\" + unitConversion(r) + unitConversion(g) + unitConversion(b);\n\t\t}", "function RGBAtoHEX(color){\n\tconst rgba = color.replace(/^rgba?\\(|\\s+|\\)$/g, '').split(',');\n\tconst hex = `#${((1 << 24) + (parseInt(rgba[0]) << 16) + (parseInt(rgba[1]) << 8) + parseInt(rgba[2])).toString(16).slice(1)}`;\n\n\treturn hex;\n}", "function rgbToHex (r, g, b) {\n var hx = '#' + componentToHex(r) + componentToHex(g) + componentToHex(b);\n return (hx);\n}", "function rgb2Hex(s) {\n //@ts-ignore\n return s.match(/[0-9]+/g).reduce(function (a, b) { return a + (b | 256).toString(16).slice(1); }, '#').toString(16);\n}", "function GetHexColour($Rgb)\n{\n\tvar $Length = 6\n\treturn ('000000000' + $Rgb.toString(16) ).substr(-$Length);\n}", "function rgbToHex(rgbObj) {\n return '#' + formatDecToHex(rgbObj.r) + formatDecToHex(rgbObj.g) + formatDecToHex(rgbObj.b);\n}", "rgbToHex (array) {\n var hexChars = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F'};\n var result = '';\n for (var i = 0; i < array.length; i++) {\n var d1 = parseInt(array[i] / 16);\n result += hexChars[d1];\n var d2 = array[i] - (d1 * 16);\n result += hexChars[d2];\n }\n return result;\n }", "function rgbToHex(r, g, b) {\n\t\t return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n\t\t}", "function hex2rgb(hex) {\n hex = (hex.substr(0,1)==\"#\") ? hex.substr(1) : hex;\n return 'rgb('+parseInt(hex.substr(0,2), 16) + ','+ parseInt(hex.substr(2,2), 16)+ ',' + parseInt(hex.substr(4,2), 16) + ')';\n }", "function rgbToHex(r, g, b) {\n return '#' + componentToHex(r) + componentToHex(g) + componentToHex(b)\n}", "function rgb2hex(r, g, b) {\n var hex = [\n r.toString( 16 ),\n g.toString( 16 ),\n b.toString( 16 )\n ];\n $.each( hex, function( nr, val ) {\n if ( val.length === 1 ) {\n hex[ nr ] = \"0\" + val;\n }\n });\n return hex.join( \"\" ).toUpperCase();\n }", "function rgbToHex(r, g, b) {\n return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n}", "function rgbToHex(rNum, gNum, bNum) {\n var r = rNum.toString(16);\n var g = gNum.toString(16);\n var b = bNum.toString(16);\n r = r.length < 2 ? '0' + r : r;\n g = g.length < 2 ? '0' + g : g;\n b = b.length < 2 ? '0' + b : b;\n return '#' + r + g + b;\n}", "function rgb2hex(rgba) {\n let sep = rgba.indexOf(\",\") > -1 ? \",\" : \" \";\n rgba = rgba.substr(rgba.indexOf(\"(\")+1).split(\")\")[0].split(sep);\n\n let r = (+rgba[0]).toString(16),\n g = (+rgba[1]).toString(16),\n b = (+rgba[2]).toString(16),\n a = rgba[3] * 255;\n\n if (r.length == 1) {\n r = \"0\" + r;\n } \n if (g.length == 1) {\n g = \"0\" + g;\n }\n if (b.length == 1) {\n b = \"0\" + b;\n }\n\n // rgb exception\n if (isNaN(a)) {\n a = \"\";\n } else {\n if (a == 0) {\n return \"transparent\";\n }\n a = Math.round(a).toString(16); // \" \" + a + \"%\";\n if (a.length == 1) {\n a = \"0\" + a;\n }\n }\n\n return \"#\" + r + g + b + a;\n}", "function hexFromRGB(r,g,b) {\r\n\treturn \"#\" + (b | (g << 8) | (r << 16)).toString(16);\r\n}", "function rgbToHex(r, g, b) {\n return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n}", "function rgbToHex(r, g, b) {\n return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n}", "function rgbToHex(r, g, b) {\n return \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\n}", "function rgbToHex(r, g, b) {\n return \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\n}", "function RGBAToHex({ red, green, blue, alpha }) {\n const r = red.toString(16).padStart(2, \"0\");\n const g = green.toString(16).padStart(2, \"0\");\n const b = blue.toString(16).padStart(2, \"0\");\n const a = alpha.toString(16).padStart(2, \"0\");\n return `#${r}${g}${b}${a === \"ff\" ? \"\" : a}`;\n}", "function rgbToHex(r, g, b) {\n var hex = \"#\" + convertToHex(r) + convertToHex(g) + convertToHex(b);\n return hex;\n}", "function rgbToHex(str) {\n\tcolour = [];\n\tstr.replace(/[a-z())]+/g, '')\n\t\t.split(',')\n\t\t.map(val => {\n\t\t\tlet value = Number(val).toString(16);\n\t\t\tvalue = value < 2 ? `0${value}` : value;\n\t\t\tcolour.push(value);\n\t\t});\n\treturn '#' + colour.join('');\n}", "function RGBtoHEXcolor(r, g, b) {\n var len = arguments.length\n\n if (len === 1 && typeof r === \"string\") {\n if (!isValidRGBcolor(r)) return console.error(\"Invalid rgb values\"), false\n var arr = r.split(\" \")\n if (arr.length !== 3) return false\n var r = parseInt(arr[0]).toString(16)\n var g = parseInt(arr[1]).toString(16)\n var b = parseInt(arr[2]).toString(16)\n return \"#\" +\n (r.length === 1 ? \"0\" + r : r) +\n (g.length === 1 ? \"0\" + g : g) +\n (b.length === 1 ? \"0\" + b : b)\n }\n else if (len === 3 && typeof r === \"number\")\n return \"#\" +\n (r.toString(16).length === 1 ? \"0\" + r.toString(16) : r.toString(16)) +\n (g.toString(16).length === 1 ? \"0\" + g.toString(16) : g.toString(16)) +\n (b.toString(16).length === 1 ? \"0\" + b.toString(16) : b.toString(16))\n else\n return console.error(\n \"Arguments need to be a string, or numbers in the format r, g, b\"\n )\n}", "function rgb2hex(colorArray) {\n var color = [];\n for (var i = 0; i < colorArray.length; i++) {\n var hex = colorArray[i].toString(16);\n if (hex.length < 2) { hex = \"0\" + hex; }\n color.push(hex);\n }\n return \"#\" + color.join(\"\");\n }", "function convertRgbToHexa() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(arguments[i].toString(16));\n }\n }\n return output;\n}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [(0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .FZ)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .FZ)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .FZ)(Math.round(b).toString(16))];\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}" ]
[ "0.88249797", "0.87684107", "0.8758326", "0.8742307", "0.86851597", "0.8684691", "0.8677611", "0.86772746", "0.8667237", "0.86553633", "0.8653287", "0.8653161", "0.86491597", "0.8642759", "0.8642759", "0.8640203", "0.86384666", "0.86151296", "0.86090267", "0.86090267", "0.86028916", "0.85988945", "0.8596931", "0.8593425", "0.8593425", "0.8589606", "0.85871184", "0.8576503", "0.85723895", "0.8568578", "0.8529247", "0.85224503", "0.85187733", "0.8516771", "0.8511997", "0.8505969", "0.8490051", "0.84421355", "0.843526", "0.843526", "0.8375187", "0.836895", "0.83537483", "0.83140326", "0.8304464", "0.8296584", "0.82706755", "0.8250653", "0.8246979", "0.8215501", "0.817665", "0.8169947", "0.8142406", "0.81320125", "0.8120913", "0.8117397", "0.8099748", "0.80912983", "0.80384135", "0.8035502", "0.7995709", "0.7966041", "0.79474497", "0.7869424", "0.7852038", "0.78233075", "0.7811047", "0.77740866", "0.7765368", "0.7757489", "0.7710543", "0.7691834", "0.7677559", "0.7610826", "0.76049536", "0.75770366", "0.75740474", "0.7571647", "0.7570016", "0.75697124", "0.7542376", "0.7537177", "0.7523972", "0.7498604", "0.74967486", "0.74808425", "0.7475605", "0.7460023", "0.7453315", "0.74456894", "0.74456894", "0.74421555", "0.74330723", "0.74182224", "0.7416995", "0.740454", "0.740094", "0.73847055", "0.7382012", "0.7354463" ]
0.8878183
0
e is the standard DOM event object
handleChange(e) { // e.currentTarget: DOM element we attached the event handler to // use the value property to read its current value this.setState({ input: e.currentTarget.value }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function xl_GetEvent(e) \n{\n\t// e gives access to the event in all browsers\n\tif (!e) var e = window.event; \n\t\n\treturn e; \n}", "function Utilities_GetEvent(e)\r\n{\r\n return e || window.event;\r\n}", "function xl_GetEventTarg(e) \n{\n\tvar EventObj; \n\tvar e = xl_GetEvent(e); \n\t\n\tif (e.target) EventObj = e.target;\n\telse if (e.srcElement) EventObj = e.srcElement;\n\t\n\treturn EventObj; \n}", "function nH(e){if (window.event){var e = window.event;var elm = e.srcElement;}else{var elm = e.target;};return elm}", "function mouseevent(e){\n\t// console.log(`Event Type = ${e.type}`);\n}", "_mouseEvent(eventType, e)\n\t{\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "_mouseEvent(eventType, e)\n\t{\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "_mouseEvent(eventType, e)\n\t{\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "_mouseEvent(eventType, e)\n\t{\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "_mouseEvent(eventType, e)\n\t{\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "function e(e) {\n return e && (\"function\" == typeof e.on || \"function\" == typeof e.addEventListener);\n }", "_evtClick(event) { }", "function listener(evt)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\talert ('in listener');\n\t\t\t\t\t\t\tvar typ = evt.type;\n\t\t\t\t\t\t\t//if (typ === 'DOMCharacterDataModified') {\n\t\t\t\t\t\t\tvar htmlValue = document.getElementById(\"idDivCEOmniBox\").innerHTML;\n\n\t\t\t\t\t\t\tvar logStr = 'event typ:' + typ \t\t + ' new htmlValue [' + htmlValue + ']';\n\t\t\t\t\t\t\tu_.U_o.liveLog(logStr);\n\t\t\t\t\t\t\t//console.log (logStr);\n\t\t\t\t\t\t\t//alert (logStr);\n\n\t\t\t\t\t\t\t//alert(evt);\n\t\t\t\t\t\t}", "function get_object_from_event(e) {\r\n\tvar event_obj;\r\n\tif (browser.isIE) {\r\n\t\tevent_obj = window.event.srcElement;\r\n\t} else {\r\n\t\tevent_obj = e.target;\r\n\t}\r\n\treturn event_obj;\r\n}", "function e(e) {\n return \"string\" == typeof e ? document.getElementById(e) : e;\n }", "function u(e) {\n return function(t, n) {\n var o = new r(e);\n l(o, n), S.isDOMComponent(t) ? S.simulateNativeEventOnDOMComponent(e, t, o) : t.tagName && // Will allow on actual dom nodes.\n S.simulateNativeEventOnNode(e, t, o);\n };\n }", "function getEvent(e){\n if(window.event != null) {\n return event;\n }\n return e;\n}", "function getEventTarget(e) {\n e = e || window.event;\n return e.target || e.srcElement;\n }", "function eObj(e) {\r\n return initXuaEvent(ie && e == null ? self.event : e);\r\n}", "function incomingEvent(e) {\n trace(\"incomingEvent: \" + JSON.stringify(e));\n}", "_evtChange(event) { }", "function $getEventType(e) {\r\n\t\treturn e.type;\r\n\t}", "function e(){}", "function getEventTarget(e) {\n\t\te = e || window.event;\n\t\treturn e.target || e.srcElement;\n\t}", "function holaMundo(){\n alert(\"Hola mundo\")\n console.log(event)\n }", "function d(e, t, n) {\n e.addEventListener ? e.addEventListener(t, n) : e.attachEvent(\"on\" + t, n);\n }", "function e(event) {\n event = event || window.event;\n event.target = event.target || event.srcElement;\n event.relatedTarget = event.relatedTarget || (event.type == 'mouseover' ? event.fromElement : event.toElement);\n event.target = event.target || event.srcElement;\n\n event.stop = function () {\n event.preventDefault ? event.preventDefault() : event.returnValue = false;\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n if (event.cancelBubble != null) {\n event.cancelBubble = true;\n }\n };\n\n if (event.target.nodeType === 3) {\n event.target = event.target.parentNode; //Safari bug\n }\n\n return event;\n }", "function MyEventHandler(e) {\n\n //console.log(e.currentTarget); // will return a node that matches the 'link' node\n // the reason this is useful is because you can use the event handler for any link and the currentTarget\n // would tell you which link was clicked.\n\talert(\"ouch!\");\n\te.preventDefault();\n}", "function handleEvent(event) {\n\n }", "function tag(e) {\n return e.tagName;\n}", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function InternalEvent() { }", "function e() {}", "function onEvent(e) {\r\n \r\n // console.log(e.type);\r\n // console.log(curEvent,preEvent);\r\n if (e.type === 'onload') {\r\n console.log(\"loadEventFound\")\r\n }\r\n\r\n if (e.constructor.name === 'PointerEvent' || e.type === 'selectstart' || e.type === 'selectionchange' || e.type === 'click'){\r\n return;\r\n }\r\n //console.log(e.constructor.name, e.type, \"captured\", e.target.constructor.name);\r\n //need better Logic, which works universally.//Output is not consistent.\r\n \r\n\r\n if(e.type==='mousedown'){\r\n mD = true;\r\n mM = false; \r\n }\r\n if (e.type === 'mousemove') {\r\n mM = true;\r\n // console.log(\"mouseMove\",mM)\r\n }\r\n if(e.type === 'mouseup'){\r\n mU =true; mD = false; mM = false; \r\n console.log(\"mouseUp\");\r\n }\r\n\r\n\r\n if(mD&&mM){\r\n createElement(e);\r\n console.log(\"mouseDown\",mD,\"mouseMove\",mM,\"clickNDraw\");\r\n }\r\n\r\n\r\n\r\n}", "function runEvent(e){\n\n console.log(`EVENT TYPE: ${e.type}`);\n\n //grabs the target from the event object, which happens to be the form, and logs the keys\n console.log(e.target.value);\n\n\n //Get input value\n // console.log(taskInput.value);\n\n //prevents the redirect (see id=\"task-form\", line 22 in index.html)\n e.preventDefault();\n}", "function returnEventElement(e) {\n var elm;\n\n if (!e) {\n e = window.event;\n }\n // W3C/Netscape\n if (e.target) {\n elm = e.target;\n // Microsoft use srcElement\n } else if (e.srcElement) {\n elm = e.srcElement;\n }\n\n if (elm.nodeType === 3) {\n elm = elm.parentNode;\n }\n\n return elm;\n }", "function getTarget(e){\n\te = e || window.event;\n\treturn e.target ||e.srcElement;\n}", "function $getEventSource(e) {\r\n\t\treturn e.srcElement || e.target;\r\n\t}", "function displayEventObject (e, prevent) {\n\n console.log('EVENT TYPE: *** ', e.type, ' ***');\n console.log(e);\n if (prevent) {\n e.preventDefault();\n }\n\n}", "function InternalEvent() {}", "function eventToObject(e) {\n\t\t// console.log(e.target.id);\n\t\t// console.log('eventToObject',e);\n\t\tif (\n\t\t\te.target &&\n e.target.tagName &&\n e.target.tagName.toLowerCase() === 'a'\n\t\t) {\n\t\t\te.preventDefault();\n\t\t}\n\t\tif (\n\t\t\te.currentTarget &&\n e.currentTarget.tagName &&\n e.currentTarget.tagName.toLowerCase() === 'a'\n\t\t) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\treturn {\n\t\t\taltKey: e.altKey,\n\t\t\tbubbles: e.bubbles,\n\t\t\tbutton: e.button,\n\t\t\tbuttons: e.buttons,\n\t\t\tkeyCode: e.keyCode || null,\n\t\t\tcancelBubble: e.cancelBubble,\n\t\t\tcancelable: e.cancelable,\n\t\t\tclientX: e.clientX,\n\t\t\tclientY: e.clientY,\n\t\t\tcomposed: e.composed,\n\t\t\tctrlKey: e.ctrlKey,\n\t\t\tcurrentTarget: e.currentTarget ? e.currentTarget.id : null,\n\t\t\trelatedTarget: e.relatedTarget ? e.relatedTarget.id : null,\n\t\t\tdefaultPrevented: e.defaultPrevented,\n\t\t\tdetail: e.detail,\n\t\t\teventPhase: e.eventPhase,\n\t\t\tfromElement: e.fromElement ? e.fromElement.id : null,\n\t\t\tisTrusted: e.isTrusted,\n\t\t\tlayerX: e.layerX,\n\t\t\tlayerY: e.layerY,\n\t\t\tmetaKey: e.metaKey,\n\t\t\tmovementX: e.movementX,\n\t\t\tmovementY: e.movementY,\n\t\t\toffsetX: e.offsetX,\n\t\t\toffsetY: e.offsetY,\n\t\t\tpageX: e.pageX,\n\t\t\tpageY: e.pageY,\n\t\t\treturnValue: e.returnValue,\n\t\t\tscreenX: e.screenX,\n\t\t\tscreenY: e.screenY,\n\t\t\tshiftKey: e.shiftKey,\n\t\t\tpath: [],\n\t\t\tregion: e.region || null,\n\t\t\tsrcElement: e.srcElement ? e.srcElement.id : null,\n\t\t\ttarget: e.target ? e.target.id : null,\n\t\t\ttype: e.type || undefined,\n\t\t\ttimeStamp: e.timeStamp,\n\t\t\ttoElement: e.toElement ? e.toElement.id : null,\n\t\t\twhich: e.which,\n\t\t\tx: e.x,\n\t\t\ty: e.y\n\t\t};\n\t}", "function initXuaEvent(e) {\r\n if (! e) return null;\r\n\r\n e.src = null;\r\n e.pos = null;\r\n e.btn = null;\r\n\r\n // Let e.src be the literal target of event e.\r\n if (ie) {\r\n e.src = e.srcElement;\r\n } else {\r\n // XXX Perhaps we should recursively look up the hierarchy for a parent\r\n // with nodeType 1.\r\n if (e.target.nodeType != 1) {\r\n e.src = e.target.parentNode;\r\n }\r\n e.src = e.target;\r\n }\r\n\r\n // Let e.pos be the position of the event on the x and y axes.\r\n e.pos = new Pos((ie ? e.clientX : e.pageX), (ie ? e.clientY : e.pageY));\r\n // Adjust MSIE event coordinates for scrolling.\r\n if (ie && e.pos != null) {\r\n e.pos.x += viewLeft();\r\n e.pos.y += viewTop();\r\n }\r\n\r\n // XXX By the time e makes it's way back to the caller, e.btn is effectively\r\n // useless. Neither Gecko-based browsers nor MSIE are able to intercept a\r\n // right-click event.\r\n\r\n // Let e.btn be the mouse button that triggered the event: 1 for left, 2 for\r\n // right and 3 for middle.\r\n if (ie) {\r\n if (e.button == 1 || e.button == 2) {\r\n e.btn = e.button;\r\n } else if (e.button == 3 || e.button == 5) {\r\n e.btn = 3;\r\n } else {\r\n e.btn = 1;\r\n }\r\n } else {\r\n if (e.button == 0) {\r\n e.btn = 1;\r\n } else if (e.button == 1) {\r\n e.btn = 3;\r\n } else if (e.button == 2) {\r\n e.btn = 2;\r\n } else {\r\n e.btn = 1;\r\n }\r\n }\r\n\r\n e.stp = function () {\r\n if (ie) {\r\n this.cancelBubble = true;\r\n this.returnValue = false;\r\n } else {\r\n this.stopPropagation();\r\n this.preventDefault();\r\n }\r\n };\r\n\r\n return e;\r\n}", "function getEventSourceElement(anE)\r\n{\r\n\tif((anE==null)||(anE==undefined))anE = window.event;\r\n\tif (anE.target) \r\n\t{\r\n\t\treturn anE.target; //-- moz\r\n\t}\r\n\telse if (anE.srcElement) \r\n\t{\r\n\t\treturn anE.srcElement; //-- ie\r\n\t}\r\n\treturn null;\r\n}", "function eventReporter(e) {\n if (e.type !== \"keypress\") e.preventDefault();\n var display = ''; // Text to display in event box.\n display += (\"<li>Event type: <code>\" + e.type + \"</code></li>\");\n var target_box = ($(e.target).attr('id') ? $(e.target).attr('id') : $(e.target).parent().attr('id'));\n display += (\"<li>Target box: <code>\" + target_box + \"</code></li>\");\n $(\"#event-box-content\").html(display);\n}", "function e() {\n}", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tdocument.body.style.cursor = 'pointer';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tdocument.body.style.cursor = 'default';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.CLICK:\n\t\t\t\tthis.SwitchState();\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tdocument.body.style.cursor = 'pointer';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tdocument.body.style.cursor = 'default';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.CLICK:\n\t\t\t\tthis.SwitchState();\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "function XT(e){return e}", "function T(e,t,n){Q.reference.addEventListener(e,t),n.push({eventType:e,handler:t})}", "get e() {\n\t\treturn this._htmlElement;\n\t}", "get e() {\n\t\treturn this._htmlElement;\n\t}", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.CLICK:\n\t\t\t\tthis.hasFocus = true;\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tthis.isMouseOver = true;\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tthis.isMouseOver = false;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif(typeof this.mouseEvents[eventType] !== 'undefined' &&\n\t\t typeof this.mouseEvents[eventType] !== null)\n\t\t{\n\t\t\tthis.mouseEvents[eventType](e);\n\t\t}\n\t}", "function e_by_gum(eventobj)\n{\n\tif (!eventobj || is_ie)\n\t{\n\t\twindow.event.cancelBubble = true;\n\t\treturn window.event;\n\t}\n\telse\n\t{\n\t\tif (eventobj.target.type == 'submit')\n\t\t{\n\t\t\t// naughty safari\n\t\t\teventobj.target.form.submit();\n\t\t}\n\t\teventobj.stopPropagation();\n\t\treturn eventobj;\n\t}\n}", "function r(e) {\n return e;\n }", "function domHandler(e) {\n e = e || env.root.event;\n var wrapped = wrapDomEvent(e);\n var normalized = normalize(wrapped);\n evt.trigger(this, normalized);\n evt.destroyEvent(wrapped);\n evt.destroyEvent(normalized);\n}", "triggerEvent(e){\n\t\tthis.emit(e.type, e);\n\t}", "function getClick(e) {\n e = e || window.event;\n return e.target || e.srcElement;\n}", "element(e) {\n return e.target || e.srcElement;\n }", "function onevent(args) {\n console.log(\"Event:\", args[0]);\n }", "function handleEvent(e)\n {\n var elem = e.currentTarget,\n $elem = $(elem);\n\n // It's a button, and not inside a form[data-f-ajaxify], do nothing\n if ($elem.is(\"[type=submit]\") && !$elem.closest(\"form[data-f-ajaxify]\")[0]){\n return;\n }\n\n // If event is a mouseenter, but there is not hover directive, do nothing\n if (e.type == \"mouseenter\" && !$elem.attr(\"data-f-hover\")){\n return;\n }\n\n // Get the instructions\n var ajaxify = $elem.attr(\"data-f-ajaxify\") || null,\n href = $elem.attr(\"data-f-href\") || $elem.attr(\"href\") || $elem.attr(\"action\"),\n loading = $elem.attr(\"data-f-loading\") || null,\n uniq = $elem.attr(\"data-f-uniq\") || null,\n confirm = $elem.attr(\"data-f-confirm\") || null,\n stop = $elem.attr(\"data-f-stop\") || null,\n toggle = $elem.attr(\"data-f-toggle\") || null,\n $form = null,\n method = $elem.attr(\"data-f-method\") || null,\n e_type = e.type;\n\n // A submit button/input has been clicked ? Let's find the relative form\n if ($elem.is(\"[type=submit]\")) {\n $form = $elem.closest(\"form[data-f-ajaxify]\");\n href = href || $form.attr(\"action\");\n ajaxify = $form.attr(\"data-f-ajaxify\");\n confirm = confirm || $elem.attr(\"data-f-confirm\");\n }\n\n // No action url provided ? Do nothing\n if (!href) {\n return;\n }\n\n // The main command is 0 ? Stop event propagation and stop there,\n // to let the time to the previous action to finish\n // (to prevent multiple clics)\n if (ajaxify === \"0\") {\n e.preventDefault();\n return;\n }\n\n // This button shouldn't do anything ?\n if (stop) {\n e.preventDefault();\n return;\n }\n\n // Is there a confirm message to be displayed before sending the action ?\n if (confirm && !window.confirm(confirm)) {\n e.preventDefault();\n return;\n }\n\n // Clone the clicked button as a hidden field, so the server knows\n // which one was clicked\n if ($elem.is(\"[type=submit]\")) {\n $form.append(\n $('<input type=\"hidden\" class=\"js-injected\"/>').attr({\n name: $elem.attr(\"name\") || '',\n value: $elem.val() || ''\n })\n );\n\n showActivity($elem[0]);\n return;\n }\n\n // Forms actions should be posts. YES THEY SHOULD :p\n if ($elem.is(\"form\")){\n method = \"post\";\n }\n else{\n method = method || \"get\";\n }\n\n // Show activity (loading state...) (to be configured by user)\n showActivity(elem, loading);\n\n // Set the state to 0, so the action won't be executed twice\n $elem.attr(\"data-f-ajaxify\", \"0\");\n\n var data;\n // Retrieve data to be sent to the server\n if ($elem.is(\"form\")){\n data = $elem.serializeArray();\n data.push({name:\"__ajax__\", value: 1});\n }\n else {\n data = {__ajax__: 1};\n }\n\n // Ajax call settings\n var ajax_settings = {\n url: href,\n type: method,\n data: data,\n xhrFields: {\n withCredentials: true\n }\n };\n\n\n var callback_common = function(response){\n if ($elem.is(\"form\") && toggle && response.success) {\n var $ori = $elem.find(\".js-loading\");\n $elem.find(\"[type=submit]\").attr(\"data-f-stop\", \"\")\n .filter(\".js-loading\").attr(\"data-f-stop\", \"1\");\n }\n };\n\n // Callback when the call was successful\n var callback_done = function(response) {\n handleResponse(response, $elem);\n callback_common(response);\n };\n\n // Callback when the call has server error\n var callback_fail = function(jqXHR) {\n var response = jqXHR.responseJSON;\n handleResponse(response, $elem);\n callback_common(response);\n };\n\n // Callback in any case, success or error\n var callback_always = function(){\n $elem.attr(\"data-f-ajaxify\", uniq ? null : \"1\");\n $elem.is(\"form\") && $elem.find(\".js-injected\").remove();\n hideActivity(elem);\n e_type == \"mouseenter\" && $elem.trigger(\"mouseenter\");\n };\n\n // Do we have a user custom function to call before ajax ?\n settings.onBeforeAjax\n ? settings.onBeforeAjax(ajax_settings, callback_done, callback_always)\n : $.ajax(ajax_settings).done(callback_done).fail(callback_fail).always(callback_always)\n ;\n\n // Finaly, cancel default form submit, so frontal can handle it\n e.preventDefault();\n }", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tdocument.body.style.cursor = 'pointer';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tdocument.body.style.cursor = 'default';\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "function GetElementClicked(e)\n{\n var targ;\n\tif (!e) var e = window.event\n\tif (e.target) targ = e.target\n\telse if (e.srcElement) targ = e.srcElement\t\n\n\treturn targ;\n}", "function handler(e)\t{\r\n\tif (isIE) {\r\n\t\te=window.event;\r\n\t\tif(e.keyCode && e.keyCode == 13) { noPop=1; }\r\n\t\tif(e.type== \"click\" ||\te.type== \"dblclick\") { noPop=1; }\r\n\t\tif(e.type== \"unload\") {\r\n\t\t\tif((e.clientX >\t0 && e.clientX < 120) && e.clientY < 0 ) {\tnoPop=1; }\r\n\t\t\tgoPop();\r\n\t\t}\r\n\t\te.cancelBubble=true;\r\n\t}\r\n}", "updated(e){}", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tdocument.body.style.cursor = 'text';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tdocument.body.style.cursor = 'default';\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "function runevent(e){\n\t// console.log(\"i am working\");\n\t// console.log(e.type);\n\t// console.log(text.value);\n\te.preventDefault();\n}", "function onClick(e) {\n }", "function runEvent(e){\n //e.preventDefault();\n console.log(`Event Type: ${e.key} `);\n heading.innerText = e.target.value;\n}", "function eventProxy(e)\n{\n\tsink.handleEvent(e);\n}", "get event () {\n\t\treturn this._event;\n\t}", "function onevent(args) {\n console.log(\"Event:\", args[0]);\n }", "function DocumentEvent()\n\t{\n\t\tthrow new Error(\"Illegal operation: do not instantiate DocumentEvent, simply use its static constants.\");\n\t}", "function onClick(e) {\n \t\t// console.log(this);\n\t\t}", "function get_event_target(e)\n{\n if(window.event)\n e=window.event;\n\n if(e.srcElement) // mozilla\n target = e.srcElement;\n else if(e.target) // IE\n target = e.target;\n\n return target;\n}", "handleEvent(event) {\n switch (event.type) {\n case 'click':\n this._evtClick(event);\n break;\n case 'focus':\n this._evtFocus(event);\n break;\n default:\n break;\n }\n }", "function do_an_e(eventobj)\n{\n\tif (!eventobj || is_ie)\n\t{\n\t\twindow.event.returnValue = false;\n\t\twindow.event.cancelBubble = true;\n\t\treturn window.event;\n\t}\n\telse\n\t{\n\t\teventobj.stopPropagation();\n\t\teventobj.preventDefault();\n\t\treturn eventobj;\n\t}\n}", "function eventTrigger (e) {\n\tif (! e)\n\t\te = event;\n\treturn e.target || e.srcElement;\n}", "function runEvent(e){\n console.log(`EVENT TYPE: ${e.type}`);\n\n //console.log(e.target.value);\n\n // heading.innerText = e.target.value;\n\n // Get input value\n // console.log(taskInput.value);\n\n // e.preventDefault();\n}", "fun(e){\n alert(\"We're about to get White Castle\");\n }", "function keyEventsIE() {\n\te = event;\n\te.which = e.keyCode;\n\tkeyEvents(e);\n}", "function o(e) {\n var t = e.nodeName && e.nodeName.toLowerCase();\n return \"select\" === t || \"input\" === t && \"file\" === e.type;\n }", "function catchevent(event) {\n\talert(event.srcElement);\n\teventSrcID=(event.srcElement)?event.srcElement.id:'undefined';\n\teventtype=event.type;\n\tstatus=eventSrcID+' has received a '+eventtype+' event.';\n\talert(status);\n\twindow.status = status;\n\treturn true;\n}", "function runevent2(e){\n\tconsole.log(`Event Type = ${e.type}`);\n\n\t// get input value \n\tconsole.log(taskinput.value);\n\t// e.preventDefault();\n}", "function getSrcElement(e) {\r\n\tvar tgt = e.target;\r\n\twhile (tgt.nodeType != 1) { tgt = tgt.parentNode; }\r\n\treturn tgt;\r\n\t}", "function getSrcElement(e) {\n var tgt = e.target;\n while (tgt.nodeType != 1) { tgt = tgt.parentNode; }\n return tgt;\n}", "function eventFunction(e){\n\t getSlot([q.id], allEvents).push(e);\n\t eventDurForeach(e, drawfn);\n\t}", "function hello(e){\n\t\t\tconsole.log(e);\n\t\t\t}", "eventListenerIn(e) {\n const scene = this.scenes[this.currentSceneIndex];\n if (scene) {\n // process ui object events primarily\n const processed = scene.uiObjects.reduce((acc, uiObject) => {return acc || uiObject.eventListener(this, scene, e)}, false);\n if (!processed) {\n scene.eventListener(this, scene, e);\n }\n }\n if (e.type !== this.EVENT_TYPE_MOUSEDOWN) {\n // when mousedown event occurred it needs a system's default process to get focus\n e.preventDefault()\n }\n }", "function processForm (e) {\n\n var curMenuItem = document.querySelector('.explore-form-menu-item.active'),\n eventType = e.type;\n\n switch (e.type) {\n case 'change':\n case 'keydown':\n case 'keyup':\n case 'focus':\n case 'blur':\n case 'reset':\n if (curMenuItem.classList.contains(eventType)) {\n displayEventObject(e, false);\n }\n break;\n case 'submit':\n if (curMenuItem.classList.contains(eventType)) {\n displayEventObject(e, true);\n } else {\n e.preventDefault();\n }\n break;\n }\n}", "function l(e){\n console.log(e);\n }", "function testclick(e) {\n\talert('Clicked ' + '\\'' + e.source.id + '\\'');\n}", "handleEvent(event) {\n switch (event.type) {\n case 'change':\n this._evtChange(event);\n break;\n case 'click':\n this._evtClick(event);\n break;\n case 'dblclick':\n this._evtDblClick(event);\n break;\n default:\n break;\n }\n }", "function getEvent(e) {\r\n return e.originalEvent.touches !== undefined ? e.originalEvent.touches[0] : e.originalEvent;\r\n }", "function checkEventElementValidity(e) {\n var elm = returnEventElement(e);\n customCheckValidity(elm);\n }", "function newEvent(e)\r\n{\r\n var evt = (e || window.event);\r\n\tifrm = document.body.getElementsByTagName('iframe');\r\n\tif(ifrm.length) \r\n\t\tfor(i=0; i < ifrm.length; i++)\r\n\t\t\tif(ifrm[i]) hideIfNotClicked(evt,ifrm[i]);\r\n}", "get event() {\n\t\treturn this.__event;\n\t}", "get event() {\n\t\treturn this.__event;\n\t}", "get event() {\n\t\treturn this.__event;\n\t}" ]
[ "0.71195644", "0.70377535", "0.6960898", "0.6918632", "0.69156265", "0.6858194", "0.6858194", "0.6858194", "0.6858194", "0.6858194", "0.6820185", "0.6717468", "0.6697286", "0.66541004", "0.6647255", "0.66437334", "0.6634303", "0.661451", "0.6608323", "0.6603127", "0.65511066", "0.65355635", "0.65258336", "0.6521859", "0.644444", "0.64444375", "0.6428643", "0.64170605", "0.6390697", "0.63703674", "0.63392776", "0.63392776", "0.63392776", "0.63392776", "0.63392776", "0.6330498", "0.63117504", "0.6307401", "0.6296753", "0.62930626", "0.624668", "0.6234651", "0.6226361", "0.6205421", "0.6203873", "0.62038", "0.6192325", "0.61887777", "0.61829174", "0.61829174", "0.61786556", "0.61664736", "0.61550826", "0.61550826", "0.6140845", "0.6138695", "0.6136004", "0.6129193", "0.61214805", "0.6111602", "0.6098519", "0.6097094", "0.6096707", "0.6092899", "0.6077555", "0.60639185", "0.60601425", "0.6046593", "0.60451883", "0.60440916", "0.604341", "0.60398644", "0.6027016", "0.6014645", "0.60137445", "0.6013566", "0.60118335", "0.6006109", "0.5999498", "0.59940565", "0.5993898", "0.5992593", "0.5992572", "0.5990327", "0.5980681", "0.5978575", "0.59688425", "0.5965164", "0.5958531", "0.59576887", "0.5949254", "0.5932859", "0.5928962", "0.5915523", "0.59145373", "0.5901574", "0.5899986", "0.58988047", "0.5894887", "0.5894887", "0.5894887" ]
0.0
-1
has finished loading in the browser.
function showTheChat(chat, sec) { setTimeout(function () { chat.style.display = "block"; }, sec); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDone() {\n return true;\n }", "function loadComplete() {\n\thasLoaded = true;\n}", "function pageFullyLoaded () {}", "function finishedLoad() {\n console.log('finishedLoad()');\n if (externalIsLoaded()) {\n init();\n }\n }", "function onLoadComplete()\n {\n this.loaded = true;\n }", "function isPageLoaded() {\n lp ++;\n\n /*if (typeof evt == 'object') {\n src = evt.target.src;\n var pl = src.lastIndexOf('/');\n src = src.substr(pl + 1);\n }else src = evt;\n\n get('say').innerHTML += src + ', ' + lp + '<br />';*/\n if (lp == np + nd) {\n\n removeElement('divLoading');\n removeElement('shadow');\n }\n }", "function $w_completed() {\r\n\tconsole.log(\"$w_completed\");\r\n\tif ($d.addEventListener || event.type === \"load\" || $d.readyState === \"complete\" ) {\r\n\t\t$w_detach();\r\n\t\tif(!Whaty.isReady){\r\n\t\t\tconsole.log(\"Whaty.isReady---:\"+Whaty.isReady);\r\n\t\t\tWhaty.isReady = true;\r\n\t\t\t$w_init();\r\n\t\t}\r\n\t}\r\n}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener || window.event.type === \"load\" || document.readyState === \"complete\") {\n detach();\n jQuery.ready();\n }\n }", "loadComplete() {\n // Nothing\n }", "function completed() {\n\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener ||\n window.event.type === \"load\" ||\n document.readyState === \"complete\") {\n\n detach();\n jQuery.ready();\n }\n }", "function completed() {\n\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener ||\n window.event.type === \"load\" ||\n document.readyState === \"complete\") {\n\n detach();\n jQuery.ready();\n }\n }", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n detach();\n jQuery.ready();\n }\n }", "function completed() {\n\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener ||\n window.event.type === \"load\" ||\n document.readyState === \"complete\" ) {\n\n detach();\n jQuery.ready();\n }\n }", "function notifyEndOfLoadingRequest() {\n\tloadingRequests--;\n\tcheckLoading();\n\treturn true;\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "function loadComplete() {\n if (++docsLoaded == 1) {\n setUpPageStatus = 'complete';\n }\n}", "IsFinishedRendering() {}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if (document.addEventListener || event.type === \"load\" || document.readyState === \"complete\") {\n detach();\n jQuery.ready();\n }\n }", "function completed( event ) {\n\t // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\t if ( w3c || event.type === LOAD || doc[READYSTATE] === COMPLETE ) {\n\t detach();\n\t ready();\n\t }\n\t }", "function isLoaded() {\n\treturn LOADED;\n}", "function pageLoaded() {\t\t\t\n\t\twriteToConsole(\"Page Loaded\");\n\t}", "function completed() {\r\n\r\n\t\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\r\n\t\tif (document.addEventListener ||\r\n\t\t\twindow.event.type === \"load\" ||\r\n\t\t\tdocument.readyState === \"complete\") {\r\n\r\n\t\t\tdetach();\r\n\t\t\tjQuery.ready();\r\n\t\t}\r\n\t}", "function _complete() {\n\t if (!_iscomplete) {\n\t _iscomplete = true;\n\t _status = scriptloader.loaderstatus.COMPLETE;\n\t _this.trigger(events.COMPLETE);\n\t }\n\t }", "function _complete() {\n\t\t\tif (_errorState) {\n\t\t\t\t_eventDispatcher.sendEvent(events.ERROR, {message: _errorMessage});\n\t\t\t} else if (!_iscomplete) {\n\t\t\t\t_iscomplete = true;\n\t\t\t\t_status = utils.loaderstatus.COMPLETE;\n\t\t\t\t_eventDispatcher.sendEvent(events.COMPLETE);\n\t\t\t}\n\t\t}", "function readyStateHandler() {\n if (isEqualIgnoreCase(\"loaded\", element.readyState) ||\n isEqualIgnoreCase(\"complete\", element.readyState)) {\n callback({type: \"load\"});\n }\n }", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n detach();\n jQuery.ready();\n }\n}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n detach();\n jQuery.ready();\n }\n}", "pageReady() {}", "loaded() {\n this.searchField.waitForVisible();\n return true;\n }", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener ||\n\t\twindow.event.type === \"load\" ||\n\t\tdocument.readyState === \"complete\" ) {\n\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\t\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\t\tdetach();\n\t\t\tjQuery.ready();\n\t\t}\n\t}", "function completed() {\n\t\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\t\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\t\tdetach();\n\t\t\tjQuery.ready();\n\t\t}\n\t}", "_loadingComplete() {\n this._loaded = true;\n this._registry.off(\"load\", this._onLoad, this);\n this._registry.off(\"error\", this._onError, this);\n\n if (this._failed && this._failed.length) {\n if (this._callback) {\n this._callback.call(this._scope, \"Failed to load some assets\", this._failed);\n }\n this.fire(\"error\", this._failed);\n } else {\n if (this._callback) {\n this._callback.call(this._scope);\n }\n this.fire(\"load\", this._assets);\n }\n }", "function completed() {\n\n\t\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\t\tif (document.addEventListener || window.event.type === \"load\" || document.readyState === \"complete\") {\n\n\t\t\tdetach();\n\t\t\tjQuery.ready();\n\t\t}\n\t}", "function completed() {\n // readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n if ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n detach();\n jQuery.ready();\n }\n}", "function loadComplete() {\n cnt--;\n if (!cnt) {\n execComplete();\n }\n }", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}", "function completed() {\n\t// readyState === \"complete\" is good enough for us to call the dom ready in oldIE\n\tif ( document.addEventListener || event.type === \"load\" || document.readyState === \"complete\" ) {\n\t\tdetach();\n\t\tjQuery.ready();\n\t}\n}" ]
[ "0.75903344", "0.73198736", "0.7153369", "0.70527005", "0.6929781", "0.6825354", "0.6823386", "0.66756654", "0.6654849", "0.66131467", "0.66131467", "0.66110796", "0.66009635", "0.65965", "0.65844256", "0.65844256", "0.65844256", "0.65844256", "0.6570404", "0.6567171", "0.6557365", "0.6514834", "0.65138286", "0.6507935", "0.6475102", "0.645117", "0.6436539", "0.643487", "0.643487", "0.64109015", "0.64098865", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6406449", "0.6405576", "0.6405576", "0.6404399", "0.63955003", "0.6372445", "0.63509613", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594", "0.63464594" ]
0.0
-1
play 5 round game
function game(win){ for (let i = 0; i < 5; i++){ let win = playRound(); switch (win){ case 1: playerScore++; break; case 2: computerScore++; break; case 3: draws++; break; } //alert(`win ${win} playerScore ${playerScore} computerscore ${computerScore} round ${i}`) } //add disable play button and reset button if(computerScore > playerScore){ alert(`Oh no! you lost ${computerScore} to ${playerScore}. ${draws} draws.`); }else if (playerScore > computerScore){ alert(`Well done! you won ${playerScore} to ${computerScore}. ${draws} draws.`); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function game(){\n\twhile(rounds<5){\n\t\tconst playerSelection = playerPLay();\n\t\tconst computerSelection = computerPlay();\n\t\tconsole.log(playRound(playerSelection, computerSelection));\n\t\tconsole.log(\"Scoreboard: Won: \" + won + \" Lost: \" + lost + \" Drawn: \" + drawn );\n\t\trounds++;\n\t}\n\n}", "function game() {\n for (let round = 1; round <= 5; round++) {\n //playerSelection = humanPlay();\n computerSelection = computerPlay();\n let oneRoundGame = playRound(playerSelection, computerSelection);\n console.log(`round # ${round}: Human = ${playerSelection} & AI = ${computerSelection} | ${oneRoundGame} |`);\n }\n}", "function game()\n{\n // Creates a numberOfRounds variable that is used to specify how many rounds of the game should be played\n let numberOfRounds = 5;\n\n for (let i = 1; i <= numberOfRounds; i++)\n {\n playRound();\n }\n}", "function game() {\n // Create a loop that will play rock, paper, scissors for 5 rounds\n for (let i = 0; i < 5; i++) {\n // Console.log the results of the game\n let player = player_selection();\n let computer = computerPlay();\n console.log(singleRound(player, computer));\n }\n }", "function game() {\n\tlet playerWin = 0;\n\tlet computerWin = 0;\n\tlet playCount = 0;\n\n\tfor (i = 0; i < 5; i++) {\n\t\tplayerMove = playerPlay();\n\t\tcomputerMove = computerPlay();\n\t\troundResult = playRound(playerChoice, computerChoice);\n\n\t\tif (roundResult === \"win\") {\n\t\t\tplayerWin++;\n\t\t\tplayCount++;\n\t\t\tconsole.log(\n\t\t\t\t`You win! ${playerMove} beats ${computerMove} in Round ${playCount}`\n\t\t\t);\n\t\t} else if (roundResult === \"lose\") {\n\t\t\tcomputerWin++;\n\t\t\tplayCount++;\n\t\t\tconsole.log(`You lose! ${computerMove} beats ${playerMove}`);\n\t\t} else if (roundResult === \"draw\") {\n\t\t\tplayCount++;\n\t\t\tconsole.log(`It\\'s a draw!`);\n\t\t} else {\n\t\t\tconsole.log(`Invaild!`);\n\t\t}\n\t\tplayerPlay();\n\t\tcomputerPlay();\n\t}\n\tconsole.log(\"---Results----\");\n\tif (playerWin > computerWin) {\n\t\tconsole.log(`Player won ${playerWin} rounds, Player wins!`);\n\t} else if (playerWin < computerWin) {\n\t\tconsole.log(`Computer won ${computerWin} rounds, Computer wins!`);\n\t} else {\n\t\tconsole.log(\n\t\t\t`${playCount} rounds were played, Player won ${playerWin} rounds, Computer won ${computerWin} rounds, it was a draw!`\n\t\t);\n\t}\n}", "function game()\n {\n \tlet playerScore = 0;\n \tlet computerScore = 0;\n \tlet ties = 0;\n \tconst MAX_ROUNDS = 5;\n\n \tfor(let i = 0; i < MAX_ROUNDS; i++)\n \t{\n \t\tif(!(playerScore === 3 || computerScore === 3))\n \t\t{\n \t\t\tlet outcome = playRound();\n\n\t \t\tif(outcome === \"win\")\n\t \t\t{\n\t \t\t\tplayerScore++;\n\t \t\t}\n\t \t\telse if(outcome === \"lose\")\n\t \t\t{\n\t \t\t\tcomputerScore++;\n\t \t\t}\n\t \t\telse\n\t \t\t{\n\t \t\t\tties++;\n\t \t\t}\n\n\t \t\tgetCurrentScore(playerScore, computerScore, ties);\n\t \t}\n \t}\n\n \tgetOutcome(playerScore, computerScore, ties);\n }", "function game() {\n round = 0;\n while (round < 5) {\n playerSelection = prompt('Enter rock, paper, or scissors.');\n computerSelection = computerPlay();\n console.log(playRound(playerSelection,computerSelection));\n round++;\n }\n \n if (w > l) {\n return 'You Win the Game!';\n } else if (w < l) {\n return 'You Lose the Game!';\n } else {\n return 'It\\'s a draw!';\n }\n }", "function game() {\n for (let i = 0; i < 5; i++) {\n console.log(playRound(prompt('Enter your choice!'), computerPlay()));\n }\n}", "function playToFive() {\n\t//console.log(\"Let's play Rock Paper Scissors\");\n \tplayerRunningTotal = 0; //start each total with zero\n \tcomputerRunningTotal = 0; //start each total with zero\n\t\n while (playerRunningTotal < 5 && computerRunningTotal < 5) {\n\t\t \n userChoice = getPlayerMove(); //calls getPlayerMove function\n \tcomputerChoice = getComputerMove(); //calls getComputerMove function\n \twinner = getWinner(userChoice, computerChoice); //calls getWinner function with the arguments 'userChoice' which is the variable for the function getPlayerMove() and 'computerChoice' which is the variable for the function computerChoice()\n\t\t\t\n if (winner === \"player\") { //if the player is the winner then total increases by one until five is reached\n \tplayerRunningTotal++;\n \t} else if (winner === \"computer\") { //if computer is the winner then total increases by one until five is reached\n \tcomputerRunningTotal++;\n \t}\n \n\talert(\"Player chose \" + userChoice + \" while Computer chose \" + computerChoice + \"! \\nThe score is Player \"+ playerRunningTotal + \", Computer \" + computerRunningTotal + \".\"); //alert is displayed after each round\n }\n}", "function Game() {\n rounds = parseInt(prompt(\"How many rounds would you like to play?\"))\n\n for (i = 0; i < rounds; i++) {\n console.log(playRound(playerSelection, computerSelection));\n }\n\n }", "function game () {\n /* Function to play the game over 5 rounds */\n let roundResult;\n let round = 0;\n let wins = 0;\n let losses = 0;\n let draws = 0;\n /* Create a while loop that plays 5 rounds */\n while (round < 5) {\n /* Ask the user to enter a choice */\n let userSelection = prompt (\"Enter rock, paper or scissors\");\n /* Now call computerPlay to get the computers selection */\n let computerSelection = computerPlay ();\n /* Call the function playRound that compares what the user entered to the computers choice and returns error, draw, win or lose */\n roundResult = playRound (userSelection, computerSelection);\n /* Check what result of the round was */\n if (roundResult === \"error\") {\n /* User didn't select rock paper or scissors so thats an error, play the round again */\n alert (\"please enter rock, paper or scissors\");\n }\n /* Otherwise depending on the result, increment the appropriate counter and the round count and show a message */\n else if (roundResult === \"draw\") {\n draws++;\n round++;\n alert (\"The round was a draw. The score is player: \" + wins + \" computer: \" + losses + \" draws: \" + draws);\n }\n else if (roundResult === \"win\") {\n wins++;\n round++;\n alert (\"You win. The score is player: \" + wins + \" computer: \" + losses + \" draws: \" + draws);\n }\n else if (roundResult === \"lose\") {\n losses++;\n round++;\n alert (\"You lose. The score is player: \" + wins + \" computer: \" + losses + \" draws: \" + draws);\n }\n\n }\n}", "function game() {\n let playerPoints = 0;\n let computerPoints = 0;\n\n for (let i = 0; i < 5; i++) {\n let result = playRound(userPlay(), computerPlay());\n\n // display the value returned on who won\n console.log(result);\n\n // tally up the points\n if (result.slice(0, 6) === 'Player') {\n playerPoints++;\n } else if (result.slice(0, 8) === 'Computer') {\n computerPoints++;\n }\n }\n // choose the final winner based on who won the most rounds (or tie if they have the same wins)\n if (playerPoints > computerPoints) {\n return 'Player has won the game!';\n } else if (playerPoints < computerPoints) {\n return 'Computer has won the game!';\n } else {\n return 'Tie game!';\n }\n}", "function game(){\n playerScore = 0;\n computerScore = 0;\n for (let i = 0; i < 5; i++){\n playRound();\n }\n if (playerScore > computerScore){\n console.log(`You won the game! Player Score: ${playerScore}, Computer Score: ${computerScore}.`) \n } else if (playerScore < computerScore) {\n console.log(`You lost the game! Player Score: ${playerScore}, Computer Score: ${computerScore}.`);\n } else if (playerScore === computerScore){\n console.log(`It was a draw! Nobody wins!`)\n }\n}", "function nextRound() {\n if (GAME.currentRound == GAME.roundToWin) {\n userWin();\n nextSample();\n setTimeout(playSample, 6000);\n setTimeout(function(){updateDisplay(GAME.currentRound);}, 6500);\n GAME.currentRound++;\n } else {\n nextSample();\n playSample();\n updateDisplay(GAME.currentRound);\n GAME.currentRound++;\n }\n}", "function game(playerSelection){\n let matchOutcome;\n roundNum++;//new round\n matchOutcome=playRound(playerSelection, computerPlay());\n if(matchOutcome==1){\n playerScore++;\n playerScoreDiv.textContent=`${playerScore}`;\n }\n else if(matchOutcome==-1){\n computerScore++;\n pcScoreDiv.textContent=`${computerScore}`;\n }\n else if(matchOutcome==404){\n resultText.textContent=\"invalid selection\";\n roundNum--; //go again\n }\n if(roundNum>=5){\n if(computerScore>playerScore){\n resultText.textContent=\"You lose!\";\n }\n else if(playerScore>computerScore){\n resultText.textContent=\"You win!\";\n \n }\n else{\n resultText.textContent=\"It's a tie!\";\n }\n roundNum=0;\n computerScore=0;\n playerScore=0;\n playerScoreDiv.textContent=`${playerScore}`;\n pcScoreDiv.textContent=`${computerScore}`;\n }\n roundDiv.textContent=`Round: ${roundNum}`;\n}", "function playGame() {\n\t$('.box').click(function() {\n\t\tvar clickId = \"#\" + this.id;\n\t\tconsole.log(clickId);\n\t\tif(clickId === usedSequence[clickIndex]) {\n\t\t\tclickIndex += 1;\n\t\t\tif(clickIndex == usedSequence.length) {\n\t\t\t\tclickIndex = 0;\n\t\t\t\tround++;\n\t\t\t\t$('#round').html('Round: ' + round);\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tstartSequence();\n\t\t\t\t}, 1500);\n\t\t\t}\n\t\t} else {\n\t\t\tlocation.reload(); // when matches are not made alert and reload page to start new game\n\t\t\talert('Game Over!');\n\t\t}\n\t});\n}", "function game() {\n const textBox = document.getElementById(\"instructions\");\n textBox.textContent = \"Pick one of the above to play a round!\"\n getUserThrow();\n /* playRound(getUserThrow(),randomThrow());\n playRound(getUserThrow(),randomThrow());\n playRound(getUserThrow(),randomThrow());\n playRound(getUserThrow(),randomThrow());\n playRound(getUserThrow(),randomThrow());\n if (score >= 3) {\n alert(\"You just won the game!!!!!! (P.S. You lost the game at the same time...)\");\n }\n else {\n alert(\"You just lost the game. Metaphorically. Also, you lost the game literally.\")\n }*/\n\n }", "function playRound(playerSelection, computerSelection) {\n let win =\n (playerSelection === \"Rock\" && computerSelection === \"Scissors\") ||\n (playerSelection === \"Paper\" && computerSelection === \"Rock\") ||\n (playerSelection === \"Scissors\" && computerSelection === \"Paper\");\n let lose =\n (playerSelection === \"Paper\" && computerSelection === \"Scissors\") ||\n (playerSelection === \"Scissors\" && computerSelection === \"Rock\") ||\n (playerSelection === \"Rock\" && computerSelection === \"Paper\");\n\n while (playerScore < 5 && computerScore < 5) {\n if (win) {\n playerScore++;\n // console.log(\"Player Score: \" + playerScore);\n // console.log(\"Computer Score: \" + computerScore);\n div.innerText = `${playerSelection} beats ${computerSelection}! ${winMessage}`;\n\n round++;\n } else if (lose) {\n computerScore++;\n // console.log(\"Player Score: \" + playerScore);\n // console.log(\"Computer Score: \" + computerScore);\n div.innerText = `${computerSelection} beats ${playerSelection}! ${loseMessage}`;\n\n round++;\n } else if (playerSelection === computerSelection) {\n // console.log(\"Player Score: \" + playerScore);\n // console.log(\"Computer Score: \" + computerScore);\n div.innerText = `You both chose ${computerSelection}. ${tieMessage}`;\n\n round++;\n }\n score_box.innerHTML = `Player Score: ${playerScore} <br> Computer Score: ${computerScore}`;\n roundNo.innerText = round;\n msg_container.appendChild(div);\n return;\n }\n let winner = \"\";\n if (computerScore > playerScore) {\n winner = \"The Computer\";\n } else {\n winner = \"You\";\n }\n\n div.innerText = `GAME OVER - ${winner} Won!`;\n msg_container.appendChild(refresh); //insert refresh button\n}", "function game() {\n let matches = 0;\n while (matches < 5) {\n playRound();\n matches += 1;\n }\n console.log(\"You have won \" + playerWins + \", lost \" + computerWins + \" and had \" + ties + \" tied games.\");\n if (playerWins > computerWins) {\n console.log(\"Congratulations! You've won!!\");\n } else if (playerWins < computerWins) {\n console.log (\"I'm sorry, you lost\")\n } else {\n console.log(\"OMG, you guys tied!\")\n }\n}", "function Orandomplay() {\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t// Loop to find a valid play\n\t\t\n\t\t\tvar randomNumber = Math.floor((Math.random() * 9) + 1);\n\t\t\tvar randomSquare = $('#square'+randomNumber);\n\t\t\tvalidatePlay(randomSquare);\n\n\t\t\tif (playValid) {\n\n\t\t\t\trandomSquare.removeClass('free');\n\t\t\t\trandomSquare.addClass('played');\n\t\t\t\trandomSquare.addClass('O-play');\n\t\t\t\trandomSquare.html(\"O\");\n\t\t\t\tbreak;\n\t\t\t} \n\t\t}\n\t}", "function round() {\n rl.question(`Press A-Z or 2-0 to play, '1' to stop: `, (answer) => {\n if(answer === '1') {\n // stop playing\n console.log('you quit the game');\n rl.close();\n return;\n } \n // TODO: eliminate circular dependency\n game();\n });\n}", "function playRound(e) {\n\n // get the user selection and show the image\n let playerSelection = e.target.textContent;\n // get the computer selection and show the image\n let computerSelection = computerPlay();\n\n showImage(playerSelection, computerSelection);\n let winner;\n if (playerSelection == \"rock\") {\n if (computerSelection == \"rock\") {\n winner = \"draw\";\n } else if(computerSelection == \"paper\") {\n winner = \"computer\";\n } else {\n winner = \"player\";\n }\n } else if (playerSelection == \"paper\") {\n if (computerSelection == \"rock\") {\n winner = \"player\";\n } else if (computerSelection == \"paper\") {\n winner = \"draw\";\n } else {\n winner = \"computer\";\n }\n } else if (playerSelection == \"scissors\"){\n if (computerSelection == \"rock\") {\n winner = \"computer\";\n } else if (computerSelection == \"paper\") {\n winner = \"player\";\n } else {\n winner = \"draw\";\n }\n } else {\n alert(\"Selection not recognized!!!\");\n }\n\n if (winner == \"player\") {\n playerScore += 1;\n } else if (winner == \"computer\") {\n computerScore += 1;\n }\n \n // update the points on the screen\n showScore(playerScore, computerScore);\n \n if (playerScore == 5 || computerScore == 5) {\n let h1 = document.querySelector('h1');\n let winner = (playerScore == 5) ? \"player\" : \"computer\";\n let finalResult = document.createElement('div');\n finalResult.classList.add('winner');\n let restartButton = document.createElement('button');\n restartButton.classList.add('restart');\n restartButton.textContent = \"restart\"\n finalResult.appendChild(document.createTextNode(`${winner.toUpperCase()} WINS!!`));\n finalResult.appendChild(restartButton);\n restartButton.addEventListener('click', restartGame);\n body.insertBefore(finalResult,h1);\n }\n}", "play(view){\n\n\t\tvar possible_moves = view.getMoves();\n\t\tvar max = possible_moves.length;\n\t\tvar i = Math.floor(Math.random() * max);\n\t\treturn possible_moves[i].toString();\n\t}", "function doRound() {\n // generate and play back seq\n\n if (level == 20) {\n // win\n console.log(\"You won! Congrats!\");\n alert(\"You won! Congrats!\");\n startGame();\n } else {\n\n // inc level and display\n level++;\n $('#levelCount').text(level);\n\n // add a random button id to seq\n seq.push(\"#sBtn\" + Math.floor(Math.random() * 3));\n\n console.log(seq);\n playback();\n }\n\n}", "function game() {\n let count = 0;\n let win = 0;\n for (let i = 0; i < 5; i++) {\n const playerPrompt = prompt(\"Rock, Paper, or Scissors?\");\n let playerSelection = playerPrompt.toLowerCase();\n const computerSelection = computerPlay();\n const roundResult = playRound(playerSelection, computerSelection);\n alert(roundResult);\n if (!roundResult) {\n i--;\n alert(\"Please choose either rock, paper, or scissors!\");\n } else if (roundResult.charAt(4) === \"w\") {\n count++;\n win++;\n } else if (roundResult.charAt(4) === \"l\") {\n count--;\n }\n }\n let winOrLoss;\n if (count >= 1) {\n winOrLoss = \"YOU WON!\";\n } else if (count === 0) {\n winOrLoss = \"YOU TIED!\";\n } else {\n winOrLoss = \"YOU LOST!\";\n }\n return `${winOrLoss} You won ${win} of 5.`;\n}", "function game() {\n player_count = 0\n computer_count = 0\n for (i = 0; i < 5; i++) {\n result = round()\n if (result === \"1\") {\n player_count++\n } else if (result === \"0\") {\n computer_count++\n }\n } if (player_count > computer_count) {\n console.log(\"You have won the match!\")\n } else if (player_count < computer_count) {\n console.log(\"You have lost the match!\")\n } else {\n console.log(\"The match is a tie!\")\n }\n}", "function levelFiveAction(){\n if (cx >= redSeven.x && cx <= redSeven.x + redSeven.width && cy >= redSeven.y && cy <= redSeven.y + redSeven.height) {\n if (redSeven.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n level5Score += 5;\n levelFiveCorrect++;\n redSeven.isClicked = true;\n redSeven.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n\n } else if (cx >= redTwo.x && cx <= redTwo.x + redTwo.width && cy >= redTwo.y && cy <= redTwo.y + redTwo.height) {\n if (redTwo.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n level5Score += 5;\n levelFiveCorrect++;\n redTwo.isClicked = true;\n redTwo.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n } else if (cx >= redFive2.x && cx <= redFive2.x + redFive2.width && cy >= redFive2.y && cy <= redFive2.y + redFive2.height) {\n if (redFive2.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n level5Score += 5;\n levelFiveCorrect++;\n redFive2.isClicked = true;\n redFive2.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n } else if (cx >= blueTwo.x && cx <= blueTwo.x + blueTwo.width && cy >= blueTwo.y && cy <= blueTwo.y + blueTwo.height) {\n if (blueTwo.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n\t\t\tchangecolors();\n livesCount--;\n blueTwo.isClicked = true;\n blueTwo.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n } else if (cx >= greenTwo2.x && cx <= greenTwo2.x + greenTwo2.width && cy >= greenTwo2.y && cy <= greenTwo2.y + greenTwo2.height) {\n if (greenTwo2.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n\t\t\tchangecolors();\n livesCount--;\n greenTwo2.isClicked = true;\n greenTwo2.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n } else if (cx >= redSix.x && cx <= redSix.x + redSix.width && cy >= redSix.y && cy <= redSix.y + redSix.height) {\n if (redSix.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n\t\t\tchangecolors();\n livesCount--;\n redSix.isClicked = true;\n redSix.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n } else if (cx >= yellowSeven.x && cx <= yellowSeven.x + yellowSeven.width && cy >= yellowSeven.y && cy <= yellowSeven.y + yellowSeven.height) {\n if (yellowSeven.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n\t\t\tchangecolors();\n livesCount--;\n yellowSeven.isClicked = true;\n yellowSeven.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore5();\n }\n } else if (cx >= missionBubble.x && cx <= missionBubble.x + missionBubble.width && cy >= missionBubble.y && cy <= missionBubble.y + missionBubble.height) {\n\t\tchangecolors();\n if (missionBubble.opClick == 0) {\n if (playMusic == true) {\n\t\t\tbubblePop.play();\n\t\t\t}\n\t\t\tchangecolors();\n livesCount = 0;\n missionBubble.isClicked = true;\n missionBubble.opClick++;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawScore();\n }\n }\n}", "function game() {\n // initialize win counter for both player and computerScore\n let playerScore = 0;\n let computerScore = 0;\n \n // make a loop that ::: (loop 5 times)\n\n for(let i = 0; i < 5; i++) {\n // ask the user for the input rock paper or scissors as a string\n const playerSelection = prompt('Choose Rock Paper or Scissors!');\n // generates a computer string value with computerPlay function\n const computerSelection = computerPlay();\n // use playRound function with the two values and increment the result of playerScore and computerScore\n let tempValue = playRound(playerSelection, computerSelection);\n playerScore += tempValue[0];\n computerScore += tempValue[1];\n }\n console.log(playerScore);\n // prints game finished when loop is done and log if player won if playerScore is larger then 2\n (playerScore > computerScore) ? console.log('You Won Yay!!!') : (playerScore === computerScore) ? console.log('Draw!!!') : console.log('You Lose!!!');\n}", "function playRound(playerSelection, computerSelection) {\n if (playerSelection.length === computerSelection.length){\n comments.textContent = 'You both are no good!'; \n } else if (playerSelection.length == 4 && computerSelection.length === 5) {\n comments.textContent = \"Damn! Paper beats Rock! :(\";\n computerScore++\n } else if (playerSelection.length == 4 && computerSelection.length === 8) {\n comments.textContent = \"Nice! Rock beats Scissors!\"; \n humanScore++\n } else if (playerSelection.length == 5 && computerSelection.length === 4) {\n comments.textContent = \"Good going! Paper beats Rock!\"; \n humanScore++\n }else if (playerSelection.length == 5 && computerSelection.length === 8) {\n comments.textContent = \"Try harder! Scissors beats Paper!\"; \n computerScore++\n }else if (playerSelection.length == 8 && computerSelection.length === 4) {\n comments.textContent = \"Damn! Rock beats Scissors!\"; \n computerScore++\n } else if (playerSelection.length == 8 && computerSelection.length === 5) {\n comments.textContent = \"Yay! Scissors beats Paper!\"; \n humanScore++\n } else {\n comments.textContent = 'Nice going. something is broken >:(';\n}\n}", "function playRound(e) {\n if (gamePaused) {\n return;\n }\n\n let computerSelection = computerPlay();\n let playerSelection = this.id;\n\n document.getElementById('round-choices').textContent = `You chose ${playerSelection}, the computer chose ${computerSelection}.`;\n\n winner = checkRoundWinner(computerSelection, playerSelection);\n fightReport = getFightReport(computerSelection, playerSelection);\n\n // announce round winner\n if (winner === 'tie') {\n document.getElementById('round-results').textContent = 'Nothing happens.';\n }\n else if (winner === 'computer') {\n document.getElementById('round-results').textContent = `${fightReport} Sorry, you lose this round.`;\n computerScore++;\n }\n else if (winner === 'player') {\n document.getElementById('round-results').textContent = `${fightReport} You win this round!`;\n playerScore++;\n }\n else {\n document.getElementById('round-results').textContent = 'Glitch in the Matrix. Hmm....';\n }\n\n document.getElementById('player-score').textContent = playerScore;\n document.getElementById('computer-score').textContent = computerScore;\n\n // check for the end of the game\n if (playerScore >= 3) {\n gameOver('player');\n }\n else if (computerScore >= 3) {\n gameOver('computer');\n }\n}", "function game() {\n for (let i = 1; playerScore < 5 && computerScore < 5; i++) {\n let playerChoice = prompt('Rock, Paper, or Scissors?');\n computerSelection = computerPlay();\n playRound(playerChoice, computerSelection);\n }\n if (playerScore === 5) {\n console.log( `Nice job, You won! | Final Score: ${playerScore} - ${computerScore}` );\n } else {\n console.log( `GAME OVER! Try Again. | Final Score: ${playerScore} - ${computerScore}`);\n }\n}", "playAnotherRound() {\n this.displayGuess();\n console.log(this.displayedWord);\n console.log(\"\");\n\n this.playRound();\n }", "function game() {\n for (let i = 0; i < 5; i++) {\n let playerSelect = prompt(\"Pick a move\");\n const computerSelect = computerPlay()\n let compSelect = alert(\"computer just chose: \" + computerSelect);\n console.log(playRound(playerSelect, computerSelect));\n }\n return reportWinner(playerScore, computerScore);\n}", "function playGame() {\n\n if (rounds === 3) {\n gameWon()\n return\n }\n\n $empezar.style.visibility = 'hidden'\n updateAlert(\"Turno de la Compu, espere y preste atención\")\n updateRound(rounds)\n\n const newCircle = getComputerCircle()\n computerSecuenceArray.push(newCircle)\n\n desactivateUserTurn()\n\n showSecuence(computerSecuenceArray)\n\n const delayUserToPlay = (computerSecuenceArray.length + 2) * 1000\n setTimeout(() => {\n updateAlert(\"Su Turno, espero que haya prestado atención\")\n activateUserTurn()\n }, delayUserToPlay);\n\n userComputerArray = []\n rounds++\n}", "function playRound(player, computer){\r\n if(player == computer){\r\n winnerRound.innerHTML = `Its a tie. ${player}${\"user\".fontsize(3).sub()} equals ${computer}${\"comp\".fontsize(3).sub()}`;\r\n }\r\n else if(player === \"rock\" && computer===\"scissors\" || player === \"paper\" && computer === \"rock\" || player===\"scissors\" && computer ===\"paper\"){\r\n winnerRound.innerHTML = `<em>You win! ${player}${\"user\".fontsize(3).sub()} beats ${computer}${\"comp\".fontsize(3).sub()}</em>`;\r\n playerPoints++; \r\n }\r\n else {\r\n winnerRound.innerHTML = `<em>You lose.. ${computer}${\"comp\".fontsize(3).sub()} beats ${player}${\"user\".fontsize(3).sub()}</em>`;\r\n computerPoints++; \r\n }\r\n score.textContent = `${playerPoints} : ${computerPoints}`;\r\n // --- check if player or computer has reached 5 points\r\n winner();\r\n}", "function play() {\n win = false;\n order = [];\n playerOrder = [];\n flash = 0;\n intervalId = 0;\n round = 1;\n roundCount.innerHTML = 1;\n score = true;\n for (var i = 0; i < 20; i++) {\n order.push(Math.floor(Math.random() * 4) + 1);\n }\n compRound = true;\n intervalId = setInterval(gameRound, 800);\n}", "function playGame(){\n //time = 5;\n\n // initialising more values\n mimic = [];\n trunAI = true;\n turnNo = 1;\n\n // changing score on the html to the score\n scoreCount.innerHTML = (score).toLocaleString('en', {minimumIntegerDigits: 2, useGrouping: false}); // making sure that the digits have 2 values\n\n // initialising the sequence array with 25 flashes\n for(var i =0; i < 25; i++){\n let random = Math.floor(Math.random()*4)+1;\n sequence.push(random);\n\n }\n\n // computer turn\n aiTurn = true;\n interval = setInterval(compRound, 1000); // making sure computer flash happens every second\n}", "function game() {\n for (let i = 0; i < 5; i++) {\n const userChoice = prompt(\"Your Choices... Rock, Paper, Scissors\");\n const computerChoice = getComputerChoice();\n\n console.log(`You chose ${userChoice}`);\n console.log(`Computer chose ${computerChoice}`);\n console.log(score(playRound(userChoice, computerChoice)));\n }\n // print final score outcome to user at end of rounds(loop).\n if (userScore > computerScore) {\n console.log(\n `Well done you WON! Player Score:${userScore} - Computer Score: ${computerScore}`\n );\n } else if (userScore < computerScore) {\n console.log(\n `Oh-No You Lost! Player Score:${userScore} - Computer Score: ${computerScore}`\n );\n } else {\n console.log(\n `It\\'s a DRAW! Player Score:${userScore} - Computer Score: ${computerScore}`\n );\n }\n}", "function playRound()\n {\n \tlet outcome;\n \tlet computersChoice = getComputerChoice();\n \tlet playersChoice = getPlayerChoice();\n\n \t// Player Rock comparison\n \tif(playersChoice === \"rock\")\n \t{\n \t\tif(computersChoice === \"rock\")\n \t\t{\n \t\t\toutcome = \"tie\";\n \t\t}\n \t\telse if(computersChoice === \"paper\")\n \t\t{\n \t\t\toutcome = \"lose\";\n \t\t}\n \t\telse //scissors\n \t\t{\n \t\t\toutcome = \"win\";\n \t\t}\n \t}\n\n \t// Player Paper comparison\n \tif(playersChoice === \"paper\")\n \t{\n \t\tif(computersChoice === \"rock\")\n \t\t{\n \t\t\toutcome = \"win\";\n \t\t}\n \t\telse if(computersChoice === \"paper\")\n \t\t{\n \t\t\toutcome = \"tie\";\n \t\t}\n \t\telse //scissors\n \t\t{\n \t\t\toutcome = \"lose\";\n \t\t}\n \t}\n\n \t// Player Scissors comparison\n \tif(playersChoice === \"scissors\")\n \t{\n \t\tif(computersChoice === \"rock\")\n \t\t{\n \t\t\toutcome = \"lose\";\n \t\t}\n \t\telse if(computersChoice === \"paper\")\n \t\t{\n \t\t\toutcome = \"win\";\n \t\t}\n \t\telse //scissors\n \t\t{\n \t\t\toutcome = \"tie\";\n \t\t}\n \t}\n\n \tdisplayOutcome(playersChoice, computersChoice, outcome);\n\n \treturn outcome;\n }", "function game() {\n const playGame = e => {\n const player = e.target.parentElement.value;\n setTimeout(function() { playRound(player); }, 500);\n }\n \n //check buttons are clicked\n const buttons = document.querySelectorAll('button')\n buttons.forEach(function(button) {\n button.addEventListener('click', playGame);\n }) \n}", "function game() {\n \n round = 0;\n while (round < 5) {\n playerSelection = prompt('Rock Paper Scissors! Please enter your selection:', 'Rock');\n computerSelection = computerPlay();\n console.log(playRound(playerSelection, computerSelection));\n round++;\n }\n\n if (win > loss) {\n return 'You win the game! Player: ' + win + ', Computer: ' + loss;\n } else if (win < loss) {\n return 'You lose the game! Computer wins! Player: ' + win + ', Computer: ' + loss;\n } else {\n return 'It\\'s a draw!';\n }\n}", "function playRound() {\n if (cardValue.indexOf(deck1[0]) > cardValue.indexOf(deck2[0])) {\n moveToBack(deck1, deck1, 1);\n moveToBack(deck2, deck1, 1);\n }\n else if (cardValue.indexOf(deck2[0]) > cardValue.indexOf(deck1[0])) {\n moveToBack(deck1, deck2, 1);\n moveToBack(deck2, deck2, 1);\n }\n else {\n playWar();\n }\n \n n = deck1.length;\n m = deck2.length;\n}", "function playRound() {\r\n // 'this' refers to button element calling this function.\r\n const playerSelection = this.textContent.toLowerCase();\r\n const computerSelection = computerPlay().toLowerCase();\r\n // Element (containing each player's action) class lists\r\n const classListPlayer = document.querySelector('.player-action').classList;\r\n const classListComp = document.querySelector('.computer-action').classList;\r\n let winner;\r\n\r\n updateActionImage(classListPlayer, playerSelection);\r\n updateActionImage(classListComp, computerSelection);\r\n\r\n // Tie between player and computer.\r\n if (playerSelection === computerSelection) {\r\n return;\r\n } else {\r\n winner = findWinner(playerSelection, computerSelection);\r\n updateScore(winner);\r\n }\r\n\r\n checkGameOver();\r\n}", "function playRound(uChoice) {\n if (uScore < Math.ceil(rounds/2) && cScore < Math.ceil(rounds/2)) {\n const cChoice = compChoose();\n if (cChoice == uChoice) status.textContent = \"Tie! You both selected \"+uChoice+\".\";\n else if (uChoice == \"rock\" && cChoice == \"scissors\" || \n uChoice == \"paper\" && cChoice == \"rock\" || \n uChoice == \"scissors\" && cChoice == \"paper\") {\n status.textContent = \"Round won! \"+uChoice[0].toUpperCase()+uChoice.substring(1)+\" beats \"+cChoice+\".\";\n uScore +=1;\n } else {\n status.textContent = \"Round lost! \"+cChoice[0].toUpperCase()+cChoice.substring(1)+\" beats \"+uChoice+\".\";\n cScore +=1;\n }\n }\n updateScoreDisplay();\n checkForWinner();\n}", "function playRound(e) {\n // disable championship input during round\n if (rounds === 1) {\n championshipDiv.contentEditable = true;\n championshipInput.readonly = false;\n } else {\n championshipDiv.contentEditable = false;\n championshipInput.readonly = true;\n }\n\n if (e.target.name === \"Reset\") {\n resetRounds();\n } else {\n const player = e.target.name;\n const computer = computerPlay();\n if (computer === results[player][\"win\"]) {\n handleResults(1, player, computer);\n } else if (computer === results[player][\"lose\"]) {\n handleResults(0, player, computer);\n } else {\n handleResults(-1, player, computer);\n }\n }\n }", "function startRound(){\n playRound(this.id, computerPlay());\n}", "function singleGame(userSelection) {\n let computerSelection = computerPlay();\n const intro = document.getElementById('intro');\n intro.innerText = \"The computer chose\";\n const computer = document.getElementById('computer');\n computer.innerText = `${computerSelection}`;\n const outcome = document.getElementById('outcome');\n const roundNumber = document.getElementById('round');\n const winNumber = document.getElementById('win');\n const lossNumber = document.getElementById('loss');\n const tieNumber = document.getElementById('tie');\n \n\n if(round === 5) {\n intro.innerText = \"Press button to play again\";\n computer.innerText = 'the one below...';\n outcome.innerText = 'further down...';\n restartButton.value = 'This buttonzz'\n } else {\n if (userSelection === rock) {\n if (computerSelection === paper) {\n outcome.innerText = 'You lose!'\n lose += 1;\n lossNumber.innerText = `Lose: ${lose}`;\n } else if (computerSelection === scissors) {\n outcome.innerText = 'You win!'\n win += 1;\n winNumber.innerText = `Win: ${win}`;\n } else if (computerSelection === rock) {\n outcome.innerText = `It's a tie!`;\n tie += 1;\n tieNumber.innerText = `Tie: ${tie}`;\n }\n } else if (userSelection === paper) {\n if (computerSelection === scissors) {\n outcome.innerText = 'You lose!'\n lose += 1;\n lossNumber.innerText = `Lose: ${lose}`;\n } else if (computerSelection === rock) {\n outcome.innerText = 'You win!';\n win += 1;\n winNumber.innerText = `Win: ${win}`;\n } else if (computerSelection === paper) {\n outcome.innerText = `It's a tie!`;\n tie += 1;\n tieNumber.innerText = `Tie: ${tie}`;\n }\n } else if (userSelection === scissors) {\n if (computerSelection === rock) {\n outcome.innerText = 'You lose!'\n lose += 1;\n lossNumber.innerText = `Lose: ${lose}`;\n } else if (computerSelection === paper) {\n outcome.innerText = 'You win!';\n win += 1;\n winNumber.innerText = `Win: ${win}`;\n } else if (computerSelection === scissors) {\n outcome.innerText = `It's a tie!`;\n tie += 1;\n tieNumber.innerText = `Tie: ${tie}`;\n }\n }\n round += 1;\n roundNumber.innerText = `Round: ${round}`\n if(round === 5) {\n restartButton.style.display = 'flex';\n restartButton.value = 'Play again?'\n intro.innerText = 'Game Over';\n if(win > lose) {\n computer.innerText = 'You have won!';\n outcome.innerText = 'Congratulations!';\n } else if (lose > win) {\n computer.innerText = 'Oh, you lost...';\n outcome.innerText = 'I am so, so sorry...';\n } else if (tie > win && tie > lose) {\n computer.innerText = 'My, my, my,'\n outcome.innerText = 'Somehow you tied...'\n }\n } \n }\n}", "function nextRound(round){\n\tround++;\n\tboard = makeBlank(words[round-1].length);\n\tguess = [];\n\tpile = [];\n\treturn round;\n}", "function round() {\n const clickedElement = event.target;\n if ((clickedElement.classList.contains(\"p1-houses\")) || (clickedElement.classList.contains(\"p2-houses\"))) {\n var startIndex = parseInt(clickedElement.id);\n }\n selectHouse(false, currentPlayer);\n currentPlayer = distributionLoop(currentPlayer, startIndex);\n if (checkEmptyHouses(currentPlayer)) {\n currentPlayer = (currentPlayer === 1) ? 2 : 1;\n }\n game(currentPlayer);\n}", "function loadRound(){\n\tenableButtons();\n\tupdateScore();\n\tunbindHandlers();\n\tshuffle();\n\n\tsetGame(0);\n\tsetGame(1);\n\tsetGame(2);\n\tbindSelectors();\n}", "function startNextRound() {\r\n// log(\"snr:\"+currentRound);\r\n var remainingRounds = FIRST_ACTUAL_ROUND+numRounds-currentRound-1;\r\n// alert(remainingRounds);\r\n// if (currentRound < (FIRST_ACTUAL_ROUND+numRounds-1)) {\r\n if (remainingRounds > 0) {\r\n initializeRound(currentRound+1);\r\n } else {\r\n hideGame(); // must do this the first time\r\n $('#q1').show(); // 1st survey question\r\n// showResults(); // called in q1\r\n }\r\n}", "function game () {\n\n // need a way to record the winner and keep track of each player's score\n let playerScore = 0;\n let computerScore = 0;\n\n\n // loop for 5 rounds\n for (i = 0; i < 5; i++) {\n \n\n let playerSelection = prompt(\"Enter rock, paper, or scissors.\");\n\n \n // increment score for the winner\n switch (playerWon) {\n case 0:\n computerScore+=1;\n case 1:\n playerScore+= 1;\n case -1:\n break;\n }\n\n // output round results\n console.log(playRound(playerSelection));\n console.log(`Computer chose ${computerSelection} and you chose ${playerSelection}. Your score is ${playerScore} and the computer's is ${computerScore}.`);\n }\n\n\n //output game results \n console.log(`Final score, you: ${playerScore} computer: ${computerScore}`);\n}", "function playGameConsole() {\n let computerChoice;\n let playerChoice;\n let pScore = 0;\n let cScore = 0;\n let result;\n for (i = 0; i < 5; i++) {\n computerChoice = computerPlay();\n playerChoice = prompt(\"Enter your choice:\");\n if (\n playerChoice.toLowerCase() == \"rock\" ||\n playerChoice.toLowerCase() == \"paper\" ||\n playerChoice.toLowerCase() == \"scissors\"\n ) {\n result = playRound(playerChoice, computerChoice);\n if (result === 1) {\n alert(\"Player WINS with \" + playerChoice + \" over \" + computerChoice);\n pScore++;\n } else if (result === 0)\n alert(\"It's a draw! \" + computerChoice + \" over \" + playerChoice);\n else if (result === -1) {\n alert(\"Computer WINS with \" + computerChoice + \" over \" + playerChoice);\n cScore++;\n }\n } else {\n i--;\n alert(\"Wrong input!\");\n }\n }\n alert(\"PLAYER \" + pScore + \" COMPUTER \" + cScore);\n}", "function nextRound() {\r\n\tround++; //increments round number\r\n\troundNumber.innerText = round; //adjusts round number display\r\n\tsetTimeout(function () {\r\n\t\tinit(); //initializes another round of play with 1 sec delay\r\n\t}, 1000);\r\n}", "function game(playerPick) {\n \n let computerPick = computerPlay();\n \n let result = playRound(playerPick, computerPick);\n\n \n\n if (result.includes(\"win\")){\n wins++;\n } else if (result.includes(\"lose\")) {\n losses++;\n } else {\n console.log(\"game() something went wrong\");\n } \n rounds++;\n\n if (rounds == 1) {\n outcomeContent.textContent = \" \";\n }\n \n roundContent.textContent = rounds;\n lossesContent.textContent = losses;\n winsContent.textContent = wins;\n\n //outputs score after each round\n console.log(result + \" Round: \" + rounds + \"/5. Wins: \" + wins + \". Losses: \" + losses + \". Ties: \" + ties + \".\");\n\n //Reports final winner after 5 rounds are played\n if (wins == 5 || losses == 5) {\n console.log(finalWinner(wins, losses, ties));\n outcomeContent.textContent = finalWinner(wins, losses, ties);\n rounds = wins = losses = ties = 0;\n } \n\n \n \n }// end of game", "function times(){\n\tif (i<4){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//notice only have 4 times\n\t\ti++;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//everytimes running this fuction, i=i+1.\n\t\tj=5-i;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//j is for how many chances the player still have.\n\t\tgame();\n\t\tif (j<=1){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//when the player just have 1 or less chance.\n\t\t\tdocument.getElementById(\"chances\").innerHTML =\"You still have \"+j+\" chance.\";\n\t\t\tchances.style.color = \"yellow\";\t\t\t\t\t\t\t\t\t\t\t\t\t\t//show the output notice text yellow color.\n\t\t}\n\t\telse{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//when the player have more than 1 chance.\n\t\t\tdocument.getElementById(\"chances\").innerHTML =\"You still have \"+j+\" chances.\";\n\t\t\tchances.style.color = \"blue\";\t\t\t\t\t\t\t\t\t\t\t\t\t\t//show the output notice text blue color.\n\t\t}\n\t}\n\telse{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//player fail all 5 times.\n\t\talert(\"Sorry, You Lose!\");\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//player lose\n\t\twindow.location.href= \"ThankyouPage.html\";\t\t\t\t\t\t\t\t\t\t\t\t//after clicking 'ok' in alert, jump to thank-you page.\n\t}\n}", "function roundsSetup() {\n const playingContainer = document.querySelector('.playingContainer');\n const tl = new TimelineMax();\n tl.addCallback(() => {\n tl.to('.playingContainer', 1, {\n top: '25%'\n });\n playingContainer.classList.remove('visuallyhidden');\n });\n tl.to('.scoreBoard', 1, {\n top: 5\n });\n\n // get the value from the form field for rounds\n rounds = document.querySelector('#rounds').value;\n const roundsToPlay = document.querySelector('#totalRounds');\n const messageBox = document.querySelector('.messageBox');\n // put the number of rounds to play into the rounds box\n roundsToPlay.innerHTML = rounds;\n // clear out the message box\n messageBox.innerHTML = '';\n // call the function to start the game\n gamePlay(player1, player2);\n}", "function clickHandler() {\n if (win === 0) {\n run();\n } else if (win === 5) {\n endGame();\n } else if (win > 0) {\n display();\n } else {\n }\n}", "function game() {\n\n // scores\n let playerScore = 0;\n let computerScore = 0;\n\n for (let i = 0; i < 5; i++) {\n // get choices\n const playerChoice = getPlayerChoice();\n const computerChoice = computerPlay()\n const result = playRound(playerChoice, computerChoice);\n console.log(`you choose: ${playerChoice}`)\n console.log(`and the computer choose ${computerChoice}`)\n\n // print result\n if (result === 'c') {\n computerScore++;\n console.log('Round Winner: Computer');\n } else if (result === 'p') {\n console.log('Round Winner: Player');\n playerScore++;\n } else {\n console.log('It\\'s a tie');\n }\n }\n\n // final result\n console.log(`final result: `);\n console.log(`Player: ${playerScore}`);\n console.log(`Computer: ${computerScore}`);\n}", "function playGame(){\n createTimer();\n juego.resetScore();\n juego.resetCorrectLabel();\n juego.setStatePlaying(true);\n disablePlayButton();\n juego.updateExpression();\n enableSendResultButton();\n resetClasses();\n}", "function gameRound1() {\r\n if (this.id == \"btnRed\") {\r\n if (activePlayerCount < playerCount) {\r\n showingCard();\r\n checkRed();\r\n deleteCard();\r\n nextPlayer();\r\n } else if (activePlayerCount == playerCount) {\r\n showingCard();\r\n checkRed();\r\n deleteCard();\r\n nextPlayerRound();\r\n round1.style.display = \"none\";\r\n round2.style.display = \"block\";\r\n }\r\n }\r\n\r\n if (this.id == \"btnBlack\") {\r\n if (activePlayerCount < playerCount) {\r\n showingCard();\r\n checkBlack();\r\n deleteCard();\r\n nextPlayer();\r\n } else if (activePlayerCount == playerCount) {\r\n showingCard();\r\n checkBlack();\r\n deleteCard();\r\n nextPlayerRound();\r\n round1.style.display = \"none\";\r\n round2.style.display = \"block\";\r\n }\r\n }\r\n}", "function game(){\n while (playerScore < 5 && cpuScore < 5){\n playRound();\n }\n if(playerScore ==5){\n console.log(\"You Win! Refresh to Play Again. Player Score: \" + playerScore + \" CPU Score: \" + cpuScore);\n }else {\n console.log(\"Computer Wins! Refresh to Play Again. Player Score: \" + playerScore + \" CPU Score: \" + cpuScore);\n }\n }", "function playNormal(args) {\n\tlet ind1 = args[0];\n\tlet ind2 = args[1];\n\tlet rounds = args[2];\n\t\n\tind1.gameInit();\n\tind2.gameInit();\n\t\n\tfor (let i = 0; i < rounds; i++) {\n\t\tplayRound(ind1, ind2);\n\t}\n\t\n\tind1.gameEnd();\n\tind2.gameEnd();\n}", "function paperPlayer() {\n\tplayChoice=2;\n\trandomNumber();\n}", "function gameRound() {\n power = false;\n if (flash == round) {\n clearInterval(intervalId);\n compRound = false;\n clearColor();\n power = true;\n }\n if (compRound) {\n clearColor();\n setTimeout(() => {\n if (order[flash] == 1) one();\n if (order[flash] == 2) two();\n if (order[flash] == 3) three();\n if (order[flash] == 4) four();\n flash++;\n }, 200);\n }\n}", "function startRound()\r\n{\r\n\t// If there are no more rounds left, end the game\r\n\tif(currentRound >= rounds.length)\r\n\t{\r\n\t\tgameEnd();\r\n\t\treturn;\r\n\t}\r\n\r\n\t$(\"#comment\").hide();\r\n\r\n\t// Reset button colors\r\n\t$(\"#answer-1\").attr(\"class\", \"left-btn answer-button guess-left\");\r\n\t$(\"#answer-2\").attr(\"class\", \"right-btn answer-button guess-right\");\r\n\t$(\"#answer-3\").attr(\"class\", \"left-btn answer-button guess-left\");\r\n\t$(\"#answer-4\").attr(\"class\", \"right-btn answer-button guess-right\");\r\n\r\n\t// Set text for question and answers\r\n\t$(\"#question\").text(rounds[currentRound].question);\r\n\t$(\"#answer-1\").text(rounds[currentRound].answer1);\r\n\t$(\"#answer-2\").text(rounds[currentRound].answer2);\r\n\t$(\"#answer-3\").text(rounds[currentRound].answer3);\r\n\t$(\"#answer-4\").text(rounds[currentRound].answer4);\r\n\r\n\tplaying = true;\r\n\r\n\ttimer.start(30, timeUp);\r\n}", "function gameWin() {\n\tplayCounter++;\n\twinCount++;\n\tconsole.log(\"You won!\");\n\tif (playCounter < 3) {\n\t\tgame.state.start('win');\n\t}\n\telse {\n\t\tgame.state.start('complete');\n\t}\n}", "function play() {\n round += 1;\n console.log(\"Round: \" + round);\n getComputerPlay();\n getHumanPlay();\n console.log('[You] \"' + humanPlay + '!\" [Computer] \"' + computerPlay + '!\"');\n if (humanPlay === computerPlay) {\n console.log(\"We tied :/\");\n } else if (humanPlay === 'paper' && computerPlay === 'rock'\n || humanPlay === 'rock' && computerPlay === 'scissors'\n || humanPlay === 'scissors' && computerPlay === 'paper') {\n if (humanScore < 2){\n console.log(\"You won this time!\");\n } else {}\n humanScore += 1;\n } else if (computerPlay === 'paper' && humanPlay === 'rock'\n || computerPlay === 'rock' && humanPlay === 'scissors'\n || computerPlay === 'scissors' && humanPlay === 'paper') {\n console.log(\"Huzzah, I've won! One step closer to world domination!\");\n computerScore += 1;\n } else {\n console.log(\"How'd you do that dummy!\");\n }\n console.log(\"Computers: \" + computerScore + \" -- Humans:\" + humanScore);\n checkScore();\n}", "function playRound (e) {\n resetScore();\n\n if (e.target.id == 'rock-icon') {\n weaponPlayerAssignment ('rock');\n } else if (e.target.id == 'paper-icon') {\n weaponPlayerAssignment ('paper');\n } else if (e.target.id == 'scissors-icon') {\n weaponPlayerAssignment ('scissors');\n }\n \n cpuWeapon = randomWeapon();\n winnerWeapon = roundPlay (playerWeapon, cpuWeapon);\n\n checkWeapons (playerWeapon, cpuWeapon, winnerWeapon);\n checkWinner ();\n\n}", "startNextRound() {\n let chosen = this.chooseNextChaser();\n if (chosen !== undefined) {\n this.broadcast({\n type: 9, properties: this.gameProperties\n });\n this.gameStarted = true;\n this.broadcast({\n type: 12, id: chosen\n });\n this.currentlyChosen = chosen;\n //+500 to make up for fade in/out transitions\n setTimeout(this.startNextRound.bind(this), (this.gameProperties.roundLength * 1000)+500);\n } else {\n this.broadcast({\n type: 15, scores: this.getScores()\n });\n this.delete();\n }\n }", "function gameRounds() {\n if (finalScores.length >= 2) {\n finalStart();\n console.log(\"final start in game rounds function\")\n } else {\n startGame();\n console.log(\"start game in game rounds function\")\n }\n }", "function gamePlay(p1, p2) {\n const messageBox = document.querySelector('.messageBox');\n const roundsToPlay = document.querySelector('#currentRound');\n roundsToPlay.innerHTML = roundCounter;\n const selectorOptions = document.querySelectorAll('.selectorOption');\n // If the game hasn't played enough rounds, reactivate the buttons and restart the sequence\n if (roundCounter < rounds) {\n // trigger selector\n /* eslint-disable no-restricted-syntax, no-undef */\n for (selector of selectorOptions) {\n if (selector.hasAttribute('disabled')) {\n selector.removeAttribute('disabled');\n }\n }\n /* eslint-enable no-restricted-syntax, no-undef */\n // Show the button selector\n TweenLite.to('.selector', 1, {\n bottom: '10px',\n delay: 1\n });\n roundCounter += 1;\n // If both players have the same number of wins after the rounds, do a tiebreaker until someone wins\n } else if (p1.wins === p2.wins) {\n // tiebreaker round\n /* eslint-disable no-restricted-syntax, no-undef */\n for (selector of selectorOptions) {\n if (selector.hasAttribute('disabled')) {\n selector.removeAttribute('disabled');\n }\n }\n /* eslint-enable no-restricted-syntax, no-undef */\n messageBox.innerHTML = `\n <h1 class=\"lgLabel\">It's a tie!<br>\n Prepare for a<br>tiebreaker round!</h1>\n `;\n // trigger selector again\n TweenLite.to('.selector', 1, {\n bottom: '10px',\n delay: 1\n });\n // Once someone has more wins at the end, announce the winner and display a button to restart the game\n } else if (p1.wins > p2.wins) {\n messageBox.innerHTML = `\n <div class=\"woodBackground playAgainContainer\"><span class=\"fullWidth\"><h1 class=\"lgLabel\">${p1.name} wins the game!</h1></span>\n <a href=\"#\" id=\"playAgainButton\" class=\"enterNameButton\" onClick=\"getRoundsToPlay()\">Play Again!</a></div>\n `;\n } else {\n messageBox.innerHTML = `\n <div class=\"woodBackground playAgainContainer\"><span class=\"fullWidth\"><h1 class=\"lgLabel\">${p2.name} wins the game!</h1></span>\n <a href=\"#\" id=\"playAgainButton\" class=\"enterNameButton\" onClick=\"getRoundsToPlay()\">Play Again!</a></div>\n `;\n }\n}", "function playToFive() {\n console.log(\"Let's play Rock, Paper, Scissors\");\n var playerWins = 0;\n var computerWins = 0;\n \n while (playerWins < 5 && computerWins < 5) {\n console.log(\"The score is currently player: \" + playerWins + \", computer: \" + computerWins)\n var playerMove = getPlayerMove();\n var computerMove = getComputerMove();\n var winner = getWinner(playerMove,computerMove);\n \n if (winner === \"player\") {\n playerWins += 1;\n console.log(\"You chose \" + playerMove + \" while the computer chose \" + computerMove + \".\");\n console.log(\"The winner of this round is \" + winner + \".\");\n } else if (winner === \"computer\") {\n computerWins += 1;\n console.log(\"You chose \" + playerMove + \" while the computer chose \" + computerMove + \".\");\n console.log(\"The winner of this round is \" + winner + \".\");\n } else if (winner === \"tie\") {\n console.log(\"You chose \" + playerMove + \" while the computer chose \" + computerMove + \".\");\n console.log(\"This round was a tie. Try again!\");\n }\n }\n\n if (playerWins === 5) {\n console.log(\"You won!\"); \n } else if (computerWins === 5) {\n console.log(\"Computer won.\");\n } \n return [playerWins, computerWins];\n \n}", "function startGame() {\n\n //Reset game\n score = 0;\n reserrors = 0;\n round = 1;\n $('#score').text(\"Score: \"+score);\n\n generateRound()\n}", "function playRound(playerSelection, computerSelection) {\n \n\n if (playerSelection === \"Rock\" && computerSelection === \"Rock\"){\n draw();\n } else if (playerSelection === \"Rock\" && computerSelection === \"Paper\"){\n computerWin();\n } else if (playerSelection === \"Rock\" && computerSelection === \"Scissors\"){\n playerWin();\n } else if (playerSelection === \"Paper\" && computerSelection === \"Rock\"){\n playerWin();\n } else if (playerSelection === \"Paper\" && computerSelection === \"Scissors\"){\n computerWin();\n } else if (playerSelection === \"Paper\" && computerSelection === \"Paper\"){\n draw();\n } else if (playerSelection === \"Scissors\" && computerSelection === \"Rock\"){\n computerWin();\n roundResult.textContent = \"You lose!\";\n } else if (playerSelection === \"Scissors\" && computerSelection === \"Scissors\"){\n draw();\n } else if (playerSelection === \"Scissors\" && computerSelection === \"Paper\"){\n playerWin();\n }\n}", "function playARound() {\n document.body.className = 'play'\n\n if (is_hard_mode) {\n current_dog_pair = getTwoDogs(null, 1) // hard mode\n }\n else {\n current_dog_pair = getTwoDogs(10, null) // easy mode\n }\n\n iconClasses = getTwoIcons();\n\n document.querySelector('#roundNumber').innerText = rounds_played + 1 + ' / ' + NUMBER_OF_ROUNDS\n\n document.querySelectorAll('#play button')[0].innerText = current_dog_pair[0].name\n document.querySelectorAll('#play button')[0].className = iconClasses[0];\n\n document.querySelectorAll('#play button')[1].innerText = current_dog_pair[1].name\n document.querySelectorAll('#play button')[1].className = iconClasses[1];\n\n}", "function gameplay() {\r\n\t// run hole\r\n\tif (hole == 1)\r\n\t\thole1();\r\n\telse if (hole == 2)\r\n\t\thole2();\r\n\telse if (hole == 3)\r\n\t\thole3();\r\n\telse if (hole == 4)\r\n\t\thole4();\r\n\telse if (hole == 5)\r\n\t\thole5();\r\n\telse if (hole == 6)\r\n\t\thole6();\r\n\telse if (hole == 7)\r\n\t\thole7();\r\n\telse if (hole == 8)\r\n\t\thole8();\r\n\telse if (hole == 9)\r\n\t\thole9();\r\n}", "function game() {\n\n\tfor(let i = 0; i < 5; i++) {\n\t\n\t\tplayerInput();\n\t\n\t}\n\t\n\tif(userWin > computerWin) {\n\t\n\t\talert(\"You won! Congratulations!\");\n\t\t\n\t} else if(computerWin > userWin) {\n\t\n\t\talert(\"You lose, noob!\");\n\t\t\n\t} else {\n\t\n\t\talert(\"Tie!\");\n\t\t\n\t}\n\t\n\tlet again = confirm(\"Again?\");\n\t\n\tif(again === true) {\n\t\n\t\tuserWin = 0;\n\t\t\n\t\tcomputerWin = 0;\n\t\t\n\t\tgame();\n\t\t\n\t} else {\n\t\n\t\talert(\"Thanks for playing!\");\n\t\n\t}\n\t\t\n}", "function game(e) {\n var roundResult;\n var winner;\n\n //update interface based on round result \n roundResult = (singleRound(this.id,computerPlay()));\n if(roundResult.charAt(0) == 'C'){\n cWin++;\n round++;\n document.getElementById(\"cScore\").innerText =cWin;\n document.getElementById(\"roundNum\").innerText =round;\n }\n else if (roundResult.charAt(0) == 'P'){\n pWin++;\n round++;\n document.getElementById(\"pScore\").innerText = pWin;\n document.getElementById(\"roundNum\").innerText =round;\n }\n else {\n draw++;\n round++;\n document.getElementById(\"dScore\").innerText = draw;\n document.getElementById(\"roundNum\").innerText =round;\n }\n console.log('P:'+pWin + ' C:' + cWin + ' ' +roundResult);\n\n //game result\n if (cWin == 5){\n document.getElementById(\"message\").innerHTML = `Sorry, you lost. [Auto reset in 3 second]`;\n };\n if (pWin == 5){\n document.getElementById(\"message\").innerHTML = `Congratulations, you win. [Auto reset in 3 second]`;\n };\n\n if (cWin == 5 || pWin == 5) {\n setTimeout(() => { reset(); }, 3000);\n\n\n }\n\n\n \n}", "function playGame() {\n gameChoice();\n playerChoice();\n calculateResult();\n roundResult();\n incrementRoundScore();\n gameResult();\n incrementGameScore();\n winnerResult();\n}", "function newRound() {\n currentClue = random(clues);\n responsiveVoice.speak(currentClue);\n timer = 30 * 60;\n}", "function playRound(p1,p2){\r\n\r\n // 2 \r\n // Each player has name and getHand() properties.\r\n // they are assigned here so they get a new random # each iteration\r\n p1.hand = getHand();\r\n p2.hand = getHand();\r\n\r\n // console.log(p1, p2); //check that arguments came in correctly\r\n\r\n if(p1.hand === p2.hand){\r\n // console.log(\"It's a tie!\")\r\n p1.score.t++\r\n p2.score.t++\r\n }\r\n if(p1.hand === \"Rock\"){\r\n if(p2.hand === \"Paper\"){\r\n // console.log(p2.name + \" wins!\")\r\n p2.score.w++\r\n p1.score.l++\r\n }\r\n if(p2.hand === \"Scissors\"){\r\n // console.log(p1.name + \" wins!\")\r\n p1.score.w++\r\n p2.score.l++\r\n }\r\n }\r\n if(p1.hand === \"Paper\"){\r\n if(p2.hand === \"Scissors\"){\r\n // console.log(p2.name + \" wins!\")\r\n p2.score.w++\r\n p1.score.l++\r\n }\r\n if(p2.hand === \"Rock\"){\r\n // console.log(p1.name + \" wins!\")\r\n p1.score.w++\r\n p2.score.l++\r\n }\r\n }\r\n if(p1.hand === \"Scissors\"){\r\n if(p2.hand === \"Rock\"){\r\n // console.log(p2.name + \" wins!\")\r\n p2.score.w++\r\n p1.score.l++\r\n }\r\n if(p2.hand === \"Paper\"){\r\n // console.log(p1.name + \" wins!\")\r\n p1.score.w++\r\n p2.score.l++\r\n }\r\n }\r\n if(p1.score.w === 5){\r\n toFive = true;\r\n }\r\n if(p2.score.w === 5){\r\n toFive = true;\r\n }\r\n}", "function playRound(playerSelection, computerSelection){\n computerSelection = computerSelection.toLowerCase();\n let winner = false;\n\n //if statements for comparing, separate player wins for easier reading.\n //combined computer win for shorter code\n if ((playerSelection == \"rock\") && (computerSelection == \"scissors\")){\n message = \"You Win! Rock beats Scissors!\"\n winner = true;\n }\n else if ((playerSelection == \"paper\") && (computerSelection == \"rock\")){\n message = \"You Win! Paper covers Rock!\";\n winner = true;\n }\n else if ((playerSelection == \"scissors\") && (computerSelection == \"paper\")){\n message = \"You win! Scissors cut Paper!\";\n winner = true;\n }\n else {\n message = `You lose! ${computerSelection} beats ${playerSelection}`;\n winner = false;\n }\n if (winner){\n playerScore++;\n output.style.color = \"green\";\n }\n else {\n computerScore++;\n output.style.color = \"red\"; \n }\n if (playerScore >= 5){\n message =`You won!<br><br>Your score: ${playerScore} | Computer score: ${computerScore}<br>Press 'Play Game' to start a new round.`;\n rock.classList.toggle(\"hidden\");\n paper.classList.toggle(\"hidden\");\n scissors.classList.toggle(\"hidden\"); \n play.classList.toggle(\"attention\"); \n }\n else if (computerScore >= 5){ \n message =`You lost!<br><br>Your score: ${playerScore} | Computer score: ${computerScore}<br>Press 'Play Game' to start a new round.`;\n startGame = false;\n rock.classList.toggle(\"hidden\");\n paper.classList.toggle(\"hidden\");\n scissors.classList.toggle(\"hidden\");\n play.classList.toggle(\"attention\");\n }\n\n //displays winning message\n output.innerHTML = message;\n output.style.display = \"block\";\n //updates scores\n scoreUpdate();\n\n}", "function playRound (playerSelection) {\n \n \n computerSelection = computerPlay();\n\n // always uppercase\n playerSelection = playerSelection.toUpperCase();\n computerSelection = computerSelection.toUpperCase();\n\n\n // ROCK beats SCISSORS\n if (playerSelection == 'ROCK' && computerSelection == 'SCISSORS'){\n playerWon = 1;\n return `You won! ${playerSelection} beats ${computerSelection}!`;\n } else if (playerSelection == 'SCISSORS' && computerSelection == 'ROCK'){\n playerWon = 0;\n return `Drat! You lost! ${computerSelection} beats ${playerSelection}!`;\n } \n \n // SCISSORS beats PAPER\n else if (playerSelection == 'SCISSORS' && computerSelection == 'PAPER'){\n playerWon = 1;\n return `You won! ${playerSelection} beats ${computerSelection}!`;\n } else if (playerSelection == 'PAPER' && computerSelection == 'SCISSORS'){\n playerWon = 0;\n return `Drat! You lost! ${computerSelection} beats ${playerSelection}!`;\n } \n\n // PAPER beats ROCK\n else if (playerSelection == 'PAPER' && computerSelection == 'ROCK'){\n playerWon = 1;\n return `You won! ${playerSelection} beats ${computerSelection}!`;\n } else if (playerSelection == 'ROCK' && computerSelection == 'PAPER'){\n playerWon = 0;\n return `Drat! You lost! ${computerSelection} beats ${playerSelection}!`;\n } else {\n playerWon = -1;\n return 'Golly Jee-Willikers! It\\'s a tie!';\n }\n}", "function winGame() {\n flashColor();\n roundCount.innerHTML = \"WIN!\";\n power = false;\n win = true;\n startOver = setTimeout(() => {\n play();\n }, 5000);\n}", "function startGame() {\n //START THE FIRST ROUND\n console.log(\"Game will Begin\");\n randomColor();\n playPattern();\n if (round === 0) {\n update();\n }\n}", "function startNewGame() {\n\t\tif (userRoundScore > randomScore) {\n\t\t\tlosses++;\n\t\t\talert(\"Math is hard... You Lost. Try again!\");\n\t\t\tinitializeVariables();\n\t\t}\n\n\t\tif (userRoundScore == randomScore) {\n\t\t\twins++;\n\t\t\tinitializeVariables();\n\t\t\talert(\"Szechuan Sauce For All! You Win!\");\n\t\t}\n\t}", "function playRound(e) {\n let computerSelection = computerPlay();\n console.log(e.target.id);\n changeComputerImg(computerSelection);\n if (e.target.id == 'rock' && computerSelection === 'scissors') {\n game_status.textContent = `${playerName} wins! Rock beats Scissors`;\n countWinsPlayer++;\n score_name.lastElementChild.textContent = `${playerName}: ${countWinsPlayer}`;\n } else if (e.target.id == 'paper' && computerSelection === 'rock') {\n game_status.textContent = `${playerName} wins! Paper beats Rock`;\n countWinsPlayer++;\n score_name.lastElementChild.textContent = `${playerName}: ${countWinsPlayer}`;\n } else if (e.target.id == 'scissors' && computerSelection === 'paper') {\n game_status.textContent = `${playerName} wins! Scissors beats Paper`;\n countWinsPlayer++;\n score_name.lastElementChild.textContent = `${playerName}: ${countWinsPlayer}`;\n } else if (e.target.id == 'paper' && computerSelection === 'scissors') {\n game_status.textContent = `${playerName} Loses! Scissors beats Paper`;\n countWinsComputer++;\n computerScore.textContent = `Computer: ${countWinsComputer}`;\n } else if (e.target.id == 'rock' && computerSelection === 'paper') {\n game_status.textContent = `${playerName} Loses! Paper beats Rock`;\n countWinsComputer++;\n computerScore.textContent = `Computer: ${countWinsComputer}`;\n } else if (e.target.id == 'scissors' && computerSelection === 'rock') {\n game_status.textContent = `${playerName} Loses! Rock beats Scissors`;\n countWinsComputer++;\n computerScore.textContent = `Computer: ${countWinsComputer}`;\n } else {\n game_status.textContent = \"It's a tie\";\n return \"Tie\";\n }\n if (countWinsComputer == 5 || countWinsPlayer == 5) {\n for (let i = 0; i < playerSelection.length; i++) {\n playerSelection[i].disabled = true;\n }\n if (countWinsComputer > countWinsPlayer) {\n game_status.textContent = `Computer Wins by ${countWinsComputer} points`;\n } else if (countWinsComputer < countWinsPlayer) {\n game_status.textContent = `Woohoo! ${playerName} Wins by ${countWinsPlayer} points`;\n\n } else {\n game_status.textContent = \"It's a tie\";\n }\n }\n}", "function startRound() {\n printGameScreen();\n printPlayer(activePlayer)\n rl.question(\"Command: \", function(answer) {\n\n //draw phase\n //play hand phase\n //buy components\n //play action\n\n //if final person has reached then do the cycle update round\n\n //check to see if anyone has reached the winning amount\n\n\n //need to cycle between players\n\n if (/^[d]/.test(answer)) {\n console.log('someone pressed the d')\n players[activePlayer].drawCard(deck);\n playerActionCount++;\n }\n\n if (/^[x]/.test(answer)) {\n console.log('someone pressed x')\n let pred = answer.split(' ');\n let temp = pred[1];\n let cardsList = temp.split(\",\");\n var result = cardsList.map(function (x) {\n return parseInt(x, 10);\n });\n //need to draw that many cards for this player\n //error handling make sure not allowed take more than allowed\n\n players[activePlayer].board.exchangeForComponent(result);\n playerActionCount++;\n }\n\n if (/^[t]/.test(answer)) {\n let pred = answer.split(' ');\n let cardNum = pred[1];\n players[activePlayer].board.addNewTask(cardNum);\n playerActionCount++\n }\n\n if (answer == \"help\" || answer == \"h\") {\n console.log('>d //to draw a card');\n console.log('>x 1,2,3 //to exchange cards for components, the number in csv will be the number of the card in your hand');\n console.log('>t n // to add a card from your hand to the tasks');\n }\n\n if (answer == \"exit\"){\n rl.close();\n } else {\n if(playerActionCount == maxActionPerTurn) {\n activePlayer = nextPlayer(activePlayer);\n playerActionCount = 0;\n }\n\n\n\n startRound();\n }\n });\n}", "function startGame () {\n currentSnake.forEach(index => squares[index].classList.remove('snake'));\n squares[appleIndex].classList.remove('apple');\n clearInterval(interval);\n score = 0;\n randomApple();\n direction = 1;\n scoreDisplay.innerText = score;\n intervalTime = 1000;\n currentSnake = [2,1,0];\n currentIndex = 0;\n currentSnake.forEach(index => squares[index].classList.add('snake'));\n interval = setInterval(moveOutcomes, intervalTime);\n }", "function usePaper() {\n let aiChoice = aiTurn();\n let lastRound = comparator(1, aiChoice);\n endRound(aiChoice, lastRound);\n }", "function playRound(playerSelection, computerSelection) {\n if (playerSelection === computerSelection) {\n let outcome = \"Nobody wins!\"\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n } else if (playerSelection === \"paper\" && computerSelection === \"rock\") {\n let outcome = \"You win, paper beats rock!\"\n playerScore++\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n } else if (playerSelection === \"rock\" && computerSelection === \"paper\") {\n let outcome = \"You lose, paper beats rock!\"\n computerScore++\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n } else if (playerSelection === \"scissors\" && computerSelection === \"rock\") {\n let outcome = \"You lose, rock beats scissors!\"\n computerScore++\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n } else if (playerSelection === \"rock\" && computerSelection === \"scissors\") {\n let outcome = \"You win, rock beats scissors!\"\n playerScore++\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n } else if (playerSelection === \"paper\" && computerSelection === \"scissors\") {\n let outcome = \"You lose, scissors beat paper!\"\n computerScore++\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n } else {\n let outcome = \"You win, scissors beat paper!\"\n playerScore++\n round++\n displayResult(outcome,playerSelection,computerSelection,playerScore,computerScore,round)\n }\n}", "function playGame(){\n const userChoice = getUserChoice('paper');\n const computerChoice = getComputerChoice();\n console.log('You selected: ' + userChoice);\n console.log('The computer selected: ' + computerChoice);\n \n console.log(determineWinner(userChoice, computerChoice));\n }", "function game () {\n rockIconEle.addEventListener('click', () => {\n playerSelection = 'rock'\n round++\n roundNumberEle.textContent = 'Round: '+round\n playRound(playerSelection)\n declareWinner ()\n });\n paperIconEle.addEventListener('click', () => {\n playerSelection = 'paper'\n round++\n roundNumberEle.textContent = 'Round: '+round\n playRound(playerSelection)\n declareWinner ()\n });\n scissorsIconEle.addEventListener('click', () => {\n playerSelection = 'scissors'\n round++\n roundNumberEle.textContent = 'Round: '+round\n playRound(playerSelection)\n declareWinner ()\n });\n}", "function startGame(){\n\t$( \"#button_game0\" ).click(function() {selectGame(0)});\n\t$( \"#button_game1\" ).click(function() {selectGame(1)});\n\t$( \"#button_game2\" ).click(function() {selectGame(2)});\n\tloadRound();\n}", "function runGame() {\n randomizeNumbers();\n clearInterval(interval);\n let timeForRound;\n if (parseInt(document.getElementById(\"score\").innerText) <= 5) {\n timeForRound = 100;\n } else if (parseInt(document.getElementById(\"score\").innerText) <= 10) {\n timeForRound = 80;\n } else if (parseInt(document.getElementById(\"score\").innerText) <= 15) {\n timeForRound = 50;\n } else if (parseInt(document.getElementById(\"score\").innerText) <= 20) {\n timeForRound = 30;\n } else {\n timeForRound = 15;\n }\n runTimer(timeForRound); \n document.addEventListener(\"keydown\", checkChoiceForKeyboard, { once: true });\n let numbers = document.getElementsByClassName('number')\n for (let number of numbers) {\n number.addEventListener('click', checkChoiceForClick, {once: true});\n number.style.cursor = 'pointer';\n }\n \n}", "function playGame(square) {\n\n // Determine computers move (and play that move) --------- //\n\n function computerMove() {\n\n //If no strong moves are present, computer will move randomly\n \n var computerSquare = Math.ceil(Math.random() * 9);\n var corners = [1, 3, 7, 9];\n var counter = 0;\n \n // Lowest priorty: corner play --------- // \n \n for (var f = 0; f < 4; f++){\n if (takenSquares.indexOf(corners[f]) < 0) {\n computerSquare = corners[f];\n break;\n }\n }\n \n // Next up: play the center -------------- // \n \n for (var q = 0; q < 4; q++) {\n \n if (takenSquares.indexOf(corners[q]) > 0) {\n counter += 1;\n }\n if (counter == 4 && takenSquares.indexOf(5) < 0) {\n computerSquare = 5;\n }\n }\n \n // Higher priority: block the human --------- //\n \n for (var a = 0; a < 8; a++) {\n var winCheck = 0;\n var holder = 0;\n for (var b = 0; b < 3; b++) {\n if (humanMoves.indexOf(winningArray[a][b]) >= 0) {\n winCheck += 1;\n } else {\n holder = winningArray[a][b];\n }\n if (winCheck == 2 && holder > 0 && takenSquares.indexOf(holder) < 0) {\n computerSquare = holder;\n }\n }\n }\n \n\n\n if (takenSquares.indexOf(computerSquare) < 0) {\n computerSquare.toString();\n document.getElementById(computerSquare).innerHTML = pcIcon;\n takenSquares.push(computerSquare);\n pcMoves.push(computerSquare);\n gameOn();\n } else {\n computerMove();\n }\n\n }\n\n // Play human's move --------- //\n\n if (takenSquares.indexOf(parseInt(square)) < 0) {\n\n takenSquares.push(parseInt(square));\n humanMoves.push(parseInt(square));\n document.getElementById(square).innerHTML = playerIcon;\n gameOn();\n\n // Once user's move is played, wait .7 seconds then run computerMove --------- //\n\n if (winner === false) {\n var pcTimer = window.setTimeout(computerMove, 700);\n }\n\n } else {\n alert(\"That square is taken, choose another\");\n }\n\n }", "function startGame(){\n\t\tfor (var i=1; i<=9; i=i+1){\n\t\t\tclearBox(i);\n\t\t}\n\t\tdocument.turn = \"X\";\n\t\tif (Math.random()<0.5) {\n\t\t\tdocument.turn = \"O\";\n\t\t}\n\t\tdocument.winner = null;\n\t// This uses the \"setMessage\" function below in order to update the message with the contents from this function\n\t\tsetMessage(document.turn + \" gets to start.\");\n\t}", "function newRound() {\n if (round < 10) {\n selectedStories.shift();\n updateRound();\n hideFeedbackModal();\n enableAnswerBtns();\n startRound();\n } else {\n hideFeedbackModal();\n showGameSummaryModal();\n }\n}", "function addColorsGame(){\n\n var oneGame = 0\n var one2Game = 0\n var twoGame = 0\n var threeGame = 0\n var fiveGame = 0\n\n if (hoursGame === 1){\n \tvar oneGame = 1\n }\n if (hoursGame === 2){\n \tvar twoGame = 1\n }\n if (hoursGame === 3){\n \tvar threeGame = 1\n }\n if (hoursGame === 4){\n \tvar threeGame = 1\n \tvar one2Game = 1\n }\n if (hoursGame === 5){\n \tvar fiveGame = 1\n }\n if (hoursGame === 6){\n \tvar threeGame = 1\n \tvar twoGame = 1 \n \tvar one2Game = 1 \n }\n if (hoursGame === 7){\n \tvar oneGame = 1\n \tvar fiveGame = 1\n \tvar one2Game = 1\n }\n if (hoursGame === 8){\n \tvar threeGame = 1\n \tvar fiveGame = 1\n }\n if (hoursGame === 9){\n \tvar oneGame = 1\n \tvar one2Game = 1\n var twoGame = 1\n var fiveGame = 1\n }\n if (hoursGame === 10){\n \tvar twoGame = 1\n \tvar threeGame = 1\n \tvar fiveGame = 1\n }\n if (hoursGame === 11){\n \tvar oneGame = 1\n \tvar twoGame = 1\n \tvar threeGame = 1\n \tvar fiveGame = 1\n }\n if (hoursGame === 12){\n \tvar oneGame = 1\n \tvar one2Game = 1\n \tvar twoGame = 1\n \tvar threeGame = 1\n \tvar fiveGame = 1\n }\n\n\n\n\n\n\n\n \n\n\n if (minutesGame == 5){\n \tvar oneGame = oneGame + 2\n }\n if (minutesGame == 10 ){\n \tvar twoGame = twoGame + 2\n }\n if (minutesGame == 15 ){\n \tvar twoGame = twoGame + 2\n \tvar one2Game = one2Game + 2\n }\n if (minutesGame == 20 ){\n \tvar oneGame = oneGame + 2\n \tvar threeGame = threeGame + 2\n }\n if (minutesGame == 25 ){\n \tvar fiveGame = fiveGame + 2\n }\n if (minutesGame == 30 ){\n \tvar threeGame = threeGame + 2\n \tvar twoGame = twoGame + 2\n \tvar oneGame = oneGame + 2\n }\n if (minutesGame == 35 ){\n \tvar fiveGame = fiveGame + 2\n \tvar oneGame = oneGame + 2\n \tvar one2Game = one2Game + 2\n }\n if (minutesGame == 40 ){\n \tvar fiveGame = fiveGame + 2\n \tvar threeGame = threeGame + 2\n }\t\t\n if (minutesGame == 45 ){\n \tvar fiveGame = fiveGame + 2\n \tvar threeGame = threeGame + 2\n \tvar oneGame = oneGame + 2\n }\n if (minutesGame == 50 ){\n \tvar twoGame = twoGame + 2\n \tvar fiveGame = fiveGame + 2\n \tvar threeGame = threeGame + 2\n }\n if (minutesGame == 55 ){\n \tvar oneGame = oneGame + 2\n \tvar twoGame = twoGame +2\n \tvar threeGame = threeGame + 2\n \tvar fiveGame = fiveGame + 2\n }\n\n \n\n\n\n if (oneGame === 1){\n \tdocument.getElementById(\"oneGame\").style.background = \"red\";\n }\n if (oneGame === 2){\n \tdocument.getElementById(\"oneGame\").style.background = \"blue\";\n }\n if (oneGame === 3){\n document.getElementById(\"oneGame\").style.background = \"purple\";\n }\n\n\n if (one2Game === 1){\n document.getElementById(\"one2Game\").style.background = \"red\";\n }\n if (one2Game === 2){\n document.getElementById(\"one2Game\").style.background = \"blue\";\n }\n if (one2Game === 3){\n document.getElementById(\"one2Game\").style.background = \"purple\";\n }\n\n if (twoGame === 1){\n document.getElementById(\"twoGame\").style.background = \"red\";\n }\n if (twoGame === 2){\n document.getElementById(\"twoGame\").style.background = \"blue\";\n }\n if (twoGame === 3){\n document.getElementById(\"twoGame\").style.background = \"purple\";\n }\n\n if (threeGame === 1){\n document.getElementById(\"threeGame\").style.background = \"red\";\n }\n if (threeGame === 2){\n document.getElementById(\"threeGame\").style.background = \"blue\";\n }\n if (threeGame === 3){\n document.getElementById(\"threeGame\").style.background = \"purple\";\n }\n\n if (fiveGame === 1){\n document.getElementById(\"fiveGame\").style.background = \"red\";\n }\n if (fiveGame === 2){\n document.getElementById(\"fiveGame\").style.background = \"blue\";\n }\n if (fiveGame === 3){\n document.getElementById(\"fiveGame\").style.background = \"purple\";\n }\n\n\n\n\n\n\n console.log(\"one is \" +oneGame)\n console.log(\"one2 is \" +one2Game)\n console.log(\"two is \" +twoGame)\n console.log(\"three is \" +threeGame)\n console.log(\"five is \" +fiveGame)\n\n if (oneGame === 0){\n var random = Math.random();\n if (random < .33){\n document.getElementById(\"oneGame\").style.background = \"orange\";\n }\n if (random > .67){\n document.getElementById(\"oneGame\").style.background = \"yellow\";\n }\n if (random >.33 && random <.67){\n document.getElementById(\"oneGame\").style.background = \"green\";\n }\n }\n\n if (one2Game === 0){\n var random = Math.random();\n if (random < .33){\n document.getElementById(\"one2Game\").style.background = \"orange\";\n }\n if (random > .67){\n document.getElementById(\"one2Game\").style.background = \"yellow\";\n }\n if (random >.33 && random <.67){\n document.getElementById(\"one2Game\").style.background = \"green\";\n }\n }\n \n\n if (twoGame === 0){\n var random = Math.random();\n if (random < .33){\n document.getElementById(\"twoGame\").style.background = \"orange\";\n }\n if (random > .67){\n document.getElementById(\"twoGame\").style.background = \"yellow\";\n }\n if (random >.33 && random <.67){\n document.getElementById(\"twoGame\").style.background = \"green\";\n }\n }\n \n\n if (threeGame === 0){\n var random = Math.random();\n if (random < .33){\n document.getElementById(\"threeGame\").style.background = \"orange\";\n }\n if (random > .67){\n document.getElementById(\"threeGame\").style.background = \"yellow\";\n }\n if (random >.33 && random <.67){\n document.getElementById(\"threeGame\").style.background = \"green\";\n }\n }\n \n\n if (fiveGame === 0){\n var random = Math.random();\n if (random < .33){\n document.getElementById(\"fiveGame\").style.background = \"orange\";\n }\n if (random > .67){\n document.getElementById(\"fiveGame\").style.background = \"yellow\";\n }\n if (random >.33 && random <.67){\n document.getElementById(\"fiveGame\").style.background = \"green\";\n }\n }\n }" ]
[ "0.76948947", "0.74845207", "0.7479477", "0.7396535", "0.7344169", "0.72763824", "0.72435963", "0.72267437", "0.71683156", "0.7131276", "0.7111724", "0.7070816", "0.7066701", "0.70108277", "0.69837713", "0.69166803", "0.6896058", "0.68894935", "0.68469155", "0.6834712", "0.6832454", "0.6796504", "0.6773083", "0.67710376", "0.6768198", "0.67278737", "0.6722538", "0.67207706", "0.66995424", "0.6699435", "0.6698602", "0.66975224", "0.66911435", "0.66850346", "0.6679037", "0.6660055", "0.66388184", "0.6638384", "0.6614848", "0.66095304", "0.6605634", "0.6592809", "0.65904963", "0.6580761", "0.65798587", "0.6570878", "0.6555514", "0.6555495", "0.6540555", "0.6538108", "0.6528553", "0.652194", "0.65143037", "0.6510168", "0.6509774", "0.65078616", "0.65073425", "0.6503481", "0.6502299", "0.6500212", "0.6499487", "0.6494456", "0.6493121", "0.64839894", "0.64768255", "0.6473616", "0.6456212", "0.6455742", "0.6453969", "0.6448009", "0.64448345", "0.6439317", "0.64271575", "0.6425117", "0.6422523", "0.64175105", "0.64167315", "0.6413158", "0.6411534", "0.6409313", "0.64055085", "0.6401841", "0.6400287", "0.6394733", "0.6391699", "0.63901234", "0.63855416", "0.6380567", "0.63676304", "0.63668823", "0.63585603", "0.6349841", "0.6342972", "0.6340673", "0.63400906", "0.63369364", "0.6335689", "0.6335298", "0.633283", "0.63314116" ]
0.7215968
8
compare user and computer choice
function playRound(playerSelection, computerSelection) { playerSelection = userChoice; computerSelection = computerChoice; let playerWin; switch (playerSelection){ case computerSelection: playerWin = 3; break; case "rock": if (computerSelection == "scissors"){ playerWin = 1; } else if (computerSelection == "paper"){ playerWin = 2; } break; case "paper": if (computerSelection == "rock"){ playerWin = 1; } else if (computerSelection == "scissors"){ playerWin = 2; } break; case "scissors": if (computerSelection == "paper"){ playerWin = 1; }else if (computerSelection == "rock"){ playerWin =2; } break; } switch(playerWin){ case 1: round.textContent = `You win! ${playerSelection} beats ${computerSelection}.`; return playerWin; break; case 2: round.textContent = `You loose! ${computerSelection} beats ${playerSelection}`; return playerWin; break; case 3: round.textContent = `WOW! ${playerSelection} vs ${computerSelection} it's a draw!`; return playerWin; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareChoices(userSelection, computerSelection) {\n clearPreviousAlerts();\n\n if (rounds < 5) {\n rounds++;\n }\n\n if (userSelection === computerSelection) {\n $(\".tie\").show();\n ties++;\n } else if (\n (userSelection === \"rock\" && computerSelection === \"scissors\") ||\n (userSelection === \"scissors\" && computerSelection === \"paper\") ||\n (userSelection === \"paper\" && computerSelection === \"rock\")\n ) {\n playerWins++;\n computerLosses++;\n $(\"#player-success\").show();\n $(\"#computer-failure\").show();\n } else {\n playerLosses++;\n computerWins++;\n $(\"#player-failure\").show();\n $(\"#computer-success\").show();\n }\n\n // console.log(\"user: \" + userSelection);\n // console.log(\"computer: \" + computerSelection);\n console.log(\"Wins: \" + playerWins);\n console.log(\"Losses: \" + playerLosses);\n console.log(\"Ties: \" + ties);\n console.log(\"Rounds: \" + rounds);\n printResults();\n}", "function decidePlayerOrComputer() {\r\n choiceComputerPlayer = this.value;\r\n}", "function validateChoice() {\n if (userChoice !== \"r\" && userChoice !== \"p\" && userChoice !== \"s\") {\n alert(\"pick a either r, p , or s\")\n getUserChoice();\n } else {\n generateComputerChoice();\n compareAnswer();\n }\n}", "function game (userChoice) {\n //this is to get the computer choice (see function above!)\n const computerChoice = getComputerChoice();\n}", "function game(userChoice){\n // console.log(`clicked ${userChoice}`)\n getCompChoice()\n\n const computerChoice = getCompChoice();\n // console.log(computerChoice);\n\n switch(userChoice + computerChoice){\n // the options for winning as shown as the letters that you and the comp select to be compared later\n case 'rs':\n case 'rl':\n case 'sl':\n case 'sp':\n case 'pa':\n case 'pr':\n case 'la':\n case 'lp':\n case 'ar':\n case 'as':\n // console.log(\"you win\")\n win(userChoice, computerChoice);\n break;\n // the options for losing as shown as the letters that you and the comp select to be compared later\n case 'rp':\n case 'ra':\n case 'ps':\n case 'pl':\n case 'sa':\n case 'sr':\n case 'lr':\n case 'ls':\n case 'al':\n case 'ap':\n // console.log('you lost')\n lose(userChoice, computerChoice);\n break;\n // the options for a tie to be compared later \n case 'rr':\n case 'll':\n case 'ss':\n case 'pp':\n case 'aa':\n // console.log('its a tie')\n tie(userChoice, computerChoice)\n break;\n }\n}", "function check(computer, user) {\n var result\n \n if (computer == 'rock' && user == 'rock') {\n result = 'draw'\n } \n else if(computer == 'rock'&& user == 'paper') {\n result = 'win'\n } \n else if(computer == 'rock' && user == 'scissors') {\n result = 'lose'\n }\n else if (computer == 'paper' && user == 'rock') {\n result = 'lose'\n } \n else if(computer =='paper' && user == 'paper') {\n result = 'draw'\n } \n else if(computer == 'paper' && user == 'scissors') {\n result = 'win'\n }\n else if (computer == 'scissors' && user == 'rock') {\n result = 'win'\n }\n else if(computer =='scissors' && user == 'paper') {\n result = 'lose'\n }\n else {\n result = 'draw'\n }\n console.log('Computer choose ' + computer + '. You chose ' + user)\n console.log('You ' + result)\n \n showResult(computer, user, result);\n}", "function compare(userChoice, cpuChoice) {\n\tvar indexUser =\tchoices.indexOf(userChoice)+1;\n\tvar indexCpu = choices.indexOf(cpuChoice)+1;\n\n\tif (indexUser !== 0){\n\t\tif (indexUser-indexCpu === 1 || (indexUser === 1 && indexCpu === 3)){\n\t\t\treturn 'You are';\n\t\t}\n\t\telse if (indexCpu === indexUser){\n\t\t\treturn 'Tie! Nobody is'\n\t\t}\n\t\telse{\n\t\t\treturn 'CPU is';\n\t\t}\n\t}\n}", "function computerChoice() {\n \t//The function computerChoice assigns the random number which the computer generated to be either rock, paper, or scissors\n \tif (randNumber <= 33) {\n \t\tcompChoice=1;\n \t\t//If the variable randNumber is less than 33, the computer chooses rock\n \t} else if (randNumber <= 66) {\n \t\tcompChoice=2;\n \t\t//If the variable randNumber is less than 66, the computer chooses paper\n \t} else if (randNumber <=100) {\n \t\tcompChoice=3;\n \t\t//If the variable randNumber is less than 100, the computer chooses scissors\n \t}\n\tcompare();\n }", "function chooseWinner(user, computer) {\n if (user === computer) {\n return \"draw\";\n } else if (\n (user === \"paper\" && computer === \"rock\") ||\n (user === \"scissors\" && computer === \"paper\") ||\n (user === \"rock\" && computer === \"scissors\")\n ) {\n return \"win\";\n } else {\n return \"loose\";\n }\n}", "function compareAnswer() {\n if (userChoice === compChoice) {\n alert(\"Tie!\")\n } else if ((userChoice === \"r\" && compChoice === \"s\") || (userChoice === \"s\" && compChoice === \"p\") || (userChoice === \"p\" && compChoice === \"r\")) {\n alert(\"Winner!\")\n }\n else {\n alert(\"Loser!\")\n }\n}", "function makeComputerChoice() {\n \n \n \n return computerChoice;\n}", "function selections() {\n let userChoice = prompt(\"Rock, Paper, or Scissors\");\n\n let computerChoice = Math.random();\n\n if(computerChoice<=0.33){\n computerChoice = \"rock\";\n } else if (0.34<=computerChoice <= 0.66){\n computerChoice = \"paper\";\n } else {\n computerChoice = \"scissors\";\n }\n\n choice1 = userChoice\n choice2 = computerChoice\n\n}", "function getUserChoice() {\n userChoice = prompt(\"choose R, P or S\");\n userChoice = userChoice.toLowerCase();\n validateChoice();\n}", "function checkResult(playerChoice) {\r\n resetSelected()\r\n computerRandomChoice()\r\n displayComputerChoice()\r\n updateScore(playerChoice)\r\n}", "function compareValues (userSelection, computerSelection){\r\n \r\n $(\".test\").hide();\r\n if(userSelection === 'rock') {\r\n \r\n if(computerSelection === 'rock') {\r\n console.log('Tie');\r\n $(\"#tie\").show(\"slow\");\r\n \r\n\r\n } else if (computerSelection === 'paper') {\r\n console.log( 'computer is the winner ');\r\n $(\"#lose\").show();\r\n } else if (computerSelection === 'scissors') {\r\n console.log( ' you are the winner');\r\n $(\"#win\").show(\"slow\");\r\n }\r\n\r\n \r\n } else if (userSelection === 'paper') {\r\n \r\n if(computerSelection === 'paper') {\r\n console.log('Tie');\r\n $(\"#tie\").show(\"slow\");\r\n } else if (computerSelection === 'rock') {\r\n console.log('you are the winner');\r\n $(\"#win\").show(\"slow\");\r\n } else if (computerSelection === 'scissors') {\r\n console.log('computer is the winner');\r\n $(\"#lose\").show(\"slow\");\r\n }\r\n }\r\n\r\n else if (userSelection === 'scissors') {\r\n \r\n if(computerSelection === 'scissors') {\r\n console.log('Tie');\r\n $(\"#tie\").show(\"slow\");\r\n } else if (computerSelection === 'paper') {\r\n console.log('you are the winner');\r\n $(\"#win\").show(\"slow\");\r\n } else if (computerSelection === 'rock') {\r\n console.log ('computer is the winner');\r\n $(\"#lose\").show(\"slow\");\r\n \r\n }\r\n }\r\n \r\n\r\n }", "function game(userChoice){\r\n const computerChoice = getComputerChoice()\r\n switch(userChoice + computerChoice){\r\n case \"rockscissor\":\r\n case \"paperrock\":\r\n case \"scissorpaper\":\r\n win(userChoice, computerChoice);\r\n break;\r\n\r\n case \"paperscissor\":\r\n case \"scissorrock\":\r\n case \"rockpaper\":\r\n lost(userChoice , computerChoice);\r\n break;\r\n\r\n case \"paperpaper\":\r\n case \"rockrock\":\r\n case \"scissorscissor\":\r\n draw(userChoice, computerChoice);\r\n break;\r\n }\r\n}", "function startUp(userInput) { \nvar compuServe = computerChoice();\n \n if (compuServe === userInput) \n { \n result = document.getElementById('result').innerHTML = \"A tie is better than nothing\";\n \n }\n else if (userInput === \"Rock\") \n {\n if (compuServe === \"Paper\") \n {\n result = document.getElementById('result').innerHTML = \"You Lost\";\n\n \n }\n else \n {\n result = document.getElementById('result').innerHTML = \"You Won\";\n\n }\n } \n else if (userInput === \"Paper\") \n { \n \n if (compuServe === \"Scissor\") \n {\n result = document.getElementById('result').innerHTML = \"You Lost\";\n \n\n }\n else \n {\n result = document.getElementById('result').innerHTML = \"You Won\";\n\n } \n } \n else if (userInput === \"Scissor\") \n {\n if (compuServe === \"Rock\") \n {\n result = document.getElementById('result').innerHTML = \"You Lost\";\n\n }\n else \n {\n result = document.getElementById('result').innerHTML = \"You Won\";\n \n\n }\n }\n document.getElementById('you').innerHTML = userInput;\n document.getElementById('computer').innerHTML = compuServe;\n counter();\n \n\n \n}", "function choiceFunc (choice) {\n let cpu = rockPaperScissor()\n if (choice === cpu) {\n console.log(`Its a draw! CPU:${cpu} YOU:${choice}`)\n } else if ((choice === \"rock\" && cpu === \"paper\") || (choice === \"paper\" && cpu === \"rock\") || (choice === \"scissor\") && cpu === \"paper\") {\n console.log(`YOU win! CPU:${cpu} YOU:${choice}`)\n } else {\n console.log(`CPU win! CPU:${cpu} YOU:${choice}`)\n }\n}", "function getResult(userPicked) {\n\n\n if (userPicked === computerPicked) {\n result = 'The game is a draw!';\n } else {\n if (userPicked === ' rock' && (computerPicked === ' scissors' || computerPicked === ' lizard')) {\n result = ' You win!'\n } else if (userPicked === ' paper' && (computerPicked == ' rock' || computerPicked == ' spock')) {\n result = ' You win!'\n } else if (userPicked === ' scissors' && (computerPicked == ' paper' || computerPicked == ' lizard')) {\n result = ' You win!'\n } else if (userPicked === ' lizard' && (computerPicked == ' spock' || computerPicked == ' paper')) {\n result = ' You win!'\n } else if (userPicked === ' spock' && (computerPicked == ' scissors' || computerPicked == ' rock')) {\n result = ' You win!'\n } else {\n result = ' You lose!'\n }\n }\n\n userPick(userPicked);\n computerPick(computerPicked);\n gameResult(result);\n return result;\n}", "function playRound(){\r\n let computerSelection = computerPlay()\r\n let userSelection = prompt(\"Choose your weapon for this round (Type rock, paper or scisssors)\").toLowerCase()\r\n if(computerSelection == userSelection ){\r\n \"Tie!\"\r\n }else{\r\n checkWinner(computerSelection, userSelection)\r\n }\r\n}", "function RockPaperScissors(userChoice){\n var computer = 1 + Math.floor((Math.random()*3));\n if ((userChoice === 1 && computer === 2) || (userChoice === 2 && computer === 3) || (userChoice === 3 && computer === 1)){\n console.log('Sorry, the computer wins!')}\n if ((userChoice === 2 && computer === 1) || (userChoice === 3 && computer === 2) || (userChoice === 1 && computer === 3)){\n console.log('You win!')}\n if (userChoice === computer){\n console.log('Its a tie!') }\n}", "function results(){\n if(computerChosen === userChosen){\n return result = \"It's a Tie!!!\"\n }\n else if(computerChosen === 'rock' && userChosen === 'paper'){\n return result = won\n }\n else if(computerChosen === 'rock' && userChosen === 'scissors'){\n return result = lost\n\n }\n else if(computerChosen === 'paper' && userChosen === 'rock'){\n return result = lost\n\n }\n else if(computerChosen === 'paper' && userChosen === 'scissors'){\n return result = won\n\n }\n else if(computerChosen === 'scissors' && userChosen === 'rock'){\n return result = won\n\n }\n else if(computerChosen === 'scissors' && userChosen === 'paper'){\n return result = lost\n\n }\n}", "function playRound(playerSelection, computerSelection)\n{\n //this is how TOP suggested i do things\n playerSelection = playerSelection.toLowerCase();\n computerSelection = computerSelection.toLowerCase();\n\n if(playerSelection == computerSelection)\n {\n return \"You tied the computer!\";\n }\n else if((playerSelection == \"rock\" && computerSelection == \"scissors\") ||\n (playerSelection == \"scissors\" && computerSelection == \"paper\") ||\n (playerSelection == \"paper\" && computerSelection == \"rock\"))\n {\n return \"You win! \" + playerSelection + \" beats \" + computerSelection;\n }\n else\n {\n return \"You lose! \" + computerSelection + \" beats \" + playerSelection;\n }\n}", "function game (userSelection){\r\n // message to display user choice\r\n userOption.innerHTML = \"Your selection is: \" + userSelection \r\n // getting computer choice \r\n let computerSelection = getcomputerSelection();\r\n // display computer choice\r\n compOption.innerHTML = \"Computer selection is: \" + computerSelection\r\n\r\n //defining situation and calling win , loss or draw function\r\n if ( userSelection == \"rock\" && computerSelection ==\"scissor\" || userSelection\r\n == \"paper\" && computerSelection == \"rock\" || userSelection == \"scissor\" &&\r\n computerSelection ==\"paper\"){\r\n // call win function if user win\r\n userWin(userSelection,computerSelection);\r\n \r\n }\r\n else if( userSelection == \"rock\" && computerSelection == \"paper\" || userSelection\r\n == \"paper\"&& computerSelection==\"scissor\" || userSelection ==\"scissor\" && \r\n computerSelection ==\"rock\"){\r\n // call loss function if computer win\r\n computerWin(userSelection,computerSelection);\r\n\r\n }\r\n\r\n else if( userSelection ==\"rock\" && computerSelection ==\"rock\" || userSelection\r\n ==\"paper\"&& computerSelection==\"paper\" || userSelection == \"scissor\"&& computerSelection\r\n == \"scissor\" ) {\r\n // call gamedraw function if game draws\r\n gameDraw(userSelection,computerSelection);\r\n }\r\n\r\n \r\n else {\r\n console.log(\"select appropriate option !\");\r\n }\r\n\r\n \r\n \r\n\r\n }", "function checkWinner() {\n\n // Select any random icon \n const computerChoice = pickRandomChoice();\n \n // Display user and computer choice\n updateSelection(user_select, userChoice);\n updateSelection(computer_select, computerChoice);\n\n //GAME RULES \n // Draw game if user and computer have the same choice\n if(userChoice === computerChoice){ \n winner.innerText = 'draw';\n }\n\n // Check if User Win \n else if(\n (userChoice === 'paper' && computerChoice === 'rock') || (userChoice === 'rock' && computerChoice === 'scissors')\n ||\n (userChoice === 'scissors' && computerChoice === 'paper')\n ) {\n // Display User Win\n updateScore();\n winner.innerText = 'you win';\n }\n \n // Else Computer Win\n else {\n \n // Display User Lost\n updateComscore();\n winner.innerText = 'you loss';\n }\n}", "function determineWinner(userChoice, computerChoice){\n if(userChoice === computerChoice){\n return \"tie!\";\n };\n if(userChoice === \"rock\"){\n if(computerChoice === \"paper\"){\n return \"computer won!!!\";\n } else {\n return \"You won!\";\n }\n }\n if(userChoice === \"paper\"){\n if(computerChoice === \"scissors\"){\n return \"computer won!\";\n } else {\n return \"you suck lmao\";\n }\n }\n if(userChoice === \"scissors\"){\n if(computerChoice === \"rock\"){\n return \"computer won a!\"\n } else {\n return \"yes u won!\"\n }\n }\n if(userChoice === \"bomb\"){\n return \"holy shit stop cheating!\";\n }\n }", "defineComputerChoice() {\n let computerChoice = Math.random()\n if (computerChoice < 0.34) {\n this.props.setChoice(COMPUTER_CHOICE, Constants.ROCK)\n } else if (computerChoice <= 0.67) {\n this.props.setChoice(COMPUTER_CHOICE, Constants.PAPER)\n } else {\n this.props.setChoice(COMPUTER_CHOICE, Constants.SCISSORS)\n }\n }", "function playerChoice() {\n \n let choice = prompt(\"Make a decision: \")\n \n // make player decision case sensitive (RoCK, paper, SCISSOR).\n // and test the input of validity\n \n if (choice.toLowerCase() == \"rock\" || choice.toLowerCase() == \"paper\" || choice.toLowerCase() == \"scissor\") {\n \n return choice.toLowerCase();\n } else {\n\n alert(\"wrong decision\");\n }\n}", "function runGame(userChoice){\n const computerChoice = getCompChoice();\n\n //compares the users and computers choice and calls the appropriate function\n switch(userChoice+computerChoice){\n case \"rs\":\n case \"pr\":\n case \"sp\":\n win(userChoice,computerChoice);\n break;\n case \"rp\":\n case \"ps\":\n case \"sr\":\n lose(userChoice,computerChoice);\n break;\n case \"rr\":\n case \"pp\":\n case \"ss\":\n draw(userChoice,computerChoice);\n break; \n }\n}", "function computerChoice(){\n\t//random choice\n\tvar computerMove=Math.floor(Math.random() * 3) + 1 \n\tif (computerMove==1){\n\t\tcomputerMove='rock';\n\t} else if (computerMove==2){\n\t\tcomputerMove='scissors';\n\t} else {\n\t\tcomputerMove='paper';\n\t}\n\t//computer strategy\n\tif(user.moves.length>=4){\n\t\tif(user.moves[(user.moves.length)-1].move == user.moves[(user.moves.length)-2].move && user.moves[(user.moves.length)-2].move == user.moves[(user.moves.length)-3].move && user.moves[(user.moves.length)-3].move==user.moves[(user.moves.length)-4].move)\n\t\t\tif (user.move=='rock'){\n\t\t\t\tcomputerMove='paper';\n\t\t\t}else if (user.move=='paper'){\n\t\t\t\tcomputerMove='scissors';\n\t\t\t}else if (user.move=='scissors'){\n\t\t\t\tcomputerMove='rock';\n\t\t\t}\n\t}\n\treturn computerMove;\n\t\n}", "function computerSelection() {\n\tlet choices = [\"paper\", \"rock\", \"scissor\"];\n\n\tlet randomChoice = choices[Math.floor(Math.random() * choices.length)];\n\n\t//console.log(\"Computer choice is : \" + randomChoice);\n\treturn randomChoice;\n}", "function getComputerChoice(){\n\tconst choices = ['ro','pa','sc'];\n\tconst randomNumber = Math.floor(Math.random() * 3)\n\treturn choices[randomNumber];\n}", "function getPlayerChoice() \n {\n \tconst CHOICES = [\"rock\", \"paper\", \"scissors\"];\n \tlet choice;\n \tvar isValid = false;\n\n \t// Asks player to type a choice, and converts to lowercase for comparison\n \tdo {\n \t\tchoice = prompt(\"Rock, paper, or scissors?\").toLowerCase();\n\n \t\t// Cycles through CHOICES array to check for valid player response\n \t\tfor (var i = 0; i < CHOICES.length; i++)\n \t\t{\n \t\t\tif (choice === CHOICES[i])\n \t\t\t{\n \t\t\t\tisValid = true;\n \t\t\t}\n \t\t}\n \t}\n \twhile(!isValid);\n\n \treturn choice;\n }", "function game(userChoice){\n const computerChoice = getComputerChoice();\n switch (userChoice + computerChoice){\n case \"pici\":\n case \"papi\":\n case \"cipa\":\n console.log(\"choix du joueur => \" + userChoice);\n console.log(\"choix de l'ordi => \" + computerChoice);\n document.getElementById(\"quiGagne\").textContent = \"Gooood !\";\n break;\n case \"pipa\":\n case \"paci\":\n case \"cipi\":\n console.log(\"choix du joueur => \" + userChoice);\n console.log(\"choix de l'ordi => \" + computerChoice);\n document.getElementById(\"quiGagne\").textContent = \"Bowser gagne !!\";\n break;\n case \"pipi\":\n case \"papa\":\n case \"cici\":\n console.log(\"choix du joueur => \" + userChoice);\n console.log(\"choix de l'ordi => \" + computerChoice);\n document.getElementById(\"quiGagne\").textContent = \"Match nul ...\";\n break;\n }\n}", "function playRound(userSelection, computerSelection) {\n userSelection = userSelection.toLowerCase();\n // if its a tie\n if (userSelection == computerSelection) {\n console.log(\"It's a tie\");\n }\n // if the user wins \n else if (userSelection == 'rock' && computerSelection == 'scissors' ||\n userSelection == 'paper' && computerSelection == 'rock' ||\n userSelection == 'scissors' && computerSelection == 'paper')\n {\n userCount++;\n console.log(`You Win! ${userSelection} beats ${computerSelection}, You: ${userCount} : ${computerCount} Computer`);\n }\n // if computer wins\n else {\n computerCount++;\n console.log(`You Lose! ${computerSelection} beats ${userSelection}. You: ${userCount} : ${computerCount} Computer`);\n }\n}", "function rpcGame (userChoice) {\n const rpc = Math.random();\n\nif (rpc < 0.34) {\n compChoice = \"Rock\";\n} else if (rpc < 0.67) {\n compChoice = \"Paper\";\n} else {\n compChoice = \"Scissors\";\n}\n if (userChoice === \"Rock\" && compChoice === \"Scissors\" || userChoice === \"Paper\" && compChoice === \"Rock\" || userChoice === \"Scissors\" && compChoice === \"Paper\") {\n return \"you win!\";\n } else if (userChoice === \"Rock\" && compChoice === \"Paper\" || userChoice === \"Scissors\" && compChoice === \"Rock\" || userChoice === \"Paper\" && compChoiceq === \"Scissors\"){\n return \"You lose.\";\n } else if (userChoice === \"Rock\" && compChoice === \"Rock\" || userChoice === \"Paper\" && compChoice === \"Paper\" || userChoice === \"Scissors\" && compChoice === \"Scissors\") {\n return \"It's a tie.\";\n }\n}", "function myfunction(){\r\n\t\t\tvar user = prompt('choose any random number')\r\n\t\t\tvar ran\r\n\t\t\tvar computer=Math.random();\r\n\t\t\tif (computer<0.34){\r\n\t\t\t\tcomputer=\"HUMAN\";\r\n\r\n\t\t\t}\r\n\t\t\telse if (computer<=0.67){\r\n\t\t\t\tcomputer=\"COCKROACH\";\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tcomputer=\"NUCLEAR BOMB\";\r\n\t\t\t}\r\n\t\t\talert(\"computer chooseS:\" + computer)\r\n\t\t\tvar ran = Math.floor(Math.random()*Math.floor(1000))\r\n\t\t\tvar remainder = ran %3;\r\n\t\t\tif (remainder==0){\r\n\t\t\t\tuser='Human'\r\n\t\t\t}\r\n\t\t\telse if (remainder ==1){\r\n\t\t\t\tuser='Cockroach'\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tuser='Nuclear Bomb'\r\n\t\t\t}\r\n\t\t\tcheck(computer,user)\r\n\t\t}", "function getUserChoice() {\n const selectId = \"select\";\n const userWatching = \"userWatching\";\n const userLeft = \"userLeft\";\n\n let selectObj = document.getElementById(selectId);\n document.getElementById(\"log\").innerText = \"\";\n if (selectObj.value == userWatching) {\n promise(true, false);\n }\n if (selectObj.value == userLeft) {\n promise(false, true);\n }\n}", "function getComputerChoice() \n {\n \tconst CHOICES = [\"rock\", \"paper\", \"scissors\"];\n\n \tconst choice = Math.floor(Math.random() * CHOICES.length);\n\n \treturn CHOICES[choice];\n }", "function playRound(userChoice, computerChoice) {\n if (userChoice === computerChoice) {\n console.log(\n `It\\'s a Tie! You chose ${userChoice} and Computer chose ${computerChoice} `\n );\n } else if (\n (userChoice === \"rock\" && computerChoice === \"scissors\") ||\n (userChoice === \"paper\" && computerChoice === \"rock\") ||\n (userChoice === \"scissors\" && computerChoice === \"paper\")\n ) {\n console.log(`You Win! ${userChoice} beats ${computerChoice}`);\n return \"win\";\n } else if (\n (userChoice === \"scissors\" && computerChoice === \"rock\") ||\n (userChoice === \"rock\" && computerChoice === \"paper\") ||\n (userChoice === \"paper\" && computerChoice === \"scissors\")\n ) {\n console.log(`You Lose! ${userChoice} lost to ${computerChoice}`);\n return \"lose\";\n }\n}", "function getComputerChoice(){\n const choices = ['r','p','s'];\n const randomSelection = (Math.floor(Math.random() * 3));\n return choices [randomSelection];\n }", "function game(userChoice) {\r\n // get computer choice\r\n const computerChoice = getComputerChoice();\r\n\r\n\r\n // Compare user and computer\r\n // switch (computerChoice) {\r\n // case computerChoice.losesTo === userChoice:\r\n // win(userChoice, computerChoice.choice);\r\n // break;\r\n // case computerChoice.beats === userChoice:\r\n // lose(userChoice, computerChoice.choice);\r\n // break;\r\n // default:\r\n // draw(userChoice, computerChoice.choice);\r\n // break;\r\n // }\r\n if (computerChoice.losesTo.includes(userChoice)) {\r\n win(userChoice, computerChoice.choice);\r\n } else if (computerChoice.beats.includes(userChoice)) {\r\n lose(userChoice, computerChoice.choice);\r\n } else {\r\n draw(userChoice, computerChoice.choice);\r\n }\r\n}", "check(user_choice){\n return user_choice === this.answer;\n }", "function checkIfComputerTurn() {\n\t\tif (playerOne.computer && currentPlayer() == playerOne) {\n\t\t\tcheckComputerChoice();\n\t\t}\n\t}", "function game(userChoice) {\r\n const computerChoice = getCompChoice();\r\n switch (userChoice + computerChoice) {\r\n case \"rs\":\r\n case \"pr\":\r\n case \"sp\":\r\n win(userChoice, computerChoice);\r\n break;\r\n case \"sr\":\r\n case \"rp\":\r\n case \"ps\":\r\n lose(userChoice, computerChoice);\r\n break;\r\n case \"rr\":\r\n case \"pp\":\r\n case \"ss\":\r\n draw(userChoice, computerChoice);\r\n break;\r\n }\r\n}", "function userScissors() {\n userChoiceword = \"scissors\";\n if (computerChoiceword == \"scissors\")\n {\n //Function for a user tie result.\n tie();\n resultTied();\n }\n else if (computerChoiceword == \"paper\")\n {\n //Function for a user win result.\n userWins();\n resultWin();\n }\n else if (computerChoiceword == \"rock\")\n {\n //Function for a user lose result.\n computerWins();\n resultLose();\n }\n }", "function computerSelection() {\n computerChoicenumber = Math.floor(Math.random() * 3) + 1;\n computerChoiceword = \"\";\n\n if (computerChoicenumber == 1)\n {\n computerChoiceword = \"rock\";\n }\n else if (computerChoicenumber == 2)\n {\n computerChoiceword = \"paper\";\n }\n else if (computerChoicenumber == 3)\n {\n computerChoiceword = \"scissors\";\n }\n }", "function getComputerChoice() {\n\treturn options[Math.min(Math.floor((Math.random() * 3)), 2)];\n}", "function getComputerChoice() {\n\n let computerPicked = Math.ceil(Math.random() * 5);\n\n if (computerPicked === 1) {\n return \"rock\";\n } else if (computerPicked === 2) {\n return \"paper\";\n } else if (computerPicked === 3) {\n return \"scissors\";\n } else if (computerPicked === 4) {\n return \"lizard\";\n } else if (computerPicked === 5) {\n return \"spock\";\n } else {\n return \"error\";\n }\n}", "function getcomputerSelection(){\r\n // defining array with 3 option\r\n let compSelect = [\"rock\",\"paper\",\"scissor\"];\r\n // using inbuit function to getting random choice \r\n let randomChoice = Math.floor(Math.random()*3);\r\n // getting single return value from array of selection\r\n return compSelect[randomChoice];\r\n\r\n }", "function getUserChoice() {\n var userInputChoice = prompt('scegli fra pari o dispari');\n if (userInputChoice === 'pari' || userInputChoice === 'dispari') {\n return userInputChoice;\n } else {\n alert('errore dati inseriti Non validi');\n }\n}", "function game(userChoice) {\n const computerChoice = getComputerChoice();\n\n // similar to if and else if statements but more efficient for branching\n switch(userChoice + computerChoice) {\n /* cases where user wins */\n case \"rs\":\n case \"pr\":\n case \"sp\":\n ///give choices as parameters so user can see what they and the comp selected\n win(userChoice, computerChoice);\n //always need a break to escape the loop\n break;\n \n /* cases where user loses */\n case \"rp\":\n case \"ps\":\n case \"sr\":\n lose(userChoice, computerChoice);\n break;\n\n /* cases with ties between user and cpu */\n case \"rr\":\n case \"pp\":\n case \"ss\":\n draw (userChoice, computerChoice);\n break;\n\n\n }\n\n}", "function compare(you, machine){\n\n var verdict = 'lose';\n\n if ( you == machine ) {\n var verdict = 'draw';\n }\n\n if ((you == \"Rock\") && (machine == \"Scissors\")) {\n verdict = 'win';\n }\n\n if ((you == \"Paper\") && (machine ==\"Rock\")) {\n verdict = 'win';\n }\n\n if ((you == \"Scissors\") && (machine ==\"Paper\")) {\n verdict = 'win';\n }\n\n if ( verdict == 'win') {\n won++;\n $(\"#game_won\").text(won);\n }\n\n if ( verdict == 'lose') {\n lost++;\n $(\"#game_lost\").text(lost);\n }\n\n if ( verdict == 'draw') {\n draw++;\n $(\"#game_draw\").text(draw);\n }\n\n $(\"#verdict\").text(verdict);\n\n played++;\n $(\"#games_played\").text(played);\n\n}", "function game(userChoice) {\n var computerChoice = getComputerChoice();\n switch (userChoice + computerChoice) {\n // rock beats f,s,sna,h,t,wol,spo\n case \"rs\":\n // scissors beats sna,h,t,wol,spo,p,a\n case \"sp\":\n // paper beats a,w,dra,dev,l,g,r\n case \"pr\":\n win(userChoice, computerChoice);\n break;\n // rock loses to paper\n case \"rp\":\n //scissors loses to rock\n case \"sr\":\n // paper loses to scissors\n case \"ps\":\n lose(userChoice, computerChoice);\n break;\n case \"rr\":\n case \"ss\":\n case \"pp\":\n draw(userChoice, computerChoice);\n break;\n }\n}", "function game(userChoice, computerChoice) {\n switch (userChoice + computerChoice) {\n case \"rs\":\n case \"pr\":\n case \"sp\":\n win(userChoice, computerChoice);\n break;\n case \"rp\":\n case \"ps\":\n case \"sr\":\n loss(userChoice, computerChoice);\n break;\n default:\n draw(userChoice, computerChoice);\n break;\n\n }\n\n\n}", "function getComputerChoice(){\n\tconst choices = ['r', 'p', 's'];\n\tconst randomNumber = Math.floor(Math.random() * 3);\n\treturn choices[randomNumber];\n}", "function getComputerChoice() {\r\n\t\tconst choices = [\"p\", \"f\", \"c\"];\r\n\t\tconst randomNumber = Math.floor(Math.random() * choices.length);\r\n\t\treturn choices[randomNumber];\r\n\t}", "function computerPlay() {\n let computerSelection = inputOption[Math.floor(Math.random() * inputOption.length)];\n return(computerSelection)\n}", "function systemSelection(option){\n\tvar check = option; \n\tif(vehicleFuel<=0){\n\t\tgameOverLose();\n\t}\n\n\telse{\n\n\n\tif(currentLocation===check){\n\t\t\tgamePrompt(\"Sorry Captain, You're already there or have been there. I will return you to the main menu to make another choice\",beginTravel);\n\t\t\t}\n\n\telse{\n\t\n\t\t\tif(check.toLowerCase() === \"e\"){\n\t\t\t\tvehicleFuel=(vehicleFuel-10);\n\t\t\t\tcurrentLocation=\"e\" ;\n\t\t\t\tgamePrompt(\"Flying to Earth...You used 10 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToEarth);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"m\"){\n\t\t\t//need to add a 'visited' conditional\n\t\t\tvehicleFuel=(vehicleFuel-20);\n\t\t\tcurrentLocation=\"m\" ;\n\t\t\t\tgamePrompt(\"Flying to Mesnides...You used 20 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\", goToMesnides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"l\"){\n\t\t\tvehicleFuel=(vehicleFuel-50);\n\t\t\tcurrentLocation=\"l\" ;\n\t\t\tgamePrompt(\"Flying to Laplides...You used 50 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToLaplides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"k\"){\n\t\t\tvehicleFuel=(vehicleFuel-120);\n\t\t\tcurrentLocation=\"k\" ;\n\t\t\tgamePrompt(\"Flying to Kiyturn...You used 120 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToKiyturn);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"a\"){\n\t\t\tvehicleFuel=(vehicleFuel-25);\n\t\t\tcurrentLocation=\"a\";\n\t\t\tgamePrompt(\"Flying to Aenides...You used 25 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToAenides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"c\"){\n\t\t\tvehicleFuel=(vehicleFuel-200);\n\t\t\tcurrentLocation=\"c\" ;\n\t\t\tgamePrompt(\"Flying to Cramuthea...You used 200 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToCramuthea);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"s\"){\n\t\t\tvehicleFuel=(vehicleFuel-400);\n\t\t\tcurrentLocation=\"s\" ;\n\t\t\tgamePrompt(\"Flying to Smeon T9Q...You used 400 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToSmeon);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"g\"){\n\t\t\tvehicleFuel=(vehicleFuel-85);\n\t\t\tcurrentLocation=\"g\" ;\n\t\t\tgamePrompt(\"Flying to Gleshan 7Z9...You used 85 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToGleshan);\n\t\t\t}\n\t\telse{\n\t\t\tgamePrompt(\"Sorry Captain, I did not understand you. I will return you to the main menu\",beginTravel);\n\t\t}\n\t}\n\t}\n}", "function whoWins() {\n var winner;\n switch (userInput) {\n case \"rock\":\n switch (computerInput) {\n case \"rock\":\n winner = \"tie\";\n break;\n case \"scissors\":\n winner = \"You\";\n break;\n case \"paper\":\n winner = \"Computer\";\n break;\n case \"dynamite\":\n winner = \"Computer\";\n break;\n\n }\n break;\n case \"scissors\":\n switch (computerInput) {\n case \"rock\":\n winner = \"Computer\";\n break;\n case \"scissors\":\n winner = \"tie\";\n break;\n case \"paper\":\n winner = \"You\";\n break;\n case \"dynamite\":\n winner = \"You\";\n break;\n\n }\n break;\n case \"paper\":\n switch (computerInput) {\n case \"rock\":\n winner = \"You\";\n break;\n case \"scissors\":\n winner = \"Computer\";\n break;\n case \"paper\":\n winner = \"tie\";\n break;\n case \"dynamite\":\n winner = \"Computer\";\n break;\n }\n break;\n case \"dynamite\":\n switch (computerInput) {\n case \"rock\":\n winner = \"You\";\n break;\n case \"scissors\":\n winner = \"Computer\";\n break;\n case \"paper\":\n winner = \"You\";\n break;\n case \"dynamite\":\n winner = \"tie\";\n break;\n }\n break;\n\n }\n\n userImg = userInput+\".jpg\";\n computerImg = computerInput+\".jpg\";\n\n if (winner == \"tie\")\n {\n resultsDisplay = \"<h2>Computer Selected \"+ computerInput + \"</h2>\"+ \"<img src='./img/\"+computerImg+\"'>\" + \"<h2>You Selected \"+ userInput+\"</h2>\" + \"<img src='./img/\"+userImg+\"'>\"+\" <h1>It's a Tie !!</h1>\";\n }\n else if (winner == \"Computer\")\n {\n resultsDisplay = \"<h2>Computer Selected \"+ computerInput + \"</h2>\"+ \"<img src='./img/\"+computerImg+\"'>\" + \"<h2>You Selected \"+ userInput+\"</h2>\" + \"<img src='./img/\"+userImg+\"'>\"+\" <h1>COMPUTER is the winner :(</h1>\";\n\n }\n else if (winner == \"You\"){\n resultsDisplay = \"<h2>Computer Selected \"+ computerInput + \"</h2>\"+ \"<img src='./img/\"+computerImg+\"'>\" + \"<h2>You Selected \"+ userInput+\"</h2>\" + \"<img src='./img/\"+userImg+\"'>\"+\" <h1>YOU are the winner!! :)))</h1>\";\n\n }\n }", "function game(userChoice) {\r\n\t\tconst computerChoice = getComputerChoice();\r\n\t\tswitch (userChoice + computerChoice) {\r\n\t\t\tcase \"pc\":\r\n\t\t\tcase \"fp\":\r\n\t\t\tcase \"cf\":\r\n\t\t\t\twin(userChoice, computerChoice);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"pf\" :\r\n\t\t\tcase \"fc\" :\r\n\t\t\tcase \"cp\" :\r\n\t\t\t\tlose(userChoice, computerChoice);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"pp\":\r\n\t\t\tcase \"ff\":\r\n\t\t\tcase \"cc\":\r\n\t\t\t\tdraw(userChoice, computerChoice); \r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}", "function opPlayer() {\n let playerPrompt = prompt(\"Please choose Rock, Paper, or Scissors:\");\n let playerChoice = playerPrompt.toLowerCase(); \n\n // If user enters choice, return user choice \n if (playerChoice==\"rock\" || playerChoice==\"paper\" || playerChoice==\"scissors\") {\n alert(`You have selected ${playerChoice} as your weapon! \\n Get Ready for Battle!`); \n return playerChoice; \n }\n // if user does not enter choice, prompt again\n else if (playerChoice==null || playerChoice==\"\") {\n alert(\"Oops! You need to enter Rock, Paper, or Scissors!\"); \n opPlayer()\n }\n else {\n alert (\"Please choose Rock, Paper, or Scissors:\"); \n opPlayer()\n } //end else \n} //end function opPlayer ", "function getComputerChoice() {\n if (randomNumber === 1) {\n return (computerChosen = \"rock\");\n } else if (randomNumber === 2) {\n return (computerChosen = \"paper\");\n } else if (randomNumber === 3) {\n return (computerChosen = \"scissors\");\n } else if (randomNumber === 4) {\n return (computerChosen = \"lizard\");\n } else if (randomNumber === 5) {\n return (computerChosen = \"spock\");\n }\n}", "function userChoice(choice){\n setHulkChoice();\n evaluate(choice);\n}", "function compare(comp, person){\n console.log(\"Computer selects: \", comp, \"Human selects: \", person);\n if (comp === 1 && person === 3){\n lossCount++;\n return \"loss\";\n } else if ( comp === 3 && person === 1){\n winCount++\n return \"win\";\n } else if ( comp > person ){\n lossCount++;\n return \"loss\";\n } else if ( person > comp ){\n winCount++;\n return \"win\";\n } else {\n tieCount++;\n return \"tie\";\n }\n}", "function outcome(playerSelection, computerSelection)\n{\n // Creates playerSelectionCapitalized variable that converts the first letter of the string value in playerSelection to upper case\n let playerSelectionCapitalized = playerSelection[0].toUpperCase() + playerSelection.slice(1);\n\n // Creates computerSelectionCapitalized variable that converts the first letter of the string value in computerSelection to upper case\n let computerSelectionCapitalized = computerSelection[0].toUpperCase() + computerSelection.slice(1);\n\n if ((playerSelection === `rock` && computerSelection === `scissors`) || (playerSelection === `paper` && computerSelection === `rock`) || (playerSelection === `scissors` && computerSelection === `paper`))\n {\n alert(`You win! ${playerSelectionCapitalized} beats ${computerSelectionCapitalized}.`);\n }\n else if ((computerSelection === `rock` && playerSelection === `scissors`) || (computerSelection === `paper` && playerSelection === `rock`) || (computerSelection === `scissors` && playerSelection === `paper`))\n {\n alert(`You lose! ${computerSelectionCapitalized} beats ${playerSelectionCapitalized}.`);\n }\n}", "function checkResult(userChoice){\n \n userSelectOption(userChoice);\n \n let computerChoice = rng();\n \n var img = document.getElementById(\"computerchoiceimg\");\n img.src = imgArray[computerChoice];\n img.style.display = \"block\";\n \n let resultDisplay = document.getElementById('result');\n let opponentscore = document.getElementById('opponentscore');\n let playerscore = document.getElementById('playerscore');\n \n \n if (userChoice == computerChoice){\n resultDisplay.innerHTML = \"It's a tie!\";\n \n audio.src = \"assets/Round Draw - CSGO Sound Effect.mp3\";\n \n }\n else if((userChoice == 0 && computerChoice == 1) || (userChoice == 1 && computerChoice == 2) || (userChoice == 2 && computerChoice == 0)){ \n resultDisplay.innerHTML = \"You lost to a computer!\";\n opponentCount++;\n opponentscore.innerHTML = opponentCount;\n audio.src = \"assets/Lose sound effects.mp3\";\n \n \n }\n else if((computerChoice == 0 && userChoice == 1) || (computerChoice == 1 && userChoice == 2) || (computerChoice == 2 && userChoice == 0)){\n resultDisplay.innerHTML = \"You won!\";\n playerCount++;\n playerscore.innerHTML = playerCount;\n audio.src = \"assets/You win sound effect 5.mp3\";\n \n }\n audio.play();\n}", "function computerPlay() {\n let numGen = Math.random();\n if (numGen < 0.34) {\n compChoice = 'ROCK';\n }\n else if (numGen <= 0.67) {\n compChoice = 'PAPER';\n }\n else {\n compChoice = 'SCISSORS';\n }\n console.log('Computer Choice: ' + compChoice);\n return compChoice;\n\n }", "function compare(userChoice){\r\n let robotChoice = roboChoice();\r\n let score;\r\n\r\n if(userChoice == robotChoice){\r\n score = 2;\r\n }\r\n else if(userChoice == \"rock\" && robotChoice == \"scissors\"){\r\n score = 1;\r\n }\r\n else if(userChoice == \"scissors\" && robotChoice == \"rock\"){\r\n score = 0;\r\n }\r\n else if(userChoice == \"paper\" && robotChoice == \"rock\"){\r\n score = 1;\r\n }\r\n else if(userChoice == \"rock\" && robotChoice == \"paper\"){\r\n score = 0;\r\n }\r\n else if(userChoice == \"paper\" && robotChoice == \"scissors\"){\r\n score = 0;\r\n }\r\n else if(userChoice == \"scissors\" && robotChoice == \"paper\"){\r\n score = 1;\r\n }\r\n else{\r\n score = 2;\r\n } \r\n\r\n return score;\r\n\r\n}", "function game(userChoice) {\n const computerChoice = getComputerChoice();\n switch (userChoice + computerChoice) {\n //user win situations\n case 'rockscissors':\n case 'rocklizard':\n case 'paperrock':\n case 'paperspock':\n case 'scissorspaper':\n case 'scissorslizard':\n case 'lizardspock':\n case 'lizardpaper':\n case 'spockscissors':\n case 'spockrock':\n win(userChoice, computerChoice);\n break;\n //computer win situations\n case 'rockpaper':\n case 'rockspock':\n case 'paperscissors':\n case 'paperlizard':\n case 'scissorsrock':\n case 'scissorsspock':\n case 'lizardrock':\n case 'lizardscissors':\n case 'spockpaper':\n case 'spocklizard':\n lose(userChoice, computerChoice);\n break;\n //equality\n case 'rockrock':\n case 'paperpaper':\n case 'scissorsscissors':\n case 'lizardlizard':\n case 'spockspock':\n draw(userChoice, computerChoice);\n break;\n }\n}", "function getComputerChoice()\n{\n const choices = ['r', 'p', 's'];\n const randomNumber = Math.floor(Math.random()*3);\n return choices[randomNumber];\n}", "function getComputerChoice() {\n var choices = ['r', 's', 'p'];\n var randomNumber = Math.floor(Math.random() * 3);\n return choices[randomNumber];\n}", "function computerSelected() {\n computerGuess = computerChoices[Math.floor(Math.random() * computerChoices.length)];\n}", "function getWinner(playerChoice, computerChoice) {\n console.log(\"Get winner: player \", playerChoice, \"computer \", computerChoice);\n\n if (playerChoice == computerChoice) {\n //If they chose the same option then it's a draw\n return \"Draw\";\n } else if (playerChoice == \"Rock\" && computerChoice == \"Paper\") {\n // If user chooses Rock & Computer chooses Paper\n return \"computer\"; // Computer wins since Paper covers Rock\n } else if (playerChoice == \"Rock\" && computerChoice == \"Scissors\") {\n // If user chooses Rock & Computer chooses Scissors\n return \"player\"; // Player wins since Rock crushes Scissors\n } else if (playerChoice == \"Rock\" && computerChoice == \"Lizard\") {\n // If user chooses Rock & Computer chooses Lizard\n return \"player\"; // Player wins since Rock crushes Lizard\n } else if (playerChoice == \"Rock\" && computerChoice == \"Spock\") {\n // If user chooses Rock & Computer chooses Spock\n return \"computer\"; // Computer wins since Spock vaporizes Rock\n } else if (playerChoice == \"Paper\" && computerChoice == \"Rock\") {\n // If user chooses Paper & Computer chooses Rock\n return \"player\"; // Player wins since Paper covers Rock\n } else if (playerChoice == \"Paper\" && computerChoice == \"Scissors\") {\n // If user chooses Paper & Computer chooses Scissors\n return \"computer\"; // Computer wins since Scissors cuts Paper\n } else if (playerChoice == \"Paper\" && computerChoice == \"Lizard\") {\n // If user chooses Paper & Computer chooses Lizard\n return \"computer\"; // Computer wins since Lizard eats Paper\n } else if (playerChoice == \"Paper\" && computerChoice == \"Spock\") {\n // If user chooses Paper & Computer chooses Spock\n return \"player\"; // Player wins since Paper disproves Spock\n } else if (playerChoice == \"Scissors\" && computerChoice == \"Rock\") {\n // If user chooses Scissors & Computer chooses Rock\n return \"computer\"; // Computer wins since Rock crushes Scissors\n } else if (playerChoice == \"Scissors\" && computerChoice == \"Paper\") {\n // If user chooses Scissors & Computer chooses Paper\n return \"player\"; // Player wins since Scissors cuts Paper\n } else if (playerChoice == \"Scissors\" && computerChoice == \"Lizard\") {\n // If user chooses Scissors & Computer chooses Lizard\n return \"player\"; // Player wins since Scissors decapitates Lizard\n } else if (playerChoice == \"Scissors\" && computerChoice == \"Spock\") {\n // If user chooses Scissors & Computer chooses Spock\n return \"computer\"; // Computer wins since Spock smashes Scissors\n } else if (playerChoice == \"Lizard\" && computerChoice == \"Rock\") {\n // If user chooses Lizard & Computer chooses Rock\n return \"computer\"; // Computer wins since Rock smashes Lizard\n } else if (playerChoice == \"Lizard\" && computerChoice == \"Paper\") {\n // If user chooses Lizard & Computer chooses Paper\n return \"player\"; // Player wins since Lizard eats Paper\n } else if (playerChoice == \"Lizard\" && computerChoice == \"Scissors\") {\n // If user chooses Lizard & Computer chooses Scissors\n return \"computer\"; // Computer wins since Scissors decapitates Lizard\n } else if (playerChoice == \"Lizard\" && computerChoice == \"Spock\") {\n // If user chooses Lizard & Computer chooses Spock\n return \"player\"; // Player wins since Lizard poisons Spock\n } else if (playerChoice == \"Spock\" && computerChoice == \"Rock\") {\n // If user chooses Spock & Computer chooses Rock\n return \"player\"; // player wins since Spock vaporizes Rock\n } else if (playerChoice == \"Spock\" && computerChoice == \"Paper\") {\n // If user chooses Spock & Computer chooses Paper\n return \"computer\"; // computer wins since Paper disproves Spock\n } else if (playerChoice == \"Spock\" && computerChoice == \"Scissors\") {\n // If user chooses Spock & Computer chooses Scissors\n return \"player\"; // player wins since Spock smashes Scissors\n } else if (playerChoice == \"Spock\" && computerChoice == \"Lizard\") {\n // If user chooses Spock & Computer chooses Lizard\n return \"computer\"; // computer wins since Lizard poisons Spock\n }\n}", "function getComputerChoice() {\n const choices = ['r', 'p', 's', 'l', 'm'];\n const randomNumber = Math.floor(Math.random() * 5);\n return choices[randomNumber];\n}", "function getComputerChoice() {\n const choices = ['rock', 'paper', 'scissors', 'lizard', 'spock'];\n const randomNumber = Math.floor(Math.random() * 5); // randomize a number bwn 0 and 5 and round it down\n return choices[randomNumber];\n}", "function playRound(userSelection, computerSelection) {\n // display msg if there is a tie and get input again\n while (userSelection == computerSelection) {\n computerSelection = computerPlay();\n }\n\n // decide who wins and call appropriate func\n switch (userSelection) {\n case \"Paper\":\n computerSelection == \"Rock\" ?\n userWins(userSelection, computerSelection) :\n userLoses(userSelection, computerSelection);\n break;\n case \"Rock\":\n computerSelection == \"Scissors\" ?\n userWins(userSelection, computerSelection) :\n userLoses(userSelection, computerSelection);\n break;\n case \"Scissors\":\n computerSelection == \"Paper\" ?\n userWins(userSelection, computerSelection) :\n userLoses(userSelection, computerSelection);\n break;\n }\n}", "function compareTheGame(me, opponent) {\n\t\n\tjQuery('#computerSelection').text(opponent);\n\n\n\n\t//Determine who wins\n\nif(me===opponent){\n return 'Tie';\n } else if(me === 'rock') {\n\n if (opponent === 'paper') {\n return 'My rock lost to paper :(';\n } else if (opponent === 'scissors') {\n return 'My rock crushed scissors! >:)';\n }\n \n }else if(me == 'paper') {\n\n \tif (opponent === 'scissors') {\n \t\treturn 'My paper lost to scissors :(';\n \t} else if (opponent === 'rock')\n \t\treturn 'My paper crushed rock! >:)'\n } \n\n\n\n\n\n\n\n\t//Display winner\n\n\n}", "function userSelection() {\n writeLog(\"Selection: \" + userChoice);\n writeLog(\"Search Item: \" + searchItem);\n switch (userChoice) {\n case \"help\":\n console.log(\"The following options are valid:\");\n console.log(\"-----------------------------------------------------------------------\");\n console.log(\"'node liri concert-this <artist>' --> search bandsintown for the artist\");\n console.log(\"'node liri spotify-this-song <song>' --> search spotify for the song\");\n console.log(\"'node liri movie-this <movie>' --> search omdb for the movie\");\n console.log(\"'node liri do-what-it-says' --> read commands from the random.txt file and execute\");\n break;\n case \"concert-this\":\n doConcertThis(searchItem);\n break;\n case \"spotify-this-song\":\n doSpotifyThisSong(searchItem);\n break;\n case \"movie-this\":\n doMovieThis(searchItem);\n break;\n case \"do-what-it-says\":\n doWhatItSays(searchItem);\n break;\n default:\n writeLog(\"You gave me '\" + userChoice + \"' which is not a valid option. Enter 'node liri help' to display valid options.\");\n }\n}", "function RPSGame(str) {\n\n let rock = 0;\n let paper = 1;\n let scissors = 2;\n let userChoice;\n let userChoiceVal;\n let computerChoice;\n let winner;\n\n computerChoice = Math.floor(Math.random() * 3);\n\n if (computerChoice == 0){\n computerChoice = \"rock\";\n } else if (computerChoice == 1){\n computerChoice = \"paper\";\n } else if (computerChoice == 2) {\n computerChoice = \"scissors\";\n } else {}\n\n if (str.toLowerCase() == \"rock\"){\n userChoiceVal = rock;\n userChoice = str.toLowerCase();\n\n console.log(\"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv This is the answer to Task 4 & Stretch Task 2 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\");\n console.log(\"You chose \" + userChoice + \". \" + \"The computer chose \" + computerChoice + \".\");\n\n if(userChoice == \"rock\" && computerChoice == \"scissors\"){\n winner = \"user\";\n console.log (userChoice.charAt(0).toUpperCase() + userChoice.substr(1).toLowerCase() + \" beats \" + computerChoice + \".\");\n } else if (userChoice == \"rock\" && computerChoice == \"paper\") {\n winner = \"computer\";\n console.log (computerChoice.charAt(0).toUpperCase() + computerChoice.substr(1).toLowerCase() + \" beats \" + userChoice + \".\");\n } else if (userChoice == \"rock\" && computerChoice == \"rock\") {\n winner = \"tie\";\n } else {}\n\n } else if (str.toLowerCase() == \"paper\"){\n userChoiceVal = paper;\n userChoice = str.toLowerCase();\n\n console.log(\"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv This is the answer to Task 4 & Stretch Task 2 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\");\n console.log(\"You chose \" + userChoice + \". \" + \"The computer chose \" + computerChoice + \".\");\n\n if(userChoice == \"paper\" && computerChoice == \"rock\"){\n winner = \"user\";\n console.log (userChoice.charAt(0).toUpperCase() + userChoice.substr(1).toLowerCase() + \" beats \" + computerChoice + \".\");\n } else if (userChoice == \"paper\" && computerChoice == \"scissors\") {\n winner = \"computer\";\n console.log (computerChoice.charAt(0).toUpperCase() + computerChoice.substr(1).toLowerCase() + \" beats \" + userChoice + \".\");\n } else if (userChoice == \"paper\" && computerChoice == \"paper\") {\n winner = \"tie\";\n } else {}\n\n } else if (str.toLowerCase() == \"scissors\") {\n userChoiceVal = scissors;\n userChoice = str.toLowerCase();\n\n console.log(\"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv This is the answer to Task 4 & Stretch Task 2 vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\");\n console.log(\"You chose \" + userChoice + \". \" + \"The computer chose \" + computerChoice + \".\");\n\n if(userChoice == \"scissors\" && computerChoice == \"paper\"){\n winner = \"user\";\n console.log (userChoice.charAt(0).toUpperCase() + userChoice.substr(1).toLowerCase() + \" beats \" + computerChoice + \".\");\n } else if (userChoice == \"scissors\" && computerChoice == \"rock\") {\n winner = \"computer\";\n console.log (computerChoice.charAt(0).toUpperCase() + computerChoice.substr(1).toLowerCase() + \" beats \" + userChoice + \".\");\n } else if (userChoice == \"scissors\" && computerChoice == \"scissors\") {\n winner = \"tie\";\n } else {}\n\n } else {\n console.log(\"Please select either rock, paper, or scissors to play.\");\n }\n\n if (winner == \"user\"){\n console.log (\"Congratulations! You won!\");\n console.log(\"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the answer to Task 4 & Stretch Task 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\");\n } else if (winner == \"computer\") {\n console.log(\"The computer wins. You lost.\");\n console.log(\"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the answer to Task 4 & Stretch Task 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\");\n } else if (winner == \"tie\"){\n console.log(\"It's a tie. Play again to see who wins.\");\n console.log(\"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is the answer to Task 4 & Stretch Task 2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\");\n } else {}\n}", "function computerSelection(){\n var election = (Math.random().toPrecision(1)) * 10;\n var newElection = Math.round(election);\n var cadena;\n //console.log(newElection);\n\n\n if(newElection <= 3){\n cadena = 'piedra';\n //console.log(cadena);\n return cadena;\n }else if(newElection > 3 && newElection <= 6){\n cadena = 'papel';\n //console.log(cadena);\n return cadena;\n }else if(newElection > 6 && newElection <= 10){\n cadena = 'tijera';\n //console.log(cadena);\n return cadena;\n }\n\n}", "function determineWinner(userChoice, compterChoice) {\n if (userChoice === compterChoice) {\n return 'it\\'s a tie';\n }\n if (userChoice === 'cheat') {\n return 'You won';\n }\n if (userChoice === 'paper') {\n if (compterChoice === 'scissors') {\n return 'Computer won';\n } else {\n return 'You won';\n }\n }\n if (userChoice === 'rock') {\n if (compterChoice === 'paper') {\n return 'Computer won';\n } else {\n return 'You won';\n }\n }\n if (userChoice === 'scissors') {\n if (compterChoice === 'rock') {\n return 'Computer won';\n } else {\n return 'You won';\n }\n }\n}", "function game(userChoice) {\n const comp_input = comp_choice();\n console.log(\"So, you hit the -->\" + userChoice);\n console.log(\"Computer hit -->\" + comp_input);\n win_loss(userChoice, comp_input);\n}", "function automate(playerSelection) {\n if (userCurrentScore < 5 && computerCurrentScore < 5) {\n if (\n playerSelection.toUpperCase() == \"ROCK\" ||\n playerSelection.toUpperCase() == \"PAPER\" ||\n playerSelection.toUpperCase() == \"SCISSORS\"\n ) {\n document.querySelector(\".your\").textContent =\n playerSelection.toUpperCase();\n document.querySelector(\".computers\").textContent =\n computerSelection.toUpperCase();\n\n if (playerSelection.toUpperCase() === computerSelection.toUpperCase()) {\n draw();\n } else if (\n (playerSelection.toUpperCase() == \"ROCK\" &&\n computerSelection.toUpperCase() == \"PAPER\") ||\n (playerSelection.toUpperCase() == \"SCISSORS\" &&\n computerSelection.toUpperCase() == \"ROCK\") ||\n (playerSelection.toUpperCase() == \"PAPER\" &&\n computerSelection.toUpperCase() == \"SCISSORS\")\n ) {\n userLoses(playerSelection);\n } else if (\n (computerSelection.toUpperCase() == \"ROCK\" &&\n playerSelection.toUpperCase() == \"PAPER\") ||\n (computerSelection.toUpperCase() == \"SCISSORS\" &&\n playerSelection.toUpperCase() == \"ROCK\") ||\n (computerSelection.toUpperCase() == \"PAPER\" &&\n playerSelection.toUpperCase() == \"SCISSORS\")\n ) {\n userWins(playerSelection);\n }\n }\n } else {\n if (computerCurrentScore == 5 && userCurrentScore < 5) {\n document.querySelector(\n \"h1\"\n ).textContent = `You Lost with ${computerCurrentScore}:${userCurrentScore}`;\n document.body.style.backgroundColor = \"#FF5C58\";\n finalize();\n } else if (userCurrentScore == 5 && computerCurrentScore < 5) {\n document.querySelector(\n \"h1\"\n ).textContent = `You Win with ${userCurrentScore}:${computerCurrentScore}`;\n document.body.style.backgroundColor = \"#B1E693\";\n finalize();\n }\n }\n}", "function rockChoice() {\n var compChoice = showCompResult();\n // Check for win\n if (compChoice === 0) {\n playerDraws();\n } else if (compChoice === 1) {\n playerLoses();\n } else {\n playerWins();\n }\n}", "function game(userChoice) {\n const computerChoice = getComputerChoice();\n switch (userChoice + computerChoice) {\n case \"sp\":\n case \"pr\":\n case \"rl\":\n case \"lm\":\n case \"ms\":\n case \"sl\":\n case \"lp\":\n case \"pm\":\n case \"mr\":\n case \"rs\":\n win(userChoice, computerChoice);\n break;\n case \"ml\":\n case \"lr\":\n case \"rp\":\n case \"ps\":\n case \"sm\":\n case \"mp\":\n case \"pl\":\n case \"ls\":\n case \"sr\":\n case \"rm\":\n lose(userChoice, computerChoice);\n break;\n case \"ss\":\n case \"pp\":\n case \"rr\":\n case \"ll\":\n case \"mm\":\n draw(userChoice, computerChoice);\n break;\n \n } \n}", "function getComputerChoice() {\r\n const choices = [\"r\", \"p\", \"s\"];\r\n const randomNumber = Math.floor(Math.random() * 3)\r\n return choices[randomNumber];\r\n\r\n}", "function evaluator(user, com){\r\n if (user === com){\r\n agree(user, com);\r\n }\r\n else(user != com)\r\n // alert(\"you lose\")\r\n leftover(user, com);\r\n\r\n if (guessesLeft > 0){\r\n }\r\n else{\r\n reset();\r\n }\r\n\r\n}", "function getValue() {\n playerSelection = prompt(`Round:${round} - Rock, paper or scissor`);\n\n playerSelection = playerSelection.toLowerCase();\n computerSelection = computerPlay();\n}", "function mainGame(user,computer){\n if (user < computer ) {\n buttonClicks();\n } else if ( userNumber === computerGuess) {\n alert(\"You win!\");\n wins++;\n resetGame();\n } else {\n alert('You Lose!')\n losses++;\n resetGame();\n }\n\n }", "function playRound(playerSelection, computerSelection) {\n // compare the selection and decide winner\n // check for computer side only\n // check every possible commination\n let winner = undefined;\n\n switch (computerSelection) {\n case 'rock':\n switch (playerSelection) {\n case 'rock':\n winner = 't'\n break;\n case 'paper':\n winner = 'p'\n break;\n case 'scissors':\n winner = 'c'\n break;\n }\n break;\n\n case 'paper':\n switch (playerSelection) {\n case 'rock':\n winner = 'c'\n break;\n case 'paper':\n winner = 't'\n break;\n case 'scissors':\n winner = 'p'\n break;\n }\n break;\n\n case 'scissors':\n switch (playerSelection) {\n case 'rock':\n winner = 'p'\n break;\n case 'paper':\n winner = 'c'\n break;\n case 'scissors':\n winner = 't'\n break;\n }\n break;\n }\n return winner;\n\n}", "function paperChoice() {\n var compChoice = showCompResult();\n // Check for win\n if (compChoice === 1) {\n playerDraws();\n } else if (compChoice === 2) {\n playerLoses();\n } else {\n playerWins();\n }\n}", "function getComputerChoice() {\n var choices = ['r', 'p', 's'];\n var randomNumber = Math.floor(Math.random() * 3);\n return choices[randomNumber];\n}", "function rpsGame() {\n var user = prompt(\"Pick One: Rock, Paper or Scissors?\");\n var userAnswer = user.toLowerCase();\n\n /* Underneath we have the computer picking */\n\n var someNumber = Math.random();\n var improvedNumber = (someNumber * 3) + 1;\n var finalNumber = Math.floor(improvedNumber);\n\n /* Underneath we have all the options for if the user */\n\n if (userAnswer === \"rock\" || \"paper\" || \"scissor\") {\n if (userAnswer === \"rock\" && finalNumber === 1) {\n alert(\"I have Rock! It's a tie! Let's go again.\");\n } else if (userAnswer === \"rock\" && finalNumber === 2) {\n alert(\"I have Paper! I win.\");\n } else if (userAnswer === \"rock\" && finalNumber === 3) {\n alert(\"I have Scissor! Shoot ya beat me this time.\");\n }\n if (userAnswer === \"paper\" && finalNumber === 1) {\n alert(\"I have Rock! Shoot ya beat me this time.\");\n } else if (userAnswer === \"paper\" && finalNumber === 2) {\n alert(\"I have Paper! It's a tie! Let's go again.\");\n } else if (userAnswer === \"paper\" && finalNumber === 3) {\n alert(\"I have Scissor! I win.\");\n }\n if (userAnswer === \"scissor\" && finalNumber === 1) {\n alert(\"I have Rock! I win\");\n } else if (userAnswer === \"scissor\" && finalNumber === 2) {\n alert(\"I have Paper! Shoot ya beat me this time.\");\n } else if (userAnswer === \"scissor\" && finalNumber === 3) {\n alert(\"I have Scissor! It's a tie! Let's go again.\");\n\n } else {\n alert(\"Hope you enjoyed the game let's play again later!\");\n }\n }\n }", "function getComputerChoice () {\n const choices = ['rock', 'paper', 'scissors', 'lizard', 'spock'];\n const randomNumber = Math.floor(Math.random() * 5);\n return choices[randomNumber];\n}", "function compare(choice1, choice2){\n\tif (choice1==choice2){\n\t\treturn 'TIE';\n\t} else if (choice1=='rock'){\n\t\tif(choice2=='scissors'){\n\t\t\tuser.addScore();\n\t\t\treturn user.getUserName() +' wins with Rock!';\n\t\t} else {\n\t\t\tcomputer.addScore();\n\t\t\treturn computer.getUserName() +' wins with paper!';\n\t\t}\n\t} else if(choice1=='paper'){\n\t\tif (choice2=='rock'){\n\t\t\tuser.addScore();\n\t\t\treturn user.getUserName() + ' wins with paper!';\n\t\t}else{\n\t\t\tcomputer.addScore();\n\t\t\treturn computer.getUserName() + ' wins with scissors!';\n\t\t}\n\t} else if(choice1 == \"scissors\"){\n\t\tif(choice2 ==\"rock\"){\n\t\t\tcomputer.addScore();\n\t\t\treturn computer.getUserName() + \" wins with rock!\";\n\t\t} else {\n\t\t\tuser.addScore();\n\t\t\treturn user.getUserName() + \" wins with scissors!\";\n\t\t}\n\t}\n}", "function getComputerChoice() {\r\n const choices = [\r\n { choice: 'r', beats: ['s', 'l'], losesTo: ['p', 'sp'] },\r\n { choice: 'p', beats: ['r', 'sp'], losesTo: ['s', 'l'] },\r\n { choice: 's', beats: ['p', 'l'], losesTo: ['r', 'sp'] },\r\n { choice: 'l', beats: ['p', 'sp'], losesTo: ['r', 's'] },\r\n { choice: 'sp', beats: ['r', 's'], losesTo: ['p', 'l'] }\r\n ];\r\n\r\n // generate random number\r\n const randomNumber = Math.floor(Math.random() * choices.length);\r\n\r\n // return choice based on element of random number in choices array\r\n return choices[randomNumber];\r\n}", "function compete(event) {\n let userChoice = getUserChoice(event);\n let compChoice = getCompChoice();\n let winner = getWinner(userChoice, compChoice);\n\n // update player and computer scores\n if (winner == 1) playerScore++;\n else if (winner == 2) compScore++;\n\n // display the results of that round\n displayResults(userChoice, compChoice, winner);\n\n // update the scoreboard\n let scoreboard = document.getElementById(\"score\");\n scoreboard.textContent = `${playerScore} - ${compScore}`;\n\n // if either player has gotten to 3, display the winner\n if (playerScore >= 3) {\n let username = document.getElementById(\"name\").value;\n displayWinner(username);\n } else if (compScore >= 3) displayWinner(\"Computer\");\n\n // if a player has won, disable \"shoot\" button\n if (playerScore >= 3 || compScore >= 3) {\n document.getElementById(\"shoot\").style.display = \"none\";\n }\n}", "function computerSelection() {\n const options = ['rock', 'paper', 'scissors'];\n const selection = Math.floor(Math.random() * 3);\n return options[selection];\n}", "function results() {\n if (computerChosen == playerChosen) {\n return result = 'It is a TIE!'\n } \n else if (computerChosen === 'rock' && playerChosen === 'paper') {\n return result = 'You Win!'\n } \n else if (computerChosen === 'rock' && playerChosen === 'scissors') {\n return result = 'You Lose!'\n } \n else if (computerChosen === 'paper' && playerChosen === 'rock') {\n return result = 'You Lose!'\n } \n else if (computerChosen === 'paper' && playerChosen === 'scissors') {\n return result = 'You Win!'\n } \n else if (computerChosen === 'scissor' && playerChosen === 'rock') {\n return result = 'You Win!'\n } \n else if (computerChosen === 'scissor' && playerChosen === 'paper') {\n return result = 'You Lost!'\n }\n}", "function whoIsPlaying() {\n console.log(prompt(\"Do you want to play against me or another ‘real’ person?\"));\n console.log(prompt(\"Type 1 to play against me.\\n=> Type 2 to play against a friend.\"));\n userChoice = userInput.question();\n userChoice = userInputValidation(userChoice, ['1', '2'], \"Maybe I wasn't clear enough! The options are: '1' to play with me or '2' to play against a friend.\\n\");\n if (userChoice === '1') {\n console.clear();\n playWithComputer();\n whoStarts('computer');\n } else {\n console.clear();\n playWithFriend();\n whoStarts('friend');\n }\n}" ]
[ "0.71171516", "0.7086824", "0.70657337", "0.7054372", "0.70536125", "0.7049375", "0.69436496", "0.6903555", "0.68633497", "0.68328804", "0.6802112", "0.6779254", "0.6752433", "0.67331934", "0.6727019", "0.66917986", "0.66803426", "0.6679248", "0.6663939", "0.66405463", "0.6614668", "0.6614376", "0.6613542", "0.6605959", "0.6604703", "0.66002494", "0.6599289", "0.6596977", "0.65887535", "0.65808624", "0.6545027", "0.6544795", "0.6536811", "0.6530235", "0.65127254", "0.6500811", "0.64941514", "0.6480005", "0.64735943", "0.6467154", "0.6465505", "0.64573866", "0.64549744", "0.6446382", "0.6410612", "0.6405411", "0.64044285", "0.6402083", "0.63979447", "0.63892007", "0.6380069", "0.6371166", "0.6356362", "0.63386184", "0.6330803", "0.6329496", "0.6328124", "0.6327958", "0.63254535", "0.6323494", "0.63222563", "0.6322153", "0.6317423", "0.6316742", "0.6316301", "0.63156086", "0.6310599", "0.6308453", "0.6298985", "0.62949026", "0.62945634", "0.62722594", "0.6271414", "0.62700075", "0.6265214", "0.62597376", "0.62579054", "0.62515795", "0.6250957", "0.6248753", "0.6238531", "0.62344134", "0.6231693", "0.6225217", "0.6217565", "0.6216841", "0.6213474", "0.62109417", "0.6206159", "0.620473", "0.6203791", "0.620334", "0.6199379", "0.61983925", "0.6194286", "0.6189193", "0.6188444", "0.6173327", "0.61724323", "0.61704147", "0.61682886" ]
0.0
-1
create a new post
createPost(id, timestamp, title, body, author, category) { console.log('onCreate', id, timestamp, title, body, author, category); Api.addPost(id, timestamp, title, body, author, category).then((post) => { // console.log('res ',post); this.props.addPost(post); }).catch((err) => { console.log('error when persisting post: ', err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createPost() {\n}", "newPost(post) {\n\n }", "function addPost(post) {\n return PostsModel.create(post);\n}", "function createPost(req, res) {\n var post = new Post();\n post._id = new ObjectID();\n post.title = req.body.title;\n post.type = req.body.type;\n post.price = req.body.price || '';\n post.author = req.account._id;\n post.area = req.body.area;\n post.category = req.body.category;\n post.content = req.body.content || '';\n post.tags = req.body.tags || [];\n post.status = Post.Status.ACTIVE;\n post.replies = [];\n post.images = req.body.images || [];\n post.duration = req.body.duration || 0;\n post.neverExpire = !!req.body.neverExpire;\n if (!post.neverExpire) {\n var expireDate = new Date();\n expireDate.setTime(Date.now() + parseInt(req.body.duration) * 24 * 60 * 60 * 1000);\n post.expire = expireDate;\n }\n post.email = req.body.email;\n post.phone = req.body.phone || '';\n post.delivery = req.body.delivery || [];\n\n post.save(function (err) {\n if (err) {\n return res.send(500);\n } else {\n return res.send(200, post);\n }\n });\n}", "function CreatePost (req, res, post) {\n post.price = parseInt(post.price);\n if (isValidPost(post)) {\n post.user_id = req.session.userID;\n models.Post.create(post).then(function () {\n res.status(204).end();\n var activity = {user: req.session.userID, activity: \"Create Post\",\n value: post.id};\n models.Activity.create(activity);\n }).catch(function(err){\n console.log(err);\n res.status(401).end();\n });\n }\n else {\n res.status(401).end();\n }\n}", "function create(req, res) {\n req.body.name = req.user.name\n req.body.avatar = req.user.avatar\n req.body.Likes = 0\n console.log(req.body.Posts)\n Post.create(req.body)\n .then(() => {\n res.redirect('/posts')\n })\n }", "async function newPost(req, res) {\n try {\n console.log(req.body);\n const post = await Post.create(req.body.title, req.body.date, req.body.name, req.body.body)\n res.status(201).json(post)\n } catch(err) {\n res.status(422).json({err})\n }\n}", "async createPost () {\n\t\tthis.postCreator = new PostCreator({ \n\t\t\trequest: this,\n\t\t\tassumeSeqNum: this.teamWasCreated ? 2 : undefined // because the actual code error was 1\n\t\t});\n\t\t// TODO: for replies, we should probably validate that the parent post ID is a code error\n\t\t// for the same team/stream/etc. ... but for now, just allow it\n\t\tthis.post = await this.postCreator.createPost({\n\t\t\tparentPostId: this.request.body.parentPostId || this.codeError.get('postId'),\n\t\t\tstreamId: this.codeError.get('streamId'),\n\t\t\ttext: this.request.body.text,\n\t\t\tmentionedUserIds: this.mentionedUserIds\n\t\t});\n\t}", "function newPost(req, res) {\n var loggedInUser = req.user;\n var postBody = _.pick(req.body.post, ['imageUrl', 'description']);\n\n postBody.owner = loggedInUser._id.valueOf();\n var newPost = new Post(postBody);\n\n newPost.save().then((post) => {\n res.send({ post });\n }, (e) => {\n res.status(400).send(e);\n }).catch((e) => res.status(400).send(e));\n}", "static async makePost(post) {\n return new Post({\n id: 0,\n pid: 0,\n tid: post.tid,\n communityID: post.communityID,\n created: post.created,\n\n body: post.body,\n painting: post.painting,\n empathy: 0,\n screenName: post.screenName,\n\n appData: post.appData,\n });\n }", "static async create(postData) {\n return new Promise(async (resolve, reject) => {\n try {\n const { title, pseudonym, post_body } = postData;\n let result = await db.query(`INSERT INTO thoughts (title, pseudonym, post_body) VALUES ($1, $2, $3) RETURNING *;`, [title, pseudonym, post_body]);\n let newPost = new Post(result.rows[0])\n resolve(newPost);\n\n } catch (err) {\n reject('Post could not be created');\n }\n });\n }", "function addPost() {\n vm.newPost.userId = vm.userId;\n Post\n .create(vm.newPost)\n .$promise\n .then(function(post) {\n vm.postForm.$setPristine();\n $state.go('blog');\n });\n }", "async addPost(_, {\n title, content, published\n }, { authUser }) {\n // Make sure user is logged in\n if (!authUser) {\n throw new Error('You must log in to continue!');\n }\n const user = await db.user.findOne({ where: { id: authUser.id } });\n\n return db.post.create({\n userId: user.id,\n title,\n content,\n published\n });\n }", "function createPost() {\n // Check length of title max: 256 chars\n if (postTitle.value.length > 255) {\n return 0;\n }\n\n // If title is within max length, create post\n fetch(\"/session\")\n .then((response) => response.json())\n .then((userData) => {\n console.log(\"fetched user: \" + userData);\n\n postData(\"/api/posts\", {\n title: postTitle.value,\n content: postContent.value,\n userId: userData.user_id,\n }).then((data) => {\n loadDashboardPosts();\n });\n });\n}", "function createPost(post) {\n var id = hash(post.title + post.auth + Date.now());\n console.log(\"post\");\n var auth = post.auth;\n var color = false;\n User.findOne({\n id: post.uid\n }, function(err, u) {\n if (!err && u) {\n if (u.color) {\n color = u.color\n\n }\n\n pO = {\n id: id,\n title: san.escape(post.title),\n auth: auth,\n alt: post.alt,\n color: color,\n uid: post.uid,\n date: Date.now(),\n tags: post.tags.map(san.escape).map(function(t) {\n t.toLowerCase()\n }),\n content: san.escape(post.content),\n comments: [],\n favs: 0\n }\n var npost = new Post(pO);\n npost.save();\n }\n })\n\n return id;\n}", "function createPost(post) {\n socket.emit('createPost', { post });\n}", "function newPost(req, res, next) {\n Post.create(req.body).then((post) => {\n req.response.content = post;\n post.isOwner = (req.user == post.author);\n User.findOne({username: req.user}).then((user) =>{\n user.posts.push(post._id);\n User.findOneAndUpdate({_id: user._id}, user).then(() => next())\n })\n next();\n }).catch((err) => res.send(err))\n}", "function createNewPost(){\n Quas.ajax({\n url : \"/php/post-create.php\",\n type : \"POST\",\n data : {\n sid : getCookie(\"session\")\n },\n success : function(res){\n Toolbar.postID = res;\n Quas.setUrlValues({p:Toolbar.postID});\n new Notification(\"Created Post\", 3).render();\n }\n });\n}", "create(postData) {\n const reqId = shortid.generate();\n this.logger.info(`Request ID: ${reqId} - Creating post with payload: ${JSON.stringify(postData)}`);\n\n return this.post.createPost(postData)\n .then(post => {\n this.logger.info(`Request ID: ${reqId} - Created post with Payload: ${JSON.stringify(postData)}`);\n return post;\n })\n .catch(error => {\n this.logger.error(`Request ID: ${reqId} - Error creating post, reason: ${error.toString()}`);\n throw error;\n });\n }", "function createPost(object, callback) {\n post = new TSchemas.Post();\n ContentModel = TSchemas.model(object.data.postType);\n contentObj = new ContentModel();\n \n // create a content object from data.content\n contentObj.create(object.data.content, function(err) { if(err) callback(err); else {\n // change the value of data.content to the ID of the content object, because that is what the schema wants\n object.data.content = contentObj._id;\n // create a post from the original object\n post.create(object, function(err) { if(err) callback(err); else {\n callback(null, post, contentObj);\n }});\n }});\n}", "async function createNewPost(req, res) {\n\n const user = await User.findOne({_id: req.body.User})\n const userId = user.id;\n const userSuburb = user.Suburb\n\n const newPost = new Post({\n User: userId, \n DidSelfIsolate: req.body.DidSelfIsolate,\n Suburb: userSuburb,\n Claps: 0\n });\n\n try {\n const savedPost = await newPost.save()\n res.json(savedPost);\n } catch (err) {\n res.json({\n message: err\n })\n }\n}", "function create_post(post, type, user) {\n const div = document.createElement('div');\n div.id = `post-${post['id']}`;\n document.querySelector('#posts').append(div);\n // Format the post\n format_post(post, type, user);\n}", "function createPost(post) {\n\treturn new Promise((resolve, reject) => {\n\t\tsetTimeout(() => {\n\t\t\tposts.push(post);\n\n\t\t\t// this is to simulate a run code that may create errors\n\t\t\tconst error = false;\n\t\t\tif (!error) {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\treject('Error in code');\n\t\t\t}\n\t\t}, 2000);\n\t});\n}", "function postPost(req, res) {\n let post = req.body;\n addExtraPostProperties(post);\n log.msg('adding post ' + JSON.stringify(post));\n postModel\n .create(post)\n .then(() => {\n addPostToBackup(post);\n res.status(200).send();\n })\n .catch((err) => {\n res.status(500).send(err);\n log.err('post_database:postPost:' + err);\n });\n}", "function addPost(post) {\n return db.query(\"insert into post (user_id, post_subject, post_content, post_topic_code) \"\n + \"values ( ?, ?, ?, ? );\", [post.user_id, post.subject, post.content, post.topic]);\n}", "async createPost () {\n\t\tthis.user = this.fromUser;\n\t\tthis.postCreator = new PostCreator({\n\t\t\trequest: this,\n\t\t\tteam: this.team,\n\t\t\tforInboundEmail: true,\n\t\t\torigin: 'email'\n\t\t});\n\t\tconst postData = {\n\t\t\tteamId: this.team.id,\n\t\t\tstreamId: this.streamId,\n\t\t\ttext: this.request.body.text\n\t\t};\n\t\tif (this.parentPostId) {\n\t\t\tpostData.parentPostId = this.parentPostId;\n\t\t}\n\t\ttry {\n\t\t\tawait this.postCreator.createPost(postData);\n\t\t}\n\t\tcatch (error) {\n\t\t\tthrow this.errorHandler.error('internal', { reason: error });\n\t\t}\n\t\tthis.post = this.postCreator.model;\n\t\tthis.responseData.post = this.post.getSanitizedObject({ request: this });\n\t\tthis.responseData = this.postCreator.makeResponseData({\n\t\t\ttransforms: this.transforms,\n\t\t\tinitialResponseData: this.responseData\n\t\t});\n\t}", "function createPost(post) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n posts.push(post);\n\n // const error = false;\n\n // if (error === false) {\n resolve();\n // } else {\n // reject('Error, something went wrong!')\n // } \n }, 2000);\n });\n}", "async function createPost() {\n\t\tif (File) {\n\t\t\tconst user = await Auth.currentAuthenticatedUser();\n\t\t\tconst { name: fileName, type: mimeType } = File;\n\t\t\tconst key = `postImages/${uuid()}${fileName}`;\n\t\t\t// const url = `https://${bucket}.s3.${region}.amazonaws.com/public/${key}`;\n\t\t\tlet date = new Date();\n\n\t\t\tconst inputData = {\n\t\t\t\timg: key,\n\t\t\t\tpostedBy: user.attributes.sub,\n\t\t\t\ttags: PostTags,\n\t\t\t\tcaption: PostCaption,\n\t\t\t\tloveCount: 0,\n\t\t\t\tcreatedDate: date.toISOString()\n\t\t\t};\n\n\t\t\ttry {\n\t\t\t\tawait Storage.put(key, File, {\n\t\t\t\t\tlevel: 'protected',\n\t\t\t\t\tcontentType: mimeType,\n\t\t\t\t\tprogressCallback(progress) {\n\t\t\t\t\t\tconsole.log(`Uploading... ${Math.floor(progress.loaded * 100 / progress.total)}%`);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tawait API.graphql(graphqlOperation(CreatePost, { input: inputData }));\n\t\t\t\tconsole.log('Success');\n\t\t\t} catch (err) {\n\t\t\t\tconsole.log('error: ', err);\n\t\t\t}\n\t\t\t// listPosts();\n\t\t} else {\n\t\t\t// print call a validation method...\n\t\t}\n\t}", "function createPost(post) {\n return new Promise((resove, reject) => {\n setTimeout(() => {\n posts.push(post);\n\n //Just for testing now; It shoud be actual error checking\n const error = false;\n\n if (!error) {\n resove();\n } else {\n reject(\"Error: Something went wrong\");\n }\n }, 2000);\n });\n}", "function saveNewPost(request, response) {\n console.log(request.body.message);\n console.log(request.body.author);\n //write it on the command prompt so we can see\n let post= {};\n let cleanAuthor = filter.clean(request.body.author);\n post.author = sanitizer.sanitize(cleanAuthor);\n let cleanMessage = filter.clean(request.body.message);\n post.message = sanitizer.sanitize(cleanMessage);\n let cleanImage = filter.clean(request.body.image);\n post.image = sanitizer.sanitize(cleanImage);\n if (post.image == \"\") {\n post.image = \"http://4.bp.blogspot.com/-NVNKQIypEFk/T82Of_w1KiI/AAAAAAAAAQE/WXTMrw3dUb8/s1600/mickey-mouse-and-minnie-mouse-cooking-coloring-pages-1.jpg\";\n }\n post.time = new Date();\n post.id = Math.round(Math.random() * 10000);\n posts.push(post);\n response.send(\"thanks for your message. Press back to add another\");\n databasePosts.insert(post);\n}", "async addPost(_, { title, content, status, tags }, { authUser }) {\n // Make sure user is logged in\n if (!authUser) {\n throw new Error(\"You must log in to continue!\");\n }\n const user = await User.findOne({ where: { id: authUser.id } });\n const post = await Post.create({\n userId: user.id,\n title,\n slug: slugify(title, { lower: true }),\n content,\n status\n });\n // Assign tags to post\n await post.setTags(tags);\n return post;\n }", "function createPost(post) {\n return new Promise( (resolve, reject) => {\n setTimeout( () => {\n posts.push(post);\n\n const error = false; // or true\n if(!error){\n resolve(); // all ok!\n } else {\n reject('Error: Something went wrong! :( '); // all not ok, ERROR!\n }\n\n } , 3000);\n });\n }", "async function createPost() {\n\t\tif (!title && !content) return;\n\t\tif (typeof window.ethereum !== 'undefined') {\n\t\t\tawait requestAccount();\n\t\t\tconst provider = new ethers.providers.Web3Provider(window.ethereum);\n\t\t\tconsole.log({ provider });\n\t\t\tconst signer = provider.getSigner();\n\t\t\tconst contract = new ethers.Contract(crudAddress, Crud.abi, signer);\n\t\t\tconst transaction = await contract.createPost(title, content);\n\t\t\tawait transaction.wait();\n\t\t}\n\t}", "function createBlogPost(req, res) {\n\t//Create a new blog post\n\tvar blogPost = new _blogPost(); //create a new instance of the blogPost model\n\tblogPost.subject\t = req.body.subject; //set the blog post's subject\n\tblogPost.description = req.body.description //set the blog post's description\n\n\tblogPost.save(function(err) {\n\t\tif (err)\n\t\t\tres.send(err);\n\n\t\tres.json({ message: 'Blog Post created!' });\n\t});\n\t\n}", "function createPost(post) {\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n posts.push(post);\n\n const error = false;\n\n if (!error) {\n resolve();\n } else {\n reject('Error: Something went wrong');\n }\n }, 2000);\n });\n}", "function createPost(postData) {\n const div = document.createElement('div');\n const h2 = document.createElement('h2');\n const p = document.createElement('p');\n const btn = document.createElement('button');\n\n btn.textContent = 'Delete Post';\n // On click, it should delete the item from the database\n // Then remove the item from the DOM on success\n btn.addEventListener('click', () => {\n // Pessimistic rendering, don't delete unless the post\n // was actually deleted from the DB\n fetch(`${url}/${postData.id}`, { method: 'DELETE' })\n .then(res => res.json())\n .then(() => {\n // We can access the div because it's available one level up\n // in the scope chain\n div.remove();\n })\n });\n\n h2.textContent = postData.title;\n p.textContent = postData.text;\n div.append(h2, p, btn);\n\n const postsSection = document.querySelector('.posts');\n\n postsSection.append(div);\n}", "async postCreate (req,res,next){\n req.body.post.images=[];\n for (const file of req.files) {\n req.body.post.images.push({\n url: file.secure_url,\n public_id: file.public_id\n });\n }\n const response = await geocodingClient.forwardGeocode({ \n query: req.body.post.location,\n limit: 1\n }).send();\n req.body.post.geometry = response.body.features[0].geometry;\n req.body.post.author = req.user._id;\n let post = new Post(req.body.post);\n\t\tpost.properties.description = `<strong><a href=\"/posts/${post._id}\">${post.title}</a></strong><p>${post.location}</p><p>${post.desc.substring(0, 20)}...</p>`;\n\t\tawait post.save();\n res.redirect(`/posts/${post.id}`);\n }", "function createPost() {\n var protoClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'proto-post';\n var imgSrc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'https://static.scientificamerican.com/blogs/cache/file/638FC5CE-96EC-46DA-AAC64985822092FE_source.jpg?w=590&h=800&BDB89ACC-71A2-463A-928419A181070C770';\n var postContent = arguments.length > 2 ? arguments[2] : undefined;\n var authorUsername = arguments.length > 3 ? arguments[3] : undefined;\n var authorImg = arguments.length > 4 ? arguments[4] : undefined;\n var newPost = document.getElementsByClassName(protoClass)[0].cloneNode(true);\n newPost.getElementsByTagName('img')[0].src = authorImg;\n newPost.getElementsByTagName('img')[1].src = imgSrc;\n newPost.getElementsByTagName('h1')[0].textContent = authorUsername;\n newPost.getElementsByTagName('p')[0].textContent = postContent;\n return newPost;\n} //-----------------show posts from everyone------------------", "addPost(){\n\n }", "function postNewPost(iduser, title, description) {\n return API.post('/posts', {\n iduser,\n title,\n description}).then(result => result.data);\n}// el servidor me devuelve un resultado que la guardo en result", "function createPost(text, author, comments){\n fs.readFile('data/data.json', 'utf8', function (err, data) {\n \n if (err) {\n return console.log(err);\n }\n parsedData = JSON.parse(data);\n var id = parsedData.posts[parsedData.posts.length-1].id + 1\n var post = new Post(text, author, comments, id);\n parsedData.posts.push(post);\n fs.writeFileSync('data/data.json', JSON.stringify(parsedData));\n //callback(parsedData.posts)\n });\n}", "async newPost(userPost) {\n const { handle, email, post } = userPost;\n const toLower = handle.toLowerCase();\n const params = {\n TableName: TABLE_NAME,\n Item: {\n handle: toLower,\n email: email,\n post: post,\n }\n };\n await ddbDocClient_1.ddbDocClient.send(new lib_dynamodb_1.PutCommand(params));\n }", "function createPost(postModel, data) {\n var mkPost = data.mkPost;\n var tags = data.tags;\n\n var dataUrlScheme = \"data\";\n var p = Promise.resolve();\n\n if(mkPost.imageUrl.slice(0, dataUrlScheme.length) === dataUrlScheme) {\n var imageBuf = dataHelpers.parseDataUrl(mkPost.imageUrl);\n p = dataHelpers.saveImage(imageBuf)\n .then(function(imageData) {\n var imageUrl = dataHelpers.getImageUrl(imageData.id)\n mkPost.imageUrl = imageUrl;\n });\n }\n\n var thePost;\n\n debug('creating post for account ' + mkPost.creatorId);\n\n return p\n .then(function() {\n return postModel.create(mkPost);\n })\n .then(function(post) {\n thePost = post;\n return Promise.all(tags.map(function(tag) {\n return models.Tag.findOne({\n where: {\n name: tag\n }\n })\n .then(function(tagInstance) {\n // if the tag doesn't exist, then we need to create it\n if(tagInstance)\n return Promise.resolve(tagInstance);\n else\n return models.Tag.create({\n name: tag\n });\n });\n }))\n })\n .then(function(tags) {\n debug('adding the tags to the post');\n return Promise.all([\n models.Account.findById(mkPost.creatorId),\n thePost.addTags(tags)\n ]);\n })\n .then(function(resolved) {\n var account = resolved[0];\n debug('adding the creator as a follower of the post');\n return thePost.addFollowers([account]);\n })\n .then(function() {\n return getPost(postModel, {\n where: {\n id: thePost.id\n }\n });\n });\n}", "async handleNewPostSubmit(event, text) {\n event.preventDefault();\n\n const path = '/home/posts/create';\n const userID = this.state.user._id;\n const requestBody = {userID, text};\n\n try {\n let res = await this.makeRequest(path, 'POST', requestBody);\n \n // add new post to state's user.posts array\n const postData = await res.json();\n if (postData) {\n console.log(postData.message);\n let userObject = this.state.user;\n userObject.posts.push({\n _id: postData._id,\n text: postData.text,\n created: postData.created\n });\n this.setState({user: userObject});\n }\n } catch (err) {\n console.log('Error: ' + err);\n }\n }", "function addPost(texts) {\n var postIds = creatID();\n let post = {\n texts: texts,\n ids: postIds,\n comments: []\n }\n posts.push(post);\n}", "async function handleAddPost() {\n router.push(\"/posts/create\");\n }", "function addPost(post) {\n const sql = 'INSERT INTO post (title, details, creatorID, tags) VALUES (?, ?, ?, ?);';\n /* Replaced to db.query, to allow apostrophe input. */\n // eslint-disable-next-line max-len\n return db.query(sql, [post.title, post.details, post.creatorID, post.tags]);\n}", "async create(req, res) {\n // Pegar todos os dados enviados\n const data = postFunctions.getPostJsonData(req)\n // Verificar se existe o índexId informado\n const postIndex = await postFunctions.getPostIndex(data.indexId)\n if (!postIndex) {\n return res.status(404).json({ mesage: 'post index not found' })\n }\n // Criar nova postagem com os dados informados\n const newPost = await Posts.create({ ...data }).catch(() => { error = true })\n // Verificar se criou direitinho\n if (!newPost || error) {\n return res.status(400).json({ message: 'creation failed' })\n }\n // Gravar o id da postagem no indexId\n const writenIdInIndex = await postFunctions.writePostIdInIndex(newPost._id, postIndex)\n // Verificar se o index foi modificado com sucesso\n if (!writenIdInIndex) {\n await Posts.findByIdAndDelete(newPost._id)\n }\n // Mensagem de confirmação\n return res.status(200).json({ message: 'post created', id: newPost._id })\n }", "static new_post(req, dynamoDb, callback) {\n if (Login.authenticate(req)) {\n const post = {\n staging: true,\n postId: 10\n };\n callback('render', 'posts/new', {post: post});\n } else {\n callback('redirect', '/login');\n }\n }", "function createNewComments(sample,forPost){\n Comment.create(sample,function(err,newComment){\n if(err) console.log(err)\n else{\n addCommentToPost(forPost,newComment);\n }\n });\n }", "async createPost(page,title,authorName,content){\n await page.type('#postTitle',title)\n const author = await page.$(\"#postAuthor\");\n await page.waitFor(2000)\n await author.type(authorName)\n await page.type('#postContent',content) \n await page.click('form>button')\n await page.waitFor(3000)\n }", "function createPost(post){\n return new Promise(function(resolve, reject){\n setTimeout(function(){\n posts.push(post);\n resolve();\n }, 2000);\n });\n}", "function postToFeed(req, res) {\n postModel.createPost({\n postTitle: req.body.postTitle,\n postLink: req.body.postLink,\n postingUser: req.session['currentUser']._id,\n feed: req.params['feedId']\n }).then(function(post) {\n return feedModel.addInternalPost(req.params['feedId'], post._id)\n .then(function(post) {\n return userModel.addPostToUser(post.postingUser, post._id)\n });\n }).then(function(response) {\n res.send(response);\n });\n }", "function submitPost(e){\n e.preventDefault();\n var title = e.target.title.value;\n var description = e.target.description.value;\n \n // form must be complete\n if (!title.length || !description.length){\n return false;\n }\n \n Posts.insert({\n title: title,\n description: description,\n creationDate: new Date(),\n owner: Meteor.userId(),\n username: Meteor.user().username\n });\n \n // clear posts writing form\n e.target.reset();\n Session.set('writingPost', false);\n}", "function makePost(postData) {\n let postList = document.getElementById(\"post-list\");\n let container = document.createElement(\"div\");\n container.id = postData.title;\n let postTitle = postData.title;\n let postContent = postData.content;\n let postDate = postData.date;\n\n container.innerHTML = `\n <h2>${postTitle} ${postDate}</h2>\n <p>${postContent}</p>\n `;\n\n let editBtn = document.createElement(\"button\");\n editBtn.innerHTML = \"Edit\";\n editBtn.type = \"button\";\n editBtn.id = \"edit:\" + postTitle;\n editBtn.addEventListener(\"clicked\", editPost);\n container.appendChild(editBtn);\n\n let deleteBtn = document.createElement(\"button\");\n deleteBtn.innerHTML = \"Delete\";\n deleteBtn.type = \"button\";\n deleteBtn.id = \"delete:\" + postTitle;\n editBtn.addEventListener(\"clicked\", deletePost);\n container.appendChild(deleteBtn);\n\n postList.appendChild(container);\n console.log(\"make post\");\n}", "add_post(state, post){\n state.posts.push(post)\n }", "async addPost({ commit, state }, createdPost) {\n try {\n const res = await axios.post(\"https://nuxt-web-blog.firebaseio.com/posts.json?auth=\" + state.token, createdPost)\n commit(\"ADD_POST\", { ...createdPost, id: res.data.name })\n } catch (e) {\n console.log(e.response)\n }\n }", "function createPost(post) {\n\n return new Promise ((resolve, reject) => {\n\n setTimeout (() => {\n posts.push(post);\n\n const error = false;\n\n if (!error) {\n //as soon as the timeout is done, it will resolve if there is no error, \"then\", we call get Posts afterwards\n resolve();\n } else {\n //this will run if we get an error and not resolve\n reject('Error, Something went wrong.');\n }\n }, 2000); \n\n });\n\n}", "async postCreate () {\n\t}", "function newPost() {\n // console.log(\"new post agular\")\n // console.log(\"vm.newPost:\", vm.newPost)\n var userId = Account.getUserIdFromJwt();\n var gardenId = $stateParams.id;\n $http\n .post('/api/users/' + userId + '/posts/' + gardenId, vm.newMessage)\n .then(function(response){\n vm.all.push(response.data)\n // isUsersPost();\n })\n toastr.success('Message Sent!')\n vm.newMessage = {}\n // location.reload();\n }", "function createPost(post) {\n // A promise takes in a callback function\n // It takes in 2 parameters: resolve, reject\n // When you want to resolve a promise successfully, you call 'resolve'\n // You something goes wrong, you call 'reject'\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n posts.push(post);\n\n const error = false;\n // const error = true; // uncomment this to see the .catch below work\n\n // Conditional\n // Reads as if not an error, then resolve\n // Else, if it is an error, then display message\n if (!error) {\n resolve();\n } else {\n reject('Error: Something went wrong! :(');\n }\n }, 750)\n })\n}", "function writeNewPost(uid, obj) {\n\n return new Promise(function(resolve,reject){\n // A post entry.\n var postData = {\n name: obj.name,\n id: obj.id,\n name: obj.name,\n photo: obj.photo,\n address: obj.address,\n location: {\n lat: obj.location.lat,\n lng: obj.location.lng\n }\n };\n\n db.ref('/user-posts/' + uid + '/collections/' + state.currentCollection.id + '/posts/').push(postData).once(\"value\")\n .then(function(snapshot) {\n\n db.ref('/user-posts/' + uid + '/collections/' + state.currentCollection.id).once(\"value\").then(function(snapshot){\n\n state.currentCollection.id = snapshot.key\n state.currentCollection.data = snapshot.val()\n resolve();\n\n })\n });\n });\n\n }", "function newPost(req, res, next){\n courseService.newPost(req.body.post, req).then(x => {\n res.json(x);\n })\n}", "async function savePost(req) {\n\t// Create a new post record to be stored in the database\n\tconst post_obj = {\n\t\tid: req.body.id,\n\t\tcreated: req.body.created,\n\t\tedited: req.body.edited,\n title: req.body.title,\n body: req.body.body,\n tags: req.body.tags,\n\t\tedits: req.body.edits,\n\t\tpublished: req.body.published,\n\t\tpublishedVersion: req.body.publishedVersion,\n\t\tcanComment: req.body.canComment,\n\t\tcomments: req.body.comments,\n\t\tarchived: req.body.archived\n\t};\n let result = await datastore.save({\n\t\tkey: datastore.key(['post', post_obj.id]),\n\t\tdata: post_obj,\n\t});\n\treturn result;\n}", "async function newPost() {\n let newPost = formatResults(await submitPost())[0];\n id(\"home\").prepend(generateCard(newPost));\n setTimeout(showHomeView, DELAY);\n }", "createPost (n, callback) {\n\t\tconst postOptions = {\n\t\t\tstreamId: this.teamStream.id,\n\t\t\ttoken: this.users[1].accessToken\t// the \"other user\" will create the posts\n\t\t};\n\t\tthis.postFactory.createRandomPost(\n\t\t\t(error, response) => {\n\t\t\t\tif (error) { return callback(error); }\n\t\t\t\t// \"currentPosts\" refer to the posts we are tracking ... firstPosts for the \"read\" ones, lastPosts for the \"unread\" ones\n\t\t\t\tthis.currentPosts.push(response.post);\n\t\t\t\tcallback();\n\t\t\t},\n\t\t\tpostOptions\n\t\t);\n\t}", "async createCodemarkPost (codemark, postId, stream, numReplies) {\n\t\tconst seqNum = this.bumpSeqNum(stream);\n\t\tconst postData = {\n\t\t\tid: postId,\n\t\t\tversion: 1,\n\t\t\tdeactivated: false,\n\t\t\tcreatedAt: codemark.createdAt,\n\t\t\tmodifiedAt: codemark.createdAt,\n\t\t\tcreatorId: codemark.creatorId,\n\t\t\tcodemarkId: codemark.id,\n\t\t\tteamId: codemark.teamId,\n\t\t\tstreamId: stream.id,\n\t\t\tseqNum,\n\t\t\tnumReplies\n\t\t};\n\n\t\tlet post;\n\t\tif (Commander.dryrun) {\n\t\t\tthis.log('\\t\\tWould have created post for codemark');\n\t\t\tpost = postData;\n\t\t}\n\t\telse {\n\t\t\tthis.log('\\t\\tCreating post for codemark...');\n\t\t\tpost = await this.data.posts.create(postData);\n\t\t}\n\t\tthis.verbose(postData);\n\t\treturn post;\n\t}", "async function createItemPost(postObj) {\n try {\n const BASE_URL = 'http://clever-neumann-583.herokuapp.com/posts'\n const url = `${BASE_URL}/posts`;\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `Bearer ${userToken}`\n },\n body: JSON.stringify({\n post: postObj\n }),\n });\n const newPost = await response.json();\n return newPost;\n } catch (error) {\n throw error;\n }\n}", "function insertPost(post) {\n let insertSQL = `INSERT INTO posts(title, author, date, description, content)\n VALUES(?, ?, ?, ?, ?)`;\n\n let post_array = [post.title, post.author, post.date, post.description, post.content];\n\n let database = new Database(config);\n\n database.query(insertSQL, post_array)\n .catch(err => {\n database.close();\n throw err;\n });\n}", "function addPost (req,res){\n var psts=[\n {title:\"رونالدو: أصبحت جزءاً من تاريخ كرة القدم\",description:'sssss'},\n {title:\"بايرن يعير بادشتوبر إلى شالكه\",description:'ssssssss'},\n {title:\"أنشيلوتي: الأندية الأوروبية في مأمن من الإنفاق الصيني\",description:'ssssss'}\n ];\n \n // var newPost=Post({\n // title:\"رونالدو: أصبحت جزءاً من تاريخ كرة القدم\",description:'sssss'\n // });\n //use the Post model to insert/save\n //but first we need to remove the whole data before insering the new once, notice in realy data sitution we should't do that, but here we do that just as an example\n Post.remove({},()=>{\n for(pst of psts){\n var newPost=new Post(pst); //here we create a new instance of Post model and add to it the post array of objects\n newPost.save();// here we use the save method of the object post or its instance which we call iet newPost to save data\n }\n // save the Post\n newPost.save(function(err) {\n if (err) throw err;\n console.log('Database seeded');\n });\n })\n \n res.send(\"Every thing is ok\") ;\n }", "function createNewPosts(posts,commentFn,comment){\n for(let post of posts){\n Post.create(post,function(err,newPost){\n if(err) console.log(err)\n else{\n commentFn(comment,newPost);\n }\n });\n }\n }", "function createBlogPost(post) {\n var title = $(\"<h1/>\").text(post.title);\n \n // Regular textarea (store as plain text)\n // var content = $(\"<p/>\").text(post.content);\n\n // TinyMCE Editor (the editor converts it to HTML)\n var content = $(\"<p/>\").html(post.content);\n var footer = $(\"<p/>\").text(\n \"Published by \" + post.author + \" on \" + post.date);\n\n var blogPostHTML = $(\"<div/>\").append([title, content, footer]).addClass(\"blogpost\");\n\n $(\".content\").prepend(blogPostHTML);\n }", "static async create(content, token) {\n return await sendRequest(\"POST\", \"/posts\", token, { content: content });\n }", "function createPost(post, callback) {\n setTimeout(() => {\n posts.push(post);\n callback();\n }, 2000);\n}", "function uiAddPost () {\r\n const postTitle = prompt('What is the post title ?');\r\n const postText = prompt('What is the post text ?');\r\n\r\n // TODO:\r\n newPost(postTitle, postText).then((data)=> {\r\n console.log(data)\r\n const display = document.querySelector('div.response')\r\n display.innerHTML = JSON.stringify(data, null, 2)\r\n })\r\n}", "addPost(post) {\n console.log(post);\n return this.http.post(\"http://localhost:8080/api/users/addPost/\" + JSON.parse(localStorage.getItem('user')).id, post);\n }", "function createPost(post, callback) {\n return new Promise((resolve, reject) => {\n setTimeout(() =>{\n posts.push(post);\n const error = false;\n\n if (!error) {\n resolve();\n } else {\n reject('Error: Something went wrong');\n }\n }, 2000);\n \n });\n}", "function Post(uri, title, label, creator){\r\n\tthis.URI=uri;\r\n\tthis.title=title;\r\n\tthis.label=label;\r\n\tthis.creator=creator;\r\n}", "function createPost(user_id, text_content) {\n const INSERT_POST = `\n INSERT INTO posts ( user_id, text_content, created_at) VALUES\n ($1, $2, (SELECT CURRENT_TIMESTAMP))\n `;\n return db.query(INSERT_POST, [user_id, text_content]);\n}", "function create_post() {\n const content = document.querySelector(\"#new-post-content\").value;\n\n // Create post\n fetch(\"/posts\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-CSRFToken\": csrftoken\n },\n body: JSON.stringify({\n content: content\n })\n })\n\n // Convert response to json\n .then(function(response) {\n return response.json();\n })\n\n // Log response to console\n .then(function(response) {\n window.alert(response.message);\n console.log(response);\n })\n\n // Load posts again so new post appears\n .then(function() {\n show_posts(\"/posts\", 1);\n })\n\n // Catch any errors and log them to console\n .catch(function(err) {\n console.log(err);\n })\n\n // Reset textarea\n document.querySelector(\"#new-post-content\").value = \"\";\n\n // Prevent default submission\n return false;\n}", "function receivedNewPost(post) {\n return {\n type: action_types_1.PostTypes.RECEIVED_NEW_POST,\n data: post,\n };\n}", "function createPost(postInfo) {\n\t$.post(\"http://tiny-pizza-server.herokuapp.com/collections/chat-messages\", postInfo);\n}", "function createPost(id, title, body, date) { \n var post = [`<div class=\"post-preview\">`,\n `<h2 class=\"post-title\">${title}</h2>`,\n `<p class=\"post-subtitle\">${body}</p>`, \n `<p class=\"post-meta\">Posted at ${date}`,\n `<a href=\"javascript:edit(${id})\" class=\"btn\"><span class=\"glyphicon glyphicon-pencil\"></span></a>`,\n `<a href=\"javascript:del(${id})\" class=\"btn\"><span class=\"glyphicon glyphicon-trash\"></span></a></p>`,\n `</div>`,\n `<hr>`].join(\"\\n\")\n return post;\n}//E N D function createPost", "function CreateNewPost(title, body, id) {\n var template = $(\"#templatePost\").text();\n console.log(template);\n\n // return template;\n $(\"body\").append(template);\n\n var $article = $(\"article:last-of-type\");\n\n $article.find(\"h2\").html(title);\n\n body = body.replace(\"\\n\", \"<br>\");\n\n $article.find(\"p\").html(body);\n\n $article.find(\"button\").attr(\"value\", id);\n $article.find(\"button\").attr(\"onClick\", \"ToggleComments(this)\");\n\n //We place our comments in this\n $article.find(\"section\").attr(\"id\", \"comments-\" + id);\n\n}", "async store ({ params, request }) {\n const property = await Property.findOrFail(params.id)\n const data = request.only([\n 'title',\n 'coment'\n ])\n\n const post = await Post.create({ ...data, property_id: property })\n\n return post\n }", "async create_post(req,res){\n\t\ttry{\n\t\t\tconst required = {\n\t\t\t\tsecurity_key:req.headers.security_key,\n\t\t\t\tauthorization_key:req.headers.authorization_key,\n\t\t\t\tdata:req.body,\n\t\t\t\tcheckexist:2\n\t\t\t}\t\n\t\t\tconst non_required= {}\n\t\t\tlet requestdata = await App.vaildObject(required,non_required);\n\t\t\tlet total_price=0;\n\t\t\tfor(let price in requestdata.data.product_details){\n\t\t\t\tif(requestdata.data.product_details[price].amount){\n\t\t\t\t\ttotal_price+=requestdata.data.product_details[price].amount;\n\t\t\t\t}else{\n\t\t\t\t\tlet message=\"Amount filed is missing product_details at position \"+JSON.stringify(requestdata.data.product_details[price]);\n\t\t\t\t\tthrow {code:400,message};\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet complete_data={\n\t\t\t\taddresses:requestdata.data.address,\n\t\t\t\tproduct_details:requestdata.data.product_details,\n\t\t\t\tuser_id:requestdata.users.id,\n\t\t\t\tamount:total_price\n\t\t\t};\n\t\t\tlet last_insert_id= await DB.save('create_posts',complete_data);\n\t\t\tcomplete_data.id=last_insert_id; \n\t\t\tcomplete_data.status=0; \n\t\t\tres.status(200).json({\n\t\t\t\t'success':true,\n\t\t\t\t'message':\"Create Post\",\n\t\t\t\t'code':200,\n\t\t\t\t'body':complete_data\n\t\t\t});\n\t\t}catch(err){\n\t\t\t$this.error(res,err);\n\t\t}\n\t}", "function createPost(){\n\n //we get the form and prevent the defualt behavior off its submit button\n var newPostForm = $('#form-posts');\n // console.log(newPostForm);\n newPostForm.submit(function(defaultEvent){\n // console.log(defaultEvent);\n\n defaultEvent.preventDefault();\n\n $.ajax({\n url : \"/posts/create\",\n method:\"POST\",\n data: newPostForm.serialize(), //this converts the foem data into json\n success : function(data){\n //data recooved from the api call\n // console.log(data); //ajax req by jquery will parse the string dat into json itslef\n let newPost = newPostDom(data.data.post , data.data.userName);\n $(\"#posts-display-wrapper\").prepend(newPost );\n //adding this function to delete post fucn to it can be deleted usin ajax\n deletePost($(' .delete-post-btn-link' , newPost));\n\n new PostComments(data.data.post._id);\n //this will enable the comment section to be dynamic\n expandComment($(`#btn-${data.data.post._id}`));\n //shows flash message\n sucessFlash(\"Post Created !\");\n new ToggleLike($(' .like-btn-link', newPost));//bind the new like button of this post to this clas\n \n \n },\n error: function(error){\n console.log(error.responseText);\n errorFlash(err.responseText);\n }\n });\n\n });\n\n }", "function createPost(post, callback) {\n setTimeout(() => {\n posts.push(post);\n callback();\n }, 2000);\n}", "function submitPost() {\n // add to database\n return new Promise( function(resolve) {\n // Create object and set up request\n let xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function() {\n if (this.readyState === 4 && this.status === 200) {\n resolve(this.responseText);\n }\n };\n\n // Get new post information, build query string\n let topics = document.getElementsByName(\"topic\");\n let topic = \"\";\n for (let option of topics) {\n if (option.checked) {\n topic = option.value;\n break;\n }\n }\n let queryString = \"username=\" + id(\"name\").value +\n \"&title=\" + id(\"post-title\").value +\n \"&content=\" + id(\"post-content\").value +\n \"&topic=\" + topic;\n\n // Pass query information into server script for POST request\n xhttp.open(\"POST\", \"../backend/new_post.php\", true);\n xhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xhttp.send(queryString);\n });\n }", "function saveMypost(req, res) {\n //para verificar\n console.log('Post /api/post')\n console.log(req.body)\n\n var preid = req.body.title\n var pre_id = preid.toLowerCase();\n\n\n function convert(pre_id) {\n let newId = ''\n for (let i of pre_id) {\n if (i == ' ') {\n newId = newId + '-'\n } else {\n newId = newId + i\n }\n }\n return newId\n }\n\n function getmyDate(){\n const meses = new Array (\"Enero\",\"Febrero\",\"Marzo\",\"Abril\",\"Mayo\",\"Junio\",\"Julio\",\"Agosto\",\"Septiembre\",\"Octubre\",\"Noviembre\",\"Diciembre\")\n let f = new Date()\n let fecha = meses[f.getMonth()]+\" \"+(f.getDate().toString())+\",\"+(f.getFullYear().toString())\n return fecha\n }\n\n let nuevId = convert(pre_id)\n let fechaActual = getmyDate()\n //instanciamos\n\n\n\n let mypost = new Mypost()\n mypost._id = nuevId\n mypost.title = req.body.title\n mypost.autor = req.body.autor\n mypost.date = fechaActual\n mypost.description = req.body.description\n mypost.content = req.body.content\n mypost.img = req.body.img\n\n //save\n mypost.save((err, postCreado) => {\n if (err) {\n res.status(500).send({ message: 'error al crear el post: ' + err })\n } else {\n res.status(200).send({ mypost: postCreado })\n }\n })\n\n}", "async function createPost({ title, content, parentId, userId }) {\n const post = await knex('posts')\n .insert({ title, content, parent_id: parentId, owner_user_id: userId })\n .returning('*');\n post.childPosts = [];\n\n return camelize(post[0]);\n}", "onSubmit(e) {\n\t\te.preventDefault();\n\n\t\tconst post = { //title and body is now in the state so can just grab from there\n\t\t\ttitle: this.state.title, \n\t\t\tbody: this.state.body,\n\t\t\tdate: this.state.date\n\t\t}\n\n\t\t//Call action\n\t\tthis.props.createPost(post);\n\t}", "async create(req, res) {\n try {\n // Check if url given ends with a valid image extension such as .jpg or .png\n const isImage = await isImageURL(req.body.imageUrl);\n if (isImage) {\n const post = await Post.create({\n title: req.body.title,\n content: req.body.content,\n imageUrl: req.body.imageUrl,\n categoryId: req.body.categoryId,\n });\n res.status(201).send(post);\n } else {\n res.status(400).send(\"Wrong Url, please enter a valid image url!\")\n }\n } catch (e) {\n console.log(e)\n res.status(400).send(e)\n }\n }", "async function insertNewPost(post) {\n post = extractValidFields(post, PostSchema);\n const [ result ] = await mysqlPool.query(\n 'INSERT INTO posts SET ?',\n post\n );\n \n return result.insertId;\n }", "function Post (datePosted, user, text) {\n this.datePosted = datePosted;\n this.user = user;\n this.text = text;\n}", "function createPost(userID, topicID, content, callback) {\n pool.getConnection(function(err, connection) {\n if(err) {\n connection.release();\n return callback(err);\n }\n\n connection.query('INSERT INTO `Post` (`userID`, `topicID`, `content`, `postTime`) VALUES (?, ?, ?, NOW());', [userID, topicID, content], function(err, result) {\n if(err) {\n connection.release();\n return callback(err);\n }\n\n // Release the connection\n connection.release();\n\n // Run callback\n callback(null, (result.affectedRows>0));\n });\n });\n}", "createPost(event){\n // prevent default stops the page from auto reloading on form submit\n event.preventDefault();\n // this grabs the data from the form \n let formData = event.target;\n // creates a JavaScript object\n let rawPost = {\n body: formData.body.value\n };\n // console.log(\"creating the post\")\n PostService.createPost(rawPost);\n // form reset says go clear that form\n formData.reset();\n _draw();\n }", "function createPosts(post){\n return new Promise((resolve, reject) => {\n setTimeout(() =>{\n posts.push(post);\n\n const error = false;\n\n if(!error){\n resolve();\n }\n else{\n reject('Error: something went wrong');\n } \n },2000);\n });\n}", "function Post(datePosted, user, text) {\n this.datePosted = datePosted;\n this.user = user;\n this.text = text;\n}", "function insertRecord(req, res) {\n\n if(req.file) {\n\tvar post = new BlogPost();\n post.title = req.body.title;\n post.content = req.body.content;\n post.url = req.body.url;\n post.description = req.body.description;\n post.image = req.file.location;\n post.author = req.user.username;\n \n post.save((err, doc) => {\n if (!err) {\n res.redirect('post/blogPost');\n }\n });\n } else {\n res.render('create-post', {content: req.body}); // reload create post a pass content back in\n \n }\n\n}" ]
[ "0.8242593", "0.81065476", "0.7654327", "0.7518669", "0.7511522", "0.750402", "0.7430222", "0.74262244", "0.7422644", "0.74204165", "0.74079263", "0.73831743", "0.733665", "0.7317212", "0.72421", "0.7223112", "0.71948236", "0.7175566", "0.71679384", "0.7164915", "0.71567065", "0.7114112", "0.7087155", "0.70840377", "0.7067445", "0.7025451", "0.699203", "0.6989251", "0.6971491", "0.6959384", "0.6949978", "0.6935208", "0.6899283", "0.6898648", "0.6896979", "0.6893574", "0.6886129", "0.6873967", "0.68490744", "0.6798583", "0.6798532", "0.6795473", "0.6790451", "0.67760164", "0.67733175", "0.67576873", "0.6748801", "0.67452294", "0.67437786", "0.6739428", "0.67344797", "0.67291236", "0.6709808", "0.67076087", "0.6706768", "0.6673281", "0.6659482", "0.66483885", "0.6629058", "0.6617378", "0.6598731", "0.6583377", "0.65682906", "0.6565585", "0.65652907", "0.6538054", "0.65379107", "0.6495251", "0.6486915", "0.64865", "0.64857584", "0.6479002", "0.6474709", "0.6471058", "0.6466658", "0.64569443", "0.6450571", "0.6447153", "0.64438874", "0.64269143", "0.63985217", "0.639808", "0.6383397", "0.63713", "0.63586146", "0.6349132", "0.6347377", "0.6346834", "0.6346123", "0.6342786", "0.6342267", "0.6336186", "0.6334593", "0.63167435", "0.63114864", "0.62858456", "0.6278329", "0.627202", "0.62694067", "0.62678945" ]
0.7502742
6
function to add field to list of filled fields
function addFields(p, ...fields) { if (!p.state.fields) { p.state.fields = [...fields] } else { fields.filter(f => !p.state.fields.includes(f)).forEach(f => p.state.fields.push(f)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMoreFields(field) {\n var name = \"product[\"+field+\"][]\";\n if(field == 'images')\n name += '[img_path]'\n $(\"<input type='text' value='' />\")\n .attr(\"name\", name)\n .appendTo(\"#\"+field);\n}", "function addFields(){\n var fields=[\"id\",\"query2\", \"sameAs\"];\n \n var ftag='<input class=\"object\" type=\"text\" ondrop=\"drop(event)\" onndragover=\"allowDrop(event)\" size=\"50\" placeholder=\"..escribe o arrastra etiqueta..\"'\n \n \n for(var i in fields){\n $(\"#fieldsarea\").append('<label for=\"'+fields[i]+'\">'+id2json(fields[i])+' </label><br>')\n .append(ftag+\" id='\"+fields[i]+\"'>\")\n .append('<br>');\n }\n}", "function populateDataFields() {}", "addFieldValue() {\n this.add = this.add + 1;\n this.fieldArray.push(this.newAttribute);\n this.newAttribute = {};\n console.log(this.fieldArray);\n }", "function AddPropertyToField() {\n var obj = {\n 'id': 5,\n 'grower': 'Joe',\n 'farm': 'Dream Farm'\n };\n myField.objInfo = obj;\n}", "function attFields() {\n\n\tlet code = '<div id=\"fieldadd\">';\n\tfor (i = 0; i < NAME_LIST.length; i++) {\n\n\t\tif (NAME_LIST[i] === 'color') {\n\n\t\t\tcode += '<div class=\"w3-col l3 m4 w3-padding\">'+ NAME_LIST[i] +':<a class=\"w3-text-red\">*</a><br>'+\n\t\t\t\t\t\t'<input type=\"color\" id=\"color\" value=#808080 style=\"width:100%\">'+\n\t\t\t\t\t'</div>';\n\n\t\t} else if (NECESSARY_VAL.indexOf(NAME_LIST[i]) !== -1){\n\n\t\t\tcode += '<div class=\"w3-col l3 m4 w3-padding\">'+ NAME_LIST[i] +':<a class=\"w3-text-red\">*</a><br>'+\n\t\t\t\t\t\t'<input type=\"text\" autocomplete=\"on\" class=\"w3-input w3-border\" id=\"'+ NAME_LIST[i] +'\">'+\n\t\t\t\t\t'</div>';\n\t\t} else if ([\"PDB_file\",\"image\"].indexOf(NAME_LIST[i]) !== -1){\n\n\t\t\tcode += '<div class=\"w3-col l3 m4 w3-padding\">'+ NAME_LIST[i] +':<br>'+\n\t\t\t\t\t\t'<input type=\"file\" autocomplete=\"on\" id=\"'+ NAME_LIST[i] +'\">'+\n\t\t\t\t\t'</div>';\n\t\t} else {\n\n\t\t\tcode += '<div class=\"w3-col l3 m4 w3-padding\">'+ NAME_LIST[i] +':<br>'+\n\t\t\t\t\t\t'<input type=\"text\" autocomplete=\"on\" class=\"w3-input w3-border\" id=\"'+ NAME_LIST[i] +'\">'+\n\t\t\t\t\t'</div>';\n\t\t}\n\t};\n\t\n\tcode += '</div>';\n\treturn code;\n}", "function addFields(field, currFieldName, realIndex) {\n if (field.group) {\n var isGroupCreated = false, property;\n for (var i = 0; i < self.displayData.length; i++) {\n if (self.displayData[i].name === field.group && self.displayData[i].container === 'g') {\n isGroupCreated = true;\n property = { 'name': currFieldName, 'realFieldIndex': realIndex };\n property.extensionName = field.extensionName;\n self.displayData[i].fields.push(property);\n break;\n }\n }\n if (!isGroupCreated) {\n var groupDetails = getGroupDetails(field.group);\n var group = {\n container: 'g',\n fields: [],\n name: groupDetails.id,\n groupDetails: {\n 'id': groupDetails.id,\n 'heading': $translate.instant(groupDetails.heading),\n 'collapsible': groupDetails.collapsible\n }\n };\n property = { 'name': currFieldName, 'realFieldIndex': realIndex };\n property.extensionName = field.extensionName;\n group.fields.push(property);\n self.displayData.push(group);\n }\n } else {\n var fieldContainerCreated = false;\n var displayDataLength = self.displayData.length;\n if (displayDataLength && self.displayData[displayDataLength - 1].container === 'f') {\n fieldContainerCreated = true;\n property = { 'name': currFieldName, 'realFieldIndex': realIndex };\n self.displayData[displayDataLength - 1].fields.push(property);\n }\n\n if (!fieldContainerCreated) {\n property = { 'container': 'f', 'name': currFieldName, 'realFieldIndex': realIndex, 'fields': [] };\n property.fields.push({ 'name': currFieldName, 'realFieldIndex': realIndex });\n self.displayData.push(property);\n }\n\n }\n\n if (typeof field.type === \"object\") {\n Object.getOwnPropertyNames(field.type).forEach(function (propName) {\n addFields(field.type[propName], currFieldName + \".\" + propName);\n });\n }\n }", "add(fields) {\r\n\t\t\tconst addField = (path, options) => {\r\n\t\t\t\tif (obsidian.Field === options || obsidian.Field === options.type) {\r\n\t\t\t\t\tthrow new Error(\"The field type must be a child class of obsidian.Field\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if the options param is a Field\r\n\t\t\t\tif (obsidian.Field.isPrototypeOf(options)) {\r\n\t\t\t\t\toptions = {type: options};\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Make sure the type field is a Field\r\n\t\t\t\tif (!obsidian.Field.isPrototypeOf(options.type)) {\r\n\t\t\t\t\tthrow new Error(\"The type parameter must be an instance of the Field class\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.schemaFields[path] = new options.type(this, path, options);\r\n\t\t\t}\r\n\r\n\t\t\tconst processFieldDefinition = (definition, prefix = \"\") => {\r\n\t\t\t\tObject.keys(definition).forEach((key) => {\r\n\t\t\t\t\tconst obj = definition[key];\r\n\r\n\t\t\t\t\tif (!obj) {\r\n\t\t\t\t\t\tthrow new Error(`Invalid value for schema path ${prefix+key} in ${this.listName}`);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (isPlainObject(obj) && !obj.type && Object.keys(obj).length) {\r\n\t\t\t\t\t\t// obj is a nested field\r\n\t\t\t\t\t\tprocessFieldDefinition(obj, prefix + key + \".\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\taddField(prefix + key, obj);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\t// Recursivly process the field definitions\r\n\t\t\tprocessFieldDefinition(fields);\r\n\t\t}", "addFields(fields) {\n if (fields[0] === false) {\n this.options.fields = false;\n\n return this;\n }\n\n this.options.fields = this.options.fields || {};\n\n fields.forEach((field) => {\n if (isArray(field)) {\n field.forEach((field) => {\n this.options.fields[field] = field;\n });\n } else if (isObject(field)) {\n this.options.fields = Object.assign(this.options.fields, field);\n } else if (isString(field)) {\n this.options.fields[field] = field;\n }\n });\n\n return this;\n }", "function appendField(e,o){\n e.preventDefault();\n addField(o);\n}", "function addIngredientFields() {\n let newFields = $(\".ingredient-selector\")[0].cloneNode(true)\n newFields.children[0].value = \"\"\n newFields.children[2].value = \"\"\n $(\"#ingredient-appender\").append(newFields)\n}", "function processFieldArray(form, fields) {\n\n fields.forEach(function (field, key) {\n // Add it\n if (field.type) {\n form.fields.push(field);\n }\n // Remove it\n if (field.hide) {\n form = removeField(form, field.name);\n }\n });\n\n}", "function addField(fieldIndex){\n if(!fieldIndex){\n return;\n }\n var fieldTypes = [\n //Single Line Text Field\n {\"label\": \"New Text Field\", \"type\": \"TEXT\", \"placeholder\": \"New Field\"},\n //Date Field\n {\"label\": \"New Date Field\", \"type\": \"DATE\"},\n //DropDownField\n {\"label\": \"New Dropdown\", \"type\": \"OPTIONS\", \"options\": [\n {\"label\": \"Option 1\", \"value\": \"OPTION_1\"},\n {\"label\": \"Option 2\", \"value\": \"OPTION_2\"},\n {\"label\": \"Option 3\", \"value\": \"OPTION_3\"}\n ]},\n //Checkboxes Field\n {\"label\": \"New Checkboxes\", \"type\": \"CHECKBOXES\", \"options\": [\n {\"label\": \"Option A\", \"value\": \"OPTION_A\"},\n {\"label\": \"Option B\", \"value\": \"OPTION_B\"},\n {\"label\": \"Option C\", \"value\": \"OPTION_C\"}\n ]},\n //Radio Buttons Field\n {\"label\": \"New Radio Buttons\", \"type\": \"RADIOS\", \"options\": [\n {\"label\": \"Option X\", \"value\": \"OPTION_X\"},\n {\"label\": \"Option Y\", \"value\": \"OPTION_Y\"},\n {\"label\": \"Option Z\", \"value\": \"OPTION_Z\"}\n ]},\n //Multi Line Text Field\n {\"label\": \"New Text Field\", \"type\": \"TEXTAREA\", \"placeholder\": \"New Field\"},\n //Email Text field\n {\"label\": \"New Email Field\", \"type\": \"EMAIL\", \"placeholder\": \"New Field\"},\n //Password field\n {\"label\": \"New Password Field\", \"type\": \"PASSWORD\", \"placeholder\": \"New Field\"}\n\n ];\n\n FieldService\n .createFieldForForm(vm.formId, fieldTypes[fieldIndex])\n .then(function (response) {\n vm.fields = response.data;\n },\n function (error) {\n console.log(error.statusText);\n });\n\n\n }", "function processFieldArray(form, fields) {\n\n fields.forEach(function(field, key) {\n // Add it\n if(field.type) {\n form.fields.push(field);\n }\n // Remove it\n if(field.hide) {\n form = removeField(form, field.name);\n }\n });\n\n}", "addField(e) {\n const c = this\n let path = this.props.keys.replace(/\\./g, \"/\")\n\n let value\n if (Array.isArray(c.state.value)) {\n value = this.state.value\n } else if (typeof c.state.value === 'string') {\n value = [this.state.value]\n } else {\n value = [\"\"]\n }\n\n value.push(\"\")\n this.setState({ value })\n //TODO: handle if need to set up an association here\n //use firebase.push() instead\n\n firebaseActions( path, value)\n }", "function addField() {\n ctrl.productProperties.push({'key': '', 'value': ''});\n }", "addRequiredRuleToFields() {\n Object.values(this.props.fields).forEach(field => {\n if (field.required === true || typeof field.required === 'string') {\n const newFields = this.props.fields\n newFields[field.name].rules.push('isRequired')\n this.setState({ fields: newFields })\n }\n })\n }", "_mapFieldsToMenu() {\n const that = this;\n\n if (!that.fields && !that._valueFields) {\n return;\n }\n\n that._fields = (that.fields || that._valueFields).concat(that._manuallyAddedFields).map(field => {\n return { label: field.label, value: field.dataField, dataType: field.dataType, filterOperations: field.filterOperations, lookup: field.lookup };\n });\n }", "function wrapFields(fields) {\n return [{\"Field\": fields}];\n}", "function populateTagField (tagArray){\n\t\ttagArray.forEach(addTag);\n\t}", "addNewline(){\n // re-render formfield\n // TODO : to fix\n this.formFieldManage.applyConfigurationToformlyModel(this.configuration, this.wfFormFields, this.dataModel);\n this.wfFormFieldsOnlyNeededProperties = angular.copy(this.wfFormFields);\n }", "function associateData (newItem, items, field, zoteroField) {\n\tif (items[field]) {\n\tnewItem[zoteroField] = items[field];\n\t}\n}", "function addToInvalidFields(arr, fName, fValue) {\n arr.push({\"name\": fName, \"value\": fValue});\n}", "function addListItemFromForm() {\n addListItem( getFormValues());\n}", "addField(classId, fieldId, data) {\n this.fields[fieldId] = new FieldData(data);\n this.classes[classId].addField(fieldId);\n }", "function buildFields() {\n let rules = document.getElementsByClassName('rule');\n let rule = rules[0];\n var container = document.getElementsByClassName('container')[0];\n var newRule = rule.cloneNode(true);\n\n var elements = getStringsReplace(newRule);\n\n elements.string.id = 'string' + (rules.length + 1);\n elements.replace.id = 'replace' + (rules.length +1);\n clearFields(elements)\n\n container.appendChild(newRule);\n createEventListeners(newRule.getElementsByClassName('delete')[0]);\n}", "function addToField(input, addSpace) {\n problemField.append(input);\n if (addSpace) {\n problemField.append(\" \");\n }\n }", "function addFieldRow(e) {\n e.stopPropagation();\n var $ul = getUl(this)\n , id = $ul.attr('id')\n , $tgl = getToggleField($ul);\n $ul.append(getTemplate(id));\n focusInput($ul);\n if (!isChecked($tgl)) {\n setToggleField($(this), true);\n $ul.addClass('visible');\n }\n render();\n}", "addGraphQLField(field) {\n this._graphQLFields.push(field);\n }", "function addField(state = {}, action) {\n\n switch (action.type) {\n case \"formBuilder.AddField\": {\n // TODO: Promp for a key/field-name first.\n let key = \"new\" + Object.keys(state.properties).length;\n state.properties[key] = {\"type\": \"string\", \"title\": \"Textfield \" + Object.keys(state.properties).length};\n return state;\n }\n default:\n return state;\n }\n}", "static addFieldCo(paylod) {\n return {\n type: FieldAction.ADDFIELD,\n payload\n }\n }", "function addAdField(app, tab, key, cnt, cb) {\n\tAdminFields.find({'appname':app, 'table':tab, 'name':key}, function(err, docs) {\n\t\tvar s_flag = true;\n\t\tvar thisfield = {};\n\t\tif (err) {\n\t\t\tconsole.log('error checking in on key ' + key + ' in ' + app + '\\'s ' + tab + 'table.');\n\t\t\tthrow err;\n\t\t}\n\t\tif (! docs.length) {\n\t\t\tthisfield = new AdminFields();\n\t\t\tthisfield.name = key;\n\t\t\tthisfield.appname = app;\n\t\t\tthisfield.table = tab;\n\t\t} else if (rejig_db == 'all') {\n\t\t\tthisfield = docs[0];\n\t\t} else s_flag=false;\n\t\tthisfield.listorder = thisfield.editorder = cnt++;\n\t\tif (s_flag) {\n\t\t\tif (key == 'id' || key == '_id' || key == 'modified_date' || key == 'created_date') {\n\t\t\t\tthisfield.listed = false;\n\t\t\t\tthisfield.edited = false;\n\t\t\t} else {\n\t\t\t\tthisfield.listed = true;\n\t\t\t\tthisfield.edited = true;\n\t\t\t}\n\t\t\tthisfield.save(function(err){\n\t\t\t\tif (err) {\n\tconsole.log('ERROR adding ' + key + ' in ' + tab + ' for ' + app);\n\tconsole.log(err);\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t\tcb();\n\t\t\t});\n\t\t} else cb();\n\t});\n}", "function field_list_of_fixed_values(data,editable,config) {\n\tif (data == null) data = [];\n\ttyped_field_multiple.call(this, data, editable, config);\n}", "function addCommaToField(element, item) {\n element.value = element.value + ', '\n}", "function fillNestedFields($multifield, valueArr) {\n _.each(valueArr, function (record, index) {\n $multifield.find(\".js-coral-Multifield-add\").click();\n //a setTimeout may be needed\n _.each(record, function (value, key) {\n setWidgetValue($($multifield.find(\"[name='./\" + key + \"']\")[index]), value);\n });\n });\n }", "function _addToChangedFields(obj)\r\n {\r\n if(obj && !(this.isFieldModified(obj.id)))\r\n {\r\n this._mChangedFields[this._mChangedFields.length] = obj.id;\r\n this._mHasUserModifiedData = true;\r\n }\r\n }", "function UpdateAddableField(fieldType, fieldKey, fieldValue)\n{\n\t// fildKey is the key required to save the fieldType, ex. mobile: 01009091995, mobile is the key\n\tTi.API.info(\"UpdateAddableField: \" + fieldType + \", \" + fieldKey + \", \" + fieldValue);\n\t\n\t// TODO: Replace this with return statement\n\tif(contact == null) alert(\"Contact must be initialized ya beheema !\");\n\t\n\t// Add the new addable field to its array in contact\n\t// If contact[fieldType] is not empty, append to it, else create a new array\n\tvar fieldDictionary = contact[fieldType];\t// A workaround for iOS\n\ttry\n\t{\n\t\tfieldDictionary[fieldKey].push(fieldValue);\n\t}\n\tcatch(exp)\n\t{\n\t\tfieldDictionary[fieldKey] = [fieldValue];\n\t}\n\tcontact[fieldType] = fieldDictionary;\n\talert(contact[fieldType]);\n}", "function declaringFields() { }", "addField(fieldDef) {\n let fieldObject = null;\n switch (fieldDef.type.toUpperCase()) {\n case \"TEXT\":\n fieldObject = new Text(fieldDef);\n break;\n\n case \"EMAIL\":\n fieldObject = new Email(fieldDef);\n break;\n\n case \"TEXTAREA\":\n fieldObject = new Textarea(fieldDef);\n break;\n case \"BUTTON\":\n fieldObject = new Button(fieldDef);\n // Is the submit button ?\n if (\n fieldDef.hasOwnProperty(\"buttonType\") &&\n fieldDef.buttonType.toUpperCase() === \"SUBMIT\"\n ) {\n this.submitButton = fieldObject;\n }\n break;\n }\n if (fieldDef.hasOwnProperty(\"placeholder\")) {\n fieldObject.setPlaceholder(fieldDef.placeholder);\n }\n\n this._fieldCollection.addField(fieldDef.id, fieldObject);\n\n return this;\n }", "updateFieldItems() {\n this.fieldItems = this.getFieldItems();\n this.fullQueryFields = this.getFullQueryFields();\n this.availableFieldItemsForFieldMapping = this.getAvailableFieldItemsForFieldMapping();\n this.availableFieldItemsForMocking = this.getAvailableFieldItemsForMocking();\n this.mockPatterns = this.getMockPatterns();\n }", "function AppendFieldToList(element, index, array) {\r\n var selected = index == 0 ? 'selected=\"selected\"' : '';\r\n var s = String.format('<option value=\"{0}\" {1}>{0}</option>', element.Name, selected);\r\n this.append(s);\r\n}", "function add_fields(link, association, content) {\n var new_id = new Date().getTime();\n var regexp = new RegExp(\"new_\" + association, \"g\")\n $(link).up().insert({\n before: content.replace(regexp, new_id)\n });\n }", "function FieldList(parent){this.parent=parent;this.addEventListener();}", "function addTextField(first) {\n var remove = first ? '</div>' : '<a href=\"#\" class=\"remove_field\">Remove field</a></div>';\n var emptyField = '<div><input class=\"tool_name\" name=\"tool[name][]\" placeholder=\"Tool Name\" type=\"text\">';\n emptyField = emptyField + remove;\n $(\".input_field form\").append(emptyField);\n}", "function addFieldSuggestion(options, fieldName, suggestion) {\r\n if (fieldName in options) {\r\n options[fieldName].push(suggestion);\r\n } else {\r\n options[fieldName] = [ suggestion ];\r\n }\r\n}", "function infoForField(field, extendedProps) { // 434\n // 435\n // Ensure fields are not added more than once // 436\n if (_.contains(addedFields, field)) // 437\n return; // 438\n // 439\n // Get schema definitions for this field // 440\n var fieldDefs = ss.schema(field); // 441\n // 442\n var info = {name: field}; // 443\n // 444\n // If there are allowedValues defined, use them as select element options // 445\n if (useAllowedValuesAsOptions) { // 446\n var av = fieldDefs.type === Array ? ss.schema(field + \".$\").allowedValues : fieldDefs.allowedValues; // 447\n if (_.isArray(av)) { // 448\n info.options = \"allowed\"; // 449\n } // 450\n } // 451\n // 452\n addedFields.push(field); // 453\n // 454\n // Return the field info along with the extra properties that // 455\n // all fields should have // 456\n return _.extend(info, extendedProps); // 457\n } // 458", "function initializeFields() {\n // Not used\n}", "function addSelectedFields(row){\n\tvar table = $(\"selectedFields\");\n\tvar tBody = table.tBodies[0];\n\tvar new_tr = createRowForSelectedField(row);\n\t\n\ttBody.appendChild(new_tr);\n\t// $('td_' + table_name + '.' + field_name).style.display = status;\n\ttable.name = tBody.rows.length; \n}", "function registerManualField(id) {\n\tfieldsToCheck.push(id);\n}", "function populateList(){\n\t\tlistbuilder.empty();\n\t\t$.each(el.val().split(options.delimChar), function(){\n\t\t\tif(this != ''){ listbuilder.append( listUnit(this) ); }\n\t\t});\n\t\t//append typeable component\n\t\tlistbuilder.append('<li class=\"listbuilder-entry-add\"><input type=\"text\" value=\"\" title=\"'+ options.userDirections +'\" /></li>');\n\t}", "function addListElement() {\n\n var m_index = 0;\n for (index in field) { //iterate over all items in array \n var name = dom.getName($scope),\n $child = $scope.querySelector('[data-name=\"' + name + '\\[' + index + '\\]\"]'); //get child by name\n\n if (cls.preRenderView($scope, field[index])) { //check filters or other stuff that could avoid rendering that item\n\n $html = dom.parseHTML(cls.view.views[viewName].call(cls.view, field[index], index, $scope)); //render view\n\n var $close = $scope.querySelector('[data-name=\"' + name + '\\[' + m_index + '\\]\"]');\n\n if ($child) {\n $child.parentNode.replaceChild($html, $child);\n } else if ($close) {\n $close.parentNode.insertBefore($html, $close.nextSibling);\n } else {\n $scope.appendChild($html); //just append at the end\n }\n\n cls.bind($html); //bind to app to new html \n cls.postRenderView($html); //execute post render on added child\n\n } else {\n $child.parentNode.removeChild($child);\n }\n\n m_index = index;\n }\n }", "function fillAddDefaults(event) {\n let fields = ['brand', 'scale'];\n let selBrand = '#id_{0}-brand'.format(conf.prefix);\n let selScale = '#id_{0}-scale'.format(conf.prefix);\n fields.forEach(field => {\n let sel = '#id_{0}-{1}'.format(conf.prefix, field);\n let option = $(sel).find('option:selected');\n if ($(sel).val() && option) {\n let input = $('#id_{0}-{1}_ta'.format(conf.prefix_add, field));\n if (!input.val()) {\n let hiddenInput = $('#id_{0}-{1}'.format(conf.prefix_add, field));\n hiddenInput.val(option.val());\n input.val(option.text());\n }\n }\n });\n}", "addImageToField(image) {\n\t\tconst list = getArrayFromField(this.imagesField);\n\t\tlist.push(image);\n\t\tconsole.log('addImageToField -- list: ');\n\t\tconsole.log(list);\n\t\tsaveArrayToField(this.imagesField, list);\n\t}", "function fillDroplist(fieldName, newOptions, editable)\r\n{\r\n\tif (typeof(editable) == \"undefined\") editable = true;\r\n\tvar selectField = document.getElementById(fieldName);\r\n\tif (selectField == null) \r\n\t{\r\n\t\talert(\"DEBUG: the field was not found. Check the spelling. \" + fieldName);\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (editable) selectField.disabled = false;\r\n\t//selectField.className = \"detailFormField\";\r\n\tif (selectField.options==null) return;\r\n\t\r\n\tselectField.options.length = 0;\r\n\r\n\t// --- for an unknown reason, newOptions[0] becomes (newOptions[1] where newOptions[0] = \"0\") - detect and avoid\r\n\r\n\tif (newOptions.length == 1 && newOptions[0] == \"0\") return;\r\n\tfor(var i=0, max=newOptions.length; i<max; i++)\r\n\t{\r\n\t\t//if (newOptions[i] == \"0\") alert(\"TRUE\");\r\n\t\tselectField.options[i] = new Option(newOptions[i].text, newOptions[i].value, newOptions[i].defaultSelected, newOptions[i].selected);\r\n\t}\r\n}", "function cloneField(){\n // Duplicar os campos / Quais campos ? \n const newFieldContainer = document.querySelector('.schedule-item').cloneNode(true)\n\n // pegar os campos ? Quais campos ?\n const fields = newFieldContainer.querySelectorAll('input')\n\n // para cada campo, limpar\n\n fields.forEach(function(field) {\n // pegar o field do momento e limpa ele\n field.value = \"\"\n })\n\n // Colocar na pagina / Onde ?\n document.querySelector('#schedule-item').appendChild(newFieldContainer)\n}", "function makeFields$static(config/*:LinkListDropAreaWithSuggestions*/)/*:Array*/ {\n var result/*:Array*/ = [];\n if (AS3.getBindable(config,\"defaultFields\")) {\n result = result.concat(AS3.getBindable(config,\"defaultFields\"));\n }\n if (AS3.getBindable(config,\"extraFields\")) {\n result = result.concat(AS3.getBindable(config,\"extraFields\"));\n }\n return result;\n }", "function setUpFields(fields){\n\n\t_.forEach(fields, function(value, key){\n\t\tif(value.type == 'date'){\n\t\t\t$scope.data.thisContent[value.field || value.key] = {\n\t\t\t\tstartDate: $scope.data.thisContent[value.field || value.key] || null,\n\t\t\t\tendDate: null //have to stub but don't use all the time\n\t\t\t}\n\t\t}\n\t})\n\n\treturn fields;\n\n}", "function onAdd() {\n\n var tmp = $scope.section.rows[$scope.section.rows.length - 1];\n if (tmp.cols.length > 0) {\n if (tmp.cols[0].fields.length > 0) {\n $scope.section.rows.push(OdsFormService.newRowObject());\n }\n }\n }", "addFields(newValues) {\n this.setFields(_objectSpread({}, this.getFields(), newValues));\n return this;\n }", "get availablefields() {\r\n return new Fields(this, \"availablefields\");\r\n }", "addLookup(title, lookupListId, lookupFieldName, properties) {\r\n const props = extend({\r\n FieldTypeKind: 7,\r\n LookupFieldName: lookupFieldName,\r\n LookupListId: lookupListId,\r\n Title: title,\r\n }, properties);\r\n const postBody = jsS({\r\n \"parameters\": extend(metadata(\"SP.FieldCreationInformation\"), props),\r\n });\r\n return this.clone(Fields_1, \"addfield\").postCore({ body: postBody }).then((data) => {\r\n return {\r\n data: data,\r\n field: this.getById(data.Id),\r\n };\r\n });\r\n }", "function newField(field, action) {\n var label = document.createElement(field + \"_label\");\n label.id = field + \"_label\";\n \n if (action == \"add\"){\n if (field == 'preacher')\n label.appendChild(document.createTextNode('Please enter preacher\\'s full name: '));\n else if (field == 'series')\n label.appendChild(document.createTextNode('Please enter title of series: '));\n }\n else if (action == \"select\") {\n if (field == 'preacher')\n label.appendChild(document.createTextNode('Preacher: '));\n else if (field == 'series')\n label.appendChild(document.createTextNode('Series: '));\n }\n\n label.setAttribute(\"style\", \"font-weight:normal\");\n\n // replace field label with new label\n var fieldDiv = document.getElementById(field + \"_label\");\n var parentDiv = fieldDiv.parentNode;\n parentDiv.replaceChild(label, fieldDiv);\n\n // create new input box\n if (action == \"add\"){\n var txtbox = document.createElement(\"input\");\n txtbox.setAttribute(\"type\", \"text\");\n }\n else if (action == \"select\") {\n var txtbox = document.createElement(\"select\");\n txtbox.setAttribute(\"size\", \"4\");\n \n // TODO: HERE\n var arr = $.parseJSON('<?php echo json_encode($preacher_list); ?>');\n var i = 0;\n for (i=0; i<=arr.length; i++) {\n var option = document.createElement(arr[i]);\n option.text = arr[i];\n txtbox.add(option);\n }\n }\n \n txtbox.setAttribute(\"id\", field);\n txtbox.setAttribute(\"value\", \"\");\n txtbox.setAttribute(\"name\", field);\n txtbox.setAttribute(\"style\", \"width:200px\");\n\n // replace selection box with input box\n var fieldDiv = document.getElementById(field);\n var parentDiv = fieldDiv.parentNode;\n parentDiv.replaceChild(txtbox, fieldDiv);\n\n // create link to select field instead\n var link = document.createElement('a');\n link.id = \"new_\" + field;\n \n if (action == \"add\") {\n var linkText = document.createTextNode('Select ' + field + ' from list');\n link.setAttribute('href', \"javascript:newField('\" + field + \"','select')\");\n } \n else if (action == \"select\") {\n var linkText = document.createTextNode('New ' + field + '?');\n link.setAttribute('href', \"javascript:newField('\" + field + \"','action')\");\n }\n \n link.appendChild(linkText);\n \n var fieldname = \"new_\" + field;\n var fieldDiv = document.getElementById(fieldname);\n var parentDiv = fieldDiv.parentNode;\n\n // replace existing node sp2 with the new span txtbox sp1\n parentDiv.replaceChild(link, fieldDiv);\n}", "_setRequiredFields() {\n const that = this;\n\n if (!that.requiredFields || !that.requiredFields.length) {\n return;\n }\n\n const currentValue = that.value;\n let reqGroup = [];\n\n for (let i = 0; i < that.requiredFields.length; i++) {\n const reqField = that.requiredFields[i],\n field = that.fields.find(field => field.dataField === reqField);\n\n if (field) {\n let valueRecords = [];\n\n if (currentValue) {\n let i = 0;\n\n //Doing a lookup on the value for records that contain 'requiredFields'\n //Modifies the value dynamically\n while (i < currentValue.length) {\n const val = currentValue[i];\n\n if (Array.isArray(val)) {\n let r = 0;\n\n while (r < val.length) {\n let record = val[r];\n\n if (record && record[0] === field.dataField) {\n valueRecords.push(record);\n val.splice(r > 0 ? r - 1 : r, 2);\n continue;\n }\n\n r++;\n }\n }\n\n if (!val.length) {\n currentValue.splice(i, 2);\n continue;\n }\n\n i++;\n }\n }\n\n //Check if group records exist inside value\n if (valueRecords) {\n for (let r = 0; r < valueRecords.length; r++) {\n reqGroup.push(valueRecords[r]);\n reqGroup.push('and');\n }\n }\n else {\n //If no records create a placeholder\n reqGroup.push([reqField]);\n reqGroup.push('and');\n }\n }\n }\n\n //Remove the lastly added 'and' condition\n if (typeof reqGroup[reqGroup.length - 1] === 'string') {\n reqGroup.pop();\n }\n\n //Add the Required Fields on Top of the value\n that.value.unshift(reqGroup, 'and')\n }", "function addFields(){\n var container = document.getElementById(\"container\");\n var input = document.createElement(\"input\");\n input.type = \"text\";\n input.id=\"list-field\";\n\n var number=container.childElementCount;\n input.id=\"list-field\"+ number;\n if (number<13) {\n container.appendChild(input);\n }\n // Append a line break\n// container.appendChild(document.createElement(\"br\"));\n// alert(number);\n}", "ing_field_list() {\n Template.instance().dataLocationList.set([{ label: '', value: '', selected: true }]\n .concat(_.map(Locations.find({}, { fields: { _id: 1, locationName: 1 } }).fetch(),\n function renameLocation(loc) {\n return { label: loc.locationName, value: loc._id, selected: false };\n })));\n return Template.instance().dataIngs.get();\n }", "function fieldsListPending() { throw \"baby\" }", "function cloneField() {\n //console.log(\"\")\n //Duplicate fields\n const newFieldContainer = document.querySelector('.schedule-item').cloneNode(true) //bolean: true or false\n\n //limpar os campos\n const fields = newFieldContainer.querySelectorAll('input')\n\n /* Manual reset fields\n fields[0].value = \"\"\n fields[1].value = \"\"*/\n\n fields.forEach(function (field) {\n //Take the field and clean\n field.value = ''\n })\n\n //Show on page\n document.querySelector('#schedule-items').appendChild(newFieldContainer)\n}", "_pushFields(fields, indexValue, type = 'default') {\n if (!_.isUndefined(indexValue)) {\n let index = this._rowsIndex[type][indexValue];\n if (_.isUndefined(index)) {\n this._rowsIndex[type][indexValue] = this._rows[type].length;\n this._rows[type].push(fields);\n } else {\n //this._rowsIndex.default[indexValue] = this._rows.default.length;\n let checker = this._getRuleChecker().setFields({\n 'new': fields,\n 'old': this._rows[type][index]\n });\n _.each(this.config.rules, rule => {\n if (checker.check(rule)) {\n this._rows[type][index] = fields;\n\n return false; // rule is matching, break next iteration\n }\n });\n }\n } else {\n this._rows[type].push(fields);\n }\n }", "function FieldList ( app ) {\n\t\tvar me = this;\n\t\tapp.getList( \"FieldList\", function ( reply ) {\n\t\t\tme.fields = reply.qFieldList.qItems;\n\t\t\tme.render();\n\t\t} );\n\t\tapp.getList( 'CurrentSelections', function ( reply ) {\n\t\t\tvar yearSel = reply.qSelectionObject.qSelections.filter( function ( val ) {return val.qField === 'Year'} );\n\t\t\tvar selectedYears = yearSel[0] ? yearSel[0].qSelectedCount : 0;\n\n\t\t\tme.selections = reply.qSelectionObject.qSelections;\n\t\t\tme.render();\n\t\t\t$( \"[data-qcmd='back']\" ).toggleClass( 'disabled', reply.qSelectionObject.qBackCount < 1 );\n\t\t\t$( \"[data-qcmd='forward']\" ).toggleClass( 'disabled', reply.qSelectionObject.qForwardCount < 1 );\n\t\t} );\n\t}", "function updateField( F, S ){\n\t$( F ).val( $( F ).val( ) + S );\t//Appends content of TXT to the field FLD\n}", "get clonedFields() {\n \n // check result\n if(this.record.data) {\n //define an array key, value to be sent \n let clonedFields = [];\n \n for (let i=0; i< this.fields.length; i++) {\n //extract the short fieldName from the full name to be sent to the lightning-form component\n const tmpArray = this.fields[i].split(\".\");\n \n let fieldName = tmpArray[1];\n // get the value of each field\n let fieldValue = getFieldValue(this.record.data, this.fields[i]);\n //push fieldName and fieldValue for each field\n clonedFields.push({key : fieldName, value : fieldValue });\n }\n \n return clonedFields;\n }\n else return null;\n \n }", "function cloneField() {\n //Doubling fields\n const newFieldContainer = document.querySelector('.schedule-item').cloneNode(true)\n \n //Clear the fields\n const fields = newFieldContainer.querySelectorAll('input')\n\n fields.forEach(function(field) {\n field.value = \"\"\n })\n\n //Page\n document.querySelector('#schedule-items').appendChild(newFieldContainer)\n}", "function createFormFields(fields) {\n var _items = [];\n for (var i = 0; i < fields.length; i++) {\n var field = fields[i];\n var item = {};\n for (var key in FieldPlistMapper) {\n if (FieldPlistMapper.hasOwnProperty(key) && (field[key] !== null && field[key] !== undefined)) {\n item[FieldPlistMapper[key]] = field[key];\n }\n }\n _items.push(item);\n }\n\n return _items;\n}", "function collectFieldLabelsAction(node, fieldname, context)\r\n {\r\n if (node == undefined || typeof(node) != 'object' || fieldname != 'fieldLabel' || node[fieldname] == undefined)\r\n return;\r\n\r\n if(node[fieldname])\r\n context.fields.push(node[fieldname]);\r\n }", "addFieldsToParam(searchParam) {\n let allFields = this.fields.split(',');\n allFields.push('Id');\n allFields.push('Name');\n let cleanFields = this.dedupeArray(allFields).join(',');\n searchParam.fieldsToQuery = cleanFields;\n }", "function updateHeaderFields() {\n data.fields.forEach(field => {\n let id = GatherComponent.idByGatherTeamField(gatherMakers, gatherMakers.team, field);\n field.attributes.name = elementById(id).value;\n });\n}", "addAttachmentField(aName, aValue) {}", "createFieldListString(fields) {\n if (!fields || !fields.length) return null;\n if (fields.length === 1) return `${fields[0]} field is`;\n const lastField = fields.pop();\n return fields.join(\", \") + ` & ${lastField} fields are`;\n }", "function associateData (newItem, dataTags, field, zoteroField) {\n\tif (dataTags[field]) {\n\t\tnewItem[zoteroField] = dataTags[field];\n\t}\n}", "function associateData (newItem, dataTags, field, zoteroField) {\n\tif (dataTags[field]) {\n\t\tnewItem[zoteroField] = dataTags[field];\n\t}\n}", "function associateData (newItem, dataTags, field, zoteroField) {\n\tif (dataTags[field]) {\n\t\tnewItem[zoteroField] = dataTags[field];\n\t}\n}", "function associateData (newItem, dataTags, field, zoteroField) {\n\tif (dataTags[field]) {\n\t\tnewItem[zoteroField] = dataTags[field];\n\t}\n}", "function insertFieldValues(lyr, fieldName, values) {\n var size = getFeatureCount(lyr) || values.length,\n table = lyr.data = (lyr.data || new DataTable(size)),\n records = table.getRecords(),\n rec, val;\n\n for (var i=0, n=records.length; i<n; i++) {\n rec = records[i];\n val = values[i];\n if (!rec) rec = records[i] = {};\n rec[fieldName] = val === undefined ? null : val;\n }\n }", "function add_fields(link, association, content) {\n var new_id = new Date().getTime();\n var regexp = new RegExp(\"new_\" + association, \"g\");\n $(link).parent().before(content.replace(regexp, new_id));\n}", "static createGameField(incrementFunc, decrementFunc, getNumberOfActiveFieldsFunc, getFieldStateFunc, modifyFieldStateFunc) {\n const numberOfFields = 49;\n let gameField = [];\n\n for (let i = 0; i < numberOfFields; i++) {\n // create fields and add them to the gameField list\n gameField.push(\n <Field\n fieldValue={i + 1}\n key={i.toString()}\n incrementActiveFields={incrementFunc}\n decrementActiveFields={decrementFunc}\n getNumberOfActiveFields={getNumberOfActiveFieldsFunc}\n getFieldState={getFieldStateFunc}\n modifyFieldState={modifyFieldStateFunc}\n />\n );\n }\n return gameField\n }", "function addListItem() {\n var itemInput = document.getElementById('itemInput');\n var priceInput = document.getElementById('priceInput');\n listObject.addListItem(itemInput.value, priceInput.value);\n itemInput.value = '';\n priceInput.value = '';\n buildList(listObject.listItems);\n listObject.saveList();\n}", "function updatePartnersFields() {\n data.partners.forEach(partner => {\n data.fields.forEach(field => {\n let id = GatherComponent.idByPartnerField(partner, field);\n partner.attributes[field.id] = elementById(id).value;\n });\n });\n}", "field (field, alias = null, options = {}) {\n alias = alias ? this._sanitizeFieldAlias(alias) : alias;\n field = this._sanitizeField(field);\n\n // if field-alias combo already present then don't add\n let existingField = this._fields.filter((f) => {\n return f.name === field && f.alias === alias;\n });\n if (existingField.length) {\n return this;\n }\n\n this._fields.push({\n name: field,\n alias: alias,\n options: options,\n });\n }", "function addToList(data){\n\n var signatureData = {\n type: \"\",\n filename: \"\",\n password: \"\",\n visible: false,\n useField: false,\n verticalPosition: \"Top\",\n horizontalPosition: \"Left\",\n pageNumber: 1,\n signatureField: \"\",\n image: \"\",\n tabUrl: \"\"\n };\n\n signatureData.type = data.type;\n signatureData.filename = data.filename;\n signatureData.password = data.password;\n signatureData.visible = data.visible;\n signatureData.useField = data.useField;\n signatureData.verticalPosition = data.verticalPosition;\n signatureData.horizontalPosition = data.horizontalPosition;\n signatureData.pageNumber = data.pageNumber;\n signatureData.signatureField = data.signatureField;\n signatureData.image = data.image;\n signatureData.tabUrl = data.tabUrl;\n storedForField.push(signatureData);\n\n}", "function updateRequiredField() {\n var fieldObject = pageFieldList[1];\n fieldObject = ['proposal.plannedPlatforms'];\n\n var platformField = conceptCommonServiceField.field('proposal.plannedPlatforms');\n var platforms = platformField.value() || [];\n\n platforms.forEach(angular.bind(this, function(platform){\n var fieldList = this.getFieldList(platform.platform.code);\n\n for (var field in fieldList) {\n fieldObject.push( fieldList[field] );\n\n //set field active\n conceptCommonServiceField.field(fieldList[field]).active(true);\n }\n }));\n\n pageFieldList[1] = fieldObject;\n }", "function CreateVatField(id, displayName) {\r\n obj = [];\r\n obj.Id = id;\r\n obj.DisplayName = displayName;\r\n return obj;\r\n}", "function insertField(item, cantidad){ \n\tfields++;\n\tvar copia = $(item).clone();\n\tvar itemID = $(item).attr(\"id\");\n\t$(copia).attr(\"id\", itemID+cantidad);\n\tvar labelID = $(copia).find(\".fieldLabel\").attr(\"id\");\n\t$(copia).find(\".fieldLabel\").attr(\"id\", labelID+cantidad);\n\t$(copia).attr(\"selected\", false);\n\t$(copia).hide();\n\t$(copia).appendTo($(\"#form\"));\n\t//alert (copia.attr(\"id\"));\n\t$(copia).mouseover(fieldHover);\n\tvar animando = false;\n\tif (!animando){\n\t\tanimando = true;\n\t\t$(copia).fadeIn(function(){\n\t\t\tanimando = false;\n\t\t});\n\t}\n\t//en caso de ser checkbox editamos los name e ids de sus inputs\n\tif (itemID == \"checkfieldbox\"){\n\t\t$(copia).find(\"#checkboxinput\").attr(\"name\", \"checkboxinput\"+(checkinputs-2));\n\t\t$(copia).find(\"#checkboxinput\").attr(\"id\", \"checkboxinput\"+(checkinputs-2));\n\t\t$(copia).find(\"#checkboxinput2\").attr(\"name\", \"checkboxinput\"+(checkinputs-1));\n\t\t$(copia).find(\"#checkboxinput2\").attr(\"id\", \"checkboxinput\"+(checkinputs-1));\n\t\t$(copia).find(\"#checkboxinput3\").attr(\"name\", \"checkboxinput\"+checkinputs);\n\t\t$(copia).find(\"#checkboxinput3\").attr(\"id\", \"checkboxinput\"+checkinputs);\n\t}\n\t//en caso de ser radiobuttons\n\tif (itemID == \"multiplefieldbox\"){\n\t\t$(copia).find(\"#radioinput\").attr(\"name\", \"Option\"+cantidad);\n\t\t$(copia).find(\"#radioinput\").attr(\"id\", \"radioinput\"+(radioinputs-2));\n\t\t$(copia).find(\"#radioinput2\").attr(\"name\", \"Option\"+cantidad);\n\t\t$(copia).find(\"#radioinput2\").attr(\"id\", \"radioinput\"+(radioinputs-1));\n\t\t$(copia).find(\"#radioinput3\").attr(\"name\", \"Option\"+cantidad);\n\t\t$(copia).find(\"#radioinput3\").attr(\"id\", \"radioinput\"+radioinputs);\n\t}\n\t//select\n\tif (itemID == \"selectfieldbox\"){\n\t\t$(copia).find(\"#selectoption\").attr(\"id\", \"selectoption\"+(selectoptions-2));\n\t\t$(copia).find(\"#selectoption2\").attr(\"id\", \"selectoption\"+(selectoptions-1));\n\t\t$(copia).find(\"#selectoption3\").attr(\"id\", \"selectoption\"+selectoptions);\n\t}\n\t$(copia).click (function(){\n\t\teditField(copia);\n\t});\n }", "function addField(fieldName,value) {\n\tenv.log(\"setting field: \"+fieldName+\" value: \"+value);\n\tenv.addField(fieldName,value);\n}", "push(value) {\n this.isModified = true;\n const ClassName = this.ele.fieldClass;\n let ele = new ClassName(this.ele.props);\n ele.setKey(this.fieldName);\n ele.set(value);\n return this._value.push(ele);\n }", "fieldsInfo () {\n return [\n {\n text: this.$t('fields.id'),\n name: 'id',\n details: false,\n table: false,\n },\n\n {\n type: 'input',\n column: 'order_nr',\n text: 'order No.',\n name: 'order_nr',\n multiedit: false,\n required: true,\n disabled: true,\n create: false,\n },\n {\n type: 'input',\n column: 'name',\n text: 'person name',\n name: 'name',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'input',\n column: 'email',\n text: 'email',\n name: 'email',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'select',\n url: 'crm/people',\n list: {\n value: 'id',\n text: 'fullname',\n data: [],\n },\n column: 'user_id',\n text: this.$t('fields.person'),\n name: 'person',\n apiObject: {\n name: 'person.name',\n },\n table: false,\n },\n {\n type: 'input',\n column: 'package_points',\n text: 'package points',\n name: 'package_points',\n required: false,\n edit: false,\n create: false,\n },\n\n // package_points\n {\n type: 'select',\n url: 'crm/package',\n list: {\n value: 'id',\n text: 'full_name',\n data: [],\n },\n column: 'package_id',\n text: 'package name',\n name: 'package',\n apiObject: {\n name: 'package.package_name',\n },\n table: false,\n },\n {\n type: 'input',\n column: 'package_name',\n text: 'package name',\n name: 'package_name',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'input',\n column: 'package_price',\n text: 'package price',\n name: 'package_price',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n\n {\n type: 'input',\n column: 'pur_date',\n text: 'purche date',\n name: 'pur_date',\n multiedit: false,\n required: false,\n edit: false,\n create: false,\n },\n ]\n }", "function generateFieldCheckBoxList() {\r\n\t\tlet div_start = '<div class=\"form-check form-check-inline\">';\r\n\t\tlet div_end = '</div>';\r\n\t\tlet html = '';\r\n\t\tgetFieldRefList().forEach(function(field) {\r\n\t\t\tlet input = '<input class=\"form-check-input\" type=\"checkbox\" value=\"'+field.code+'\" name=\"fields\" id=\"id_'+field.code+'\" '+(field.checked?'checked':'')+'>';\r\n\t\t\tlet label = '<label class=\"form-check-label\" for=\"id_'+field.code+'\">'+ field.libelle +'</label>';\r\n\t\t\thtml += div_start + input + label + div_end;\r\n\t\t});\r\n\t\t$('#fieldList').html(html);\r\n\t}", "beforeInit() {\n const { ele } = this.props;\n this._value = [];\n if (!ele.fieldClass) {\n FieldUtiles.prepareFieldsRec(ele);\n }\n this.ele = ele.fieldClass\n ? ele\n : FieldUtiles.getFieldData({ ele }, ObjectField);\n }", "_assignToActorField (fields, value) {\n const actorData = duplicate(this.actor)\n const lastField = fields.pop()\n fields.reduce((data, field) => data[field], actorData)[lastField] = value\n this.actor.update(actorData)\n }", "function update() {\n\t\tfilterIdentifier = $(\"#new_filter #filterIdentifier\");\n\t\talgorithmName = $(\"#new_filter #algorithmName\");\n\t\tmanagerName = $(\"#new_filter #managerName\");\n\t\tallFields = $([]).add(filterIdentifier).add(algorithmName).add(managerName);\n\t}", "addFieldInterface(interfaceId, fieldId, data) {\n this.fields[fieldId] = new FieldData(data);\n this.interfaces[interfaceId].addField(fieldId);\n }" ]
[ "0.68326205", "0.6637296", "0.660361", "0.6435505", "0.63701487", "0.635481", "0.63482696", "0.634238", "0.6329716", "0.63063127", "0.6267341", "0.6254801", "0.624701", "0.6224502", "0.61904466", "0.6168713", "0.610564", "0.6087245", "0.6081404", "0.60556734", "0.6052261", "0.6014806", "0.60094255", "0.6007837", "0.595978", "0.59097606", "0.59056723", "0.58985937", "0.58839655", "0.5876307", "0.58743805", "0.5859269", "0.5849211", "0.5835571", "0.58242", "0.58217937", "0.5814951", "0.5813778", "0.58094424", "0.5806379", "0.5798118", "0.57897675", "0.57888454", "0.5784431", "0.577597", "0.57647663", "0.574263", "0.5739096", "0.5732304", "0.5729838", "0.57202995", "0.5707965", "0.5704808", "0.56969225", "0.5688681", "0.56866777", "0.5679921", "0.5678328", "0.5677306", "0.56756985", "0.56752557", "0.5674795", "0.5670835", "0.56696725", "0.56683123", "0.5667241", "0.56429666", "0.56425565", "0.5637562", "0.5634754", "0.56298906", "0.5621562", "0.56091726", "0.5606872", "0.56035966", "0.55966884", "0.55895895", "0.5588856", "0.55790263", "0.55790263", "0.55790263", "0.55790263", "0.5576017", "0.5556196", "0.5547563", "0.552969", "0.5513412", "0.5509375", "0.55059767", "0.5503362", "0.5502521", "0.5502354", "0.54994", "0.54978055", "0.5496714", "0.5494756", "0.54938453", "0.54854393", "0.54799676", "0.54741764" ]
0.6815565
1
function to remove a flag from fields list when flag is unchecked
function removeFields(p, ...fields) { if (!p.state.fields) { return } else { fields.forEach(f => { let index = p.state.fields.indexOf(f); if (index > -1) { p.state.fields.splice(index, 1); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkUncheck(e) {\n const itemId = e.target.id;\n\n if (list[itemId].done == false) {\n list[itemId].done = true;\n } else {\n list[itemId].done = false;\n }\n\n updateLocalStore();\n loadList();\n}", "function checkUncheckAllForMultipleDetail(isCheck, formName, fieldName, statusFlag)\r\n{\r\n var obj = eval('document.'+formName+'.'+fieldName);\r\n\tvar len ;\r\n\t\r\n\tif(obj) len = obj.length;\r\n\telse return;\r\n\t\r\n\tif( len == null )\r\n\t{\r\n\t\tif(!obj.disabled)\r\n\t\t{\r\n\t\t\tobj.checked = isCheck;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tfor(var lvar_Cnt=0; lvar_Cnt < len; lvar_Cnt++)\r\n\t\t{\r\n\t\t if(! obj[lvar_Cnt].disabled) {\r\n\t\t\t obj[lvar_Cnt].checked = isCheck;\r\n \t\t\t changeStatusForMultipleDetail(formName,fieldName,obj[lvar_Cnt], statusFlag)\r\n\t\t }\r\n\t\t}\r\n\t}\r\n\treturn;\r\n}", "function CHMcheckUncheckAll(isCheck, formName, fieldName)\r\n{\r\n var obj = eval('document.'+formName+'.'+fieldName);\r\n\tvar len ;\r\n\t\r\n\tif(obj) len = obj.length;\r\n\telse return;\r\n\t\r\n\tif( len == null )\r\n\t\t{\r\n\t\t\tif(! obj.disabled)\r\n\t\t\t{\r\n\t\t\t\tobj.checked = isCheck;\r\n\t\t\t\tchangeStatus(formName,fieldName,obj)\r\n\t\t\t}\r\n\t\t}\r\n\telse\r\n\t{\r\n\t\tfor(var lvar_Cnt=0; lvar_Cnt < len; lvar_Cnt++)\r\n\t\t{\r\n\t\t if(! obj[lvar_Cnt].disabled) {\r\n\t\t\t obj[lvar_Cnt].checked = isCheck;\r\n \t\t\t changeStatus(formName,fieldName,obj[lvar_Cnt])\r\n\t\t }\r\n\t\t}\r\n\t}\r\n\treturn;\r\n}", "function uncheckAll()\n{\n\tvar checkboxes = $(\"#fieldPicker :checkbox\");\n\tfor (var i = 0; i < checkboxes.length; i++)\n\t{\n\t\t\tcheckboxes[i].checked = false;\n\t}\n\n}", "function uncheck() {\n document.querySelector(\"#mcp1\").checked = false;\n document.querySelector(\"#mcp2\").checked = false;\n document.querySelector(\"#mcp3\").checked = false;\n document.querySelector(\"#mcp4\").checked = false;\n\n }", "function GetCheckboxValue_REMOVEME(name, form)\n{\n if (form[name])\n {\n var field = GetFieldNamed(name, form);\n\n return field.checked == true;\n }\n}", "function unsetHiddenField(hiddenField, checkbox) {\n hiddenField.val('')\n checkbox.removeClass('checkedx').find('i.fa-check').hide()\n}", "function onStageListUnChecked(){\n document.getElementById(\"onstagelistMsg\").value='off';\n}", "function setUnselected(){\n $(\"input:checkbox[name=selectFoods]:checked\").each(function() {\n name = $(this).val();\n genId = \"#\" + name + \"Ext\";\n\n $(this).attr('checked', false);\n document.getElementById(name).selected = false;\n $(genId).find('input[type=\"number\"]').remove();\n });\n}", "function remove_selected(){\n\tfoodlst = SELECTED_DAY_ID == \"R\" ? MY_EXPRESS_PLAN : MY_CURRENT_PLAN[SELECTED_DAY_ID] ;\n\tvar j = 0;\n\t$(\".food_list_item\").each(function(){\n\t\tif(this.checked) { foodlst.splice( parseInt(this.getAttribute(\"id_tag\")) - j , 1 ); j++;}\n\t});\n\tdisplay_grocery_list();\n\tselect_day();\n\tupload();\n}", "function removeField(objSource) {\r\n var oSource = objSource;\r\n var len = oSource.length ; \r\n for (i = len - 1; i >= 0; i--) {\r\n if (oSource.item(i).selected == true) {\r\n oSource.remove(i);\r\n }\r\n }\r\n}", "function remove_fields(link){\n\t\n\t$(link).previous(\"input[type=hidden]\").value =\"1\";\n\t\n\t$(link).up(\".fields\").hide();\n}", "function uncheck(e) {\n // console.log(e);\n e.forEach((x) => x.checked = false)\n}", "removeChecked() {\n this.todos = this.todos.filter(todo => todo.checked === false);\n }", "function unCheck(lat,long)\r\n{\r\n var chk = $('#chkPriveLoc').attr('checked');\r\n if (chk == true)\r\n {\r\n $('#chkPriveLoc').attr('checked',false); \r\n }\r\n showLocation(lat,long) ; \r\n}", "function removeSelect(){\n answerEls.forEach(x=>{\n x.checked=false\n })\n }", "function remove_fields(link) {\n $(link).prev(\":hidden\").val(\"1\");\n $(link).parents(\".fields\").hide();\n}", "uncheck_price_fields(field){\n var inputs = $(filterField).find( $(\"#priceFilter input\"));\n $.each(inputs, function(index, current){\n var ids = $(current).attr(\"id\").split('-')[1];\n if(ids != $(field).attr('id').split('-')[1]){\n $(this).prop(\"checked\", false);\n }\n });\n }", "handleRemoveRecord(e) {\n const removeItem = e.target.dataset.item;\n\n this.selectedList = this.selectedList.filter(item => item.value != removeItem);\n\n this.displayList.map(element => {\n\n if (element.value == removeItem) {\n\n element.selected = false;\n\n }\n\n });\n\n this.publishEvent();\n }", "function OnRemoval_Change( e )\r\n{\r\n try\r\n {\r\n var newDamageTypeValue = Alloy.Globals.replaceCharAt( current_non_structural_element * 6 + 1 , Alloy.Globals.AeDESModeSectionFive[\"DAMAGE_TYPES\"] , $.widgetAppCheckBoxAeDESModeFormsSectionFiveNonStructuralDamageRemoval.get_value() ) ;\r\n Alloy.Globals.AeDESModeSectionFive[\"DAMAGE_TYPES\"] = newDamageTypeValue ;\r\n }\r\n catch( exception )\r\n {\r\n Alloy.Globals.AlertUserAndLogAsync( L( 'generic_exception_msg' ) + exception.message ) ;\r\n }\r\n}", "function remove_fields(t) {\n $(t).prev(\"input[type=hidden]\").val(\"1\"), $(t).closest(\".box\").hide()\n}", "uncheck_brand_fields(field){\n var inputs = $(filterField).find( $(\"#brandSection input\"));\n $.each(inputs, function(index, current){\n if($(this).attr(\"id\") != $(field).attr(\"id\")){\n $(this).prop(\"checked\", false);\n }\n });\n }", "clearEventLogRecordingsCheckbox() {\n this.packetRoot_.getElementsByTagName('input')[0].checked = false;\n }", "function resetFields() {\n $(\"#show-order\").hide();\n $(\"input:radio\").attr(\"checked\", false);\n $(\"input:checkbox\").attr(\"checked\", false);\n}", "function clearFieldsValue(fields){\n\tfor(var i=0;i<fields.length;i++){\n\t\tvar field = $(fields[i]);\n\t\tfield.value = '';\n\t\tfield.checked = false;\n\t}\n}", "function unCheckAllDepartmentBoxes() {\n $(\"#legend input[type='checkbox']\").removeAttr(\"checked\");\n hideAllCoursesAndLinks();\n}", "function clearFields() {\n document.getElementById('title-input').value = '';\n document.getElementById('due-date-input').value = '';\n document.getElementById('category-input').value = '';\n document.getElementById('urgency-input').value = '';\n document.getElementById('description-input').value = '';\n\n for (let i = 0; i < allUsers.length; i++) {\n allUsers[i].checkedStatus = false;\n }\n\n showAssignedTo();\n\n}", "function testCheckAllForMultipleDetail(obj, formName, fieldName, statusFlag)\r\n{\r\n\r\n\tchangeStatusForMultipleDetail(formName,obj.name,obj, statusFlag);\r\n if(obj.checked == false)\r\n eval('document.'+formName+'.'+fieldName).checked=false;\r\n\t\r\n return;\r\n}", "function removeField(field, parent = null){\r\n\t\tif(parent == null) parent = field.parentNode;\r\n\t\tparent.removeChild(field);\r\n\t\tif((box = getViaAttr(field.querySelector('.remove-field'),'data-check'))) uncheckBox(box);\r\n\t\tupdateIndex(parent);\r\n}", "function remove_fields (link) {\n\t //Sets hidden field for _destroy value to 1 (i.e. true) to indicate to remove fields\n\t //when submit button is clicked.\n\t $(link).previous(\"input[type=hidden]\").value = \"1\";\n\t //Navigates up DOM tree to first tag with class 'fields' and hides them\n\t $(link).up(\".fields\").hide();\n\t}", "function remove_fields(link) {\n $(link).prev(\"input[type=hidden]\").val(\"1\");\n $(link).closest(\".fields_group\").hide();\n}", "function remove_fields(link, is_new_record) {\n $(link).closest(\"div.add_other\").children(\"p.add_other\").children(\"a\").show();\n if(is_new_record){\n $(link).closest(\".fields\").remove();\n }\n else{\n $(link).prev(\"input[type=hidden]\").val(\"1\");\n $(link).closest(\".fields\").hide();\n }\n}", "function deSelectAnswers(){\r\n answer1.forEach((e) =>{\r\n e.checked=false;\r\n });\r\n}", "function uncheckbox(form, field) {\n var price = new Number(form.elements['price' + field].value);\n var tmpprice = \"\";\n var errmsg = MSG_INVALIDPRICE;\n if (isNaN(price)) {\n alert(errmsg);\n for(var i=0; i<form.elements['price' + field].value.length; ++i) {\n price = new Number(form.elements['price' + field].value[i]);\n if(! isNaN(price) || form.elements['price' + field].value[i] == \".\") {\n tmpprice += form.elements['price' + field].value[i];\n }\n }\n form.elements['price' + field].value = tmpprice;\n return false;\n }\n form.elements['uncertainprice' + field].checked = false;\n return true;\n}", "function onCheck(row){\n var grid = Ab.view.View.getControl('', 'fields_grid');\n var sTable = $(\"selectedFields\");\n var index = row.index;\n var dataRow = grid.getDataRows()[index];\n var table_name = row['afm_flds.table_name'];\n var field_name = row['afm_flds.field_name'];\n tBody = sTable.tBodies[0];\n var selectionCheckbox = dataRow.firstChild.firstChild;\n \n // if checkbox is checked,add selected fields to summary table and to view object.\n if (selectionCheckbox.checked == true) {\n \taddSelectedFields(row);\n }\n else \n if (selectionCheckbox.checked == false) {\n \n // otherwise, get the \"Remove\" button and click it\n removeButtons = document.getElementsByName(\"removeRow\");\n for (var x = 1; x < tBody.rows.length; x++) {\n var sRow = tBody.rows[x]\n if ((field_name == sRow.cells[0].innerHTML) && (table_name == sRow.cells[5].innerHTML)) {\n removeButtons[x - 1].click();\n }\n } \n }\n \n // save\t\n getFieldValues();\n}", "function removeCheck(){\n\t$(\"input:radio\").removeAttr(\"checked\");\n}", "unCheck() {\n let checkboxes = document.getElementsByTagName('input');\n for (var i=0; i<checkboxes.length; i++) {\n if (checkboxes[i].type === 'checkbox') {\n checkboxes[i].checked = false;\n }\n }\n }", "function uncheckedAll()\n\t{\n\t \t var pollchecks = document.getElementsByTagName(\"INPUT\");\n\t\t var _return = false;\t \n\t\t for (var i = 0; i < pollchecks.length; i++)\n\t\t {\t\t\t\n\t\t\tif(pollchecks[i].type == \"checkbox\")\n\t\t\t{\n\t\t\t\t pollchecks[i].checked = false;\n\t\t\t\t\n\t\t\t}\n\t\t }\n\t\t \n\t}", "function resetTchecked(list) {\n list.tChecked = undefined;\n }", "function ListHelp_uncheckAll(items) {\n\n\tfor (var i=0; i < items.length; i++) {\n\t\tif (items[i].type == 'checkbox' ) {\n\n\t\t\t// uncheck checkbox\n\t\t\titems[i].checked = false;\n\t\t}\n\t}\n}", "function unchecked_refund_items() {\n // change shipping cost\n jQuery('.refund_shipping_cost').val('');\n jQuery('.refund_shipping_cost').trigger('change');\n\n // change shipping tax\n jQuery('.refund_shipping_tax').val('');\n jQuery('.refund_shipping_tax').trigger('change');\n\n // change line items data\n jQuery('.refund_order_item_qty').val(0);\n jQuery('.refund_order_item_qty').trigger('change');\n }", "function uncheckOnInit(){\r\n\t\t\r\n\t\tvar objCheckboxes = g_objWrapper.find(\".uc-filelist-checkbox\");\r\n\r\n\t\tobjCheckboxes.each(function(){\r\n\t\t\tvar checkbox = jQuery(this);\r\n\t\t\tvar initChecked = checkbox.data(\"initchecked\");\r\n\t\t\t\r\n\t\t\tif(!initChecked)\r\n\t\t\t\tcheckbox.prop('checked', false);\r\n\t\t});\r\n\t\t\r\n\t}", "function excluyentes(seleccionado) {\n programador_web.checked = false; \n logistica.checked = false;\n peon.checked = false;\n \n seleccionado.checked = true; \n}", "function remFieldRow(e) {\n e.stopPropagation();\n var btn = this\n , $ul = getUl(btn);\n $(btn).parent().remove();\n if ($ul.children().length == 0) {\n setToggleField($ul, false);\n $ul.removeClass('visible');\n emptyStableVar($ul);\n } else {\n refreshStableVar(getName($ul));\n }\n render();\n}", "set hideFlags(value) {}", "set hideFlags(value) {}", "set hideFlags(value) {}", "set hideFlags(value) {}", "set hideFlags(value) {}", "set hideFlags(value) {}", "function removeSelected() {\n \t$(\"#check-list-box li\").each(function(idx, li) {\n $(li).removeClass(style + color + ' selected');\n $(li).find('span.state-icon').removeClass('glyphicon-check').addClass('glyphicon-unchecked')\n });\n }", "function clearFields() {\n $(\".toggle_text\").each(function() {\n var label = getLabelFromId($(this).attr('id'));\n\n if($(this).val() === label) {\n $(this).val('');\n }\n });\n}", "function none(){\n if($('#none').is(':checked')){\n $('#tbl_improvements *').attr(\"disabled\", \"disabled\");\n $('#add_row').hide();\n $('#tbl_improvements tbody').html('');\n $('#total-improvement-mv').html('');\n // alert('sdf');\n }else{\n $('#tbl_improvements *').removeAttr('disabled');\n $('#add_row').show();\n \n }\n}", "function limparFiltros() {\n listarFiltros().forEach((elemento) => {\n elemento.checked = false;\n });\n}", "function removeUnselectedFormStatusOptions() {\r\n\t$(':input[name='+getParameterByName('page')+'_complete] option').each(function(){\r\n\t\tif ( $(this).prop('selected') == false ) {\r\n\t\t\t$(this).remove();\r\n\t\t} else {\r\n\t\t\t$(this).css('color','gray');\r\n\t\t}\r\n\t});\r\n}", "function remove_fields(link) {\n\t$('#web_ref_add_link').fadeIn();\n\t$(link).prev(\"input[type=hidden]\").val(\"1\");\n\t$(link).closest(\".fields\").hide();\n}", "function deselectCBs() {\n d3.selectAll('.type-checkbox')\n .property('checked', false)\n update();\n d3.select('.kasiosCheckbox')\n .property('checked', false)\n kasios_update();\n}", "function editOption(){\r\n var inputCheck=document.querySelectorAll('#customCheck1');\r\n for(var i=0;i<inputCheck.length;i++){\r\n inputCheck[i].checked=false;\r\n inputCheck[i].disabled=false;\r\n }\r\n}", "function removeItem() {\n li = ul.children;\n for(let index = 0; index<li.length; index++){\n while(li[index] && li[index].children[0].checked){\n ul.removeChild(li[index]);\n }\n }\n }", "function remove_fields(link) {\n $(link).prev(\"input[type=hidden]\").val(\"1\");\n $(link).closest(\".row-fluid\").hide();\n}", "function facetsOff() {\n $('#solrquest-facets .facetFilter:input').prop(\"checked\", false);\n }", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function uncheckAll(id){\r\n toggleAll(id, false);\r\n}", "function hideCheckChange()\n{\n\tvar key = $(this).attr('data-id');\n\t\t\n\tFilters[key].HideEmpty = $(this).prop('checked');\n\n\tsetGrid(globData);\n\n\tDownSortOptionsPane.show();\n\t\n}", "function deleteCheckboxFeedback() {\n var datumInputs = $(this).parents('.datum').find('input.datum-field');\n \n // Mark all inputs as deleted\n if ($(this).is(':checked')) {\n \n datumInputs.prop('disabled', true); \n \n datumInputs.each(function(i, input) {\n inputFeedbackDeleted.apply(input);\n });\n }\n \n // Or show input as edited or unmodivied\n else {\n datumInputs.prop('disabled', false);\n \n datumInputs.each(function(i, input) {\n inputFeedbackEdited.apply(input);\n });\n }\n}", "function removeNames() {\n for (let i = names.length - 1; i > -1; i--) {\n const cbox = document.getElementById(\"cbox\" + i);\n if (cbox.checked) {\n names.splice(i, 1);\n }\n }\n updateNameList();\n}", "function ClearFields() { }", "function SP_DisableClassToggle(fieldObj, flag)\n{\n\tvar fieldClass = fieldObj.className;\n\tvar IndexReadonly = fieldClass.indexOf(\" readonly\");\n\n\tif(flag)\n\t{\n\t\tif(IndexReadonly == -1)\n\t\tfieldObj.className = fieldObj.className + \" readonly\";\n\t}\n\telse\n\t{\n\t\tif(IndexReadonly != -1)\n\t\tfieldObj.className = fieldObj.className.slice(0,IndexReadonly);\n\t}\n}", "function onlyOne(checkbox) {\n var checkboxes = document.getElementsByName('check');\n checkboxes.forEach((item) => {\n if (item !== checkbox) item.checked = false\n })\n}", "function members_check_uncheck( checkbox ) {\n\n\t\tvar type = 'grant';\n\t\tvar opposite = 'deny';\n\n\t\t// If this is a deny checkbox.\n\t\tif ( jQuery( checkbox ).attr( 'data-deny-cap' ) ) {\n\n\t\t\ttype = 'deny';\n\t\t\topposite = 'grant';\n\t\t}\n\n\t\t// Get the capability for this checkbox.\n\t\tvar cap = jQuery( checkbox ).attr( 'data-' + type + '-cap' );\n\n\t\t// If the checkbox is checked.\n\t\tif ( jQuery( checkbox ).prop( 'checked' ) ) {\n\n\t\t\t// Check any duplicate checkboxes.\n\t\t\tjQuery( 'input[data-' + type + '-cap=\"' + cap + '\"]' ).not( checkbox ).prop( 'checked', true );\n\n\t\t\t// Uncheck any deny checkboxes with the same cap.\n\t\t\tjQuery( 'input[data-' + opposite + '-cap=\"' + cap + '\"]' ).prop( 'checked', false );\n\n\t\t// If the checkbox is not checked.\n\t\t} else {\n\n\t\t\t// Uncheck any duplicate checkboxes.\n\t\t\tjQuery( 'input[data-' + type + '-cap=\"' + cap + '\"]' ).not( checkbox ).prop( 'checked', false );\n\t\t}\n\t}", "removeAll() {\r\n return this.clone(ViewFields_1, \"removeallviewfields\").postCore();\r\n }", "function remove_fields(link) {\n jQuery(link).prev(\"input[type=hidden]\").val(\"1\");\n jQuery(link).closest(\".fields\").hide();\n}", "function chkall_fran_orders(franid) {\n var checkBoxes=$(\".chk_pick_list_by_fran_\"+franid);\n if($(\"#pick_all_fran_\"+franid).is(\":checked\")) {\n checkBoxes.attr(\"checked\", !checkBoxes.attr(\"checked\"));\n }\n else {\n checkBoxes.removeAttr(\"checked\", checkBoxes.attr(\"checked\"));\n }\n}", "function cancelSetting() {\n $('input:checkbox').each(function (i, elem) {\n $(this).next('label').removeClass('without-pay');\n $(this).next('label').removeClass('paid');\n $(this).attr('checked', false);\n document.getElementById($(this).attr('id')).disabled = false;\n });\n}", "function deleteDisabledMenuItems(part) {\n if (part.type === 'Menu' && part.fields) {\n _.each(part.fields, (val, key) => {\n if (val === false) {\n delete part.fields[key];\n }\n });\n }\n }", "function CheckboxToggleField(chk, field) {\n var checked = chk.attr(\"checked\");\n \n field.attr(\"readonly\", !checked);\n if (checked) {\n field.removeClass(\"readonly\");\n } else {\n field.addClass(\"readonly\");\n field.val(\"\");\n }\n}", "function removeLabel(e, label){\n for(var i = 0; i < label.length; i++){\n if(label[i].selected === true && label[i].labels.includes(e.target.value) === true){\n label[i].labels.splice(label[i].labels.indexOf(e.target.value),1)\n }\nupdate(passUp)\n}\n}", "function resetFields() {\n $(\"#nameBox\").val(\"\");\n $('input[type=checkbox]').prop('checked',false);\n}", "function clearNewFieldInputs() {\n\n\t\t// Set the new input row as a variable.\n\t\tvar $newFields = $( 'tr.lw-woo-gdpr-user-optins-new-fields-row' );\n\n\t\t// Set the icon.\n\t\tvar $iconCheck = $newFields.find( 'span.lw-woo-gdpr-user-optins-field-new-success' );\n\n\t\t// Uncheck the box.\n\t\t$newFields.find( '#lw-woo-gdpr-user-optin-required-new' ).prop( 'checked', false );\n\n\t\t// Handle the text input fields.\n\t\t$newFields.find( '#lw-woo-gdpr-user-optin-title-new' ).val( '' ).focus();\n\t\t$newFields.find( '#lw-woo-gdpr-user-optin-label-new' ).val( '' );\n\n\t\t// Remove the class from the icon to display it.\n\t\t$iconCheck.removeClass( 'lw-woo-gdpr-user-optins-field-hidden' );\n\n\t\t// Then hide it again.\n\t\thideAgain = setTimeout( function() {\n\t\t\t$iconCheck.addClass( 'lw-woo-gdpr-user-optins-field-hidden' );\n\t\t}, 3000 );\n\t}", "function deselectFilter2Checkboxes() {\r\n let checkboxes = document.querySelectorAll('input[name='+filter+']');\r\n for (i = 0; i < checkboxes.length; i++) {\r\n checkboxes[i].checked = false;\r\n let next = checkboxes[i].nextElementSibling.firstChild;\r\n next.classList.add(\"hidden\");\r\n \r\n }\r\n document.querySelector(\"#alamkorpused\").style.display = 'none';\r\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}", "function uncheckAll(id){\n toggleAll(id, false);\n}" ]
[ "0.6414068", "0.6375232", "0.63284516", "0.621044", "0.61230785", "0.6114955", "0.6102945", "0.605799", "0.6054969", "0.60499823", "0.60499316", "0.603829", "0.6023395", "0.6020382", "0.5998657", "0.5984719", "0.59431964", "0.59430814", "0.59330964", "0.59300745", "0.5914972", "0.59141695", "0.58973294", "0.5835147", "0.5830125", "0.5809201", "0.57940423", "0.57906157", "0.5785922", "0.57847905", "0.5784252", "0.57771987", "0.57767695", "0.57751393", "0.5757823", "0.5750407", "0.57451224", "0.5744783", "0.5740241", "0.57277983", "0.57130545", "0.57108223", "0.5705773", "0.56919116", "0.5691255", "0.5691255", "0.5691255", "0.5691255", "0.5691255", "0.5691255", "0.5682082", "0.5678839", "0.5677915", "0.56702185", "0.56625247", "0.56616986", "0.56578493", "0.5649525", "0.56362975", "0.56308514", "0.5622192", "0.56187093", "0.56187093", "0.56187093", "0.56187093", "0.56187093", "0.56187093", "0.56187093", "0.56187093", "0.56187093", "0.5616895", "0.5616563", "0.56118023", "0.56089526", "0.56081074", "0.5608038", "0.5604711", "0.5603374", "0.55998254", "0.5587055", "0.55842274", "0.5582838", "0.5581432", "0.55748343", "0.5572951", "0.55618495", "0.55601126", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444", "0.55594444" ]
0.56597686
56
TODO: add a generic bind() function
function mapNextUniqId2() { window.setTimeout(mapNextUniqId3, CLICK_LOAD_DELAY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function simpleBind(context,fn){return function(value){fn.call(context,value);};}", "Bind(IDispatch, string, string) {\n\n }", "function bind(fn,ctx){function boundFn(a){var l=arguments.length;return l?l>1?fn.apply(ctx,arguments):fn.call(ctx,a):fn.call(ctx);}// record original fn length\nboundFn._length=fn.length;return boundFn;}", "function bind(fn,ctx){function boundFn(a){var l=arguments.length;return l?l>1?fn.apply(ctx,arguments):fn.call(ctx,a):fn.call(ctx);}// record original fn length\nboundFn._length=fn.length;return boundFn;}", "function bindable(){\n\t\t\n\t}", "function bind(e,t){return function(){return t.apply(e,arguments)}}", "function bind(fn, ctx) {\n\t\t return function (a) {\n\t\t var l = arguments.length;\n\t\t return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n\t\t };\n\t\t}", "function bind(fn, ctx) {\n\t function boundFn(a) {\n\t var l = arguments.length;\n\t return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn;\n\t}", "function bind(fn, ctx) {\n\t function boundFn(a) {\n\t var l = arguments.length;\n\t return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn;\n\t}", "function simpleBind(context, fn) { // 14775\n return function(value) { // 14776\n fn.call(context, value); // 14777\n }; // 14778\n } // 14779", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n }", "function BindAndRun() {\r\n}", "function bind(method,context){return function(){return method.apply(context,arguments);};}", "function bind(method,context){return function(){return method.apply(context,arguments);};}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function bind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn;\n}", "function newBind(fn,ctx) {\n return function () {\n return fn.call(ctx)\n }\n}", "function bind$1(fn,ctx){function boundFn(a){var l=arguments.length;return l?l>1?fn.apply(ctx,arguments):fn.call(ctx,a):fn.call(ctx);}// record original fn length\n\tboundFn._length=fn.length;return boundFn;}", "function bind (fn, ctx) {\n\t function boundFn (a) {\n\t var l = arguments.length;\n\t return l\n\t ? l > 1\n\t ? fn.apply(ctx, arguments)\n\t : fn.call(ctx, a)\n\t : fn.call(ctx)\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn\n\t}", "function bind (fn, ctx) {\n\t function boundFn (a) {\n\t var l = arguments.length;\n\t return l\n\t ? l > 1\n\t ? fn.apply(ctx, arguments)\n\t : fn.call(ctx, a)\n\t : fn.call(ctx)\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn\n\t}", "function bind (fn, ctx) {\n\t function boundFn (a) {\n\t var l = arguments.length;\n\t return l\n\t ? l > 1\n\t ? fn.apply(ctx, arguments)\n\t : fn.call(ctx, a)\n\t : fn.call(ctx)\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn\n\t}", "function bind (fn, ctx) {\n\t function boundFn (a) {\n\t var l = arguments.length;\n\t return l\n\t ? l > 1\n\t ? fn.apply(ctx, arguments)\n\t : fn.call(ctx, a)\n\t : fn.call(ctx)\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn\n\t}", "function simpleBind(context, fn) {\n\t return function(value) {\n\t fn.call(context, value);\n\t };\n\t }", "function BindFactory(){}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "function bind (fn, ctx) {\n function boundFn (a) {\n var l = arguments.length;\n return l\n ? l > 1\n ? fn.apply(ctx, arguments)\n : fn.call(ctx, a)\n : fn.call(ctx)\n }\n // record original fn length\n boundFn._length = fn.length;\n return boundFn\n}", "_bind() {\n\t\tthis._bindCaption();\n\t\tthis._bindChoices();\n\t}", "function bind_shim() {\n\n if (!Function.prototype.bind) {\n\n Function.prototype.bind = function(oThis) {\n\n if (typeof this !== \"function\") {\n // closest thing possible to the ECMAScript 5 internal IsCallable function\n throw new TypeError(\n \"Function.prototype.bind - what is trying to be bound is not callable\");\n }\n\n var fSlice = Array.prototype.slice, aArgs = fSlice.call(arguments, 1), fToBind = this;\n\n /**\n * @constructor\n */\n var fNOP = function() {\n\n };\n\n var fBound = function() {\n\n return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs\n .concat(fSlice.call(arguments)));\n };\n\n fNOP.prototype = this.prototype;\n fBound.prototype = new fNOP();\n\n return fBound;\n };\n }\n\n}", "function simpleBind(context, fn) {\n return function (value) {\n fn.call(context, value);\n };\n }", "function Bind_A_A_R() {\r\n}", "_bind(...methods) {\n methods.forEach((method) => this[method] = this[method].bind(this));\n }", "function bind$1(fn, ctx) {\n\t function boundFn(a) {\n\t var l = arguments.length;\n\t return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n\t }\n\t // record original fn length\n\t boundFn._length = fn.length;\n\t return boundFn;\n\t}", "function Bind_A_Obound() {\r\n}", "function Bind_A_A_A() {\r\n}", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function simpleBind(context, fn) {\n return function(value) {\n fn.call(context, value);\n };\n }", "function Bind_R() {\r\n}", "function bind(fn, obj) {\n\t return function binded() {\n\t return fn.apply(obj, arguments);\n\t }\n\t}", "function bind(fn /*: Function */, ctx /*: Object */) {\r\n if (!fn)\r\n { return false; }\r\n function boundFn(a) {\r\n var l /*: number */ = arguments.length;\r\n return l ? (l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a)) : fn.call(ctx);\r\n }\r\n // record original fn length\r\n boundFn._length = fn.length;\r\n return boundFn;\r\n }", "function bind(fn,o) {\n return function() {\n fn.call(o);\n }\n}", "function bind(ctx, fn) {\n return function() {\n return fn.apply(ctx, [].slice.call(arguments))\n }\n}" ]
[ "0.7354985", "0.7333845", "0.7269693", "0.7269693", "0.71582544", "0.70968765", "0.7057731", "0.69922155", "0.69922155", "0.69861144", "0.69621927", "0.69515264", "0.6932434", "0.6932434", "0.6926049", "0.6926049", "0.6926049", "0.6926049", "0.6926049", "0.6926049", "0.6926049", "0.6926049", "0.6926049", "0.6906089", "0.6904564", "0.6838116", "0.6838116", "0.6838116", "0.6838116", "0.6820376", "0.6806308", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6796115", "0.6784999", "0.67407966", "0.67302424", "0.67140985", "0.6706992", "0.66745615", "0.6652997", "0.6624731", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6622141", "0.6616556", "0.6600871", "0.6600655", "0.65992963", "0.6591014" ]
0.0
-1
Display the footer of the popup
_displayDialogFooter () { const { newTask, closeModal } = this.props; return ( <div className="modal-footer"> { newTask ? <button className="add-button button" type="submit" onClick={this._addTask}> {buttonsLabels.add_task_button_label} </button> : <div className="left-buttons-container"> <button className="save-button button" type="submit" onClick={this._editTask}> <img className="icon" src={assets.saveIcon} alt="" /> <div>{buttonsLabels.save_task_button}</div> </button> <button className="delete-button button" type="submit" onClick={this._deleteTask}> <img className="icon" src={assets.deleteIcon} alt="" /> <div>{buttonsLabels.delete_task_button}</div> </button> </div> } <button className="cancel-button button" onClick={closeModal}> {buttonsLabels.cancel_button} </button> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "displayFooter() {\n }", "function footer_func(){\n showfooter();\n hideicon();\n }", "function ShowTextPopup(PopUpHeader, PopUpContent, PopUpFooter)\n{\n $('.popup-wrap2').fadeIn(250);\n\t $('.popup-box2').removeClass('transform-out').addClass('transform-in');\n\t\t$(\"#PU_header\").html(PopUpHeader);\n $(\"#PU_content\").html(PopUpContent);\n\n\t\tif(PopUpFooter == \"\")\n\t\t{\n\t\t\t$(\".BottomPanel\").hide();\n\t\t}\n\t\telse {\n\t\t\t$(\".BottomPanel\").show();\n\t\t\t$(\"#PU_footer\").html(PopUpFooter);\n\t\t}\n}", "function showFooterPopup(Url) {\n\tvar iframe = document.createElement('iframe');\n\tiframe.frameBorder = 1;\n\t/*iframe.scrolling = \"auto\";*/\n\tiframe.setAttribute(\"id\", 'footer_popup_frame');\n\tiframe.setAttribute(\"src\", Url);\n\tiframe.setAttribute(\"class\", 'iframe_box_area');\n\tif (iframe) {\n\t\t$(\"#footer_popup_div\").append(iframe);\n\t}\n\tvar iPhone5 = /(iPhone|iPad)/i.test(navigator.userAgent);\n\tif(iPhone5) {\n\t\t$('#footer_popup_div').addClass('popup_iphone5');\n\t\t$('#footer_popup_last').niceScroll({touchbehavior:false, horizrailenabled:false, cursorcolor:\"#989898\",\n\t\t\tcursoropacitymax:0.7, cursorwidth:6, background:\"#ccc\", autohidemode:false});\n\t} else if((navigator.userAgent).match(/Android 2/i)) {\n\t\t$('#footer_popup_inner').addClass('popup_android');\n\t\t$('#footer_popup_frame').addClass('android_iframe_box_area');\n\t}\n\t$('#footer_popup_outer').show();\n\t$('#footer_popup_inner').show().animate({top:'50%'}, 500);\n\t$('#footer_popup_frame').attr('src', Url);\n\n\t/*Fix for the Bug 4729, popup position for android devices */\n\tif(navigator.userAgent.match(/Android/i)) {\n\t\tsetTimeout(function() {\n\t\t\tvar popupHeightcalc = $('#footer_popup_inner').outerHeight();\n\t\t\tvar popupWidthcalc = $('#footer_popup_inner').outerWidth();\n\t\t\t$('#footer_popup_inner').css({'margin-top' : (-popupHeightcalc/2), 'margin-left' : (-popupWidthcalc/2)});\n\t\t\t$('#footer_popup_inner').css({'transform': 'none', '-webkit-transform' : 'none'});\n\t\t\t$('#footer_popup_frame> html> body').oneFingerScroll();\n\t\t}, 1000);\n\t}\n\t/* To stop scrolling background when any popup appears for design area */\n\tstopBackgroundScroll();\n}", "function appendFooter(){\n var footer = \"<div class='footer'>\";\n footer += \"<center><div class='copyrightText'>&copy; 2017 ITEE Group Canada</div></center>\";\n footer += \"</div>\";\n $('body').append(footer);\n }", "showFooter(state, val) {\n state.showFooter = val;\n }", "function toggleFooter() {\r\n\t\t\tconsole.info('Info: Footer toggled.');\r\n\t\t\tif($(window).scrollTop() + $(window).height() + 80 >= $(document).height()) {\r\n\t \t\t\t$element.show();\r\n\t \t} else {\r\n\t\t\t\t$element.hide();\r\n\t\t\t}\r\n\t\t}", "renderFooter() {\n return null;\n }", "static showFooter(param) {\n if (param) {\n butCountBar === null || butCountBar === void 0 ? void 0 : butCountBar.setAttribute(\"style\", \"display:block\");\n }\n else {\n butCountBar === null || butCountBar === void 0 ? void 0 : butCountBar.setAttribute(\"style\", \"display:none\");\n }\n }", "function wePopup()\n{\n modal.style.display = \"block\";\n pagecontent.className += \" de-emphasized\";\n}", "get footer() { return $('#page-footer'); }", "function makeFooter() {\n return new Ext.Panel({\n region: 'south',\n height: 30,\n cls: 'footer-panel',\n html: '<div class=\"footer\">'\n + '<p>Wanderwerk V1.02. Edité le 21.10.13. Créé par <a href=\"http://ch.linkedin.com/in/benjamingerber\" target=\"_blank\" title=\"Voir le profil LinkedIn\" >Benjamin Gerber</a>, supporté par les <a href=\"http://www.scout-perceval.ch/\" target=\"_blank\" title=\"Voir le site des Scouts Perceval de Moutier\">Scouts Perceval de Moutier</a>. Application open source, disponible sur <a href=\"https://github.com/ger-benjamin/wanderwerk\" target=\"_blank\" title=\"Voir le code source\">github</a>. Sous licence <a href=\"http://creativecommons.org/licenses/by-nc/2.5/ch/deed.fr\" target=\"_blank\" title=\"Voir la licence\" >Creative Commons BY-NC</a></p>'\n + '</div>'\n });\n}", "goToFooter() {\n this.owner.enableHeaderAndFooter = true;\n this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.footerWidget);\n }", "function FOOTER$static_(){ToolbarSkin.FOOTER=( new ToolbarSkin(\"footer\"));}", "function footer() {\n var amountCompleted = ctrl.amountCompleted();\n var amountActive = ctrl.list.length - amountCompleted;\n \n return E('footer') . is ({ id: 'footer' }) . has([\n \n E('span') . is ({ id: 'todo-count' }) . has([\n// E('strong') . has (T(F`${count} items left`)) // jshint ignore:line\n ]),\n \n // Filters (all, active, completed)\n E('ul') . is({ id: 'filters' }) . has ([\n E('li') . has(T(\"All\")) . does({ click: _ => data.filter = 'all' }),\n E('li') . has(T(\"Active\")) . does({ click: _ => data.filter = 'active' }),\n E('li') . has(T(\"Completed\")) . does({ click: _ => data.filter = 'completed' })\n ]),\n \n /* jshint ignore:start */\n E('button') .\n has (T(F`Clear completed ${completedcount}`)) . // jshint ignore:line\n is ({ id: 'clear-completed' }) .\n does({ click: _ => 0 }) //clearCompleted })\n /* jshint ignore:end */\n ]);\n }", "function callback() {\n let keeper = `\n <div class=\"container py-5\">\n <div class=\"text-center text-white\">\n <h5>&copy;Ahmad Essam 30-9-2021</h5>\n </div>\n </div>\n `\n document.getElementById('myFooter').innerHTML = keeper;\n}", "function setFooter(stats) {\n var footer = '';\n if (stats.show == 'true') {\n if (stats.type.value == \"image\") {\n footer = '<div id=\"footer\" style=\"z-index:30;text-align:' + stats.align.value + ';\"> <img src=\"' + basePath + 'images/' + stats.logo + '\" /></div>';\n }\n else {\n footer = '<div id=\"footer\" style=\"z-index:3;position:absolute;width:100%;text-align:' + stats.align.value + ';\"><div class=\"font-setter\" style=\"z-index:3;font-size:' + stats.size.value + ';\">' + stats.text + '</div></div>';\n }\n }\n return footer;\n }", "function toggleFooter() {\n var footerVisibility = document.getElementById(\"question-footer\");\n if (footerVisibility.style.display === \"none\") {\n footerVisibility.style.display = \"block\";\n } else {\n footerVisibility.style.display = \"none\";\n }\n }", "function animateFooter(fc, id) {\n fc.css(\"display\", \"block\");\n anime({\n targets: id + ' .wpc-footer > .names',\n translateX: 100 + \"px\",\n opacity: [1, 0],\n // scale: [.75, .9],\n delay: function (el, index) {\n return index * 380;\n },\n direction: 'reverse'\n });\n }", "function printingInfoContainer() {\n jQuery('<div id=\"ksp_printing_info\" class=\"popupinfo\"> \\\n <a class=\"viewerClose\" style=\"float: right; z-index: 100\" href=\"#\" onclick=\"shadowViewer.hide();return false;\"><img alt=\"close\" title=\"close\" src=\"/stores/realmadrid/artwork/english/interface/close_v1.jpg\"></a> \\\n <div class=\"content\"> \\\n <p class=\"printing_popup_title\">'+ ksp_popup_title +'</p> \\\n '+ ksp_popup_content +' \\\n </div> \\\n </div>').appendTo('body');\n}", "verifyUserShouldSeeFooterPage(){\n let footerLocator =utils.byLocator(jobsPageLocator.jobsPage.footer);\n utils.scrollToTheView(footerLocator);\n utils.verifyTheElementIsDisplayed(footerLocator);\n }", "function exitPrinter() {\n\t$('#header').show();\n\t$('#content').show();\n\t$('#footer').show();\n\t$('#printerFriendly').remove();\n}", "function buildFooter() {\r\n $(\"#footer\").html(\r\n `\r\n <hr>\r\n My Sheridan Program: <em>${meArr[0].program}</em><br>\r\n My Home Country: <em>${meArr[0].hCountry}</em>\r\n `\r\n );\r\n $(\"#footer\").addClass(\"bottom\");\r\n}", "function PfModalFooter() {\n _classCallCheck(this, PfModalFooter);\n\n return _possibleConstructorReturn(this, (PfModalFooter.__proto__ || Object.getPrototypeOf(PfModalFooter)).call(this));\n }", "function footerBottom(){\n\tvar $footer = $('.footer');\n\tif($footer.length){\n\t\tvar $tplSpacer = $('<div />', {\n\t\t\tclass: 'spacer'\n\t\t});\n\n\t\t$('.main').after($tplSpacer.clone());\n\n\t\t$(window).on('load resizeByWidth', function () {\n\t\t\tvar footerOuterHeight = $footer.outerHeight();\n\t\t\t$footer.css({\n\t\t\t\t'margin-top': -footerOuterHeight\n\t\t\t});\n\n\t\t\t$('.spacer').css({\n\t\t\t\t'height': footerOuterHeight\n\t\t\t});\n\t\t});\n\t}\n}", "function EMBEDDED_FOOTER$static_(){ToolbarSkin.EMBEDDED_FOOTER=( new ToolbarSkin(\"embedded-footer\"));}", "closeHeaderFooter() {\n this.disableHeaderFooter();\n }", "function changeFooterText(){\n\n }", "function handleFooterPositioning() {\n if (footer) {\n let maxCoord = Math.max(window.innerHeight - 80, document.body.offsetHeight) - 80;\n footer.style.top = maxCoord + \"px\";\n footer.style.visibility = \"visible\";\n }\n}", "chargerFooter(){\n $(\"#page\"+this.instrument.ref).append('<div data-role=\"footer\" data-position=\"fixed\" data-tap-toggle=\"false\" data-fullscreen=\"false\" data-theme=\"b\">\\\n <div data-role=\"navbar\" data-grid=\"\" data-iconpos=\"left\">\\\n <ul id=\"menu\">\\\n <li><a href=\"#pageEtat\">Etat</a></li>\\\n <li><a href=\"#pageInstruments\"> Instruments</a></li>\\\n <li><a href=\"#pageCommande\">Commande</a></li>\\\n <li><a href=\"#pageConfiguration\"> Configuration</a></li>\\\n </ul>\\\n </div>\\\n </div>');\n }", "function renderFooter() {\n\t\tfooter.setToolbarOptions(computeFooterOptions());\n\t\tfooter.render();\n\t\tif (footer.el) {\n\t\t\telement.append(footer.el);\n\t\t}\n\t}", "createFooter(footer) {\n footer.appendChild(footerTemplate.content);\n }", "genFooterContent() {\n return <Footer />;\n }", "function showPopup() {\n\t\thtml = '<div class=\"etheme-popup-overlay\"></div><div class=\"etheme-popup\"><div class=\"etheme-popup-content\"></div></div>';\n\t\tjQuery('body').prepend(html);\n\t\tpopupOverlay = jQuery('.etheme-popup-overlay');\n\t\tpopupWindow = jQuery('.etheme-popup');\n\t\tpopupOverlay.one('click', function() {\n\t\t\t\thidePopup(popupOverlay, popupWindow);\n\t\t});\n}", "function accordionFooter() {\n return '</table></div></div></div></div>';\n}", "function div_show(el){ \n\t\n\t\t\tpopup6(\"\");\n\t\t\n\t}", "function footer(){\ndiv= document.createElement(\"div\");\ndiv.className=\"bg-dark justify-content-center p-4 \";\n// adding techs used ---------------------------\ntech = document.createElement(\"p\");\ntech.innerHTML=`Techs Used - <span>html,css,bootstrap,javascript</span>`;\ntech.id=\"tech\";\ndiv.appendChild(tech);\n// adding Content Disclamier---------------------\ncontent = document.createElement(\"p\");\ncontent.innerHTML=`Content Disclamier - <span>The contant of this website is taken from <a href=\"https://api.openbrewerydb.org/breweries\">Open Brewery</a></span>`;\ncontent.id=\"content\";\ndiv.appendChild(content);\n// adding social media icons --------------------\nsocialmedia = document.createElement(\"p\");\nsocialmedia.innerHTML=`<a href=\"#\" class=\"fab fa-facebook-f\"></a> <a href=\"#\" class=\"fab fa-twitter\"></a> <a href=\"#\" class=\"fab fa-google\"></a> <a href=\"#\" class=\"fab fa-linkedin-in\"></a> <a href=\"#\" class=\"fab fa-youtube\"></a>`;\nsocialmedia.id=\"social\"\ndiv.appendChild(socialmedia);\nroot.appendChild(div); // adding all things to main root element \n}", "function DonefbgnPopUp(){\r\n\t\t$(\"#popUpFBGN\").html(\"<h2>Info</h2><p style='color:blue; text-align: center;'><b>FBGN games added!</b></p>\"\r\n\t\t+'<a href=\"#add-new\" data-rel=\"back\" class=\"ui-btn ui-btn-right ui-btn-inline ui-icon-delete ui-btn-icon-notext ui-btn-a\"></a>').popup(\"open\"); \r\n\t\tsetTimeout(function(){ $(\"#popUpFBGN\").popup(\"close\"); }, 5000);\r\n\t}", "function footer() {\n //eliminando las clases para tener la medida correcta total\n $(\"footer\").removeClass(\"uno\"); \n $(\"footer\").removeClass(\"dos\");\n let elem = $(\"body\").find(\"div\").first().height();//medida de todo el html\n let windowh = window.innerHeight; //medida de la ventana\n //console.log(elem);\n //console.log(windowh);\n if (elem >= windowh) {\n $(\"footer\").addClass(\"dos\"); //aplicar posicion relative\n } else {\n $(\"footer\").addClass(\"uno\"); //aplicar posicion fixed\n }\n }", "getFooter() {\n return '</quiz>';\n }", "function closeFooterPopup(parentId, popupId) {\n\t$('.wrapper_area').css('z-index','2');\n\t$('#' + popupId).animate({top:'-50%'},1000);/* closing pop up using animated functionality */ \n\tsetTimeout(function(){$('#'+parentId).hide();\n\t\t$('#' + popupId).hide();\n\t}, 800);\n\t/* Popup position for android devices */\n\tif( (navigator.userAgent).match(/Android/i) ) {\n\t\tvar popupWidthcalc = $('#' + popupId).outerWidth();\n\t\t$('#' + popupId).css({'margin-left' : (-popupWidthcalc/2)});\n\t\t$('#' + popupId).css({'transform': 'none', '-webkit-transform' : 'none'});\n\t}\n\t$('#footer_popup_frame').remove();\n\tstartBackgroundScroll();\n}", "function initFooterSize(){\n\tvar footer = parent.$('south_tabs');\n\tif(footer){\n\t\tvar width = 50;\n\t\tif(parent.Ext && parent.Ext.isStrict) width = 52;\n\t\tEvent.observe(window, 'resize', function(){\n\t\t\tfooter.style.width = (document.body.offsetWidth - width) + \"px\";\n\t\t});\n\t\tfooter.style.width = (document.body.offsetWidth - width) + \"px\";\n\t}\n}", "function insertFooter () {\n \"use strict\";\n try {\n var footer;\n\t\t\t/* There are at least one, and maybe more, courses that are developed in partnership with BYU or BYU-Hawaii and require that to be displayed in the copyright. Checking here for customCopyright allows for those courses to create this variable with the custom text in the course.js file before the online.js is appended and then will use the custom text */\n\t\t\tif (typeof customCopyright === \"undefined\") {\n\t\t\t\tfooter = \"<div id='footer'>Copyright &copy; \" + new Date().getFullYear() + \" by Brigham Young University - Idaho. All Rights Reserved.</div>\";\n\t\t\t} else {\n\t\t\t\tfooter = \"<div id='footer'>\" + customCopyright + \"</div>\";\n\t\t\t}\n document.getElementById(\"main\").insertAdjacentHTML(\"beforeend\", footer); \n } catch (ex) {\n console.log(ex.name + \": \" + ex.message);\n }\n }", "function displayPageFooterDescription(response) { \r\n var $footerDescription = $(\"#footer-description\");\r\n if(!$footerDescription.is(\":visible\")) {\r\n toggleTouLinksColor(\r\n (typeof (response.image) != \"undefined\" && response.image) ||\r\n (typeof (response.video) != \"undefined\" && response.video) ||\r\n (BROWSER && BROWSER == \"firefox\")\r\n );\r\n if (!getWelcomePageState()) {\r\n $(document).on(\"click\", \"#footer-description-close\", function () {\r\n changeWelcomePageState();\r\n $(\"#footer-description\").fadeOut(750);\r\n });\r\n setTimeout(function () {\r\n $footerDescription.fadeIn(750);\r\n }, 2500);\r\n }\r\n }\r\n displayTermsOfUse(response);\r\n}", "function closePopup()\n{\n modal.style.display = \"none\";\n pagecontent.className = pagecontent.className.replace(\n \" de-emphasized\", \"\");\n}", "function mkdfOnWindowLoad() {\n\t\tuncoveringFooter();\n\t}", "createFooter(buttons) {\n const footer = new Widget();\n footer.addClass('jp-Dialog-footer');\n each(buttons, button => {\n footer.node.appendChild(button);\n });\n Styling.styleNode(footer.node);\n return footer;\n }", "function AccountNotesPopupClose() {\n AccountNotesPopup.Hide();\n}", "function show_footer_contact_form() {\n\tchange_properties('.contact-form-button-submit', 'value', translate_sentence('Send'));\n\tdocument.write('<br/><br/>' + translate_sentence('We will reply as soon as possible') + '.');\n}", "function setFooter() {\n\n // Remove prop from content\n $content.css( \"min-height\", \"\" );\n\n if ( $win.height() > $content.outerHeight() + $footer.outerHeight() ) {\n // Calculate the desired height\n let targetHeight = $win.height() - $footer.outerHeight();\n $content.css( \"min-height\", targetHeight + \"px\" );\n } else {\n // Clear the min height\n $content.css( \"min-height\", \"\" );\n }\n\n }", "function footerRevealInit() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($('body[data-footer-reveal=\"1\"]').length > 0 || $('body.material[data-slide-out-widget-area-style=\"slide-out-from-right\"]').length > 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\tfooterRevealCalcs();\r\n\t\t\t\t\t\t}, 60);\r\n\t\t\t\t\t\tfooterRevealCalcs();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$window.on('resize', footerRevealCalcs);\r\n\t\r\n\t\t\t\t\t\tif ($('bodybody[data-footer-reveal=\"1\"][data-footer-reveal-shadow=\"large_2\"]').length > 0) $('.container-wrap').css({\r\n\t\t\t\t\t\t\tboxShadow: '0 70px 110px -30px ' + $('#footer-outer').css('backgroundColor')\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}", "render() {\n return html`\n <link rel=\"stylesheet\" href=\"./src/css/social.css\">\n <style>\n :host { display: block; }\n :host([hidden]) { display: none; }\n </style>\n\n <footer class=\"w3-container w3-bottom w3-theme w3-margin-top\" style=\"text-align: center\">\n <h5>The Bug Slayers <iron-icon @click=\"${this.showDetails}\" icon=\"icons:bug-report\"></iron-icon></h5>\n\n\n\n\n </footer>\n\n\n `;\n }", "renderFooter() {\n return (\n <div className=\"dialog-footer\">\n <a className=\"dialog-footer--reject\" onClick={this.props.onReject}>\n {this.props.rejectLabel}\n </a>\n\n <a className=\"dialog-footer--accept\" onClick={this.props.onAccept}>\n {this.props.acceptLabel}\n </a>\n </div>\n );\n }", "static popup_close() {\n const context = Utils.popup_context.pop();\n if (typeof AGGrid !== 'undefined')\n AGGrid.popGridContext();\n Utils.popEnterContext();\n $('#' + context.id).hide();\n Utils.globalEnterHandler(context.globalEnterHandler);\n Utils.popup_zindex -= 2;\n if (Utils.popup_zindex < 10)\n Utils.popup_zindex = 10;\n }", "function Footer() {\n return (\n <Wrapper>\n <section>This project is licensed under the MIT license.</section>\n <section>语言选择开关</section>\n <section>\n Made with love by\n <A href=\"https://twitter.com/mxstbr\">Max Stoiber</A>,\n </section>\n </Wrapper>\n );\n}", "function footerRevealCalcs() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar $headerNavSpace = ($('body[data-header-format=\"left-header\"]').length > 0 && $window.width() > 1000) ? 0 : $headerOuterEl.outerHeight();\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($window.height() - $wpAdminBar.height() - $headerNavSpace - $('#footer-outer').height() - 1 - $pageHeaderBG.height() - $('.page-header-no-bg').height() > 0) {\r\n\t\t\t\t\t\tvar $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize=\"1\"]').length > 0) ? 55 : 0;\r\n\t\t\t\t\t\t$('body[data-footer-reveal=\"1\"] .container-wrap').css({\r\n\t\t\t\t\t\t\t'margin-bottom': $('#footer-outer').height() - 1\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('.container-wrap').css({\r\n\t\t\t\t\t\t\t'min-height': $window.height() - $wpAdminBar.height() - $headerNavSpace - $('#footer-outer').height() - 1 - $('.page-header-no-bg').height() - $pageHeaderBG.height() + $resizeExtra\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$('body[data-footer-reveal=\"1\"] .container-wrap').css({\r\n\t\t\t\t\t\t\t'margin-bottom': $('#footer-outer').height() - 1\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($window.width() < 1000) {\r\n\t\t\t\t\t\t$('#footer-outer').attr('data-midnight', 'light');\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t$('#footer-outer').removeAttr('data-midnight');\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "render() {\n return (\n <div className='botNav'>\n <div>\n {/* For contact pop up */}\n {/* {this.state.popup ?\n <ContactForm\n closepopup={this.handleContactPopUp.bind(this)}\n />\n : null\n } */}\n </div>\n <footer>\n <div id=\"footer\">\n <div id=\"footernav\">\n <div id=\"footerlogo\">\n <img src={require('../assets/TATAWHITE.png')} alt=\"LOGO\" width=\"109px\" height=\"68.67px\" />\n <p>TATA was developed as a Summer Impact Project Funded by the Office of Student Scholarship, Creative Activates, and Research</p>\n </div>\n \n {/* <!--end of footerlogo--> */}\n\n <div id=\"line\">\n </div>\n\n <div id=\"contact\">\n <p onClick={this.handleContactPopUp.bind(this)}>Contact Us</p>\n \n </div>\n\n <div id=\"logos\">\n <img src={require('../assets/Mason Logo.png')} alt=\"LOGO\" width=\"64px\" height=\"64px\" />\n <img src={require('../assets/OSCAR LOGO.png')} alt=\"LOGO\" className=\"oscar\" />\n </div>\n {/* <!--end of logos--> */}\n\n </div>\n {/* <!--end of footernav--> */}\n </div>\n {/* <!--end of footer--> */}\n \n </footer>\n\n </div>\n \n\n );\n }", "function showPopUp() {\n popUpSection.style.display = \"block\";\n }", "setFooter(html){\n this.footer.html(html);\n }", "function Footer() {\n return (\n<footer class=\"page-footer font-small special-color-dark pt-4\">\n \n\n <div class=\"container\">\n \n\n <ul class=\"list-unstyled list-inline text-center\">\n <li class=\"list-inline-item\">\n <a class=\"btn-floating btn-fb mx-1\">\n <i class=\"fab fa-facebook\"></i>\n </a>\n </li>\n <li class=\"list-inline-item\">\n <a class=\"btn-floating btn-tw mx-1\">\n <i class=\"fab fa-twitter\"> </i>\n </a>\n </li>\n <li class=\"list-inline-item\">\n <a class=\"btn-floating btn-gplus mx-1\">\n <i class=\"fab fa-google-plus-g\"> </i>\n </a>\n </li>\n <li class=\"list-inline-item\">\n <a class=\"btn-floating btn-li mx-1\">\n <i class=\"fab fa-linkedin-in\"> </i>\n </a>\n </li>\n <li class=\"list-inline-item\">\n <a class=\"btn-floating btn-dribbble mx-1\">\n <i class=\"fab fa-dribbble\"> </i>\n </a>\n </li>\n </ul>\n\n \n </div>\n\n <div class=\"footer-copyright text-center py-3\">\n <a href=\"https://mdbootstrap.com/\"> </a>\n </div>\n\n \n </footer>\n\n\n );\n}", "function printFooter()\r\n{\r\n\ttry\r\n\t{\r\n\r\n\t\tpdfxml += '</body></pdf>';\r\n\t}\r\n\tcatch(e)\r\n\t{\r\n\t\terrorHandler('printFooter', e);\r\n\t}\r\n}", "function displayFooterMessage(text, error) {\n messageModal.style.display = \"block\";\n if (!errorFlag) {\n if (error) {\n errorFlag = true;\n document.getElementById(\"modal-footer\").innerHTML = \"<div class=\\\"error\\\">\" + text + \"</div>\";\n } else {\n document.getElementById(\"modal-footer\").innerHTML = \"<div>\" + text + \"</div>\";\n }\n } else {\n console.log(\"Cannot display a new footer message unless the errorFlag is cleared.\");\n }\n}", "function batHandleLoad() {\n var footer = $(\"#footer\");\n var pos = footer.position();\n var height = $(window).height();\n height = height - pos.top;\n height = height - footer.height();\n if (height > 0) {\n footer.css({\n 'margin-top': height + 'px'\n });\n }\n $(\"#userId\").focus();\n }", "function showPopupOnPpr()\n{\n //8824028 -bmetikal\n if(divid != null){\n removeAndSetPopupDiv();\n }\n \n if(popupDiv != null && popupDiv.style.display != '' && !isParameterizedPopup)\n displayPopup();\n}", "function initFooter() {\n\t\n\t//hide the timeline feature first before creating content\n\t$('.inner').hide();\n\t$('#playNext').hide();\n\n\t//create elements of the timeline\n\tinitPhaseLabels();\n\tinitDayList();\n\tinitSliderBoxContent();\n\tinitPlayBtn();\n\n\t//add functionality, must come after creation of elements\n\tmoveSliderBox_onClick();\n\tretractableTimeline();\n\thighlightPhase();\n\n}", "function populateFooter(data) {\n const tabSelected = document.querySelector('.tab-selected');\n const footerText = document.getElementById('footer-text');\n\n if (tabSelected.innerHTML === 'Feedings') {\n footerText.innerHTML = `Daily Avg: ${avgFeedings} mls`;\n } else if (tabSelected.innerHTML === 'Weights') {\n footerText.innerHTML = `Avg Weight: ${parseFloat(avgWeights).toFixed(1)} g`;\n }\n}", "hasFooter() {\n return visible(this.footer.node());\n }", "function showMobileTweetFooter() {\n modalTweetFooterBarWrapper.className = \"flex w-full pt-2 justify-between h-full items-end flex-wrap mb-2 \";\n modalTweetFooterBar.className = \"flex justify-between space-x-4 items-center flex-wrap\";\n}", "function _getHeaderFooter(group, options){\n\t\tvar header = webix.html.create(\"div\", { \n\t\t\t\"class\":\"webix_view webix_print_\"+group.toLowerCase(),\n\t\t\t\"style\":\"height:0px;visibility:hidden;\"\n\t\t}, options[\"doc\"+group]);\n\n\t\tif(group ===\"Header\")\n\t\t\twebix.html.insertBefore(header, document.body.firstChild);\n\t\telse\n\t\t\tdocument.body.appendChild(header);\n\n\t\toptions[\"doc\"+group] = header;\n\t}", "Footer() {\n return (\n <div style={{ paddingbottom: \"60px\" }}>\n\n <Footer className='login-footer' size=\"mini\">\n <FooterSection type=\"left\" logo=\"North.\">\n <FooterLinkList>\n <a target=\"_blank\" href=\"https://drive.google.com/open?id=1bModZ1EzBEdGyZltHlMCmiW2o0fjjEmC\">Help</a>\n <a target=\"_blank\" href=\"https://drive.google.com/open?id=1tWE13UlHbMgXlFPAvF59OO0xwQB_wCrt\">Privacy Policy</a>\n <a target=\"_blank\" href=\"https://drive.google.com/open?id=1NtARcUGS2ygw1dfAhPEHjpanxqG8OuH-\">Terms & Conditions</a>\n </FooterLinkList>\n </FooterSection>\n </Footer>\n </div>);\n }", "function closePopUp() {\n popUpSection.style.display = \"none\";\n }", "function initPopups() {\r\n jQuery('.social-popup').contentPopup({\r\n mode: 'click',\r\n hideOnClickLink: false,\r\n hideOnClickOutside: false\r\n });\r\n}", "function showPricingUrl() {\n\tremoveMessageFromDivId();\n\tremoveSuccessOrFailureStrip();\n\tbookmarks.sethash('#moreinfo',showFooterPopup, footerUrlName[\"FooterPricingUrl\"]);\n\treturn false;\n}", "function displayInsfcntPopup(){\n $(insufficientCardPopup).css({\n \"display\" : \"flex\"\n })\n }", "function displayInfoboxClose(e) {\n if (e.targetType == 'pushpin') {\n infobox.setLocation(e.target.getLocation());\n infobox.setOptions({ visible: false});\n }\n }", "function displayPopup() {\n membershipPopup.classList.toggle(\"openPopup\");\n }", "function showPopupOrder(tittle, content, nameButton){\n\tvar d = new Date;\n\tcheckin_time = [d.getFullYear(), d.getMonth()+1, d.getDate()].join('/')+' '+\n [d.getHours(), d.getMinutes(), d.getSeconds()].join(':');\n\tsetMessagePopup('Thông báo đặt phòng', 'Hãy xác nhận đặt phòng <br></br>'\n\t\t\t+'Giờ checkin là: '+ checkin_time, 'Đặt phòng')\n\t$('#popup-message').modal('show');\n\t$('#btn-success-popup').removeAttr('disabled');\n}", "function getFooter() {\n return `</div>\n </div>\n </body>\n </html>`;\n}", "function thankTheReader() {\n // event.preventDefault();\n let popUp = document.getElementById('thankYouPopUp');\n\n let popUpOptions = document.getElementsByClassName('thankYouFooter')[0];\n\n for (var i = 0; i < popUpOptions.children.length; i++) {\n popUpOptions.addEventListener('click', removePopUp)\n }\n\n popUp.style.display = 'block';\n\n return true;\n}", "function footerData(sourcefile){\r\n\treturn `<div class='information' id='information'>\r\n\t\t\t\r\n\t\t<div style='float:right; padding-top: 28px; padding-right: 14px;'>\r\n\t\t\tRobert Calamari 2019\r\n\t\t</div>\r\n\r\n\t</div>\r\n`;\r\n}", "function afterFooter() {\n // Get Cartridge Cache\n var cache = dw.system.CacheMgr.getCache('DevToolsCache');\n\n // Write log types to their own cache key ( 128KB max per key )\n cache.put('debug', Debugger.debug);\n cache.put('error', Debugger.error);\n cache.put('fatal', Debugger.fatal);\n cache.put('info', Debugger.info);\n cache.put('log', Debugger.log);\n cache.put('warn', Debugger.warn);\n\n // Render Remote Include to Prevent ISML Bug\n var velocity = require('dw/template/Velocity');\n velocity.render('$velocity.remoteInclude(\\'DevTools-AfterFooter\\')', {\n velocity: velocity\n });\n}", "function initFooter () {\n $(\".beta-site-wrap .betaClose\").on(\"click\", function () {\n $(\".beta-site-wrap\").slideUp(400);\n });\n\n $(\".overlayFooter h4.arrow-right\").on(\"click\", function () {\n if ($(window).width() > 991) {\n return;\n }\n\n if ($(this).hasClass(\"footerMenuOpen\")) {\n $(this).removeClass(\"footerMenuOpen\");\n $(this).next().slideUp(400);\n } else {\n $(this).addClass(\"footerMenuOpen\");\n $(this).next().slideDown(400);\n }\n });\n\n $(window).resize(function () {\n if ($(window).width() > 991) {\n $(\"footer ul\").removeAttr('style');\n } else {\n $(\"footer ul\").removeAttr('style');\n $(\"footer .footerMenuOpen\").next().show(0);\n }\n });\n}", "function createEndPopup(message) {\r\n\t\tvar $popupWindow = $('<div id=\"popup\" class=\"popup\"/>').appendTo(\"body\");\r\n\t\t\r\n\t\t$popupWindow.css(\"z-index\", crtZIndex++);\r\n\t\t\r\n\t\tvar popupHTML = new String(\"\");\r\n\t\tpopupHTML += \"<center>\";\r\n\t\tpopupHTML += \"<p>\";\r\n\t\tpopupHTML += message;\r\n\t\tpopupHTML += \"</p>\";\r\n\t\tpopupHTML += \"<p>\";\r\n\t\tpopupHTML += \"<button id='quit2' style='font-size:14pt'>Back to Main Menu!</button>\";\r\n\t\tpopupHTML += \"</p>\";\r\n\t\tpopupHTML += \"</center>\";\r\n\t\t\r\n\t\t$popupWindow.html(popupHTML);\r\n\t\t\r\n\t\t$(\"#quit2\").click( function() {\r\n\t\t\twarnAtUnload = false;\r\n\t\t\twindow.location.replace(\".\");\r\n\t\t});\r\n\t\t\r\n\t\tvar boardTop = $(\"#board\").offset().top;\r\n\t\tvar boardLeft = $(\"#board\").offset().left;\r\n\t\tvar boardHeight = $(\"#board\").height();\r\n\t\tvar boardWidth = $(\"#board\").width();\r\n\t\tvar windowHeight = $(\"#popup\").height();\r\n\t\tvar windowWidth = $(\"#popup\").width();\r\n\t\t\r\n\t\t$popupWindow.offset( {\r\n\t\t\ttop : boardTop + boardHeight / 2 - windowHeight / 2,\r\n\t\t\tleft: boardLeft + boardWidth / 2 - windowWidth / 2\r\n\t\t});\r\n}", "function autoResize() {\n var h = $(window).height() - 120;\n if (hasFooter) h -= 90;\n if (h < 400) h = 400;\n popup.height(h);\n popup.trigger('aweresize');\n }", "function porfolio_detail_popup() {\r\n $('.portfolio-detail-popup').magnificPopup({\r\n type: 'inline',\r\n mainClass: 'mfp-fade',\r\n preloader: true,\r\n gallery: {\r\n enabled: true\r\n }\r\n });\r\n }", "function footer_at_bottom() {\n\n var winWidth = $(window).width();\n var $footer = $('#footer');\n var $wrapper = $('#wrapper');\n var $footer_height = $footer.height();\n\n winWidth >= 960 ? $wrapper.css('paddingBottom',$footer_height) : $wrapper.css('paddingBottom',0)\n\n\n }", "function add_popup_box(){\n\t\t\t var pop_up = $('<div class=\"paulund_modal_box\"><span class=\"paulund_modal_close\" style=\"cursor:pointer;\"></span><div class=\"paulund_inner_modal_box\"><table width=\"200px\" height=\"30px\" style=\"position:absolute;\"><tr><td style=\"font-weight:bold;\">비밀번호&nbsp;<input type=\"password\" name=\"passwd\" id=\"passwd\" size=\"10\" maxlength=\"20\"></td><td><img src=\"/images/btn_confirm.gif\" onclick=\"pwConfirm();\" valign=\"absmiddle\" style=\"cursor:pointer;\"></td></tr></table></div></div>');\n\t\t\t $(pop_up).appendTo('.paulund_block_page');\n\t\t\t \t\t\t \n\t\t\t $('.paulund_modal_close').click(function(){\n\t\t\t\t$(this).parent().fadeOut().remove();\n\t\t\t\t$('.paulund_block_page').fadeOut().remove();\t\t\t\t \n\t\t\t });\n\t\t}", "function closeNotificationPanel() {\n $('#notification-center').html(`<p class='text-muted'>{% trans \"Notifications will load here\" %}</p>`);\n}", "function Footer(props) {\n return (\n <footer className=\"footer fixed-bottom\">\n <div class=\"container text-right\">\n <span><a href=\"https://github.com/carolinelester/clicky-game\">Github</a> </span>\n </div>\n </footer>\n )}", "function delAllPopup() {\r\n\t$(\"#opPop\").html('<h3 style=\"color:red;\">Delete Game?</h3>'+\r\n\t'<p>Are You Sure You Want To Delete All Games?</p>'+\r\n\t'<a href=\"javascript:delAllGames()\" class=\"ui-shadow ui-btn ui-corner-all ui-btn-b ui-icon-check ui-btn-icon-left ui-btn-inline ui-mini ui-nodisc-icon ui-btn-c\">Yes</a>'+\r\n\t'<a href=\"#\" data-rel=\"back\" class=\"ui-shadow ui-btn ui-corner-all ui-btn-inline ui-mini ui-btn-b\">No</a>').popup(\"open\");\r\n\t}", "function getVisiblePartOfFooter() {\n var $el = $('#footer'),\n scrollTop = $(this).scrollTop(),\n scrollBot = scrollTop + $(this).height(),\n elTop = $el.offset().top,\n elBottom = elTop + $el.outerHeight(),\n visibleTop = elTop < scrollTop ? scrollTop : elTop,\n visibleBottom = elBottom > scrollBot ? scrollBot : elBottom;\n $('#notification').text(visibleBottom - visibleTop);\n\n var height = $(window).height() - (visibleBottom - visibleTop)\n\n if ((visibleBottom - visibleTop) > 0){\n $('.affix').css(\"height\", height - 60)\n $('.affix-bottom').css(\"height\", height - 60)\n } else {\n $('.affix').css(\"height\", 'auto')\n $('.affix-bottom').css(\"height\", 'auto')\n }\n }", "function close_pop() {\n join_room.css(\"display\", \"none\");\n $(\".join_room_popup_content\").css(\"height\",\"10em\");\n $(\"#pop_message\").html(\"\");\n }", "close() {\n\n // Pop the activity from the stack\n utils.popStackActivity();\n\n // Hide the screen\n this._screen.scrollTop(0).hide();\n\n // Hide the content behind the placeholders\n $(\"#page--info .ph-hidden-content\").hide();\n\n // Stop the placeholders animation\n this._placeholders.removeClass(\"ph-animate\").show();\n\n // Hide the delete button\n $(\"#info-delete\").hide();\n\n // Hide the info button\n $(\"#info-edit\").hide();\n\n // Show all the fields\n $(\".info-block\").show();\n\n // Delete the content of each of the fields\n $(\"#info-createdAt .info-content\").html(\"\");\n $(\"#info-updatedAt .info-content\").html(\"\");\n $(\"#info-coordinates .info-content\").html(\"\");\n $(\"#info-coordinatesAccuracy .info-content\").html(\"\");\n $(\"#info-altitude .info-content\").html(\"\");\n $(\"#info-altitudeAccuracy .info-content\").html(\"\");\n $(\"#info-type .info-content\").html(\"\");\n $(\"#info-materialType .info-content\").html(\"\");\n $(\"#info-hillPosition .info-content\").html(\"\");\n $(\"#info-water .info-content\").html(\"\");\n $(\"#info-vegetation .info-content\").html(\"\");\n $(\"#info-mitigation .info-content\").html(\"\");\n $(\"#info-mitigationsList .info-content\").html(\"\");\n $(\"#info-monitoring .info-content\").html(\"\");\n $(\"#info-monitoringList .info-content\").html(\"\");\n $(\"#info-damages .info-content\").html(\"\");\n $(\"#info-damagesList .info-content\").html(\"\");\n $(\"#info-notes .info-content\").html(\"\");\n\n // Show the image placeholder\n $(\"#info-photo-preview\").attr(\"src\", \"img/no-img-placeholder-200.png\");\n\n }", "function showFeedBackUrl() {\n\tremoveMessageFromDivId();\n\tremoveSuccessOrFailureStrip();\n\tvar userId = getCookie(\"userId\");\n\tvar registerUser = parseBoolean(localStorage.getItem(\"registerUser\"));\n\tvar isGuest = true;\n\tvar email =\"\";\n\tvar phone = \"\";\n\tif(registerUser && user_get_profile_obj){\n\t\tisGuest = false;\n\t\temail = user_get_profile_obj.user.email;\n\t\tphone = user_get_profile_obj.user.phone;\n\t}\n\tvar url = footerUrlName[\"FooterFeedBackUrl\"] + \"?userID=\" + userId + \"&isGuest=\" + isGuest + \"&email=\" + email + \"&phone=\" + phone;\n\tbookmarks.sethash('#moreinfo',showFooterPopup, url); \n\treturn false;\n}", "function adjustFooter() {\n var windowHeight = $(window).height()\n var contentHeight = $(\"body\").height()\n \n var extraHeight = 0;\n if($(\"footer\").css(\"position\") == \"fixed\")\n {\n extraHeight = $(\"footer\").height() + 60\n }\n else\n {\n extraHeight = 0\n }\n \n if(contentHeight < windowHeight-extraHeight)\n {\n $(\"footer\").css({\n position: \"fixed\"\n })\n }\n else\n {\n $(\"footer\").css({\n position: \"static\"\n })\n }\n \n $(\"footer\").show() // Hidden in CSS by default\n }", "function FooterDown() {\n return (\n <div className={style.downBlock}>\n <div className={`${styleContainer.container} ${style.downContainer}`}>\n <Title text={\"Roman Somov\"}/>\n <div className={style.socialIcons}>\n <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://t.me/romansmv8\" className={style.socialIcon}></a>\n <a href=\"tel:+375255434784\" className={style.socialIcon}>\n </a>\n <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://www.linkedin.com/in/romansmv\" className={style.socialIcon}>\n </a>\n </div>\n <span className={style.copyright}> 2021 All rights reserved</span>\n\n </div>\n\n </div>\n )\n}", "function gfont_close_popup() {\n var popup = $('ja-popup-gfont');\n var display = popup.getStyle('display');\n if (display == 'block') {\n popup.setStyle('display', 'none');\n }\n}", "function buildEnd(options) {\n html += `</main>\n\n <footer>\n <p>Copyright info?</p>\n </footer>\n </body>\n </html>`\n}", "function toggleFooter() {\n $('#footer-help').toggle('slide', { direction: \"down\" });\n $('.footer-wrapper').addClass('hidden');\n $('#footer1').removeClass('hidden');\n}", "get footerDistance() {\n return this.footerDistanceIn;\n }" ]
[ "0.7370727", "0.7013707", "0.6801526", "0.6656114", "0.6596412", "0.64637136", "0.642996", "0.64059454", "0.6367824", "0.6305404", "0.62922007", "0.628223", "0.627824", "0.6247534", "0.62313604", "0.62237394", "0.62147695", "0.6195005", "0.6182845", "0.61451113", "0.61159647", "0.6104842", "0.6096016", "0.60897905", "0.6089366", "0.6075271", "0.6068081", "0.605628", "0.6043564", "0.6023891", "0.60131305", "0.6006443", "0.59959906", "0.59940416", "0.5968394", "0.59618086", "0.5957576", "0.5937681", "0.59374183", "0.5934512", "0.59193027", "0.58913434", "0.5884478", "0.58793694", "0.5862205", "0.5856216", "0.5850519", "0.5848951", "0.5837975", "0.57981694", "0.57977897", "0.57951075", "0.5767645", "0.5766587", "0.5765948", "0.57632726", "0.57621926", "0.5743338", "0.57287055", "0.5716479", "0.5716039", "0.57149863", "0.56991404", "0.56857663", "0.5676733", "0.56743675", "0.56676716", "0.5665307", "0.5661207", "0.5656268", "0.565263", "0.5633326", "0.56309825", "0.56287324", "0.5625657", "0.56217897", "0.5621329", "0.5614154", "0.5607968", "0.56046265", "0.5604033", "0.5598204", "0.5595103", "0.55938864", "0.55938566", "0.55891544", "0.55878615", "0.55770934", "0.5576464", "0.55703884", "0.55683804", "0.55663186", "0.55588907", "0.5549295", "0.55421907", "0.5538152", "0.5536013", "0.5533669", "0.55302745", "0.55294687" ]
0.5598283
81
Slide 16 set up the inputs
function setupWebInput() { let choices = document.getElementsByClassName("choice"); let cat = document.getElementById("cat"); let elephant = document.getElementById("elephant"); cat.addEventListener("click", userPick); elephant.addEventListener("click", userPick); for (let i = 0; i < choices.length; i++) { choices[i].addEventListener("click", userPick); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function slider_setup(s_name, sample, index) {\n var s = document.getElementById(s_name);\n var s_out = document.getElementById(s_name+\"_out\");\n var s_out2 = document.getElementById(\"ex4_\"+s_name);\n var s_out3 = document.getElementById(\"ex5_\"+s_name);\n s.value = sample[index];\n s_out.innerHTML = s.value;\n s.paired_out = s_out;\n s.paired_out2 = s_out2;\n s.paired_out3 = s_out3;\n s.oninput = function() {\n sample[index] = Number(this.value);\n this.paired_out.innerHTML = this.value;\n this.paired_out2.innerHTML = this.value;\n this.paired_out3.innerHTML = this.value;\n update(treeData[0]);\n \tex4_reset();\n \tex5_reset();\n ex6_reset();\n }\n}", "function matchFormToModel() {\n maxspdslider[0].value = tsdParams.maxspdslider;\n\t scaleslider[0].value = tsdParams.scaleslider;\n }", "function setupSlider() {\n rSlider = createSlider(0, 255, 0);\n rSlider.position(width - 340, 50);\n rSlider.style(\"width\", \"255px\");\n\n gSlider = createSlider(0, 255, 0);\n gSlider.position(width - 340, 50 + 30);\n gSlider.style(\"width\", \"255px\");\n\n bSlider = createSlider(0, 255, 0);\n bSlider.position(width - 340, 50 + 60);\n bSlider.style(\"width\", \"255px\");\n\n sizeSlider = createSlider(1, 80, 4);\n sizeSlider.position(width - 340, 500);\n sizeSlider.style(\"width\", \"255px\");\n}", "function setupUI()\r\n{\r\n textSize(12)\r\n constraintsSlider = createSlider(1, 4, 1, 0.1)\r\n constraintsSlider.style('width', '300px')\r\n constraintsSlider.position(50, sliderY)\r\n\r\n desiredXSlider = createSlider(100, 600, desiredX, 1)\r\n desiredXSlider.style('width', '300px')\r\n desiredXSlider.position(380, sliderY)\r\n}", "function actionSliders(arr) {\n \"use strict\";\n\n //planet distance\n arr[0].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n document.getElementById('orbdis').value = newvalue;\n });\n //planets size\n arr[1].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n newvalue /= 5;\n newvalue = newvalue.toFixed(2);\n document.getElementById('plansize').value = newvalue;\n });\n //planet speed\n arr[2].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n newvalue /= 20;\n newvalue = newvalue.toFixed(1);\n document.getElementById('spchange').value = newvalue;\n });\n\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n keyPressed();\n\n // Slider1 for depth\n mySlider1 = createSlider(5, windowWidth, 8);\n mySlider1.position(10, 10);\n mySlider1.style('width', '80px');\n\n // Slider2 for depth\n mySlider2 = createSlider(5, windowWidth, 15);\n mySlider2.position(10, 30);\n mySlider2.style('width', '80px');\n\n // Slider3 for depth\n mySlider3 = createSlider(5, windowWidth, 5);\n mySlider3.position(10, 50);\n mySlider3.style('width', '80px');\n\n // Slider4 for depth\n mySlider4 = createSlider(5, windowWidth, 8);\n mySlider4.position(10, 70);\n mySlider4.style('width', '80px');\n\n myButton = createButton('PRESS ALT TO SAVE');\n myButton.position(10, 500);\n\n\n}", "function setControls(){\n \n $( \".pointer\" ).click(function() {\n var point = $(this).attr('data-sl');\n count = point;\n initSlider(slides);\n console.log(\"clicked point:\"+point);\n });\n\n }", "function inputSetup() {\n nameInpX = windowWidth / 2 - 240;\n nounInpX = windowWidth / 2 - 65.5;\n adjInpX = windowWidth / 2 + 127;\n //name\n nameInput = createInput('');\n nameInput.size(inpW, inpH);\n // nameInput.position(nameInpX, inpY);\n nameInput.id('name');\n nameInput.changed(updateName);\n //what do you like\n nounInput = createInput('');\n nounInput.size(inpW, inpH);\n nounInput.position(nounInpX, inpY);\n //describe yourself\n adjInput = createInput('');\n adjInput.size(inpW, inpH);\n adjInput.position(adjInpX, inpY);\n}", "function setup(){\n canvas = createCanvas(1000,1000,WEBGL);\n colorin =[255,255,255,random(255),random(255),random(255)];\n canvas.parent(\"parametricacool\");\n saa = createSlider(1,200,1); \n sbb = createSlider(1,200,60); \n scc = createSlider(1,200,1); \n sdd = createSlider(1,200,120); \n saa.parent(\"slidea\");\n sbb.parent(\"slideb\");\n scc.parent(\"slidec\");\n sdd.parent(\"slided\");\n loop();\n background(170);\n}", "function setup(){\n let width = CELL_SIZE * COLS \n let height = CELL_SIZE * ROWS\n createCanvas(width, height);\n // slider + label\n textSize(32);\n let label = createDiv('Speed');\n label.id('label');\n sSlider = createSlider(0, frame_buffer - 1, frame_buffer);\n let ruleset = createDiv('RULESET: 0 = turn right | 1 = turn left |\\\n 2 = enter countdown state (going straight for a bit)');\n ruleset.id('label');\n //checkboxes\n toggleStats = createCheckbox('show stats?', true);\n toggleStats.changed(toggle_stats);\n toggleAnt = createCheckbox('show ant?', false);\n toggleAnt.changed(toggle_ant);\n}", "function initInputHandlers() {\n\tidealNumNodes = window.innerWidth / 20;\n\tmaxExtraEdges = Math.round(parseFloat(100) / 100 * idealNumNodes);\n\n\tradiiWeightPower = parseFloat(0.0);\n\n\tdriftSpeed = 0.03;\n\trepulsionForce = 500;\n}", "function initInputs() {\n initVolumeInput();\n initWidthInput();\n initHeightInput();\n initCurrentTimeInput();\n initPlaybackRateInput();\n initPlayPauseButtons();\n initAutoplayInput();\n initPictureInPictureInput();\n initFullScreenInput();\n initMutedInput();\n initLoopInput();\n initControlsInput();\n initPreloadInput();\n initPosterInput();\n initSrcInput();\n}", "function setControls(slides,speed){\n \n $( \".pointer\" ).click(function() {\n var point = $(this).attr('data-sl');\n point = point - 1\n if(point >= slides){ point = 1; }\n if(point < 0){ point = slides; }\n count = point;\n clicked = 1;\n startSlide(slides,speed);\n console.log(\"clicked point:\"+point);\n });\n\n }", "updateForm() {\n this.$step.innerText = this.currentStep;\n\n // TODO: Validation\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n this.$stepInstructions[0].parentElement.parentElement.hidden = this.currentStep >= 6;\n this.$step.parentElement.hidden = this.currentStep >= 6;\n\n // TODO: get data from inputs and show them in summary\n }", "function initControls() \n{\n 'use strict';\n\n // If a slide title is selected from the drop up list, show the slide.\n $('.dropdown-menu li a').on('click', function (event) {\n pfView.showSlide(event, $(this));\n });\n\n // Cycles to the previous slide\n $('#prev-slide-btn').on('click', function (){ \n pfView.moveLeft();\n });\n\n // Cycles to the next slide\n $('#next-slide-btn').on('click', function (){ \n pfView.moveRight();\n });\n\n // Listen for keydown anywhere in body.\n $('body').on('keydown', function (event) {\n return keystroke(event);\n });\n\n // Listen for keyup anywhere in body.\n $('body').on('keyup', function (event) {\n return keystroke(event);\n });\n}", "updateForm() {\n this.$step.innerText = this.currentStep;\n\n // TODO: Validation\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n this.$stepInstructions[0].parentElement.parentElement.hidden = this.currentStep >= 5;\n this.$step.parentElement.hidden = this.currentStep >= 5;\n\n // TODO: get data from inputs and show them in summary\n }", "function defineInputs() {\r\n\r\n\tsteerYes = filterRadios[0];\r\n\tsteerNo = filterRadios[1];\r\n\tsteerBoth = filterRadios[2];\r\n\r\n\tbrakeYes = filterRadios[3];\r\n\tbrakeNo = filterRadios[4];\r\n\tbrakeBoth = filterRadios[5];\r\n\r\n\tABS_Yes = filterRadios[6];\r\n\tABS_No = filterRadios[7];\r\n\tABS_Both = filterRadios[8];\r\n\r\n\tTC_Yes = filterRadios[9];\r\n\tTC_No = filterRadios[10];\r\n\tTC_Both = filterRadios[11];\r\n\r\n\tSC_Yes = filterRadios[12];\r\n\tSC_No = filterRadios[13];\r\n\tSC_Both = filterRadios[14];\r\n\r\n\tnoDamageYes = filterRadios[15];\r\n\tnoDamageNo = filterRadios[16];\r\n\tnoDamageBoth = filterRadios[17];\r\n\r\n\tgearYes = filterRadios[18];\r\n\tgearNo = filterRadios[19];\r\n\tgearBoth = filterRadios[20];\r\n\r\n\tclutchYes = filterRadios[21];\r\n\tclutchNo = filterRadios[22];\r\n\tclutchBoth = filterRadios[23];\r\n\t\r\n\tlineYes = filterRadios[24];\r\n\tlineNo = filterRadios[25];\r\n\tlineBoth = filterRadios[26];\r\n\r\n\t\r\n\tsetupDefault = filterCheckboxes[0];\r\n\tsetupCustom = filterCheckboxes[1];\r\n\r\n\tcontrolWheel = filterCheckboxes[2];\r\n\tcontrolPad = filterCheckboxes[3];\r\n\tcontrolKeyboard = filterCheckboxes[4];\r\n\r\n\tcameraIn = filterCheckboxes[5];\r\n\tcameraOut = filterCheckboxes[6];\r\n}", "function update_inputs(data) {\n $(\"#x_slider\").slider(\"values\", data.slice(0, 2));\n $(\"#y_slider\").slider(\"values\", data.slice(2, 4));\n $(\"input[name='x1']\").val(data[0]);\n $(\"input[name='x2']\").val(data[1]);\n $(\"input[name='y1']\").val(data[2]);\n $(\"input[name='y2']\").val(data[3]);\n $(\"input[name='x1']\").valid();\n $(\"input[name='x2']\").valid();\n $(\"input[name='y1']\").valid();\n $(\"input[name='y2']\").valid();\n}", "function setControls(){\n//unused: theedgelengthOutput.value=theedgelength.value;\n//unused: therotangleOutput.value=therotangle.value;\n thenodesizeOutput.value=thenodesize.value;\n thelinewidthOutput.value=thelinewidth.value;\n thecubegapOutput.value=thecubegap.value;\n thescaleOutput.value=thescale.value;\n}", "function initialiseControls()\n{\n\n\n /* Create Input Panel */\n PIEaddDisplayText(\"Time1 ds\",0);\n PIEaddDisplayText(\"Time2 ds\",0);\n PIEaddDisplayText(\"Time3 ds\",0);\n PIEaddDisplayText(\"Time4 ds\",0);\n PIEaddDisplayText(\"Time5 ds\",0);\n\n}", "function setup() {\n\t// set up sliders\n\tsize_slider = createSlider(10, 100, 50);\n\tsize_slider.style('width', '200px');\n\tsize_slider.position(23 + DESIRED_HEIGHT, START_HEIGHT + 60);\n\n\t// set up radio buttons\n\tcreate_radio = createRadio();\n\tcreate_radio.option('Random');\n\tcreate_radio.option('Blank');\n\tcreate_radio.value('Random'); // default value\n\tcreate_radio.position(50 + DESIRED_HEIGHT, START_HEIGHT + 130);\n\n\tdraw_radio = createRadio();\n\tdraw_radio.option('Draw');\n\tdraw_radio.option('Erase');\n\tdraw_radio.value('Draw'); // default value\n\tdraw_radio.position(55 + DESIRED_HEIGHT, START_HEIGHT + 300);\n\n\t// buttons\n\tpause_button = createButton('Pause');\n\tpause_button.style('width', '150px');\n\tpause_button.style('height', '30px');\n\tpause_button.position(50 + DESIRED_HEIGHT, START_HEIGHT + 390);\n\tpause_button.mousePressed(pause);\n\n\tresume_button = createButton('Resume');\n\tresume_button.style('width', '150px');\n\tresume_button.style('height', '30px');\n\tresume_button.position(50 + DESIRED_HEIGHT, START_HEIGHT + 390);\n\tresume_button.mousePressed(resume);\n\tresume_button.hide();\n\n\tgenerate_button = createButton('Generate');\n\tgenerate_button.position(50 + DESIRED_HEIGHT, START_HEIGHT + 170);\n\tgenerate_button.style('width', '150px');\n\tgenerate_button.style('height', '30px');\n\tgenerate_button.mousePressed(generate);\n\n\tgenerate();\n\tcreateCanvas(windowWidth, windowHeight);\n}", "function initEvent(){\n\n\n\t//slider interface\n\t$('#slider_skip').slider({\n\t\t\tmin: 0.01,\n\t\t\tmax: 5.00,\n\t\t\tstep: 0.01,\n\t\t\tvalue: _skip,\n\t\t\tslide: function(_event, ui){\n\t\t\t\tvar value = ui.value;\n\t\t\t\t_skip = value;\n\t\t\t\tskip = 1/(60*Dt)*_skip;\n\t\t\t\tdocument.getElementById(\"input_skip\").value = value;\n\t\t\t}\n\t});\n\n /*\n\t$('#slider_radius').slider({\n\t\t\tmin: 0.01,\n\t\t\tmax: 5,\n\t\t\tstep: 0.01,\n\t\t\tvalue: RADIUS,\n\t\t\tslide: function(_event, ui){\n\t\t\t\tvar value = ui.value;\n\t\t\t\tdocument.getElementById(\"input_radius\").value = value;\n }\n */\n\t$('#slider_mass1').slider({\n min: 0.1,\n\t\t\tmax: 10,\n\t\t\tstep: 0.1,\n\t\t\tvalue: mass1,\n\t\t\tslide: function(_event, ui){\n\t\t\t\tvar value = ui.value;\n document.getElementById(\"input_mass1\").value = value;\n\t\t\t}\n });\n\t$('#slider_mass2').slider({\n min: 0.1,\n\t\t\tmax: 10,\n\t\t\tstep: 0.1,\n\t\t\tvalue: mass1,\n\t\t\tslide: function(_event, ui){\n\t\t\t\tvar value = ui.value;\n document.getElementById(\"input_mass2\").value = value;\n\t\t\t}\n });\n /*\n\t$('#slider_N').slider({\n\t\t\tmin: 1,\n\t\t\tmax: 40,\n\t\t\tstep: 1,\n\t\t\tvalue: N,\n\t\t\tslide: function(_event, ui){\n\t\t\t\tvar value = ui.value;\n\t\t\t\tdocument.getElementById(\"input_N\").value = value;\n\t\t\t}\n\t});\n\t$('#slider_theta').slider({\n\t\t\tmin: 0,\n\t\t\tmax: 90,\n\t\t\tstep: 1,\n\t\t\tvalue: theta * 180 / Math.PI,\n\t\t\tslide: function(_event, ui){\n\t\t\t\tvar value = Math.PI * ui.value / 180.0;\n\t\t\t\tdocument.getElementById(\"input_theta\").value = ui.value;\n\t\t\t}\n\t});\n\n\n */\n\t//input interface\n document.getElementById(\"input_skip\").value = _skip;\n\tdocument.getElementById(\"input_mass1\").value = mass1;\n\tdocument.getElementById(\"input_mass2\").value = mass2;\n\tdocument.getElementById(\"input_Dt\").value = Dt;\n /*\n\tdocument.getElementById(\"input_radius\").value = RADIUS;\n\tdocument.getElementById(\"input_N\").value = N;\n\tdocument.getElementById(\"input_theta\").value = theta * 180.0 / Math.PI;\n\n\n */\n\t//checkbox interface\n\t$('#checkbox_contour').click(function(){\n\t\t\tif($(this).prop('checked') == true){\n\t\t\t\tcontourFlag = true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcontourFlag = false;\n\t\t\t}\n });\n /*\n\t$('#checkbox_orbital').click(function(){\n\t\t\tif($(this).prop('checked') == true){\n\t\t\t\torbital_flag = true;\n\t\t\t}\n\t\t\telse{\n\t\t\t\torbital_flag = false;\n\t\t\t}\n\t});\n\n\n */\n\n\t//button interface\n\t//start button\n\tdocument.getElementById(\"startButton\").addEventListener(\"click\", function(){\n\t\t\tresetFlag = true;\n });\n \n\n\t//stop button\n\tdocument.getElementById(\"stopButton\").addEventListener(\"click\", function(){\n\t\t\tif(stopFlag){\n\t\t\t\tstopFlag = false;\n\t\t\t}else{\n\t\t\t\tstopFlag = true;\n\t\t\t}\n });\n\n}", "function setup() { \r\n // -------------------------Sliders-------------------------//\r\n \r\n //widthWaves Slider\r\n let s = 'The quick brown fox jumped over the lazy dog.';\r\n fill(50);\r\n text(s, 10, 10, 70, 80); // Text wraps within text box\r\n widthWaves = createSlider(12, 120, 12);\r\n widthWaves.position(50, 50);\r\n widthWaves.style('width', '80px')\r\n\r\n //Angular Velocity Slider\r\n thetaSlider = createSlider(1, 30, 1);\r\n thetaSlider.position(50, 150);\r\n thetaSlider.style('width', '80px');\r\n\r\n //-------------------------Canvas-------------------------//\r\n \r\n let theCanvas = createCanvas(width, height, WEBGL);\r\n theCanvas.parent('container'); //Make sure canvas and container size are the same so canvas is centered on screen\r\n\r\n w = width + 16;\r\n dx = (TWO_PI * 2 / period) * xspacing;\r\n yvalues = new Array(floor(w / xspacing));\r\n}", "function Init(){\r\n\r\n $('#dayBright, #nightBright').attr('max',configuration['maxBrightness']);\r\n document.title = configuration['version'];\r\n $('#versionHeader').html(configuration['version']);\r\n\r\n setLocalPagination();\r\n $('[pagemenu]').on('click',function(){\r\n $('.menu-item.active').removeClass('active');\r\n $('[page].active').removeClass('active');\r\n $(this).addClass('active');\r\n $('[page=\"'+$(this).attr('pagemenu')+'\"]').addClass('active');\r\n if($(this).attr('pagemenu') == 'settings'){\r\n getClockDetails();\r\n }\r\n });\r\n $('.menu-item').eq(0).trigger('click');\r\n\r\n $('#rgbFixColor').on('input',function(){\r\n setPreviewColor();\r\n });\r\n\r\n var sliderFadeOutTimer;\r\n function setFadeOutTimer(element){\r\n setTimeout(function(){\r\n if(isMouseDown > 0){\r\n clearTimeout(sliderFadeOutTimer);\r\n sliderFadeOutTimer = setFadeOutTimer(element);\r\n }\r\n else{\r\n $(element).addClass('fading').fadeOut('slow',function(){\r\n $(this).remove();\r\n });\r\n }\r\n },600);\r\n }\r\n\r\n $('input[type=\"range\"]').on('mousedown touchstart input',function(){\r\n clearTimeout(sliderFadeOutTimer);\r\n var id = $(this).attr('id');\r\n var parent = $(this).closest('.control-holder');\r\n $('[sliderfor]:not(.fading)').each(function(){\r\n if($(this).attr('sliderfor') != id && !$(this).hasClass('fading')){\r\n $(this).addClass('fading').fadeOut('slow',function(){\r\n $(this).remove();\r\n });\r\n }\r\n });\r\n if($(parent).children('.slider-info').length == 0){\r\n $(parent).append('<div class=\"slider-info\" sliderfor=\"'+id+'\"></div>');\r\n $(parent).children('.slider-info').fadeIn(300);\r\n }\r\n var _this = $(parent).children('.slider-info').text($(this).val());\r\n sliderFadeOutTimer = setFadeOutTimer(_this);\r\n });\r\n\r\n $('.form label').on('click',function(){\r\n var id = '';\r\n if(!!$(this).attr('for')){\r\n id = $(this).attr('for');\r\n }\r\n else{\r\n id = $(this).closest('.control-holder').find('input, select, .info').eq(0).attr('id');\r\n }\r\n \r\n var info = getControlInfo(id);\r\n if(!!info){\r\n showPopUp($(this).text(), info, 450, true);\r\n } \r\n });\r\n $('#popup-close-btn, #info-popup').on('click',function(){\r\n if($('#info-popup').hasClass('cantClose')){\r\n return;\r\n }\r\n else{\r\n $('#info-popup').fadeOut(450);\r\n }\r\n });\r\n $(\"#popup-box\").click(function(event){\r\n event.stopPropagation();\r\n });\r\n\r\n //binds custom switch functionality\r\n $('.switcher').on('click',function(){\r\n $('#'+$(this).attr('for')).prop('checked',!$('#'+$(this).attr('for')).is(\":checked\")).trigger('change');\r\n });\r\n \r\n //binds custom switch text functionality\r\n $('.switcher-text').on('click',function(){\r\n $('#'+$(this).attr('for')).prop('checked',$(this).hasClass('right')).trigger('change');\r\n });\r\n\r\n //fills autogenerated select drop downs\r\n /*\r\n Possible css class:\r\n two-digit - fills with two digit values if value lower than 10\r\n Possible attributes:\r\n min (mandatory) - auto generation's minimum value\r\n max (mandatory) - auto generation's maximum value\r\n step (optional) - auto generation's step, if not set, default is 1\r\n prefix (optional) - concatanate this string before value\r\n suffix (optional) - concatanate this string after value\r\n */\r\n $('.number-select').each(function(){\r\n let from = $(this).attr('min')*1;\r\n let to = $(this).attr('max')*1;\r\n let step = !!$(this).attr('step') ? $(this).attr('step') : 1;\r\n \r\n for(let i = from; i < to+1; i){\r\n let value = $(this).hasClass('two-digit') ? formatToTwoDigit(i) : i;\r\n let text_value = value;\r\n if($(this).attr('prefix') != null){\r\n text_value = $(this).attr('prefix') + text_value\r\n }\r\n if($(this).attr('suffix') != null){\r\n text_value += $(this).attr('suffix')\r\n }\r\n $(this).append('<option value=\"'+value+'\">'+text_value+'</option>');\r\n i += step*1;\r\n } \r\n });\r\n\r\n //fills the inputs with configuration values\r\n for(var index in configuration){\r\n let value = configuration[index];\r\n if(index == 'dayTime' || index == 'nightTime' || index == 'alarmTime'){\r\n value = value.split(':');\r\n $('#'+index+'Hours').val(formatToTwoDigit(value[0]));\r\n $('#'+index+'Minutes').val(formatToTwoDigit(value[1]));\r\n }\r\n else if(index == 'version'\r\n\t\t){\r\n $('#'+index).html(value);\r\n }\r\n else if(index == 'utc_offset' || index == 'maxBrightness' || \r\n index == 'dayBright' || index == 'nightBright' || \r\n index == 'animMode' || index == 'rgbBrightness' ||\r\n index == 'rgbFixColor' || index == 'rgbSpeed' ||\r\n index == 'rgbEffect' || index == 'interval' ||\r\n\t\t\t\tindex == 'alarmPeriod' || index == 'radarTimeout' ||\r\n\t\t\t\tindex == 'dateRepeatMin' || index == 'dateMode' ||\r\n\t\t\t\tindex == 'dateStart' || index == 'dateEnd' ||\r\n\t\t\t\tindex == 'timeStart' || index == 'timeEnd' ||\r\n\t\t\t\tindex == 'tempStart' || index == 'tempEnd' ||\r\n\t\t\t\tindex == 'humidStart' || index == 'humidEnd' ||\r\n\t\t\t\tindex == 'mqttBrokerRefresh' ||\r\n\t\t\t\tindex == 'wifiSsid' || index == 'wifiPsw' || \r\n\t\t\t\tindex == 'ApSsid' || index == 'ApPsw' || \r\n\t\t\t\tindex == 'mqttBrokerAddr' || index == 'NtpServer' ||\r\n\t\t\t\tindex == 'mqttBrokerUser' || index =='mqttBrokerPsw' ||\r\n\t\t\t\tindex == 'firmware' || index == 'corrT0' || index == 'corrT1' ||\r\n\t\t\t\tindex == 'corrH0' || index == 'corrH1' || index == 'cathProtMin'\r\n ){\r\n $('#'+index).val(value);\r\n }\r\n else if((index == 'enableDST' || index == 'set12_24' ||\r\n index == 'showZero' || index == 'enableBlink' ||\r\n index == 'enableAutoShutoff' || index == 'alarmEnable' ||\r\n index == 'rgbDir' || index == 'manualOverride' ||\r\n\t\t\t\tindex == 'enableAutoDim' || index == 'enableRadar' ||\r\n\t\t\t\tindex == 'enableDoubleBlink' || index == 'enableTimeDisplay' ||\r\n\t\t\t\tindex == 'mqttEnable' || index == 'tempCF' || index == \"wifiMode\"\r\n ) && !!value\r\n ){\r\n $('#'+index).prop('checked',true);\r\n }\r\n else if(index == \"maxDigits\"){\r\n //TODO\r\n }\r\n }\r\n\t$('.radar-holder').toggleClass('hidden',configuration['radarTimeout'] == 0);\r\n\t$('.mqtt-holder').toggleClass('hidden',configuration['mqttBrokerRefresh'] == 0);\r\n\t$('.lux-holder').toggleClass('hidden',configuration['lux'] == 255);\r\n $('.pressure-holder').toggleClass('hidden',configuration['pressure'] == 255);\r\n\t$('.humidity-holder').toggleClass('hidden',configuration['humidity'] == 255);\r\n\t$('.humidity-holder2').toggleClass('hidden',configuration['humidity2'] == 255);\r\n $('.temperature-holder').toggleClass('hidden',configuration['temperature'] == 255);\r\n\t$('.temperature-holder2').toggleClass('hidden',configuration['temperature2'] == 255);\r\n $('.rgb-holder').toggleClass('hidden',configuration['rgbEffect'] == 255);\r\n\t$('.tube-holder').toggleClass('hidden',configuration['tubeDriver'] == \"DUMMY\");\r\n setPreviewColor();\r\n\r\n //sets a possible good timezone, if not already set\r\n //if(!configuration['utc_offset']){\r\n // //Intl.DateTimeFormat().resolvedOptions().timeZone <- I am in this Zone\r\n // var tryToFindCurrentZone = -(new Date().getTimezoneOffset() / 60);\r\n // $('#utc_offset').val(tryToFindCurrentZone);\r\n //}\r\n\r\n setTimeout(function(){\r\n $('input, select').on('change',function(){\r\n var value = '';\r\n if($(this).attr('id').indexOf(\"Hours\") == -1 || $(this).attr('id').indexOf(\"Minutes\") == -1){\r\n if($(this).attr('type') == 'checkbox'){\r\n value = $(this).is(':checked');\r\n }\r\n else{\r\n value = $(this).val();\r\n }\r\n sendMsgToArduino($(this).attr('id'), value);\r\n }\r\n else{\r\n var key = $(this).attr('id').replace('Hours','').replace('Minutes','');\r\n value = $('#'+key+'Hours').val() + \":\" + $('#'+key+'Minutes').val();\r\n sendMsgToArduino(key, value);\r\n }\r\n });\r\n $('#dateMode').on('change',function(){\r\n configuration[\"dateMode\"] = $(this).val();\r\n setCurrentInfos();\r\n });\r\n $('#tempCF').on('change',function(){\r\n configuration[\"tempCF\"] = !configuration[\"tempCF\"];\r\n setCurrentInfos();\r\n });\r\n },200);\r\n}", "function next(){\n\tpdx = idx;\n\tidx++;\n\tif(idx >= 4){\n\t\tidx = 0;\n\t}\n\tchangeSlide();\n}", "controlsListner(){\n // pin controls\n for(let pin of document.getElementsByClassName('fw-pin')) {\n \n pin.addEventListener(\"click\",function(){\n //alert(this.dataset.pin);\n for(let p of document.getElementsByClassName('fw-pin')){\n p.style.background = 'none';\n }\n this.style.background = '#ccc';\n for(let slide of document.querySelectorAll('[data-slide]')){\n if(slide.dataset.slide == pin.dataset.pin){\n slide.className = 'fw-slide fw-active ' + slide.dataset.enterAnimationClass;\n slide.dataset.active = true;\n }\n else{\n slide.className = 'fw-slide fw-previous-junk';\n slide.dataset.active = false;\n }\n }\n \n });\n\n\n } \n // arrow controls\n for(let arrow of document.querySelectorAll('[data-control]')) {\n arrow.addEventListener('click',function(slidesToShow){\n slidesToShow = document.getElementById('fw-slider-id').dataset.slides;\n \n // left is pressed\n if(this.dataset.control == 'left'){\n let index = -1;\n for(let slide of document.querySelectorAll('[data-slide]')){\n if(slide.dataset.active == 'true'){\n index = slide.dataset.slide;\n }\n slide.dataset.active = false;\n slide.className = 'fw-slide fw-previous-junk'; \n }\n index--;\n if(index == -1){\n index = slidesToShow-1;\n }\n let slide = document.getElementById('fw-slide-'+index);\n slide.className = 'fw-slide fw-active ' + slide.dataset.enterAnimationClass;\n slide.dataset.active = true;\n // changing the active pin\n for(let p of document.getElementsByClassName('fw-pin')){\n p.style.background = 'none';\n if(p.dataset.pin == index){\n p.style.background = '#ccc';\n }\n }\n \n\n \n }\n\n // right is pressed\n if(this.dataset.control == 'right'){\n let index = -1;\n for(let slide of document.querySelectorAll('[data-slide]')){\n if(slide.dataset.active == 'true'){\n index = slide.dataset.slide;\n }\n slide.dataset.active = false;\n slide.className = 'fw-slide fw-previous-junk'; \n }\n index++;\n if(index >= slidesToShow){\n index = 0;\n }\n let slide = document.getElementById('fw-slide-'+index);\n slide.className = 'fw-slide fw-active ' + slide.dataset.enterAnimationClass;\n slide.dataset.active = true;\n // changing the active pin\n for(let p of document.getElementsByClassName('fw-pin')){\n p.style.background = 'none';\n if(p.dataset.pin == index){\n p.style.background = '#ccc';\n }\n }\n }\n\n });\n }\n \n }", "bindControlsEvent () {\n this.nextBtn.addEventListener(\"click\", () => this.nextSlide())\n this.prevBtn.addEventListener(\"click\", () => this.prevSlide())\n }", "function setSliderValues(){\n warpValue.innerHTML = \"Warp Speed:\" + warpSlider.value;\n warpSlider.oninput = function() {\n warpValue.innerHTML = \"Warp Speed:\" + this.value;\n }\n\n stretchValue.innerHTML = \"Warp Stretch Length:\" + stretchSlider.value;\n stretchSlider.oninput = function() {\n stretchValue.innerHTML = \"Warp Stretch Length:\" + this.value;\n }\n\n sizeValue.innerHTML = \"Base Size:\" + sizeSlider.value;\n sizeSlider.oninput = function() {\n sizeValue.innerHTML = \"Base Size:\" + this.value;\n }\n \n baseSpeedValue.innerHTML = \"Base Speed:\" + baseSpeedSlider.value;\n baseSpeedSlider.oninput = function() {\n baseSpeedValue.innerHTML = \"Base Speed:\" + this.value;\n }\n\n amountValue.innerHTML = \"Amount:\" + amountSlider.value*100;\n amountSlider.oninput = function() {\n amountValue.innerHTML = \"Amount:\" + this.value*100;\n loadImages();\n }\n}", "constructor(x,y,w,h,Slider, canvas,c_1,c_2, c_3, Button, SFButton){\r\n this.x = x;\r\n this.y = y;\r\n this.w = w;\r\n this.h = h;\r\n\r\n // class Button x,y,w,h,text, c_1, c_2, c_3, canvas\r\n this.strokeB = new SFButton(x+4*0.125*w, y-0.15*h, 0.1*w, 0.2*h, \"S\", c_1, c_3, c_2, canvas, \"Stroke\" );\r\n this.fillB = new SFButton(x+5*0.125*w, y-0.15*h, 0.1*w, 0.2*h, \"F\", c_1, c_3, c_2, canvas, \"Fill\" );\r\n \r\n //class Slider (canvas,x,y,w,h,c_1,c_2, c_3, max, min, start)\r\n this.StrkWidth = new Slider(canvas, x+0*0.125*w, y-0.1*h, 3*0.125*w, 2*0.1*h , c_1, c_2, c_3, 10, 0, 10);\r\n\r\n this.R = new Slider(canvas, x+0*0.125*w, y+0.1*h, 3*0.125*w, 2*0.1*h , c_1, c_2, c_3, 255, 0, 255);\r\n this.G = new Slider(canvas, x+0*0.125*w, y+0.3*h, 3*0.125*w, 2*0.1*h , c_1, c_2, c_3, 255, 0, 255);\r\n this.B = new Slider(canvas, x+0*0.125*w, y+0.5*h, 3*0.125*w, 2*0.1*h , c_1, c_2, c_3, 255, 0, 255);\r\n this.A = new Slider(canvas, x+0*0.125*w, y+0.7*h, 3*0.125*w, 2*0.1*h , c_1, c_2, c_3, 100, 0, 100);\r\n\r\n this.outline = c_1;\r\n this.fill = c_2;\r\n this.stroke = c_3;\r\n this.colour = \"\";\r\n this.strokeColour = \"rgba(0,0,0,1)\";\r\n\r\n this.strokeWidth = 0;\r\n this.selectedStyle = SFButton.selectedStyle;\r\n\r\n}", "updateForm() {\n this.$step.innerText = this.currentStep;\n if (this.currentStep < 2) this.$prev.forEach(el => el.classList.add(\"hidden\"));\n if (this.currentStep === 2) this.$prev.forEach(el => el.classList.remove(\"hidden\"));\n if (this.currentStep > 4) this.$next.forEach(el => el.classList.add(\"hidden\"));\n if (this.currentStep === 4) this.$next.forEach(el => el.classList.remove(\"hidden\"));\n if (this.currentStep === 5) {\n this.updateSummary();\n this.$stepCounter.classList.add(\"hidden\");\n this.$agreeBtn.classList.remove(\"hidden\");\n\n }\n if (this.currentStep < 5) {\n this.$stepCounter.classList.remove(\"hidden\");\n this.$agreeBtn.classList.add(\"hidden\");\n }\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n }", "function moveSlide(n) { //moveSlide untuk button prev dan next\r\n index = index+n\r\n showSlides(index);\r\n}", "function make_slides(f) {\n var slides = {};\n var present_list = stimfile// _.shuffle(stims.concat(fillers)); //\n // var present_list = _.shuffle(fillers);\n slides.consent = slide({\n name : \"consent\",\n start: function() {\n exp.startT = Date.now();\n $(\"#consent_2\").hide();\n exp.consent_position = 0;\n },\n button : function() {\n if(exp.consent_position === 0) {\n exp.consent_position++;\n $(\"#consent_1\").hide();\n $(\"#consent_2\").show();\n } else {\n exp.go(); //use exp.go() if and only if there is no \"present\" data.\n }\n }\n });\n\n slides.i0 = slide({\n name : \"i0\",\n start: function() {\n exp.startT = Date.now();\n }\n });\n\n slides.trial = slide({\n name : \"trial\",\n present : present_list,\n start: function() {\n exp.startT = Date.now();\n },\n\n present_handle : function(stim) {\n // if stim is an attention check, pass html \n this.stim = stim;\n $(\".prompt\").html(\"<p><strong>\" + stim.stim + \"</strong></p>\"); /*\"<u>Speaker A</u>: <p class='hangingindent'>\" + stim.setup + \". \" + \n stim.question + \"</p><br>\" + \"<u>Speaker B</u>: <p class='hangingindent'><b>\" + \n stim.response + \".</b></p>\") ;*/\n},\nbutton: function(stim) {\n if ($('input[name=\"rating\"]:checked').val() === undefined) {\n $(\".error\").show();\n } else {\n $(\".error\").hide()\n /* use _stream.apply(this); if and only if there is\n \"present\" data. (and only *after* responses are logged) */\n /*if (this.stim.type == \"filler\" & this.stim.truefalse_question != \"na\" & $('input[name=\"truefalse\"]:checked').val() === undefined) {\n $('.truefalse-buttons').show()\n $('.vertical-radio-buttons').hide()\n $(\".prompt\").html(\"Given what you just read, is the following true or false: <p><b>\" +\n this.stim.truefalse_question + \"</b>.\") ;\n } else {\n if (this.stim.truefalse_question === \"na\") {\n truefalse_response = \"na\";\n } else {\n truefalse_response = $('input[name=\"truefalse\"]:checked').val();\n }*/\n this.log_responses();\n _stream.apply(this);\n $('input[name=\"rating\"]').attr('checked',false)\n //$('input[name=\"truefalse\"]').attr('checked',false)\n //$('.truefalse-buttons').hide()\n $('.vertical-radio-buttons').show()\n //}\n }\n },\n log_responses: function() {\n exp.data_trials.push({\n \"rating\" : $('input[name=\"rating\"]:checked').val(),\n \"stim\" : this.stim.stim,\n \"first_conj_subj\" : this.stim.first_conj_subj,\n \"last_conj_subj\" : this.stim.last_conj_subj,\n \"stim_type\" : this.stim.stim_type,\n \"predicate_type\" : this.stim.predicate_type,\n \"has_gapping\" : this.stim.has_gapping,\n \"has_negation\" : this.stim.has_negation,\n \"tense\" : this.stim.tense,\n \"verb\" : this.stim.verb,\n \"first_conj_arg\" : this.stim.first_conj_arg,\n \"last_conj_arg\" : this.stim.last_conj_arg,\n //\"question\" : this.stim.question,\n //\"answer\" : this.stim.response,\n //\"type\" : this.stim.type,\n //\"expression\" : this.stim.expr,\n //\"polarity\" : this.stim.polarity,\n //\"truefalse_question\" : this.stim.truefalse_question,\n //\"truefalse_answer\" : this.stim.truefalse_answer,\n //\"truefalse_response\" : truefalse_response,\n \"order\" : order,\n });\n order = order + 1;\n }\n });\n\n slides.instructions = slide({\n name : \"instructions\",\n button : function() {\n exp.go(); //use exp.go() if and only if there is no \"present\" data.\n }\n });\n\n slides.subj_info = slide({\n name : \"subj_info\",\n submit : function(e){\n //if (e.preventDefault) e.preventDefault(); // I don't know what this means.\n exp.subj_data = {\n language : $(\"#language\").val(),\n enjoyment : $(\"#enjoyment\").val(),\n asses : $('input[name=\"assess\"]:checked').val(),\n age : $(\"#age\").val(),\n gender : $(\"#gender\").val(),\n education : $(\"#education\").val(),\n comments : $(\"#comments\").val(),\n problems: $(\"#problems\").val(),\n fairprice: $(\"#fairprice\").val()\n };\n exp.go(); //use exp.go() if and only if there is no \"present\" data.\n }\n });\n\n slides.thanks = slide({\n name : \"thanks\",\n start : function() {\n exp.data= {\n \"trials\" : exp.data_trials,\n \"catch_trials\" : exp.catch_trials,\n \"system\" : exp.system,\n \"subject_information\" : exp.subj_data,\n \"time_in_minutes\" : (Date.now() - exp.startT)/60000\n };\n setTimeout(function() {turk.submit(exp.data);}, 1000);\n }\n });\n\n return slides;\n}", "function readyStart(svg){\n\t\n\n svg.input.textArea(18, 10, \"It Takes Carbon Fiber and Kevlar to Make the Best Basketball Shoes in the World\", {width: '200', class: 'heading'});\n \n svg.input.textArea(18, 97, \"When you look at basketball shoes, what do you see? A big swoosh. Three stripes. Michael Jordan. A billboard molded to your feet. But do you see the technology? Though maybe not as blatant as an Intel sticker on your laptop, every shoe showcases its own advanced technology. Don't worry, you can't miss it on these, the best basketball shoes on the planet. Because they roll with carbon fiber and Kevlar.\", {width: '200'});\n\n svg.input.list(228, 10, 'Nullam eget purus enim, quis faucibus sapien. \\nVivamus semper nulla vel sapien fringilla ullamcorper. \\nIn hac habitasse platea dictumst. ',{width: '150'});\n svg.input.list(228, 100, 'Nullam eget purus enim, quis faucibus sapien. \\nVivamus semper nulla vel sapien fringilla ullamcorper. \\nIn hac habitasse platea dictumst. ',{width: '150'});\n\t\n\t\n\t$('.svg-container').transition({ x: '0', y: '20px', height: '400px'}, 1000, 'snap');\n\t\n\t$('.view .message').removeClass('loading');\n\n\t\n}", "function updateJumpInputField(slideNum) {\n\t\t\t// translate to 1-based index\n\t\t\tslideNum++;\n\t\t\t$('.slideshowJumpInputField').val(slideNum);\n\t\t}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n\n mouseSizeSlider = new SliderSetting(\"Mouse Size\", 40, 160, 100, width * 0.05, height * 0.2);\n\n particleSizeSlider = new SliderSetting(\"Particle Size\", 1, 20, 9, mouseSizeSlider.slider.position().x + width/3, height * 0.2);\n\n speedSlider = new SliderSetting(\"Speed\", 0, 5, 1, particleSizeSlider.slider.position().x + width/3, height * 0.2 );\n\n // Create next image button \n let nextButton = createButton(\"Next Image\");\n nextButton.position(particleSizeSlider.slider.position().x + 30, height * 0.8);\n nextButton.mousePressed(nextImage);\n\n // Start with first image.\n nextImage();\n}", "execute(){\n console.log(this.toString());\n let slider = document.createElement('div');\n slider.className = 'fw-slider';\n slider.id = 'fw-slider-id';\n slider.setAttribute(\"data-direction\",true);\n slider.setAttribute(\"data-slides\",this.slidesToShow);\n slider.setAttribute(\"data-slides-to-scroll\",this.slidesToScroll);\n\n // create slides\n for(let i = 0;i<this.slidesToShow;i++){\n var slide = this.makeSlide(this.slides[i],i);\n slider.append(slide);\n }\n\n // pin controls\n let pinControls = document.createElement('div');\n pinControls.className = 'fw-pin-controls';\n let arrowControls = document.createElement('div');\n arrowControls.className = 'fw-arrow-controls';\n let container = document.createElement('div');\n container.className = 'fw-pin-container';\n container.style.width = (6.66 * this.slidesToShow) + '%';\n\n for(let i=0;i<this.slidesToShow;i++){\n var pin = document.createElement('div');\n pin.className = 'fw-pin';\n pin.setAttribute(\"data-pin\",i);\n pin.style.background = 'none';\n if(i == 0){\n pin.style.background = '#ccc';\n }\n container.append(pin);\n }\n \n // arrow control\n let arrowLeft = document.createElement('div');\n arrowLeft.className = 'fw-left-control';\n arrowLeft.setAttribute('data-control','left');\n let arrowRight = document.createElement('div');\n arrowRight.className = 'fw-right-control';\n arrowRight.setAttribute('data-control','right');\n\n\n pinControls.append(container);\n arrowControls.append(arrowLeft);\n arrowControls.append(arrowRight);\n slider.append(arrowControls);\n slider.append(pinControls);\n\n this.sliderElement.append(slider);\n console.log(slider);\n this.controlsListner();\n\n }", "set Joystick2Button16(value) {}", "function setup(){\r\n try{\r\n createCanvas(windowWidth, windowHeight);\r\n textFont('Courier');\r\n textSize(20);\r\n \r\n PreLoadOscillator(); //Osciladores\r\n ActivarMic(); //Preparar la captura de microfono\t \r\n \r\n gb_value_stq= gb_value_q4= gb_value_q3= gb_value_q2 = gb_value_q1 = 0;\r\n //gb_value_stq_antes = gb_value_q4_antes = gb_value_q3_antes = gb_value_q2_antes = gb_value_q1_antes = 0; \r\n \r\n gb_ctrl_btnClear = createButton('Clear');\r\n gb_ctrl_btnClear.position(150, 150);\r\n gb_ctrl_btnClear.mousePressed(ClearDtmf);\r\n \r\n gb_ctrl_btnStop = createButton('Stop');\r\n gb_ctrl_btnStop.position(150, 180);\r\n gb_ctrl_btnStop.mousePressed(StopSound);\r\n \r\n //btnPruebaSendDTMF = createButton('Send');\r\n //btnPruebaSendDTMF.position(220, 210);\r\n //btnPruebaSendDTMF.mousePressed(PruebaSendDTMF);\r\n \r\n gb_ctrl_lbl_stq = createElement('h4', 'STQ'); //label\r\n gb_ctrl_lbl_stq.position(10,130);\r\n gb_ctrl_btn_input_stq = createInput(gb_id_stq.toString(),'number'); \r\n gb_ctrl_btn_input_stq.style('width','40px');\r\n gb_ctrl_btn_input_stq.position(50, 150);\r\n gb_ctrl_btn_input_stq.input(LoadBotones);\r\n gb_ctrl_btn_input_stq.elt.min = 0;\r\n gb_ctrl_btn_input_stq.elt.max = 99;\r\n gb_ctrl_btn_input_stq.elt.value = gb_id_stq.toString();\r\n\r\n gb_ctrl_lbl_q4 = createElement('h4', 'Q4'); //label\r\n gb_ctrl_lbl_q4.position(10,160);\r\n gb_ctrl_btn_input_q4 = createInput(gb_id_q4.toString(),'number');\r\n gb_ctrl_btn_input_q4.style('width','40px');\r\n gb_ctrl_btn_input_q4.position(50, 180);\r\n gb_ctrl_btn_input_q4.input(LoadBotones);\r\n gb_ctrl_btn_input_q4.elt.min = 0;\r\n gb_ctrl_btn_input_q4.elt.max = 99;\r\n gb_ctrl_btn_input_q4.elt.value = gb_id_q4.toString();\r\n \r\n gb_ctrl_lbl_q3 = createElement('h4', 'Q3'); //label\r\n gb_ctrl_lbl_q3.position(10,190);\r\n gb_ctrl_btn_input_q3 = createInput(gb_id_q3.toString(),'number');\r\n gb_ctrl_btn_input_q3.style('width','40px');\r\n gb_ctrl_btn_input_q3.position(50, 210);\r\n gb_ctrl_btn_input_q3.input(LoadBotones);\r\n gb_ctrl_btn_input_q3.elt.min = 0;\r\n gb_ctrl_btn_input_q3.elt.max = 99; \r\n gb_ctrl_btn_input_q3.elt.value = gb_id_q3.toString();\r\n \r\n gb_ctrl_lbl_q2 = createElement('h4', 'Q2'); //label\r\n gb_ctrl_lbl_q2.position(10,220);\r\n gb_ctrl_btn_input_q2 = createInput(gb_id_q2.toString(),'number');\r\n gb_ctrl_btn_input_q2.style('width','40px');\r\n gb_ctrl_btn_input_q2.position(50, 240);\r\n gb_ctrl_btn_input_q2.input(LoadBotones);\r\n gb_ctrl_btn_input_q2.elt.min = 0;\r\n gb_ctrl_btn_input_q2.elt.max = 99; \r\n gb_ctrl_btn_input_q2.elt.value = gb_id_q2.toString();\r\n \r\n gb_ctrl_lbl_q1 = createElement('h4', 'Q1'); //label\r\n gb_ctrl_lbl_q1.position(10,250);\r\n gb_ctrl_btn_input_q1 = createInput(gb_id_q1.toString(),'number');\r\n gb_ctrl_btn_input_q1.style('width','40px');\r\n gb_ctrl_btn_input_q1.position(50, 270);\r\n gb_ctrl_btn_input_q1.input(LoadBotones);\r\n gb_ctrl_btn_input_q1.elt.min = 0;\r\n gb_ctrl_btn_input_q1.elt.max = 99; \r\n gb_ctrl_btn_input_q1.elt.value = gb_id_q1.toString();\r\n \r\n\r\n gb_ctrl_chkbox_dtmf = createCheckbox('DTMF', gb_use_dtmf); \r\n gb_ctrl_chkbox_dtmf.position(150,210);\r\n gb_ctrl_chkbox_dtmf.changed(UseDTMFEvent); \r\n UseDTMFEvent();\r\n \r\n gb_ctrl_lbl_speed_dtmf = createElement('h4', 'Vel'); //label\r\n gb_ctrl_lbl_speed_dtmf.position(150,220);\r\n gb_ctrl_input_speed_dtmf = createInput(gb_speed_dtmf.toString(),'number'); //input\r\n gb_ctrl_input_speed_dtmf.position(180, 240);\r\n gb_ctrl_input_speed_dtmf.style('width','40px');\r\n gb_ctrl_input_speed_dtmf.elt.min = 1;\r\n gb_ctrl_input_speed_dtmf.elt.max = 17; \r\n gb_ctrl_input_speed_dtmf.input(SpeedEvent);\r\n gb_ctrl_input_speed_dtmf.elt.value = gb_speed_dtmf.toString(); \r\n SpeedEvent(); //Fuerza la velocidad leida\r\n\r\n gb_ctrl_chkbox_fast = createCheckbox('FAST', gb_use_fast); \r\n gb_ctrl_chkbox_fast.position(150,270);\r\n gb_ctrl_chkbox_fast.changed(UseFastEvent);\r\n UseFastEvent();\r\n \r\n gb_ctrl_chkbox_log = createCheckbox('Log Debug', gb_log_debug); //TX y RX al mismo tiempo\r\n gb_ctrl_chkbox_log.position(250,150);\r\n gb_ctrl_chkbox_log.changed(LogDebugEvent);\r\n \r\n \r\n gb_ctrl_chkboxPAD = createCheckbox('GAMEPAD', gb_use_gamepad_dtmf); //checkbox joystick\r\n gb_ctrl_chkboxPAD.position(250,170);\r\n gb_ctrl_chkboxPAD.changed(GamePADEvent);\r\n \r\n gb_ctrl_chkboxMic = createCheckbox('Micrófono', gb_use_mic_dtmf);//checkbox mic\r\n gb_ctrl_chkboxMic.position(250,190);\r\n gb_ctrl_chkboxMic.changed(MicEvent);\r\n\r\n gb_ctrl_chkboxNTSC = createCheckbox('NTSC', gb_use_ntsc_arduino);//checkbox mic\r\n gb_ctrl_chkboxNTSC.position(250,210);\r\n gb_ctrl_chkboxNTSC.changed(NTSCEvent); \r\n \r\n\t \r\n gb_forceDraw = true; \r\n //gb_song_array.play();\r\n }\r\n catch(err) \r\n {\r\n DebugLog(err.message.toString());\r\n } \r\n}", "setupControls() {\n [\"shape\", \"rows\", \"cols\", \"bombs\"].forEach((i) => {\n this.controls[i].addEventListener(\"change\", this.setupBoard.bind(this));\n });\n this.controls.outcome.hidden = true;\n }", "function setup() {\n createCanvas(innerWidth, innerHeight)\n background(30)\n ScaleLoopingSlider = createSlider(5*1, 30*10, 25);\n ScaleLoopingSlider.position(innerWidth/2 - 70, innerHeight/2 + 340);\n}", "function makeSliderDisplay()\r\n{\r\n\t$(\"div#sliders\").empty();\r\n\tinputs = new Array();\r\n\r\n\tsimulationId = parameterSimId;\r\n\r\n\txmlGlobal = getXMLDoc(simulationId);\r\n\tinputmetadata = $(xmlGlobal).find(\"inputs>metadata\");\r\n\toutputmetadata = $(xmlGlobal).find(\"outputs>metadata\");\r\n\r\n\t// render create plan button\r\n\tvar currentSim = $(xmlGlobal).find(\"simulation\").get(0);\r\n\r\n\tgetValsFromXML(xmlGlobal);\r\n\r\n\taddSliders();\r\n\tpopulateActionsFormWithValues();\r\n}", "initSlides () {\n let i = 0,\n sections = document.getElementsByClassName(\"slide__section\");\n for ( let section of sections ) {\n let slide = new Slide(section, this)\n this.slides.push(slide)\n\n let control = this.controls[i]\n slide.control = control\n control.slideIndex = i\n\n this.bindEventToControl(control)\n\n i++\n }\n this.controls[this.current].classList.add(\"current\")\n this.len = this.slides.length\n }", "static SetInputs( inputs )\n {\n PlaybackInputs.INPUTS = inputs;\n }", "set Joystick4Button16(value) {}", "function initialiseControls(){\n PIEaddInputCheckbox(\"Rotate Mirror\",false, function()\n {\n if(turn==0)\n {\n turn=1;\n //PIEchangeDisplayCheckbox(\"Rotate Mirror\",true);\n for(var i=imagesLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesLeft[i]);\n imagesLeft.pop();\n }\n for(var i=imagesRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesRight[i]);\n imagesRight.pop();\n }\n for(var i=imagesFromLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromLeft[i]);\n imagesFromLeft.pop();\n }\n for(var i=imagesFromRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromRight[i]);\n imagesFromRight.pop();\n }\n for(var i=animateRay.length-1;i>=0;i--)\n {\n PIEremoveElement(animateRay[i]);\n animateRay.pop();\n }\n // PIEremoveDragElement(leftMirror);\n // PIEremoveDragElement(rightMirror);\n //PIEremoveDragElement(circle);\n resetExperiment();\n formRay();\n PIErender();\n if(lastOn==1) lastOn=0;\n PIEchangeInputSlider(\"Angle btw Mirror:\",90);\n document.getElementById(\"hello\").innerHTML=\"<h2></h2>\";\n // var li=document.getElementsByTagName(\"li\");\n // li[16].style.display='';\n //animate();\n }\n else\n {\n //setInterval(function(){time=0;x=desX;},5000);\n turn=0;\n //PIEchangeDisplayCheckbox(\"Rotate Mirror\",false);\n for(var i=ray1.length-1;i>=0;i--)\n {\n PIEremoveElement(ray1[i]);\n ray1.pop();\n }\n for(var i=imagesFromLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromLeft[i]);\n imagesFromLeft.pop();\n }\n for(var i=imagesFromRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromRight[i]);\n imagesFromRight.pop();\n }\n for(var i=animateRay.length-1;i>=0;i--)\n {\n PIEremoveElement(animateRay[i]);\n animateRay.pop();\n }\n if(lastOn==1) lastOn=0;\n document.getElementById(\"hello\").innerHTML=\"<h2></h2>\";\n //PIEstartButton.removeEventListener(\"mousemove\", myFunction);\n // while(object.children.length)\n // {\n // object.children.remove(object.children[0]);\n // }\n // for(var i=PIEsceneElements.length-1;i>=0;i--)\n // {\n // PIEremoveElement(PIEsceneElements[i]);\n // PIEsceneElements.pop();\n // }\n // PIErender();\n // //PIEaddElement(PIEscene);\n // PIEaddElement(leftMirror);\n // PIEaddElement(rightMirror);\n // PIEaddElement(circle);\n // PIEdragElement(circle);\n // PIEsetDragEnd(circle,correctPosObject);\n resetExperiment();\n rotateMirror();\n document.getElementById(\"hello\").innerHTML=\"<h2>Number of images formed is 3.</h2>\";\n // PIEdragElement(leftMirror);\n // PIEsetDragEnd(leftMirror,rotateMirror);\n // PIEdragElement(rightMirror);\n // PIEsetDragEnd(rightMirror,rotateMirror);\n // PIEdragElement(circle);\n // PIEsetDragEnd(circle,rotateMirror);\n PIErender();\n // var li=document.getElementsByTagName(\"li\");\n // li[16].style.display='none';\n }\n //console.log(turn);\n });\n PIEaddInputSlider(\"Angle btw Mirror:\", 90, function()\n {\n if(turn==0)\n {\n //if(lastOn==0)\n //{\n if(360%PIEgetInputSlider(\"Angle btw Mirror:\")!=0)\n {\n var c=PIEgetInputSlider(\"Angle btw Mirror:\");\n var d=Math.floor(360/PIEgetInputSlider(\"Angle btw Mirror:\"));\n //console.log(\"c=\",c);\n //console.log(\"d=\",d);\n if(d==7)\n {\n PIEchangeInputSlider(\"Angle btw Mirror:\",60);\n }\n else\n {\n if(c==25)\n {\n PIEchangeInputSlider(\"Angle btw Mirror:\",24);\n }\n else\n {\n PIEchangeInputSlider(\"Angle btw Mirror:\",360/d);\n }\n }\n }\n for(var i=animateRay.length-1;i>=0;i--)\n {\n PIEremoveElement(animateRay[i]);\n animateRay.pop();\n }\n for(var i=imagesFromLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromLeft[i]);\n imagesFromLeft.pop();\n }\n for(var i=imagesFromRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromRight[i]);\n imagesFromRight.pop();\n }\n rotateMirror();\n //}\n // else\n // {\n // PIEchangeInputSlider(\"Angle btw Mirror:\",90);\n // }\n }\n else\n {\n PIEchangeInputSlider(\"Angle btw Mirror:\",90);\n }\n },10, 180, 5);\n PIEaddInputCommand(\"Demo Mode\", function()\n {\n // var li=document.getElementsByTagName(\"li\");\n // li[10].style.display='none';\n // li[11].style.display='none';\n // li[12].style.display='none';\n // li[13].style.display='none';\n // li[14].style.display='none';\n // //li[16].style.display='none';\n if(lastOn==1)\n {\n if(turn==0)\n {\n for(var i=imagesLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesLeft[i]);\n imagesLeft.pop();\n }\n for(var i=imagesRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesRight[i]);\n imagesRight.pop();\n }\n leftMirror.position.x=-halfLength*Math.cos(45*Math.PI/180);\n leftMirror.position.y=halfLength*Math.sin(45*Math.PI/180);\n leftMirror.rotation.z=45*Math.PI/180;\n\n rightMirror.position.x=halfLength*Math.cos(45*Math.PI/180);\n rightMirror.position.y=halfLength*Math.sin(45*Math.PI/180);\n rightMirror.rotation.z=-45*Math.PI/180;\n\n PIEchangeInputSlider(\"Angle btw Mirror:\",90);\n document.getElementById(\"hello\").innerHTML=\"<h2></h2>\";\n PIErender();\n }\n }\n else\n {\n lastOn=1;\n flag1=1;\n flag2=0;\n flag3=0;\n flag4=0;\n flag5=0;\n flag6=0;\n xAnimate1=0;\n xAnimate2=0;\n xAnimate3=0;\n xAnimate4=0;\n leftMirror.position.x=-halfLength*Math.cos(45*Math.PI/180);\n leftMirror.position.y=halfLength*Math.sin(45*Math.PI/180);\n leftMirror.rotation.z=45*Math.PI/180;\n\n rightMirror.position.x=halfLength*Math.cos(45*Math.PI/180);\n rightMirror.position.y=halfLength*Math.sin(45*Math.PI/180);\n rightMirror.rotation.z=-45*Math.PI/180;\n for(var i=ray1.length-1;i>=0;i--)\n {\n PIEremoveElement(ray1[i]);\n ray1.pop();\n }\n for(var i=imagesLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesLeft[i]);\n imagesLeft.pop();\n }\n for(var i=imagesRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesRight[i]);\n imagesRight.pop();\n }\n for(var i=imagesFromLeft.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromLeft[i]);\n imagesFromLeft.pop();\n }\n for(var i=imagesFromRight.length-1;i>=0;i--)\n {\n PIEremoveElement(imagesFromRight[i]);\n imagesFromRight.pop();\n }\n //console.log(\"hi\");\n //console.log(animateRay.length-1);\n for(var i=animateRay.length-1;i>=0;i--)\n {\n PIEremoveElement(animateRay[i]);\n animateRay.pop();\n }\n PIEchangeInputSlider(\"Angle btw Mirror:\",90);\n document.getElementById(\"hello\").innerHTML=\"<h2></h2>\";\n PIErender();\n }\n PIEstartAnimation();\n });\n PIEaddInputCommand(\"Note Reading\", function(){\n if(turn==1)\n {\n if(PIEgetInputSlider(\"Angle btw Mirror:\")==90)\n {\n updateTable();\n }\n else\n {\n PIEchangeInputSlider(\"Angle btw Mirror:\",90);\n updateTable();\n }\n }\n else\n {\n updateTable();\n }\n //console.log(angles);\n });\n PIEaddInputCommand(\"Clear Table\", function(){\n for(var i=1;i<=counter-1;i++)\n {\n PIEupdateTableCell(i,0,\"\");\n PIEupdateTableCell(i,1,\"\");\n PIEupdateTableCell(i,2,\"\");\n }\n //console.log(angles);\n // for(var j=0;j<angles.length;j++)\n // {\n // angles.pop();\n // }\n var j=angles.length-1;\n while(j>=0)\n {\n angles.pop();\n j--;\n }\n //console.log(angles);\n counter=1;\n });\n}", "function setup(){\n\tcreateCanvas(640, 360);\n noStroke();\n \n\n rotateSlider = createSlider(0, TWO_PI, 0);\n rotateSlider. input(pattern);\n\n\n\tpattern(); // generate a pattern to start\n}", "function currentSlide(n,p) {\r\n showSlides(slideIndex = n,p);\r\n \r\n}", "updateForm() {\n this.$step.innerText = this.currentStep;\n\n // TODO: Validation\n\n this.slides.forEach(slide => {\n slide.classList.remove(\"active\");\n\n if (slide.dataset.step == this.currentStep) {\n slide.classList.add(\"active\");\n }\n });\n\n if (this.currentStep === 5) {\n//step4\n const categories = document.getElementsByName('categories');\n const checkedCategories = [];\n for (let i = 0; i < categories.length; i++)\n if (categories[i].checked === true) {\n checkedCategories.push(categories[i].dataset.name);\n }\n\n const bags = document.getElementsByName('bags')[0].value;\n\n const organization = document.getElementsByName('organization');\n const checkedOrganization = [];\n for (let i = 0; i < organization.length; i++) {\n if (organization[i].checked === true) {\n checkedOrganization.push(organization[i].dataset.name);\n }\n }\n\n const address = document.getElementsByName('address')[0].value;\n const city = document.getElementsByName('city')[0].value;\n const postcode = document.getElementsByName('postcode')[0].value;\n const phone = document.getElementsByName('phone')[0].value;\n const date = document.getElementsByName('date')[0].value;\n const time = document.getElementsByName('time')[0].value;\n const more_info = document.getElementsByName('more_info')[0].value;\n\n//step5\n const bags_donation = document.getElementById('bag_donation');\n const organization_name = document.getElementById('organization');\n const address_phone = document.getElementById('address_phone');\n const date_time = document.getElementById('date_time');\n\n bags_donation.innerText = `${bags} worków ${checkedCategories},`;\n\n organization_name.innerText = `Dla ${checkedOrganization}`;\n\n address_phone.children[0].innerHTML = address;\n address_phone.children[1].innerHTML = city;\n address_phone.children[2].innerHTML = postcode;\n address_phone.children[3].innerHTML = phone;\n\n date_time.children[0].innerHTML = date;\n date_time.children[1].innerHTML = time;\n date_time.children[2].innerHTML = more_info;\n }\n this.$stepInstructions[0].parentElement.parentElement.hidden = this.currentStep >= 6;\n this.$step.parentElement.hidden = this.currentStep >= 6;\n\n // TODO: get data from inputs and show them in summary\n }", "function setup() {\n createCanvas(600,600);\n noStroke();\n for (let i=0;i<8;i++) {\n steps[i] = i%3\n }\n console.log(steps);\n// let n = 10;\n// console.log('i can fit number 8', floor(n/8), 'times into number', n, 'and the remainder is', n%8);\n// t0 = new Tone.MembraneSynth().chain(reverb)\n\tt0.oscillator.type = 'sine';\n// t0.envelope.attack = 1.1;\n// t0.envelope.decay = 0.1;\n// t0.envelope.sustain = 0.1;\n// t0.envelope.release = 0.1;\n t0.toMaster();\n}", "function assignElements(){\n document.getElementById(\"processContainer\").appendChild(app.view);\n document.getElementById(\"uploadImage\").addEventListener(\"change\", readFile);\n\n warpSlider = document.getElementById(\"warpRange\");\n warpValue = document.getElementById(\"warpValue\");\n\n stretchSlider = document.getElementById(\"stretchRange\");\n stretchValue = document.getElementById(\"stretchValue\");\n\n sizeSlider = document.getElementById(\"sizeRange\");\n sizeValue = document.getElementById(\"sizeValue\");\n\n baseSpeedSlider = document.getElementById(\"baseSpeedRange\");\n baseSpeedValue = document.getElementById(\"baseSpeedValue\");\n\n amountSlider = document.getElementById(\"amountRange\");\n amountValue = document.getElementById(\"amountValue\");\n setSliderValues();\n}", "function customControls() {\n\t\t\tif (options.initialLoad) {\n\t\t\t\t$this.append('<input class=\"pageNum\" type=\"hidden\" value=\"' + options.slideNum + '\">');\n\t\t\t}\n\t\t\t$this.find('.pageNum').change(function change() {\n\t\t\t\toptions.slideNum = parseInt($(this).val(), 10) - 1;\n\t\t\t\tslideTo();\n\t\t\t\toptions.autoStart = false;\n\t\t\t});\n\t\t}", "function crearEx6() {\n sliderViatge();\n filtrarViatge();\n}", "function createSequenceControls(map, attributes){\r\n $('#Unemployment_Query').append('<button class=\"skip\" id=\"reverse\">Reverse</button>');\r\n $('#Unemployment_Query').append('<button class=\"skip\" id=\"forward\">Skip</button>');\r\n $('#Unemployment_Query').append('<input class=\"range-slider\" type=\"range\">');\r\n \r\n //sets the default values of our range class\r\n \r\n $('.range-slider').attr({\r\n max: 12,\r\n min: 1,\r\n value: 0,\r\n step: 1\r\n });\r\n \r\n \r\n //sets up a listener that changes the value of our index based on\r\n //our clicks to the range slider\r\n $('.skip').click(function(){\r\n var index = $('.range-slider').val();\r\n \r\n if ($(this).attr('id') == 'forward'){\r\n index++;\r\n index = index > 12 ? 1 : index;\r\n } \r\n else if ($(this).attr('id') == 'reverse'){\r\n index--;\r\n index = index < 1 ? 12 : index; \r\n };\r\n \r\n //updates our range slider and our symbol\r\n \r\n $('.range-slider').val(index);\r\n //console.log(attributes[index2].split(\"_\")[0]);\r\n updatePropSymbols(map, attributes[index]);\r\n });\r\n \r\n\r\n $('.range-slider').on('input', function(){\r\n var index = $(this).val();\r\n updatePropSymbols(map, attributes[index]); \r\n });\r\n \r\n}", "function setupUI(){\r\n\t\r\n\t\t//Song drop down\r\n\t\tdocument.querySelector(\"#trackSelect\").onchange = function(e) {\r\n\t\t\taudioElement.src = e.target.value;\r\n\t\t\t\r\n\t\t\tdocument.querySelector('#nowPlaying').innerHTML = \"Now playing: \" + e.target.value;\r\n\t\t};\r\n\t\t\r\n\t\t//User slider for the highpass intensity and the checkbox for activation\r\n\t\tlet highSlider = document.querySelector(\"#highGainSlider\");\r\n\t\thighSlider.oninput = e => {\r\n\t\t\thighFilterGain = e.target.value;\r\n\t\t\thighFilterLabel.innerHTML = e.target.value;\r\n\t\t\t\t\t\ttoggleHighshelf();\r\n\t\t};\r\n\t\thighSlider.dispatchEvent(new InputEvent(\"input\"));\r\n\t\t\t\t\r\n\t\tdocument.querySelector('#highshelfCB').checked = highshelf;\r\n\t\tdocument.querySelector('#highshelfCB').onchange = e => {\r\n\t\t\thighshelf = e.target.checked;\r\n\t\t\ttoggleHighshelf();\r\n\t\t};\r\n\t\ttoggleHighshelf();\r\n\t\t\r\n\t\t//User slider for the lowpass intensity and the checkbox for activation\r\n\t\tlet lowSlider = document.querySelector(\"#lowGainSlider\");\r\n\t\tlowSlider.oninput = e => {\r\n\t\t\tlowFilterGain = e.target.value;\r\n\t\t\tlowFilterLabel.innerHTML = e.target.value;\r\n\t\t\t\t\ttoggleLowshelf();\r\n\t\t};\r\n\t\tlowSlider.dispatchEvent(new InputEvent(\"input\"));\t\t\r\n\t\r\n\t\tdocument.querySelector('#lowshelfCB').checked = lowshelf;\r\n\t\tdocument.querySelector('#lowshelfCB').onchange = e => {\r\n\t\t\tlowshelf = e.target.checked;\r\n\t\t\ttoggleLowshelf();\r\n\t\t};\r\n\t\ttoggleLowshelf();\r\n\t\t\r\n\t\t// Activates or deactivates the tint filter, user can change its color\r\n\t\tdocument.querySelector(\"#checkbox1\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { tint = true; }\r\n\t\t\telse { tint = false; }\r\n\t\t};\r\n\t\tdocument.querySelector(\"#tintStyleChooser\").onchange = function(e) {\r\n\t\t\r\n\t\t\ttintColor = e.target.value;\r\n\t\t};\r\n\t\t\r\n\t\t// User can change which type of audio data they want to visualize\r\n\t\tdocument.querySelector(\"#formStyleChooser\").onchange = function(e) {\r\n\t\t\r\n\t\t\tdataForm = e.target.value;\r\n\t\t};\r\n\t\t\r\n\t\t// Activates or deactivates the invert filter\r\n\t\tdocument.querySelector(\"#checkbox2\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { invert = true; }\r\n\t\t\telse { invert = false; }\r\n\t\t};\r\n\t\t\r\n\t\t// Activates or Deactivates the noise filter\r\n\t\tdocument.querySelector(\"#checkbox3\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { noise = true; }\r\n\t\t\telse { noise = false; }\r\n\t\t};\r\n\t\t\r\n\t\t// Activates or deactivates the drawing of bars\r\n\t\tdocument.querySelector(\"#checkbox4\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { showBars = true; }\r\n\t\t\telse { showBars = false; }\r\n\t\t};\r\n\t\t\r\n\t\t// Activates or deactivates the drawing of lines\t\t\r\n\t\tdocument.querySelector(\"#checkbox5\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { showLines = true; }\r\n\t\t\telse { showLines = false; }\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// Sets the users choice of color up and onto the bars\r\n\t\tdocument.querySelector(\"#barStyleChooser\").onchange = function(e) {\r\n\t\t\r\n\t\t\tbarColor = e.target.value;\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// Sets the users choice of color up and onto the circles\r\n\t\tdocument.querySelector(\"#circleStyleChooser\").onchange = function(e) {\r\n\t\t\r\n\t\t\tcircleColor = e.target.value;\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// brings the AV up into full screen\r\n\t\tdocument.querySelector(\"#fullscreen\").onclick = function() {\r\n\t\t\trequestFullscreen(canvas);\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// button from icon state machine, shows a bob variant or no bob at all based on the users input\r\n\t\tdocument.querySelector(\"#showBobRadio\").onclick = function() {\r\n\t\t\r\n\t\t\tif (this.checked) { showBob = true;\r\n\t\t\t\t\t\t\t\tshowRainBob = false;\r\n\t\t\t\t\t\t\t\tshowWindowBob = false;\r\n\t\t\t\t\t\t\t\tshowNoBob = false;}\r\n\t\t\telse { showBob = false; }\r\n\t\t};\r\n\t\tdocument.querySelector(\"#showRainBobRadio\").onclick = function() {\r\n\t\t\r\n\t\t\tif (this.checked) { showRainBob = true; \r\n\t\t\t\t\t\t\t\tshowBob = false;\r\n\t\t\t\t\t\t\t\tshowWindowBob = false;\r\n\t\t\t\t\t\t\t\tshowNoBob = false;}\r\n\t\t\telse { showRainBob = false; }\r\n\t\t};\r\n\t\tdocument.querySelector(\"#showWindowBobRadio\").onclick = function() {\r\n\t\t\r\n\t\t\tif (this.checked) { showWindowBob = true;\r\n\t\t\t\t\t\t\t\tshowBob = false;\r\n\t\t\t\t\t\t\t\tshowRainBob = false;\r\n\t\t\t\t\t\t\t\tshowNoBob = false;}\r\n\t\t\telse { showWindowBob = false; }\r\n\t\t};\r\n\t\tdocument.querySelector(\"#showNoBobRadio\").onclick = function() {\r\n\t\t\r\n\t\t\tif (this.checked) { showNoBob = true; \r\n\t\t\t\t\t\t\t\tshowBob = false;\r\n\t\t\t\t\t\t\t\tshowRainBob = false;\r\n\t\t\t\t\t\t\t\tshowWindowBob = false;}\r\n\t\t\telse { showNoBob = false; }\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// Sets the users choice of background up and onto the canvas\t\t\r\n\t\tdocument.querySelector(\"#backgroundStyleChooser\").onchange = function(e) {\r\n\t\t\r\n\t\t\tbackgroundColor = e.target.value;\r\n\t\t};\r\n\t\t\r\n\t\t// Sets the users choice of color up and onto the lines\t\t\r\n\t\tdocument.querySelector(\"#lineStyleChooser\").onchange = function(e) {\r\n\t\t\r\n\t\t\tlineColor = e.target.value;\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// Activates or deactivates the drawing of curves\t\t\t\r\n\t\tdocument.querySelector(\"#checkbox6\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { showCurves = true; }\r\n\t\t\telse { showCurves = false; }\t\t\r\n\t\t};\r\n\t\t\r\n\t\t// Activates or deactivates the drawing of circles\t\t\t\r\n\t\tdocument.querySelector(\"#checkbox7\").onclick = function() {\r\n\t\t\t\r\n\t\t\tif (this.checked) { showCircles = true; }\r\n\t\t\telse { showCircles = false; }\t\t\r\n\t\t};\t\t\r\n\t\t\r\n\t\t// Sets the users choice of color up and onto the curves\t\t\t\r\n\t\tdocument.querySelector(\"#curveStyleChooser\").onclick = function(e) {\r\n\t\t\t\r\n\t\t\tcurveColor = e.target.value;\r\n\t\t};\r\n\t\t\r\n\t\t// User slider for circle radius\r\n\t\tlet radiusSlider = document.querySelector(\"#circleRadiusSlider\");\r\n\t\tradiusSlider.oninput = e => {\r\n\t\t\tcircleRadius = e.target.value;\r\n\t\t\tcircleRadiusLabel.innerHTML = e.target.value;\r\n\t\t};\r\n\t\tradiusSlider.dispatchEvent(new InputEvent(\"input\"));\r\n\t\t\r\n\t}", "set Joystick7Button16(value) {}", "function toControls(fld) {\n\tif (fld & slide == 1) {\n\t\tvar control = $(\"form input[name='controltype']\")[1];\n\t} else {\n\t\tvar control = $(\"form input[name='controltype']\")[0];\n\t}\n\t$(\"#play\").prop('checked', ((fld & play) != 0) ? true : false);\n\t$(\"#forward\").prop('checked', ((fld & forward) != 0) ? true : false);\n\t$(\"#backward\").prop('checked', ((fld & backward) != 0) ? true : false);\n\t$(\"#jump\").val((fld & jump) >>> 4);\n\t$(\"#interaction\").val((fld & interaction) >>> 10);\n\t$(control).prop('checked', true).change();\n}", "function SliderControls(slider){\r\n this.initialize(slider);\r\n}", "function onSliderChange () {\n showSpinner(true)\n // get slider values\n let inputs = {}\n for (const input of document.getElementsByTagName('input')) {\n switch (input.type) {\n case 'number':\n inputs[input.id] = input.valueAsNumber\n break\n case 'range':\n inputs[input.id] = input.valueAsNumber\n break\n case 'checkbox':\n inputs[input.id] = input.checked\n break\n }\n }\n for (const input of document.getElementsByTagName('select')) {\n inputs[input.id] = input.value\n }\n \n \n data.inputs = inputs\n\n compute()\n}", "function next() {\n changeSlide($nextel);\n }", "setup() {\n\n let controls = new Array();\n const configs = Object.entries(this.config);\n for (const [key, val] of configs) {\n\n // Create a new object\n var control = new Object();\n\n // Create the div that contains the control\n control.div = createDiv('<label>' + val.name + '</label>')\n .parent('pattern-controls')\n .addClass('pattern-control');\n\n // Create the control form input\n // TODO: make this dynamic\n if (val.input.type == \"createSlider\") {\n control.input = createSlider(val.input.params[0], val.input.params[1], val.input.params[2], val.input.params[3])\n .attribute('name', key)\n .parent(control.div)\n .addClass(val.input.class);\n } else if (val.input.type == \"createInput\") {\n control.input = createInput(val.input.params[0], val.input.params[1], val.input.params[2])\n .attribute(\"type\", \"checkbox\")\n .attribute('name', key)\n .attribute('checkbox', null)\n .parent(control.div);\n }\n\n // Create a span element to display the current input's value (useful for Sliders)\n if (val.input.displayValue) {\n let radius_value = createSpan('0')\n .parent(control.div);\n }\n\n // Add to \"controls\" object\n controls.push(control);\n }\n }", "function setUI() {\n $('.menu_options__psize .w').val(defPixelWidth);\n $('.menu_options__psize .h').val(defPixelWidth);\n $('.menu_options__ssize .w').val(defSceneWidth);\n $('.menu_options__ssize .h').val(defSceneHeight);\n $('button.s').data('size',`${defSceneWidth},${defSceneHeight}`);\n $('button.m').data('size',`${defSceneWidth * 1.5},${defSceneHeight * 1.5}`);\n $('button.l').data('size',`${defSceneWidth * 2},${defSceneHeight * 2}`);\n $('button.xl').data('size',`${defSceneWidth * 2.5},${defSceneHeight * 2.5}`);\n}", "function inputChanged(target, index) {\n let sliderIndex = index - 1;\n\n sliders[sliderIndex].getElementsByTagName(\"input\")[0].value = target.value;\n updateSliderValue(index);\n}", "set Joystick1Button16(value) {}", "function setupButtons() {\n slider = select('#slider');\n // When the Dog button is pressed, add the current frame\n // from the video with a label of \"dog\" to the classifier\n select('#addSample').mousePressed(function() {\n regressor.addImage(slider.value());\n select('#amountOfSamples').html(samples++);\n });\n\n // Train Button\n select('#train').mousePressed(function() {\n regressor.train(function(lossValue) {\n if (lossValue) {\n loss = lossValue;\n select('#loss').html('Loss: ' + loss);\n } else {\n select('#loss').html('Done Training! Final Loss: ' + loss);\n }\n });\n });\n\n // Predict Button\n select('#buttonPredict').mousePressed(predict);\n}", "function registerInputs() {\n\t\tinputLeftIds[input.KeyEvent.DOM_VK_A] = myKeyboard.registerHandler(function() {\n\t\t\tmodel.moveSingleDown(Demo.assets['effect-1']);\n\t\t},\n\t\tinput.KeyEvent.DOM_VK_A, false\n\t\t);\n\t\tinputLeftIds[input.KeyEvent.DOM_VK_Q] = myKeyboard.registerHandler(function() {\n\t\t\tmodel.moveSingleUp(Demo.assets['effect-1']);\n\t\t},\n\t\tinput.KeyEvent.DOM_VK_Q, false\n\t\t);\n\n\t\tinputLeftIds[input.KeyEvent.DOM_VK_S] = myKeyboard.registerHandler(function(elapsedTime) {\n\t\t\tmodel.moveRepeatDown(Demo.assets['effect-2'], elapsedTime);\n\t\t},\n\t\tinput.KeyEvent.DOM_VK_S, true\n\t\t);\n\t\tinputLeftIds[input.KeyEvent.DOM_VK_W] = myKeyboard.registerHandler(function(elapsedTime) {\n\t\t\tmodel.moveRepeatUp(Demo.assets['effect-2'], elapsedTime);\n\t\t},\n\t\tinput.KeyEvent.DOM_VK_W, true\n\t\t);\n\n\t\tinputLeftIds[input.KeyEvent.DOM_VK_D] = myKeyboard.registerHandler(function() {\n\t\t\tmodel.moveRepeatTimedDown(Demo.assets['effect-3']);\n\t\t},\n\t\tinput.KeyEvent.DOM_VK_D, true, 250\n\t\t);\n\t\tinputLeftIds[input.KeyEvent.DOM_VK_E] = myKeyboard.registerHandler(function() {\n\t\t\tmodel.moveRepeatTimedUp(Demo.assets['effect-3']);\n\t\t},\n\t\tinput.KeyEvent.DOM_VK_E, true, 250\n\t\t);\n\t}", "setup() {\n\n let controls = new Array();\n const configs = Object.entries(this.config);\n for (const [key, val] of configs) {\n\n // Create a new object\n var control = new Object();\n\n // Create the div that contains the control\n control.div = createDiv('<label>' + val.name + '</label>')\n .parent('pattern-controls')\n .addClass('pattern-control');\n\n // Create the control form input\n if (val.input.type == \"createSelect\") {\n control.input = createSelect()\n .attribute('name', key)\n .parent(control.div)\n .addClass(val.input.class);\n\n const entries = Object.entries(val.input.options)\n for (const [key, object] of entries) {\n control.input.option(object, key);\n }\n\n } else if (val.input.type == \"createSlider\") {\n control.input = createSlider(val.input.params[0], val.input.params[1], val.input.params[2], val.input.params[3])\n .attribute('name', key)\n .parent(control.div)\n .addClass(val.input.class);\n } else if (val.input.type == \"createInput\") {\n control.input = createInput(val.input.params[0], val.input.params[1], val.input.params[2])\n .attribute(\"type\", \"checkbox\")\n .attribute('name', key)\n .attribute('checkbox', null)\n .parent(control.div);\n }\n\n // Create a span element to display the current input's value (useful for Sliders)\n if (val.input.displayValue) {\n let radius_value = createSpan('0')\n .parent(control.div);\n }\n\n // Add to \"controls\" object\n controls.push(control);\n }\n }", "function toChangeValues(){\n currentClefIndex = 0;\n currentSyllableIndex = 0;\n currentNeumeIndex = 0;\n currentNeumeVariationIndex = 0;\n currentNeumeInVariationIndex = 0;\n currentPitchIndex = 0;\n currentVarPitchIndex = 0;\n currentVarSourceIndex = 0;\n \n document.getElementById(\"input\").innerHTML = changeValueForm();\n}", "function setup() {\n\n var cnv = createCanvas(900, 600);\n cnv.mouseClicked(togglePlay);\n var x = (windowWidth - width) / 2;\n var y = (windowHeight - height) / 2;\n cnv.position(x, y);\n fft = new p5.FFT();\n slider = createSlider(0, 1, 0.5, 0.01);\n}", "setup() {\n\n let controls = new Array();\n const configs = Object.entries(this.config);\n for (const [key, val] of configs) {\n\n // Create a new object\n var control = new Object();\n\n // Create the div that contains the control\n control.div = createDiv('<label>' + val.name + '</label>')\n .parent('pattern-controls')\n .addClass('pattern-control');\n\n // Create the control form input\n if (val.input.type == \"createSelect\") {\n control.input = createSelect()\n .attribute('name', key)\n .parent(control.div)\n .addClass(val.input.class);\n\n const entries = Object.entries(val.input.options)\n for (const [key, object] of entries) {\n control.input.option(object, key);\n }\n\n control.input.value(val.value);\n\n } else if (val.input.type == \"createSlider\") {\n control.input = createSlider(val.input.params[0], val.input.params[1], val.input.params[2], val.input.params[3])\n .attribute('name', key)\n .parent(control.div)\n .addClass(val.input.class);\n } else if (val.input.type == \"createInput\") {\n control.input = createInput(val.input.params[0], val.input.params[1], val.input.params[2])\n .attribute(\"type\", \"checkbox\")\n .attribute('name', key)\n .attribute('checkbox', null)\n .parent(control.div);\n }\n\n // Create a span element to display the current input's value (useful for Sliders)\n if (val.input.displayValue) {\n let radius_value = createSpan('0')\n .parent(control.div);\n }\n\n // Add to \"controls\" object\n controls.push(control);\n }\n }", "function Initialize2()\n{\n const Slides = document.querySelectorAll('.slides1');\n const pages = document.querySelectorAll('section');\n let current=0;\n\n Slides.forEach((slide,index) => {\n slide.addEventListener('click', function(){\n changeDots(this);\n nextSlide(index);\n });\n });\n\n\n function changeDots(dot)\n {\n Slides.forEach(slide => {\n slide.classList.remove(\"active\");\n })\n\n dot.classList.add(\"active\");\n }\n\n function nextSlide(pageNumber)\n {\n const nextPage = pages[pageNumber];\n const currentPage = pages[current];\n\n const tl = new TimelineMax({defaults:{ease:\"power2.out\"}});\n\n tl.fromTo(currentPage , 0.8,{opacity:1,pointerEvents:\"all\"},{opacity:0,pointerEvents:\"none\"})\n .fromTo(nextPage,0.8,{opacity:0,pointerEvents:\"none\"},{opacity:1,pointerEvents:\"all\"},'-=0.4') \n\n current = pageNumber;\n }\n}", "set Joystick8Button16(value) {}", "function updateSliders() {\n lengthLabel.html(\"Length: \" + lengthSlider.value());\n tempLabel.html(\"Temperature: \" + tempSlider.value());\n}", "function setup() {\n createCanvas(1440, 7 * 737 / 8);\n //background('white');\n textFont('Helvetica');\n textAlign(CENTER, CENTER);\n\n inputReA = createInput('Re(a)', 'number');\n inputReA.position(1440 / 18, 3 * 737 / 20);\n inputReA.size(50);\n inputReA.style('font-size', '20px');\n buttonReA = createButton('✓');\n buttonReA.position(inputReA.x + inputReA.width, 3 * 737 / 20);\n buttonReA.mousePressed(reA);\n buttonReA.style('font-size', '20px');\n buttonReA.style('background-color', 'whitesmoke');\n\n inputImA = createInput('Im(a)', 'number');\n inputImA.position(1440 / 18, 4 * 737 / 20);\n inputImA.size(50);\n inputImA.style('font-size', '20px');\n buttonImA = createButton('✓');\n buttonImA.position(inputImA.x + inputImA.width, 4 * 737 / 20);\n buttonImA.mousePressed(imA);\n buttonImA.style('font-size', '20px');\n buttonImA.style('background-color', 'whitesmoke');\n\n inputReB = createInput('Re(b)', 'number');\n inputReB.position(1440 / 18, 6 * 737 / 20);\n inputReB.size(50);\n inputReB.style('font-size', '20px');\n buttonReB = createButton('✓');\n buttonReB.position(inputReB.x + inputReB.width, 6 * 737 / 20);\n buttonReB.mousePressed(reB);\n buttonReB.style('font-size', '20px');\n buttonReB.style('background-color', 'whitesmoke');\n\n inputImB = createInput('Im(b)', 'number');\n inputImB.position(1440 / 18, 7 * 737 / 20);\n inputImB.size(50);\n inputImB.style('font-size', '20px');\n buttonImB = createButton('✓');\n buttonImB.position(inputImB.x + inputImB.width, 7 * 737 / 20);\n buttonImB.mousePressed(imB);\n buttonImB.style('font-size', '20px');\n buttonImB.style('background-color', 'whitesmoke');\n\n buttonAddAnotherPair = createButton('add another pair');\n buttonAddAnotherPair.position(1440 / 50, 9 * 737 / 10);\n buttonAddAnotherPair.mousePressed(addAnotherPair);\n buttonAddAnotherPair.style('font-size', '20px');\n buttonAddAnotherPair.style('background-color', 'whitesmoke');\n}", "function initializeRangeSlider() {\n console.log('intializeRangeSlider()');\n var len = forecast.OpsImgs.length-1;\n var rs = document.createElement('Input');\n attrs = {\"type\":\"range\", \"id\":\"forecast-slider\", \"onchange\":\"jump2img(this.value)\", \"min\":0,\"max\":len, \"step\":0, \"title\": String(forecast.ImgNum) + '/' + String(len)}\n \n for (var key in attrs) {\n rs.setAttribute(key, attrs[key]);\n }\n fc = document.getElementById('forecast-controls');\n fc.insertBefore(rs, fc.firstChild);\n}", "function setup() {\n createCanvas(innerWidth , 300);\n textSize(25);\n // add textbox to canvas\n input = createInput('').attribute(\"id\", \"numInput\");\n input.attribute(\"placeholder\", \"Enter number\");\n // add button to canvas\n button = createButton(\"Convert\").attribute(\"id\", \"convertBtn\");\n // add mouse press function to button\n button.mousePressed(getNumber);\n}", "set Joystick6Button16(value) {}", "plusSlides(n){\n showSlides(this.state.slideIndex)\n }", "function setUp() {\n\n \"use strict\";\n //help buttons\n var OrbHelp = document.getElementById('orbitHelp');\n var ColourHelp = document.getElementById('colourHelp');\n var SizeHelp = document.getElementById('sizeHelp');\n var SpeedHelp = document.getElementById('speedHelp');\n\n //modal closures\n var finish0 = document.getElementById('X0');\n var finish1 = document.getElementById('X1');\n var finish2 = document.getElementById('X2');\n var finish3 = document.getElementById('X3');\n\n //sliders\n var SlideDis = document.getElementById('orbitDisSlide');\n var SlideSize = document.getElementById('planetSizeSlide');\n var SlideSpeed = document.getElementById('speedSlide');\n\n var allSliders = [SlideDis, SlideSize, SlideSpeed];\n var allHelp = [OrbHelp, ColourHelp, SizeHelp, SpeedHelp];\n var allFinish = [finish0, finish1, finish2, finish3];\n\n document.getElementById('Colchoice').addEventListener('change', ColourSel);\n document.getElementById('title').addEventListener('click', titleLink);\n document.getElementById('Go').addEventListener('click', inCount);\n\n createSliders(allSliders);\n actionSliders(allSliders);\n actionHelp(allHelp);\n actionFinish(allFinish);\n\n updateValues();\n\n}", "setupInitialValues() {\n this.__xSpacingInput.value = \"1.0\";\n this.__ySpacingInput.value = \"1.0\";\n\n this.__xDimInput.value = 5;\n this.__yDimInput.value = 1;\n }", "function update() {\n type = textInput.value();\n shapeWidth = shapeSlider.value();\n density = densitySlider.value();\n shapeOpacity = opacitySlider.value();\n let size = fontSizeOptions.value();\n fontSize = int(size);\n fontStyle = fontStyleOptions.value();\n shape = radioShape.value();\n fillInitially = radioFill.value();\n shake = shakeCheckBox.checked();\n move = moveCheckBox.checked();\n colourInitially = radioColour.value();\n\n setUpText();\n}", "function drawSliders() {\n\n noUiSlider.create(nodeSlider, {\n start: [ 8 ],\n connect: 'lower',\n tooltips: [ true ],\n range: {\n 'min': [ 0 ],\n 'max': [ 16 ]\n }\n });\n\n noUiSlider.create(edgeSlider, {\n start: [ 1 ],\n connect: 'lower',\n tooltips: [ true ],\n range: {\n 'min': [ 0 ],\n 'max': [ 4 ]\n }\n });\n\n noUiSlider.create(tensionSlider, {\n start: [ 0.7 ],\n connect: 'lower',\n tooltips: [ true ],\n range: {\n 'min': [ 0 ],\n 'max': [ 1 ]\n }\n });\n\n noUiSlider.create(weightSlider, { \n start: [ 0, MAXWEIGHT ],\n connect: true,\n tooltips: [ true, true ],\n range: {\n 'min': [ 0 ],\n '20%': [ MAXWEIGHT*0.0016 ],\n '40%': [ MAXWEIGHT*0.008 ],\n '60%': [ MAXWEIGHT*0.04 ],\n '80%': [ MAXWEIGHT*0.2 ],\n 'max': [ MAXWEIGHT ]\n }\n });\n\n noUiSlider.create(inSlider, {\n start: [ MAXIN ],\n connect: 'lower',\n tooltips: [ toInt ],\n step: 1,\n range: {\n 'min': [ 0 ],\n '20%': [ MAXIN*0.0016 ],\n '40%': [ MAXIN*0.008 ],\n '60%': [ MAXIN*0.04 ],\n '80%': [ MAXIN*0.2 ],\n 'max': [ MAXIN ]\n }\n });\n\n noUiSlider.create(outSlider, {\n start: [ MAXOUT ],\n connect: 'lower',\n tooltips: [ toInt ],\n step: 1,\n range: {\n 'min': [ 0 ],\n '20%': [ MAXOUT*0.0016 ],\n '40%': [ MAXOUT*0.008 ],\n '60%': [ MAXOUT*0.04 ],\n '80%': [ MAXOUT*0.2 ],\n 'max': [ MAXOUT ]\n }\n });\n\n isDrawn = true;\n updateSliders();\n}", "function init() {\n\n //this thing is for hiding the second and the third image slide\n TweenLite.set(slide.not(active), { autoAlpha: 0 });\n\n //this thing is for hiding the second and the third text slide\n TweenLite.set(textSlide.not(active), { autoAlpha: 0 });\n\n }", "function set_proj_meta_input() {\n proj_form = $('#proj');\n\n // Set the project id header\n var html = proj_form.html();\n proj_form.html(html.replace(new RegExp('PROJECT_ID', 'g'), proj_id));\n\n // Set up contributors.\n var contributors_group = proj_form.find('.proj_contributors_group');\n var contributors_div = contributors_group.children('.contributors_inputs');\n set_contributors(contributors_div);\n\n // Set up Factor 1 name and values.\n var factor_card = proj_form.find('.factor_card');\n set_factor(factor_card);\n\n // Enable experimental design.\n var design_group = proj_form.find('.proj_experimental_design_group');\n var design_inputs = design_group.children('.experimental_design_inputs');\n var factor_hide_radio = design_group.find('#proj_design_1_radio');\n var factor_show_radio = design_group.find('#proj_design_2_radio');\n var div_to_toggle = factor_card.clone(true);\n div_to_toggle.children('h6').text('Contrast Factor 2');\n div_to_toggle.addClass('collapse');\n design_inputs.append(div_to_toggle);\n set_radio_collapse_toggle(factor_hide_radio, factor_show_radio, div_to_toggle);\n\n // Then, we must also set up listeners to show/hide appropriate factor 1\n // and factor 2 information for each sample.\n set_factor_to_sample_listeners(factor_hide_radio, factor_show_radio, design_inputs);\n\n proj_form.find('.save_btn').click(function () {\n var btn = $(this);\n\n // Disable this button.\n btn.prop('disabled', true);\n\n // Function to show next form.\n function show_next_form() {\n var header = $('#sample_meta_header');\n header.show();\n $('#sample_meta_common').show();\n scroll_to_ele(header);\n }\n\n save_proj(show_saved, btn, show_next_form);\n });\n\n // Disable 2-factor design if there are less than 8 samples.\n if (Object.keys(proj.samples).length < 8) {\n factor_show_radio.prop('disabled', true);\n }\n\n // Enable popovers and tooltips.\n enable_popovers_tooltips(proj_form);\n}", "function sliderSetup(event) {\n var $this = $(this);\n // Mark up the lists and items.\n $this\n .trigger('listChange')\n // Add slider controls.\n .find('.fp-list')\n .not('.fp-root')\n // Add a back button.\n .prepend(\n $('<li>', {\n html: $('<a>', {\n text: 'back'\n }),\n 'class': 'fp-back'\n })\n )\n .end()\n .end()\n // Mark up the back buttons.\n .trigger('listChange')\n .trigger('reflowed');\n \n }", "function setupInstructions() {\n if (isVR()) {\n hideEntity(document.getElementById('start-copy-desktop'));\n hideEntity(document.getElementById('game-over-copy-desktop'));\n showEntity(document.getElementById('start-copy-mobile'));\n showEntity(document.getElementById('game-over-copy-mobile'));\n } else {\n showEntity(document.getElementById('start-copy-desktop'));\n showEntity(document.getElementById('game-over-copy-desktop'));\n hideEntity(document.getElementById('start-copy-mobile'));\n hideEntity(document.getElementById('game-over-copy-mobile'));\n }\n}", "set Joystick3Button16(value) {}", "set Joystick5Button16(value) {}", "function next() {\n slide(false, true);\n }", "function js_startSlide() {\n reset();\n sliderImages[0].style.display = 'block'; // Show image 1.\n temporal[current].innerHTML = current + 1 + \"/\" + sliderImages.length; // Print number image is in current location.\n dots[current].classList.add(\"active\"); // Add class active dot current image.\n}", "function setNewSlidesNumbers() {\n if (!slider.options.reverse) {\n nextSlide = increaseNumber(nextSlide);\n currentSlide = decreaseNumber(nextSlide);\n } else {\n nextSlide = decreaseNumber(nextSlide);\n currentSlide = increaseNumber(nextSlide);\n }\n }", "function sliderProps() {\n if(g.diagram == \"P-V-diagram\"){\n slider.setAttribute(\"min\",\"275\");\n slider.setAttribute(\"max\",\"750\");\n slider.setAttribute(\"step\",\"5\");\n slider.value = \"500\";\n g.slider = Number(slider.value);\n slider_label.innerHTML = `${g.slider}`;\n slider_units.innerHTML = \"Temperature (K)\";\n } else {\n slider.setAttribute(\"min\",\"0.2\");\n slider.setAttribute(\"max\",\"25\");\n slider.setAttribute(\"step\",\"0.2\");\n slider.value = \"9\";\n g.slider = Number(slider.value);\n slider_label.innerHTML = `${g.slider}`;\n slider_units.innerHTML = \"Pressure (MPa)\";\n }\n}", "function stepSliderControl(event)\n{\n switch(event.target.tag)\n {\n case SliderEnum.SYNTH_VELOCITY:\n step[stepSelected].synthVelocity = event.target.value;\n sliderDisplay[0].innerHTML = event.target.value;\n console.log(\"Here\");\n break;\n case SliderEnum.SYNTH_PITCH:\n step[stepSelected].synthPitch = event.target.value;\n sliderDisplay[1].innerHTML = NoteName[event.target.value];\n break;\n case SliderEnum.SYNTH_OCTAVE:\n step[stepSelected].synthOctave = event.target.value;\n sliderDisplay[2].innerHTML = event.target.value;\n break;\n case SliderEnum.SYNTH_CHANCE:\n step[stepSelected].synthChance = event.target.value;\n sliderDisplay[3].innerHTML = event.target.value;\n break;\n case SliderEnum.DRUM_VELOCITY:\n step[stepSelected].drumVelocity = event.target.value;\n sliderDisplay[0].innerHTML = event.target.value;\n break;\n case SliderEnum.DRUM_TYPE:\n step[stepSelected].drumType = event.target.value;\n sliderDisplay[1].innerHTML = DrumName[event.target.value];\n break;\n case SliderEnum.DRUM_CHANCE:\n step[stepSelected].drumChance = event.target.value;\n sliderDisplay[3].innerHTML = event.target.value;\n break;\n }\n}", "function setUpAnim(){\r\n\tanimInstruction = animInstructionsRaw.split(',');\r\n\tanimCurrentInst = 0;\r\n\tmainInput.style.display = \"none\";\r\n\t//\t\tcreate 10 placerholder arrays for points on each line\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\tanimPoints.push([]);\r\n\t\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n\tanimPointPos.push([]);\r\n}", "function initButtons() {\n document.getElementById('next-arrow').addEventListener('click', gonext);\n document.getElementById('prev-arrow').addEventListener('click', goprev);\n\n//\t\tconsole.log(deck);\n//\t\tconsole.log($('.bespoke-before').length);\n\n//\t\tsetInterval(function (r) {\n//\n//\t\t\tvar value=os_count>9?9:os_count+1;\n//\t\t\tvalue=value*100/(9+1);\n//\t\t\t$('#os_value').css('width', value+'%');\n//\t\t\tgonext();\n//\n//\t\t\tconsole.log(slides);\n//\t\t\tif(os_count==4){\n//\n//\t\t\t\tos_count=0;\n//\n//\t\t\t}\n//\t\t}, 5000);\n\n\n // setTimeout(window.show, 5000);\n }", "function input() {\n r = inputNumber(ipR, 3, true, 0.1, 10); // radio (m)\n tPer = inputNumber(ipT, 3, true, 1, 10); // // período (s) \n m = inputNumber(ipM, 3, true, 0.1, 10); // masa (kg)\n}", "function initSimpleSlider() {\n\n showSlides(slideIndex);\n\n if (slides.length < 10) {\n total.textContent = `0${slides.length}`;\n } else {\n total.textContent = slides.length;\n }\n\n function showSlides(n) {\n if (n > slides.length) {\n slideIndex = 1;\n }\n if (n < 1) {\n slideIndex = slides.length;\n }\n\n slides.forEach((item) => item.classList.remove(\"show\"));\n\n slides[slideIndex - 1].classList.add(\"show\");\n\n if (slides.length < 10) {\n current.textContent = `0${slideIndex}`;\n } else {\n current.textContent = slideIndex;\n }\n }\n\n function plusSlides(n) {\n showSlides(slideIndex += n);\n }\n\n prev.addEventListener('click', function () {\n plusSlides(-1);\n });\n\n next.addEventListener('click', function () {\n plusSlides(1);\n });\n\n }", "function onInputChanged()\n{\n //find which input was changed\n switch ($(this).attr(\"id\"))\n {\n case inputArray[0].attr(\"id\"):\n sliderArray[0].slider(\"value\", inputArray[0].val());\n break;\n case inputArray[1].attr(\"id\"):\n sliderArray[1].slider(\"value\", inputArray[1].val());\n break;\n case inputArray[2].attr(\"id\"):\n sliderArray[2].slider(\"value\", inputArray[2].val());\n break;\n case inputArray[3].attr(\"id\"):\n sliderArray[3].slider(\"value\", inputArray[3].val());\n break;\n case inputArray[4].attr(\"id\"):\n sliderArray[4].slider(\"value\", inputArray[4].val());\n break;\n case inputArray[5].attr(\"id\"):\n sliderArray[5].slider(\"value\", inputArray[5].val());\n break;\n case inputArray[6].attr(\"id\"):\n sliderArray[6].slider(\"value\", inputArray[6].val());\n break;\n case inputArray[7].attr(\"id\"):\n sliderArray[7].slider(\"value\", inputArray[7].val());\n break;\n default:\n }\n}", "function initCentralControl(){\n var selector,i,option;\n\n selector=document.getElementById('select_device_id');\n for(i=1;i<251; i++){\n option = new Option(i+'', (i-1)+'');\n selector.options.add(option);\n }\n\n selector=document.getElementById('gain_step');\n for(i=1;i<6; i++){\n option = new Option(i+'dB', i+'');\n selector.options.add(option);\n }\n\n selector=document.getElementById('read_output_channel');\n for(i=1;i<9; i++){\n option = new Option('OUT'+i, (i-1)+'');\n selector.options.add(option);\n }\n\n\n selector=document.getElementById('input_gain_step');\n for(i=1;i<6; i++){\n option = new Option(i+'dB', i+'');\n selector.options.add(option);\n }\n\n\n selector=document.getElementById('read_input_channel');\n option = new Option('IN A', '0');\n selector.options.add(option);\n option = new Option('IN B', '1');\n selector.options.add(option);\n option = new Option('IN C', '2');\n selector.options.add(option);\n option = new Option('IN D', '3');\n selector.options.add(option);\n\n\n\n selector=document.getElementById('device_program_selector');\n for(i=1;i<31; i++){\n option = new Option(isChinese ? '设备程序' + i : 'Device Program ' + i, i + '');\n selector.options.add(option);\n }\n\n document.getElementById('output_write_copy').onclick = outputWriteCopyResponse;\n document.getElementById('output_read_copy').onclick = outputReadCopyResponse;\n document.getElementById('input_write_copy').onclick = inputWriteCopyResponse;\n document.getElementById('input_read_copy').onclick = inputReadCopyResponse;\n document.getElementById('system_copy').onclick = systemCopyResponse;\n document.getElementById('central_exit').onclick = centralExitClickResponse;\n\n setCentralElementEvent();\n\n initCentralDisplay();\n}", "function on_draw_gui_decoder()\n{\n //Define decoder configuration GUI\n ScanaStudio.gui_add_ch_selector(\"ch_servo\",\"Servo channel\",\"Servomotor\");\n ScanaStudio.gui_add_combo_box(\"type\",\"Servomotor type\");\n ScanaStudio.gui_add_item_to_combo_box(\"Standart (angle and speed)\", true);\n ScanaStudio.gui_add_item_to_combo_box(\"Continuous rotation (sense and speed of rotation)\",false);\n ScanaStudio.gui_add_engineering_form_input_box(\"pulse_min\",\"Pulse width min (0 °)\",100e-6,10e-3,1e-3,\"s\");\n ScanaStudio.gui_add_engineering_form_input_box(\"pulse_max\",\"Pulse width max (180 °)\",100e-6,10e-3,2e-3,\"s\");\n ScanaStudio.gui_add_text_input(\"angle_range\",\"Angle Range (°)\",\"180\");\n ScanaStudio.gui_add_engineering_form_input_box(\"frequency\",\"Frequency\",5,500,50,\"Hz\");\n ScanaStudio.gui_add_combo_box(\"display\",\"Angle Display\");\n ScanaStudio.gui_add_item_to_combo_box(\"°\",true);\n ScanaStudio.gui_add_item_to_combo_box(\"%\",false);\n ScanaStudio.gui_add_new_tab(\"Virtual Analog Channels\",true);\n ScanaStudio.gui_add_check_box(\"angle_disp_deg\", \"Display a graphic for angle in °\", false);\n ScanaStudio.gui_add_check_box(\"angle_disp_percent\", \"Display a graphic for angle in %\", false);\n ScanaStudio.gui_add_check_box(\"speed_disp\", \"Display a graphic for speed in sec/60°\", false);\n ScanaStudio.gui_add_check_box(\"speed_display_perc\", \"Display a graphic for speed in %\", false);\n\n ScanaStudio.gui_end_tab();\n}", "function bindSliderAndNumberInputs(id) {\r\n\t// Contrast inputs (even though ids says \"intensity\")\r\n\t$('#' + id + '-intensity-input, #' + id + '-intensity-num').on('input', function() {\r\n\t\t$('#' + id + '-intensity-input, #' + id + '-intensity-num').val(this.value);\r\n\t});\r\n\t// Brightness inputs\r\n\t$('#' + id + '-brightness-input, #' + id + '-brightness-num').on('input', function() {\r\n\t\t$('#' + id + '-brightness-input, #' + id + '-brightness-num').val(this.value);\r\n\t});\r\n}", "function init() {\n initVisualization();\n \n addSimulationControls(play, pause, step, stop_movement);\n \n addParamControls(\"#sliders\", params, update_params); \n}" ]
[ "0.6371694", "0.61439204", "0.61213946", "0.5952436", "0.5918183", "0.59051746", "0.58922833", "0.58647317", "0.5845431", "0.5816585", "0.5813328", "0.57881147", "0.57851344", "0.5772182", "0.5751158", "0.5744353", "0.57023895", "0.5624105", "0.56165457", "0.5615085", "0.56116664", "0.5589836", "0.5588348", "0.5578262", "0.55565846", "0.555597", "0.54986626", "0.5491166", "0.5490658", "0.54878706", "0.5477627", "0.54721975", "0.5462273", "0.54324406", "0.5431262", "0.5423438", "0.5418398", "0.54166585", "0.54152894", "0.5411683", "0.54062295", "0.5403409", "0.5390538", "0.5389775", "0.53805035", "0.53757745", "0.53748477", "0.53736305", "0.5372352", "0.53680307", "0.53674406", "0.5363132", "0.5356283", "0.53521603", "0.5351177", "0.5351161", "0.534879", "0.5334044", "0.5331149", "0.53290325", "0.532548", "0.53158814", "0.5315385", "0.5310729", "0.529979", "0.5299385", "0.529904", "0.52904695", "0.5289805", "0.52894354", "0.5288993", "0.5283121", "0.5281234", "0.52756333", "0.5275491", "0.5273735", "0.5272252", "0.527116", "0.5268236", "0.5266951", "0.5266389", "0.5264249", "0.5263219", "0.5257135", "0.52558655", "0.5255259", "0.5255042", "0.5250638", "0.52474606", "0.5245224", "0.5242755", "0.5233777", "0.52275926", "0.52255696", "0.5225047", "0.52211726", "0.52200377", "0.5217586", "0.5217462", "0.52099496", "0.52085525" ]
0.0
-1
Slide 17 get the user choice which starts the game
function userPick(evt) { userChoice = this.id; console.log(userChoice); playGame(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseStimulus1() {makeChoice(selection=1)}", "function playerChoice(id){\n var choixJ = id.alt;\n console.log(choixJ);\n gameStart(choixJ);\n}", "static choosingOpponent(){\n //console.info(\"step5\")\n KB.listen([\n {key: Const.KEYBOARD_INT, callback: Lands.choiceQttOst}, // 0-9\n {key: Const.KEYBOARD_RETURN, callback: IA.do}, // ↩\n ]);\n\n Party.refreshWithTemplates([tpl_5_base, tpl_5]);\n }", "function gameStart() {\n gameStarted = true;\n let pSelected = userChoice;\n let hSelected = houseSelection();\n gameRule(pSelected, hSelected);\n}", "function startGame() {\n setMessage(\"Select an opponent above\");\n}", "selectOption() {\n switch ( this.index ) {\n case 0:\n this.scene.start( 'GameScene' );\n break;\n }\n }", "startGame() {\n document.getElementById('homemenu-interface').style.display = 'none';\n document.getElementById('character-selection-interface').style.display = 'block';\n this.interface.displayCharacterChoice();\n this.characterChoice();\n }", "function game (userChoice) {\n //this is to get the computer choice (see function above!)\n const computerChoice = getComputerChoice();\n}", "function startGame(){\n getDictionary();\n var state = $.deparam.fragment();\n options.variant = state.variant || options.variant;\n makeGameBoard();\n loadState();\n }", "function gamestart() {\n\t\tshowquestions();\n\t}", "function start() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\"Play the game\", \n \"Quit\"]\n })\n .then(function(answer) {\n // based on their answer, either call newGame function \n switch (answer.action) {\n case \"Play the game\" :\n console.log(\"more than once\");\n newGame();\n break;\n case \"Quit\" :\n console.log(\"Adios\")\n break;\n }\n });\n}", "function actionOnClick () {\r\n game.state.start(\"nameSelectionMenu\");\r\n}", "function start(action) {\r\n\t\r\n\t\tswitch (action) {\r\n\t\t\tcase 'go look':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: What are you going to look at??\", 1000);\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'explore':\r\n\t\t\t\texploreship(gameobj.explore);\r\n\t\t\t\tgameobj.explore++;\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'sit tight':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: Good choice we should probably wait for John to get back.\", 1000);\r\n\t\t\t\tgameobj.sittight++;\r\n\t\t\tbreak;\t\r\n\t\t}\r\n}", "pressedStart()\n\t\t\t{\n\t\t\tif(this.gamestate === 'starting')\n\t\t\t\t{\n\t\t\t\tthis.gamestate = 'choose';\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'choose')\n\t\t\t\t{\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'stats')\n\t\t\t\t{\n\t\t\t\tthis.gamestate = 'bedroom';\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'bedroom')\n\t\t\t\t{\n\t\t\t\tthis.menu.RunFunction(this);\n\t\t\t\t}\n\t\t\t}", "processSelection(){\n //let popupText = this.popup.optionEntered();\n let popupText = this.world.getTop().optionEntered();\n if(!popupText) return;\n\n console.log(\"enter \"+popupText);\n //this guy has to do the lifting for the options\n switch(popupText){\n case 'Resume Game':\n this.resumeGame();\n break;\n case 'Restart Episode':\n this.resumeGame();//need to unpause the game before change state\n this.state.start('ep2');\n break;\n case 'Instructions':\n this.popupInstruction = new Popup(this.game,this.camera.x,this.camera.y,3);\n let instruction = this.cache.getJSON('config').popup.instructions;\n this.popupInstruction.setTitle(instruction['title']);\n this.popupInstruction.setDescription(instruction['description'],0);\n\n this.world.removeChild(this.popup);\n this.world.addChild(this.popupInstruction);\n this.enableCursorKeys(false);\n break;\n case 'Got it!':\n this.enableCursorKeys(true);\n this.resumeGame();\n break;\n case 'Quit to Main Menu':\n this.resumeGame();\n this.state.start('menu');\n break;\n case 'Mute Music':\n console.log(\"muting music \");\n Tools.storeData('mutetheme',true);\n Tools.muteOrPlay(this.theme,true);\n break;\n case 'Mute Sound':\n console.log(\"muting sound\");\n Tools.storeData('mutesound',true);\n Tools.muteOrPlay(this.sfx,true);\n break;\n case 'Play Music':\n console.log(\"playing music\");\n Tools.storeData('mutetheme',false);\n Tools.muteOrPlay(this.theme,false);\n break;\n case 'Play Sound':\n console.log(\"playing sound\");\n Tools.storeData('mutesound',false);\n Tools.muteOrPlay(this.sfx,false);\n break;\n }\n }", "function playerOneMadeChoice() {\n console.log(\"this is the player 1 choice: \", player1.choice);\n player1.choice ? true : false;\n }", "function choice1() {\r\n\tplayerStoryCode += 1;\r\n\tloadStory(storyStorageArray, playerStoryCode);\r\n}", "function startGame() {\n printStats();\n console.log(\"Game Started\");\n getGamePick();\n console.log(gPick);\n document.getElementById('Title').innerHTML=\"Great, now it is you turn pick a letter a-z\"; \n }", "function policeShowUp(){\n\tstory(\"You chose to talk with the guy HOW WISE, you guys have a good 30 minute conversation about your favorite sports teams and the sports you like the best before the cops show up\");\n\tchoices = [\"Act like you know the guy\", \"Wake up from a dream\", \"Have a nightmare of the man\"];\n\tanswer = setOptions(choices);\n}", "function makeChoice(selection) {\n \n // Calculate reaction time\n const endTime = (new Date()).getTime();\n responses.rt = endTime - startTime;\n \n // Stop listening for clicks (so people can't select more than one option)\n stimulus1.removeEventListener(\"click\", chooseStimulus1);\n stimulus2.removeEventListener(\"click\", chooseStimulus2);\n \n // Display cue\n const displayedCue = cueHTML(selection);\n responses.cue = parseInt(displayedCue.index) + 1;\n \n // Calculate outcomes\n outcome = calculateOutcome(selection, displayedCue);\n \n // Wait before displaying feedback\n setTimeout(function (){\n \n // Draw feedback to screen\n feedbackHTML(selection);\n \n // Update the tally\n updateTally(outcome);\n \n // Wait before displaying the next button\n setTimeout(function (){nextButton()}, trial.feedbackDuration);\n \n }, trial.cueDuration);\n \n }", "function startGame(){\n\t// resets the score at zero\n\tscore = 0;\n\n\t// resets the index to zero\n\tquestionNumber = 0;\n\n\t// Prompt to ask the user whether they want to play with basic or cloze cards\n\tinquirer.prompt([\n\t{\n\t\ttype: \"list\",\n\t\tmessage: \"Would you like to play with Basic cards or Cloze cards?\",\n\t\tchoices: [\"Basic\", \"Cloze\"],\n\t\tname: \"cardType\"\n\t\t\n\t}\n\n\t]).then(function(game) {\n\n\tconsole.log(game.cardType + \" game!\");\n\tconsole.log(\"---------------------------------------------------\");\n\n\t\t// Starts the appropriate function based on the users selection\n\t\tif(game.cardType === \"Basic\"){\n\t\t\tbasicGame();\n\n\t\t}else if(game.cardType === \"Cloze\"){\n\t\t\tclozeGame();\n\t\t};\n\t})\n}", "function userChoice(choice){\n setHulkChoice();\n evaluate(choice);\n}", "function startGame() {\n// Hide start\n start.style.display = \"none\";\n\n// On start, display first question\n displayQuestion();\n}", "function startGame(){\n //resets came incase it wasnt already done\n resetGame();\n //changes game state to running\n gameState = \"running\";\n \n //randomly chooses who goes first\n whosFirst();\n //alert who gets to go first\n alert(whosTurn + \"'s go first!\");\n}", "function getActionChoice() {\n let user_action;\n // Represents the option chosen from this menu\n console.log(\"1. Add inventory to the location\\n\");\n console.log(\"2. Ship inventory from a location\\n\");\n console.log(\"3. Quit the program\");\n user_action = rls.questionInt(\"Please enter you choice: \");\n\n return user_action;\n}", "startBtnClickHandler() {\n this.changeGamePhase(\"creatureSelect\");\n }", "function startGame() {\n clearBox();\n kickOff();\n loadQuestion(currentQuest);\n}", "function startGame(){\n currentQuestionIndex = 0;\n setNextQuestion();\n}", "function startGame() {\n if(gameState.gameDifficulty === 'easy')\n {\n easyMode();\n } \n if(gameState.gameDifficulty ==='normal'){\n normalMode();\n }\n\n if(gameState.gameDifficulty ==='hard'){\n hardMode();\n }\n\n}", "function startGame(){\n countdown();\n question();\n solution();\n }", "function beginApp() {\n console.log('Please build your team');\n newMemberChoice();\n}", "function startGame(){\n\tgamePrompt(\"S.R.S.V: Press Enter to Start and to Continue\",intro);\n}", "function playGame(event) {\n let userChoice = event.target.innerText;\n let userChoiceIndex = userOptions.options.indexOf(userChoice);\n if (userChoiceIndex === -1) {\n alert('Unable to find to your choice!!!')\n }\n else {\n images[0].childNodes[1].classList = `fas ${userOptions.images[userChoiceIndex]}`;\n addAnimations();\n getResult(userChoiceIndex);\n removeClickEvents();\n }\n}", "function OnCorrectChoice() {\n //Gets player name input: executes once\n if (!nameInputted) {\n if ($(\"name\").value !== \"\") {\n name = $(\"name\").value;\n //If inputted value is null, the character's name remains the default\n }\n nameInputted = true;\n }\n \n //Progresses game, executes for all stages of the game\n progressGame(tracker);\n}", "function askToStart(){\n\tinquirer.prompt([\n\t {type: \"input\",\n\t name: \"startGame\",\n\t message: \"Ready to play? Yes or no.\"}\n\n\t]).then(function(data){\n\t if (data.startGame == 'yes'){\n\t \t//go to where the game will start\n\t \t//go to where the letter.js to get the blank lines in\n\t \tlettersGuessed();\n\t\t }else if (data.startGame == 'no'){\n\t\t \t//go to where game ends\n\t \tconsole.log('Maybe next time then!');\n\t }else {\n\t \tconsole.log('Yes or no please...');\n\t \taskToStart();\n\t }\n\t});\n}", "onChooseGame(proceed, game) {\n this.chooseGameScreen.hide();\n if (proceed) {\n this.chosenGame = game;\n }\n this.show();\n }", "function UserFirst() {\n if (!gameOver && !oneOption) {\n oneOption = true;\n computer = \"O\";\n user = \"X\";\n canPlay = true;\n currentState.whichPlayerPlayed = userWinValue;\n setMessage(\"You are X's\");\n }\n}", "function pickedRock(){ \n userchoice = 'Rock'; \n playround();\n}", "startGame(){\r\n startScreen.style.display = \"none\"\r\n this.activePhrase = this.getRandomPhrase(this.phrases).toLowerCase();\r\n chosenPhrase = new Phrase(this.activePhrase);\r\n chosenPhrase.addPhraseToDisplay()\r\n }", "runGame() {\r\n HangmanUtils.displayGameOptions();\r\n let gameOption = input.questionInt(\">> \");\r\n let game = new Game(this.sourceFileName, this.recordsFileName, this.maxScore);\r\n switch (gameOption) {\r\n case 1:\r\n game.opOneRoundIndependent();\r\n break;\r\n case 2:\r\n game.opOneGameplay();\r\n break;\r\n case 3:\r\n game.opContinuousGameplays();\r\n break;\r\n case 4:\r\n break;\r\n default:\r\n console.log(\"\\nPlease only enter 1, 2, 3 or 4!\");\r\n input.question(\"\\nPress \\\"Enter\\\" to proceed...\");\r\n }\r\n }", "function startGame() {\n $(\"#startBtn\").click(function () {\n\n $(\"#startBtn\").css(\"visibility\", \"hidden\");\n $(\"#questAns\").css(\"visibility\", \"visible\");\n $(\"#time\").css(\"visibility\", \"visible\");\n $(\"#countdown\").css(\"visibility\", \"visible\");\n $(\"#answers\").css(\"visibility\", \"visible\");\n $(\"#question\").css(\"visibility\", \"visible\");\n $(\"#endScreen\").css(\"visibility\", \"hidden\");\n timer = 30;\n timeCount = 30;\n\n //starting question/answer combo\n questCount = 0;\n // a question/answer team appears\n $(\"#question\").html(questAns[questCount].question);\n console.log(questAns[questCount].question);\n getQ();\n\n })\n }", "function init () {\n\tprompt.get('choice', function (err, result) {\n\t\tvar choice = result.choice;\n\n\t\t// error handling - will run prompt again if user does not enter rock, paper, or scissors\n\t\tif (choice !== 'rock' && choice !== 'paper' && choice !== 'scissors') return init();\n\n\t\t// triggers game\n\t\tstartGame(choice)\n\t});\n}", "function start (){\n if (gameStatus.active === false) {\n gameStatus.active = true\n gameStatus.maxStrikes = 2\n gameStatus.strikes = 0\n gameStatus.poits = 0\n gameStatus.passes = 2\n gameStatus.words = shuffle(words)\n gameStatus.word = gameStatus.words.shift()\n gameStatus.scrambled = shuffle(gameStatus.word)\n console.log(` guess the name of this country: ${gameStatus.scrambled}`)\n \n } else { \n console.log (\"there is an active game, finish the active game first!\")\n }\n }", "function start() {\n console.log(\" \");\n inquirer.prompt({\n name: \"start\",\n type: \"input\",\n message: \"Press <enter> to shop agian\"\n }).then(function(answer) {\n choice = [];\n console.log(\" \");\n display();\n \n });\n}", "function selectOption() {\n let selection = document.querySelector('.pveSelect');\n let pveModal = document.querySelector('.pveModal');\n pveModal.style.cssText = 'display: none'; \n first.value = 'X';\n second.value = 'O';\n // determines which parts of code run\n if (selection.value == '2') {\n bestMove();\n GBModule.power('off');\n firstPlayer.winner('X');\n computer.power('off');\n AIGame.switch('on 2');\n playAgainPrompt.playAgain('on');\n } else if (selection.value == '1') {\n GBModule.power('off');\n firstPlayer.winner('X');\n computer.power('off');\n AIGame.switch('on 1');\n AIGame.random();\n playAgainPrompt.playAgain('on');\n\n }\n }", "function start() {\n console.log((`Welcome To Sport's Quiz :\n 1. Choose any one of the two Sport\n 2. There will be 5 questions on the sport you have selected\n 3. Each correct answer gets you 1 points. You get nothing for wrong answer.\n 4. Enter only 'A', 'B' or 'C' to make choice`));\n username = readLineSync.question(\"\\nLet's Start With Your Name First?\\n\");\n sportChoice = readLineSync.question(`\\nWhich of the following shows do you like the most ${username}?\n (A) Cricket\n (B) Footbal\n Your choice: `);\n sport_name = sportName[sportChoice];\n console.log(chalk.bgBlue(`\\n\\nGreat, let's begin ${username}!\\n`));\n\n}", "function getChoice() {\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\"]\n }).then(function(answer) {\nswitch(answer.action) {\n\tcase 'View Products for Sale':\n\t\tviewProducts();\n\tbreak;\n\n\tcase 'View Low Inventory':\n\t\tviewLowInventory();\n\tbreak;\n\t\n\tcase 'Add to Inventory':\n\t\trestockInventory();\n\tbreak; \n\t\n\tcase 'Add New Product':\n\t\taddNewProduct();\n\tbreak;\n }\n })\n}", "startGame() {\n //@todo: have this number set to the difficulty, easy = 3, normal = 6, hard = 9\n StateActions.onStart(5, 5, this.state.difficulty);\n StateStore.setGameState(1);\n this.gameState();\n }", "function startGame(){\n\t$( \"#button_game0\" ).click(function() {selectGame(0)});\n\t$( \"#button_game1\" ).click(function() {selectGame(1)});\n\t$( \"#button_game2\" ).click(function() {selectGame(2)});\n\tloadRound();\n}", "function startGame() {\n $controls.addClass(\"hide\");\n $questionWrapper.removeClass(\"hide\");\n showQuestion(0, \"n\");\n points();\n}", "function gameStart(){\n\t\tplayGame = true;\n\t\tmainContentRow.style.visibility = \"visible\";\n\t\tscoreRow.style.visibility = \"visible\";\n\t\tplayQuitButton.style.visibility = \"hidden\";\n\t\tquestionPool = getQuestionPool(answerPool,hintPool);\n\t\tcurrentQuestion = nextQuestion();\n}", "function determineStartingPlayer()\n{\n // @TODO: Random laten bepalen welke speler aan de beurt is of mag beginnen\n \n}", "function mainGame(player_choice) {\n var p_choice, Com_choice;\n p_choice = player_choice.id;\n Com_choice = numberTochi(rnadonchice());\n results = decideWinner(p_choice, Com_choice);\n message = message_display(results);\n\n change_view(player_choice.id, Com_choice, message);\n}", "function fightOrRun() {\n var choices = [\"Run\", \"Fight\"];\n var askPlayer = parseInt(readline.keyInSelect(choices, \"Do you want to fight like a shark or run like a shrimp???\\nThe next monster might be scarier.\\n \\n What are you going to do? Press 1 to run...Press 2 to fight.\"));\n if (choices === 1) {\n //call the function for deciding to run \n run();\n } else {\n //call the function for deciding to fight\n console.log('You decided to fight, bring it on!!.');\n fight();\n }\n }", "function cornerOfTheBuilding(){\n\tstory(\"You decide to go talk with the creepy guy since it was on your way home anyways you to go over to him at midnight while you were walking, he stares you down as you slowly approach towards him and escape the streetlights illumination. He starts to act weird as you get closer and closer and you start to feel uncomfortable\");\n\tchoices = [\"Go home\", \"Run into the forest\", \"Run into the building\"];\n\tanswer = setOptions(choices);\n}", "function startGame() {\n $('#menu').hide('slow');\n var selectedQs;\n var german;\n switch (chosenQuiz) {\n case 'cogsci.tsv':\n if (quizzes.cogsci.length < NQUESTIONS) {\n quizzes.cogsci = JSON.parse(JSON.stringify(storedQuizzes.cogsci));\n }\n german = false;\n selectedQs = selectQuestions(quizzes.cogsci, NQUESTIONS, german);\n break;\n case 'ibm.tsv':\n if (quizzes.ibm.length < NQUESTIONS) {\n quizzes.ibm = JSON.parse(JSON.stringify(storedQuizzes.ibm));\n }\n german = false;\n selectedQs = selectQuestions(quizzes.ibm, NQUESTIONS, german);\n break;\n case 'deutsch.tsv':\n if (quizzes.deutsch.length < NQUESTIONS) {\n quizzes.deutsch = JSON.parse(JSON.stringify(storedQuizzes.deutsch));\n }\n german = true;\n selectedQs = selectQuestions(quizzes.deutsch, NQUESTIONS, german);\n break;\n default:\n }\n player = undefined;\n player = new Player();\n game = undefined;\n game = new Game(player, selectedQs, german);\n cStatus = undefined;\n cStatus = new CurrentStatus();\n if (!game.german) $('#header').attr('src', MEDIA_URL + 'cogsci-ibm.png');\n else $('#header').attr('src', MEDIA_URL + 'ghcampus-header.png');\n setLanguage();\n setLangParams();\n // Add click event listeners\n addClickListeners();\n $('#game').show('slow').promise().done(function() {\n if (!game.german) {\n speakOut(INTRO + '\\\\pau=2000\\\\' + game.quiz[game.p].question);\n }\n else {\n speakOut(INTROD + '\\\\pau=2000\\\\' + game.quiz[game.p].question);\n }\n });\n}", "function takeTurn(){\r\n\t\r\n\tGC.drawPlayersOnBoard();\r\n\tUI.setConsoleHTML(\"It is now \" + playerNames[GC.currentPlayer - 1] + \"'s turn. Roll the dice!\");\r\n\tUI.clearControls();\r\n\tUI.addControl(\"rollDice\",\"button\",\"Roll\",\"takeOption(0)\");\r\n}", "function startGame() {\n\t$(\"#start-button\", \"#menu\").click(function(){\n\t\tif (sess_token == null) {\n\t\t\treturn;\n\t\t}\n\t\tbutton_lock = true;\n\t\tdocument.getElementById(\"question-answer-container\").style.visibility = \"visible\";\n\t\tdocument.getElementById(\"stats\").style.visibility = \"visible\";\n\t\tdocument.getElementById(\"menu\").style.visibility = \"hidden\";\n\t\tdocument.getElementById(\"reset-button\").style.visibility = \"visible\";\n\t\tgetQuestion(\"easy\");\n\t}); \n}", "function start() {\r\n var questions = [{\r\n type: 'rawlist',\r\n name: 'choice',\r\n message: 'What would you like to do?',\r\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\", \"Exit Store\"]\r\n }];\r\n inquirer.prompt(questions).then(answers => {\r\n mainMenu(answers.choice);\r\n });\r\n}", "function getuserchoice(){\n var choice = readline.question('Choice: ');\n console.log('You have chosen option: ' + choice);\n return choice;\n}", "startGame() {\n inquirer\n .prompt({\n type: \"input\",\n message: \"What is your name?\",\n name: \"player\"\n })\n .then(answer => {\n console.log(\"Welcome to Hangman! You're up \" + answer.player);\n this.selectedWord = new Word(randomWords());\n this.refreshPage();\n this.playGame();\n });\n }", "function C007_LunchBreak_ActorSelect_Run() {\n\tBuildInteraction(C007_LunchBreak_ActorSelect_CurrentStage);\n}", "function appSelection() {\n appLetter = letterOptions[Math.floor(Math.random() * letterOptions.length)];\n}", "function startGame() {\n pairMovieWithSounds();\n randomSounds(movie);\n addPhraseToDisplay();\n keyboardSetup();\n}", "function gameStart() {\n\trenderQuestion(State.Questions[State.onQuestion]);\n\t$(\"#question-box\").removeClass('hidden');\n\t$(\"#start\").addClass('hidden');\n}", "startGame() {\r\n // Hide start screen overlay\r\n document.getElementById('overlay').style.display = 'none';\r\n\r\n // get a random phrase and set activePhrase property\r\n this.activePhrase = this.getRandomPhrase();\r\n this.activePhrase.addPhrasetoDisplay();\r\n }", "function startGame(event) {\n event.stopPropagation();\n gameTimer();\n cQuestion = -1;\n startBtn.style.display = \"none\";\n questionEl.textContent = \"\";\n choiceEl.textContent = \"\";\n nextQuestion();\n}", "function computerPlay() {\n let computerSelection = inputOption[Math.floor(Math.random() * inputOption.length)];\n return(computerSelection)\n}", "function userTouchedContinue() {\n TileSum.game.state.start('Play');\n }", "function computerPlay() {\n var randomNum = getRandomInt(0, 2);\n var choices = [\"Rock\", \"Paper\", \"Scissors\"];\n \n computerChoice = choices[randomNum];\n}", "function choice0() {\n selectAnswer(0);\n}", "function gameChoice() {\n gameSelected = playerOptions[Math.floor(Math.random() * playerOptions.length)];\n document.getElementById('game-ans-round').className = `far fa-hand-${gameSelected}`;\n document.getElementById('game-ans-game').className = `far fa-hand-${gameSelected}`;\n document.getElementById('game-answer').innerHTML = `${gameSelected}`;\n}", "function computerPlay () {\n var computerChoice = options[Math.floor(Math.random()*options.length)];\n return computerChoice;\n }", "function displayChoice() {\n \n // Draw stimuli using HTML\n leftOption.innerHTML = `<img id=\"stimulus${(stimuli.order[0]+1)}\" class=\"options\" src=\"${stimuli.leftOption}\" draggable=\"false\">`;\n rightOption.innerHTML = `<img id=\"stimulus${(stimuli.order[1]+1)}\" class=\"options\" src=\"${stimuli.rightOption}\" draggable=\"false\">`;\n \n // Select the stimuli so you can interact with them\n stimulus1 = display_element.querySelector(\"#stimulus1\");\n stimulus2 = display_element.querySelector(\"#stimulus2\");\n \n // Start \"listening\" for the participant clicking the stimulus\n // When they click on it, run the function chooseOption\n stimulus1.addEventListener(\"click\", chooseStimulus1);\n stimulus2.addEventListener(\"click\", chooseStimulus2);\n \n }", "function initialPrompt() {\n word=input.question(\"Let's play some scrabble! Enter a word to score:\");\n}", "function whoIsPlaying() {\n console.log(prompt(\"Do you want to play against me or another ‘real’ person?\"));\n console.log(prompt(\"Type 1 to play against me.\\n=> Type 2 to play against a friend.\"));\n userChoice = userInput.question();\n userChoice = userInputValidation(userChoice, ['1', '2'], \"Maybe I wasn't clear enough! The options are: '1' to play with me or '2' to play against a friend.\\n\");\n if (userChoice === '1') {\n console.clear();\n playWithComputer();\n whoStarts('computer');\n } else {\n console.clear();\n playWithFriend();\n whoStarts('friend');\n }\n}", "function playGame(){\n\tinquirer.prompt([\n\t {type: \"list\",\n\t name: \"play\",\n\t choices: [\"Yes\", \"No\"],\n\t message: \"Welcome to Hangman! Would you like to play?\"}\n\t ]).then(function(data){\n\t \tif (data.play == \"Yes\"){\n\n\n\t \t\tinquirer.prompt([\n\t\t\t\t {type: \"list\",\n\t\t\t\t name: \"cat\",\n\t\t\t\t choices: [\"Animal Phyla\", \"HTML Color Names\", \"Programming Languages\", \"Board Games\"],\n\t\t\t\t message: \"Choose a category\"}\n\t\t\t\t ]).then(function(data){\n\t\t\t\t \tinitializeWord(data.cat)\n\t\t\t\t });\n\t \t}else{\n\t \t\tconsole.log(\"Come back soon!\")\n\t \t}\n\n\t\t});\n}", "function startGame() {\n\t\n\t// fill the question div with new random question\n\tgenerateQuestion();\n\t\n\t// start the timer\n\tmoveProgressBar();\n}", "function walkingToTheBack(){\n\tstory(\"The guy starts walking away and you follow him around to the back of the building where there's no cameras or light.\");\n\tchoices = [\"Run away\", \"Fight him\", \"Call the police\"];\n\tanswer = setOptions(choices);\n}", "setName() {\n let namePicked = readlineSync.keyInSelect(playerOptions, \"Choose your player: \")\n if (namePicked === 0) {\n return \"Mario\"\n }\n else if (namePicked === 1) {\n return \"Luigi\"\n }\n\n\n }", "function chooseFighter() {\nplayerChoice = prompt(\"Choose your fighter! Rock, paper, or scissors?\");\n}", "function getStart() {\n var random = Math.random();\n if (random < 0.5) {\n player = \"X\";\n } else {\n player = \"O\";\n }\n console.log(player);\n check(player);\n}", "function startGame () {\n // This hides the start button once clicked\n document.getElementById('start').style.display = 'none'\n questionIndex = 0\n correct = 0\n incorrect = 0\n nextQuestion()\n}", "function select(choice) {\r\n checkResult(choice)\r\n // add 'selected' styling & player choice\r\n switch (choice) {\r\n case 'rock':\r\n playerRock.classList.add('selected')\r\n playerChoiceEl.textContent = ' --- Rock'\r\n break\r\n case 'paper':\r\n playerPaper.classList.add('selected')\r\n playerChoiceEl.textContent = ' --- Paper'\r\n break\r\n case 'scissors':\r\n playerScissors.classList.add('selected')\r\n playerChoiceEl.textContent = ' --- Scissors'\r\n break\r\n case 'lizard':\r\n playerLizard.classList.add('selected')\r\n playerChoiceEl.textContent = ' --- Lizard'\r\n break\r\n case 'spock':\r\n playerSpock.classList.add('selected')\r\n playerChoiceEl.textContent = ' --- Spock'\r\n break\r\n }\r\n}", "function getPlayer(whatPlayer){\n\ttheAnswer = whatPlayer.value;\n\tdocument.getElementById('question').style.display = 'none';\n\tif (theAnswer != \"x\") {\n\t\tstartComputer(Math.floor(Math.random() * 8));\n\t\treturn;\n\t} else {\n\t\talert(\"make your first X move\");\n\t}\n}", "function start(n, userChoice){\n var result;\n var n = n || 0;\n if (n>=1){\n //// Play second match with new values // <-- version 0.1 code needs upgrades :: TODO\n // var userChoice2 = theUserChoice(choices2);\n // computerChoice = theChoice(choices2);\n // theJudge(computerChoice, userChoice2, choices2);\n console.log('playing game 2');\n }else{\n // made userChoice === 'rock' for testing :: TODO\n computerChoice = theChoice(choices);\n\n // call in theJudge passing in choices computer and user made\n theJudge(computerChoice, userChoice);\n }\n\n }", "function startGame () { \n console.log(\"game started\"); \n\n inquirer \n .prompt ({\n name: \"wannaGuess\", \n type: \"list\", \n message: \"Do you want to guess a word?\", \n choices: [\"Yes\", \"Nah, I'm good\"]\n })\n\n .then (function(response) { \n var choice = response.wannaGuess; \n // console.log (\"you said \" + choice); \n\n if (choice == \"Yes\") {\n // console.log (\"you said \" + choice); \n playgame(); \n }\n\n else {\n // console.log (\"you said \" + choice); \n noThanks(); \n }\n })\n}", "function AI(){\r\n let best_choice=bestOption(game_board);\r\n game_board[Math.floor(best_choice/10)][best_choice%10]='o';\r\n document.getElementById(best_choice).classList.toggle('ring_active'); //display on the website\r\n checkEnd();\r\n }", "startGame() {\n const startScreen = document.getElementById('overlay');\n startScreen.style.display = 'none';\n this.activePhrase = this.getRandomPhrase();\n this.activePhrase.addPhraseToDisplay();\n }", "function wakeUpInYourBed(){\n\tstory(\"\");\n\tchoices = [\"Go back to bed\",\"Your mom drags you out of bed\",\"Run into the nearest forest\"];\n\tanswer = setOptions(choices);\n}", "function game(userChoice) {\r\n\t\tconst computerChoice = getComputerChoice();\r\n\t\tswitch (userChoice + computerChoice) {\r\n\t\t\tcase \"pc\":\r\n\t\t\tcase \"fp\":\r\n\t\t\tcase \"cf\":\r\n\t\t\t\twin(userChoice, computerChoice);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"pf\" :\r\n\t\t\tcase \"fc\" :\r\n\t\t\tcase \"cp\" :\r\n\t\t\t\tlose(userChoice, computerChoice);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"pp\":\r\n\t\t\tcase \"ff\":\r\n\t\t\tcase \"cc\":\r\n\t\t\t\tdraw(userChoice, computerChoice); \r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}", "function startGame() {\n gameRules.style.display = \"none\";\n rulesTitle[0].style.display = \"none\";\n btnMain.style.display = \"none\";\n deck1.style.paddingTop = \"8%\";\n deck2.style.paddingTop = \"8%\";\n scoreOne.style.display = \"inline\";\n scoreTwo.style.display = \"inline\";\n\n showCurrentScore();\n\n //generate random number between 0 and 1 \n gameData.index = Math.round(Math.random());\n console.log(`${gameData.index}`);\n setUpTurn();\n}", "function onFirstPlay() {\n var duration = player.getDuration();\n game.timePoints.push({\n time: duration,\n choices: [\n { prompt: 'Again', next: -1 }\n ]\n });\n }", "function computerPlay() {\n let choices = [\"Rock\", \"Paper\", \"Scissors\"];\n return choice = choices[Math.floor(Math.random() * 3)];\n }", "function theMan(){\n\tstory(\"You are wandering along a sidewalk at midnight in near pitch black with only streetlights illuminating the path that you have chosen. You have plenty of time that you would want to waste but out of the corner of your eye you see a shadow of a man leaning against a building asking you to go talk with him. What do you want to do?\");\n\tchoices = [\"Walk Away\", \"Walk to him\", \"Call the police\"];\n\tanswer = setOptions(choices);\n}", "function startGame() {\n gameState.active = true;\n resetBoard();\n gameState.resetBoard();\n\n var activePlayer = rollForTurn();\n \n // Game has started: enable/disable control buttons accordingly.\n btnDisable(document.getElementById('btnStart'));\n btnEnable(document.getElementById('btnStop'));\n\n var showPlayer = document.getElementById('showPlayer');\n showPlayer.innerHTML = activePlayer;\n showPlayer.style.color = (activePlayer === \"Player 1\") ? \"blue\" : \"red\";\n // The above line, doing anything more would require a pretty sizeable refactor.\n // I guess I could name \"Player 1\" with a constant.\n}", "function game() {\n easyQuestions();\n hardQuestions();\n inquirer.prompt([\n //This will be the user choice for Basic or Clozed questions\n {\n type: \"list\",\n message: \"What type of flashcards would you like?\",\n choices: [\"Basic\", \"Clozed\"],\n name: \"input\"\n }\n ]).then(function(data) {\n //user chooses to either play with basic(easy) or clozed(difficult) cards\n if (data.input === \"Basic\") {\n easy();\n } else {\n difficult();\n }\n });\n}", "function startGame() {\n select = Math.floor(Math.random() * wordList.length);\n chosenWord = wordList[select];\n gameWord = new Word(chosenWord);\n gameWord.createWord();\n if (select > -1) {\n wordList.splice(select, 1);\n }\n console.log(\n \"You get 8 letter guesses to correctly find the type of fruit.\\n Good luck!\"\n .cyan\n );\n promptUser();\n}", "function selectDrawOrGame(input) {\n switch (input) {\n case \"1\":\n selectedEmoji = \"♠\"\n drawSelected = true;\n clearOutput();\n alert(`Draw mode with ${selectedEmoji} emoji selected`);\n break;\n case \"2\":\n selectedEmoji = \"♦\"\n drawSelected = true;\n clearOutput();\n alert(`Draw mode with ${selectedEmoji} emoji selected`);\n break;\n case \"3\":\n selectedEmoji = \"♣\"\n drawSelected = true;\n clearOutput();\n alert(`Draw mode with ${selectedEmoji} emoji selected`);\n break;\n case \"4\":\n selectedEmoji = \"♥\"\n drawSelected = true;\n clearOutput();\n alert(`Draw mode with ${selectedEmoji} emoji selected`);\n break;\n case \"game\":\n selectedEmoji = \"⭕\";\n gameSelected = true;\n clearOutput();\n alert(`Game mode selected`);\n addPara(\"Input size of game board:\");\n default:\n selectedEmoji = \"\";\n break;\n }\n\n}", "function start() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do?\",\n choices: [\"Purchase Items\", \n \"Exit\"],\n }\n ]).then(function(answer) {\n\n // Based on the selection, the user experience will be routed in one of these directions\n switch (answer.choice) {\n case \"Purchase Items\":\n displayItems();\n break;\n case \"Exit\":\n exit();\n break;\n }\n });\n} // End start function" ]
[ "0.73294675", "0.7116935", "0.7113943", "0.69982475", "0.6838551", "0.6829047", "0.68167996", "0.676782", "0.67609525", "0.6749641", "0.6683467", "0.66652244", "0.66200227", "0.66179466", "0.6592817", "0.6576619", "0.6559508", "0.6554784", "0.65242827", "0.6519005", "0.6513438", "0.6505026", "0.64924675", "0.6475626", "0.64745617", "0.6456767", "0.6442632", "0.64376247", "0.64370954", "0.64282584", "0.64273477", "0.6418079", "0.6396657", "0.6391405", "0.63796437", "0.63298154", "0.6318882", "0.63147986", "0.6311853", "0.6300604", "0.629569", "0.62889135", "0.62877643", "0.6282329", "0.62804836", "0.6270364", "0.6267133", "0.6265096", "0.62556326", "0.62410563", "0.6240521", "0.62332827", "0.62323964", "0.6199292", "0.6193668", "0.61884654", "0.6188432", "0.6177762", "0.61710906", "0.6163917", "0.6158286", "0.6156931", "0.6143576", "0.6138033", "0.61363417", "0.61271286", "0.61198604", "0.6115872", "0.61105865", "0.61103505", "0.6108512", "0.61084384", "0.6105115", "0.610498", "0.6099001", "0.6091425", "0.6082586", "0.60780454", "0.6076537", "0.6076459", "0.60636353", "0.60631686", "0.6060416", "0.6060413", "0.6058719", "0.6058044", "0.60534346", "0.605155", "0.6037058", "0.6035932", "0.6030509", "0.6029622", "0.6025287", "0.60245436", "0.6019808", "0.6019701", "0.60172516", "0.601526", "0.6012058", "0.60116804" ]
0.66059613
14
Slide 18 set up the game logic (play the game) and call the output
function playGame() { let answers = ["rock", "paper", "scissors", "cat"]; computerChoice = answers[Math.floor(Math.random() * 4)]; console.log(computerChoice); catState = 2; let result = ""; if (userChoice === computerChoice) { result = "it's a draw!" } else if ((userChoice === "cat") || (computerChoice === "cat")) { catState = Math.floor(Math.random() * 2); console.log(catState); if (userChoice === "cat") { if (catState === 0) { result = "The user picked angry cat! The computer wins!"; } else { result = "The user picked happy cat! The user wins!"; } } else { if (catState === 0) { result = "The computer picked angry cat! The user wins!"; } else { result = "The computer picked happy cat! The computer wins!"; } } } else if (userChoice === "rock") { if (computerChoice === "scissors") { result = "you win, as rock blunts scissors!"; } else { result = "the computer wins, as paper wraps rock!"; } } else if (userChoice === "paper") { if (computerChoice === "rock") { result = "you win, as paper wraps rock!!"; } else { result = "the computer wins, as scissors cuts paper!"; } } else if (userChoice === "scissors") { if (computerChoice === "paper") { result = "you win, as scissors cuts paper!!"; } else { result = "the computer wins, as rock blunts scissors!!"; } } if (result === "") { gameAnswer = `User picked ${userChoice}, this is not a valid choice, please try again`; } else { gameAnswer = `User picked ${userChoice} , computer picked ${computerChoice} - ${result}`; } userOutput() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runGame() {\n\t// DISPLAY WELCOME BANNER\n\n\t// STORE INITIAL GAME STATE\n\n\t// WHILE LOOP FOR WHEN GAME IS NOT WON\n}", "function startGame() {\n pairMovieWithSounds();\n randomSounds(movie);\n addPhraseToDisplay();\n keyboardSetup();\n}", "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n if (running) {\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n } else {\n\n hud.textElements.push({\n text: 'Press \\'Y\\' to play again.',\n lineWidth: 2,\n fillStyle: 'white',\n strokeStyle: 'black',\n font: '26pt \\'IMPACT\\'',\n position: 'center center',\n padding: 83\n });\n\n render();\n }\n }", "function play() {\n\tconsole.log(\"Play the game\");\n\tcomputeNextGen();\n}", "function startGame() {\n createAnsArray();\n playAnswer();\n }", "runGame() {\r\n HangmanUtils.displayGameOptions();\r\n let gameOption = input.questionInt(\">> \");\r\n let game = new Game(this.sourceFileName, this.recordsFileName, this.maxScore);\r\n switch (gameOption) {\r\n case 1:\r\n game.opOneRoundIndependent();\r\n break;\r\n case 2:\r\n game.opOneGameplay();\r\n break;\r\n case 3:\r\n game.opContinuousGameplays();\r\n break;\r\n case 4:\r\n break;\r\n default:\r\n console.log(\"\\nPlease only enter 1, 2, 3 or 4!\");\r\n input.question(\"\\nPress \\\"Enter\\\" to proceed...\");\r\n }\r\n }", "function game() {\n console.log(\"Main game function ran\");\n /* I hide the initial screen */\n $(\"#start\").hide();\n /* I show the Play again and game info plus the first question*/\n gameInfoReset();\n $(\"#top\").show();\n $(\"#gamecontent\").show();\n showNextQuestion();\n \n /* I define function for what happens when users clicks possible answer */\n $(\"button\").click(function () {\n $(this).focusout();\n console.log(\"Answer button was clicked\");\n controlAnswer($(this).text());\n questionNumber += 1;\n console.log(\"Question no. now: \" + questionNumber);\n gameOverControl();\n\n });\n }", "play() {\r\n /*Display \"Simulating Battle*/\r\n console.log(\"Simulating Battle\");\r\n /*Call the \"createMinions\" function to create the minions.\r\n *Call the \"createPlayers\" function to create the players. */\r\n this.createMinions();\r\n this.createPlayers();\r\n /*create commenceBattle*/\r\n this.commenceBattle();\r\n }", "function game() {\n dessinerSerpent();\n dessinerPomme();\n detectionCollision();\n verifMangerPomme();\n gestionVieSerpent();\n gestionBonus();\n }", "function playGame(){\n createTimer();\n juego.resetScore();\n juego.resetCorrectLabel();\n juego.setStatePlaying(true);\n disablePlayButton();\n juego.updateExpression();\n enableSendResultButton();\n resetClasses();\n}", "function startGame() { }", "function startGame() {\n renderNewWord();\n startBar();\n }", "go() {\n\t\tthis.context.analytics.record(\"Game Loaded\");\n\t\tthis._$template.css({ \"visibility\": \"visible\"}).hide().fadeIn();\n\t\tthis._$start = $(\".start\", this._$template);\n\n\t\tthis._$start.on('click', (e) => {\n\t\t\te.preventDefault();\n\t\t\tthis._$template.fadeOut(() => {\n\t\t\t\tthis.nextState(\"playing\");\n\t\t\t});\n\t\t});\n\t}", "function startGame() {\n //hide the deal button\n hideDealButton();\n //show the player and dealer's card interface\n showCards();\n //deal the player's cards\n getPlayerCards();\n //after brief pause, show hit and stay buttons\n setTimeout(displayHitAndStayButtons, 2000);\n }", "function startGame(){\n getDictionary();\n var state = $.deparam.fragment();\n options.variant = state.variant || options.variant;\n makeGameBoard();\n loadState();\n }", "function play() {\n\t\t\n\t\t//this function (defined below) will continue to the next turn\n\t\tadvance();\n\t}", "startGame() {\r\n\t\tthis.board.drawHTMLBoard();\r\n\t\tthis.activePlayer.activeToken.drawHTMLToken();\r\n\t\tthis.ready = true;\r\n\t}", "function startGame(){\n countdown();\n question();\n solution();\n }", "function startGame() {\n renderTextPhrase(roundCount);\n renderSketchpad();\n init();\n changeId('right-col', 'right-col-sketch');\n renderNextFormBtn();\n timer();\n}", "function NewGame() {\n\t// Your code goes here for starting a game\n\tprint(\"Complete this method in Singleplayer.js\");\n}", "function draw() {\n background(109, 207, 246);\n\n //states\n if (state === `title`) {\n title();\n }\n\n if (state === `simulation`) {\n simulation();\n }\n\n if (state === `howToPlay`) {\n howToPlay();\n }\n\n if (state === `win`) {\n win();\n }\n\n if (state === `lose`) {\n lose();\n }\n}", "function gamestart() {\n\t\tshowquestions();\n\t}", "function playGame() {\n}", "function startgame() {\t\r\n\tloadImages();\r\nsetupKeyboardListeners();\r\nmain();\r\n}", "function gameLoop()\n {\n // console.log( \"beep!\" , properties.difficulty );\n renderFrame();\n }", "function play(){\n\t\n\t// If the player has entered tower building mode\n\tif (gameInfo.currentLevelBuilding) {\n\t\t// Keep the building preview centered on the pointer\n\t\tgameInfo.currentLevelBuildingPreview.setPosition(game.pointer.x, game.pointer.y);\n\t\tgameInfo.currentLevelBuildingPreviewRange.setPosition(game.pointer.x, game.pointer.y);\n\t\t// Update the building preview color to indicate valid or invalid build spots\n\t\tif (isValidBuild()) {\n\t\t\tgameInfo.currentLevelBuildingPreview.tint = 0x0000FF;\n\t\t}\n\t\telse {\n\t\t\tgameInfo.currentLevelBuildingPreview.tint = 0xFF0000;\n\t\t}\n\t}\n\t\n\t// If the level is just beginning\n\tif (gameInfo.currentLevelTime == 0) {\n\t\t//gameInfo.currentLevelBackground.visible = true;\n\t\tgameInfo.currentLevelMusic.playFrom(0);\n\t}\n\n\t// Update the time\n\tgameInfo.currentLevelTime += 1;\n\t\n\t// Update the UI elements for health, coins, and the current wave\n\tgameInfo.coinText.text = 'X ' + gameInfo.currentLevelCash;\n\tgameInfo.healthText.text = 'X ' + gameInfo.currentLevelLives;\n\t// If the last wave has not been reached, wave text is updated\n\tif ((gameInfo.currentLevelWave) < gameInfo.currentLevel.waves.length) {\n\t\tgameInfo.waveText.text = \"Wave \" + (gameInfo.currentLevelWave + 1) + '/' + gameInfo.currentLevel.waves.length;\n\t}\n\t// Price labels are red if the player doesn't have enough coins and white if they do\n\tfor (let priceLabel of gameInfo.priceLabels) {\n\t\tif(priceLabel.cost > gameInfo.currentLevelCash && priceLabel.style.fill != \"red\") {\n\t\t\tpriceLabel.style = {font: '14px mariofont', fill: 'red', stroke: 'black', strokeThickness: 5};\n\t\t}\n\t\telse if (priceLabel.cost <= gameInfo.currentLevelCash && priceLabel.style.fill != \"white\") {\n\t\t\tpriceLabel.style = {font: '14px mariofont', fill: 'white', stroke: 'black', strokeThickness: 5};\n\t\t}\n\t}\n\n\t// If the final enemy of the final wave in the level has been spawned\n\tif (gameInfo.currentLevelAllSpawned == true) {\n\t\t// And all enemies have left the screen / been removed from the game\n\t\tif (gameInfo.currentLevelEnemies.length == 0) {\n\t\t\t// Then the player is victorious and the level is over\n\t\t\t// Later it will matter if the player won or lost and content on the level select screen will respond to it\n\t\t\tconsole.log(\"VICTORY\");\n\t\t\tif (gameInfo.lastLevelCompleted < gameInfo.currentLevel.number) {\n\t\t\t\tgameInfo.lastLevelCompleted = gameInfo.currentLevel.number;\n\t\t\t\t// If this is the highest level completed so far, save it to the user's browser\n\t\t\t\tlocalStorage.setItem('Level Completed', gameInfo.lastLevelCompleted);\n\t\t\t\t// And unlock the next level\n\t\t\t\tfor (let level in gameInfo.levels) {\n\t\t\t\t\tlevel = gameInfo.levels[level];\n\t\t\t\t\tif (level.number == gameInfo.lastLevelCompleted + 1) {\n\t\t\t\t\t\tgameInfo.levelSelectInteractive.push(level.buttonSprite);\n\t\t\t\t\t\tlevel.buttonSprite.alpha = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tgameInfo.currentLevelRunning = false;\n\t\t\tgameInfo.currentLevelWinSound.play();\n\t\t\tcleanupLevel();\n\t\t}\n\t}\n\t\n\t// If the player's health has dropped to 0\n\tif (gameInfo.currentLevelLives <= 0) {\n\t\t// Then they have lost and the level is over\n\t\t// Later it will matter if the player won or lost and content on the level select screen will respond to it\n\t\tconsole.log(\"DEFEAT\");\n\t\tgameInfo.currentLevelRunning = false;\n\t\tgameInfo.currentLevelLoseSound.play();\n\t\tcleanupLevel();\n\t}\n\n\t// For each enemy on the map\n\tfor (const [index, enemy] of gameInfo.currentLevelEnemies.entries()) {\n\t\t\n\t\t// Keep the healthbar at the enemy's feet\n\t\tenemy.healthbarGroup.children[0].setPosition(enemy.x, enemy.y + 3);\n\t\tenemy.healthbarGroup.children[1].setPosition(enemy.x - (25 / 2), enemy.y + 3);\n\t\t\n\t\t// If the enemy has a trait radius, keep the trait radius centered on the enemy\n\t\tif (\"healCircle\" in enemy) {\n\t\t\tenemy.healCircle.setPosition(enemy.x, enemy.y - 10);\n\t\t\t// If it is time to trigger the healing\n\t\t\tif ((gameInfo.currentLevelTime % (60 * enemy.traits.healRadius[2])) == 0) {\n\t\t\t\tgame.wait((game.randomInt(0, 2000)), () => {\n\t\t\t\t\tif (enemy.disrupted) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tfor (let ally of gameInfo.currentLevelEnemies) {\n\t\t\t\t\t\tif(game.hitTestCircleRectangle(enemy.healCircle, ally)) {\n\t\t\t\t\t\t\tlet newHealth = ally.currentHealth + enemy.traits.healRadius[1];\n\t\t\t\t\t\t\tif (newHealth >= ally.maxHealth) {\n\t\t\t\t\t\t\t\tally.currentHealth = ally.maxHealth;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tally.currentHealth = newHealth;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Update the ally healthbar\n\t\t\t\t\t\t\tlet newWidth = (((ally.currentHealth / ally.maxHealth) * 100) / 4);\n\t\t\t\t\t\t\tif (newWidth < 0) {\n\t\t\t\t\t\t\t\tnewWidth = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tally.healthbarGroup.children[1].width = newWidth;\n\t\t\t\t\t\t\t// The healing circle is briefly displayed when the heal takes place\n\t\t\t\t\t\t\tenemy.healCircle.visible = true;\n\t\t\t\t\t\t\tgame.wait(900, () => {\n\t\t\t\t\t\t\t\tenemy.healCircle.visible = false;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Check each projectile to see if the enemy has been struck\n\t\tfor (const [index, projectile] of gameInfo.currentLevelProjectiles.entries()) {\n\t\t\t// If a projectile did hit the enemy\n\t\t\tif (game.hitTestRectangle(enemy, projectile)) {\n\t\t\t\t// Then that enemy takes damage if not invincible\n\t\t\t\tif (!(\"invincible\" in enemy && enemy.invincible)) {\n\t\t\t\t\t// Enemies with the Koopa trait have a chance of deflecting the projectile\n\t\t\t\t\tif (!(\"Koopa\" in enemy.traits && !enemy.disrupted && game.randomInt(1, 100) <= enemy.traits.Koopa)) {\n\t\t\t\t\t\tenemyDamage(enemy, projectile, true);\n\t\t\t\t\t}\n\t\t\t\t\t// If a koopa successfully deflects the projectile\n\t\t\t\t\telse {\n\t\t\t\t\t\tprojectile.vx *= -1;\n\t\t\t\t\t\tprojectile.vy *= -1;\n\t\t\t\t\t\tprojectile.scale.x *= -1;\n\t\t\t\t\t\tgame.move(projectile);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If the enemy is burning\n\t\tif (\"burning\" in enemy && enemy.burning) {\n\t\t\tenemy.burning -= 1;\n\t\t\tenemy.currentHealth -= enemy.burningDamage;\n\t\t\tlet newWidth = (((enemy.currentHealth / enemy.maxHealth) * 100) / 4);\n\t\t\tif (newWidth < 0) {\n\t\t\t\tnewWidth = 0;\n\t\t\t}\n\t\t\tenemy.healthbarGroup.children[1].width = newWidth;\n\t\t\t// If the burning ticker has run down\n\t\t\tif (enemy.burning == 0) {\n\t\t\t\tenemy.burning = false;\n\t\t\t\tenemy.burningDamage = 0;\n\t\t\t\tenemy.healthbarGroup.children[0].lineWidth = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// If the enemy is disrupted\n\t\tif (\"disrupted\" in enemy && enemy.disrupted) {\n\t\t\tenemy.disrupted -= 1;\n\t\t\t// If the disruption ticker has run down\n\t\t\tif (enemy.disrupted == 0) {\n\t\t\t\tenemy.disrupted = false;\n\t\t\t\tif(enemy.tint != 0xFF0000) {\n\t\t\t\t\tenemy.tint = 0xFFFFFF;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If the enemy's current health has fallen below one\n\t\tif (enemy.currentHealth <= 0) {\n\t\t\t//Add reward to Cash\n\t\t\tgameInfo.currentLevelCash += enemy.reward;\n\t\t\t// Then that enemy has been slain and is removed\n\t\t\tgameInfo.currentLevelEnemies.splice(index, 1);\n\t\t\tgame.wait(200, () => {\n\t\t\t\tif (enemy) {\n\t\t\t\t\tgame.remove(enemy.healthbarGroup);\n\t\t\t\t\tgame.remove(enemy);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t\n\t\t// If the enemy has upcoming turns in their path\n\t\tif (enemy.turnsTaken < enemy.pathTurns.length) {\n\t\t\t// And they have reached a turn (travelling horizontally)\n\t\t\tif (enemy.vx && ((enemy.vx > 0 && enemy.x >= gameInfo.currentLevel.turns[enemy.turnsTaken][0]) || (enemy.vx < 0 && enemy.x <= gameInfo.currentLevel.turns[enemy.turnsTaken][0]) )) {\n\t\t\t\t// Then they will now be travelling vertically along the y axis\n\t\t\t\tlet direction = enemy.vx;\n\t\t\t\tenemy.vx = 0;\n\t\t\t\t// If they are turning downwards\n\t\t\t\tif (gameInfo.currentLevel.turns[enemy.turnsTaken][1] == 1) {\n\t\t\t\t\t// If the enemy approaches from the left\n\t\t\t\t\tif (direction > 0) {\n\t\t\t\t\t\tdirection = \"rightdown\";\n\t\t\t\t\t}\n\t\t\t\t\t// If the enemy approaches from the right\n\t\t\t\t\telse {\n\t\t\t\t\t\tdirection = \"leftdown\";\n\t\t\t\t\t}\n\t\t\t\t\tenemyCurve(enemy, direction, enemy.states.walkDown);\n\t\t\t\t\tenemy.vy = enemy.speed;\n\t\t\t\t}\n\t\t\t\t// Else they are turning upwards\n\t\t\t\telse {\n\t\t\t\t\t// If the enemy approaches from the left\n\t\t\t\t\tif (direction > 0) {\n\t\t\t\t\t\tdirection = \"rightup\";\n\t\t\t\t\t}\n\t\t\t\t\t// If the enemy approaches from the right\n\t\t\t\t\telse {\n\t\t\t\t\t\tdirection = \"leftup\";\n\t\t\t\t\t}\n\t\t\t\t\tenemyCurve(enemy, direction, enemy.states.walkUp);\n\t\t\t\t\tenemy.vy = enemy.speed * -1;\n\t\t\t\t}\n\t\t\t\tenemy.turnsTaken += 1;\n\t\t\t}\n\t\t\t// And they have reached a turn (travelling vertically)\n\t\t\t//else if (enemy.vy && enemy.y == gameInfo.currentLevel.turns[enemy.turnsTaken][0]) {\n\t\t\telse if (enemy.vy && ((enemy.vy > 0 && enemy.y >= gameInfo.currentLevel.turns[enemy.turnsTaken][0]) || (enemy.vy < 0 && enemy.y <= gameInfo.currentLevel.turns[enemy.turnsTaken][0]) )) {\n\t\t\t\t// Then they will now be traviling horizontally along the x axis\n\t\t\t\tlet direction = enemy.vy;\n\t\t\t\tenemy.vy = 0;\n\t\t\t\t// If they are turning rightwards\n\t\t\t\tif (gameInfo.currentLevel.turns[enemy.turnsTaken][1] == 1) {\n\t\t\t\t\t// If the enemy approaches from the top\n\t\t\t\t\tif (direction > 0) {\n\t\t\t\t\t\tdirection = \"downright\";\n\t\t\t\t\t// If the enemy approaches from the bottom\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdirection = \"upright\";\n\t\t\t\t\t}\n\t\t\t\t\tenemyCurve(enemy, direction, enemy.states.walkRight);\n\t\t\t\t\tenemy.vx = enemy.speed;\n\t\t\t\t}\n\t\t\t\t// Else they are turning leftwards\n\t\t\t\telse {\n\t\t\t\t\t// If the enemy approaches from the top\n\t\t\t\t\tif (direction > 0) {\n\t\t\t\t\t\tdirection = \"downleft\";\n\t\t\t\t\t}\n\t\t\t\t\t// If the enemy approaches from the bottom\n\t\t\t\t\telse {\n\t\t\t\t\t\tdirection = \"upleft\";\n\t\t\t\t\t}\n\t\t\t\t\tenemyCurve(enemy, direction, enemy.states.walkLeft);\n\t\t\t\t\tenemy.vx = enemy.speed * -1;\n\t\t\t\t}\n\t\t\t\tenemy.turnsTaken += 1;\n\t\t\t}\n\t\t}\n\n\t\t// Move the enemy according to their velocity values\n\t\tgame.move(enemy);\n\t\t\n\t\t// If the enemy has completed all turns in the path\n\t\tif (enemy.turnsTaken == enemy.pathTurns.length) {\n\t\t\t// Then it is removed after leaving the visible area and a life is deducted from the player\n\t\t\tlet collision = game.outsideBounds(enemy, game.stage);\n\t\t\tif(collision){\n\t\t\t\tgameInfo.currentLevelEnemies.splice(index, 1);\n\t\t\t\tif (\"Boss\" in enemy.traits) {\n\t\t\t\t\tgameInfo.currentLevelLives = 0;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tgameInfo.currentLevelLives -= 1;\n\t\t\t\t}\n\t\t\t\tgame.wait(2000, () => {\n\t\t\t\t\tif (enemy) {\n\t\t\t\t\t\tgame.remove(enemy.healthbarGroup);\n\t\t\t\t\t\tgame.remove(enemy);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t// For each tower on the map\n\tfor (let tower of gameInfo.currentLevelTowers) {\n\t\t\n\t\tlet towerInfo = gameInfo.towers[tower.name];\n\t\t// Decrement the tower's shooting cooldown\n\t\ttower.cooldown -= 1;\n\t\t// If the cooldown has reached 0, begin the shooting process\n\t\tif (tower.cooldown == 0) {\n\t\t\t// Helper function acquires closest valid target and stores it on the tower object\n\t\t\ttowerTarget(tower, towerInfo, false);\n\t\t\t// If no target was found\n\t\t\tif (!tower.closestEnemy) {\n\t\t\t // Then the tower can try again next tick\n\t\t\t tower.cooldown = 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t // With a target acquired, begin the shooting animation\n\t\t\t tower.playAnimation(tower.states.shoot);\n\t\t\t // By default, sprites are animated at 12 frames per second\n\t\t\t game.wait((1000 * (towerInfo.shotWindup / 12)), () => {\n\t\t\t if (gameInfo.currentLevelRunning) {\n\t\t\t\t\t // Reperform targetting and make the shot \n\t\t\t tower.closestEnemy = null;\n\t\t\t // Towers with the sureshot trait get extra range while taking this shot\n\t\t\t\t\t if(\"Sureshot\" in towerInfo.traits) {\n\t\t\t\t\t \ttowerTarget(tower, towerInfo, true);\n\t\t\t\t\t }\n\t\t\t\t\t else {\n\t\t\t\t\t \ttowerTarget(tower, towerInfo, false);\n\t\t\t\t\t }\n\t\t\t // If a valid target was acquired, make the shot\n\t\t\t if (tower.closestEnemy) {\n\t\t\t towerShoot(tower, towerInfo);\n\t\t\t }\n\t\t\t // If no target could be found, the shot windup is wasted and the tower can try again after the wind-down\n\t\t\t else {\n\t\t\t game.wait((1000 * (towerInfo.shotWinddown / 12)), () => {\n\t\t\t if (gameInfo.currentLevelRunning) {\n\t\t\t tower.playAnimation(tower.states.idle);\n\t\t\t\t\t tower.cooldown = 1;\n\t\t\t }\n\t\t\t\t });\n\t\t\t }\n\t\t\t }\n\t\t\t });\n\t\t\t}\n\t\t}\n\t}\n\n\t// For each projectile on the map\n\tfor (const [index, projectile] of gameInfo.currentLevelProjectiles.entries()) {\n\t\t// If the projectile has hit a target, it is removed after a very brief delay\n\t\tif (projectile.finished == 1 || projectile.disrupted) {\n\t\t\tif(\"Explosive\" in projectile.traits && !projectile.disrupted){\n\t\t\t\t// Fire and physical explosions are red; magical explosions are blue\n\t\t\t\tlet explosionColor = \"red\";\n\t\t\t\tif (projectile.type == \"Magic\") {\n\t\t\t\t\texplosionColor = \"blue\";\n\t\t\t\t}\n\t\t\t\tlet explosion = game.circle((projectile.traits.Explosive * 2), explosionColor);\n\t\t\t\texplosion.anchor.x = 0.5;\n\t\t\t\texplosion.anchor.y = 0.5;\n\t\t\t\texplosion.setPosition(projectile.x, projectile.y - 10);\n\t\t\t\texplosion.alpha = 0.5;\n\t\t\t\t// For all enemies hit by the explosion\n\t\t\t\tfor (let enemy of gameInfo.currentLevelEnemies) {\n\t\t\t\t\tif(game.hitTestCircleRectangle(explosion, enemy) && !enemy.invincible) {\n\t\t\t\t\t\tenemyDamage(enemy, projectile, false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tgame.wait(400, () => {\n\t\t\t\t\tif (explosion) {\n\t\t\t\t\t\tgame.remove(explosion);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tgameInfo.currentLevelProjectiles.splice(index, 1);\n\t\t\tgame.wait(20, () => {\n\t\t\t\tif (projectile) {\n\t\t\t\t\tgame.remove(projectile);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t// Move the projectile\n\t\tgame.move(projectile);\n\t\t// If the projectile has left the visible area, destroy it after one second\n\t\tlet collision = game.outsideBounds(projectile, game.stage);\n\t\tif(collision){\n\t\t\tgameInfo.currentLevelProjectiles.splice(index, 1);\n\t\t\tgame.wait(1000, () => {\n\t\t\t\tif (projectile) {\n\t\t\t\t\tgame.remove(projectile);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t// After five seconds and every 60 seconds thereafter as long as there are waves left in the level\n\tif(((gameInfo.currentLevelTime - 300) % 900 == 0) && (gameInfo.currentLevelWave < gameInfo.currentLevel.waves.length)) { //replace 900 with 3600 after the midpoint demo\n\t\t// currentLevelWave is incremented so each wave will start a minute apart from the previous\n\t\tgameInfo.currentLevelWave += 1;\n\t\tgameInfo.currentLevelWaveDone = false;\n\t}\n\n\t// If it is a second mark and the first wave has begun, but the last wave has not begun\n\tif (gameInfo.currentLevelTime % 60 == 0 && gameInfo.currentLevelWave >= 0 && gameInfo.currentLevelWave < gameInfo.currentLevel.waves.length) {\n\t\t// If the current wave still has enemies left to spawn\n\t\tif (gameInfo.currentLevelWaveDone == false) {\n\t\t\t// Then spawn the next trio of enemies in the current wave\n\t\t\tlet enemyOuter = spawnEnemy(gameInfo.currentLevel.waves[gameInfo.currentLevelWave][gameInfo.currentLevelWaveSegment][2]);\n\t\t\tlet enemyMiddle = spawnEnemy(gameInfo.currentLevel.waves[gameInfo.currentLevelWave][gameInfo.currentLevelWaveSegment][1]);\n\t\t\tlet enemyInner = spawnEnemy(gameInfo.currentLevel.waves[gameInfo.currentLevelWave][gameInfo.currentLevelWaveSegment][0]);\n\t\t\tenemyOuter.pathing = \"outer\";\n\t\t\tenemyMiddle.pathing = \"middle\";\n\t\t\tenemyInner.pathing = \"inner\";\n\t\t\t// If the first turn goes from leftwards to upwards, then outer and inner enemies have their pathing designation switched\n\t\t\tif (gameInfo.currentLevel.turns[0][1] == -1) {\n\t\t\t\tenemyOuter.pathing = \"inner\";\n\t\t\t\tenemyInner.pathing = \"outer\";\n\t\t\t}\n\t\t\tenemyOuter.setPosition(gameInfo.currentLevel.startPosition[0], gameInfo.currentLevel.startPosition[1] -70);\n\t\t\tenemyMiddle.setPosition(gameInfo.currentLevel.startPosition[0], gameInfo.currentLevel.startPosition[1] -35);\n\t\t\tenemyInner.setPosition(gameInfo.currentLevel.startPosition[0], gameInfo.currentLevel.startPosition[1]);\n\t\t\t// Set each enemy in the trio moving in the right direction\n\t\t\tlet enemyTrio = [enemyInner, enemyMiddle, enemyOuter];\n\t\t\tfor (let enemy of enemyTrio) {\n\t\t\t\tenemy[gameInfo.currentLevel.startTravelAxis] = (enemy.speed * gameInfo.currentLevel.startTravelDirection);\n\t\t\t\tenemy.pathTurns = gameInfo.currentLevel.turns;\n\t\t\t\tenemy.turnsTaken = 0;\n\t\t\t\tenemy.playAnimation(enemy.states.walkLeft);\n\t\t\t\tenemy.anchor.x = 0.5;\n\t\t\t\tenemy.anchor.y = 1;\n\t\t\t\t// Antiprojectile enemies are always moved to the front of the currentLevelEnemies list for their projectile-gobbling properties\n\t\t\t\tif (\"antiProjectile\" in enemy.traits) {\n\t\t\t\t\tgameInfo.currentLevelEnemies.unshift(enemy);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tgameInfo.currentLevelEnemies.push(enemy);\n\t\t\t\t}\n\t\t\t\t// Enemies with the startStealth trait remain invincible after spawning for a short time\n\t\t\t\tif (\"startStealth\" in enemy.traits) {\n\t\t\t\t\tenemy.invincible = true;\n\t\t\t\t\tenemy.alpha = 0.5;\n\t\t\t\t\tgame.wait((game.randomInt(6000, (1000 * enemy.traits.startStealth))), () => {\n\t\t\t\t\t\tenemy.invincible = false;\n\t\t\t\t\t\tenemy.alpha = 1;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If there are still wave segments left in this wave\n\t\t\tif (!(gameInfo.currentLevelWaveSegment == gameInfo.currentLevel.waves[gameInfo.currentLevelWave].length - 1)) {\n\t\t\t\t// Then move on to the next wave segment\n\t\t\t\tgameInfo.currentLevelWaveSegment += 1;\n\t\t\t}\n\t\t\t// Else if all enemies in the wave have been spawned\n\t\t\telse {\n\t\t\t\t// Then wave enemy spawning stops until the next wave begins\n\t\t\t\tgameInfo.currentLevelWaveSegment = 0;\n\t\t\t\tgameInfo.currentLevelWaveDone = true;\n\t\t\t\t// If that was the last wave\n\t\t\t\tif (gameInfo.currentLevelWave == gameInfo.currentLevel.waves.length - 1) {\n\t\t\t\t\t// Then the level is marked as having had every enemy spawn\n\t\t\t\t\tgameInfo.currentLevelAllSpawned = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function runPlay() {\n var toString = Object.prototype.toString,\n slice = Array.prototype.slice;\n function Probability() {\n var i = 0,\n l = 0,\n probas = [],\n functions = [],\n sum = 0,\n args = toString.call(arguments[0]) === '[object Array]' ? arguments[0] : slice.call(arguments);\n args.push({\n p: 0,\n f: function () { }\n });\n for (i = 0, l = args.length; i < l; i++) {\n var p = Math.abs(parseFloat(args[i].p)),\n f = args[i].f;\n if (isNaN(p) || typeof f !== 'function') {\n throw new TypeError('Probability.js: Invalid probability object in argument ' + i + '.');\n }\n if (/%/.test(args[i].p)) {\n p = p / 100.0;\n }\n sum += p;\n if (sum > 1.0) {\n throw new TypeError('Probability.js: Probability exceeds \"1.0\" (=100%) in argument ' + i + ': p=\"' + p + '\" (=' + p * 100 + '%), sum=\"' + sum + '\" (=' + sum * 100 + '%).');\n }\n probas[i] = sum;\n functions[i] = f;\n }\n return function probabilitilized() {\n var random = Math.random();\n for (i = 0, l = probas.length - 1; i < l && random >= probas[i]; i++) {\n /* intentionally left empty */\n }\n return functions[i].apply(this, arguments);\n };\n }\n function getRandomInt(min, max) {\n return Math.floor( Math.random() * (max - min) + min);\n }\n\n function bigRunPlay() {\n let yards = getRandomInt(80, 20)\n let roundedYards = Math.round(yards * 10) / 10;\n console.log(`Holy cow! The vikings strike for a ${roundedYards} yard play!`)\n $(\"#in-game-message\").text(\"LOOK AT THAT RUN!!!\");\n $(\"#in-game-yardage\").text(\"+\"+roundedYards+\" YARDS\");\n netYards += roundedYards;\n possessionYards +=roundedYards;\n gameYards += roundedYards;\n console.log(\"Pos Yards = \"+ possessionYards);\n runYardage += roundedYards\n console.log(runYardage)\n return runYardage\n }\n\n function bigDefPlay() {\n let yards = getRandomInt(8, 1)\n let roundedYards = Math.round(yards * 10) / 10;\n console.log(`Holy smokes! The defense just stuffed the vikings for a loss of ${roundedYards} yards!`)\n $(\"#in-game-message\").text(\"What. A. Defense...\");\n $(\"#in-game-yardage\").text(\"-\"+roundedYards+\" YARDS\");\n netYards -+ roundedYards;\n possessionYards -=roundedYards;\n gameYards -= roundedYards;\n console.log(\"Pos Yards = \"+ possessionYards);\n runYardage -= roundedYards\n console.log(runYardage)\n return runYardage\n }\n\n\n function normalRun() {\n let yards = getRandomInt(offRun, opponentDefRun)\n let roundedYards = Math.round(yards * 10) / 10;\n console.log(`The Vikings pound the ball for a gain of ${roundedYards} yards!`)\n $(\"#in-game-message\").text(\"\");\n $(\"#in-game-yardage\").text(\"+\"+roundedYards+\" YARDS\");\n netYards += roundedYards;\n possessionYards +=roundedYards;\n gameYards += roundedYards;\n console.log(\"Pos Yards = \"+ possessionYards);\n runYardage += roundedYards\n console.log(runYardage)\n return runYardage\n \n }\n\n function noGain() {\n console.log(\"The defense comes up big and stuffs the runner for no gain\")\n $(\"#in-game-message\").text(\"No Gain!\");\n $(\"#in-game-yardage\").text(\"\");\n }\n\n var probabilitilized = new Probability({ p: \"8%\", f: bigRunPlay }, { p: \"8%\", f: bigDefPlay }, { p: \"60%\", f: normalRun }, { p: \"14%\", f: noGain })\n\n for (let i = 0; i < 1; i++) {\n probabilitilized();\n\n }\n }", "function C005_GymClass_Intro_Run() {\n\t\n\t// Paints the background\n\tDrawImage(CurrentChapter + \"/\" + CurrentScreen + \"/Background.jpg\", 0, 0);\n\tDrawPlayerTransition();\n\n\t// Write the chapter introduction\n\tDrawText(GetText(\"Intro1\"), 450, 100, \"White\");\n\tif (TextPhase >= 1) DrawText(GetText(\"Intro2\"), 450, 200, \"White\");\n\tif (TextPhase >= 2) DrawText(GetText(\"Intro3\"), 450, 300, \"White\");\n\tif (TextPhase >= 3) DrawText(GetText(\"Intro4\"), 450, 400, \"White\");\n\tif (TextPhase >= 4) DrawText(GetText(\"Intro5\"), 450, 500, \"White\");\n\n}", "function main() {\n\n // Get our time delta information which is required if the game requires smooth animation.\n var now = Date.now(),\n dt = (now - lastTime) / 1000;\n\n //Call our update/render functions, pass along the time delta to\n //our update function.\n update(dt);\n render();\n\n //Set our lastTime variable which is used to determine the time delta\n //for the next time this function is called.\n lastTime = now;\n\n //Use the browser's requestAnimationFrame function to call this\n //function again as soon as the browser is able to draw another frame.\n if (player.youWin === true) {\n win.cancelAnimationFrame(gameOver);\n modal.classList.toggle('visible');\n } else {\n gameOver = win.requestAnimationFrame(main);\n }\n }", "function gamePlay() {\n collisionDetection();\n moveVerticalPlatform();\n movePlayer();\n updateScreen();\n moveBullets();\n moveMonsterBullets();\n moveMonsters();\n}", "function startGame() {\n\tsetup();\n\tmainLoop();\n}", "function StartGame1() {\r\nShowZeroScores();\r\nStartP1();\r\n}", "function startGame()\n{\n //Call to the Instruction Screen UI function that generates the UI for the Instruction Screen\n createInstructionScreenUI();\n\n //Cal to create Instruction function that loads the level data from the gameLevels and append the required texts onto the UI elements\n createLevelInstruction();\n}", "function start_game_flow () {\n\n\tvar that = this;\n\n\tanimate(that._scoreboard).wait(1000)\n\t\t.then(function () {\n\t\t\tthat._scoreboard.setText(text.READY);\n\t\t}).wait(500).then(function () {\n\t\t\tthat._scoreboard.setText(text.SET);\n\t\t}).wait(500).then(function () {\n\t\t\tthat._scoreboard.setText(text.GO);\n\t\t}).wait(100).then(function () {\n\t\t\t//start game ...\n\t\t\tgame_on = true;\n\t\t\tconsole.log(\"play game...\\n\");\n\t\t\tplay_game.call(that);\n\t\t});\n}", "function startGame() {\n\tupdateGameState()\n\tmoveTetroDown()\n}", "function gsPLAY(){\r\n gameState = PLAY\r\n ServeScreen.visible= false\r\n StartButton.hide();\r\n InfoButton.hide();\r\n InfoIcon.visible = false;\r\n touches = []\r\n Joey.x = StartGround.x\r\n Joey.changeAnimation(\"Jumping\",Jumping_Joey);\r\n SaveName.hide();\r\n displayName.hide();\r\n NameBar.hide();\r\n title.hide();\r\n \r\n }", "function mainLogic(){\n\tif(switchOn === true){\t\n\tgameLevel++;\n\t\tconsole.log(\"Game level: \" + gameLevel);\n\t\t$(\"#screen\").text(\"Game level: \" + gameLevel);\n\t\trandomizeNumber();\n\t\tvar i = 0;\n\t\tvar gameInterval = setInterval(function(){\n\t\tkey = gameArray[i];\n\t\t//associates color with part id\n\t\tcolor = $(\"#\" + key).attr('class').split(\" \")[1];\n\t\taddSound(key, color);\n\t\ti++;\n\t\tif(i === gameArray.length){\n\t\t\tclearInterval(gameInterval)\n\t\t}\n\t}, 1000);\n\t}\n}", "run() {\n logger.info('Starting game...');\n this.running = true;\n this.update();\n }", "function startGame() {\n\t\n\t// fill the question div with new random question\n\tgenerateQuestion();\n\t\n\t// start the timer\n\tmoveProgressBar();\n}", "function startGame() {\n $controls.addClass(\"hide\");\n $questionWrapper.removeClass(\"hide\");\n showQuestion(0, \"n\");\n points();\n}", "function draw() {\n if (state === \"menu\") {\n showMenu();\n }\n if (state === \"dancing\"){\n dancingBlock();\n }\n if (state === \"howToPlay\") {\n Instructions();\n } \n}", "function main() {\n rock_div.addEventListener('click', function () {\n game(\"r\");\n })\n paper_div.addEventListener('click', function () {\n game(\"p\");\n })\n scissors_div.addEventListener('click', function () {\n game(\"s\");\n })\n }", "function C001_BeforeClass_Intro_Run() {\n\t\n\t// Draw the background and player\n\tif (TextPhase <= 2) DrawImage(CurrentChapter + \"/\" + CurrentScreen + \"/Background1.jpg\", 0, 0);\n\telse DrawImage(CurrentChapter + \"/\" + CurrentScreen + \"/Background2.jpg\", 0, 0);\n\tDrawPlayerTransition();\n\t\n\t// Introduce chapter 1 with each clicks\n\tDrawText(GetText(\"Intro1\"), 450, 50, \"White\");\n\tif (TextPhase >= 1) DrawText(GetText(\"Intro2\"), 450, 150, \"White\");\n\tif (TextPhase >= 2) DrawText(GetText(\"Intro3\"), 450, 250, \"White\");\n\tif (TextPhase >= 3) DrawText(GetText(\"Intro4\"), 450, 350, \"White\");\n\tif (TextPhase >= 4) DrawText(GetText(\"Intro5\"), 450, 450, \"White\");\n\tif (TextPhase >= 5) DrawText(GetText(\"Intro6\"), 450, 550, \"White\");\n\n}", "function HostGame() {\n\t// Your code goes here for hosting a game\n\tprint(\"Complete this method in Multiplayer.js\");\n}", "function runGame() {\n\n // clear all game values\n score = 0;\n wordInput.value = \"\";\n wordDisplayString.innerText = \"\";\n bar.style.width = 100 + \"%\";\n bar.innerHTML = \"Get Ready\";\n width = 100;\n wpmScoreBox.innerHTML = \"0 wpm\";\n wordInput.focus();\n\n // start startGame function after 4s\n playTimerSound();\n setTimeout(startGame, 4000) ;\n\n }", "function main() {\n showScore();\n nextQuestion();\n getFeedback();\n startQuiz();\n render();\n}", "function Play() {}", "startGame () {\n game.state.start('ticTac')\n }", "function run() {\n Game.Load.images(IMAGES, function(images) {\n Game.Load.json(\"levels/demo\", function(level) {\n setup(images, level);\n Game.run({\n fps: FPS,\n update: update,\n render: render\n });\n Dom.on(document, 'keydown', function(ev) { return onkey(ev, ev.keyCode, true); }, false);\n Dom.on(document, 'keyup', function(ev) { return onkey(ev, ev.keyCode, false); }, false);\n });\n });\n }", "function startGame()\n{\n\tcreateDeck();\n\tshuffleDeck();\n\tcreatePlayers(2);\n\n\tdrawCard(0, 0);\n\tdrawCard(1, 0);\n\tdrawCard(0, 0);\n\tdrawCard(1, 0);\n\n\n\n\tdisplayCards();\n\tdisplayOptions();\n}", "function playGame(){\r\n //set game to runnning and not paused\r\n gameRunning = true;\r\n gamePaused = false;\r\n hideMenuTable();\r\n setupNewGame();\r\n showGameTables();\r\n //call execution\r\n execution(gameRunning);\r\n}", "function startGame() {\n \n crystalNumber = 0;\n // Generate random crystal values.\n crystals = randomNumCrystals();\n // Generate a random target number and render it to the page.\n targetNumber = randomNumGen();\n $(\"#targetNum-area\").text(targetNumber);\n }", "function main() {\n startSlideShowAnimation();\n renderProject();\n}", "display() {\n // game title\n this.canvas[1].font = \"30px Arial\";\n this.canvas[1].fillText('Classic Arcade Game',10,40);\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText('- build with ECMAScript 6',10,65);\n this.canvas[1].fillText('- Game Engine by Raghavendra Mani',220,this.canvas[0].height-10);\n // game status\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText('Active Monsters: '+this.activeEnemies.length,this.canvas[0].width*0.6,25);\n this.canvas[1].fillText('Game status: '+this.status(),this.canvas[0].width*0.6,50);\n this.canvas[1].fillText('Moves: '+this.score,this.canvas[0].width*0.6,75);\n this.canvas[1].fillText('Tries: '+this.tries,this.canvas[0].width*0.8,75);\n // game instructions\n this.instructions();\n // warning messages\n this.warning();\n }", "function draw() {\n background(45,194,112);\n //Calling states\n if (state === `title`) {\n title();\n }\n else if (state === `simulation`) {\n simulation();\n }\n else if (state === `win`) {\n win();\n }\n else if (state === `lose`) {\n lose();\n }\n}", "function playScreen() {\n\n stageCleared();\n\n audioQStateMachine();\n\n movementControlAndLock();\n //MAIN PURPOSE OF THIS IS TO CONTROL SHADOW OVERLAY OVER HOUSE//\n if (floorplan.outside) {\n\n walkInsideSFX.stop();\n\n image(grassOverlay, offsetX, offsetY);\n\n outsideHedges();\n\n floorplan.update(offsetX, offsetY);\n\n player.update(offsetX, offsetY);\n\n push();\n fill(0, 210);\n rect(0, 0, width, height);\n pop();\n\n image(floorplan1Blackout, floorplan.x + offsetX, floorplan.y + offsetY, floorplan.w, floorplan.h);\n\n rainRun();\n\n lightningGenerator();\n\n } else if (floorplan.upstairs) {\n\n rainRun();\n\n lightningGenerator();\n\n floorplan.update(offsetX, offsetY);\n\n for (let j = 0; j < VICTIMCOUNTUPSTAIRS; j++) {\n victims[j + VICTIMCOUNTDOWNSTAIRS].update(offsetX, offsetY);\n }\n\n stairs();\n\n player.update(offsetX, offsetY);\n\n } else {\n\n rainRun();\n\n lightningGenerator();\n\n floorplan.update(offsetX, offsetY);\n\n for (let i = 0; i < VICTIMCOUNTDOWNSTAIRS; i++) {\n victims[i].update(offsetX, offsetY);\n }\n\n stairs();\n\n player.update(offsetX, offsetY);\n }\n\n}", "function LoadGame() {\n\t// Your code goes here for loading a game\n\tprint(\"Complete this method in Singleplayer.js\");\n}", "function gameEngine() {\n // Updating the snake array and food\n isCollided(snakeArray);\n // Display the snake\n snakeDisplay();\n // Display the food\n foodDisplay();\n // Eating food\n foodEaten();\n // Updating the score\n setHighScore();\n // displaying the score\n displayScores();\n // moving the snake\n moveSnake();\n}", "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n milliseconds = 1000.0,\n dt = (now - lastTime) / milliseconds;\n\n if (game.currentScene !== previousScene) {\n currentUI.close();\n\n switch (game.currentScene) {\n case game.scenes.gameLost:\n currentUI = new GameLostUI(canvas, ctx, game);\n break;\n\n case game.scenes.gameWon:\n currentUI = new GameWonUI(canvas, ctx, game);\n break;\n\n case game.scenes.game:\n currentUI = new GameUI(canvas, ctx, game);\n break;\n\n case game.scenes.credits:\n currentUI = new CreditsUI(canvas, ctx, game);\n break;\n\n case game.scenes.selectPlayer:\n currentUI = new SelectPlayerUI(canvas, ctx, game);\n break;\n\n case game.scenes.intro:\n currentUI = new IntroUI(canvas, ctx, game);\n break;\n\n default:\n case game.scenes.preload:\n currentUI = new PreloadUI(canvas, ctx, game);\n break;\n }\n }\n\n /* In the next loop we need to know the previous scene in order to detect\n * when the player changed scene, ans we can change the scene object.\n */\n previousScene = game.currentScene;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n currentUI.init(dt);\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "function startGame() {\n console.log('start button clicked')\n $('.instructions').hide();\n $('.title').show();\n $('.grid_container').show();\n $('.score_container').show();\n $('#timer').show();\n // soundIntro('sound/Loading_Loop.wav');\n }", "function main() {\n\n //Get our time delta information which is required if your game requires smooth animation.\n\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /*\n Call our update/render functions, pass along the time delta to our update function\n since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /*\n Set our lastTime variable which is used to determine the time delta\n for the next time this function is called.\n */\n lastTime = now;\n\n /*\n Use the browser's requestAnimationFrame function to call this\n function again as soon as the browser is able to draw another frame.\n If game's stop value is set to true, the game will end.\n */\n if(!game.stop){\n win.requestAnimationFrame(main);\n }\n }", "function startPlayComp() {\n startModule.game.playComp(startModule.game, startModule.deck, startModule.person1, startModule.person2, startModule.table, 'tableHtml', 'person1', 'person2', socket);\n }", "function startGame() {\n // initialize game variables\n progress = 0;\n gamePlaying = true;\n // swap the Start and Stop buttons\n document.getElementById(\"startBtn\").classList.add(\"hidden\");\n document.getElementById(\"stopBtn\").classList.remove(\"hidden\");\n // generate a pattern to play\n genPattern();\n console.log(\"secret sequence is \" + pattern);\n // play the pattern\n playClueSequence();\n}", "function game()\n{\n\tupdate();\n\trender();\n}", "function main() {\n constructDisplay()\n gameBoard = new Board()\n timer()\n autoMove()\n update()\n}", "function simulation() {\n //Display tiling\n push();\n translate(60,120);\n tilingBlue();\n tilingWhite();\n pop();\n //Display design elements\n displayTimer();\n displayScore();\n displayTitle();\n //Display Antonio the ant.\n ant.wrap();\n ant.display();\n //Display loop of foods\n for (let i = 0; i < foods.length; i++) {\n let food = foods[i];\n food.move();\n food.wrap();\n food.display();\n ant.checkEat(food);\n }\n //Change to win state\n if (score >= 500){\n state = `win`;\n }\n //Change to LOSE state\n if (timer === 0 || score < -100){\n state = `lose`;\n }\n}", "function main() {\n if (has_game_ended()) return;\n\n changing_direction = false;\n setTimeout(function onTick() {\n clear_board();\n gridBoard();\n numPathBoard();\n drawFood();\n move_snake();\n drawSnake();\n // Call main again\n main();\n }, delay)\n }", "function main() {\r\n\t\trock_div.addEventListener('click', () => game(\"p\"));\r\n\t\tpaper_div.addEventListener('click', () => game(\"f\"));\r\n\t\tscissors_div.addEventListener('click', () => game(\"c\"));\t\t\r\n\t}", "function Main()\n{\n StartGame();\n GA();\n\n console.log(\"END AI\");\n}", "function run () {\n var $canvasBox;\n \n $('#newGameLink').removeAttr('disabled'); // can click new game link\n\n if (m.debug > m.NODEBUG) { console.log('screens.gameScreen.run'); }\n \n if (needsInit) {\n \n // disable mouse events on canvas and halt the game loop when we return to the menu\n $('#gameMenuLink')\n .click( function (event) {\n m.playtouch.unhookMouseEvents();\n m.Model.stopGameNow();\n m.Audio.beQuiet();\n m.screens.showScreen('menuScreen');\n });\n \n // shuffle and deal if we ask nicely\n $('#newGameLink')\n .click( function (event) {\n // disallow double-clicks, also disabled in the model while dealing\n if ( $(this).attr('disabled') === 'disabled' ) { return false; } \n $(this).attr('disabled', 'disabled'); \n // if you start a new game before winning, give 'em the not impressed face\n if (m.Settings.getPlaySounds() && !hasWon) {\n m.Sounds.playSoundFor(m.Sounds.QUIT);\n }\n \n // now we play\n setTimeout( function() {\n m.Model.stopGameNow();\n m.screens.showScreen('gameScreen');\n }, m.Settings.Delays.Quit);\n return false;\n });\n \n }\n needsInit = false;\n \n // start the game animation loop\n m.gameloop.setLoopFunction(m.view.refreshDisplay);\n \n // start a new game\n m.view.newGame($('#gameViewBox'));\n \n // hook up event handling\n m.playtouch.hookMouseEvents(); \n\n // resize the game pane if needed after a short delay\n $(window)\n .resize(function (event) {\n setTimeout( function () {\n mikeycell.view.setMetrics();\n }, 500);\n });\n\n }", "function gameLoop() {\n\t\t\tMAET_GDK.getInputs();\n\t\t\tthisGSM.runGameState();\n\t\t\t\n\t\t\treturn;\n\t\t}", "function gameplaying(){\n displayreset();\n displayTree();\n displayApple();\n fill(0);\n textSize(35);\n text(\"SCORE = \" + score, 120, 40);\n movingBasket();\n appleHitsBasket();\n dead();\n }", "runGame(){\n\t\t\tthis.scene.runGame();\n\t\t}", "startGame() {\r\n // Hide start screen overlay\r\n document.getElementById('overlay').style.display = 'none';\r\n\r\n // get a random phrase and set activePhrase property\r\n this.activePhrase = this.getRandomPhrase();\r\n this.activePhrase.addPhrasetoDisplay();\r\n }", "function gameLoop(){\n\tif(marioGame.enStatus == enStep.nInit) // before user start the game\n\t{\n\t\tif(marioGame.nTurn == 0 && marioGame.nFrame == 0)\n\t\t{\n\t\t\tinitGame();\n\t\t}\n\t}\n\telse if(marioGame.enStatus == enStep.nStarting) // User selected to play but wait until previous action is done\n\t{\n\t\t// Wait until previous motion is done\n\t\tif(marioGame.nFrame == 0) // if previous motion is done\n\t\t{\n\t\t\t// disable click event of some clickable objects, characters/items\n\t\t\tdisableElements();\n\t\t\t// goes to next step\n\t\t\tmarioGame.enStatus = enStep.nLuigiInit;\n\t\t\tmarioGame.nTurn = 0;\n\t\t\treturn;\n\t\t}\n\t}\n\telse if(marioGame.enStatus == enStep.nLuigiInit) // Level initializing, System transforms Luigi to Mario\n\t{\n\t\ttransformLuigi();\n\t\treturn;\n\t}\n\telse if(marioGame.enStatus == enStep.nCharacterInit) // Level initializing, System creates new Mario objects\n\t{\n\t\t// create and initialize characters\n\t\tinitCharacters();\n\t\t// Goes to next step\n\t\tmarioGame.enStatus = enStep.nPlaying;\n\t\t\n\t\t// init stage attributes\n\t\tmarioGame.nTurn = 0;\n\t\tmarioGame.nWrong = 0;\n\t\t\n\t\t// plays theme song\n\t\tmarioGame.audMainTheme.play();\n\t\treturn;\n\t}\n\telse if (marioGame.enStatus == enStep.nPlaying) // game playing\n\t{\n\t\t// do nothing\n\t\t// only draw updated images after this if-else statement\n\t\t;\n\t}\n\telse if (marioGame.enStatus == enStep.nSelect) // A level is done, waiting user input\n\t{\n\t\tif(marioGame.nFrame == 0){ // Runs only at first time\n\t\t\t// enable mouse event of characters and item elements\n\t\t\tenableElements();\n\t\t\t\n\t\t\t// Display \"select where is Luigi\" text for a while\n\t\t\t$(\"#select\").addClass(\"appear\").removeClass(\"disappear\");\n\t\t\tsetTimeout(disappearDiv, 2500);\n\t\t\t\n\t\t\t// stop main theme song and play user input mode song\n\t\t\tmarioGame.audMainTheme.pause();\n\t\t\tif ( marioGame.audMainTheme.currentTime > 0 )\n\t\t\t\tmarioGame.audMainTheme.currentTime = 0;\n\t\t\tmarioGame.audSelect.play();\n\t\t\t\n\t\t\tmarioGame.nFrame++;\t\n\t\t}\n\t\treturn;\n\t}\n\telse if (marioGame.enStatus == enStep.nOver) // Game Over, When user select wrong answer twice\n\t{\n\t\t// Display game over pop-up div for a while and initialize game properties\n\t\tif(marioGame.nFrame == 0)\n\t\t{\n\t\t\tgameOver();\n\t\t\tmarioGame.nFrame++;\n\t\t}\n\t\t\n\t\treturn;\n\t}\n\telse if (marioGame.enStatus == enStep.nEndLevel) // User selected right answer, Initialize Luigi character and goes back to level start step\n\t{\n\t\tdisableElements();\n\t\tif(marioGame.nTurn == 0 && marioGame.nFrame == 0) // runs only at first time, Initialize Luigi character\n\t\t{\n\t\t\tinitLuigi();\n\t\t}\n\t\telse if (marioGame.nTurn == 6) // Goes back to level start step after Luigi roam around 6 times\n\t\t{\n\t\t\tmarioGame.enStatus = enStep.nStarting;\n\t\t}\t\t\n\t}\n\n\t\n\t// Update character object images\n\tupdate();\n\t// One turn is done. Re-allocate character objects to new positions\n\tif(marioGame.nFrame ==0)\n\t{\t\n\t\tnextTurn();\n\t}\n}", "function main() {\n let game = new Game()\n game.initExample1()\n GAME = game;\n\n // __________________________________________________________________\n // Game Loop\n // ==================================================================\n function loop() {\n game.clearScreen();\n game.step();\n game.drawScreen();\n game.updateDebugger();\n window.requestAnimationFrame(loop);\n }\n\n window.requestAnimationFrame(loop);\n}", "function clickHandler() // play game.\n{\n playGame();\n}", "function startGame() {\n\t// Display Gameplay Info Panels //\n $(\".shipPanel\").fadeIn(\"fast\", function() {\n });\n \t$(\".topPanel\").fadeOut(\"fast\", function() {\n \t\t$(\".console\").css( { \"margin-top\" : \"5%\" } );\n\t });\n\t // Naval Command Communicates //\n\t $(\".text\").text(coms.start);\n \t// Display Player 1 Board //\n \thighlightBoard2();\n }", "function play(){\n removeCheckers();\n resetScores();\n init(); \n}", "go() {\n if (game.pause===true) {\n game.message = '';\n game.pause=false;\n game.generateEntities(false,true);\n game.autoMove();\n console.log('Game Status: ', game.status());\n }\n }", "function startGame() {\n water = 0;\n corn = 2;\n beans = 2;\n squash = 2;\n month = 1;\n gameOver = false;\n \n initGameBoard();\n playGame();\n}", "function playGame() {\n gameChoice();\n playerChoice();\n calculateResult();\n roundResult();\n incrementRoundScore();\n gameResult();\n incrementGameScore();\n winnerResult();\n}", "function runProgram(){\n ////////////////////////////////////////////////////////////////////////////////\n //////////////////////////// SETUP /////////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////\n\n // Constant Variables\n var FRAME_RATE = 60;\n var FRAMES_PER_SECOND_INTERVAL = 1000 / FRAME_RATE;\n \n // Game Item Objects\n function GameItem(selector) {\n var obj = {};\n obj.$element = $(selector);\n obj.width = obj.$element.width();\n obj.height = obj.$element.height();\n obj.x = 0;\n obj.y = 0;\n obj.velocityX = 0;\n obj.velocityY = 0;\n return obj;\n }\n var $board = $('#board');\n var $score = $(\"#score\");\n \n\n // one-time setup\n var interval = setInterval(newFrame, FRAMES_PER_SECOND_INTERVAL); // execute newFrame every 0.0166 seconds (60 Frames per second)\n $(document).on('eventType', handleEvent); // change 'eventType' to the type of event you want to handle\n\n ////////////////////////////////////////////////////////////////////////////////\n ///////////////////////// CORE LOGIC ///////////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////\n\n /* \n On each \"tick\" of the timer, a new frame is dynamically drawn using JavaScript\n by calling this function and executing the code inside.\n */\n function newFrame() {\n \n\n }\n \n /* \n Called in response to events.\n */\n function handleEvent(event) {\n\n }\n\n ////////////////////////////////////////////////////////////////////////////////\n ////////////////////////// HELPER FUNCTIONS ////////////////////////////////////\n ////////////////////////////////////////////////////////////////////////////////\n\n \n function endGame() {\n // stop the interval timer\n clearInterval(interval);\n\n // turn off event handlers\n $(document).off();\n }\n \n}", "function gamePlay() {\n //draw the grid\n drawMap();\n\n //Update and display player and check for input\n player.display();\n player.handleInput();\n //Check for collisions with trash and handle scoring\n player.handleScoring(trash);\n //Display trash\n trash.display();\n //Check the score of the player to determine if they've won yet\n checkScores();\n\n //Call all display and movement functions for kids in the kids array\n for (let i = 0; i < kids.length; i++) {\n kids[i].update();\n kids[i].display();\n kids[i].handleDamage(player)\n }\n\n}", "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n if (Map.gameRunning) { update(dt); }\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "function gameLoop() {\n\n handleUI();\n\n switch (gameMode) {\n case kMode_Init:\n ctx.clear(0, 0, canvasWidth, canvasHeight);\n ctx.drawText('Click on \"Start Game\"', 110, 200);\n break;\n\n case kMode_Play:\n rotationAngle += rotationFactor;\n ctx.rotation(rotationAngle);\n\n advance();\n drawAll();\n break;\n\n case kMode_Finished:\n ctx.clear(0, 0, canvasWidth, canvasHeight);\n ctx.drawText('Game over!', 140, 200);\n break;\n }\n}", "function main() {\n\trock_div.addEventListener('click', () => game(\"r\"));\n\tpaper_div.addEventListener('click', () => game(\"p\"));\n\tscissors_div.addEventListener('click', () => game(\"s\"));\n}", "function startGame() {\n createButtons();\n createCards();\n}", "function startGame() {\n createButtons();\n createCards();\n}", "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / COFFICIENT;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n\n showStoneInfo();\n showRecord();\n }", "function startGame() {\n incrementGameStep({ gameId, gameData });\n }", "function playInformation(){\n displayPin();\n\n displayBubble();\n\n displayCounter();\n}", "function startGame(){\n initialiseGame();\n}", "function startGame(){\n hideContent();\n unhideContent();\n assignButtonColours();\n generateDiffuseOrder();\n clearInterval(interval);\n setlevel();\n countdown(localStorage.getItem(\"theTime\"));\n listeningForClick();\n}", "function setup() {\n //set intro text\n boxWrite(\"Click here to activate audio and voice!\")\n // when body is clicked, the game is ready to go.\n $('body').click(function() {\n if (gameState === -1) {\n gameState = 0;\n boxWrite('Great! Now say \"Start Game!\"');\n dingSFX.play();\n }\n })\n\n //set up all annyang commands\n if (annyang) {\n\n var commands = {\n\n //All commands set the textbox text, set a line for the computer to read, change the game state, and change the AI portrait.\n\n 'start game': function() {\n if (gameState === 0) {\n dingSFX.play();\n setPortrait(\"question\");\n speak(lineIntroLine);\n boxWrite(boxTextTutorial1);\n setTimeout(function() {\n gameState += 1;\n }, 200);\n }\n\n },\n\n 'my name is *tag': function(tag) {\n if (gameState === 1) {\n dingSFX.play();\n setPortrait(\"elated\");\n gameState += 1;\n speak((\"Nice to meet you, \" + tag + \"! Shall we get started with today's video titles?\"));\n boxWrite(boxTextTutorial2);\n }\n },\n\n 'yes please': function() {\n if (gameState == 2) {\n dingSFX.play();\n setPortrait(\"question\");\n speak(lineSuggestionForVid);\n suggestion();\n speak(lineQualityQuery);\n gameState += 1;\n }\n },\n\n 'could you repeat that': function() {\n if (gameState == 3) {\n dingSFX.play();\n setPortrait(\"veryHappy\");\n speak(\"Sure thing!\");\n speak(currentSuggestion);\n speak(\"So? Good or bad?\");\n }\n },\n\n 'Good': function() {\n if (gameState === 3) {\n if (acceptedTitleAmount < 3) {\n dingSFX.play();\n setPortrait(\"elated\");\n speak(lineAcceptedSuggestion);\n addCurrentTitle();\n acceptedTitleAmount += 1;\n gameState = 2;\n if (acceptedTitleAmount === 3) {\n endGame();\n } else {\n speak(querySuggest);\n }\n }\n }\n },\n\n 'Bad': function() {\n if (gameState === 3) {\n dingSFX.play();\n setPortrait(\"quiz\");\n speak(lineQueryWhatIsWrong)\n boxWrite('Be clear! Say \"It is...\"');\n gameState = 11;\n };\n },\n\n 'it is *tag': function(tag) {\n if (gameState === 11) {\n dingSFX.play();\n adjectiveInQuestion = tag;\n setPortrait(\"neutral\");\n speak(\"Well, I think children would enjoy something \" + tag + \". Do you agree?\")\n boxWrite(boxTextTutorial6);\n setTimeout(function() {\n gameState += 1;\n }, 200);\n }\n },\n\n 'no': function() {\n if (rejectedTitleAmount >= 3) {\n dingSFX.play();\n speak(lineTooManyRejected)\n generateRemainingTitles();\n endGame();\n } else if (gameState === 12 && rejectedTitleAmount < 3) {\n setPortrait(\"annoyed\");\n speak(lineFinalRejection)\n boxWrite(boxTextTutorial4);\n rejectedTitleAmount += 1;\n setTimeout(function() {\n gameState = 2;\n }, 500);\n }\n },\n\n 'yes': function() {\n if (gameState === 12) {\n dingSFX.play();\n setPortrait(\"veryHappy\");\n speak((\"I thought so too. I would love it if someone called me \" + adjectiveInQuestion + \". I will add this title to our list. Would you like to hear my next suggestion?\"))\n boxWrite(boxTextTutorial5);\n addCurrentTitle();\n acceptedTitleAmount += 1;\n setTimeout(function() {\n gameState = 2;\n }, 500);\n };\n }\n }\n //add the previous commands to annyang and initialize it \n annyang.addCommands(commands);\n annyang.start();\n };\n}", "function startGame(){\n \t\tGameJam.sound.play('start');\n \t\tGameJam.sound.play('run');\n\t\t\n\t\t// Put items in the map\n\t\titemsToObstacles(true);\n\n\t\t// Create the prisoner path\n\t\tGameJam.movePrisoner();\n\n\t\t// Reset items, we dont want the user to be able to drag and drop them\n \t\tGameJam.items = [];\n \t\t\n \t\tfor (var item in GameJam.levels[GameJam.currentLevel].items) {\n \t\t\tGameJam.levels[GameJam.currentLevel].items[item].count = GameJam.levels[GameJam.currentLevel].items[item].countStart;\n \t\t}\n\n\t\t// Reset prisoner speed\n\t\tGameJam.prisoner[0].sprite.speed = 5;\n\n\t\t// Reset game time\n\t\tGameJam.tileCounter = 0;\n\t\tGameJam.timer.className = 'show';\n\t\tdocument.getElementById('obstacles').className = 'hide';\n\t\tdocument.getElementById('slider').className = 'hide';\n\t\tdocument.getElementById('start-button-wrapper').className = 'hide';\n\n\t\t// Game has started\n\t\tGameJam.gameStarted = true;\n\n\t\tGameJam.gameEnded = false;\n\n\t\tdocument.getElementById('static-canvas').className = 'started';\n\n\t\tconsole.log('-- Game started');\n\t}", "run(){\n\t\tthis.maybeEnemy();\n\t\tthis.move();\n\t\tthis.update();\n\t\tthis.checkEdges();\n\t\tthis.checkIfDead();\n\t\tthis.display();\n\t}", "function startGame() {\n\t// Set variables\n\tpreviousNum = null;\n\tgameOn = true;\n\tguessedArray = [];\n\tletterString = \"\";\n\t// Clear displays\n\tclearWord();\n\tclearScreen();\n\tclearScore();\n\tupdateScore();\n\t// Set displays and media\n\tsetMedia();\n\tgetRandomNum();\n\tgetWord();\n\tdisplayWord();\n\n}", "startGame () {\n\t\tif ( this.model.isBoardShuffling ) return;\n\t\tif ( this.model.isModalOpen ) this.toggleModal();\n\t\tif ( this.model.isBoardBlocked ) this.toggleBoardLock( this.model.isBoardBlocked );\n\t\tthis.model.populateListOfPossibleChanges();\n\t\tthis.view.alocatePieces( this.model.finalPositionsArr, this.model.baseNumber, this.model.getPieceSize(), this.model.gutterSize );\n\t\tthis.shufflePieces();\n\t\tthis.resetConter();\n\t}", "function draw() {\n console.log(\"start draw\");\n switch (spelStatus) {\n case SPELEN:\n welkeSpelerRijKolom();\n tekenVeld();\n tekenSpeler(spelerKolom, spelerRij);\n tekenVijand(vijandKolom, vijandRij);\n\n if(spelerTurn === true) {\n aanvallen();\n bewegen(welkeSpelerKolom,welkeSpelerRij,welkeVijandKolom,welkeVijandRij);\n }\n\n if(vijandTurn === true) {\n aanvallen();\n bewegen(welkeSpelerKolom,welkeSpelerRij,welkeVijandKolom,welkeVijandRij);\n }\n\n levensVanSpeler();\n levensVanVijand();\n\n \n\n gameOver();\n break;\n\n\n case STARTSCHERM:\n background('lightblue');\n textSize(70);\n text(\"Counter-Strike: Execution Force\", 130, 150);\n \tspeelKnop();\n uitlegKnop();\n creditsKnop();\n\n\n\n\n break;\n\n case GAMEOVER:\n gameOverScherm();\n\n\n\n\n break;\n\n case UITLEG:\n uitlegScherm();\n \n\n break;\n\n case CREDITS:\n creditScherm();\n\n break;\n }\n \n}", "function renderGame(){\n\n\t// questionOnScreen;\n\t// answerOnScreen;\n\t// timerId;\n\trightAnswers = 0;\n\twrongAnswers = 0;\n\tclicked = false;\n\t\tasked = 0;\n\t$( '#display' ).hide();\n\trandomOrder();\n\ttimerDisplay();\n\trenderQuestion();\n\trenderButtons();\n\tclickAnswer();\n\tnewQuestion();\n}" ]
[ "0.71748173", "0.7144816", "0.71168536", "0.6997403", "0.69901925", "0.6947193", "0.69374776", "0.690446", "0.6831793", "0.68270123", "0.6822336", "0.6808198", "0.6791547", "0.67903215", "0.6789373", "0.678158", "0.67661035", "0.6764731", "0.6733878", "0.67266214", "0.67256933", "0.6717599", "0.6710685", "0.6710137", "0.66876894", "0.66786194", "0.6661454", "0.6652922", "0.665109", "0.664975", "0.6644598", "0.6642723", "0.6625383", "0.66235584", "0.662347", "0.66130936", "0.6609395", "0.6604358", "0.66032135", "0.65971947", "0.65963763", "0.6586661", "0.65815353", "0.65742886", "0.6573034", "0.65711886", "0.65659654", "0.656359", "0.6559536", "0.65580696", "0.6556602", "0.6555985", "0.65556043", "0.6554323", "0.6551348", "0.6551275", "0.6546002", "0.6542754", "0.65427387", "0.65392274", "0.6536878", "0.65345544", "0.65301144", "0.6528918", "0.65281177", "0.6524245", "0.652228", "0.6522186", "0.6521039", "0.6518361", "0.6517351", "0.65137213", "0.65125084", "0.6511939", "0.65116644", "0.65036017", "0.6494441", "0.6493244", "0.6488691", "0.6480753", "0.64797246", "0.6479318", "0.647729", "0.64763826", "0.64753723", "0.6475068", "0.6474475", "0.6474471", "0.6474471", "0.64712125", "0.6461669", "0.64590293", "0.64585274", "0.64543456", "0.64537805", "0.64532924", "0.6443427", "0.64406484", "0.6438757", "0.6434716", "0.642725" ]
0.0
-1
Slide 19 display the output
function userOutput() { if ((userChoice === "cat") || (computerChoice ==="cat")) { let myAudio = document.getElementById("myAudio"); let myCatAudio = ""; if (catState === 1) { myCatAudio = "Catmeow1.mp3"; } else if (catState === 0) { myCatAudio = "AngryCat.mp3"; } myAudio.src = myCatAudio; myAudio.addEventListener("canplaythrough", function(){myAudio.play()}); } let winner = document.getElementById("winner"); winner.innerHTML = gameAnswer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _display(){\n\t\t\t$(levelID).html(level);\n\t\t\t$(pointsID).html(points);\n\t\t\t$(linesID).html(lines);\n\t\t}", "function displayToScreen() {\n\n\n\t}", "presentation() {\n\t\tconsole.log('Le personnage s\\'appelle : ' + this.NAME);\n\t\tconsole.log('current ID : ' + this.ID);\n\t\tconsole.log('IMG : ' + this.IMG);\n\t\tconsole.log('DESC : ' + this.DESC);\n\t\tconsole.log(\"-----------\");\n\t}", "function display() {\n lcd.clear();\n lcd.cursor(0, 0).print(displayDate());\n lcd.cursor(1, 0).print(displayMeasure());\n }", "function showOnScreen(input){\n output.html(input);\n }", "function info() {\n\tseperator();\n\tOutput('<span>>info:<span><br>');\n\tOutput('<span>Console simulator by Mario Duarte https://codepen.io/MarioDesigns/pen/JbOyqe</span></br>');\n}", "function display(){\r\n\r\n \r\n}", "showOutput() {\n this.output.style.display = \"block\";\n }", "function show() {\n best.html(population.pop[0].genes);\n averageFitness.html(population.averageFitness);\n generationNum.html(gNum);\n phrases.html(\"\");\n\n var phrs = \"\";\n\n for (let i = 1; i < population.pop.length && i < nPhrases.val(); i++) {\n phrs += '<span>' + population.pop[i].genes.join(\"\") + '</span>';\n }\n\n phrases.html(phrs);\n }", "function display_output($result)\n {\n //If not generator machine (acceptor) the output is Accepted or Rejected.\n if(!$('#generator').is(':checked'))\n {\n if($result == 2) {\n //Update the transition field.\n update_transition($previous_state, $old_tape_head_value, $trans.target, $trans.output, $trans.direction);\n $('#output').html(\"<strong style='color: #5cb85c;'>Accepted</strong>\");\n }\n else { $('#output').html(\"<strong>Rejected</strong>\"); $error = true; }\n if($error) { $('#output_panel').animateCss('tada'); }\n else { $('#output_panel').animateCss('bounce'); }\n }\n //If generator machine the output is the data on the tape.\n else\n {\n if($result == 2) {\n //Update the transition field.\n update_transition($previous_state, $old_tape_head_value, $trans.target, $trans.output, $trans.direction);\n var $tape_output = \"\";\n //Copy the non-blank data on the tape.\n for(var $tindex = ($left.length * -1); $tindex < $start_right.length; $tindex++)\n {\n var $tape_ele = at_index($tindex);\n if($tape_ele != '□') $tape_output += $tape_ele;\n }\n $('#output').html(\"<strong style='color: #5cb85c;'>\"+$tape_output+\"</strong>\");\n }\n else { $('#output').html(\"<strong>Error</strong>\"); $error = true; }\n if($error) { $('#output_panel').animateCss('tada'); }\n else { $('#output_panel').animateCss('bounce'); }\n }\n }", "displayScene() {\n\n //Process all component nodes\n this.processNode(this.idRoot, null, null, 1, 1);\n }", "display() {\n\t\t\t\tthis.nurbsPlane.display();\n\t\t}", "display() {\n this.scene.pushMatrix();\n this.scene.translate(10.6,1.7,9.2);\n this.scene.scale(0.1,0.1,0.1);\n this.board.display();\n this.scene.popMatrix();\n\t}", "display() \r\n {\r\n this.scene.pushMatrix();\r\n this.scene.rotate(-Math.PI/2,0,0,1);\r\n this.firstHalf.display();\r\n this.scene.popMatrix();\r\n\r\n this.scene.pushMatrix();\r\n this.scene.translate(0,0,this.height);\r\n this.scene.rotate(Math.PI,1,0,0);\r\n this.scene.rotate(Math.PI/2,0,0,1);\r\n //this.secondHalf.display();\r\n this.scene.popMatrix();\r\n }", "function qdisplay() {\n\t\t$('#main').html(\"<p>\" + test[count].b + \"</p>\");\n\t\tconsole.log(\"test[count].b\" + test[count].b)\n\t}", "function displayDOM(){\r\n\t\tvar str = '';\r\n\t\tcontainer.getChildren().each(function(item){\r\n\t\t\tstr += '<div style=\"' + item.style.cssText + '\">' + item.get('text') + '</div>\\n';\r\n\t\t});\r\n\t\tdocument.id('output').set('text', str);\r\n\t}", "function printInfo() {\n let ypos = 20;\n let xpos = 10;\n function nextY(){ ypos+=20; return ypos;}\n viewer.print('Dr.Santi Nuratch', xpos, nextY(), 'rgba(255,255,255,0.5)', 14);\n viewer.print('Machine Learning Algorithm', xpos, nextY(), 'rgba(255,255,10,0.5)', 14);\n viewer.print('Embedded Computing and Control Laboratory', xpos, nextY(), 'rgba(50,255,85,0.5)', 14);\n viewer.print('ECC-Lab | INC-KMUTT', xpos, nextY(), 'rgba(255,150,50,0.5)', 14);\n viewer.print('02 April 2018', xpos, nextY(), 'rgba(155,155,255,0.5)', 14);\n \n\n nextY(); // add empty line\n for(let i=0; i<centroids.length; i++) {\n viewer.print('Class-' + i + ': ' + centroids[i].members.length, xpos, nextY(), centroids[i].color);\n }\n viewer.print('Iteration: ' + (numIterations+1), xpos, nextY(), 'rgba(255,255,255,0.5)'); \n \n let err = (cenDist==0)?TERMINATION_TH/2 + Math.random() : cenDist;\n viewer.print('Error[' + (numIterations+1) +']: ' + err.toFixed(2), xpos, nextY(), 'rgba(255,255,255,0.5)'); \n }", "function display() {\n\n\t$(\"#random\").html(targetNumber);\n\t$(\"#score\").html(score);\n\t$(\"#wins\").html(wins);\n\t$(\"#losses\").html(losses);\n\t// $(\"#result\").html(\"&nbsp;\");\n\n}", "function output(content) {\n document.getElementById(\"display1\").innerHTML = content;\n}", "function printResults() {\n print.classList.add('active');\n inputWindow.classList.add('disappear');\n songInfo.classList.add('active');\n\n print.innerHTML = `\n I see ${inputs[0].value} of ${inputs[1].value}, ${inputs[2].value} ${inputs[3].value}, too.\n <br>\n I see ${inputs[4].value} for me and you.\n <br>\n And I think to myself, what a ${inputs[5].value} world.\n `\n}", "function showOutput() {\n const color = rgbArr.join('')\n outputRGBPanel.textContent = `#${color}`\n rangeContainer.style.backgroundColor = `#${color}`\n}", "displayScene() {\n if(this.nodeInfo)\n this.displayNode(this.nodeInfo[this.idRoot],this.defaultMaterialID,\"null\",{s:1,t:1},false);\n }", "function Display () {\n\tthis.board = new five.Board({io: new Raspi()});\n\tthis.led = null;\n\n\tthis.board.on('ready', function () {\n\t\t// Create HT16K33 controller.\n\t\tthis.led = new five.Led.Digits({controller: 'HT16K33', digits: 5});\n\t\t// Set time, if provided.\n\t\tif (this.moment) this.set(this.moment);\n\t}.bind(this));\n}", "function Display() {\n\t\tif (props.powerPro.trap4 === false) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tYou are in the air vent. You see a fan blade spinning rapidly. It\n\t\t\t\t\t\talso seems to be very sharp.\n\t\t\t\t\t</p>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else if (props.powerPro.trap5 === false) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tYou are in the air vent. The vent continues up an incline. It seems\n\t\t\t\t\t\tto be greased up.\n\t\t\t\t\t</p>\n\t\t\t\t</>\n\t\t\t);\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<p>You are in the air vent.</p>\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\t}", "function showOutput(data) {\n $(\"#title\").text(data.title);\n $(\"#poster\").attr(\"src\", data.poster);\n $(\"#story\").text(data.plot);\n $(\"#released\").text(data.released);\n $(\"#rated\").text(data.rated);\n $(\"#genre\").text(data.genre);\n $(\"#runtime\").text(data.runtime);\n $(\"#director\").text(data.director);\n $(\"#writer\").text(data.writer);\n $(\"#actors\").text(data.actor);\n $(\"#lang\").text(data.language);\n $(\"#country\").text(data.country);\n $(\"#awards\").text(data.awards);\n $(\"#metascore\").text(data.metascore);\n $(\"#imdbrating\").text(data.imdbRating);\n $(\"#imdbvotes\").text(data.imdbVotes);\n $(\"#type\").text(data.type);\n $(\"#year\").text(data.year);\n if (data.type != \"movie\") {\n $(\"#tSeasons\").attr(\"style\", \"visibility: visible\");\n $(\"#totalseason\").attr(\"style\", \"visibility: visible\");\n $(\"#tSeasons\").text(data.tSeason);\n }\n else {\n $(\"#totalseason\").attr(\"style\", \"visibility: hidden\");\n $(\"#tSeasons\").attr(\"style\", \"visibility: hidden\");\n }\n}", "function display() {\n // Update the display of the target rate text boxes, if needed.\n for (var i = 0; i < build_targets.length; i++) {\n build_targets[i].getRate()\n }\n var totals = globalTotals\n\n window.location.hash = \"#\" + formatSettings()\n\n if (currentTab == \"graph_tab\") {\n renderGraph(totals, spec.ignore)\n }\n recipeTable.displaySolution(totals)\n if (showDebug) {\n renderDebug()\n }\n\n timesDisplayed = timesDisplayed.add(one)\n var dc = document.getElementById(\"display_count\")\n dc.textContent = timesDisplayed.toDecimal()\n}", "function display() {\n\twindow.print();\n}", "display() \n { \n this.scene.pushMatrix();\n this.semiSphere2.display();\n this.scene.popMatrix();\n }", "function displayNumberCurrentSlide() {\n \tindexOfSlide.innerHTML = `Slide number ${myPresentation.getCurrentSlideIndex() + 1} (total: ${myPresentation.getSlides().length})`;\n}", "display() {\n let currentTheme = this.gameOrchestrator.getCurrentTheme();\n currentTheme.displayScene();\n this.displayGameboard(currentTheme);\n }", "function displayScene() {\n var para = document.querySelector (\"#descrip\");\n para.textContent = \"You are in the \" + player.currLoc.name + \"-\" + \"\\n\" + \n player.currLoc.description + \".\" + \"\\n\" +\n \"The items you can take are: \" + player.currLoc.items \n}", "function main() {\n startSlideShowAnimation();\n renderProject();\n}", "display()\r\n {\r\n this.scene.pushMatrix();\r\n this.scene.setActiveShader(this.shader)\r\n this.scene.graph.textures[this.waveMapId].bind(1);\r\n this.scene.graph.textures[this.textureId].bind();\r\n this.plane.display();\r\n this.scene.popMatrix();\r\n\r\n this.scene.setActiveShader(this.scene.defaultShader);\r\n\r\n }", "function printMovieDetail() {\n if (movie.bkgimage != null) {\n bkgImageElt.css('background-image', `url(${movie.bkgimage})`);\n }\n else {\n bkgImageElt.css('background-image', `linear-gradient(rgb(81, 85, 115), rgb(21, 47, 123))`);\n }\n\n titleElt.text(movie.title);\n modalTitle.text(movie.title);\n originaltitleElt.text(movie.originaltitle);\n resumeElt.text(movie.resume);\n dateElt.text(printDateFr(movie.date));\n durationElt.text(printDuration(movie.duration));\n imgElt.attr('src', movie.image);\n iframe.attr('src', movie.traileryt + \"?version=3&enablejsapi=1\");\n // Afficher la liste des acteurs\n var actorsStr = '';\n for (var actor of movie.actors) {\n actorsStr += actor + ' | ';\n }\n actorsElt.text(actorsStr);\n // afficher le réalisteur\n directorElt.text(movie.director);\n}", "display() \n { \n this.scene.pushMatrix();\n this.wing.display();\n this.scene.popMatrix();\n\n this.scene.pushMatrix();\n this.scene.rotate(Math.PI, 0, 0, 1);\n this.wing.display();\n this.scene.popMatrix();\n }", "function showCurrentPattern() {\n disableButtons();\n let showVal;\n if (currentCount < 10) {\n showVal = '0' + currentCount.toString();\n } else {\n showVal = currentCount.toString();\n }\n $(SEVEN_SEG_DISPLAY_ID).sevenSeg({ digits: 2, value: showVal });\n showMove();\n }", "display() {\n console.log('head:', this.head)\n console.log('[ ')\n this.displayHelper(this.head)\n console.log(' ]')\n console.log('tail:', this.tail)\n }", "function tiro1() {\n displays();\n}", "function showSlide()\r\n{\r\n // create objects\r\n const image1 = {file: \"ocean_beach_2.jpg\", description: \"Ocean Beach\", alt: \"Ocean Beach\"};\r\n const image2 = {file: \"back_beach_sorrento.jpg\", description: \"Sorrento Back Beach\", alt: \"Sorrento Back Beach\"};\r\n const image3 = {file: \"ocean_beach.jpg\", description: \"Ocean Beach\", alt: \"Ocean Beach\"};\r\n \r\n // using an array\r\n const images = [image1, image2, image3];\r\n \r\n // limit slideshow\r\n if (slideIndex >= images.length)\r\n {\r\n slideIndex = 0; // reset to the start\r\n }\r\n if (slideIndex === -1)\r\n {\r\n slideIndex = images.length-1; // reset to last slide \r\n }\r\n\r\n // display the slide\r\n const slideImage = document.querySelector(\".slides img\");\r\n slideImage.src = \"ICTWEB431_AE_Pro_1of2_SR1/\" + images[slideIndex].file;\r\n slideImage.alt = images[slideIndex].alt;\r\n\r\n // slides[slideIndex - 1].style.display = \"block\";\r\n\r\n // display description\r\n const description = document.querySelector(\".description\");\r\n description.innerHTML = images[slideIndex].description;\r\n\r\n // display the slide dot as the current dot\r\n // remove the class active from all dots\r\n const dotsList = document.getElementsByClassName(\"dot\");\r\n\r\n for (let i = 0; i < dotsList.length; i++)\r\n {\r\n dotsList[i].classList.remove(\"active\");\r\n }\r\n \r\n // set the class for the slide as \"active\" \r\n dotsList[slideIndex].classList.add(\"active\");\r\n\r\n}", "display() {\n push();\n // Centering image for easier image placement\n imageMode(CENTER);\n image(this.image, this.x, this.y, 1500, 300);\n pop();\n }", "function showText() {\n\tfiglet('Twitch', function(err, data) {\n\t if (err) {\n\t console.log('Something went wrong...');\n\t console.dir(err);\n\t return;\n\t }\n\t console.log(data);\n\t console.log(' Twitch streamers status '.inverse + '\\r\\n');\n\t //console.log('loading...');\n\t});\n}", "doodle() {\n this.update()\n this.display()\n }", "displayScene() {\n var root = this.components[this.root];\n if (root == null)\n return \"[displayScene]: root node does not exist!\";\n\n // display scene graph starting at the root component\n root.display(root.materials[root.currentMaterialIndex][1], root.texture);\n }", "displayScene() {\n\n this.logPicking();\n this.displayLoop('All','steelMaterial',['groundTexture']);\n this.test();\n }", "display() {\n if (this.isDrank === false) {\n //Display\n image(this.image, this.x, this.y, this.size, this.size);\n }\n }", "display() {\n\t\tthis.scene.pushMatrix();\n\t\tthis.scene.pushMaterial(this.spritesheetAppearance);\n\t\tthis.scene.pushTexture(this.texture);\n\n\t\tthis.scene.setActiveShaderSimple(this.shader);\n\t\tthis.spritesheetAppearance.setTexture(this.texture);\n\t\tthis.spritesheetAppearance.apply();\n\n\t\tlet position = 0;\n\n\t\tfor (let i = 0; i < this.text.length; i++) {\n\t\t\tposition = this.text[i].charCodeAt(0);\n\t\t\tthis.activateCellP(position);\n\t\t\tsuper.display();\n\t\t\tthis.scene.translate(1, 0, 0);\n\t\t}\n\n\n\t\tthis.scene.popTexture();\n\t\tthis.scene.popMaterial();\n\t\tthis.scene.popMatrix();\n\t\tthis.scene.setActiveShaderSimple(this.scene.defaultShader);\n\t}", "function openOutput() {\n var div = document.getElementById(\"output\");\n div.style.display = div.style.display == \"block\" ? \"none\" : \"block\";\n}", "display() {\n document.querySelector(\"#question\").innerHTML = this.question;\n for (let i = 0; i < 4; i++)\n showAnswer = selectValue(showAnswer, 4);\n answer1.innerHTML = this.answers[showAnswer[0]];\n answer2.innerHTML = this.answers[showAnswer[1]];\n answer3.innerHTML = this.answers[showAnswer[2]];\n answer4.innerHTML = this.answers[showAnswer[3]];\n }", "display() {\n this.rttTexture.bind(0);\n this.noiseTexture.bind(1);\n\n this.scene.setActiveShader(this.cameraShader);\n\n this.rectangle.display();\n\n this.scene.setActiveShader(this.scene.defaultShader);\n\n this.rttTexture.unbind(0);\n this.noiseTexture.unbind(1);\n }", "display() {\n this.scene.pushMatrix();\n this.scene.setActiveShader(this.shader);\n this.texture.bind(0);\n this.heightMapTexture.bind(1);\n this.plane.display();\n this.scene.setActiveShader(this.scene.defaultShader);\n this.scene.popMatrix();\n }", "function display() {\n let windowSize = `Window size is ${window.innerWidth} pixels wide by ${window.innerHeight} tall`\n let windowOffset = `Window offset is ${window.screenX} from the left and ${window.screenY} from the top.`\n let pageURL = `Page URL is ${window.location}`\n\n let pageInfo = document.getElementById(\"pageInfo\").innerText = `${windowSize} \\n ${windowOffset} \\n ${pageURL}`\n}", "display() {\n push();\n imageMode(CENTER);\n image(this.image, this.x, this.y, this.size * 2, this.size * 2);\n this.currentFrame = this.image.getCurrentFrame();\n pop();\n }", "function displayGuide() {\n my.html.guide.innerHTML = my.current.unit.guide\n }", "updateDisplay() {\n $('#steps .value').text(this.stepCounter);\n }", "displayScene() {\n // entry point for graph rendering\n //TODO: Render loop starting at root of graph\n //console.log(this.nodes)\n this.components[this.idRoot].display();\n }", "function show1() {\n imageCounter = 0;\n\n changeImage();\n\n changeAnnot(1, 0);\n\n }", "display() {\n this.view.board.checkSelectedCells(this.selectedPiece);\n this.stateMachine();\n \n let ignore = true;\n if (this.checkSelected() == \"OK\")\n ignore = false;\n \n this.view.updateTimer();\n this.view.chronometer.display();\n this.view.marker.display();\n \n\n this.scene.pushMatrix();\n this.makePickingValidCells(null);\n\n this.view.board.display();\n if(this.state != 'START')\n this.makePickingPieces();\n else\n this.showPieces();\n\n\n this.scene.clearPickRegistration();\n this.scene.popMatrix();\n\n }", "function showPerson() {\n $('body').find('.name').text(\"Name: \" + muArray[number].name);\n $('body').find('.git').text(\"github: \" + muArray[number].git_username);\n $('body').find('.shoutout').text(\"Shoutout: \" + muArray[number].shoutout);\n }", "show() {\n\t\tnoStroke();\n\t\tfill(150)\n\t\tcircle(this.x,this.y,this.r*2)\n\t\tfill(255)\n\t\ttextSize(30)\n\t\ttextAlign(CENTER, CENTER)\n\t\ttext(this.name, this.x, this.y)\n\t\t/*\n\t\ttext(this.one, 40, 461)\n\t\ttext(this.two, 121, 461)\n\t\ttext(this.three, 40+81*2, 461)\n\t\ttext(this.four, 40+81*3, 461)\n\t\ttext(this.five, 40+81*4, 461)\n\t\ttext(this.six, 40+81*5, 461)\n\t\ttext(this.ti, 40+81*6, 461)\n\t\ttext(this.te, 40+81*7, 461)\n\t\ttext(this.ta, 40+81*8, 461)\n\t\ttext(this.la, 40+81*9, 461)\n\t\ttext(this.le, 40+810, 461)*/\n\t}", "function display(hashmap, name, index, context) {\r\n\r\n Word.run(function (context) {\r\n\r\n // Mettez en file d'attente une commande pour obtenir la selection actuelle, puis\r\n // creez un objet de plage proxy avec les resultats.\r\n var body = context.document.body;\r\n context.load(body, 'text');\r\n\r\n console.log(\"Name to display : \" + hashmap[name][index]);\r\n\r\n var bdate = new Date(hashmap[name][index][6] + 'T10:20:30Z');\r\n bdate = calculateAge(bdate);\r\n\r\n $('#politicians').append(\r\n '<div class=\"panel panel-default\" id=\"panel' + counter.i + '\">\\\r\n <div class=\"panel-heading\">\\\r\n <a data-toggle=\"collapse\" data-target=\"#collapse'+ counter.i + '\">\\\r\n <h4 class=\"panel-title\">' + hashmap[name][index][4] + \" \" + hashmap[name][index][5] + '</h4>\\\r\n </a>\\\r\n </div>\\\r\n <div id=\"collapse'+ counter.i + '\" class=\"panel-collapse collapse \">\\\r\n <div class=\"panel-body\">\\\r\n <div class=\"row\">\\\r\n <div class=\"col-xs-2\" id=\"photo\"> <i class=\"material-icons md-60\">face</i> </div>\\\r\n <div class=\"col-xs-10\">\\\r\n <div class=\"row\"> ' + hashmap[name][index][8] + '</div>\\\r\n <div class=\"row\"> ' + hashmap[name][index][2] + '</div>\\\r\n <div class=\"row\"> ' + hashmap[name][index][7] + '</div>\\\r\n <div class=\"row\"> ' + bdate + ' years old' + '</div>\\\r\n <div class=\"row\"> <a href=\"http://www.wecitizens.be\">More on Wecitizens.be</a> </div>\\\r\n </div>\\\r\n </div>\\\r\n </div>\\\r\n </div>\\\r\n </div>\\ '\r\n );\r\n\t\t\t\tcounter.i++;\r\n })\r\n }", "displayCinematic() {\n background(this.sceneData.bgColor); // Black\n this.contriteAdam.display(this.sceneData.sizeMultiplier);\n }", "function display() {\n\n doSanityCheck();\n initButtons();\n}", "function showOutput(text) {\n document.getElementById('output').innerHTML = text;\n}", "function display_toys() {\n \n }// displays toys in the interface", "function sc_display(o, p) {\n if (p === undefined) // we assume not given\n\tp = SC_DEFAULT_OUT;\n p.appendJSString(sc_toDisplayString(o));\n}", "function display(n){\n document.write(\"<br/><font color=red> Value is \"+n+\"</font>\") \n // while display time big logic. \n}", "displayAll() {\n for (let i=0; i < this.blobs.length; i++) {\n this.displayBlob(this.blobs[i])\n log(\"\\n\")\n }\n }", "function display()\n{\n nameDisp.textContent= name;\n scoreDisp.textContent= score;\n lifeDisp.textContent= life;\n missileDisp.textContent= missile;\n levelDisp.textContent= level;\n}", "function displaySlide(index) {\n\n\t\t\tif (typeof index === \"string\" && index === \"last\") {\n\t\t\t\tcurrentIndex = len - 1;\n\n\t\t\t} else if (typeof index === \"string\" && index === \"fist\") {\n\t\t\t\tcurrentIndex = 0;\n\n\t\t\t} else if (index === undefined || index < 0 || index >= len) {\n\t\t\t\t// invalid value > auto play\n\t\t\t\tcurrentIndex = (currentIndex + 1) % len;\n\n\t\t\t} else {\n\t\t\t\tcurrentIndex = index;\n\t\t\t}\n\n\t\t\t// Program next slide\n\t\t\tdisplaySlide.future = (autoplay) ? setTimeout(function () {\n\t\t\t\trequestAnimationFrame(displaySlide);\n\t\t\t}, settings.slideDuration) : 0;\n\n\t\t\t// display the new slide\n\t\t\tvar slide = slides[currentIndex];\n\t\t\tif (typeof slide === \"object\") {\n\t\t\t\tonScreen(slide.src, $.extend({}, settings, slide));\n\n\t\t\t} else { // string\n\t\t\t\tonScreen(slide, settings);\n\t\t\t}\n\n\t\t\t// dispatch slide events as requested\n\t\t\tif (settings.events) $(settings.screen).trigger(\"slide\", slides[currentIndex]);\n\t\t}", "function displayRecords() {\n Alert.render(\n `Current best times for running the 100 metres dash <br><br>\n <b>WOMEN'S RECORD:</b> <br>10.49 seconds (set by Florence Griffith-Joyner in 1988)<br>\n <b>MEN'S RECORD:</b> <br>9.58 seconds (set by Usain Bolt in 2009)`)\n}", "function display(error, data1, data2, data3, data4) {\n\n if (error) throw error;\n\n // create a new plot and\n // display it\n var plot = scrollVis();\n d3.select(\"#vis\")\n .datum([data1, data2, data3, data4])\n .call(plot);\n\n // setup scroll functionality\n var scroll = scroller()\n .container(d3.select('#graphic'));\n\n // pass in .step selection as the steps\n scroll(d3.selectAll('.step'));\n\n // setup event handling\n scroll.on('active', function (index) {\n // highlight current step text\n d3.selectAll('.step')\n .style('opacity', function (d, i) {\n return i == index ? 1 : 0.1;\n });\n\n // activate current section\n plot.activate(index);\n });\n\n scroll.on('progress', function (index, progress) {\n plot.update(index, progress);\n });\n}", "function outputHaiku () {\n var start = '<p>&gt;&gt; ';\n var end = '</p><hr/>';\n\n // Turn off button function while working:\n unbindEventHandlers();\n\n // Append a new poem to the output window, calling the haiku API method:\n $('#output').append(start + _haiku.generateHaiku() + end);\n\n // Measure the new window height, and scroll to the bottom to show the newest:\n var height = $('#output')[0].scrollHeight;\n $('#outputScroll').scrollTop(height);\n\n // Add a little timeout to prevent button spamming:\n setTimeout(function () {\n bindEventHandlers();\n }, 300);\n }", "function output5() {\n var element = document.getElementById(\"output\");\n element.innerHTML = \"/*CSS*/ <br />\"\n + \".scenario5 { <br />\"\n + g_tab + scenarioTransformValues + \"<br />\"\n + g_tab + scenarioDurationValues + \"<br />\"\n + g_tab + scenarioDelayValues + \"<br />\"\n + g_tab + scenarioTimFunValues + \"<br />\"\n + \"}<br />\"\n + \"@keyframes animation2D { <br />\"\n + d_tab + scenarioKeyfrom + \"<br />\"\n + d_tab + scenarioKey50 + \"<br />\"\n + d_tab + scenarioKeyto + \"<br />\"\n + g_tab + \"} <br />\";\n }", "function display(board) {\n var element = document.createElement('pre');\n document.body.appendChild(element);\n\n setInterval(function () {\n element.innerText = board + '';\n board.next();\n }, 1000);\n }", "function showPrintingDiagnostics() {\n showPrintingCropMarks();\n showPrintingDescription();\n showPrintingRulers();\n}", "function renderInfo() {\n /** Get state */\n if (!wave.getState()) {\n return;\n }\n var state = wave.getState();\n \n /** Retrieve topics */\n var topics = toObject(state.get('topics','[]'));\n var votes = toObject(state.get('votes','[]'));\n \n /** Add topics to the canvas */\n var html = \"\";\n for (var i = 0; i < topics.length; i++){\n var id = \"topic\"+i;\n html += '<div class=\"topic\"><h4> ' + topics[i] + '</h4></div>';\n }\n document.getElementById('body').innerHTML = html;\n \n /** Create \"Add topic\" button to the footer */\n html += '<input type=\"text\" id=\"textBox\" value=\"\"/><button id=\"addInput\" onclick=\"addInput()\">Add Topic</button>';\n document.getElementById('footer').innerHTML = html;\n \n /** Adjust window size dynamically */\n gadgets.window.adjustHeight();\n}", "function slideChanged(evt)\n {\n if ( !printMode ) {\n slideIndices = Reveal.getIndices();\n closeWhiteboard();\n playbackEvents( 0 );\n }\n }", "function showSpeck() {\n showContent();\n\n $image.show();\n $image.attr('src', 'img/speck.jpg');\n\n $quoteText.text('This is a speck');\n $quoteAuthor.text('Somebody of the public');\n }", "function output2() {\n var element22 = document.getElementById(\"output\");\n element22.innerHTML = \"/*CSS*/ <br />\"\n + \".scenario2 { <br />\"\n + g_tab + \"transition-property: transform, opacity; <br />\"\n + g_tab + scenarioDurationValues + \"<br />\"\n + g_tab + scenarioDelayValues + \"<br />\"\n + g_tab + scenarioTimFunValues + \"<br />\"\n + g_tab + scenarioTransformValues + \"<br />\"\n + \" } <br />\";\n }", "display() {\n p.strokeWeight(p.strokeWidth);\n if (p.shapeMode == false) {\n p.ellipse(this.location.x, this.location.y, this.radius, this.radius);\n }\n if (p.lines) {\n p.line(p.w / 2, p.h / 2, this.location.x, this.location.y);\n }\n p.fill(255);\n }", "function displayInfo() {\n\tctx.fillStyle = '#FFFFFF';\n\tctx.font = '16px Times New Roman';\n\tfor (var i = 0; i < lives; i++) {\n\t\tctx.drawImage(player.ship, 800 + (i*20), 90, 15, 20);\n\t\tctx.fillText(\"Lives: \", 750, 100);\n\t}\n\tctx.fillText(\"Level: \" + level, 750, 130);\n\tctx.fillText(\"Score: \" + score, 750, 160);\n\tctx.fillText(\"Controls\", 750, 240);\n\tctx.fillText(\"Arrow keys to move\", 750, 270);\n\tctx.fillText(\"Space to shoot\", 750, 300);\n\tctx.fillText(\"W to warp\", 750, 330);\n\treturn;\n}", "render_display() {\n this.element.fadeIn();\n this.visible = true;\n }", "display() {\n p.stroke(0);\n p.bassMap = p.map(p.bass, 0, 255, 20, 500);\n p.bassStrokeWeight = p.map(p.bass, 0, 255, 0, 10);\n p.noFill();\n p.strokeWeight(p.bassStrokeWeight);\n p.stroke(p.strokeColor);\n p.ellipse(this.location.x, this.location.y, p.bassMap, p.bassMap);\n }", "function showCardOrSpeak (detail, conv) {\n var hasScreen = conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT'); \n if (hasScreen) {\n var cards = [];\n for(var i = 0; i < detail.length; i++) {\n var d = new Date(0); \n d.setUTCSeconds(detail[i].time);\n var desc = detail[i].score + ' points by ' + detail[i].by + ' ' + ta.ago(d);\n desc += ' | ';\n desc += detail[i].descendants + ' comments';\n var link = detail[i].url;\n if (link === undefined) {\n link = \"https://assistant.google.com\";\n }\n cards.push(new BrowseCarouselItem({\n title: detail[i].title,\n url: link,\n description: desc,\n }));\n }\n conv.ask(new BrowseCarousel({items: cards}));\n conv.ask(new Suggestions(['top 🕶', 'new 🔥', 'best 🎉', 'random 👾']));\n conv.ask(new LinkOutSuggestion({\n name: 'web',\n url: 'https://news.ycombinator.com/',\n }));\n } else {\n let ssml = \"<speak><p>\";\n for(var i = 0; i < detail.length; i++) {\n ssml += '<s><say-as interpret-as=\"ordinal\">' + (i+1) + '</say-as>.<break time=\"0.6s\"/>' + detail[i].title + '.</s><break time=\"0.5s\"/>';\n }\n ssml += \"<s>What else I can help?</s></p></speak>\";\n conv.ask(ssml);\n }\n return;\n}", "function display(data) {\n \n // create a new plot and\n // display it\n plot = scrollVis();\n d3.select('#vis')\n .datum(data)\n .call(plot);\n\n // setup scroll functionality\n var scroll = scroller().container(d3.select('#graphic'));\n scroll(d3.selectAll('.step'));\n \n // setup event handling\n scroll.on('active', function (index) {\n\n if( tjb.isReloaded==true ){\n index = 0;\n tjb.isReloaded=false;\n }\n else{\n index = index;\n }\n \n onScrolling(index);\n });\n}", "renderOutput(\n bmi,\n bfp,\n dci,\n bmr,\n carb,\n protein,\n fat\n ) {\n this.result.innerHTML = '';\n let container = document.createElement('div');\n container.classList.add('output-container');\n \n let imgContainer = document.createElement('div');\n imgContainer.classList.add('output-img-container');\n \n macroImageLinks.forEach((v, i) => {\n let img = document.createElement('img');\n img.src = v.link;\n img.classList.add('output-img');\n \n let label = document.createElement('p');\n label.classList.add('output-macro-label');\n \n if(i === 2) {\n label.innerText = `${carb}g Carbs/day`;\n } else if(i === 1) {\n label.innerText = `${protein}g Protein/day`;\n } else if(i === 0) {\n label.innerText = `${fat}g Fat/day`;\n }\n \n let imgLabelContainer = document.createElement('div');\n imgLabelContainer.classList.add('img-label-container');\n \n imgLabelContainer.append(img, label);\n imgContainer.appendChild(imgLabelContainer);\n });\n container.appendChild(imgContainer);\n \n let moreInfo = document.createElement('div');\n moreInfo.classList.add('more-info');\n \n let bmiText = document.createElement('p');\n bmiText.innerText = `Body Mass Index: ${roundTo2DecimalPlaces(bmi)}`;\n \n let bfpText = document.createElement('p');\n bfpText.innerText = `Body Fat Percentage: ${roundTo2DecimalPlaces(bfp)}%`;\n \n let dciText = document.createElement('p');\n dciText.innerText = `Daily Calorie Intake: ${roundTo2DecimalPlaces(dci)} calories`;\n \n let bmrText = document.createElement('p');\n bmrText.innerText = `Basal Metabolic Rate: ${roundTo2DecimalPlaces(bmr)} calories/day`;\n \n moreInfo.append(\n bmiText,\n bfpText,\n dciText,\n bmrText\n );\n \n this.result.append(container, moreInfo);\n window.scrollTo({top: 0, behavior: 'smooth'});\n }", "function displayInfo(){\n \n\n fill(255);\n var lifeExpValue = lifeExp[int(inp.value())];\n var countryNameValue = countryNames[int(inp.value())];\n \n push();\n \n textSize(76);\n textAlign(CENTER);\n fill(255);\n stroke(0);\n strokeWeight(3);\n \n text(`${lifeExpValue}`, width/4 + 75, height/2 + 150);\n text(`${countryNameValue}`, width/4 + 75, height/2 + 250);\n \n pop();\n \n}", "display() {\n push();\n noStroke();\n imageMode(CENTER);\n image(this.avalancheImg, this.x, this.y, this.width, this.height);\n pop();\n }", "function display(text) {\n\t\tvar resultNode = document.createElement(\"p\"); //create a paragraph tag to store and display result\n\t\tresultNode.innerHTML = text; //store that result\n\t\tvar resultParent = document.getElementById(\"biases\"); //find place to attach result\n\t\tresultParent.appendChild(resultNode); //actually attach value to that div tag thing\n\t}", "display(){\n this.htmlBuilder.build();\n this.displayCityName();\n this.displayTodayWeather();\n this.displayWeekWeather();\n this.displayTimeSlots();\n }", "function display()\n{\n\n}", "function display(data) {\n // create a new plot and\n // display it\n var plot = scrollVis();\n d3.select(\"#vis\")\n .datum(data)\n .call(plot);\n\n // setup scroll functionality\n var scroll = scroller()\n .container(d3.select('#graphic'));\n\n // pass in .step selection as the steps\n scroll(d3.selectAll('.step'));\n\n // setup event handling\n scroll.on('active', function(index) {\n // highlight current step text\n d3.selectAll('.step')\n .style('opacity', function(d,i) { return i == index ? 1 : 0.1; });\n\n // activate current section\n plot.activate(index);\n });\n\n scroll.on('progress', function(index, progress){\n plot.update(index, progress);\n });\n}", "function display(){\n\n\t\t\t$(\"#number\").html(randNum);\n\t\t\t$(\"#winsLosses\").html(\"<p>Wins: \" + wins + \"</p><br>\"\n\t\t\t\t+ \"<p>Losses: \" + losses + \"</p>\");\n\t\t\t$(\"#totalScore\").html(totalScore);\n\n\t\t}", "function pageDisplay(iteration) {\n // save the info from this iteration in the appendages array\n var title = appendages[iteration].title;\n var intro = appendages[iteration].intro;\n var link = appendages[iteration].link;\n var video = decodeURI(appendages[iteration].video);\n\n // format the info\n var titleText = $('<h4>').text(title);\n var introText = $('<p>').text(intro);\n var wikiLink = $('<a>').text(\"Click here for more info\")\n .addClass('wiki-link')\n .attr('target', '_blank')\n .attr('href', link);\n var videoDiv = $('<div>').append(video)\n .addClass(\"embed-container\");\n\n // append it all to the proper divs\n $('#wikiSpot').empty().append(titleText, introText, wikiLink);\n $('#videoSpot').empty().append(videoDiv);\n}", "displayScene() {\n\t\n\t\tif (this.scene.interface.isKeyPressed(\"KeyM\") == true)\n\t\t\tthis.changeMaterials();\n\n\t\tvar root = this.components[this.root];\n\t\tthis.displayComponent(root, root.materials[root.currentMaterial], root.texture, root.texS, root.texT);\n\t\n\t}", "function display(result) {\n let displayArea = document.querySelector('#display-text');\n displayArea.textContent = result;\n}", "function executeDisplay(list_lats_longs){\n //Resets slideshow back to first screen\n slideIndex = 0;\n speedIndex = 0;\n playing = true;\n //get the speed limits\n var speedlims = getSpeedLimits(list_lats_longs);\n //make the slideshow with street views and speedlimtits\n makePreview(list_lats_longs, speedlims);\n}", "function showNext() {\n\t\tif (this.container.width() > 0) {\n\t\t\tthis.nextImage();\n\t\t\tthis.showCurrent();\n\t\t}\n\t\tthis.run();\n\t}", "function displayQuestion() {\n push();\n textAlign(LEFT, CENTER);\n textSize(28);\n fill(255);\n text(`lvl #2`, width / 20, height / 20);\n text(`On a scale from 'I got this' to 'AAAAAAH',\nhow confident do you feel about the future?`, width / 20, height / 10 * 2)\n pop()\n}", "display() {\n push();\n noStroke();\n // The trail becomes its extended body\n push();\n for (let i = 0; i < this.trail.length; i++) {\n imageMode(CENTER);\n image(this.trailImage, this.trail[i].x, this.trail[i].y, this.radius * 2, this.radius * 2);\n }\n pop();\n // Centering image for precise collision\n imageMode(CENTER);\n image(this.image, this.x, this.y, this.radius * 2, this.radius * 2);\n pop();\n }", "display() {\n noStroke();\n fill(0);\n rect(this.frame.x,this.frame.y,1,1);\n imageMode(CENTER);\n image(girl_Img,this.frame.x+0.5,this.frame.y+0.5,2.25,2.75);\n }" ]
[ "0.67133266", "0.64770174", "0.64627844", "0.6449356", "0.6381097", "0.6281531", "0.62607354", "0.62514466", "0.6238299", "0.6218007", "0.6206229", "0.62033105", "0.6201278", "0.61248195", "0.6111249", "0.6080556", "0.60734487", "0.6047463", "0.6038747", "0.6027305", "0.60103935", "0.6000428", "0.5995829", "0.59878093", "0.5985512", "0.59792656", "0.5961186", "0.5950123", "0.5943371", "0.59396523", "0.5936179", "0.59278977", "0.5924141", "0.5922973", "0.59067786", "0.59028673", "0.5901581", "0.5896605", "0.58958185", "0.58843136", "0.5883191", "0.5874316", "0.5871924", "0.5868223", "0.5862248", "0.58608776", "0.5854326", "0.5849298", "0.5842244", "0.583775", "0.5823987", "0.5822251", "0.5817902", "0.5814628", "0.581127", "0.5804897", "0.5793429", "0.5789239", "0.5787678", "0.57852113", "0.5784449", "0.5783077", "0.57800406", "0.5774316", "0.57703304", "0.576678", "0.5766011", "0.5763142", "0.57587266", "0.57580954", "0.57433563", "0.5735743", "0.5733534", "0.57320136", "0.57317615", "0.57300496", "0.5724093", "0.5720621", "0.571916", "0.5711109", "0.570888", "0.5707505", "0.5707244", "0.5706812", "0.5700954", "0.5699444", "0.56894857", "0.5686416", "0.56823015", "0.5676825", "0.5673321", "0.5672417", "0.5670154", "0.5670051", "0.5668013", "0.5667656", "0.5665602", "0.5664038", "0.56640124", "0.5664002", "0.5662273" ]
0.0
-1
Init all internal data
constructor() { this.m_xDim = 0; this.m_yDim = 0; this.m_zDim = 0; this.m_stack3d = null; this.m_maxStack3d = 0; this.m_indexStack3d = 0; this.m_numFilled3d = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init () {\n // Here below all inits you need\n }", "function init() {\n\t\t\tresetData();\n\t\t\trefreshTotalCount();\n\t\t\tloadVocabs();\n\t\t}", "function _init() {\n addEvent();\n getData();\n }", "function initData() {\n initLtr_factor();\n initBosunit();\n initHero();\n initSelect25();\n initMS();\n}", "function init() {\n\t\t\tconsole.log(\"init()\");\n\t\t\tresetData();\n\t\t\trefreshTotalCount();\n\t\t\taddAdbRow();\n\t\t\tconsole.log(\"done init()\");\n\t\t}", "function _init() {\n }", "function init() {\n\t \t\n\t }", "init(){\n var self = this;\n self.generateData();\n self.insertInfo();\n self.copyData();\n }", "_init() {\n\t\tthis.life.init();\n\t\tthis.render.init();\n\n\t\tthis.emission.init();\n\t\tthis.trail.init(this.node);\n\n\t\tthis.color.init();\n\t}", "initialise() {\n cLogger('Initialising data state');\n // listen for socket events\n socketManager.setListener(this);\n // load the users\n this.getAllUsers();\n // load the entries\n this.getAllEntries();\n }", "function init() {\n DataService.currentEntity = undefined;\n DataService.entityGraph = undefined;\n DataService.types = {};\n DataService.filterTypes = [];\n DataService.entityData = {};\n }", "function init() {\n }", "function init() {\n\n }", "function init() {\n\n }", "_init() {\n this.__lookupTable = new qx.data.Array();\n this.__openNodes = [];\n this.__nestingLevel = [];\n this._initLayer();\n }", "function init() {\r\n\r\n }", "function init() {\r\n }", "function _init() {\n var self = this\n ;\n\n if (!!self['_data']) {\n self.bindTo(_loadData)(self['_data']);\n }\n }", "function init() {\n fetchDetails();\n setEvents();\n }", "init(){}", "init() {\n\t\tthis.replaceData(\n\t\t\tthis.manager.get(\"noReq\"),\n\t\t\tthis.endpoints.get,\n\t\t\tthis.data.get\n\t\t);\n\t}", "function init() { }", "function init() { }", "function _init() {\r\n\r\n //Set name on scope\r\n $sc['_name'] = CONTROLLER_NAME;\r\n\r\n //Set title and navigation\r\n $hs['$scope'].setTitle(serverData['serverName'] + ' -> ' + serverData['date']);\r\n $hs['$scope'].setNav('ranking.list');\r\n\r\n $sc['data'] = _data;\r\n\r\n //Initialize serverData\r\n _initialize_versusData();\r\n _initialize_serverData();\r\n _initialize_navigation();\r\n _initialize_chartData();\r\n\r\n _initialize_pagination();\r\n\r\n _data['filter']['all_classess'] = storedDataService['characterClassIds'].where(function(itm){ return itm.id; });\r\n _data['filter']['all_ranks'] = storedDataService['characterClassIds']\r\n .where(function(itm){ return itm.id >= 10; })\r\n .sort(function(a, b){ return b.id - a.id; });\r\n }", "resetData() {\n\t\t\tthis.initFlags();\n\t\t\tthis.initMetadata();\n\t\t}", "function init(){\n\n }", "function _init() {\n }", "function _init() {\n }", "function _init() {\n }", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "function init() {}", "initialize() {\n\t\tthis.updateFaves();\n\t\tthis.CALCULATOR.initialize();\n\t\t\n\t\t// initialize unit converter\n\t\tthis.populateCategories();\n\t\tthis.populateUnitMenus();\n\t\tthis.switchToFaveConv();\n\t\tthis.convertHandler();\n\t\t\n\t\t// initialize constants\n\t\tthis.populateConstants();\n\t\tif(this.m_faves.constant === \"\") {\n\t\t\tthis.constChange();\n\t\t\tthis.constHandler();\n\t\t}\n\t\telse {\n\t\t\tthis.switchToFaveConst();\n\t\t}\n\t\t\n\t\t// initialize formulas\n\t\tthis.populateFormulas();\n\t\tif(this.m_faves.formula === \"\") {\n\t\t\tthis.populateFormulaFields();\n\t\t}\n\t\telse {\n\t\t\tthis.switchToFaveFormula();\n\t\t}\n\t\t\n\t\tthis.setUnloadListener();\n\t}", "init() {\n this.reset();\n this.load();\n }", "function init() {\n\t//TODO\n}", "function init() {\n\n\n\n\t}", "function init() {\n\t\t\tresetData();\n resetClipboardMI();\n resetClipboardEC();\n resetClipboardDC();\n\t\t\trefreshTotalCount();\n\t\t\tloadVocabs();\n for(var i=0;i<5; i++) { addMutationInvolvesRow(); }\n for(var i=0;i<5; i++) { addExpressesComponentsRow(); }\n for(var i=0;i<5; i++) { addDriverComponentsRow(); }\n if (document.location.search.length > 0) {\n searchByAlleleKeys();\n }\n\t\t}", "function initData(){\n dynarexDataIsland.init();\n loadFunctionTimes();\n setEventListener();\n}", "_init() {\n this.floors.all = FloorsJSON\n this.locations.all = LocationsJSON\n this._segregateLocations()\n this._groupFloorsByBuildings()\n }", "function init(){}", "function init() {\n autoScroll();\n countDown();\n fetchWeather();\n fetchDestinations();\n formValidation();\n }", "static initialize()\n {\n RPM.songsManager = new SongsManager();\n RPM.settings = new Settings();\n RPM.datasGame = new DatasGame();\n RPM.gameStack = new GameStack();\n RPM.loadingDelay = 0;\n RPM.clearHUD();\n }", "init() {\n }", "function init() {\n getContentTypes();\n getProperties();\n }", "function init() {\n createDataReader('heartbeat', true);\n createDataReader('timing');\n createDataReader('telemetry');\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "function initData(){\n o_data = user.original_musics;\n d_data = user.derivative_musics;\n c_data = user.collected_musics;\n}", "function init() {\n\t\tbuildBar();\n\t\tbuildBubble();\n\t\tbuildGauge();\n\t\t//buildMeta();\n\t}", "function initAll() {\n roomName = \"\";\n type = \"\";\n minAge = 0;\n maxAge = 0;\n\n orgChildId = 0;\n classroomId = 0;\n changeRoomId = 0;\n\n roomList = {};\n room2 = [];\n displayList = [];\n dropdownList = [];\n transitId = [];\n transitData = [];\n roomTransiteData = []; \n\n dateOfBirth = new Date();\n stepStartDate = new Date();\n stepEndDate = new Date();\n actualStartDate = new Date();\n actualEndDate = new Date();\n enrollmentStartDate = new Date();\n enrollmentEndDate = new Date();\n\n startDate = new Date();\n endDate = new Date();\n transitDate = new Date();\n }", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "init() {}", "function init() {\n startIndex = 0;\n vm.data = [];\n }", "function init() {\n // localStorage.clear();\n initLocals();\n initDescription();\n initGrid();\n}", "function initData() {\n\tsensorTypes = {};\n}", "function init(){\n getReportData();\n }", "function init() {\n fetchData();\n}", "Init()\n {\n this.my_state_machine = new StateMachine();\n this.overlay_manager_inst = new OverlayManager();\n this.level_viewer = null;\n this.information_log = document.getElementById(\"informationLog\");\n this.level_object_manager = new LevelObjectManager();\n this.level_complete = document.getElementById(\"complete\");\n this.stats_manager = new StatManager();\n this.AI_bridge = new AIBridge();\n this.memento = new Memento();\n this.toolbar_manager = new ToolbarManager();\n }", "function init(){\n getData();\n}", "init () {}", "init () {}", "function fullInit(options)\n\t{\n\t\t_data = options.data;\n\t}", "function fullInit(options)\n\t{\n\t\t_data = options.data;\n\t}", "constructor() {\n this.data = this._loadData();\n }", "constructor() {\n super();\n this._init();\n }", "function init() {\n getData({}, mapDrawing);\n getPlaylist({}, loadPlaylist);\n\n console.log(\"Init functie\");\n}", "function init() {\n\n }", "function init() {\n initVariable();\n initDatePicker();\n }", "function init () {\n Accordion.initAll()\n Alert.initAll()\n Disclosure.initAll()\n Dropdown.initAll()\n FileInput.initAll()\n Dialog.initAll()\n Sidenav.initAll()\n Switch.initAll()\n Tabs.initAll()\n}", "function init() {\n\t\tbindClickEventsToBulbs();\n\t\tgetBulbsInfo();\n\t\tupdateBulbsStatus();\n\t \t\n initDigitalWatch();\n updateDate(0);\n\n bindEvents();\n }", "init() {\n\t\tthis.replaceData(\n\t\t\tthis.manager.get(\"hostReq\"),\n\t\t\tthis.endpoints.check,\n\t\t\tthis.data.check\n\t\t);\n\t}", "init()\n\t{\n\t\tinitVerticesNormalsTexturesIndexes();\n\n //Converts the values to buffers\n\t\tthis.vertexBuffer = getVertexBufferWithVertices(this.vertices);\n\t\tthis.colorBuffer = getVertexBufferWithVertices(this.colors);\n\t\tthis.indexBuffer = getIndexBufferWithIndices(this.indices);\n\n\t\t//Defines the position matrix of the object\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.translate(this.mvMatrix, this.mvMatrix, vec3.fromValues(this.x, this.y, 0.0));\n\t}", "function initialize() {\n getData('LionelNanchen');\n getData('onicoleheig');\n getData('wasadigi');\n getData('paulnta');\n getData('edri');\n getData('mraheigvd');\n getData('kamkill01011');\n getData('onicole');\n }", "initialise () {}", "function _init() {\n\t\tgetHeadlines();\n\t}", "function init() {\n reset();\n lastTime = Date.now();\n main();\n }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}" ]
[ "0.7984853", "0.79424834", "0.7931414", "0.7891047", "0.7678833", "0.7564601", "0.7564407", "0.7525892", "0.7474785", "0.74739414", "0.74430525", "0.7439018", "0.743616", "0.743616", "0.7432752", "0.74179894", "0.73684114", "0.7327663", "0.7298696", "0.72204995", "0.7219873", "0.72056097", "0.72056097", "0.7179086", "0.71778315", "0.7176999", "0.7173743", "0.7173743", "0.7173743", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.71685266", "0.7150683", "0.71205854", "0.7107985", "0.7105259", "0.7096644", "0.7094392", "0.7060478", "0.7047254", "0.7041847", "0.7035727", "0.70303065", "0.7006634", "0.6992039", "0.69855684", "0.69855684", "0.69855684", "0.69855684", "0.69855684", "0.69662887", "0.6956406", "0.6949852", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.69432354", "0.6941889", "0.69267434", "0.69237983", "0.6913531", "0.6906023", "0.69050676", "0.689453", "0.6883754", "0.6883754", "0.68768096", "0.68768096", "0.6855837", "0.68538016", "0.6846427", "0.68394196", "0.68311954", "0.68297565", "0.68214595", "0.68209696", "0.68174976", "0.6815597", "0.6812758", "0.6799115", "0.6795581", "0.67788273", "0.67788273", "0.67788273", "0.67788273" ]
0.0
-1
Apply the rawignoreregex option. Return the modified html, and a function that recovers line/column numbers of issues.
function rawIgnoreRegex(html, options) { const ignore = options["raw-ignore-regex"]; if (!ignore) { return html; } return html.replace((new RegExp(ignore, "gm")), function(match) { return match.replace(/[^\n\t\n\r]/g, "¤"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stripHtml(...args) {\n // let extractedInputs = new Set(\n // JSON.parse(\n // fs.readFileSync(path.resolve(\"./test/util/extractedInputs.json\"), \"utf8\")\n // )\n // );\n // if (typeof args[0] === \"string\" && args[0].trim().length > 3) {\n // extractedInputs.add(args[0]);\n // fs.writeFileSync(\n // path.resolve(\"./test/util/extractedInputs.json\"),\n // JSON.stringify([...extractedInputs], null, 0)\n // );\n // }\n\n let { result, ranges, allTagLocations, filteredTagLocations } =\n originalStripHtml(...args);\n return { result, ranges, allTagLocations, filteredTagLocations };\n}", "function sanitizeHtml(html,options,_recursing){var result='';// Used for hot swapping the result variable with an empty string in order to \"capture\" the text written to it.\nvar tempResult='';function Frame(tag,attribs){var that=this;this.tag=tag;this.attribs=attribs||{};this.tagPosition=result.length;this.text='';// Node inner text\nthis.updateParentNodeText=function(){if(stack.length){var parentFrame=stack[stack.length-1];parentFrame.text+=that.text;}};}if(!options){options=sanitizeHtml.defaults;options.parser=htmlParserDefaults;}else{options=extend(sanitizeHtml.defaults,options);if(options.parser){options.parser=extend(htmlParserDefaults,options.parser);}else{options.parser=htmlParserDefaults;}}// Tags that contain something other than HTML, or where discarding\n// the text when the tag is disallowed makes sense for other reasons.\n// If we are not allowing these tags, we should drop their content too.\n// For other tags you would drop the tag but keep its content.\nvar nonTextTagsArray=options.nonTextTags||['script','style','textarea'];var allowedAttributesMap;var allowedAttributesGlobMap;if(options.allowedAttributes){allowedAttributesMap={};allowedAttributesGlobMap={};each(options.allowedAttributes,function(attributes,tag){allowedAttributesMap[tag]=[];var globRegex=[];attributes.forEach(function(obj){if(isString(obj)&&obj.indexOf('*')>=0){globRegex.push(quoteRegexp(obj).replace(/\\\\\\*/g,'.*'));}else{allowedAttributesMap[tag].push(obj);}});allowedAttributesGlobMap[tag]=new RegExp('^('+globRegex.join('|')+')$');});}var allowedClassesMap={};each(options.allowedClasses,function(classes,tag){// Implicitly allows the class attribute\nif(allowedAttributesMap){if(!has(allowedAttributesMap,tag)){allowedAttributesMap[tag]=[];}allowedAttributesMap[tag].push('class');}allowedClassesMap[tag]=classes;});var transformTagsMap={};var transformTagsAll;each(options.transformTags,function(transform,tag){var transFun;if(typeof transform==='function'){transFun=transform;}else if(typeof transform===\"string\"){transFun=sanitizeHtml.simpleTransform(transform);}if(tag==='*'){transformTagsAll=transFun;}else{transformTagsMap[tag]=transFun;}});var depth=0;var stack=[];var skipMap={};var transformMap={};var skipText=false;var skipTextDepth=0;var parser=new htmlparser.Parser({onopentag:function onopentag(name,attribs){if(skipText){skipTextDepth++;return;}var frame=new Frame(name,attribs);stack.push(frame);var skip=false;var hasText=!!frame.text;var transformedTag;if(has(transformTagsMap,name)){transformedTag=transformTagsMap[name](name,attribs);frame.attribs=attribs=transformedTag.attribs;if(transformedTag.text!==undefined){frame.innerText=transformedTag.text;}if(name!==transformedTag.tagName){frame.name=name=transformedTag.tagName;transformMap[depth]=transformedTag.tagName;}}if(transformTagsAll){transformedTag=transformTagsAll(name,attribs);frame.attribs=attribs=transformedTag.attribs;if(name!==transformedTag.tagName){frame.name=name=transformedTag.tagName;transformMap[depth]=transformedTag.tagName;}}if(options.allowedTags&&options.allowedTags.indexOf(name)===-1||options.disallowedTagsMode==='recursiveEscape'&&!isEmptyObject(skipMap)){skip=true;skipMap[depth]=true;if(options.disallowedTagsMode==='discard'){if(nonTextTagsArray.indexOf(name)!==-1){skipText=true;skipTextDepth=1;}}skipMap[depth]=true;}depth++;if(skip){if(options.disallowedTagsMode==='discard'){// We want the contents but not this tag\nreturn;}tempResult=result;result='';}result+='<'+name;if(!allowedAttributesMap||has(allowedAttributesMap,name)||allowedAttributesMap['*']){each(attribs,function(value,a){if(!VALID_HTML_ATTRIBUTE_NAME.test(a)){// This prevents part of an attribute name in the output from being\n// interpreted as the end of an attribute, or end of a tag.\ndelete frame.attribs[a];return;}var parsed;// check allowedAttributesMap for the element and attribute and modify the value\n// as necessary if there are specific values defined.\nvar passedAllowedAttributesMapCheck=false;if(!allowedAttributesMap||has(allowedAttributesMap,name)&&allowedAttributesMap[name].indexOf(a)!==-1||allowedAttributesMap['*']&&allowedAttributesMap['*'].indexOf(a)!==-1||has(allowedAttributesGlobMap,name)&&allowedAttributesGlobMap[name].test(a)||allowedAttributesGlobMap['*']&&allowedAttributesGlobMap['*'].test(a)){passedAllowedAttributesMapCheck=true;}else if(allowedAttributesMap&&allowedAttributesMap[name]){var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator10=allowedAttributesMap[name][Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator10.next()).done);_iteratorNormalCompletion=true){var o=_step.value;if(isPlainObject(o)&&o.name&&o.name===a){passedAllowedAttributesMapCheck=true;var newValue='';if(o.multiple===true){// verify the values that are allowed\nvar splitStrArray=value.split(' ');var _iteratorNormalCompletion2=true;var _didIteratorError2=false;var _iteratorError2=undefined;try{for(var _iterator11=splitStrArray[Symbol.iterator](),_step2;!(_iteratorNormalCompletion2=(_step2=_iterator11.next()).done);_iteratorNormalCompletion2=true){var s=_step2.value;if(o.values.indexOf(s)!==-1){if(newValue===''){newValue=s;}else{newValue+=' '+s;}}}}catch(err){_didIteratorError2=true;_iteratorError2=err;}finally{try{if(!_iteratorNormalCompletion2&&_iterator11[\"return\"]!=null){_iterator11[\"return\"]();}}finally{if(_didIteratorError2){throw _iteratorError2;}}}}else if(o.values.indexOf(value)>=0){// verified an allowed value matches the entire attribute value\nnewValue=value;}value=newValue;}}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator10[\"return\"]!=null){_iterator10[\"return\"]();}}finally{if(_didIteratorError){throw _iteratorError;}}}}if(passedAllowedAttributesMapCheck){if(options.allowedSchemesAppliedToAttributes.indexOf(a)!==-1){if(naughtyHref(name,value)){delete frame.attribs[a];return;}}if(name==='iframe'&&a==='src'){var allowed=true;try{// naughtyHref is in charge of whether protocol relative URLs\n// are cool. We should just accept them\nparsed=url.parse(value,false,true);var isRelativeUrl=parsed&&parsed.host===null&&parsed.protocol===null;if(isRelativeUrl){// default value of allowIframeRelativeUrls is true unless allowIframeHostnames specified\nallowed=has(options,\"allowIframeRelativeUrls\")?options.allowIframeRelativeUrls:!options.allowedIframeHostnames;}else if(options.allowedIframeHostnames){allowed=options.allowedIframeHostnames.find(function(hostname){return hostname===parsed.hostname;});}}catch(e){// Unparseable iframe src\nallowed=false;}if(!allowed){delete frame.attribs[a];return;}}if(a==='srcset'){try{parsed=srcset.parse(value);each(parsed,function(value){if(naughtyHref('srcset',value.url)){value.evil=true;}});parsed=filter(parsed,function(v){return!v.evil;});if(!parsed.length){delete frame.attribs[a];return;}else{value=srcset.stringify(filter(parsed,function(v){return!v.evil;}));frame.attribs[a]=value;}}catch(e){// Unparseable srcset\ndelete frame.attribs[a];return;}}if(a==='class'){value=filterClasses(value,allowedClassesMap[name]);if(!value.length){delete frame.attribs[a];return;}}if(a==='style'){try{var abstractSyntaxTree=postcss.parse(name+\" {\"+value+\"}\");var filteredAST=filterCss(abstractSyntaxTree,options.allowedStyles);value=stringifyStyleAttributes(filteredAST);if(value.length===0){delete frame.attribs[a];return;}}catch(e){delete frame.attribs[a];return;}}result+=' '+a;if(value&&value.length){result+='=\"'+escapeHtml(value,true)+'\"';}}else{delete frame.attribs[a];}});}if(options.selfClosing.indexOf(name)!==-1){result+=\" />\";}else{result+=\">\";if(frame.innerText&&!hasText&&!options.textFilter){result+=frame.innerText;}}if(skip){result=tempResult+escapeHtml(result);tempResult='';}},ontext:function ontext(text){if(skipText){return;}var lastFrame=stack[stack.length-1];var tag;if(lastFrame){tag=lastFrame.tag;// If inner text was set by transform function then let's use it\ntext=lastFrame.innerText!==undefined?lastFrame.innerText:text;}if(options.disallowedTagsMode==='discard'&&(tag==='script'||tag==='style')){// htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n// script tags is, by definition, game over for XSS protection, so if that's\n// your concern, don't allow them. The same is essentially true for style tags\n// which have their own collection of XSS vectors.\nresult+=text;}else{var escaped=escapeHtml(text,false);if(options.textFilter){result+=options.textFilter(escaped,tag);}else{result+=escaped;}}if(stack.length){var frame=stack[stack.length-1];frame.text+=text;}},onclosetag:function onclosetag(name){if(skipText){skipTextDepth--;if(!skipTextDepth){skipText=false;}else{return;}}var frame=stack.pop();if(!frame){// Do not crash on bad markup\nreturn;}skipText=false;depth--;var skip=skipMap[depth];if(skip){delete skipMap[depth];if(options.disallowedTagsMode==='discard'){frame.updateParentNodeText();return;}tempResult=result;result='';}if(transformMap[depth]){name=transformMap[depth];delete transformMap[depth];}if(options.exclusiveFilter&&options.exclusiveFilter(frame)){result=result.substr(0,frame.tagPosition);return;}frame.updateParentNodeText();if(options.selfClosing.indexOf(name)!==-1){// Already output />\nreturn;}result+=\"</\"+name+\">\";if(skip){result=tempResult+escapeHtml(result);tempResult='';}}},options.parser);parser.write(html);parser.end();return result;function escapeHtml(s,quote){if(typeof s!=='string'){s=s+'';}if(options.parser.decodeEntities){s=s.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/\\>/g,'&gt;');if(quote){s=s.replace(/\\\"/g,'&quot;');}}// TODO: this is inadequate because it will pass `&0;`. This approach\n// will not work, each & must be considered with regard to whether it\n// is followed by a 100% syntactically valid entity or not, and escaped\n// if it is not. If this bothers you, don't set parser.decodeEntities\n// to false. (The default is true.)\ns=s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,'&amp;')// Match ampersands not part of existing HTML entity\n.replace(/</g,'&lt;').replace(/\\>/g,'&gt;');if(quote){s=s.replace(/\\\"/g,'&quot;');}return s;}function naughtyHref(name,href){// Browsers ignore character codes of 32 (space) and below in a surprising\n// number of situations. Start reading here:\n// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n// eslint-disable-next-line no-control-regex\nhref=href.replace(/[\\x00-\\x20]+/g,'');// Clobber any comments in URLs, which the browser might\n// interpret inside an XML data island, allowing\n// a javascript: URL to be snuck through\nhref=href.replace(/<\\!\\-\\-.*?\\-\\-\\>/g,'');// Case insensitive so we don't get faked out by JAVASCRIPT #1\nvar matches=href.match(/^([a-zA-Z]+)\\:/);if(!matches){// Protocol-relative URL starting with any combination of '/' and '\\'\nif(href.match(/^[\\/\\\\]{2}/)){return!options.allowProtocolRelative;}// No scheme\nreturn false;}var scheme=matches[1].toLowerCase();if(has(options.allowedSchemesByTag,name)){return options.allowedSchemesByTag[name].indexOf(scheme)===-1;}return!options.allowedSchemes||options.allowedSchemes.indexOf(scheme)===-1;}/**\n * Filters user input css properties by whitelisted regex attributes.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - Abstract Syntax Tree with filtered style attributes.\n */function filterCss(abstractSyntaxTree,allowedStyles){if(!allowedStyles){return abstractSyntaxTree;}var filteredAST=cloneDeep(abstractSyntaxTree);var astRules=abstractSyntaxTree.nodes[0];var selectedRule;// Merge global and tag-specific styles into new AST.\nif(allowedStyles[astRules.selector]&&allowedStyles['*']){selectedRule=mergeWith(cloneDeep(allowedStyles[astRules.selector]),allowedStyles['*'],function(objValue,srcValue){if(Array.isArray(objValue)){return objValue.concat(srcValue);}});}else{selectedRule=allowedStyles[astRules.selector]||allowedStyles['*'];}if(selectedRule){filteredAST.nodes[0].nodes=astRules.nodes.reduce(filterDeclarations(selectedRule),[]);}return filteredAST;}/**\n * Extracts the style attribues from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center;font-family:helvetica;\"\n */function stringifyStyleAttributes(filteredAST){return filteredAST.nodes[0].nodes.reduce(function(extractedAttributes,attributeObject){extractedAttributes.push(attributeObject.prop+':'+attributeObject.value);return extractedAttributes;},[]).join(';');}/**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the whitelist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass whitelisting.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */function filterDeclarations(selectedRule){return function(allowedDeclarationsList,attributeObject){// If this property is whitelisted...\nif(selectedRule.hasOwnProperty(attributeObject.prop)){var matchesRegex=selectedRule[attributeObject.prop].some(function(regularExpression){return regularExpression.test(attributeObject.value);});if(matchesRegex){allowedDeclarationsList.push(attributeObject);}}return allowedDeclarationsList;};}function filterClasses(classes,allowed){if(!allowed){// The class attribute is allowed without filtering on this tag\nreturn classes;}classes=classes.split(/\\s+/);return classes.filter(function(clss){return allowed.indexOf(clss)!==-1;}).join(' ');}}// Defaults are accessible to you so that you can use them as a starting point", "parse(language, code) {\n\n let languageObj = this.languages[language],\n replacementStorage = [],\n replaceKey = this.replacerID,\n keyIncrement = 0,\n regex = this.regex;\n\n if (!languageObj || language === 'ignore') {\n return code;\n }\n\n let {\n matchers,\n keywords,\n specials\n } = languageObj;\n\n // saves instances of '<' and '>'\n let parsedCode = htmlSwap(code);\n\n //Go through the matchers, matching each case\n //if matcher has internal expressions to match, go through those too.\n matchers.forEach(matcherToParse => {\n if(matcherToParse in regex) {\n\n let expression = regex[matcherToParse]\n , internalParse = false;\n\n if(expression.outer) {\n internalParse = expression.inner;\n expression = expression.outer;\n }\n\n parsedCode = parsedCode.replace(expression, match => {\n let uniqueReplacementKey = replaceKey + keyIncrement++;\n\n if( !!internalParse && typeof internalParse === 'object' ) {\n\n for(let internalRegex in internalParse) {\n match = simpleParse(match, internalParse[internalRegex], matcherToParse + '-' + internalRegex);\n }\n\n }\n\n //if this match spans over multiple lines we must make sure our spans are closed and re-opened.\n if(expression.multiline) {\n match = match.replace(/(\\r?\\n)/g, '</span>$1<span class=\"panda-' + matcherToParse + '\">');\n }\n\n replacementStorage.push([ uniqueReplacementKey , spanWrap(matcherToParse, match) ]);\n\n return uniqueReplacementKey;\n })\n\n }\n })\n //all \"matcher\" regular expressions have now been matched and replaced with unique keys.\n\n //match keywords\n if(keywords.length > 0) {\n parsedCode = simpleParse(parsedCode, RegExp('\\\\b(?:' + keywords.join('|') + ')\\\\b', 'g'), 'keyword');\n }\n\n //match all special words\n if(specials.length > 0) {\n parsedCode = simpleParse(parsedCode, RegExp('\\\\b(?:' + specials.join('|') + ')\\\\b', 'g'), 'special');\n }\n\n //replace all integers now that strings are removed?\n parsedCode = parsedCode.replace(regex.int, integer => spanWrap('int', integer))\n\n //replace all unique replacmeents with their counter parts\n for(let i = replacementStorage.length, token; (token = replacementStorage[--i]); ) {\n parsedCode = parsedCode.replace( token[0], token[1] );\n }\n\n //add line numbers\n parsedCode = specialCharacters(parsedCode);\n parsedCode = addLines(parsedCode);\n\n\n return parsedCode;\n\n }", "sanitize(htmlStr) {\r\n return DOMPurify.sanitize(htmlStr, {\r\n FORBID_TAGS: ['figure','figcaption']\r\n });\r\n }", "function sanitizeHtml(html, options, _recursing) {\n var result = '';\n\n function Frame(tag, attribs) {\n var that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n\n this.updateParentNodeText = function () {\n if (stack.length) {\n var parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n }\n\n if (!options) {\n options = sanitizeHtml.defaults;\n options.parser = htmlParserDefaults;\n } else {\n options = extend(sanitizeHtml.defaults, options);\n if (options.parser) {\n options.parser = extend(htmlParserDefaults, options.parser);\n } else {\n options.parser = htmlParserDefaults;\n }\n }\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n var nonTextTagsArray = options.nonTextTags || ['script', 'style', 'textarea'];\n var allowedAttributesMap;\n var allowedAttributesGlobMap;\n if (options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function (attributes, tag) {\n allowedAttributesMap[tag] = [];\n var globRegex = [];\n attributes.forEach(function (obj) {\n if (isString(obj) && obj.indexOf('*') >= 0) {\n globRegex.push(quoteRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(obj);\n }\n });\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n });\n }\n var allowedClassesMap = {};\n each(options.allowedClasses, function (classes, tag) {\n // Implicitly allows the class attribute\n if (allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n });\n\n var transformTagsMap = {};\n var transformTagsAll;\n each(options.transformTags, function (transform, tag) {\n var transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === \"string\") {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n var depth = 0;\n var stack = [];\n var skipMap = {};\n var transformMap = {};\n var skipText = false;\n var skipTextDepth = 0;\n\n var parser = new htmlparser.Parser({\n onopentag: function onopentag(name, attribs) {\n if (skipText) {\n skipTextDepth++;\n return;\n }\n var frame = new Frame(name, attribs);\n stack.push(frame);\n\n var skip = false;\n var hasText = frame.text ? true : false;\n var transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if (options.allowedTags && options.allowedTags.indexOf(name) === -1) {\n skip = true;\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n // We want the contents but not this tag\n return;\n }\n result += '<' + name;\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function (value, a) {\n if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {\n // This prevents part of an attribute name in the output from being\n // interpreted as the end of an attribute, or end of a tag.\n delete frame.attribs[a];\n return;\n }\n var parsed;\n // check allowedAttributesMap for the element and attribute and modify the value\n // as necessary if there are specific values defined.\n var passedAllowedAttributesMapCheck = false;\n if (!allowedAttributesMap || has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1 || allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1 || has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a) || allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a)) {\n passedAllowedAttributesMapCheck = true;\n } else if (allowedAttributesMap && allowedAttributesMap[name]) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = allowedAttributesMap[name][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var o = _step.value;\n\n if (isPlainObject(o) && o.name && o.name === a) {\n passedAllowedAttributesMapCheck = true;\n var newValue = '';\n if (o.multiple === true) {\n // verify the values that are allowed\n var splitStrArray = value.split(' ');\n var _iteratorNormalCompletion2 = true;\n var _didIteratorError2 = false;\n var _iteratorError2 = undefined;\n\n try {\n for (var _iterator2 = splitStrArray[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n var s = _step2.value;\n\n if (o.values.indexOf(s) !== -1) {\n if (newValue === '') {\n newValue = s;\n } else {\n newValue += ' ' + s;\n }\n }\n }\n } catch (err) {\n _didIteratorError2 = true;\n _iteratorError2 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion2 && _iterator2.return) {\n _iterator2.return();\n }\n } finally {\n if (_didIteratorError2) {\n throw _iteratorError2;\n }\n }\n }\n } else if (o.values.indexOf(value) >= 0) {\n // verified an allowed value matches the entire attribute value\n newValue = value;\n }\n value = newValue;\n }\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n }\n if (passedAllowedAttributesMapCheck) {\n if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n if (name === 'iframe' && a === 'src') {\n //Check if value contains proper hostname prefix\n if (value.substring(0, 2) === '//') {\n var prefix = 'https:';\n value = prefix.concat(value);\n }\n try {\n parsed = url.parse(value);\n if (options.allowedIframeHostnames) {\n var whitelistedHostnames = options.allowedIframeHostnames.find(function (hostname) {\n return hostname === parsed.hostname;\n });\n if (!whitelistedHostnames) {\n delete frame.attribs[a];\n return;\n }\n }\n } catch (e) {\n // Unparseable iframe src\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'srcset') {\n try {\n parsed = srcset.parse(value);\n each(parsed, function (value) {\n if (naughtyHref('srcset', value.url)) {\n value.evil = true;\n }\n });\n parsed = filter(parsed, function (v) {\n return !v.evil;\n });\n if (!parsed.length) {\n delete frame.attribs[a];\n return;\n } else {\n value = srcset.stringify(filter(parsed, function (v) {\n return !v.evil;\n }));\n frame.attribs[a] = value;\n }\n } catch (e) {\n // Unparseable srcset\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n value = filterClasses(value, allowedClassesMap[name]);\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'style') {\n try {\n var abstractSyntaxTree = postcss.parse(name + \" {\" + value + \"}\");\n var filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);\n\n value = stringifyStyleAttributes(filteredAST);\n\n if (value.length === 0) {\n delete frame.attribs[a];\n return;\n }\n } catch (e) {\n delete frame.attribs[a];\n return;\n }\n }\n result += ' ' + a;\n if (value.length) {\n result += '=\"' + escapeHtml(value) + '\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += \" />\";\n } else {\n result += \">\";\n if (frame.innerText && !hasText && !options.textFilter) {\n result += frame.innerText;\n }\n }\n },\n ontext: function ontext(text) {\n if (skipText) {\n return;\n }\n var lastFrame = stack[stack.length - 1];\n var tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if (tag === 'script' || tag === 'style') {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n var escaped = escapeHtml(text);\n if (options.textFilter) {\n result += options.textFilter(escaped);\n } else {\n result += escaped;\n }\n }\n if (stack.length) {\n var frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function onclosetag(name) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n var frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n skipText = false;\n depth--;\n if (skipMap[depth]) {\n delete skipMap[depth];\n frame.updateParentNodeText();\n return;\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeText();\n\n if (options.selfClosing.indexOf(name) !== -1) {\n // Already output />\n return;\n }\n\n result += \"</\" + name + \">\";\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function escapeHtml(s) {\n if (typeof s !== 'string') {\n s = s + '';\n }\n return s.replace(/\\&/g, '&amp;').replace(/</g, '&lt;').replace(/\\>/g, '&gt;').replace(/\\\"/g, '&quot;');\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n href = href.replace(/<\\!\\-\\-.*?\\-\\-\\>/g, '');\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n var matches = href.match(/^([a-zA-Z]+)\\:/);\n if (!matches) {\n // Protocol-relative URL starting with any combination of '/' and '\\'\n if (href.match(/^[\\/\\\\]{2}/)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n var scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n /**\n * Filters user input css properties by whitelisted regex attributes.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - Abstract Syntax Tree with filtered style attributes.\n */\n function filterCss(abstractSyntaxTree, allowedStyles) {\n if (!allowedStyles) {\n return abstractSyntaxTree;\n }\n\n var filteredAST = cloneDeep(abstractSyntaxTree);\n var astRules = abstractSyntaxTree.nodes[0];\n var selectedRule;\n\n // Merge global and tag-specific styles into new AST.\n if (allowedStyles[astRules.selector] && allowedStyles['*']) {\n selectedRule = mergeWith(cloneDeep(allowedStyles[astRules.selector]), allowedStyles['*'], function (objValue, srcValue) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n });\n } else {\n selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];\n }\n\n if (selectedRule) {\n filteredAST.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);\n }\n\n return filteredAST;\n }\n\n /**\n * Extracts the style attribues from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center;font-family:helvetica;\"\n */\n function stringifyStyleAttributes(filteredAST) {\n return filteredAST.nodes[0].nodes.reduce(function (extractedAttributes, attributeObject) {\n extractedAttributes.push(attributeObject.prop + ':' + attributeObject.value + ';');\n return extractedAttributes;\n }, []).join('');\n }\n\n /**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the whitelist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass whitelisting.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */\n function filterDeclarations(selectedRule) {\n return function (allowedDeclarationsList, attributeObject) {\n // If this property is whitelisted...\n if (selectedRule.hasOwnProperty(attributeObject.prop)) {\n var matchesRegex = selectedRule[attributeObject.prop].some(function (regularExpression) {\n return regularExpression.test(attributeObject.value);\n });\n\n if (matchesRegex) {\n allowedDeclarationsList.push(attributeObject);\n }\n }\n return allowedDeclarationsList;\n };\n }\n\n function filterClasses(classes, allowed) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function (clss) {\n return allowed.indexOf(clss) !== -1;\n }).join(' ');\n }\n}", "function sanitizeHtml(html, options, _recursing) {\n var result = '';\n\n function Frame(tag, attribs) {\n var that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n var parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n }\n\n if (!options) {\n options = sanitizeHtml.defaults;\n options.parser = htmlParserDefaults;\n } else {\n options = extend(sanitizeHtml.defaults, options);\n if (options.parser) {\n options.parser = extend(htmlParserDefaults, options.parser);\n } else {\n options.parser = htmlParserDefaults;\n }\n }\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n var nonTextTagsArray = options.nonTextTags || [ 'script', 'style', 'textarea' ];\n var allowedAttributesMap;\n var allowedAttributesGlobMap;\n if(options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n var globRegex = [];\n attributes.forEach(function(name) {\n if(name.indexOf('*') >= 0) {\n globRegex.push(quoteRegexp(name).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(name);\n }\n });\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n });\n }\n var allowedClassesMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if(allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n });\n\n var transformTagsMap = {};\n var transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n var transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === \"string\") {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n var depth = 0;\n var stack = [];\n var skipMap = {};\n var transformMap = {};\n var skipText = false;\n var skipTextDepth = 0;\n\n var parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n if (skipText) {\n skipTextDepth++;\n return;\n }\n var frame = new Frame(name, attribs);\n stack.push(frame);\n\n var skip = false;\n var hasText = frame.text ? true : false;\n var transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if (options.allowedTags && options.allowedTags.indexOf(name) === -1) {\n skip = true;\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n // We want the contents but not this tag\n return;\n }\n result += '<' + name;\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1 ) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1 ) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n if ((a === 'href') || (a === 'src')) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n value = filterClasses(value, allowedClassesMap[name]);\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n result += ' ' + a;\n if (value.length) {\n result += '=\"' + escapeHtml(value) + '\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += \" />\";\n } else {\n result += \">\";\n if (frame.innerText && !hasText && !options.textFilter) {\n result += frame.innerText;\n }\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n var lastFrame = stack[stack.length-1];\n var tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if ((tag === 'script') || (tag === 'style')) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n var escaped = escapeHtml(text);\n if (options.textFilter) {\n result += options.textFilter(escaped);\n } else {\n result += escaped;\n }\n }\n if (stack.length) {\n var frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n var frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n skipText = false;\n depth--;\n if (skipMap[depth]) {\n delete skipMap[depth];\n frame.updateParentNodeText();\n return;\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeText();\n\n if (options.selfClosing.indexOf(name) !== -1) {\n // Already output />\n return;\n }\n\n result += \"</\" + name + \">\";\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function escapeHtml(s) {\n if (typeof(s) !== 'string') {\n s = s + '';\n }\n return s.replace(/\\&/g, '&amp;').replace(/</g, '&lt;').replace(/\\>/g, '&gt;').replace(/\\\"/g, '&quot;');\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n href = href.replace(/<\\!\\-\\-.*?\\-\\-\\>/g, '');\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n var matches = href.match(/^([a-zA-Z]+)\\:/);\n if (!matches) {\n // Protocol-relative URL: \"//some.evil.com/nasty\"\n if (href.match(/^\\/\\//)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n var scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n function filterClasses(classes, allowed) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1;\n }).join(' ');\n }\n}", "function sanitizeHtml(html, options, _recursing) {\n var result = '';\n\n function Frame(tag, attribs) {\n var that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n var parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n }\n\n if (!options) {\n options = sanitizeHtml.defaults;\n options.parser = htmlParserDefaults;\n } else {\n options = extend(sanitizeHtml.defaults, options);\n if (options.parser) {\n options.parser = extend(htmlParserDefaults, options.parser);\n } else {\n options.parser = htmlParserDefaults;\n }\n }\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n var nonTextTagsArray = options.nonTextTags || [ 'script', 'style', 'textarea' ];\n var allowedAttributesMap;\n var allowedAttributesGlobMap;\n if(options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n var globRegex = [];\n attributes.forEach(function(name) {\n if(name.indexOf('*') >= 0) {\n globRegex.push(quoteRegexp(name).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(name);\n }\n });\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n });\n }\n var allowedClassesMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if(allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n });\n\n var transformTagsMap = {};\n var transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n var transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === \"string\") {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n var depth = 0;\n var stack = [];\n var skipMap = {};\n var transformMap = {};\n var skipText = false;\n var skipTextDepth = 0;\n\n var parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n if (skipText) {\n skipTextDepth++;\n return;\n }\n var frame = new Frame(name, attribs);\n stack.push(frame);\n\n var skip = false;\n var hasText = frame.text ? true : false;\n var transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if (options.allowedTags && options.allowedTags.indexOf(name) === -1) {\n skip = true;\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n // We want the contents but not this tag\n return;\n }\n result += '<' + name;\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1 ) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1 ) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n if ((a === 'href') || (a === 'src')) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n value = filterClasses(value, allowedClassesMap[name]);\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n result += ' ' + a;\n if (value.length) {\n result += '=\"' + value + '\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += \" />\";\n } else {\n result += \">\";\n if (frame.innerText && !hasText && !options.textFilter) {\n result += frame.innerText;\n }\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n var lastFrame = stack[stack.length-1];\n var tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if ((tag === 'script') || (tag === 'style')) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n if (options.textFilter) {\n result += options.textFilter(text);\n } else {\n result += text;\n }\n }\n if (stack.length) {\n var frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n var frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n skipText = false;\n depth--;\n if (skipMap[depth]) {\n delete skipMap[depth];\n frame.updateParentNodeText();\n return;\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeText();\n\n if (options.selfClosing.indexOf(name) !== -1) {\n // Already output />\n return;\n }\n\n result += \"</\" + name + \">\";\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n href = href.replace(/<\\!\\-\\-.*?\\-\\-\\>/g, '');\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n var matches = href.match(/^([a-zA-Z]+)\\:/);\n if (!matches) {\n // No scheme = no way to inject js (right?)\n return false;\n }\n var scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n function filterClasses(classes, allowed) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1;\n }).join(' ');\n }\n}", "function postprocessHtml(renderedMarkdown, preprocessInfo) {\n var i;\n for (i = 0; i < preprocessInfo.exclusions.length; i++) {\n renderedMarkdown = renderedMarkdown.replace(preprocessInfo.exclusions[i].placeholder,\n preprocessInfo.exclusions[i].content);\n }\n\n return renderedMarkdown;\n }", "function beautifyHTML(code, level, insideLastBlock, dictionary) {\n var openTag = code.indexOf('<');\n var closeTag = code.indexOf('>');\n var chunk;\n\n if (openTag === 0) {\n //first thing is a tag\n chunk = code.substring(0, closeTag + 1);\n code = code.substring(closeTag + 1);\n\n if (chunk.indexOf(\"</\") === 0) {\n level--;\n nsideLastBlock = false;\n } else {\n if (insideLastBlock) {\n level++;\n }\n\n //check if current tag is a self closing tag (no indent next line in this case)\n var found = false;\n\n for (var i = 0; i < dictionary.length; i++) {\n if (chunk.indexOf(dictionary[i]) === 0) {\n found = true;\n break;\n }\n }\n if (!found) {\n insideLastBlock = true;\n } else {\n insideLastBlock = false;\n }\n }\n } else {\n //first thing is content\n chunk = code.substring(0, openTag);\n code = code.substring(openTag);\n\n if (insideLastBlock) {\n level++;\n }\n insideLastBlock = false;\n }\n chunk = new Array(level + 1).join(' ') + chunk.trim();\n\n //console.log(level);\n //console.log(chunk);\n //console.log(code);\n\n if (code.length === 0) {\n return chunk;\n }\n return chunk + \"\\n\" + beautifyHTML(code.trim(), level, insideLastBlock, dictionary);\n }", "interpretHTML(a) {\n // CUT OUT IMGS TO ACCOUNT FOR MORE THAN 1 & STYLE ACCORDINGLY\n let _complete;\n let _imgs = a.match(/<img.*>/g, '');\n let _text = a.replace(/<img.*>/g, '');\n let _temp = [\"<div class='markedWrapper'>\"];\n\n if(_imgs === null){\n _temp.push(_text);\n }else if(_imgs.length > 1){\n _temp.push(_text.concat(this.handleImgs(_imgs)));\n }else{\n _temp.push(this.handleImgs(_imgs).concat(_text));\n }\n _temp.push(\"</div>\")\n _complete = _temp.join('');\n return {__html: _complete};\n }", "function sanitizeHtml(html, options, _recursing) {\n let result = '';\n // Used for hot swapping the result variable with an empty string in order to \"capture\" the text written to it.\n let tempResult = '';\n\n function Frame(tag, attribs) {\n const that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n this.mediaChildren = [];\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n\n this.updateParentNodeMediaChildren = function() {\n if (stack.length && mediaTags.includes(this.tag)) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.mediaChildren.push(this.tag);\n }\n };\n }\n\n if (!options) {\n options = sanitizeHtml.defaults;\n options.parser = htmlParserDefaults;\n } else {\n options = Object.assign({}, sanitizeHtml.defaults, options);\n if (options.parser) {\n options.parser = Object.assign({}, htmlParserDefaults, options.parser);\n } else {\n options.parser = htmlParserDefaults;\n }\n }\n // vulnerableTags\n vulnerableTags.forEach(function (tag) {\n if (\n options.allowedTags && options.allowedTags.indexOf(tag) > -1 &&\n !options.allowVulnerableTags\n ) {\n console.warn(`\\n\\n⚠️ Your \\`allowedTags\\` option includes, \\`${tag}\\`, which is inherently\\nvulnerable to XSS attacks. Please remove it from \\`allowedTags\\`.\\nOr, to disable this warning, add the \\`allowVulnerableTags\\` option\\nand ensure you are accounting for this risk.\\n\\n`);\n }\n });\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n const nonTextTagsArray = options.nonTextTags || [\n 'script',\n 'style',\n 'textarea',\n 'option'\n ];\n let allowedAttributesMap;\n let allowedAttributesGlobMap;\n if (options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n const globRegex = [];\n attributes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(obj);\n }\n });\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n });\n }\n const allowedClassesMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if (allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n });\n\n const transformTagsMap = {};\n let transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n let transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === 'string') {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n let depth;\n let stack;\n let skipMap;\n let transformMap;\n let skipText;\n let skipTextDepth;\n let addedText = false;\n\n initializeState();\n\n const parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n // If `enforceHtmlBoundary` is `true` and this has found the opening\n // `html` tag, reset the state.\n if (options.enforceHtmlBoundary && name === 'html') {\n initializeState();\n }\n\n if (skipText) {\n skipTextDepth++;\n return;\n }\n const frame = new Frame(name, attribs);\n stack.push(frame);\n\n let skip = false;\n const hasText = !!frame.text;\n let transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if ((options.allowedTags && options.allowedTags.indexOf(name) === -1) || (options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap)) || (options.nestingLimit != null && depth >= options.nestingLimit)) {\n skip = true;\n skipMap[depth] = true;\n if (options.disallowedTagsMode === 'discard') {\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n if (options.disallowedTagsMode === 'discard') {\n // We want the contents but not this tag\n return;\n }\n tempResult = result;\n result = '';\n }\n result += '<' + name;\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {\n // This prevents part of an attribute name in the output from being\n // interpreted as the end of an attribute, or end of a tag.\n delete frame.attribs[a];\n return;\n }\n let parsed;\n // check allowedAttributesMap for the element and attribute and modify the value\n // as necessary if there are specific values defined.\n let passedAllowedAttributesMapCheck = false;\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n passedAllowedAttributesMapCheck = true;\n } else if (allowedAttributesMap && allowedAttributesMap[name]) {\n for (const o of allowedAttributesMap[name]) {\n if (isPlainObject(o) && o.name && (o.name === a)) {\n passedAllowedAttributesMapCheck = true;\n let newValue = '';\n if (o.multiple === true) {\n // verify the values that are allowed\n const splitStrArray = value.split(' ');\n for (const s of splitStrArray) {\n if (o.values.indexOf(s) !== -1) {\n if (newValue === '') {\n newValue = s;\n } else {\n newValue += ' ' + s;\n }\n }\n }\n } else if (o.values.indexOf(value) >= 0) {\n // verified an allowed value matches the entire attribute value\n newValue = value;\n }\n value = newValue;\n }\n }\n }\n if (passedAllowedAttributesMapCheck) {\n if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n if (name === 'iframe' && a === 'src') {\n let allowed = true;\n try {\n // naughtyHref is in charge of whether protocol relative URLs\n // are cool. We should just accept them\n // TODO: Replace deprecated `url.parse`\n // eslint-disable-next-line node/no-deprecated-api\n parsed = url.parse(value, false, true);\n const isRelativeUrl = parsed && parsed.host === null && parsed.protocol === null;\n if (isRelativeUrl) {\n // default value of allowIframeRelativeUrls is true\n // unless allowedIframeHostnames or allowedIframeDomains specified\n allowed = has(options, 'allowIframeRelativeUrls')\n ? options.allowIframeRelativeUrls\n : (!options.allowedIframeHostnames && !options.allowedIframeDomains);\n } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {\n const allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {\n return hostname === parsed.hostname;\n });\n const allowedDomain = (options.allowedIframeDomains || []).find(function(domain) {\n return parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n // Unparseable iframe src\n allowed = false;\n }\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'srcset') {\n try {\n parsed = parseSrcset(value);\n parsed.forEach(function(value) {\n if (naughtyHref('srcset', value.url)) {\n value.evil = true;\n }\n });\n parsed = filter(parsed, function(v) {\n return !v.evil;\n });\n if (!parsed.length) {\n delete frame.attribs[a];\n return;\n } else {\n value = stringifySrcset(filter(parsed, function(v) {\n return !v.evil;\n }));\n frame.attribs[a] = value;\n }\n } catch (e) {\n // Unparseable srcset\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n const allowedSpecificClasses = allowedClassesMap[name];\n const allowedWildcardClasses = allowedClassesMap['*'];\n if (allowedSpecificClasses && allowedWildcardClasses) {\n value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses));\n } else {\n value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses);\n }\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'style') {\n try {\n const abstractSyntaxTree = postcssParse(name + ' {' + value + '}');\n const filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);\n\n value = stringifyStyleAttributes(filteredAST);\n\n if (value.length === 0) {\n delete frame.attribs[a];\n return;\n }\n } catch (e) {\n delete frame.attribs[a];\n return;\n }\n }\n result += ' ' + a;\n if (value && value.length) {\n result += '=\"' + escapeHtml(value, true) + '\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += ' />';\n } else {\n result += '>';\n if (frame.innerText && !hasText && !options.textFilter) {\n result += escapeHtml(frame.innerText);\n addedText = true;\n }\n }\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n const lastFrame = stack[stack.length - 1];\n let tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if (options.disallowedTagsMode === 'discard' && ((tag === 'script') || (tag === 'style'))) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n const escaped = escapeHtml(text, false);\n if (options.textFilter && !addedText) {\n result += options.textFilter(escaped, tag);\n } else if (!addedText) {\n result += escaped;\n }\n }\n if (stack.length) {\n const frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n const frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n skipText = options.enforceHtmlBoundary ? name === 'html' : false;\n depth--;\n const skip = skipMap[depth];\n if (skip) {\n delete skipMap[depth];\n if (options.disallowedTagsMode === 'discard') {\n frame.updateParentNodeText();\n return;\n }\n tempResult = result;\n result = '';\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeMediaChildren();\n frame.updateParentNodeText();\n\n if (options.selfClosing.indexOf(name) !== -1) {\n // Already output />\n if (skip) {\n result = tempResult;\n tempResult = '';\n }\n return;\n }\n\n result += '</' + name + '>';\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function initializeState() {\n result = '';\n depth = 0;\n stack = [];\n skipMap = {};\n transformMap = {};\n skipText = false;\n skipTextDepth = 0;\n }\n\n function escapeHtml(s, quote) {\n if (typeof (s) !== 'string') {\n s = s + '';\n }\n if (options.parser.decodeEntities) {\n s = s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n if (quote) {\n s = s.replace(/\"/g, '&quot;');\n }\n }\n // TODO: this is inadequate because it will pass `&0;`. This approach\n // will not work, each & must be considered with regard to whether it\n // is followed by a 100% syntactically valid entity or not, and escaped\n // if it is not. If this bothers you, don't set parser.decodeEntities\n // to false. (The default is true.)\n s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&amp;') // Match ampersands not part of existing HTML entity\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;');\n if (quote) {\n s = s.replace(/\"/g, '&quot;');\n }\n return s;\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n // eslint-disable-next-line no-control-regex\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n href = href.replace(/<!--.*?-->/g, '');\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n const matches = href.match(/^([a-zA-Z]+):/);\n if (!matches) {\n // Protocol-relative URL starting with any combination of '/' and '\\'\n if (href.match(/^[/\\\\]{2}/)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n const scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n /**\n * Filters user input css properties by whitelisted regex attributes.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - Abstract Syntax Tree with filtered style attributes.\n */\n function filterCss(abstractSyntaxTree, allowedStyles) {\n if (!allowedStyles) {\n return abstractSyntaxTree;\n }\n\n const filteredAST = klona(abstractSyntaxTree);\n const astRules = abstractSyntaxTree.nodes[0];\n let selectedRule;\n\n // Merge global and tag-specific styles into new AST.\n if (allowedStyles[astRules.selector] && allowedStyles['*']) {\n selectedRule = deepmerge(\n allowedStyles[astRules.selector],\n allowedStyles['*']\n );\n } else {\n selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];\n }\n\n if (selectedRule) {\n filteredAST.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);\n }\n\n return filteredAST;\n }\n\n /**\n * Extracts the style attribues from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center;font-family:helvetica;\"\n */\n function stringifyStyleAttributes(filteredAST) {\n return filteredAST.nodes[0].nodes\n .reduce(function(extractedAttributes, attributeObject) {\n extractedAttributes.push(\n attributeObject.prop + ':' + attributeObject.value\n );\n return extractedAttributes;\n }, [])\n .join(';');\n }\n\n /**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the whitelist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass whitelisting.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */\n function filterDeclarations(selectedRule) {\n return function (allowedDeclarationsList, attributeObject) {\n // If this property is whitelisted...\n if (has(selectedRule, attributeObject.prop)) {\n const matchesRegex = selectedRule[attributeObject.prop].some(function(regularExpression) {\n return regularExpression.test(attributeObject.value);\n });\n\n if (matchesRegex) {\n allowedDeclarationsList.push(attributeObject);\n }\n }\n return allowedDeclarationsList;\n };\n }\n\n function filterClasses(classes, allowed) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1;\n }).join(' ');\n }\n}", "function createReplacements() { // 4301\n return [ // 4302\n // replace two bogus tags that begin pastes from google docs\n [new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi), ''], // 4304\n [new RegExp(/<\\/b>(<br[^>]*>)?$/gi), ''], // 4305\n // 4306\n // un-html spaces and newlines inserted by OS X // 4307\n [new RegExp(/<span class=\"Apple-converted-space\">\\s+<\\/span>/g), ' '],\n [new RegExp(/<br class=\"Apple-interchange-newline\">/g), '<br>'],\n // 4310\n // replace google docs italics+bold with a span to be replaced once the html is inserted\n [new RegExp(/<span[^>]*(font-style:italic;font-weight:bold|font-weight:bold;font-style:italic)[^>]*>/gi), '<span class=\"replace-with italic bold\">'],\n // 4313\n // replace google docs italics with a span to be replaced once the html is inserted\n [new RegExp(/<span[^>]*font-style:italic[^>]*>/gi), '<span class=\"replace-with italic\">'],\n // 4316\n //[replace google docs bolds with a span to be replaced once the html is inserted\n [new RegExp(/<span[^>]*font-weight:bold[^>]*>/gi), '<span class=\"replace-with bold\">'],\n // 4319\n // replace manually entered b/i/a tags with real ones // 4320\n [new RegExp(/&lt;(\\/?)(i|b|a)&gt;/gi), '<$1$2>'], // 4321\n // 4322\n // replace manually a tags with real ones, converting smart-quotes from google docs\n [new RegExp(/&lt;a(?:(?!href).)+href=(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(((?!&quot;|&rdquo;|&ldquo;|\"|“|”).)*)(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(?:(?!&gt;).)*&gt;/gi), '<a href=\"$1\">'],\n // 4325\n // Newlines between paragraphs in html have no syntactic value,\n // but then have a tendency to accidentally become additional paragraphs down the line\n [new RegExp(/<\\/p>\\n+/gi), '</p>'], // 4328\n [new RegExp(/\\n+<p/gi), '<p'], // 4329\n // 4330\n // Microsoft Word makes these odd tags, like <o:p></o:p> // 4331\n [new RegExp(/<\\/?o:[a-z]*>/gi), ''], // 4332\n // 4333\n // cleanup comments added by Chrome when pasting html // 4334\n ['<!--EndFragment-->', ''], // 4335\n ['<!--StartFragment-->', ''] // 4336\n ]; // 4337\n } // 4338", "function initRegex() {\n if (typeof general_regex !== 'undefined') {\n return;\n }\n\n regexs = {};\n regex_raw = '~';\n regex_not_raw = `(?<!${regex_raw})`;\n\n // Update lookarounds regex\n lookaround_regexs = {\n 'block': new RegExp(`${regex_not_raw}(?=\\\\{\\\\[)( ?){1,}block( ?){1,}([^\\\\]\\\\}]*)( ?){1,}(?<=\\\\]\\\\})([\\\\s\\\\S]*?)(\\\\{\\\\[)( ?){1,}endblock( ?){1,}(\\\\]\\\\})`),\n 'parent': new RegExp(`${regex_not_raw}(?=\\\\{\\\\[)( ?){1,}parent([^\\\\]\\\\}]*)(?<=\\\\]\\\\})`),\n 'spread_block': new RegExp(`${regex_not_raw}(?=\\\\{\\\\[)( ?){1,}spread( ?){1,}([^\\\\]\\\\}]*)( ?){1,}(?<=\\\\]\\\\})([\\\\s\\\\S]*?)(\\\\{\\\\[)( ?){1,}endspread( ?){1,}(\\\\]\\\\})`),\n 'extends': new RegExp(`${regex_not_raw}(?=@extends\\\\()(.*)(?<=\\\\))`),\n 'require': new RegExp(`${regex_not_raw}(?=@require\\\\()(.*)(?<=\\\\))`),\n 'spread': new RegExp(`${regex_not_raw}(?=@spread\\\\()(.*)(?<=\\\\))`),\n 'comment': new RegExp(`${regex_not_raw}(?={#)([\\\\s\\\\S]*?)(?<=#})`),\n 'print_plain': new RegExp(`${regex_not_raw}(?={!)(.*?)(?<=!})`),\n 'print': new RegExp(`${regex_not_raw}(?={{)(.*?)(?<=}})`),\n 'code': new RegExp(`${regex_not_raw}(?={%)(.*?)(?<=%})`),\n 'code_begin': new RegExp(`${regex_not_raw}(?={%)(.*?)(?<=:( ?){1,}%})`),\n 'code_end': new RegExp(`${regex_not_raw}(?={%)( ?){1,}end( ?){1,}(?<=%})`)\n }\n\n updateNormalRegex();\n updateGeneralRegex();\n}", "function autoEdExtraBreaks(str) { //MAIN FUNCTION describes list of fixes\n \n//Usually unneeded BR tags from ends of image descriptions and wikilinks (]]), templates (}}), template parameters (|)\nstr = str.replace(/[\\t ]*<[\\s\\/\\.]*br[\\s\\/\\.]*>[\\t ]*([\\t\\n ]*?)(\\]\\]|}}|\\|)/gim, '$1$2');\n//BR tag before a list item\nstr = str.replace(/[\\t ]*<[\\s\\/\\.]*br[\\s\\/\\.]*>[\\t ]*([\\s]*?[\\n]\\*)/gim, '$1');\n//BR tag followed by at least two newlines\nstr = str.replace(/[\\t ]*<[\\s\\/\\.]*br[\\s\\/\\.]*>[\\t ]*([\\n])[\\t ]*([\\n])/gim, '$1$2');\n \nreturn str;\n}", "static tag_lines(raw)\r\n {\r\n let lines = [];\r\n let next_is_def = false;\r\n let in_code_block = false;\r\n let in_quote_block = false;\r\n for (const [index, value] of raw.entries())\r\n {\r\n let trimmed = value.trim();\r\n if (in_code_block)\r\n {\r\n lines.push(new Line(value, 'code'))\r\n }\r\n else if (in_quote_block)\r\n {\r\n lines.push(new Line(value, 'quote'))\r\n }\r\n else if (trimmed.length === 0)\r\n {\r\n lines.push(new Line('', 'empty'));\r\n }\r\n // Titles :\r\n else if (trimmed[0] === '#')\r\n {\r\n lines.push(new Line(trimmed, 'title'));\r\n }\r\n // HR :\r\n else if ((trimmed.match(/-/g)||[]).length === trimmed.length)\r\n {\r\n lines.push(new Line('', 'separator'));\r\n }\r\n // Lists, line with the first non empty character is \"* \" or \"+ \" or \"- \" :\r\n else if (trimmed.substring(0, 2) === '* ')\r\n {\r\n lines.push(new Line(value, 'unordered_list'));\r\n }\r\n else if (trimmed.substring(0, 2) === '+ ')\r\n {\r\n lines.push(new Line(value, 'ordered_list'));\r\n }\r\n else if (trimmed.substring(0, 2) === '- ')\r\n {\r\n lines.push(new Line(value, 'reverse_list'));\r\n }\r\n // Keywords, line with the first non empty character is \"!\" :\r\n // var, const, include, require, css, html, comment\r\n else if (trimmed.startsWith('!var '))\r\n {\r\n lines.push(new Line(trimmed, 'var'));\r\n }\r\n else if (trimmed.startsWith('!const '))\r\n {\r\n lines.push(new Line(trimmed, 'const'));\r\n }\r\n else if (trimmed.startsWith('!include '))\r\n {\r\n lines.push(new Line(trimmed, 'include'));\r\n }\r\n else if (trimmed.startsWith('!require '))\r\n {\r\n lines.push(new Line(trimmed, 'require'));\r\n }\r\n else if (trimmed.startsWith('!css '))\r\n {\r\n lines.push(new Line(trimmed, 'css'));\r\n }\r\n else if (trimmed.startsWith('!html'))\r\n {\r\n lines.push(new Line(trimmed, 'html'));\r\n }\r\n else if (trimmed.substring(0, 2) === '//')\r\n {\r\n lines.push(new Line(trimmed, 'comment'));\r\n }\r\n // Block of code\r\n else if (trimmed.substring(0, 2) === '@@@')\r\n {\r\n in_code_block = !in_code_block;\r\n lines.push(new Line(value, 'code'))\r\n }\r\n else if (trimmed.substring(0, 2) === '@@' && trimmed.substring(trimmed.length-2, trimmed.length) !== '@@') // :TODO: Escaping @@ in code for Ruby. @@code@@ should be a <p> not a <pre>!\r\n {\r\n lines.push(new Line(value, 'code'));\r\n }\r\n // Block of quote\r\n else if (trimmed.substring(0, 2) === '>>>')\r\n {\r\n in_quote_block = !in_quote_block;\r\n lines.push(new Line(value, 'quote'))\r\n }\r\n else if (trimmed.substring(0, 2) === '>>')\r\n {\r\n lines.push(new Line(value, 'quote'));\r\n }\r\n // Labels\r\n else if (trimmed.substring(0, 2) === '::')\r\n {\r\n lines.push(new Line(trimmed, 'label'));\r\n }\r\n // Div (Si la ligne entière est {{ }}, c'est une div. On ne fait pas de span d'une ligne)\r\n else if (trimmed.substring(0, 2) === '{{' && trimmed.substring(trimmed.length - 2) === '}}')\r\n {\r\n lines.push(new Line(trimmed, 'div'));\r\n }\r\n // Tables\r\n else if (trimmed[0] === '|' && trimmed[trimmed.length - 1] === '|')\r\n {\r\n lines.push(new Line(trimmed, 'row'));\r\n }\r\n // Definition lists\r\n else if (trimmed.substring(0, 2) === '$ ')\r\n {\r\n lines.push(new Line(trimmed.substring(2), 'definition-header'));\r\n next_is_def = true;\r\n }\r\n else\r\n {\r\n if (!next_is_def)\r\n {\r\n lines.push(new Line(trimmed, 'text'));\r\n }\r\n else\r\n {\r\n lines.push(new Line(trimmed, 'definition-content'));\r\n next_is_def = false;\r\n }\r\n }\r\n }\r\n return lines;\r\n }", "function parseWithRegex(post) {\n\t\tvar html = post.innerHTML;\n\n\t\t// Replace all titles (h1/h2/etc), regex explanation:\n\t\t// ^[\\s]* - Line can start with spaces, we ignore those\n\t\t// ([#]+) - Match a sequence of #\n\t\t// (?:\\s)* - After the hash we can have many spaces, we ignore those\n\t\t// (.*?)(?:<br>)?$ - Then match everything in non-greedy mode (as little as possible) until the end, line can end\n\t\t// with <br> so we ignore it\n\t\thtml = html.replace(/^[\\s]*([#]+)(?:\\s)*(.*?)(?:<br>)?$/gm, function(match, hashes, title) {\n\t\t\tvar headerLevel = hashes.length;\n\t\t\treturn '<h' + headerLevel + '>' + title + '</h' + headerLevel + '>'\n\t\t});\n\n\t\t// Replace all code blocks, regex explanation:\n\t\t// ^``` - line should start with ```\n\t\t// ([a-zA-Z]+)? - Then optionally we could have a language (characters only)\n\t\t// ((?:.|\\n)*?)``` - Then we match anything until ```, since '.' doesn't match \\n we need (.|\\n),\n\t\t// and we don't want that brackets in the match so adding ?:\n\t\t// and we want to match until first occurrence of ``` (non-greedy) so adding *?\n\t\t// (?:\\<br>)?$ - Then we expect br tag or end-of-line\n\t\thtml = html.replace(/^```([a-zA-Z]+)?((?:.|\\n)*?)```(?:<br>)?$/gm, '<pre><code class=\"$1\">$2</code></pre>');\n\n\t\t// Next replace code quotes, regex explanation:\n\t\t// Match anything between backticks, the character before the closing backtick should not be \"\\\" (escaped backtick)\n\t\thtml = html.replace(/`(.*?[^\\\\])`/g, '<code>$1</code>');\n\n\t\t// Next replace all escaped backticks (\\`) with backticks\n\t\thtml = html.replace(/\\\\`/g, '`');\n\n\t\tpost.innerHTML = html;\n\n\t\t// Loop thru all the created code blocks and remove all <br>, also remove the first \"\\n\"\n\t\tvar codes = post.querySelectorAll('pre > code');\n\t\tfor (var i = 0; i < codes.length; ++i) {\n\t\t\tvar code = codes[i].innerHTML;\n\t\t\tcode = code.replace(/<br>/g, '').replace(/^\\n/, '');\n\t\t\tcodes[i].innerHTML = code;\n\t\t}\n\t}", "function unhtmlify(original) {\n original = original.trim();\n // Also remove any newlines, adding a space if there was none otherwise.\n original = original.replace(/( (\\r\\n|\\n|\\r)+|(\\r\\n|\\n|\\r)+ |(\\r\\n|\\n|\\r)+)/gm,\" \");\n var testversion = original.replace(/^ *<p>/i, '').replace(/<\\/p> *$/i, '');\n if(!html_only_regex.test(testversion)) {\n testversion = dounescape(testversion);\n if(!html_regex.test(testversion)) return testversion;\n }\n return original;\n}", "function highlightCode() {\n\n \tvar htmlcode_div = document.getElementById(\"htmlcode_div\");\n\n \tvar html_content = htmlcode_div.innerHTML;\n \tvar open_highlight = \"<pre class='language-xml wrs_inline' style='word-wrap:break-word;background-color:white'><code>\";\n \tvar close_highlight = \"</code></pre>\";\n\n \tif (_wrs_conf_saveMode == \"xml\") {\n\n \t\t/* Format the MATH tags */\n\n \t\tvar indexs_end = html_content.getMatchIndices(\"&lt;/math&gt;\");\n\n \t\tfor (var i = indexs_end.length - 1; i >= 0; i--) {\n \t\t\tvar actual_index_end = indexs_end[i] + 13;\n \t\t\thtml_content = html_content.splice(actual_index_end, 0, close_highlight);\n \t\t}\n\n \t\tvar indexs_start = html_content.getMatchIndices(\"&lt;math\");\n\n \t\tfor (var i = indexs_start.length - 1; i >= 0; i--) {\n \t\t\tvar actual_index_start = indexs_start[i];\n \t\t\thtml_content = html_content.splice(actual_index_start, 0, open_highlight);\n \t\t}\n\n\n \t}\n \telse if (_wrs_conf_saveMode == \"image\" || _wrs_conf_saveMode == \"base64\") {\n\n \t\t/* Format the IMG and BASE64 */\n \t\tconsole.log(\"IMAGE MODE\");\n\n \t\tvar indexs_start = html_content.getMatchIndices(\"&lt;img\");\n \t\tif (indexs_start == 0){\n \t\t\tindexs_start = html_content.getMatchIndices(\"&lt;IMG\");\n \t\t}\n \t\tvar indexs_end = [];\n\n \t\tfor (var i = indexs_start.length - 1; i >= 0; i--) {\n \t\t\tvar actual_index_start = indexs_start[i];\n\n \t\t\tfor (var j = actual_index_start; j < html_content.length - 4; j++) {\n \t\t\t\tif (html_content[j] == \"&\" && html_content[j+1] == \"g\" && html_content[j+2] == \"t\" && html_content[j+3] == \";\"){\n \t\t\t\t\thtml_content = html_content.splice(j+4, 0, close_highlight);\n \t\t\t\t\tbreak;\n \t\t\t\t}\n \t\t\t}\n\n \t\t\thtml_content = html_content.splice(actual_index_start, 0, open_highlight);\n \t\t}\n\n \t}\n\n \thtmlcode_div.innerHTML = html_content;\n\n\t// Prism library. For demo purposes.\n\tPrism.highlightAll();\n}", "function createReplacements() {\n\t return [\n\t // Remove anything but the contents within the BODY element\n\t [new RegExp(/^[\\s\\S]*<body[^>]*>\\s*|\\s*<\\/body[^>]*>[\\s\\S]*$/g), ''],\n\n\t // cleanup comments added by Chrome when pasting html\n\t [new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g), ''],\n\n\t // Trailing BR elements\n\t [new RegExp(/<br>$/i), ''],\n\n\t // replace two bogus tags that begin pastes from google docs\n\t [new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi), ''],\n\t [new RegExp(/<\\/b>(<br[^>]*>)?$/gi), ''],\n\n\t // un-html spaces and newlines inserted by OS X\n\t [new RegExp(/<span class=\"Apple-converted-space\">\\s+<\\/span>/g), ' '],\n\t [new RegExp(/<br class=\"Apple-interchange-newline\">/g), '<br>'],\n\n\t // replace google docs italics+bold with a span to be replaced once the html is inserted\n\t [new RegExp(/<span[^>]*(font-style:italic;font-weight:bold|font-weight:bold;font-style:italic)[^>]*>/gi), '<span class=\"replace-with italic bold\">'],\n\n\t // replace google docs italics with a span to be replaced once the html is inserted\n\t [new RegExp(/<span[^>]*font-style:italic[^>]*>/gi), '<span class=\"replace-with italic\">'],\n\n\t //[replace google docs bolds with a span to be replaced once the html is inserted\n\t [new RegExp(/<span[^>]*font-weight:bold[^>]*>/gi), '<span class=\"replace-with bold\">'],\n\n\t // replace manually entered b/i/a tags with real ones\n\t [new RegExp(/&lt;(\\/?)(i|b|a)&gt;/gi), '<$1$2>'],\n\n\t // replace manually a tags with real ones, converting smart-quotes from google docs\n\t [new RegExp(/&lt;a(?:(?!href).)+href=(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(((?!&quot;|&rdquo;|&ldquo;|\"|“|”).)*)(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(?:(?!&gt;).)*&gt;/gi), '<a href=\"$1\">'],\n\n\t // Newlines between paragraphs in html have no syntactic value,\n\t // but then have a tendency to accidentally become additional paragraphs down the line\n\t [new RegExp(/<\\/p>\\n+/gi), '</p>'],\n\t [new RegExp(/\\n+<p/gi), '<p'],\n\n\t // Microsoft Word makes these odd tags, like <o:p></o:p>\n\t [new RegExp(/<\\/?o:[a-z]*>/gi), ''],\n\n\t // Microsoft Word adds some special elements around list items\n\t [new RegExp(/<!\\[if !supportLists\\]>(((?!<!).)*)<!\\[endif]\\>/gi), '$1']\n\t ];\n\t }", "function createReplacements() {\r\n return [\r\n // Remove anything but the contents within the BODY element\r\n [new RegExp(/^[\\s\\S]*<body[^>]*>\\s*|\\s*<\\/body[^>]*>[\\s\\S]*$/g), ''],\r\n\r\n // cleanup comments added by Chrome when pasting html\r\n [new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g), ''],\r\n\r\n // Trailing BR elements\r\n [new RegExp(/<br>$/i), ''],\r\n\r\n // replace two bogus tags that begin pastes from google docs\r\n [new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi), ''],\r\n [new RegExp(/<\\/b>(<br[^>]*>)?$/gi), ''],\r\n\r\n // un-html spaces and newlines inserted by OS X\r\n [new RegExp(/<span class=\"Apple-converted-space\">\\s+<\\/span>/g), ' '],\r\n [new RegExp(/<br class=\"Apple-interchange-newline\">/g), '<br>'],\r\n\r\n // replace google docs italics+bold with a span to be replaced once the html is inserted\r\n [new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi), '<span class=\"replace-with italic bold\">'],\r\n\r\n // replace google docs italics with a span to be replaced once the html is inserted\r\n [new RegExp(/<span[^>]*font-style:italic[^>]*>/gi), '<span class=\"replace-with italic\">'],\r\n\r\n //[replace google docs bolds with a span to be replaced once the html is inserted\r\n [new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi), '<span class=\"replace-with bold\">'],\r\n\r\n // replace manually entered b/i/a tags with real ones\r\n [new RegExp(/&lt;(\\/?)(i|b|a)&gt;/gi), '<$1$2>'],\r\n\r\n // replace manually a tags with real ones, converting smart-quotes from google docs\r\n [new RegExp(/&lt;a(?:(?!href).)+href=(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(((?!&quot;|&rdquo;|&ldquo;|\"|“|”).)*)(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(?:(?!&gt;).)*&gt;/gi), '<a href=\"$1\">'],\r\n\r\n // Newlines between paragraphs in html have no syntactic value,\r\n // but then have a tendency to accidentally become additional paragraphs down the line\r\n [new RegExp(/<\\/p>\\n+/gi), '</p>'],\r\n [new RegExp(/\\n+<p/gi), '<p'],\r\n\r\n // Microsoft Word makes these odd tags, like <o:p></o:p>\r\n [new RegExp(/<\\/?o:[a-z]*>/gi), ''],\r\n\r\n // Microsoft Word adds some special elements around list items\r\n [new RegExp(/<!\\[if !supportLists\\]>(((?!<!).)*)<!\\[endif]\\>/gi), '$1']\r\n ];\r\n }", "function cleanFieldHtml(fieldHtml, pos) {\n html = fieldHtml\n }", "function detectAndLogInspectionInfo()\n {\n //If the console object is not present, no need for detetction\n if(!window.console)\n return;\n if(gTemplateInspectionRules == null)\n {\n gTemplateInspectionRules = [];\n _initGlobalTemplateInspectionRules();\n }\n var inspectableElemenets = _iframe.contents().find(\".perc-widget[widgetdefid='percRawHtml']:not('.perc-locked')\").filter(\":only-child\").filter(function(){\n var curElem = window.frames[0].jQuery(this);\n var isSampleContent = curElem.find(\".html-sample-content\").length === 1;\n return !(isSampleContent);\n });\n\n for(i=0;i<gTemplateInspectionRules.length;i++)\n {\n var resp = gTemplateInspectionRules[i].apply(inspectableElemenets);\n if(!resp.status)\n {\n console.log(resp.consoleMsg);\n break;\n }\n }\n }", "function formatCode(code)\r\n{\r\n\tmetaTag = /((<br\\/?>)?\\s?&lt;(meta))/gi;\r\n\thtmlTag = /(&lt;(html)[^(&gt;)]*?&gt;\\s?(<br\\/?>)?)/gi;\r\n\thtml2Tag = /((<br\\/?>)?\\s?&lt;(\\/html)([\\s\\S]*?)&gt;)/gi;\r\n\ttitleTag = /(&lt;(\\/title)&gt;\\s?(<br\\/?>)?)/gi;\r\n\ttitle2Tag = /((<br\\/?>)?\\s?&lt;(title)&gt;)/gi;\r\n\ttableTag = /(&lt;(tbody|th|tr|td|\\/tbody|\\/th|\\/tr|\\/td)([\\s\\S]*?)&gt;\\s?(<br\\/?>)?)/gi;\r\n\ttableBeginTag = /((<br\\/?>)?\\s?&lt;(table)([\\s\\S]*?)&gt;)/gi;\r\n\ttableEndTag = /(&lt;(\\/table)&gt;\\s?(<br\\/?>)?)/gi;\r\n\theadTag = /(&lt;(head)&gt;\\s?(<br\\/?>)?)/gi;\r\n\thead2Tag = /(&lt;(\\/head)[^(&gt;)]*?&gt;\\s?(<br\\/?>)?)/gi;\r\n\tbodyTag = /(&lt;(body)([\\s\\S]*?)&gt;\\s?(<br\\/?>)?)/gi;\r\n\tbody2Tag = /((<br\\/?>)?\\s?&lt;(\\/body)([\\s\\S]*?)&gt;)/gi;\r\n\tscriptTag = /(&lt;(script|\\/script)([\\s\\S]*?)&gt;\\s?(<br\\/?>)?)/gi;\r\n\r\n\tcode = code.replace(metaTag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\r\n\tcode = code.replace(tableEndTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(tableBeginTag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\r\n\tcode = code.replace(htmlTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(html2Tag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\r\n\tcode = code.replace(title2Tag,function(s1,s2){return \"<br/>\"+s2.replace(/<br\\/?>/gi,\"\");});\r\n\tcode = code.replace(titleTag,function(s1,s2){return s2.replace(/<br\\/?>/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(tableTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(headTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(head2Tag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(bodyTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\tcode = code.replace(body2Tag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\r\n\tcode = code.replace(scriptTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\r\n\treturn code;\r\n}", "function formatCode(c)\n{\n\tmetaTag = /((<br\\/?>)?\\s?&lt;(meta))/gi;\n\thtmlTag = /(&lt;(html)[^(&gt;)]*?&gt;\\s?(<br\\/?>)?)/gi;\n\thtml2Tag = /((<br\\/?>)?\\s?&lt;(\\/html)([\\s\\S]*?)&gt;)/gi;\n\ttitleTag = /(&lt;(\\/title)&gt;\\s?(<br\\/?>)?)/gi;\n\ttitle2Tag = /((<br\\/?>)?\\s?&lt;(title)&gt;)/gi;\n\ttableTag = /(&lt;(tbody|th|tr|td|\\/tbody|\\/th|\\/tr|\\/td)([\\s\\S]*?)&gt;\\s?(<br\\/?>)?)/gi;\n\ttableBeginTag = /((<br\\/?>)?\\s?&lt;(table)([\\s\\S]*?)&gt;)/gi;\n\ttableEndTag = /(&lt;(\\/table)&gt;\\s?(<br\\/?>)?)/gi;\n\theadTag = /(&lt;(head)&gt;\\s?(<br\\/?>)?)/gi;\n\thead2Tag = /(&lt;(\\/head)[^(&gt;)]*?&gt;\\s?(<br\\/?>)?)/gi;\n\tbodyTag = /(&lt;(body)([\\s\\S]*?)&gt;\\s?(<br\\/?>)?)/gi;\n\tbody2Tag = /((<br\\/?>)?\\s?&lt;(\\/body)([\\s\\S]*?)&gt;)/gi;\n\tscriptTag = /(&lt;(script|\\/script)([\\s\\S]*?)&gt;\\s?(<br\\/?>)?)/gi;\n\n\tc = c.replace(metaTag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\n\tc = c.replace(tableEndTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\tc = c.replace(tableBeginTag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\n\tc = c.replace(htmlTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\tc = c.replace(html2Tag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\n\tc = c.replace(title2Tag,function(s1,s2){return \"<br/>\"+s2.replace(/<br\\/?>/gi,\"\");});\n\tc = c.replace(titleTag,function(s1,s2){return s2.replace(/<br\\/?>/gi,\"\")+\"<br/>\";});\n\tc = c.replace(tableTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\tc = c.replace(headTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\tc = c.replace(head2Tag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\tc = c.replace(bodyTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\tc = c.replace(body2Tag,function(s1,s2){return \"<br/>\"+s2.replace(/(<br\\/?>)/gi,\"\");});\n\tc = c.replace(scriptTag,function(s1,s2){return s2.replace(/(<br\\/?>)/gi,\"\")+\"<br/>\";});\n\treturn c;\n}", "function createReplacements() {\n return [\n // Remove anything but the contents within the BODY element\n [new RegExp(/^[\\s\\S]*<body[^>]*>\\s*|\\s*<\\/body[^>]*>[\\s\\S]*$/g), ''],\n\n // cleanup comments added by Chrome when pasting html\n [new RegExp(/<!--StartFragment-->|<!--EndFragment-->/g), ''],\n\n // Trailing BR elements\n [new RegExp(/<br>$/i), ''],\n\n // replace two bogus tags that begin pastes from google docs\n [new RegExp(/<[^>]*docs-internal-guid[^>]*>/gi), ''],\n [new RegExp(/<\\/b>(<br[^>]*>)?$/gi), ''],\n\n // un-html spaces and newlines inserted by OS X\n [new RegExp(/<span class=\"Apple-converted-space\">\\s+<\\/span>/g), ' '],\n [new RegExp(/<br class=\"Apple-interchange-newline\">/g), '<br>'],\n\n // replace google docs italics+bold with a span to be replaced once the html is inserted\n [new RegExp(/<span[^>]*(font-style:italic;font-weight:(bold|700)|font-weight:(bold|700);font-style:italic)[^>]*>/gi), '<span class=\"replace-with italic bold\">'],\n\n // replace google docs italics with a span to be replaced once the html is inserted\n [new RegExp(/<span[^>]*font-style:italic[^>]*>/gi), '<span class=\"replace-with italic\">'],\n\n //[replace google docs bolds with a span to be replaced once the html is inserted\n [new RegExp(/<span[^>]*font-weight:(bold|700)[^>]*>/gi), '<span class=\"replace-with bold\">'],\n\n // replace manually entered b/i/a tags with real ones\n [new RegExp(/&lt;(\\/?)(i|b|a)&gt;/gi), '<$1$2>'],\n\n // replace manually a tags with real ones, converting smart-quotes from google docs\n [new RegExp(/&lt;a(?:(?!href).)+href=(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(((?!&quot;|&rdquo;|&ldquo;|\"|“|”).)*)(?:&quot;|&rdquo;|&ldquo;|\"|“|”)(?:(?!&gt;).)*&gt;/gi), '<a href=\"$1\">'],\n\n // Newlines between paragraphs in html have no syntactic value,\n // but then have a tendency to accidentally become additional paragraphs down the line\n [new RegExp(/<\\/p>\\n+/gi), '</p>'],\n [new RegExp(/\\n+<p/gi), '<p'],\n\n // Microsoft Word makes these odd tags, like <o:p></o:p>\n [new RegExp(/<\\/?o:[a-z]*>/gi), ''],\n\n // Microsoft Word adds some special elements around list items\n [new RegExp(/<!\\[if !supportLists\\]>(((?!<!).)*)<!\\[endif]\\>/gi), '$1']\n ];\n }", "function purifyHtml(input, allowed) {\n if (!_.isString(input) || input.indexOf(\"<\") < 0) {\n return input;\n }\n if (allowed === undefined) {\n allowed = default_allowed;\n }\n if (!allowed_split[allowed]) {\n allowed_split[allowed] = (((allowed || \"\") + \"\").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)\n }\n return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {\n return allowed_split[allowed].indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';\n });\n }", "function sourceCodeChange(event) {\n\tvar codeText = $(\"sourcecode\").value;\n\tvar lineCount = codeText ? trim(codeText).split(/[\\r]?\\n/).length : 0;\n\n\tif ($(\"languagehtml\").checked) {\n\t\t// remove multi-line <!-- ... --> comments from HTML\n\t\tcodeText = codeText.replace(/\\<!--([^-]|-[^-])*--\\>/gi, \"\");\n\t} else if ($(\"languageml\").checked) {\n\t\t// remove multi-line (* ... *) comments from ML code\n\t\tcodeText = codeText.replace(/\\(\\*([^*]*\\*[^\\)])*([^*]*\\*)\\)/gi, \"\");\n\t\t\n\t\t// try not to count lines that contain only \"in\" or \"end\"\n\t\tcodeText = codeText.replace(/[ \\t]*let[ \\t]*/gi, \"\");\n\t\tcodeText = codeText.replace(/[ \\t]*in[ \\t]*/gi, \"\");\n\t\tcodeText = codeText.replace(/[ \\t]*end[ \\t]*[;]?/gi, \"\");\n\t} else if ($(\"languagescheme\").checked) {\n\t\t// remove ; comments\n\t\tcodeText = \"\\n\" + codeText + \"\\n\"; // makes regexes match ends of input\n\t\tcodeText = codeText.replace(/\\s*;.*/gim, \"\");\n\n\t\t// remove blank lines and lines containing only ( or ) (or [ or ])\n\t\t// (hack: I remove the regex 5x because for some reason it doesn't\n\t\t// properly remove multiple lines of ) in a row)\n\t\tcodeText = codeText.replace(/\\r/, \"\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t\tcodeText = codeText.replace(/$\\s*([()\\[\\]])*\\s*\\n/gim, \"$1\\n\");\n\t} else {\n\t\tif ($(\"languagephp\").checked) {\n\t\t\t// remove # comments (not Java syntax, but useful for Perl/PHP/shell/etc.)\n\t\t\tcodeText = codeText.replace(/\\s*#[! \\t].*/gim, \"\");\n\t\t}\n\n\t\t// remove // comments\n\t\tcodeText = \"\\n\" + codeText + \"\\n\"; // makes regexes match ends of input\n\t\tcodeText = codeText.replace(/\\s*\\/\\/.*/gim, \"\");\n\n\t\t// remove multi-line / * * / comments\n\t\t// codeText = codeText.replace(/\\/\\*([^*]*\\*)*([^*]*\\*)\\//gi, \"\");\n\t\tcodeText = codeText.replace(/\\/\\*([^*]*\\*[^\\/])*([^*]*\\*)\\//gi, \"\");\n\t}\n\n\t// remove blank lines and lines containing only { or } braces\n\t// (hack: I remove the regex 5x because for some reason it doesn't\n\t// properly remove multiple lines of } in a row)\n\tcodeText = codeText.replace(/\\r/, \"\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\tcodeText = codeText.replace(/$\\s*([{}])*\\s*\\n/gim, \"$1\\n\");\n\n\tcodeText = trim(codeText); // kill leading/trailing \\n that I inserted\n\n\t// dump to page for debugging\n\t// $(\"dumptarget\").innerHTML = htmlEncode(codeText);\n\n\tvar substantiveLineCount = codeText ? trim(codeText).split(/[\\r]?\\n/).length : 0;\n\t$(\"linecount\").innerHTML = lineCount;\n\t$(\"substantivelinecount\").innerHTML = substantiveLineCount;\n}", "getHTML(){const e=this.strings.length-1;let t=\"\",n=!1;for(let r=0;r<e;r++){const e=this.strings[r],a=e.lastIndexOf(\"<!--\");// For each binding we want to determine the kind of marker to insert\n// into the template source before it's parsed by the browser's HTML\n// parser. The marker type is based on whether the expression is in an\n// attribute, text, or comment poisition.\n// * For node-position bindings we insert a comment with the marker\n// sentinel as its text content, like <!--{{lit-guid}}-->.\n// * For attribute bindings we insert just the marker sentinel for the\n// first binding, so that we support unquoted attribute bindings.\n// Subsequent bindings can use a comment marker because multi-binding\n// attributes must be quoted.\n// * For comment bindings we insert just the marker sentinel so we don't\n// close the comment.\n//\n// The following code scans the template source, but is *not* an HTML\n// parser. We don't need to track the tree structure of the HTML, only\n// whether a binding is inside a comment, and if not, if it appears to be\n// the first binding in an attribute.\nn=(-1<a||n)&&-1===e.indexOf(\"-->\",a+1);// Check to see if we have an attribute-like sequence preceeding the\n// expression. This can match \"name=value\" like structures in text,\n// comments, and attribute values, so there can be false-positives.\nconst s=lastAttributeNameRegex.exec(e);t+=null===s?e+(n?commentMarker:nodeMarker):e.substr(0,s.index)+s[1]+s[2]+boundAttributeSuffix+s[3]+marker}return t+=this.strings[e],t}", "function parseHtml(lines, replacements, postHeader) {\n // Convert from markdown\n var body = postFormatter.performMetadataReplacements(replacements, marked(lines));\n // Perform replacements\n var header = postFormatter.performMetadataReplacements(replacements, postFormatter.headerSource);\n // Concatenate HTML\n return header + postHeader + body + postFormatter.footerSource;\n }", "function stripHtml(str, originalOpts) {\n // const\n // ===========================================================================\n const start = Date.now();\n const definitelyTagNames = new Set([\"!doctype\", \"abbr\", \"address\", \"area\", \"article\", \"aside\", \"audio\", \"base\", \"bdi\", \"bdo\", \"blockquote\", \"body\", \"br\", \"button\", \"canvas\", \"caption\", \"cite\", \"code\", \"col\", \"colgroup\", \"data\", \"datalist\", \"dd\", \"del\", \"details\", \"dfn\", \"dialog\", \"div\", \"dl\", \"doctype\", \"dt\", \"em\", \"embed\", \"fieldset\", \"figcaption\", \"figure\", \"footer\", \"form\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"head\", \"header\", \"hgroup\", \"hr\", \"html\", \"iframe\", \"img\", \"input\", \"ins\", \"kbd\", \"keygen\", \"label\", \"legend\", \"li\", \"link\", \"main\", \"map\", \"mark\", \"math\", \"menu\", \"menuitem\", \"meta\", \"meter\", \"nav\", \"noscript\", \"object\", \"ol\", \"optgroup\", \"option\", \"output\", \"param\", \"picture\", \"pre\", \"progress\", \"rb\", \"rp\", \"rt\", \"rtc\", \"ruby\", \"samp\", \"script\", \"section\", \"select\", \"slot\", \"small\", \"source\", \"span\", \"strong\", \"style\", \"sub\", \"summary\", \"sup\", \"svg\", \"table\", \"tbody\", \"td\", \"template\", \"textarea\", \"tfoot\", \"th\", \"thead\", \"time\", \"title\", \"tr\", \"track\", \"ul\", \"var\", \"video\", \"wbr\", \"xml\"]);\n const singleLetterTags = new Set([\"a\", \"b\", \"i\", \"p\", \"q\", \"s\", \"u\"]);\n const punctuation = new Set([\".\", \",\", \"?\", \";\", \")\", \"\\u2026\", '\"', \"\\u00BB\"]); // \\u00BB is &raquo; - guillemet - right angled quote\n // \\u2026 is &hellip; - ellipsis\n // we'll gather opening tags from ranged-pairs here:\n\n const rangedOpeningTags = []; // we'll put tag locations here\n\n const allTagLocations = [];\n let filteredTagLocations = []; // variables\n // ===========================================================================\n // records the info about the suspected tag:\n\n let tag = {};\n\n function resetTag() {\n tag = {\n attributes: []\n };\n }\n\n resetTag(); // records the beginning of the current whitespace chunk:\n\n let chunkOfWhitespaceStartsAt = null; // records the beginning of the current chunk of spaces (strictly spaces-only):\n\n let chunkOfSpacesStartsAt = null; // temporary variable to assemble the attribute pieces:\n\n let attrObj = {}; // marker to store captured href, used in opts.dumpLinkHrefsNearby.enabled\n\n let hrefDump = {\n tagName: \"\",\n hrefValue: \"\",\n openingTagEnds: undefined\n }; // used to insert extra things when pushing into ranges array\n\n let stringToInsertAfter = \"\"; // state flag\n\n let hrefInsertionActive = false; // marker to keep a note where does the whitespace chunk that follows closing bracket end.\n // It's necessary for opts.trimOnlySpaces when there's closing bracket, whitespace, non-space\n // whitespace character (\"\\n\", \"\\t\" etc), whitspace, end-of-file. Trim will kick in and will\n // try to trim up until the EOF, be we'll have to pull the end of trim back, back to the first\n // character of aforementioned non-space whitespace character sequence.\n // This variable will tell exactly where it is located.\n\n let spacesChunkWhichFollowsTheClosingBracketEndsAt = null; // functions\n // ===========================================================================\n\n function existy(x) {\n return x != null;\n }\n\n function isStr(something) {\n return typeof something === \"string\";\n }\n\n function treatRangedTags(i, opts, rangesToDelete) {\n\n if (Array.isArray(opts.stripTogetherWithTheirContents) && (opts.stripTogetherWithTheirContents.includes(tag.name) || opts.stripTogetherWithTheirContents.includes(\"*\"))) {\n // it depends, is it opening or closing range tag:\n // We could try to distinguish opening from closing tags by presence of\n // slash, but that would be a liability for dirty code cases where clash\n // is missing. Better, instead, just see if an entry for that tag name\n // already exists in the rangesToDelete[].\n\n if (Array.isArray(rangedOpeningTags) && rangedOpeningTags.some(obj => obj.name === tag.name && obj.lastClosingBracketAt < i)) {\n // if (tag.slashPresent) { // closing tag.\n // filter and remove the found tag\n\n for (let y = rangedOpeningTags.length; y--;) {\n if (rangedOpeningTags[y].name === tag.name) {\n // we'll remove from opening tag's opening bracket to closing tag's\n // closing bracket because whitespace will be taken care of separately,\n // when tags themselves will be removed.\n // Basically, for each range tag there will be 3 removals:\n // opening tag, closing tag and all from opening to closing tag.\n // We keep removing opening and closing tags along whole range\n // because of few reasons: 1. cases of broken/dirty code, 2. keeping\n // the algorithm simpler, 3. opts that control whitespace removal\n // around tags.\n // 1. add range without caring about surrounding whitespace around\n // the range // also, tend filteredTagLocations in the output - tags which are to be\n // deleted with contents should be reported as one large range in\n // filteredTagLocations - from opening to closing - not two ranges\n /* istanbul ignore else */\n\n if (opts.stripTogetherWithTheirContents.includes(tag.name) || opts.stripTogetherWithTheirContents.includes(\"*\")) {\n filteredTagLocations = filteredTagLocations.filter(([from, upto]) => (from < rangedOpeningTags[y].lastOpeningBracketAt || from >= i + 1) && (upto <= rangedOpeningTags[y].lastOpeningBracketAt || upto > i + 1));\n }\n\n let endingIdx = i + 1;\n\n if (tag.lastClosingBracketAt) {\n endingIdx = tag.lastClosingBracketAt + 1;\n }\n filteredTagLocations.push([rangedOpeningTags[y].lastOpeningBracketAt, endingIdx]);\n /* istanbul ignore else */\n\n if (punctuation.has(str[i]) && opts.cb) {\n opts.cb({\n tag: tag,\n deleteFrom: rangedOpeningTags[y].lastOpeningBracketAt,\n deleteTo: i + 1,\n insert: null,\n rangesArr: rangesToDelete,\n proposedReturn: [rangedOpeningTags[y].lastOpeningBracketAt, i, null]\n }); // null will remove any spaces added so far. Opening and closing range tags might\n // have received spaces as separate entities, but those might not be necessary for range:\n // \"text <script>deleteme</script>.\"\n } else if (opts.cb) {\n opts.cb({\n tag: tag,\n deleteFrom: rangedOpeningTags[y].lastOpeningBracketAt,\n deleteTo: i,\n insert: \"\",\n rangesArr: rangesToDelete,\n proposedReturn: [rangedOpeningTags[y].lastOpeningBracketAt, i, \"\"]\n });\n } // 2. delete the reference to this range from rangedOpeningTags[]\n // because there might be more ranged tags of the same name or\n // different, overlapping or encompassing ranged tags with same\n // or different name.\n\n\n rangedOpeningTags.splice(y, 1); // 3. stop the loop\n\n break;\n }\n }\n } else {\n // opening tag.\n rangedOpeningTags.push(tag);\n }\n }\n }\n\n function calculateWhitespaceToInsert(str2, // whole string\n currCharIdx, // current index\n fromIdx, // leftmost whitespace edge around tag\n toIdx, // rightmost whitespace edge around tag\n lastOpeningBracketAt, // tag actually starts here (<)\n lastClosingBracketAt // tag actually ends here (>)\n ) {\n let strToEvaluateForLineBreaks = \"\";\n\n if (Number.isInteger(fromIdx) && fromIdx < lastOpeningBracketAt) {\n strToEvaluateForLineBreaks += str2.slice(fromIdx, lastOpeningBracketAt);\n }\n\n if (Number.isInteger(toIdx) && toIdx > lastClosingBracketAt + 1) {\n // limit whitespace that follows the tag, stop at linebreak. That's to make\n // the algorithm composable - we include linebreaks in front but not after.\n const temp = str2.slice(lastClosingBracketAt + 1, toIdx);\n\n if (temp.includes(\"\\n\") && isOpeningAt(toIdx, str2)) {\n strToEvaluateForLineBreaks += \" \";\n } else {\n strToEvaluateForLineBreaks += temp;\n }\n }\n\n if (!punctuation.has(str2[currCharIdx]) && str2[currCharIdx] !== \"!\") {\n const foundLineBreaks = strToEvaluateForLineBreaks.match(/\\n/g);\n\n if (Array.isArray(foundLineBreaks) && foundLineBreaks.length) {\n if (foundLineBreaks.length === 1) {\n return \"\\n\";\n }\n\n if (foundLineBreaks.length === 2) {\n return \"\\n\\n\";\n } // return three line breaks maximum\n\n\n return \"\\n\\n\\n\";\n } // default spacer - a single space\n\n\n return \" \";\n } // default case: space\n\n\n return \"\";\n }\n\n function calculateHrefToBeInserted(opts) {\n if (opts.dumpLinkHrefsNearby.enabled && hrefDump.tagName && hrefDump.tagName === tag.name && tag.lastOpeningBracketAt && (hrefDump.openingTagEnds && tag.lastOpeningBracketAt > hrefDump.openingTagEnds || !hrefDump.openingTagEnds)) {\n hrefInsertionActive = true;\n }\n\n if (hrefInsertionActive) {\n const lineBreaks = opts.dumpLinkHrefsNearby.putOnNewLine ? \"\\n\\n\" : \"\";\n stringToInsertAfter = `${lineBreaks}${hrefDump.hrefValue}${lineBreaks}`;\n }\n }\n\n function isOpeningAt(i, customStr) {\n if (customStr) {\n return customStr[i] === \"<\" && customStr[i + 1] !== \"%\";\n }\n\n return str[i] === \"<\" && str[i + 1] !== \"%\";\n }\n\n function isClosingAt(i) {\n return str[i] === \">\" && str[i - 1] !== \"%\";\n } // validation\n // ===========================================================================\n\n\n if (typeof str !== \"string\") {\n throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_01] Input must be string! Currently it's: ${(typeof str).toLowerCase()}, equal to:\\n${JSON.stringify(str, null, 4)}`);\n }\n\n if (originalOpts && !isObj(originalOpts)) {\n throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_02] Optional Options Object must be a plain object! Currently it's: ${(typeof originalOpts).toLowerCase()}, equal to:\\n${JSON.stringify(originalOpts, null, 4)}`);\n } // eslint-disable-next-line consistent-return\n\n\n function resetHrefMarkers() {\n // reset the hrefDump\n if (hrefInsertionActive) {\n hrefDump = {\n tagName: \"\",\n hrefValue: \"\",\n openingTagEnds: undefined\n };\n hrefInsertionActive = false;\n }\n } // prep opts\n // ===========================================================================\n\n\n const opts = { ...defaults,\n ...originalOpts\n };\n\n if (Object.prototype.hasOwnProperty.call(opts, \"returnRangesOnly\")) {\n throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_03] opts.returnRangesOnly has been removed from the API since v.5 release.`);\n } // filter non-string or whitespace entries from the following arrays or turn\n // them into arrays:\n\n\n opts.ignoreTags = prepHopefullyAnArray(opts.ignoreTags, \"opts.ignoreTags\");\n opts.onlyStripTags = prepHopefullyAnArray(opts.onlyStripTags, \"opts.onlyStripTags\"); // let's define the onlyStripTagsMode. Since opts.onlyStripTags can cancel\n // out the entries in opts.onlyStripTags, it can be empty but this mode has\n // to be switched on:\n\n const onlyStripTagsMode = !!opts.onlyStripTags.length; // if both opts.onlyStripTags and opts.ignoreTags are set, latter is respected,\n // we simply exclude ignored tags from the opts.onlyStripTags.\n\n if (opts.onlyStripTags.length && opts.ignoreTags.length) {\n opts.onlyStripTags = without(opts.onlyStripTags, ...opts.ignoreTags);\n }\n\n if (!isObj(opts.dumpLinkHrefsNearby)) {\n opts.dumpLinkHrefsNearby = { ...defaults.dumpLinkHrefsNearby\n };\n } // Object.assign doesn't deep merge, so we take care of opts.dumpLinkHrefsNearby:\n\n\n opts.dumpLinkHrefsNearby = defaults.dumpLinkHrefsNearby;\n\n if (originalOpts && Object.prototype.hasOwnProperty.call(originalOpts, \"dumpLinkHrefsNearby\") && existy(originalOpts.dumpLinkHrefsNearby)) {\n /* istanbul ignore else */\n if (isObj(originalOpts.dumpLinkHrefsNearby)) {\n opts.dumpLinkHrefsNearby = { ...defaults.dumpLinkHrefsNearby,\n ...originalOpts.dumpLinkHrefsNearby\n };\n } else if (originalOpts.dumpLinkHrefsNearby) {\n // checking to omit value as number zero\n throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_04] Optional Options Object's key dumpLinkHrefsNearby was set to ${typeof originalOpts.dumpLinkHrefsNearby}, equal to ${JSON.stringify(originalOpts.dumpLinkHrefsNearby, null, 4)}. The only allowed value is a plain object. See the API reference.`);\n }\n }\n\n if (!opts.stripTogetherWithTheirContents) {\n opts.stripTogetherWithTheirContents = [];\n } else if (typeof opts.stripTogetherWithTheirContents === \"string\" && opts.stripTogetherWithTheirContents.length) {\n opts.stripTogetherWithTheirContents = [opts.stripTogetherWithTheirContents];\n }\n\n const somethingCaught = {};\n\n if (opts.stripTogetherWithTheirContents && Array.isArray(opts.stripTogetherWithTheirContents) && opts.stripTogetherWithTheirContents.length && !opts.stripTogetherWithTheirContents.every((el, i) => {\n if (!(typeof el === \"string\")) {\n somethingCaught.el = el;\n somethingCaught.i = i;\n return false;\n }\n\n return true;\n })) {\n throw new TypeError(`string-strip-html/stripHtml(): [THROW_ID_05] Optional Options Object's key stripTogetherWithTheirContents was set to contain not just string elements! For example, element at index ${somethingCaught.i} has a value ${somethingCaught.el} which is not string but ${(typeof somethingCaught.el).toLowerCase()}.`);\n } // prep the opts.cb\n\n if (!opts.cb) {\n opts.cb = ({\n rangesArr,\n proposedReturn\n }) => {\n if (proposedReturn) {\n rangesArr.push(...proposedReturn);\n }\n };\n } // if the links have to be on a new line, we need to increase the allowance for line breaks\n // in Ranges class, it's the ranges-push API setting opts.limitLinebreaksCount\n // see https://www.npmjs.com/package/ranges-push#optional-options-object\n\n const rangesToDelete = new Ranges({\n limitToBeAddedWhitespace: true,\n limitLinebreaksCount: 2\n }); // TODO: it's chummy - ranges will be unreliable if initial str has changed\n // use ranges-ent-decode\n\n if (!opts.skipHtmlDecoding) {\n while (str !== decode(str, {\n scope: \"strict\"\n })) {\n // eslint-disable-next-line no-param-reassign\n str = decode(str, {\n scope: \"strict\"\n });\n }\n } // step 1.\n // ===========================================================================\n\n\n for (let i = 0, len = str.length; i < len; i++) { // catch the first ending of the spaces chunk that follows the closing bracket.\n // -------------------------------------------------------------------------\n // There can be no space after bracket, in that case, the result will be that character that\n // follows the closing bracket.\n // There can be bunch of spaces that end with EOF. In that case it's fine, this variable will\n // be null.\n\n if (Object.keys(tag).length > 1 && tag.lastClosingBracketAt && tag.lastClosingBracketAt < i && str[i] !== \" \" && spacesChunkWhichFollowsTheClosingBracketEndsAt === null) {\n spacesChunkWhichFollowsTheClosingBracketEndsAt = i;\n } // catch the closing bracket of dirty tags with missing opening brackets\n // -------------------------------------------------------------------------\n\n\n if (isClosingAt(i)) { // tend cases where opening bracket of a tag is missing:\n\n if ((!tag || Object.keys(tag).length < 2) && i > 1) { // traverse backwards either until start of string or \">\" is found\n\n for (let y = i; y--;) {\n\n if (str[y - 1] === undefined || isClosingAt(y)) {\n const startingPoint = str[y - 1] === undefined ? y : y + 1;\n const culprit = str.slice(startingPoint, i + 1); // Check if the culprit starts with a tag that's more likely a tag\n // name (like \"body\" or \"article\"). Single-letter tag names are excluded\n // because they can be plausible, ie. in math texts and so on.\n // Nobody uses puts comparison signs between words like: \"article > \",\n // but single letter names can be plausible: \"a > b\" in math.\n\n if (str !== `<${trim(culprit.trim(), \"/>\")}>` && // recursion prevention\n [...definitelyTagNames].some(val => trim(culprit.trim().split(/\\s+/).filter(val2 => val2.trim()).filter((_val3, i3) => i3 === 0), \"/>\").toLowerCase() === val) && stripHtml(`<${culprit.trim()}>`, opts).result === \"\") {\n /* istanbul ignore else */\n if (!allTagLocations.length || allTagLocations[allTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n allTagLocations.push([startingPoint, i + 1]);\n }\n /* istanbul ignore else */\n\n\n if (!filteredTagLocations.length || filteredTagLocations[filteredTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n filteredTagLocations.push([startingPoint, i + 1]);\n }\n\n const whiteSpaceCompensation = calculateWhitespaceToInsert(str, i, startingPoint, i + 1, startingPoint, i + 1);\n let deleteUpTo = i + 1;\n\n if (str[deleteUpTo] && !str[deleteUpTo].trim()) {\n for (let z = deleteUpTo; z < len; z++) {\n if (str[z].trim()) {\n deleteUpTo = z;\n break;\n }\n }\n }\n opts.cb({\n tag: tag,\n deleteFrom: startingPoint,\n deleteTo: deleteUpTo,\n insert: whiteSpaceCompensation,\n rangesArr: rangesToDelete,\n proposedReturn: [startingPoint, deleteUpTo, whiteSpaceCompensation]\n });\n }\n\n break;\n }\n }\n }\n } // catch slash\n // -------------------------------------------------------------------------\n\n\n if (str[i] === \"/\" && !(tag.quotes && tag.quotes.value) && Number.isInteger(tag.lastOpeningBracketAt) && !Number.isInteger(tag.lastClosingBracketAt)) {\n tag.slashPresent = i;\n } // catch double or single quotes\n // -------------------------------------------------------------------------\n\n\n if (str[i] === '\"' || str[i] === \"'\") {\n if (tag.nameStarts && tag.quotes && tag.quotes.value && tag.quotes.value === str[i]) {\n // 1. finish assembling the \"attrObj{}\"\n attrObj.valueEnds = i;\n attrObj.value = str.slice(attrObj.valueStarts, i);\n tag.attributes.push(attrObj); // reset:\n\n attrObj = {}; // 2. finally, delete the quotes marker, we don't need it any more\n\n tag.quotes = undefined; // 3. if opts.dumpLinkHrefsNearby.enabled is on, catch href\n\n let hrefVal;\n\n if (opts.dumpLinkHrefsNearby.enabled && // eslint-disable-next-line\n tag.attributes.some(obj => {\n if (obj.name && obj.name.toLowerCase() === \"href\") {\n hrefVal = `${opts.dumpLinkHrefsNearby.wrapHeads || \"\"}${obj.value}${opts.dumpLinkHrefsNearby.wrapTails || \"\"}`;\n return true;\n }\n })) {\n hrefDump = {\n tagName: tag.name,\n hrefValue: hrefVal,\n openingTagEnds: undefined\n };\n }\n } else if (!tag.quotes && tag.nameStarts) {\n // 1. if it's opening marker, record the type and location of quotes\n tag.quotes = {};\n tag.quotes.value = str[i];\n tag.quotes.start = i; // 2. start assembling the attribute object which we'll dump into tag.attributes[] array:\n\n if (attrObj.nameStarts && attrObj.nameEnds && attrObj.nameEnds < i && attrObj.nameStarts < i && !attrObj.valueStarts) {\n attrObj.name = str.slice(attrObj.nameStarts, attrObj.nameEnds);\n }\n }\n } // catch the ending of the tag name:\n // -------------------------------------------------------------------------\n\n\n if (tag.nameStarts !== undefined && tag.nameEnds === undefined && (!str[i].trim() || !characterSuitableForNames(str[i]))) {\n // 1. mark the name ending\n tag.nameEnds = i; // 2. extract the full name string\n\n tag.name = str.slice(tag.nameStarts, tag.nameEnds + (\n /* istanbul ignore next */\n !isClosingAt(i) && str[i] !== \"/\" && str[i + 1] === undefined ? 1 : 0));\n\n if ( // if we caught \"----\" from \"<----\" or \"---->\", bail:\n str[tag.nameStarts - 1] !== \"!\" && // protection against <!--\n !tag.name.replace(/-/g, \"\").length || // if tag name starts with a number character\n /^\\d+$/.test(tag.name[0])) {\n tag = {};\n continue;\n }\n\n if (isOpeningAt(i)) {\n // process it because we need to tackle this new tag\n calculateHrefToBeInserted(opts); // calculateWhitespaceToInsert() API:\n // str, // whole string\n // currCharIdx, // current index\n // fromIdx, // leftmost whitespace edge around tag\n // toIdx, // rightmost whitespace edge around tag\n // lastOpeningBracketAt, // tag actually starts here (<)\n // lastClosingBracketAt // tag actually ends here (>)\n\n const whiteSpaceCompensation = calculateWhitespaceToInsert(str, i, tag.leftOuterWhitespace, i, tag.lastOpeningBracketAt, i); // only on pair tags, exclude the opening counterpart and closing\n // counterpart if whole pair is to be deleted\n\n if (opts.stripTogetherWithTheirContents.includes(tag.name) || opts.stripTogetherWithTheirContents.includes(\"*\")) {\n /* istanbul ignore next */\n\n filteredTagLocations = filteredTagLocations.filter(([from, upto]) => !(from === tag.leftOuterWhitespace && upto === i));\n } // console.log(\n // `1011 ${`\\u001b[${32}m${`PUSH`}\\u001b[${39}m`} [${\n // tag.leftOuterWhitespace\n // }, ${i}] to filteredTagLocations`\n // );\n // filteredTagLocations.push([tag.leftOuterWhitespace, i]);\n\n\n opts.cb({\n tag: tag,\n deleteFrom: tag.leftOuterWhitespace,\n deleteTo: i,\n insert: `${whiteSpaceCompensation}${stringToInsertAfter}${whiteSpaceCompensation}`,\n rangesArr: rangesToDelete,\n proposedReturn: [tag.leftOuterWhitespace, i, `${whiteSpaceCompensation}${stringToInsertAfter}${whiteSpaceCompensation}`]\n });\n resetHrefMarkers(); // also,\n\n treatRangedTags(i, opts, rangesToDelete);\n }\n } // catch beginning of an attribute value\n // -------------------------------------------------------------------------\n\n\n if (tag.quotes && tag.quotes.start && tag.quotes.start < i && !tag.quotes.end && attrObj.nameEnds && attrObj.equalsAt && !attrObj.valueStarts) {\n attrObj.valueStarts = i;\n } // catch rare cases when attributes name has some space after it, before equals\n // -------------------------------------------------------------------------\n\n\n if (!tag.quotes && attrObj.nameEnds && str[i] === \"=\" && !attrObj.valueStarts && !attrObj.equalsAt) {\n attrObj.equalsAt = i;\n } // catch the ending of the whole attribute\n // -------------------------------------------------------------------------\n // for example, <a b c> this \"c\" ends \"b\" because it's not \"equals\" sign.\n // We even anticipate for cases where whitespace anywhere between attribute parts:\n // < article class = \" something \" / >\n\n\n if (!tag.quotes && attrObj.nameStarts && attrObj.nameEnds && !attrObj.valueStarts && str[i].trim() && str[i] !== \"=\") {\n // if (!tag.attributes) {\n // tag.attributes = [];\n // }\n tag.attributes.push(attrObj);\n attrObj = {};\n } // catch the ending of an attribute's name\n // -------------------------------------------------------------------------\n\n\n if (!tag.quotes && attrObj.nameStarts && !attrObj.nameEnds) {\n\n if (!str[i].trim()) {\n attrObj.nameEnds = i;\n attrObj.name = str.slice(attrObj.nameStarts, attrObj.nameEnds);\n } else if (str[i] === \"=\") {\n /* istanbul ignore else */\n\n if (!attrObj.equalsAt) {\n attrObj.nameEnds = i;\n attrObj.equalsAt = i;\n attrObj.name = str.slice(attrObj.nameStarts, attrObj.nameEnds);\n }\n } else if (str[i] === \"/\" || isClosingAt(i)) {\n attrObj.nameEnds = i;\n attrObj.name = str.slice(attrObj.nameStarts, attrObj.nameEnds); // if (!tag.attributes) {\n // tag.attributes = [];\n // }\n\n tag.attributes.push(attrObj);\n attrObj = {};\n } else if (isOpeningAt(i)) { // TODO - address both cases of onlyPlausible\n\n attrObj.nameEnds = i;\n attrObj.name = str.slice(attrObj.nameStarts, attrObj.nameEnds); // if (!tag.attributes) {\n // tag.attributes = [];\n // }\n\n tag.attributes.push(attrObj);\n attrObj = {};\n }\n } // catch the beginning of an attribute's name\n // -------------------------------------------------------------------------\n\n\n if (!tag.quotes && tag.nameEnds < i && !str[i - 1].trim() && str[i].trim() && !`<>/!`.includes(str[i]) && !attrObj.nameStarts && !tag.lastClosingBracketAt) {\n attrObj.nameStarts = i;\n } // catch \"< /\" - turn off \"onlyPlausible\"\n // -------------------------------------------------------------------------\n\n\n if (tag.lastOpeningBracketAt !== null && tag.lastOpeningBracketAt < i && str[i] === \"/\" && tag.onlyPlausible) {\n tag.onlyPlausible = false;\n } // catch character that follows an opening bracket:\n // -------------------------------------------------------------------------\n\n\n if (tag.lastOpeningBracketAt !== null && tag.lastOpeningBracketAt < i && str[i] !== \"/\" // there can be closing slashes in various places, legit and not\n ) {\n // 1. identify, is it definite or just plausible tag\n if (tag.onlyPlausible === undefined) {\n if ((!str[i].trim() || isOpeningAt(i)) && !tag.slashPresent) {\n tag.onlyPlausible = true;\n } else {\n tag.onlyPlausible = false;\n }\n } // 2. catch the beginning of the tag name. Consider custom HTML tag names\n // and also known (X)HTML tags:\n\n\n if (str[i].trim() && tag.nameStarts === undefined && !isOpeningAt(i) && str[i] !== \"/\" && !isClosingAt(i) && str[i] !== \"!\") {\n tag.nameStarts = i;\n tag.nameContainsLetters = false;\n }\n } // Catch letters in the tag name. Necessary to filter out false positives like \"<------\"\n\n\n if (tag.nameStarts && !tag.quotes && str[i].toLowerCase() !== str[i].toUpperCase()) {\n tag.nameContainsLetters = true;\n } // catch closing bracket\n // -------------------------------------------------------------------------\n\n\n if ( // it's closing bracket\n isClosingAt(i) && //\n // precaution against JSP comparison\n // kl <c:when test=\"${!empty ab.cd && ab.cd > 0.00}\"> mn\n // ^\n // we're here, it's false ending\n //\n notWithinAttrQuotes(tag, str, i)) {\n\n if (tag.lastOpeningBracketAt !== undefined) {\n // 1. mark the index\n tag.lastClosingBracketAt = i; // 2. reset the spacesChunkWhichFollowsTheClosingBracketEndsAt\n\n spacesChunkWhichFollowsTheClosingBracketEndsAt = null; // 3. push attrObj into tag.attributes[]\n\n if (Object.keys(attrObj).length) { // if (!tag.attributes) {\n // tag.attributes = [];\n // }\n\n tag.attributes.push(attrObj);\n attrObj = {};\n } // 4. if opts.dumpLinkHrefsNearby.enabled is on and we just recorded an href,\n\n\n if (opts.dumpLinkHrefsNearby.enabled && hrefDump.tagName && !hrefDump.openingTagEnds) {\n // finish assembling the hrefDump{}\n hrefDump.openingTagEnds = i; // or tag.lastClosingBracketAt, same\n }\n }\n } // catch the ending of the tag\n // -------------------------------------------------------------------------\n // the tag is \"released\" into \"rApply\":\n\n\n if (tag.lastOpeningBracketAt !== undefined) {\n\n if (tag.lastClosingBracketAt === undefined) {\n\n if (tag.lastOpeningBracketAt < i && !isOpeningAt(i) && ( // to prevent cases like \"text <<<<<< text\"\n str[i + 1] === undefined || isOpeningAt(i + 1)) && tag.nameContainsLetters) { // find out the tag name earlier than dedicated tag name ending catching section:\n // if (str[i + 1] === undefined) {\n\n tag.name = str.slice(tag.nameStarts, tag.nameEnds ? tag.nameEnds : i + 1).toLowerCase(); // submit tag to allTagLocations\n\n /* istanbul ignore else */\n\n if (!allTagLocations.length || allTagLocations[allTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n allTagLocations.push([tag.lastOpeningBracketAt, i + 1]);\n }\n\n if ( // if it's an ignored tag\n opts.ignoreTags.includes(tag.name) || // or just plausible and unrecognised\n tag.onlyPlausible && !definitelyTagNames.has(tag.name)) {\n tag = {};\n attrObj = {};\n continue;\n } // if the tag is only plausible (there's space after opening bracket) and it's not among\n // recognised tags, leave it as it is:\n\n if ((definitelyTagNames.has(tag.name) || singleLetterTags.has(tag.name)) && (tag.onlyPlausible === false || tag.onlyPlausible === true && tag.attributes.length) || str[i + 1] === undefined) {\n calculateHrefToBeInserted(opts);\n const whiteSpaceCompensation = calculateWhitespaceToInsert(str, i, tag.leftOuterWhitespace, i + 1, tag.lastOpeningBracketAt, tag.lastClosingBracketAt);\n opts.cb({\n tag: tag,\n deleteFrom: tag.leftOuterWhitespace,\n deleteTo: i + 1,\n insert: `${whiteSpaceCompensation}${stringToInsertAfter}${whiteSpaceCompensation}`,\n rangesArr: rangesToDelete,\n proposedReturn: [tag.leftOuterWhitespace, i + 1, `${whiteSpaceCompensation}${stringToInsertAfter}${whiteSpaceCompensation}`]\n });\n resetHrefMarkers(); // also,\n\n treatRangedTags(i, opts, rangesToDelete);\n }\n /* istanbul ignore else */\n\n if (!filteredTagLocations.length || filteredTagLocations[filteredTagLocations.length - 1][0] !== tag.lastOpeningBracketAt && filteredTagLocations[filteredTagLocations.length - 1][1] !== i + 1) { // filter out opening/closing tag pair because whole chunk\n // from opening's opening to closing's closing will be pushed\n\n if (opts.stripTogetherWithTheirContents.includes(tag.name) || opts.stripTogetherWithTheirContents.includes(\"*\")) { // get the last opening counterpart of the pair\n // iterate rangedOpeningTags from the, pick the first\n // ranged opening tag whose name is same like current, closing's\n\n let lastRangedOpeningTag;\n\n for (let z = rangedOpeningTags.length; z--;) {\n /* istanbul ignore else */\n if (rangedOpeningTags[z].name === tag.name) {\n lastRangedOpeningTag = rangedOpeningTags[z];\n }\n }\n /* istanbul ignore else */\n\n\n if (lastRangedOpeningTag) {\n filteredTagLocations = filteredTagLocations.filter(([from]) => from !== lastRangedOpeningTag.lastOpeningBracketAt);\n filteredTagLocations.push([lastRangedOpeningTag.lastOpeningBracketAt, i + 1]);\n } else {\n /* istanbul ignore next */\n filteredTagLocations.push([tag.lastOpeningBracketAt, i + 1]);\n }\n } else {\n // if it's not ranged tag, just push it as it is to filteredTagLocations\n filteredTagLocations.push([tag.lastOpeningBracketAt, i + 1]);\n }\n }\n }\n } else if (i > tag.lastClosingBracketAt && str[i].trim() || str[i + 1] === undefined) { // case 2. closing bracket HAS BEEN met\n // we'll look for a non-whitespace character and delete up to it\n // BUT, we'll wipe the tag object only if that non-whitespace character\n // is not a \">\". This way we'll catch and delete sequences of closing brackets.\n // part 1.\n\n let endingRangeIndex = tag.lastClosingBracketAt === i ? i + 1 : i;\n\n if (opts.trimOnlySpaces && endingRangeIndex === len - 1 && spacesChunkWhichFollowsTheClosingBracketEndsAt !== null && spacesChunkWhichFollowsTheClosingBracketEndsAt < i) {\n endingRangeIndex = spacesChunkWhichFollowsTheClosingBracketEndsAt;\n } // if it's a dodgy suspicious tag where space follows opening bracket, there's an extra requirement\n // for this tag to be considered a tag - there has to be at least one attribute with equals if\n // the tag name is not recognised. // submit tag to allTagLocations\n\n /* istanbul ignore else */\n\n if (!allTagLocations.length || allTagLocations[allTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n allTagLocations.push([tag.lastOpeningBracketAt, tag.lastClosingBracketAt + 1]);\n }\n\n if (!onlyStripTagsMode && opts.ignoreTags.includes(tag.name) || onlyStripTagsMode && !opts.onlyStripTags.includes(tag.name)) {\n // ping the callback with nulls:\n opts.cb({\n tag: tag,\n deleteFrom: null,\n deleteTo: null,\n insert: null,\n rangesArr: rangesToDelete,\n proposedReturn: null\n }); // don't submit the tag onto \"filteredTagLocations\"\n // then reset:\n tag = {};\n attrObj = {}; // continue;\n } else if (!tag.onlyPlausible || // tag name is recognised and there are no attributes:\n tag.attributes.length === 0 && tag.name && (definitelyTagNames.has(tag.name.toLowerCase()) || singleLetterTags.has(tag.name.toLowerCase())) || // OR there is at least one equals that follow the attribute's name:\n tag.attributes && tag.attributes.some(attrObj2 => attrObj2.equalsAt)) {\n // submit tag to filteredTagLocations\n\n /* istanbul ignore else */\n if (!filteredTagLocations.length || filteredTagLocations[filteredTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n filteredTagLocations.push([tag.lastOpeningBracketAt, tag.lastClosingBracketAt + 1]);\n } // if this was an ignored tag name, algorithm would have bailed earlier,\n // in stage \"catch the ending of the tag name\".\n\n\n const whiteSpaceCompensation = calculateWhitespaceToInsert(str, i, tag.leftOuterWhitespace, endingRangeIndex, tag.lastOpeningBracketAt, tag.lastClosingBracketAt); // calculate optional opts.dumpLinkHrefsNearby.enabled HREF to insert\n\n stringToInsertAfter = \"\";\n hrefInsertionActive = false;\n calculateHrefToBeInserted(opts);\n let insert;\n\n if (isStr(stringToInsertAfter) && stringToInsertAfter.length) {\n insert = `${whiteSpaceCompensation}${stringToInsertAfter}${\n /* istanbul ignore next */\n whiteSpaceCompensation === \"\\n\\n\" ? \"\\n\" : whiteSpaceCompensation}`;\n } else {\n insert = whiteSpaceCompensation;\n }\n\n if (tag.leftOuterWhitespace === 0 || !right(str, endingRangeIndex - 1)) {\n insert = \"\";\n } // pass the range onto the callback function, be it default or user's\n opts.cb({\n tag: tag,\n deleteFrom: tag.leftOuterWhitespace,\n deleteTo: endingRangeIndex,\n insert,\n rangesArr: rangesToDelete,\n proposedReturn: [tag.leftOuterWhitespace, endingRangeIndex, insert]\n });\n resetHrefMarkers(); // also,\n\n treatRangedTags(i, opts, rangesToDelete);\n } else {\n tag = {};\n } // part 2.\n\n\n if (!isClosingAt(i)) {\n tag = {};\n }\n }\n } // catch an opening bracket\n // -------------------------------------------------------------------------\n\n\n if (isOpeningAt(i) && !isOpeningAt(i - 1) && !`'\"`.includes(str[i + 1]) && (!`'\"`.includes(str[i + 2]) || /\\w/.test(str[i + 1])) && //\n // precaution JSP,\n // against <c:\n !(str[i + 1] === \"c\" && str[i + 2] === \":\") && // against <fmt:\n !(str[i + 1] === \"f\" && str[i + 2] === \"m\" && str[i + 3] === \"t\" && str[i + 4] === \":\") && // against <sql:\n !(str[i + 1] === \"s\" && str[i + 2] === \"q\" && str[i + 3] === \"l\" && str[i + 4] === \":\") && // against <x:\n !(str[i + 1] === \"x\" && str[i + 2] === \":\") && // against <fn:\n !(str[i + 1] === \"f\" && str[i + 2] === \"n\" && str[i + 3] === \":\") && //\n // kl <c:when test=\"${!empty ab.cd && ab.cd < 0.00}\"> mn\n // ^\n // we're here, it's false alarm\n notWithinAttrQuotes(tag, str, i)) { // cater sequences of opening brackets \"<<<<div>>>\"\n\n if (isClosingAt(right(str, i))) {\n // cater cases like: \"<><><>\"\n continue;\n } else { // 1. Before (re)setting flags, check, do we have a case of a tag with a\n // missing closing bracket, and this is a new tag following it.\n\n if (tag.nameEnds && tag.nameEnds < i && !tag.lastClosingBracketAt) {\n\n if (tag.onlyPlausible === true && tag.attributes && tag.attributes.length || tag.onlyPlausible === false) { // tag.onlyPlausible can be undefined too\n\n const whiteSpaceCompensation = calculateWhitespaceToInsert(str, i, tag.leftOuterWhitespace, i, tag.lastOpeningBracketAt, i);\n opts.cb({\n tag: tag,\n deleteFrom: tag.leftOuterWhitespace,\n deleteTo: i,\n insert: whiteSpaceCompensation,\n rangesArr: rangesToDelete,\n proposedReturn: [tag.leftOuterWhitespace, i, whiteSpaceCompensation]\n }); // also,\n\n treatRangedTags(i, opts, rangesToDelete); // then, for continuity, mark everything up accordingly if it's a new bracket:\n\n tag = {};\n attrObj = {};\n }\n } // 2. if new tag starts, reset:\n\n\n if (tag.lastOpeningBracketAt !== undefined && tag.onlyPlausible && tag.name && !tag.quotes) {\n // reset:\n tag.lastOpeningBracketAt = undefined;\n tag.name = undefined;\n tag.onlyPlausible = false;\n }\n\n if ((tag.lastOpeningBracketAt === undefined || !tag.onlyPlausible) && !tag.quotes) {\n tag.lastOpeningBracketAt = i;\n tag.slashPresent = false;\n tag.attributes = []; // since 2.1.0 we started to care about not trimming outer whitespace which is not spaces.\n // For example, \" \\t <a> \\n \". Tag's whitespace boundaries should not extend to string\n // edges but until \"\\t\" on the left and \"\\n\" on the right IF opts.trimOnlySpaces is on.\n\n if (chunkOfWhitespaceStartsAt === null) {\n tag.leftOuterWhitespace = i;\n } else if (opts.trimOnlySpaces && chunkOfWhitespaceStartsAt === 0) {\n // if whitespace extends to the beginning of a string, there's a risk it might include\n // not only spaces. To fix that, switch to space-only range marker:\n\n /* istanbul ignore next */\n tag.leftOuterWhitespace = chunkOfSpacesStartsAt || i;\n } else {\n tag.leftOuterWhitespace = chunkOfWhitespaceStartsAt;\n } // tag.leftOuterWhitespace =\n // chunkOfWhitespaceStartsAt === null ? i : chunkOfWhitespaceStartsAt; // tend the HTML comments: <!-- --> or CDATA: <![CDATA[ ... ]]>\n // if opening comment tag is detected, traverse forward aggressively\n // until EOL or \"-->\" is reached and offset outer index \"i\".\n\n if (`${str[i + 1]}${str[i + 2]}${str[i + 3]}` === \"!--\" || `${str[i + 1]}${str[i + 2]}${str[i + 3]}${str[i + 4]}${str[i + 5]}${str[i + 6]}${str[i + 7]}${str[i + 8]}` === \"![CDATA[\") { // make a note which one it is:\n\n let cdata = true;\n\n if (str[i + 2] === \"-\") {\n cdata = false;\n }\n let closingFoundAt;\n\n for (let y = i; y < len; y++) {\n\n if (!closingFoundAt && cdata && `${str[y - 2]}${str[y - 1]}${str[y]}` === \"]]>\" || !cdata && `${str[y - 2]}${str[y - 1]}${str[y]}` === \"-->\") {\n closingFoundAt = y;\n }\n\n if (closingFoundAt && (closingFoundAt < y && str[y].trim() || str[y + 1] === undefined)) {\n let rangeEnd = y;\n\n if (str[y + 1] === undefined && !str[y].trim() || str[y] === \">\") {\n rangeEnd += 1;\n } // submit the tag\n\n /* istanbul ignore else */\n\n\n if (!allTagLocations.length || allTagLocations[allTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n allTagLocations.push([tag.lastOpeningBracketAt, closingFoundAt + 1]);\n }\n /* istanbul ignore else */\n\n\n if (!filteredTagLocations.length || filteredTagLocations[filteredTagLocations.length - 1][0] !== tag.lastOpeningBracketAt) {\n filteredTagLocations.push([tag.lastOpeningBracketAt, closingFoundAt + 1]);\n }\n\n const whiteSpaceCompensation = calculateWhitespaceToInsert(str, y, tag.leftOuterWhitespace, rangeEnd, tag.lastOpeningBracketAt, closingFoundAt);\n opts.cb({\n tag: tag,\n deleteFrom: tag.leftOuterWhitespace,\n deleteTo: rangeEnd,\n insert: whiteSpaceCompensation,\n rangesArr: rangesToDelete,\n proposedReturn: [tag.leftOuterWhitespace, rangeEnd, whiteSpaceCompensation]\n }); // offset:\n\n i = y - 1;\n\n if (str[y] === \">\") {\n i = y;\n } // resets:\n\n\n tag = {};\n attrObj = {}; // finally,\n\n break;\n }\n }\n }\n }\n }\n } // catch whitespace\n // -------------------------------------------------------------------------\n\n\n if (!str[i].trim()) {\n // 1. catch chunk boundaries:\n if (chunkOfWhitespaceStartsAt === null) {\n chunkOfWhitespaceStartsAt = i;\n\n if (tag.lastOpeningBracketAt !== undefined && tag.lastOpeningBracketAt < i && tag.nameStarts && tag.nameStarts < tag.lastOpeningBracketAt && i === tag.lastOpeningBracketAt + 1 && // insurance against tail part of ranged tag being deleted:\n !rangedOpeningTags.some( // eslint-disable-next-line no-loop-func\n rangedTagObj => rangedTagObj.name === tag.name)) {\n tag.onlyPlausible = true;\n tag.name = undefined;\n tag.nameStarts = undefined;\n }\n }\n } else if (chunkOfWhitespaceStartsAt !== null) { // 1. piggyback the catching of the attributes with equal and no value\n\n if (!tag.quotes && attrObj.equalsAt > chunkOfWhitespaceStartsAt - 1 && attrObj.nameEnds && attrObj.equalsAt > attrObj.nameEnds && str[i] !== '\"' && str[i] !== \"'\") {\n /* istanbul ignore else */\n if (isObj(attrObj)) {\n tag.attributes.push(attrObj);\n } // reset:\n\n\n attrObj = {};\n tag.equalsSpottedAt = undefined;\n } // 2. reset whitespace marker\n\n\n chunkOfWhitespaceStartsAt = null;\n } // catch spaces-only chunks (needed for outer trim option opts.trimOnlySpaces)\n // -------------------------------------------------------------------------\n\n\n if (str[i] === \" \") {\n // 1. catch spaces boundaries:\n if (chunkOfSpacesStartsAt === null) {\n chunkOfSpacesStartsAt = i;\n }\n } else if (chunkOfSpacesStartsAt !== null) {\n // 2. reset the marker\n chunkOfSpacesStartsAt = null;\n } // log all\n // ------------------------------------------------------------------------- // console.log(\n // `${`\\u001b[${33}m${`chunkOfSpacesStartsAt`}\\u001b[${39}m`} = ${JSON.stringify(\n // chunkOfSpacesStartsAt,\n // null,\n // 4\n // )}`\n // ); // console.log(\n // `${`\\u001b[${33}m${`chunkOfWhitespaceStartsAt`}\\u001b[${39}m`} = ${JSON.stringify(\n // chunkOfWhitespaceStartsAt,\n // null,\n // 4\n // )}`\n // );\n } // trim but in ranges\n // first tackle the beginning on the string\n\n if (str && ( // if only spaces were meant to be trimmed,\n opts.trimOnlySpaces && // and first character is a space\n str[0] === \" \" || // if normal trim is requested\n !opts.trimOnlySpaces && // and the first character is whitespace character\n !str[0].trim())) {\n\n for (let i = 0, len = str.length; i < len; i++) {\n if (opts.trimOnlySpaces && str[i] !== \" \" || !opts.trimOnlySpaces && str[i].trim()) {\n rangesToDelete.push([0, i]);\n break;\n } else if (!str[i + 1]) {\n // if end has been reached and whole string has been trimmable\n rangesToDelete.push([0, i + 1]);\n }\n }\n }\n\n if (str && ( // if only spaces were meant to be trimmed,\n opts.trimOnlySpaces && // and last character is a space\n str[str.length - 1] === \" \" || // if normal trim is requested\n !opts.trimOnlySpaces && // and the last character is whitespace character\n !str[str.length - 1].trim())) {\n for (let i = str.length; i--;) {\n if (opts.trimOnlySpaces && str[i] !== \" \" || !opts.trimOnlySpaces && str[i].trim()) {\n rangesToDelete.push([i + 1, str.length]);\n break;\n } // don't tackle end-to-end because it would have been already caught on the\n // start-to-end direction loop above.\n\n }\n } // last correction, imagine we've got text-whitespace-tag.\n // That last part \"tag\" was removed but \"whitespace\" in between is on the left.\n // We need to trim() that too if applicable.\n // By now we'll be able to tell, is starting/ending range array touching\n // the start (index 0) or end (str.length - 1) character indexes, and if so,\n // their inner sides will need to be trimmed accordingly, considering the\n // \"opts.trimOnlySpaces\" of course.\n\n\n const curr = rangesToDelete.current();\n\n if ((!originalOpts || !originalOpts.cb) && curr) {\n // check front - the first range of gathered ranges, does it touch start (0)\n if (curr[0] && !curr[0][0]) {\n curr[0][1]; // check the character at str[startingIdx] // manually edit Ranges class:\n\n rangesToDelete.ranges[0] = [rangesToDelete.ranges[0][0], rangesToDelete.ranges[0][1]];\n } // check end - the last range of gathered ranges, does it touch the end (str.length)\n // PS. remember ending is not inclusive, so ranges covering the whole ending\n // would go up to str.length, not up to str.length - 1!\n\n\n if (curr[curr.length - 1] && curr[curr.length - 1][1] === str.length) {\n curr[curr.length - 1][0]; // check character at str[startingIdx - 1] // remove third element from the last range \"what to add\" - because\n // ranges will crop aggressively, covering all whitespace, but they\n // then restore missing spaces (in which case it's not missing).\n // We already have tight crop, we just need to remove that \"what to add\"\n // third element.\n // hard edit:\n\n /* istanbul ignore else */\n\n if (rangesToDelete.ranges) {\n let startingIdx2 = rangesToDelete.ranges[rangesToDelete.ranges.length - 1][0];\n\n if (str[startingIdx2 - 1] && (opts.trimOnlySpaces && str[startingIdx2 - 1] === \" \" || !opts.trimOnlySpaces && !str[startingIdx2 - 1].trim())) {\n startingIdx2 -= 1;\n }\n\n const backupWhatToAdd = rangesToDelete.ranges[rangesToDelete.ranges.length - 1][2];\n rangesToDelete.ranges[rangesToDelete.ranges.length - 1] = [startingIdx2, rangesToDelete.ranges[rangesToDelete.ranges.length - 1][1]]; // for cases of opts.dumpLinkHrefsNearby\n\n if (backupWhatToAdd && backupWhatToAdd.trim()) {\n rangesToDelete.ranges[rangesToDelete.ranges.length - 1].push(backupWhatToAdd.trimEnd());\n }\n }\n }\n }\n\n const res = {\n log: {\n timeTakenInMilliseconds: Date.now() - start\n },\n result: rApply(str, rangesToDelete.current()),\n ranges: rangesToDelete.current(),\n allTagLocations,\n filteredTagLocations\n };\n return res;\n}", "function extractToText(strings) {\n var $htmlContent, $htmlPattern, $htmlReplace;\n\n // first remove to unnecessary gaps\n $htmlContent = strings.replace(/\\n/gim, '').replace(/\\r/gim, '').replace(/\\t/gim, '').replace(/&nbsp;/gim, ' ');\n\n $htmlPattern = [\n /\\<span(|\\s+.*?)><span(|\\s+.*?)>(.*?)<\\/span><\\/span>/gim, // trim nested spans\n// /<(\\w*[^p])\\s*[^\\/>]*>\\s*<\\/\\1>/gim, // remove empty or white-spaces tags (ignore paragraphs (<p>) and breaks (<br>))\n// [ COMMENT BCZ REMOVE THE <B> TAG -- ASHISH]\n\n /\\<div(|\\s+.*?)>(.*?)\\<\\/div>/gim, // convert div to p\n /\\<strong(|\\s+.*?)>(.*?)\\<\\/strong>/gim, // convert strong to b\n /\\<em(|\\s+.*?)>(.*?)\\<\\/em>/gim // convert em to i\n ];\n\n $htmlReplace = [\n '<span$2>$3</span>',\n// '', //[ COMMENT BCZ REMOVE THE <B> TAG -- ASHISH]\n '<p$1>$2</p>',\n '<b$1>$2</b>',\n '<i$1>$2</i>'\n ];\n\n // repeat the cleaning process 5 times\n for (c = 0; c < 5; c++) {\n // create loop as the number of pattern\n for (var i = 0; i < $htmlPattern.length; i++) {\n var pattern = $htmlPattern[i];\n var replaceby = $htmlReplace[i];\n $htmlContent = $htmlContent.replace(pattern, replaceby);\n }\n }\n\n // if paragraph is false (<p>), convert <p> to <br>\n if (!vars.p)\n $htmlContent = $htmlContent.replace(/\\<p(|\\s+.*?)>(.*?)\\<\\/p>/ig, '<br/>$2');\n\n // if break is false (<br>), convert <br> to <p>\n if (!vars.br) {\n $htmlPattern = [\n /\\<br>(.*?)/ig,\n /\\<br\\/>(.*?)/ig\n ];\n\n $htmlReplace = [\n '<p>$1</p>',\n '<p>$1</p>'\n ];\n\n // create loop as the number of pattern (for breaks)\n for (var i = 0; i < $htmlPattern.length; i++) {\n $htmlContent = $htmlContent.replace($htmlPattern[i], $htmlReplace[i]);\n }\n }\n\n // if paragraph and break is false (<p> && <br>), convert <p> to <div>\n if (!vars.p && !vars.br)\n $htmlContent = $htmlContent.replace(/\\<p>(.*?)\\<\\/p>/ig, '<div>$1</div>');\n\n return $htmlContent;\n }", "uncommentJekyllSpecifics_(contents) {\n // Note that [^] matches any character including newlines, whereas \".\"\n // does not. For anyone who's wondering, [^] the negation of the empty\n // set.\n return contents.replace(/<!--([{<][^]*?[>}])-->/g, '$1');\n }", "function hstrip(eme){\r\n\teme = eme.replace(/\\n/g,\"\\\\n\")\r\n\teme = eme.replace(/<a.+?addclass.+?see more<\\/a>/g,\"\");/*special case: \"see more\" is a meme-spreading group. adding that to your blocklist will generate A TON of false-positivies.*/\r\n\teme = eme.replace(/<\\/?a ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?i ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?img ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?div ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?h5 ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?li ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?form ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?span ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/<\\/?label ?.+?>/g,\"\");/*don't look *inside* tags*/\r\n\teme = eme.replace(/&quot;/g,'\"');/*basic stuff that apparently caused problems.*/\r\n\teme = eme.replace(/&amp;/g,'&');\r\n\teme = eme.replace(/&lt;/g,'<');\r\n\teme = eme.replace(/&gt;/g,'>');\r\n\treturn eme\r\n}", "function getOffsetsAfterAccountingForSomeSpecialSelectionCases(allText, offsets) {\n var newOffs = oldOffs = offsets;\n \n // strip leading and trailing white space\n newOffs = getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]);\n \n //remove trailing &nbsp; tag if there\n // this can happen if a user shift down-clicks and the following line\n // is empty; dw expands the selection to include the \"<p>nbsp;\"\n // on the next line\n var selStr = allText.substring(newOffs[0],newOffs[1]);\n var chunk = \"&nbsp;\";\n var chunkPos = selStr.lastIndexOf(chunk);\n if (chunkPos!=-1 && chunkPos == (selStr.length - chunk.length)) \n newOffs[1] -= chunk.length;\n\n // remove last tag if it is an opening block tag\n // this can happen if a user shift down-clicks; dw selects the\n // opening block tag on the next paragraph, resulting in a selection like:\n // <p>|some text</p>\n // <p>|more text</p>\n selStr = allText.substring(newOffs[0], newOffs[1]);\n var pattern = /<([^>]*)>$/;\n var result = selStr.match(pattern);\n if (result != null){\n if ( isAContainerTag(result[1]) ){\n newOffs[1] -= result[0].length;\n }\n }\n\n // if selection starts with a closing block tag, remove it\n // this can happen if a user puts the mouse at the end of a line and\n // presses shift-up-arrow to select it\n selStr = allText.substring(newOffs[0],newOffs[1]);\n pattern = /^<\\/([^>]*)>/;\n result = selStr.match(pattern);\n if (result != null){\n if ( isAContainerTag(result[1]) ){\n newOffs[0] += result[0].length;\n }\n }\n\n // strip leading and trailing white space if offsets have changed\n if (newOffs != oldOffs){\n newOffs = getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]);\n oldOffs = newOffs;\n }\n\n // account for special list case: selecting the first item in a list\n // can select the opening <ol> or <ul> as well. Strip it.\n newOffs = getOffsetsAfterListCheck(allText,newOffs[0],newOffs[1]);\n\n // strip leading and trailing white space if offsets have changed\n if (newOffs != oldOffs){\n newOffs = getOffsetsAfterStrippingWhiteSpace(allText,newOffs[0],newOffs[1]);\n }\n \n return newOffs;\n\n}", "reparsePretties(range) {\r\n range = this.document.validateRange(range);\r\n const startCharacter = 0;\r\n const newUglyRanges = new DisjointRangeSet_1.DisjointRangeSet();\r\n const newStyledRanges = new DisjointRangeSet_1.DisjointRangeSet();\r\n const newScopedRanges = [];\r\n const newUnscopedRanges = [];\r\n const newConditionalRanges = new RangeSet_1.RangeSet();\r\n // initialize an empty range set for every id\r\n this.prettyDecorations.unscoped.forEach(() => newUnscopedRanges.push(new DisjointRangeSet_1.DisjointRangeSet()));\r\n this.prettyDecorations.scoped.forEach(() => newScopedRanges.push(new DisjointRangeSet_1.DisjointRangeSet()));\r\n let invalidatedTokenState = false;\r\n // Collect new pretties\r\n const lineCount = this.document.getLineCount();\r\n let lineIdx;\r\n for (lineIdx = range.start.line; lineIdx <= range.end.line || (invalidatedTokenState && lineIdx < lineCount); ++lineIdx) {\r\n const line = this.document.getLine(lineIdx);\r\n const { tokens: tokens, invalidated: invalidated } = this.refreshTokensOnLine(line, lineIdx);\r\n invalidatedTokenState = invalidated;\r\n for (let ugly of this.iterateLineUglies(line, tokens)) {\r\n const uglyRange = new vscode.Range(lineIdx, ugly.start, lineIdx, ugly.end);\r\n newConditionalRanges.add(new vscode.Range(lineIdx, ugly.matchStart, lineIdx, ugly.matchEnd));\r\n if (ugly.type === \"scoped\") {\r\n if (this.prettyDecorations.scoped[ugly.id].pretty)\r\n newUglyRanges.insert(uglyRange);\r\n else\r\n newStyledRanges.insert(uglyRange);\r\n newScopedRanges[ugly.id].insert(uglyRange);\r\n }\r\n else if (ugly.type === \"unscoped\") {\r\n if (this.prettyDecorations.unscoped[ugly.id].pretty)\r\n newUglyRanges.insert(uglyRange);\r\n else\r\n newStyledRanges.insert(uglyRange);\r\n newUnscopedRanges[ugly.id].insert(uglyRange);\r\n }\r\n }\r\n }\r\n if (lineIdx - 1 > range.end.line) {\r\n // console.info('Aditional tokens reparsed: ' + (lineIdx-range.end.line) + ' lines');\r\n range = range.with({ end: range.end.with({ line: lineIdx, character: 0 }) });\r\n }\r\n // compute the total reparsed range\r\n // use this to clear any preexisting substitutions\r\n const newUglyTotalRange = newUglyRanges.getTotalRange();\r\n const newStyledTotalRange = newStyledRanges.getTotalRange();\r\n let hiddenOverlap = range.with({ start: range.start.with({ character: startCharacter }) });\r\n let styledOverlap = range.with({ start: range.start.with({ character: startCharacter }) });\r\n if (!newUglyTotalRange.isEmpty)\r\n hiddenOverlap = hiddenOverlap.union(newUglyRanges.getTotalRange());\r\n if (!newStyledTotalRange.isEmpty)\r\n styledOverlap = styledOverlap.union(newStyledRanges.getTotalRange());\r\n const overlap = hiddenOverlap.union(styledOverlap);\r\n this.conditionalRanges.removeOverlapping(overlap, { includeTouchingStart: false, includeTouchingEnd: false });\r\n this.uglyDecorationRanges.removeOverlapping(hiddenOverlap);\r\n // this.styledDecorationRanges.removeOverlapping(styledOverlap);\r\n this.prettyDecorations.unscoped.forEach(r => r.ranges.removeOverlapping(overlap));\r\n this.prettyDecorations.scoped.forEach(r => r.ranges.removeOverlapping(overlap));\r\n // add the new pretties & ugly ducklings\r\n newConditionalRanges.getRanges().forEach(r => this.conditionalRanges.add(r));\r\n this.uglyDecorationRanges.insertRanges(newUglyRanges);\r\n this.prettyDecorations.unscoped.forEach((pretty, idx) => pretty.ranges.insertRanges(newUnscopedRanges[idx]));\r\n this.prettyDecorations.scoped.forEach((pretty, idx) => {\r\n pretty.ranges.insertRanges(newScopedRanges[idx]);\r\n });\r\n if (!newStyledRanges.isEmpty() || !newUglyRanges.isEmpty())\r\n this.changedUglies = true;\r\n return hiddenOverlap.union(styledOverlap);\r\n }", "function reformatCode(code) {\n var APPLY_LINE_NUMBERS = false;\n var lineNumberOffset = 0;\n var ENV = Espruino.Core.Env.getData();\n if (ENV && ENV.VERSION_MAJOR && ENV.VERSION_MINOR) {\n if (ENV.VERSION_MAJOR>1 ||\n ENV.VERSION_MINOR>=81.086) {\n if (Espruino.Config.STORE_LINE_NUMBERS)\n APPLY_LINE_NUMBERS = true;\n }\n }\n // Turn cr/lf into just lf (eg. windows -> unix)\n code = code.replace(/\\r\\n/g,\"\\n\");\n // First off, try and fix funky characters\n for (var i=0;i<code.length;i++) {\n var ch = code.charCodeAt(i);\n if ((ch<32 || ch>255) && ch!=9/*Tab*/ && ch!=10/*LF*/ && ch!=13/*CR*/) {\n console.warn(\"Funky character code \"+ch+\" at position \"+i+\". Replacing with ?\");\n code = code.substr(0,i)+\"?\"+code.substr(i+1);\n }\n }\n\n /* Search for lines added to the start of the code by the module handler.\n Ideally there would be a better way of doing this so line numbers stayed correct,\n but this hack works for now. Fixes EspruinoWebIDE#140 */\n if (APPLY_LINE_NUMBERS) {\n var l = code.split(\"\\n\");\n var i = 0;\n while (l[i] && (l[i].substr(0,8)==\"Modules.\" ||\n l[i].substr(0,8)==\"setTime(\")) i++;\n lineNumberOffset = -i;\n }\n\n var resultCode = \"\\x10\"; // 0x10 = echo off for line\n /** we're looking for:\n * `a = \\n b`\n * `for (.....) \\n X`\n * `if (.....) \\n X`\n * `if (.....) { } \\n else foo`\n * `while (.....) \\n X`\n * `do \\n X`\n * `function (.....) \\n X`\n * `function N(.....) \\n X`\n * `var a \\n , b` `var a = 0 \\n, b`\n * `var a, \\n b` `var a = 0, \\n b`\n * `a \\n . b`\n * `foo() \\n . b`\n * `try { } \\n catch \\n () \\n {}`\n *\n * These are divided into two groups - where there are brackets\n * after the keyword (statementBeforeBrackets) and where there aren't\n * (statement)\n *\n * We fix them by replacing \\n with what you get when you press\n * Alt+Enter (Ctrl + LF). This tells Espruino that it's a newline\n * but NOT to execute.\n */\n var lex = Espruino.Core.Utils.getLexer(code);\n var brackets = 0;\n var curlyBrackets = 0;\n var statementBeforeBrackets = false;\n var statement = false;\n var varDeclaration = false;\n var lastIdx = 0;\n var lastTok = {str:\"\"};\n var tok = lex.next();\n while (tok!==undefined) {\n var previousString = code.substring(lastIdx, tok.startIdx);\n var tokenString = code.substring(tok.startIdx, tok.endIdx);\n //console.log(\"prev \"+JSON.stringify(previousString)+\" next \"+tokenString);\n\n /* Inserting Alt-Enter newline, which adds newline without trying\n to execute */\n if (brackets>0 || // we have brackets - sending the alt-enter special newline means Espruino doesn't have to do a search itself - faster.\n statement || // statement was before brackets - expecting something else\n statementBeforeBrackets || // we have an 'if'/etc\n varDeclaration || // variable declaration then newline\n tok.str==\",\" || // comma on newline - there was probably something before\n tok.str==\".\" || // dot on newline - there was probably something before\n tok.str==\"+\" || tok.str==\"-\" || // +/- on newline - there was probably something before\n tok.str==\"=\" || // equals on newline - there was probably something before\n tok.str==\"else\" || // else on newline\n lastTok.str==\"else\" || // else befgore newline\n tok.str==\"catch\" || // catch on newline - part of try..catch\n lastTok.str==\"catch\"\n ) {\n //console.log(\"Possible\"+JSON.stringify(previousString));\n previousString = previousString.replace(/\\n/g, \"\\x1B\\x0A\");\n }\n\n var previousBrackets = brackets;\n if (tok.str==\"(\" || tok.str==\"{\" || tok.str==\"[\") brackets++;\n if (tok.str==\"{\") curlyBrackets++;\n if (tok.str==\")\" || tok.str==\"}\" || tok.str==\"]\") brackets--;\n if (tok.str==\"}\") curlyBrackets--;\n\n if (brackets==0) {\n if (tok.str==\"for\" || tok.str==\"if\" || tok.str==\"while\" || tok.str==\"function\" || tok.str==\"throw\") {\n statementBeforeBrackets = true;\n varDeclaration = false;\n } else if (tok.str==\"var\") {\n varDeclaration = true;\n } else if (tok.type==\"ID\" && lastTok.str==\"function\") {\n statementBeforeBrackets = true;\n } else if (tok.str==\"try\" || tok.str==\"catch\") {\n statementBeforeBrackets = true;\n } else if (tok.str==\")\" && statementBeforeBrackets) {\n statementBeforeBrackets = false;\n statement = true;\n } else if ([\"=\",\"^\",\"&&\",\"||\",\"+\",\"+=\",\"-\",\"-=\",\"*\",\"*=\",\"/\",\"/=\",\"%\",\"%=\",\"&\",\"&=\",\"|\",\"|=\"].indexOf(tok.str)>=0) {\n statement = true;\n } else {\n if (tok.str==\";\") varDeclaration = false;\n statement = false;\n statementBeforeBrackets = false;\n }\n }\n /* If we're at root scope and had whitespace/comments between code,\n remove it all and replace it with a single newline and a\n 0x10 (echo off for line) character. However DON'T do this if we had\n an alt-enter in the line, as it was there to stop us executing\n prematurely */\n if (previousBrackets==0 &&\n previousString.indexOf(\"\\n\")>=0 &&\n previousString.indexOf(\"\\x1B\\x0A\")<0) {\n previousString = \"\\n\\x10\";\n // Apply line numbers to each new line sent, to aid debugger\n if (APPLY_LINE_NUMBERS && tok.lineNumber && (tok.lineNumber+lineNumberOffset)>0) {\n // Esc [ 1234 d\n // This is the 'set line number' command that we're abusing :)\n previousString += \"\\x1B\\x5B\"+(tok.lineNumber+lineNumberOffset)+\"d\";\n }\n }\n\n // add our stuff back together\n resultCode += previousString+tokenString;\n // next\n lastIdx = tok.endIdx;\n lastTok = tok;\n tok = lex.next();\n }\n //console.log(resultCode);\n if (brackets>0) {\n Espruino.Core.Notifications.error(\"You have more open brackets than close brackets. Please see the hints in the Editor window.\");\n return undefined;\n }\n if (brackets<0) {\n Espruino.Core.Notifications.error(\"You have more close brackets than open brackets. Please see the hints in the Editor window.\");\n return undefined;\n }\n return resultCode;\n }", "function cleanUpRTEHtmlMarkup(msg) {\n msg = msg.replace(/(<p><\\/p>)/ig,\"\"); //replace <p></p> - globally\n msg = msg.replace(/<p/ig,\"<span\"); //replace all open paragraphs with span\n msg = msg.replace(/<\\/p>/ig,\"</span></br>\"); //replace all closing paragraphs with closing span and break. Please note that <br/> keeps the indentation in-tact - where as <p/> invalidates it.\n return msg;\n }", "function sanitize(s, noContext, notredirect) { \r\n\t\r\n for (var j = 0; j < bad.length; j++) { \r\n if(noContext && modifiers[j].indexOf(\"c\") != -1 || notredirect && modifiers[j].indexOf(\"r\") !=-1 ) { \r\n continue;\r\n } \r\n s = s.replace(bad[j], good[j]);\r\n } \r\n return s; \r\n}", "function sanitize(s, noContext, notredirect) { \r\n\t\r\n for (var j = 0; j < bad.length; j++) { \r\n if(noContext && modifiers[j].indexOf(\"c\") != -1 || notredirect && modifiers[j].indexOf(\"r\") !=-1 ) { \r\n continue;\r\n } \r\n s = s.replace(bad[j], good[j]);\r\n } \r\n return s; \r\n}", "function markup(e){var t,n,i,r;if(hash=clicked=e,get(),$.extend(hash,{line:\"\",root:options.root,textarea:textarea,selection:selection||\"\",caretPosition:caretPosition,ctrlKey:ctrlKey,shiftKey:shiftKey,altKey:altKey}),\n// callbacks before insertion\nprepare(options.beforeInsert),prepare(clicked.beforeInsert),(!0===ctrlKey&&!0===shiftKey||!0===e.multiline)&&prepare(clicked.beforeMultiInsert),$.extend(hash,{line:1}),!0===ctrlKey&&!0===shiftKey){for(lines=selection.split(/\\r?\\n/),n=0,i=lines.length,r=0;r<i;r++)\"\"!==$.trim(lines[r])?($.extend(hash,{line:++n,selection:lines[r]}),lines[r]=build(lines[r]).block):lines[r]=\"\";string={block:lines.join(\"\\n\")},start=caretPosition,t=string.block.length+(browser.opera?i-1:0)}else!0===ctrlKey?(string=build(selection),start=caretPosition+string.openWith.length,t=string.block.length-string.openWith.length-string.closeWith.length,t-=string.block.match(/ $/)?1:0,t-=fixIeBug(string.block)):!0===shiftKey?(string=build(selection),start=caretPosition,t=string.block.length,t-=fixIeBug(string.block)):(string=build(selection),start=caretPosition+string.block.length,t=0,start-=fixIeBug(string.block));\"\"===selection&&\"\"===string.replaceWith&&(caretOffset+=fixOperaBug(string.block),start=caretPosition+string.openBlockWith.length+string.openWith.length,t=string.block.length-string.openBlockWith.length-string.openWith.length-string.closeWith.length-string.closeBlockWith.length,caretOffset=$$.val().substring(caretPosition,$$.val().length).length,caretOffset-=fixOperaBug($$.val().substring(0,caretPosition))),$.extend(hash,{caretPosition:caretPosition,scrollPosition:scrollPosition}),string.block!==selection&&!1===abort?(insert(string.block),set(start,t)):caretOffset=-1,get(),$.extend(hash,{line:\"\",selection:selection}),\n// callbacks after insertion\n(!0===ctrlKey&&!0===shiftKey||!0===e.multiline)&&prepare(clicked.afterMultiInsert),prepare(clicked.afterInsert),prepare(options.afterInsert),\n// refresh preview if opened\npreviewWindow&&options.previewAutoRefresh&&refreshPreview(),\n// reinit keyevent\nshiftKey=altKey=ctrlKey=abort=!1}", "function editor_filterOutput(objname) {\r\n editor_updateOutput(objname);\r\n var contents = document.all[objname].value;\r\n var config = document.all[objname].config;\r\n\r\n // ignore blank contents\r\n if (contents.toLowerCase() == '<p>&nbsp;</p>') { contents = \"\"; }\r\n\r\n // filter tag - this code is run for each HTML tag matched\r\n var filterTag = function(tagBody,tagName,tagAttr) {\r\n tagName = tagName.toLowerCase();\r\n var closingTag = (tagBody.match(/^<\\//)) ? true : false;\r\n\r\n // fix placeholder URLS - remove absolute paths that IE adds\r\n if (tagName == 'img') { tagBody = tagBody.replace(/(src\\s*=\\s*.)[^*]*(\\*\\*\\*)/, \"$1$2\"); }\r\n if (tagName == 'a') { tagBody = tagBody.replace(/(href\\s*=\\s*.)[^*]*(\\*\\*\\*)/, \"$1$2\"); }\r\n\r\n // add additional tag filtering here\r\n\r\n // convert to vbCode\r\n// if (tagName == 'b' || tagName == 'strong') {\r\n// if (closingTag) { tagBody = \"[/b]\"; } else { tagBody = \"[b]\"; }\r\n// }\r\n// else if (tagName == 'i' || tagName == 'em') {\r\n// if (closingTag) { tagBody = \"[/i]\"; } else { tagBody = \"[i]\"; }\r\n// }\r\n// else if (tagName == 'u') {\r\n// if (closingTag) { tagBody = \"[/u]\"; } else { tagBody = \"[u]\"; }\r\n// }\r\n// else {\r\n// tagBody = \"\"; // disallow all other tags!\r\n// }\r\n\r\n return tagBody;\r\n };\r\n\r\n // match tags and call filterTag\r\n RegExp.lastIndex = 0;\r\n var matchTag = /<\\/?(\\w+)((?:[^'\">]*|'[^']*'|\"[^\"]*\")*)>/g; // this will match tags, but still doesn't handle container tags (textarea, comments, etc)\r\n\r\n contents = contents.replace(matchTag, filterTag);\r\n\r\n // remove nextlines from output (if requested)\r\n if (config.replaceNextlines) { \r\n contents = contents.replace(/\\r\\n/g, ' ');\r\n contents = contents.replace(/\\n/g, ' ');\r\n contents = contents.replace(/\\r/g, ' ');\r\n }\r\n\r\n // update output with filtered content\r\n document.all[objname].value = contents;\r\n\r\n}", "postprocess(html) {\n return html;\n }", "preprocess(markdown) {\n return markdown;\n }", "function SafeHtml() {}", "function SafeHtml() {}", "function SafeHtml() {}", "function SafeHtml() {}", "function SafeHtml() {}", "function StyleSanitizeFn() {}", "function StyleSanitizeFn() {}", "function StyleSanitizeFn() {}", "function sanitize(markup) {\n return (\"\" + markup)\n .trim()\n .replace(/[\\r|\\n]/g, ' ')\n .replace(/>\\s+</g, '><');\n }", "function _sanitizeHtml(defaultDoc,unsafeHtmlInput){var inertBodyElement=null;try{inertBodyHelper=inertBodyHelper||new InertBodyHelper(defaultDoc);// Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).\nvar unsafeHtml=unsafeHtmlInput?String(unsafeHtmlInput):'';inertBodyElement=inertBodyHelper.getInertBodyElement(unsafeHtml);// mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser\n// trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.\nvar mXSSAttempts=5;var parsedHtml=unsafeHtml;do{if(mXSSAttempts===0){throw new Error('Failed to sanitize html because the input is unstable');}mXSSAttempts--;unsafeHtml=parsedHtml;parsedHtml=inertBodyElement.innerHTML;inertBodyElement=inertBodyHelper.getInertBodyElement(unsafeHtml);}while(unsafeHtml!==parsedHtml);var sanitizer=new SanitizingHtmlSerializer();var safeHtml=sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement)||inertBodyElement);if(isDevMode()&&sanitizer.sanitizedSomething){console.warn('WARNING: sanitizing HTML stripped some content, see http://g.co/ng/security#xss');}return safeHtml;}finally{// In case anything goes wrong, clear out inertElement to reset the entire DOM structure.\nif(inertBodyElement){var parent_1=getTemplateContent(inertBodyElement)||inertBodyElement;while(parent_1.firstChild){parent_1.removeChild(parent_1.firstChild);}}}}", "function apply_indents() {\n // TODO:SOMEONE MAKE GLOBAL OPTION THAT THESE AREN'T THERE first, make sure indents are _never_ applied to the first paragraph of a section\n $source.find('.hz_column_break_after').each(function() {\n $(this).find('p:first').addClass('hz_no_indent');\n });\n \n // apply indents everywhere they're expected\n $source.find('p').not('.hz_no_indent, .opening').each(function() {\n $(this).html(\"\" + $(this).html());\n });\n }", "function outputFilter(text) {\r\n return text.format_html_output();\r\n }", "transformWithoutCodeBlocks_(contents, transformer) {\n const codeBlockVars = new Map();\n\n // Replace code blocks with variable references\n contents = contents.replace(patterns.newMarkdownCodePattern(), (match) => {\n const varRef = `{{ code_${ uuid() } }}`;\n codeBlockVars.set(varRef, match);\n return varRef;\n });\n\n // Run transformation function against code-less Markdown\n contents = transformer(contents);\n\n // Restore code blocks\n for (let [k, v] of codeBlockVars.entries()) {\n contents = contents.replace(k, v);\n }\n\n return contents;\n }", "function sanitizeInput(rawInput) {\n var placeholder = HtmlService.createHtmlOutput(\" \");\n placeholder.appendUntrusted(rawInput);\n\n return placeholder.getContent();\n}", "codeAroundError(startOfDef, problemIndex) {\n const range = 20;\n let before = Math.max(0, startOfDef-range);\n let after = Math.min(this.maxIndex+1, problemIndex);\n return `\"...${this.code.slice(before, after)}\"`;\n }", "function SafeHtml() { }", "function SafeHtml() { }", "function SafeHtml() { }", "function Digest(code){\n\tif (code.indexOf(\"<b>Warning</b>\")!=-1) {\n\n\t\tvar warning= '';\n\t\tvar msg='';\n\t\tvar start = (code.indexOf(\"<b>Warning</b>\", 0)!=-1) ? code.substring(0, code.indexOf(\"<b>Warning</b>\", 0)) : '';\n\t\tvar i=0;\n\t\twhile (code.indexOf(\"<b>Warning</b>\", 0)!=-1) {\n\t\t\t\n\t\t\twarning = code.substring(code.indexOf(\"<b>Warning</b>\", 0)+15, code.indexOf(\"<br />\", code.indexOf(\"on line\", code.indexOf(\"<b>Warning</b>\", 0)+15)+9));\n\t\t\tcode = code.substring(code.indexOf(\"<br />\", code.indexOf(\" on line\", 0) ), code.length);\n\n\t\t\tmsg= msg + String.fromCharCode(13) + String.fromCharCode(13) + warning.replace(\" - \", String.fromCharCode(13));\n\t\t\tmsg = msg.replace(\"in <b>\", String.fromCharCode(13));\n\t\t\ti++;\n\t\t}\n\t\tcode= start + code.substring(7, code.length);\n\t\t\n\t\twindow.alert('Warnings('+i+'):'+msg);\n\t}\n\treturn code;\n}", "function StyleSanitizeFn() { }", "function StyleSanitizeFn() { }", "function textTransformToHtml(text)\n{\n var html = text;\n //html = html.replace(/&/gi, \"&amp;\");\n //html = html.replace(/</gi, \"&lt;\").replace(/>/gi, \"&gt;\");\n html = html.replace(/\\r\\n/gi, \"<br/>\").replace(/\\n/gi, \"<br/>\");\n html = html.replace(/\\[h(\\d)\\](.+?)\\[\\/h\\d\\]/gi, \"<h$1>$2</h$1>\");\n\n html = html.replace(/\\[q\\](.+?)\\[q\\]/g, '<i class=\"ttQuoted\">$1</i>');\n html = html.replace(/\\[f\\](.+?)\\[f\\]/g, '<b class=\"ttFilename\">$1</b>');\n html = html.replace(/\\[space=(.+?)\\]/g, '<span style=\"margin-right: $1\">&nbsp;</span>');\n html = html.replace(/\\[mdash\\]/g, '&mdash;');\n\n html = html.replace(/\\[img(.*?)\\](.+?)\\[\\/img\\]/g, '<img $1 src=\"$2\" />');\n html = html.replace(/\\[a(.*?)\\](.+?)\\[\\/a\\]/g, '<a $1 target=\"_blank\">$2</a>');\n\n html = html.replace(/<br\\/>(\\d)\\. /g, '<br/><b class=\"numlist\">$1.</b> ');\n\n // word-highliter\n var words = new Array();\n var rx = /\\[wh=([abcdefABCDEF0-9]+?)\\](.+?)\\[wh\\]/g;\n var match;\n while (match = rx.exec(html))\n {\n var color = match[1];\n var word = match[2];\n words[word] = color;\n }\n html = html.replace(/\\[wh=[abcdefABCDEF0-9]+?\\].+?\\[wh\\]/gi, \"\");\n for (word in words)\n {\n color = words[word];\n html = replaceTextNotBetween(html, \"[code\", \"[/code]\", word, '<span style=\"color: #' + color + '\">' + word + '</span>');\n }\n\n\n // prepare code for syntax highlighting\n html = html.replace(/\\[code (class=\"brush\\: .+?\")\\](.+?)\\[\\/code\\]/gi, \"<pre $1>$2</pre>\");\n html = replaceTextBetween(html, '<pre class=\"brush', \"</pre>\", \"<br/>\", \"\\n\");\n\n return html;\n}", "function heavyCleanup(input) {\n // TODO: Some of the backslash escapes should be handled by Flowmark instead\n // being of unescaped here.\n return input\n .replace(/ {4}> /gim, ' ')\n .replace(/<!-- -->/gim, '')\n .replace(/\\\\'/gim, \"'\")\n .replace(/\\\\\"/gim, '\"')\n .replace(/\\\\\\$/gim, '$')\n .replace(/\\\\~/gim, '~')\n .replace(/\\\\>/gim, '>')\n .replace(/\\\\</gim, '<')\n .replace(/\\\\@/gim, '@')\n .replace(/\\\\\\\\ >/gim, '\\n') // Some newlines get converted erroneously.\n .replace(/\\[([^[\\]]*?)]{.underline}/gim, '$1') // Pandoc exports often have underlined links.\n .replace(/\\[([^[\\]]*?)]{.ul}/gim, '$1') // Another variation on underlined links.\n .replace(/\\[(http.*?)]\\(\\1\\)/gim, '$1'); // Some editors set a link to be its own anchor text, which is ugly and pointless.\n}", "function getPlainTextHTML(res){\n\t'use strict';\n\tres = res.replace(/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gim,'');\n\tres = res.replace(/<style\\b[^<]*(?:(?!<\\/style>)<[^<]*)*<\\/style>/gim,'');\n\tres = res.replace(/<!--[\\s\\S]*?-->/gim,'');\n\tres = res.replace(/(<([^>]+)>)/gim, '');\n\tres = res.replace(/^\\s+$/gim, '');\n\tres = res.replace(/(&nbsp;)/gim, '');\n\treturn res;\n}", "function previewContent(content, article){\n\n var regex = new RegExp(article.sourceName, 'g', 'i')\n var redactedContent = content.replace(regex, \"[REDACTED BY YOURAGORA]\")\n\n if(redactedContent.includes(\"<p>\")){\n if(redactedContent.match(/<p>/g).length > 2){\n var fixedContent = redactedContent.replace(/(<img)(.*?)(>)/g, '')\n var pattern = /(<p>)(.*?)(<\\/p>)/g\n // TODO: Can we loop this more elegantly?\n var par1 = pattern.exec(fixedContent)[0]\n var par2 = pattern.exec(fixedContent)[0]\n var par3 = pattern.exec(fixedContent)[0]\n var par4 = pattern.exec(fixedContent)[0]\n return [par1, par2, par3, par4].join(\" \")\n } else {\n return '';}\n } else {\n return ''\n }\n\n}", "function onIgnoreTagStripAll(){return\"\";}", "findRawChars(node, text, location, regexp) {\n let match;\n do {\n match = regexp.exec(text);\n if (match) {\n const char = match[0];\n /* In relaxed mode & only needs to be encoded if it is ambiguous,\n * however this rule will only match either non-ambiguous ampersands or\n * ampersands part of a character reference. Whenever it is a valid\n * character reference or not not checked by this rule */\n if (this.relaxed && char === \"&\") {\n continue;\n }\n /* determine replacement character and location */\n const replacement = replacementTable.get(char);\n const charLocation = sliceLocation(location, match.index, match.index + 1);\n /* report as error */\n this.report(node, `Raw \"${char}\" must be encoded as \"${replacement}\"`, charLocation);\n }\n } while (match);\n }", "function _sanitizeHtml(html) {\n return html.replace(/\\<\\s*script/gi, '');\n }", "getHTML(){const l=this.strings.length-1;let html=\"\",isCommentBinding=!1;for(let i=0;i<l;i++){const s=this.strings[i],commentOpen=s.lastIndexOf(\"<!--\");// For each binding we want to determine the kind of marker to insert\n// into the template source before it's parsed by the browser's HTML\n// parser. The marker type is based on whether the expression is in an\n// attribute, text, or comment poisition.\n// * For node-position bindings we insert a comment with the marker\n// sentinel as its text content, like <!--{{lit-guid}}-->.\n// * For attribute bindings we insert just the marker sentinel for the\n// first binding, so that we support unquoted attribute bindings.\n// Subsequent bindings can use a comment marker because multi-binding\n// attributes must be quoted.\n// * For comment bindings we insert just the marker sentinel so we don't\n// close the comment.\n//\n// The following code scans the template source, but is *not* an HTML\n// parser. We don't need to track the tree structure of the HTML, only\n// whether a binding is inside a comment, and if not, if it appears to be\n// the first binding in an attribute.\n// We're in comment position if we have a comment open with no following\n// comment close. Because <-- can appear in an attribute value there can\n// be false positives.\nisCommentBinding=(-1<commentOpen||isCommentBinding)&&-1===s.indexOf(\"-->\",commentOpen+1);// Check to see if we have an attribute-like sequence preceeding the\n// expression. This can match \"name=value\" like structures in text,\n// comments, and attribute values, so there can be false-positives.\nconst attributeMatch=lastAttributeNameRegex.exec(s);if(null===attributeMatch){// We're only in this branch if we don't have a attribute-like\n// preceeding sequence. For comments, this guards against unusual\n// attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n// <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n// below.\nhtml+=s+(isCommentBinding?marker:nodeMarker)}else{// For attributes we use just a marker sentinel, and also append a\n// $lit$ suffix to the name to opt-out of attribute-specific parsing\n// that IE and Edge do for style and certain SVG attributes.\nhtml+=s.substr(0,attributeMatch.index)+attributeMatch[1]+attributeMatch[2]+boundAttributeSuffix+attributeMatch[3]+marker}}html+=this.strings[l];return html}", "function StyleSanitizeFn(){}", "ignoringHashBangComment(code, callback) {\n const [/* all */, hashBang, js] = code.match(/^(\\s*#!.*?\\r?\\n|)([\\s\\S]*)$/);\n return hashBang + callback(js);\n }", "function updateGeneralRegex() {\n general_regex = new RegExp(\n lookaround_regexs.comment.source + '|' +\n lookaround_regexs.code.source + '|' +\n lookaround_regexs.print.source + '|' +\n lookaround_regexs.print_plain.source, 'gm');\n}", "function fixSyntaxHighlighting () {\n var sts = document.querySelectorAll('.err');\n Array.prototype.forEach.call(sts, function (st) {\n if (st.textContent === '`' || st.textContent === ':') {\n st.classList.remove('err');\n }\n })\n}", "function format_html_output() {\r\n var text = String(this);\r\n text = text.tidy_xhtml();\r\n\r\n if (Prototype.Browser.WebKit) {\r\n text = text.replace(/(<div>)+/g, \"\\n\");\r\n text = text.replace(/(<\\/div>)+/g, \"\");\r\n\r\n text = text.replace(/<p>\\s*<\\/p>/g, \"\");\r\n\r\n text = text.replace(/<br \\/>(\\n)*/g, \"\\n\");\r\n } else if (Prototype.Browser.Gecko) {\r\n text = text.replace(/<p>/g, \"\");\r\n text = text.replace(/<\\/p>(\\n)?/g, \"\\n\");\r\n\r\n text = text.replace(/<br \\/>(\\n)*/g, \"\\n\");\r\n } else if (Prototype.Browser.IE || Prototype.Browser.Opera) {\r\n text = text.replace(/<p>(&nbsp;|&#160;|\\s)<\\/p>/g, \"<p></p>\");\r\n\r\n text = text.replace(/<br \\/>/g, \"\");\r\n\r\n text = text.replace(/<p>/g, '');\r\n\r\n text = text.replace(/&nbsp;/g, '');\r\n\r\n text = text.replace(/<\\/p>(\\n)?/g, \"\\n\");\r\n\r\n text = text.gsub(/^<p>/, '');\r\n text = text.gsub(/<\\/p>$/, '');\r\n }\r\n\r\n text = text.gsub(/<b>/, \"<strong>\");\r\n text = text.gsub(/<\\/b>/, \"</strong>\");\r\n\r\n text = text.gsub(/<i>/, \"<em>\");\r\n text = text.gsub(/<\\/i>/, \"</em>\");\r\n\r\n text = text.replace(/\\n\\n+/g, \"</p>\\n\\n<p>\");\r\n\r\n text = text.gsub(/(([^\\n])(\\n))(?=([^\\n]))/, \"#{2}<br />\\n\");\r\n\r\n text = '<p>' + text + '</p>';\r\n\r\n text = text.replace(/<p>\\s*/g, \"<p>\");\r\n text = text.replace(/\\s*<\\/p>/g, \"</p>\");\r\n\r\n var element = Element(\"body\");\r\n element.innerHTML = text;\r\n\r\n if (Prototype.Browser.WebKit || Prototype.Browser.Gecko) {\r\n var replaced;\r\n do {\r\n replaced = false;\r\n element.select('span').each(function(span) {\r\n if (span.hasClassName('Apple-style-span')) {\r\n span.removeClassName('Apple-style-span');\r\n if (span.className == '')\r\n span.removeAttribute('class');\r\n replaced = true;\r\n } else if (span.getStyle('fontWeight') == 'bold') {\r\n span.setStyle({fontWeight: ''});\r\n if (span.style.length == 0)\r\n span.removeAttribute('style');\r\n span.update('<strong>' + span.innerHTML + '</strong>');\r\n replaced = true;\r\n } else if (span.getStyle('fontStyle') == 'italic') {\r\n span.setStyle({fontStyle: ''});\r\n if (span.style.length == 0)\r\n span.removeAttribute('style');\r\n span.update('<em>' + span.innerHTML + '</em>');\r\n replaced = true;\r\n } else if (span.getStyle('textDecoration') == 'underline') {\r\n span.setStyle({textDecoration: ''});\r\n if (span.style.length == 0)\r\n span.removeAttribute('style');\r\n span.update('<u>' + span.innerHTML + '</u>');\r\n replaced = true;\r\n } else if (span.attributes.length == 0) {\r\n span.replace(span.innerHTML);\r\n replaced = true;\r\n }\r\n });\r\n } while (replaced);\r\n\r\n }\r\n\r\n for (var i = 0; i < element.descendants().length; i++) {\r\n var node = element.descendants()[i];\r\n if (node.innerHTML.blank() && node.nodeName != 'BR' && node.id != 'bookmark')\r\n node.remove();\r\n }\r\n\r\n text = element.innerHTML;\r\n text = text.tidy_xhtml();\r\n\r\n text = text.replace(/<br \\/>(\\n)*/g, \"<br />\\n\");\r\n text = text.replace(/<\\/p>\\n<p>/g, \"</p>\\n\\n<p>\");\r\n\r\n text = text.replace(/<p>\\s*<\\/p>/g, \"\");\r\n\r\n text = text.replace(/\\s*$/g, \"\");\r\n\r\n return text;\r\n }", "function strip_HTML(str) {\n var findHtml = /<(.|\\n)*?>/gi;\n return str.replace(findHtml,\"\");\n}", "function sanitizeText(html) {\n\t\tif (typeof html !== 'string') {\n\t\t\treturn html;\n\t\t}\n\t\tvar value = \"<div>\" + html.replace(/(\\s)(on(?:\\w+))(\\s*=)/, '$1xss-$2$3') + \"</div>\";\n\t\tvar elems = $($.parseHTML(value, null, false));\n\n\t\telems.find('*').each(function() {\n\t\t\tsanitizeElement(this);\n });\n\n\t\treturn elems.html();\n\t}", "function RenderInlineHTML(html) {\n var rtn = html;\n var i, rule;\n for (i = 0; i < Pattern.InlineElement.length; i++) {\n rule = Pattern.InlineElement[i];\n if ((typeof rule.method) == \"function\") {\n rtn = rule.method(rtn);\n }\n else {\n rtn = rtn.replace(rule.regex, rule.replacement);\n }\n }\n return rtn;\n }", "clean(html) {\n\t\treturn html\n\t\t\t.replace(/(&#xA0;)+/g, ' ')\n\t\t\t.replace(' ', ' ')\n\t\t\t.replace(/\\s*([<>])\\s*/g, '$1');\n\t}", "function htmlDecode() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utTransform,\n sp: utilitymanager_1.um.TIXSelPolicy.Line,\n }, function (up) {\n var d = document.createElement('div');\n d.innerHTML = up.intext;\n return d.textContent;\n });\n }", "getHTML(){const l=this.strings.length-1;let html='';let isCommentBinding=false;for(let i=0;i<l;i++){const s=this.strings[i];// For each binding we want to determine the kind of marker to insert\n// into the template source before it's parsed by the browser's HTML\n// parser. The marker type is based on whether the expression is in an\n// attribute, text, or comment position.\n// * For node-position bindings we insert a comment with the marker\n// sentinel as its text content, like <!--{{lit-guid}}-->.\n// * For attribute bindings we insert just the marker sentinel for the\n// first binding, so that we support unquoted attribute bindings.\n// Subsequent bindings can use a comment marker because multi-binding\n// attributes must be quoted.\n// * For comment bindings we insert just the marker sentinel so we don't\n// close the comment.\n//\n// The following code scans the template source, but is *not* an HTML\n// parser. We don't need to track the tree structure of the HTML, only\n// whether a binding is inside a comment, and if not, if it appears to be\n// the first binding in an attribute.\nconst commentOpen=s.lastIndexOf('<!--');// We're in comment position if we have a comment open with no following\n// comment close. Because <-- can appear in an attribute value there can\n// be false positives.\nisCommentBinding=(commentOpen>-1||isCommentBinding)&&s.indexOf('-->',commentOpen+1)===-1;// Check to see if we have an attribute-like sequence preceding the\n// expression. This can match \"name=value\" like structures in text,\n// comments, and attribute values, so there can be false-positives.\nconst attributeMatch=lastAttributeNameRegex.exec(s);if(attributeMatch===null){// We're only in this branch if we don't have a attribute-like\n// preceding sequence. For comments, this guards against unusual\n// attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n// <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n// below.\nhtml+=s+(isCommentBinding?commentMarker:nodeMarker);}else {// For attributes we use just a marker sentinel, and also append a\n// $lit$ suffix to the name to opt-out of attribute-specific parsing\n// that IE and Edge do for style and certain SVG attributes.\nhtml+=s.substr(0,attributeMatch.index)+attributeMatch[1]+attributeMatch[2]+boundAttributeSuffix+attributeMatch[3]+marker;}}html+=this.strings[l];return html;}", "function prepareHTML(html) {\n\n // Clean\n html = html\n .replace(/[ ]{2,}/g, \"\") // Remove multiple spaces\n .replace(/<!--(.|\\s)*?-->/g, \"\") // Replace comments\n .replace(/([\\\\'])/g, \"\\\\$1\") // Replace values with token\n .replace(/[\\r\\t\\n]/g, \" \") // Replace line endings to spaces\n .replace(/{&gt; /g, \"{> \") // Replace {&gt; with {> (for children)\n .replace(/\\\\{/g, \"#lcb#\") // Replace left curly bracket break\n .replace(/\\\\}/g, \"#rcb#\"); // Replace right currly bracket break\n\n // Convert to jQuery\n html = $(html);\n\n // Convert attributes to markup\n convertAttrToMarkup(html, \"go-any\", \"?\");\n convertAttrToMarkup(html, \"go-none\", \"!\");\n convertAttrToMarkup(html, \"go-if\", \"?\");\n convertAttrToMarkup(html, \"go-each\", \"~\");\n convertAttrToMarkup(html, \"go-with\", \"^\");\n\n // Get HTML output\n html = html[0].outerHTML;\n\n // Remove host from href attributes\n // JQuery auto-inserts these values\n var base = location.protocol + \"//\" + location.host + \"/\";\n var regex = new RegExp(\"href=[\\\"|']\" + base, \"g\");\n html = html.replace(regex, \"href=\\\"\");\n\n //Regex Replacements\n html = html\n\t\t\t.replace(/[\\r\\t\\n]/g, \" \") // Replace line endings to spaces\n .replace(/{&gt; /g, \"{> \") // Replace {&gt; with {> (for children)\n .replace(/%7B#/g, \"{#\") // Replace %7B# with {#\n .replace(/\\{\\?\\}/g, \"{? this}\") // Replace {?} with {? this}\n .replace(/\\{\\~\\}/g, \"{~ this}\") // Replace {~} with {~ this}\n .replace(/\\{\\.\\}/g, \"{= this}\") // Replace {.} with {this}\n .replace(/\\{(([^\\/\\*\\?\\$\\^\\*\\.\\+\\-\\!@%&~#:>=]{1})([^{}]*))\\}/g, \"{= $1}\"); // Replace {expression} with {= expression}\n\n return html;\n }", "function basic_formatter(text){\n var lines = text.split(/\\n/),\n formatRe = /\\B\\*([^\\*]+?)\\*\\B|\\B\\/([^\\/]+?)\\/\\B/g,\n toRet=[];\n $.each(lines, function(i,line){\n if(line){\n toRet.push(line.replace(formatRe, function(match, p1, p2){\n if(p1){\n return '<b>'+p1+'</b>';\n } else if(p2){\n return '<i>'+p2+'</i>';\n } else {\n return match;\n }\n }));\n }\n });\n return '<p>'+toRet.join('</p><p>')+'</p>';\n}", "function formatText(text){\n text = text.replace(/\\r/g, \" \").replace(/\\n/g, \" \");\n text = text.replaceAll(/#w(.*?)#w;/g, \"<span class='text-important'>$1</span>\");\n text = text.replaceAll(/##(.*?)##;/g, \"<span class='text-title'>$1</span>\");\n text = text.replaceAll(/#d(.*?)#d;/g, \"<span class='text-discrete'>$1</span>\");\n text = text.replaceAll(/\\*\\*(.*?)\\*\\*/g, \"<b>$1</b>\");\n text = text.replaceAll(/\\*(.*?)\\*/g, \"<i>$1</i>\");\n text = text.replaceAll(\"#\\\\n\", \"<br/><br/>\");\n text = text.replaceAll(/#u(.*?)#u;/g, \"<ul>$1</ul>\");\n text = text.replaceAll(/#i(.*?)#i;/gim, \"<li>$1</li>\");\n text = text.replaceAll(/#ic(.*?)#ic;/gim, \"<span class='text-inlinecode'>$1</span>\");\n return text;\n}", "function replaceBBCode(postContentDiv) {\n\t// This is fugly and I hope no one sees it...but it'll do for now.\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/(?:alt=\")?(:\\)|;\\)|:\\(|:'\\(|:D|:P|:p|o_o|:=|>:\\(|:grr:|:rolleyes:|>_<|:doh:|:blush:|\\^\\^|:\\/(?!\\/)|o_O|X_X|x_x|XD|xD|:ninja:|:zombie:|B\\)|<3|:heart:|:\\*|:o|:O)/g,replaceSmiley); // matching alt=\" prevents double-parsing b/c alt=\":) is not a case\n\tif(postContentDiv.innerHTML.search(/[\\[\\]]/) == -1) {\n\t\tif(DEBUG) console.count(\"Aborted BBCode\"); // no need to run a dozen RegExps if there is no BBCode anyway\n\t\treturn;\n\t}\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[b\\]/gi,\"<span style=\\\"font-weight: bold;\\\">\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[\\/b\\]/gi,\"</span>\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[i\\]/gi,\"<span style=\\\"font-style: italic;\\\">\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[\\/i\\]/gi,\"</span>\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[s\\]/gi,\"<span style=\\\"text-decoration: line-through;\\\">\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[\\/s\\]/gi,\"</span>\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[size=[\" ]?[\" ]?(xx-small|x-small|small|medium|large|x-large|xx-large)[\" ]?[\" ]?\\]/gi,\"<span style=\\\"font-size: $1;\\\">\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[\\/size\\]/gi,\"</span>\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[color=[\" ]?[\" ]?(#?\\w*?)[\" ]?[\" ]?\\]/gi,\"<span style=\\\"color: $1;\\\">\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[\\/color\\]/gi,\"</span>\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[url=[\" ]?[\" ]?(.*?)[\" ]?[\" ]?\\](.*?)\\[\\/url\\]/gi,\"<a href=\\\"$1\\\" class=\\\"parserLinks\\\">$2</a>\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[img=[\" ]?[\" ]?(.*?)[\" ]?[\" ]?\\]/gi,\"<img src=\\\"$1\\\">\");\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[quote=[\" ]?[\" ]?(.*?)[\" ]?[\" ]?\\]([\\s\\S]*?)\\[\\/quote\\]/gi,\"<blockquote class=\\\"linkFixQuote\\\"><address>$1 said:</address>$2</blockquote>\");\n\t\n\tpostContentDiv.innerHTML = postContentDiv.innerHTML.replace(/\\[list(?:=\"?[a1]\"?)?\\][\\s\\S]*?\\[\\/list\\]/gim,replaceList);\n}", "function testOutput(text, check) {\n checkBlock.innerHTML += '<p><span class=\"code\">' + text.substring(0, text.indexOf(')') + 1) + \"</span>\" + text.substring(text.indexOf(')') + 1, text.length) + ': <span class=\"' + check + '\">' + e.cap(check) + '!</span></p><hr/>';\n }", "function filterNote(text) {\n var session_id = $(\"#session_id\").val();\n\n // 替换跳转页面\n text = text.replace(/@[\\w-.#]+/g, function($0){ \n var page_code=$0.substr(1);\n return \" <span class='jump_color'> <a href='/wx/doct_init?session_id=\"+session_id+\"&page_code=\"+page_code.replace('#','%23')+\"'>\"+page_code+\"</a></span> \";\n });\n\n // 替换索引\n text = text.replace(/\\[[\\s\\w-*#§¶†‡•Ü|]+\\]/g, function($0){ \n var note_code=$0.substr(1,$0.length-2);\n var p = note_code.lastIndexOf('-');\n return \" <sup class='jump_color'><a onclick='note_click(\\\"\"+note_code+\"\\\")' href='#'>[\"+note_code.substr(p+1).replace('#','%23')+\"]</a></sup> \";\n });\n\n return text;\n}", "function extractTextFromMainBody() {\n //\n // RAW PART\n //\n rawArticle = setTitleSectionSeparator('MAIN CONTENT [ RAW ]')\n\n // html texts in page\n let htmlTexts = Array.from(document.querySelectorAll('h1,h2,h3,h4,h5,h6,p'))\n .map(x => {\n return {\n type: x.tagName,\n text: x.innerText.trim(),\n }\n })\n .filter(x => x.text.length > 0)\n .map(x => {\n // detect titles and set title with markdown style (ex: h1=#, h2=##, h3=###, ...)\n let t = x.type == 'P' ? x.text : '\\n' + titleToSymbol(x.type, x.text, '#').text\n return t\n })\n\n //\n // print text as full lines\n //\n rawArticle += htmlTexts\n .join('\\n')\n .replace(/(.+?[.!?)\\]}|][\\s\\r\\n])|(.+[\\s\\r\\n])/gmi, x => x + '\\n')\n rawArticle += '\\n\\n';\n console.log(rawArticle);\n\n injectPreInHTML(rawArticle, 'dodgerblue', 'pre-content-raw')\n\n\n\n //\n // SPLITTED PART\n //\n rawArticle = setTitleSectionSeparator('MAIN CONTENT [ SPLIT ]')\n\n //\n // print text as splitted lines according to \"ponctuation\" or \"special words\"\n //\n /**\n * PRONOUNS\n * ARTICLES\n * COORDINATING_CONJUNCTIONS\n * POSSESIVE\n * PREPOSITIONS\n * QUESTIONNING\n */\n rawArticle += htmlTexts\n .join('\\n')\n .replace(/(.+?[,:.!?)\\]}|][\\s\\r\\n])|(.+[\\s\\r\\n])/gmi, x => x + '\\n')\n .replace(new RegExp(`(\\\\b(${PRONOUNS[language]})\\\\b.+?[,.!?:)\\\\]}|])`, 'gmi'), x => '\\n' + x)\n .replace(new RegExp(`(\\\\b(${ARTICLES[language]})\\\\b.+?[,.!?:)\\\\]}|])`, 'gmi'), x => '\\n' + x)\n .replace(new RegExp(`(\\\\b(${COORDINATING_CONJUNCTIONS[language]})\\\\b.+?[,.!?:)\\\\]}|])`, 'gmi'), x => '\\n' + x)\n .replace(new RegExp(`(\\\\b(${POSSESIVE[language]})\\\\b.+?[,.!?:)\\\\]}|])`, 'gmi'), x => '\\n' + x)\n .replace(new RegExp(`(\\\\b(${PREPOSITIONS[language]})\\\\b.+?[,.!?:)\\\\]}|])`, 'gmi'), x => '\\n' + x)\n .replace(new RegExp(`(\\\\b(${QUESTIONNING[language]})\\\\b.+?[.!?:)\\\\]}|])`, 'gmi'), x => '\\n' + x)\n\n // always display results in console\n rawArticle += '\\n\\n';\n console.log(rawArticle);\n\n injectPreInHTML(rawArticle, 'lightpink', 'pre-content-split')\n}", "function highlight() {\n var code_blocks = document.body.getElementsByClassName(\"language-c\");\n var keywords = [\n \"auto\", \"break\", \"case\", \"char\", \"const\", \"continue\", \"default\",\n \"do\", \"double\", \"else\", \"enum\", \"extern\", \"float\", \"for\", \"goto\",\n \"if\", \"inline\", \"int\", \"long\", \"register\", \"restrict\", \"return\",\n \"short\", \"signed\", \"sizeof\", \"static\", \"struct\", \"switch\",\n \"typedef\", \"union\", \"unsigned\", \"void\", \"volatile\", \"while\",\n ];\n var regex_var = /\\b[A-z][A-z0-9]*/;\n var regex_number = /\\b0[xX][0-9a-fA-F]+\\b|\\b[0-9]*\\.[0-9]+\\b|\\b[0-9]*\\b/;\n var regex_string = /\"[^\"]*\"/;\n var regex_symbol = /&gt;|&lt;|\\ |\\(|\\)|;|-/;\n for (var i = 0; i < code_blocks.length; i++) {\n var element = code_blocks.item(i);\n var code_lines = element.innerHTML.split('\\n');\n var cursor = 0;\n\n var parts = [];\n var insert_index = 0;\n function insert_at(index, insertable) {\n if (index < insert_index) console.error(\"inserting before last insert!!\");\n parts.push(element.innerHTML.substr(insert_index, index - insert_index));\n parts.push(insertable);\n insert_index = index;\n }\n\n var in_block_comment = false;\n\n for (var j = 0; j < code_lines.length; j++) {\n var words = code_lines[j].split(regex_symbol);\n var in_line_comment = false;\n\n for (var k = 0; k < words.length; k++) {\n var word = words[k];\n\n // Special case for < and >, because they're escaped in\n // innerHTML.\n var to_be_processed_html = element.innerHTML.substr(cursor);\n if (to_be_processed_html.startsWith(\"lt;\") ||\n to_be_processed_html.startsWith(\"gt;\")) {\n cursor += 3;\n }\n\n if (in_block_comment) {\n if (word == \"*/\") {\n in_block_comment = false;\n insert_at(cursor + word.length, \"</span>\"); // close comment block\n }\n } else {\n if (!in_line_comment) {\n if (word == \"//\") {\n in_line_comment = true;\n insert_at(cursor, \"<span class='syntax-comment'>\"); // open comment line\n }\n if (word == \"/*\") {\n in_block_comment = true;\n insert_at(cursor, \"<span class='syntax-comment'>\"); // open comment block\n }\n }\n\n if (!in_line_comment && !in_block_comment) {\n if (keywords.indexOf(word) != -1) {\n insert_at(cursor, \"<span class='syntax-keyword'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_string.test(word)) {\n insert_at(cursor, \"<span class='syntax-string'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_var.test(word) && element.innerHTML.substr(cursor + word.length, 1) == \"(\") {\n insert_at(cursor, \"<span class='syntax-call'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_var.test(word)) {\n insert_at(cursor, \"<span class='syntax-variable'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_number.test(word)) {\n insert_at(cursor, \"<span class='syntax-number'>\");\n insert_at(cursor + word.length, \"</span>\");\n }\n }\n }\n\n cursor += word.length + 1;\n }\n\n if (in_line_comment) {\n insert_at(cursor, \"</span>\"); // close comment line\n }\n }\n\n parts.push(element.innerHTML.substr(insert_index));\n element.innerHTML = parts.join('');\n\n // When processing, using &lt; and &gt; is forced upon us. Now we\n // can fix that to allow for good copypasting.\n element.innerHTML.replace(/&lt;/g, \"<\");\n element.innerHTML.replace(/&gt;/g, \">\");\n }\n}", "function fixUpInsertionPoint() {\n moveIPToOutsideOfParagraphToPreventInvalidHTML();\n backUpCursorIfAfterNonBreakingSpaceInTableCell();\n}", "function highlightMultilinePres() {\n var pres = document.querySelectorAll('pre');\n \n for (var i = 0; i < pres.length; ++i) {\n var pre = pres[i];\n\n // only all text pres are desired to be fixed\n if (pre.children.length > 0)\n continue;\n \n // only multi-line pres\n if (!pre.textContent.includes(\"\\n\"))\n continue;\n \n var code = document.createElement(\"CODE\");\n code.innerHTML = pre.innerHTML;\n pre.innerHTML = \"\";\n pre.appendChild(code);\n \n hightlightCodeBlock(code, pre);\n }\n}", "getHTML() {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment poisition.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceeding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceeding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n }\n else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }", "function escapeDangerousHtml(text) {\n\t// Wrap in span because we may have multiple nodes\n\tlet whitelistNodes = ['b', 'i', 'u', 'font', '#text', 'br'];\n\tlet whitelistParameters = ['color', 'size'];\n\tlet html = htmlToElement(`<span>${text}</span>`);\n\tfunction escapeRecursively(element) {\n\t\tif(whitelistNodes.indexOf(element.nodeName.toLowerCase()) === -1) {\n\t\t\telement.parentElement.replaceChild(document.createTextNode(element.innerText), element);\n\t\t}\n\t\telse {\n\t\t\tif('attributes' in element) {\n\t\t\t\tlet attributesToRemove = [];\n\t\t\t\tfor(let attrIndex = 0; attrIndex < element.attributes.length; ++attrIndex) {\n\t\t\t\t\tlet attr = element.attributes.item(attrIndex);\n\t\t\t\t\tif(whitelistParameters.indexOf(attr.localName) === -1) {\n\t\t\t\t\t\tattributesToRemove.push(attr.localName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(let attribute of attributesToRemove) {\n\t\t\t\t\telement.removeAttribute(attribute);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(let i = 0; i < element.childNodes.length; ++i) {\n\t\t\t\tescapeRecursively(element.childNodes[i]);\n\t\t\t}\n\t\t}\n\t}\n\tfor(let i = 0; i < html.childNodes.length; ++i) {\n\t\tescapeRecursively(html.childNodes[i]);\n\t}\n\treturn html.innerHTML;\n}", "function sanitizeContent(content) {\n let output = \"\";\n let offset = 0;\n // test ![...](...)\n // test [...](...)\n // <a name=\"myAnchor\"></a>Anchor Header\n // test [^footnote]\n const r = /\\!?\\[([^\\]]*)\\]\\(([^)]*)\\)|<([^>]*)>([^<]*)<\\/([^>]*)>|\\[\\^([^\\]]*)\\]/g;\n let match = null;\n // tslint:disable-next-line:no-conditional-assignment\n while ((match = r.exec(content))) {\n output += content.slice(offset, match.index);\n offset = match.index + match[0].length;\n if (match[0][0] === \"<\") {\n output += match[4];\n }\n else if (match[0][0] === \"[\" && match[0][1] === \"^\") {\n // # footnote\n output += \"\";\n }\n else if (match[0][0] !== \"!\") {\n output += match[1]; // image\n }\n else {\n output += match[0];\n }\n }\n output += content.slice(offset, content.length);\n return output;\n}", "function outputRaw() {\r\n\t\r\n\tvar renderData = buildRawOutput();\r\n\t\r\n\t$('#sjo-api-textarea-raw').html(renderData.bodyHtml.join('\\r\\n')).show();\r\n\r\n\t// Change status message\r\n\t$('#sjo-api-status').text('Matched ' + \r\n\t\t(renderData.numRowsMatched == data.length ? '' : \r\n\t\t\trenderData.numRowsMatched + ' of ') + data.length + ' rows').show();\r\n\t\r\n\t$('#sjo-api-button-truncate').hide();\r\n\t$('#sjo-api-invalidonly-wrapper').hide();\r\n\t$('#sjo-api-button-dupes').show();\r\n\t\r\n}", "function reportSyntaxError(self) { callback(self._syntaxError(/^\\S*/.exec(input)[0])); }", "function reportSyntaxError(self) { callback(self._syntaxError(/^\\S*/.exec(input)[0])); }" ]
[ "0.53842604", "0.53379184", "0.5234418", "0.5148536", "0.5039616", "0.50360775", "0.50360775", "0.50063103", "0.49855205", "0.4949308", "0.4939795", "0.49372882", "0.4928766", "0.49035624", "0.48491928", "0.4833677", "0.4816147", "0.48147166", "0.47953978", "0.47653732", "0.47386152", "0.47313797", "0.4723624", "0.4716786", "0.47166783", "0.47134888", "0.4688576", "0.46833712", "0.46660933", "0.4665148", "0.46599075", "0.465866", "0.46341133", "0.4633075", "0.46286651", "0.46223587", "0.46195656", "0.4618312", "0.4618312", "0.46182892", "0.46107495", "0.46096516", "0.45851564", "0.45717213", "0.45717213", "0.45717213", "0.45717213", "0.45717213", "0.45703176", "0.45703176", "0.45703176", "0.455568", "0.45463842", "0.45392904", "0.45261797", "0.4524686", "0.45234752", "0.4507428", "0.45069575", "0.45069575", "0.45069575", "0.45061815", "0.4504785", "0.4504785", "0.4497522", "0.44955957", "0.44895154", "0.44885334", "0.4484807", "0.44741824", "0.4464052", "0.44551516", "0.44540882", "0.44531047", "0.44510406", "0.44483036", "0.4447009", "0.4443355", "0.4440262", "0.444002", "0.4435392", "0.44213063", "0.44174746", "0.4416123", "0.4414635", "0.44101405", "0.44081736", "0.4399096", "0.4397941", "0.4397148", "0.43963468", "0.4396043", "0.4388528", "0.4386798", "0.43853128", "0.43847695", "0.43827584", "0.43797693", "0.43797693" ]
0.56612295
1
REMOVE: after v1, rules will only receive TreeNodes
lintByLine(rule, lines) { return lines.map((line) => { // this.inlineConfig.getOptsAtIndex(line.index); return this.callRuleLint(rule, line);//, this.inlineConfigs.current); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "anchoredNodeRemoved(node) {}", "remove(value) {\n this.root = this.removeVisitor(this.root, value)\n }", "remove(tree){\n let replaceWith;\n if(this.left && this.right){\n const next = this.right.getLeftmostChild();\n this.low = next.low;\n this.high = next.high;\n this.intervals = next.intervals;\n this.removeUpdateLimits();\n next.handleRemoval(tree); \n }else{\n this.handleRemoval(tree);\n }\n }", "removeNode (value) {\n this.nodes.delete(value)\n this.nodes.forEach(node => {\n if (node.includes(value)) {\n let newNodes = node.filter(item => item !== value)\n while (node.length > 0) {\n node.pop()\n }\n newNodes.forEach(item => node.push(item))\n }\n })\n }", "_cleanNode(node){\n const removeList = [\"passengers\", \"flights\", \"documents\", \"phones\", \"emails\"];\n for(let i=0; i<removeList.length;i++){\n delete node[\"data\"][removeList[i]];\n }\n return node;\n }", "handleRemoval(tree){\n // Get the one child node, if there is one.\n const child = this.left || this.right;\n // Handle the case where this node is the root\n if(!this.parent){\n tree.root = child;\n if(child){\n child.parent = null;\n child.color = Black;\n }\n // Delete a red node (which by implication has no children)\n }else if(this.color === Red){\n this.makeOrphan();\n // Delete a black node with a red child\n }else if(child && child.color === Red){\n this.intervals = child.intervals;\n this.low = child.low;\n this.high = child.high;\n this.minimumLow = child.minimumLow;\n this.maximumLow = child.maximumLow;\n this.minimumHigh = child.minimumHigh;\n this.maximumHigh = child.maximumHigh;\n this.left = child.left;\n this.right = child.right;\n // Delete a black node with a black child\n // Note: This case should not actually be reachable?\n }else if(child){\n this.swapWithChild(child);\n child.removalFix(tree);\n this.makeOrphan();\n // Delete a black node with no children\n }else{\n this.removalFix(tree);\n this.makeOrphan();\n }\n // Update interval information\n if(this.parent){\n this.parent.removeUpdateLimits();\n // Note: A reference implementation used this behavior instead.\n // This change did not cause issues during extensive testing.\n // Still, if bugs occur, it may be because of this change.\n // this.parent.immediateUpdateLimits();\n // if(this.parent.parent) this.parent.parent.removeUpdateLimits();\n }\n }", "remove() {\r\n manipulation_1.removeClausedNodeChild(this);\r\n }", "function dropNodes(tree) {\n var _match3;\n\n return match(tree, (_match3 = {}, _match3[NODE] = function (node) {\n return node.data;\n }, _match3[OBJECT] = function (obj) {\n return mapValues(obj, dropNodes);\n }, _match3[ARRAY] = function (ar) {\n return ar.map(dropNodes);\n }, _match3[NULL] = function () {\n return null;\n }, _match3));\n}", "remove(data){\n this.children = this.children.filter(node=>{\n return node.data!==data;\n })\n }", "remove() {\n this.node.remove()\n }", "removeNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n var {\n at = editor.selection,\n match\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Editor.isBlock(editor, n);\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at);\n }\n\n var depths = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var pathRefs = Array.from(depths, (_ref4) => {\n var [, p] = _ref4;\n return Editor.pathRef(editor, p);\n });\n\n for (var pathRef of pathRefs) {\n var path = pathRef.unref();\n\n if (path) {\n var [node] = Editor.node(editor, path);\n editor.apply({\n type: 'remove_node',\n path,\n node\n });\n }\n }\n });\n }", "removeNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n var {\n at = editor.selection,\n match\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Editor.isBlock(editor, n);\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at);\n }\n\n var depths = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n var pathRefs = Array.from(depths, _ref4 => {\n var [, p] = _ref4;\n return Editor.pathRef(editor, p);\n });\n\n for (var pathRef of pathRefs) {\n var path = pathRef.unref();\n\n if (path) {\n var [node] = Editor.node(editor, path);\n editor.apply({\n type: 'remove_node',\n path,\n node\n });\n }\n }\n });\n }", "remove(data){\n //because doesn't modifu original array, would re-assign\n this.children = this.children.filter(node => {\n //for every node in array, do a check\n // if return true, want to keep, false to remove\n // this is why we used (!==) falsey operator\n return node.data !== data;\n });\n }", "remove(data){\n //Root is reinitialized the root at modified binary tree.\n this.root = this.removeNode(this.root, data);\n }", "removeAll() {\n this.nodes.forEach(node => node.parentNode.removeChild(node));\n this.nodes = [];\n this.component.resolveElements();\n }", "remove() {\n multiReplaceStatement({\n parent: this.parent,\n node: this.fullNode,\n replacements: [],\n });\n }", "removeMatches(subject, predicate, object, graph) {\n return this.remove(this.match(subject, predicate, object, graph));\n }", "remove(data) {\n // Root is re-initialized with root of a modified tree\n this.root = this.removeNode(this.root, data);\n }", "function removeRules() {\n var rulesDivs = document.querySelectorAll(\".clothingRule\"); \n if (rulesDivs) {\n for (var i = 0; i < rulesDivs.length; i++) {\n rulesDiv.removeChild(rulesDivs[i]);\n }\n }\n}", "function removeNode(name) {\n nodes = _.filter(nodes, function (node) { return (node[\"name\"] != name) });\n links = _.filter(links, function (link) { return ((link[\"source\"][\"name\"] != name) && (link[\"target\"][\"name\"] != name)) });\n update();\n}", "removeNodes (nodes) {\n if (!nodes.length) { return }\n\n function removeFn () {\n var parent = nodes[0].parentNode;\n for (var i = nodes.length - 1; i >= 0; --i) {\n cleanNode(nodes[i]);\n parent.removeChild(nodes[i]);\n }\n }\n\n if (this.beforeRemove) {\n var beforeRemoveReturn = this.beforeRemove({\n nodesToRemove: nodes, foreachInstance: this\n }) || {};\n // If beforeRemove returns a `then`–able e.g. a Promise, we remove\n // the nodes when that thenable completes. We pass any errors to\n // ko.onError.\n if (typeof beforeRemoveReturn.then === 'function') {\n beforeRemoveReturn.then(removeFn, options.onError);\n }\n } else {\n removeFn();\n }\n }", "remove(data) {\n // root is re-initialized with \n // root of a modified tree. \n this.root = this.removeNode(this.root, data);\n }", "remove(value) {\n this.root = this.removeNode(thisroot, value);\n }", "remove () {\n this.node.parentNode.removeChild(this.node)\n this.stylesheet.parentNode.removeChild(this.stylesheet)\n }", "function removeUnusedSubtrees(node) {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n return false;\n }\n else {\n node.remove();\n }\n return true;\n }", "remove(data) {\n if (this.root != null) {\n this.root = this.removeNode(data, this.root);\n }\n }", "remove(data) {\n // root is re-initialized with\n // root of a modified tree.\n this.root = this.removeNode(this.root, data);\n }", "removeNode(g, n) { }", "removeNode(g, n) { }", "function walkAll(nodes){\n var result = null\n for (var i=0;i<nodes.length;i++){\n var childNode = nodes[i]\n if (childNode.type === 'EmptyStatement') continue\n var result = walk(childNode)\n if (result === 'remove'){\n nodes.splice(i--, 1)\n }\n }\n }", "remove(index){\n const leader = this.traverseToIndex(index-1)\n const unwantedNode = leader.next;\n leader.next = unwantedNode.next;\n this.length --;\n }", "removeNode() {\n let root;\n if (!this.data.length) {\n return;\n }\n if (this.data.length === 1) {\n root = this.data.pop();\n } else {\n root = this.data[0];\n this.data[0] = this.data[this.data.length - 1];\n this.data = this.data.slice(0, this.data.length - 1);\n }\n\n this.usage.delete(root);\n this.heapifyDown(0);\n this.store.setItem(this.key + \"_searchData\", this.data);\n this.store.setItem(this.key + \"_searchUsageMap\", this.usage);\n return root;\n }", "function clean( node ){\n\tvar l = node.c.length;\n\twhile( l-- ){\n\t\tif( typeof node.c[l] == 'object' )\n\t\t\tclean( node.c[l] );\n\t}\n\tnode.n = node.a = node.c = null;\n}", "function removeUnusedSubtrees(node) {\n var parent = node.parent;\n if (node instanceof dataflow_1.OutputNode || node.numChildren() > 0) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n return false;\n }\n else {\n node.remove();\n }\n return true;\n}", "removalFix(tree){\n let node = this;\n while(node.color === Black && node.parent){\n let sibling = node.getSibling();\n if(sibling.color === Red){\n sibling.rotate(tree);\n sibling = node.getSibling();\n }\n if(\n (!sibling.left || sibling.left.color === Black) &&\n (!sibling.right || sibling.right.color === Black)\n ){\n sibling.color = Red;\n node = node.parent;\n }else{\n if(sibling === sibling.parent.left && (\n !sibling.left || sibling.left.color === Black\n )){\n sibling = sibling.rotateLeft(tree);\n }else if(sibling === sibling.parent.right && (\n !sibling.right || sibling.right.color === Black\n )){\n sibling = sibling.rotateRight(tree);\n }\n sibling.rotate(tree);\n node = node.parent.getSibling();\n }\n }\n node.color = Black;\n }", "function clean(node) {\n if ( node.source ) {\n var file = node.source.input.file\n node.source = {input:{}}\n node.source.input.file = path.basename(file);\n }\n if ( node.nodes ) node.nodes = node.nodes.map(clean);\n return node;\n}", "remove(index) {\n\t\tif (index < 0) {\n\t\t\treturn false\n\t\t}\n\t\tif (index === 0) {\n\t\t\tlet currentNode = this.head\n\t\t\tthis.head = currentNode.next\n\t\t\t//free up memory in space by pointing it to null\n\t\t\tcurrentNode = null\n\t\t\tthis.length--\n\t\t} else {\n\t\t\tconst currentNode = this.getIndex(index - 1)\n\t\t\t//Creates pointer on the unwanted Node object.\n\t\t\tlet unwantedNode = currentNode.next\n\t\t\t//Has the currentNode object link up using the next attribute to whatever the unwatned object is pointing at\n\t\t\tcurrentNode.next = unwantedNode.next\n\t\t\t//free up memory in space by pointing it to null\n\t\t\tunwantedNode.next = null\n\t\t\tthis.length--\n\t\t\treturn this\n\t\t}\n\t}", "function removeNodes() {\n \tconst nodes = document.removeAttribute(\".fn-remove-me\");\n \tnodes.innerHTML //este no sé cómo pintar en html una vez quitado el atributo .fn-remove-me\n}", "function removeRules()\n\t{\n\t\tif(style)\n\t\t\tstyle.parentNode.removeChild(style);\n\t}", "removeNode(node, id) {\n if (!this.nodes[id]) {\n throw new Error(\"removeNode: attempting to remove a node which is not in hashmap\");\n }\n let val = this.nodes[id].value;\n switch (this.comparator.compare(val, node.value)) {\n case 0:\n // eq - handle siblings if present\n if (node.siblings.length > 0) {\n // if node to remove is alpha sibling...\n if (node.id === id) {\n // get first sibling as replacement\n let alphaSiblingId = node.siblings.shift();\n let alphaSibling = this.nodes[alphaSiblingId];\n // remap all properties but id and value from node onto alphasibling\n alphaSibling.parent = node.parent;\n this.updateChildLink(node.parent, id, alphaSiblingId);\n if (node.left) {\n this.nodes[node.left].parent = alphaSiblingId;\n }\n if (node.right) {\n this.nodes[node.right].parent = alphaSiblingId;\n }\n alphaSibling.left = node.left;\n alphaSibling.right = node.right;\n alphaSibling.siblings = node.siblings;\n alphaSibling.height = node.height;\n alphaSibling.balance = node.balance;\n if (this.apex === id) {\n this.apex = alphaSiblingId;\n }\n // parent all remaining siblings alphaSibling (new parent)\n for (let si of alphaSibling.siblings) {\n this.nodes[si].parent = alphaSiblingId;\n }\n // delete old node from nodes and return\n delete this.nodes[id];\n return;\n }\n // else we are inner sibling\n else {\n let idx = node.siblings.indexOf(id);\n if (idx === -1) {\n throw new Error(\"Unable to remove sibling from parented sibling\");\n }\n node.siblings.splice(idx, 1);\n delete this.nodes[id];\n return;\n }\n }\n // else we have no siblings, node will be removed\n else {\n // if node to delete has no children\n if (!node.left && !node.right) {\n // if we have a parent, remove us from either left or right child link\n this.updateChildLink(node.parent, node.id, null);\n delete this.nodes[id];\n if (id === this.apex) {\n this.apex = null;\n }\n return;\n }\n // if node to delete has only one child we can do simple copy/replace\n if (!node.left || !node.right) {\n if (node.left) {\n this.promoteChild(node, this.nodes[node.left]);\n if (this.apex === id) {\n this.apex = node.left;\n }\n }\n if (node.right) {\n this.promoteChild(node, this.nodes[node.right]);\n if (this.apex === id) {\n this.apex = node.right;\n }\n }\n return;\n }\n // node to delete has two children, need swap with inorder successor\n // use find inorder successor by default\n this.promoteSuccessor(node);\n return;\n }\n case 1:\n // gt - search right branch\n if (!node.right) {\n throw new Error(\"removeNode: Unable to find value in tree\");\n }\n this.removeNode(this.nodes[node.right], id);\n break;\n case -1:\n // lt - search left branch\n if (!node.left) {\n throw new Error(\"removeNode: Unable to find value in tree\");\n }\n this.removeNode(this.nodes[node.left], id);\n break;\n }\n this.updateBalance(node);\n if (node.balance < -1) {\n if (node.left === null) {\n throw new Error(\"insertNode.balance() : left child should not be null\");\n }\n if (this.nodes[node.left].balance <= 0) {\n this.leftLeftCase(node);\n }\n else {\n this.leftRightCase(node);\n }\n }\n if (node.balance > 1) {\n if (node.right === null) {\n throw new Error(\"insertNode.balance() : right child should not be null\");\n }\n if (this.nodes[node.right].balance >= 0) {\n this.rightRightCase(node);\n }\n else {\n this.rightLeftCase(node);\n }\n }\n }", "removeHead() {\n let result = this.root;\n this.root = this.root.next;\n if (this.root && this.root.prev) {\n this.root.prev = null;\n }\n return result;\n }", "function cleanupListIgnore(node, levels) {\n var nodesToRemove = [];\n for (var child = node.firstChild; child; child = child.nextSibling) {\n // Clean up the item internally first if we need to based on the number of levels\n if (child.nodeType == 1 /* Element */ && levels > 1) {\n cleanupListIgnore(child, levels - 1);\n }\n // Try to convert word comments into ignore elements if we haven't done so for this element\n child = fixWordListComments(child, true /*removeComments*/);\n // Check if we can remove this item out\n if (isEmptySpan(child) || isIgnoreNode(child)) {\n nodesToRemove.push(child);\n }\n }\n nodesToRemove.forEach(function (child) { return node.removeChild(child); });\n}", "function removeUnnecessaryNodes(node) {\n // remove empty non positive filter\n if (node instanceof nonpositivefilter_1.NonPositiveFilterNode && util_1.every(util_1.vals(node.filter), function (b) { return b === false; })) {\n node.remove();\n }\n // remove empty null filter nodes\n if (node instanceof nullfilter_1.NullFilterNode && util_1.every(util_1.vals(node.filteredFields), function (f) { return f === null; })) {\n node.remove();\n }\n // remove output nodes that are not required\n if (node instanceof dataflow_1.OutputNode && !node.isRequired()) {\n node.remove();\n }\n node.children.forEach(removeUnnecessaryNodes);\n}", "remove(index){\n// check the param\n\nconst leader = this.traverseToIndex(index-1);\nconst unwamtedNode = leader.next;\nleader.next = unwamtedNode.next;\nthis.length--;\n\n\n}", "__removeChildren() {\n let remove = (children) => {\n for(let i = 0; i < children.length; i++) {\n let child = children[i];\n\n remove(child.__akili.__children);\n child.__akili.__remove();\n i--;\n }\n };\n\n remove(this.__children);\n }", "function nodeRemove(items) {\r\n var i, node = null, parent = null, args = ArrayProto.slice.call(arguments), len = args.length;\r\n\r\n for (i = 0; i < len; ++i) {\r\n node = args[i];\r\n if (isElement(node)) {\r\n parent = node.parentNode;\r\n parent.removeChild(node);\r\n }\r\n }\r\n }", "function remover(myNode){\r\n\r\n while(myNode.hasChildNodes())\r\n {\r\n myNode.removeChild(myNode.lastChild);\r\n }\r\n }", "function cleanUpNodesAfterPrune(remainingNodePath) {\n\t if (n.VariableDeclaration.check(remainingNodePath.node)) {\n\t var declarations = remainingNodePath.get('declarations').value;\n\t if (!declarations || declarations.length === 0) {\n\t return remainingNodePath.prune();\n\t }\n\t }\n\t else if (n.ExpressionStatement.check(remainingNodePath.node)) {\n\t if (!remainingNodePath.get('expression').value) {\n\t return remainingNodePath.prune();\n\t }\n\t }\n\t else if (n.IfStatement.check(remainingNodePath.node)) {\n\t cleanUpIfStatementAfterPrune(remainingNodePath);\n\t }\n\t return remainingNodePath;\n\t }", "tryRemove() {\n var node = /** @type {KMLNode} */ (this.scope['item']);\n if (node) {\n if (node.hasChildren()) {\n var label = node.getLabel();\n var prompt = 'Are you sure you want to remove <strong>' + label + '</strong> from the tree? This will also ' +\n 'remove all descendants.';\n\n ConfirmUI.launchConfirm(/** @type {!osx.window.ConfirmOptions} */ ({\n confirm: this.removeNodeInternal.bind(this, node),\n prompt: prompt,\n\n windowOptions: /** @type {!osx.window.WindowOptions} */ ({\n icon: 'fa fa-trash-o',\n label: 'Remove ' + label\n })\n }));\n } else {\n this.removeNodeInternal(node);\n }\n }\n }", "remove(...args) {\n let removedNodes = [];\n for (let current = this.#head.next; // head is dummy, skip it\n current != this.#tail; // tail is dummy, don't go past it\n current = current.next) {\n\n // Is current node in args?\n if (args.includes(current.value)) {\n let node = current;\n removedNodes.push(current.value);\n current = current.next;\n node.prev.next = node.next;\n node.next.prev = node.prev;\n this.#length--;\n }\n }\n\n return removedNodes;\n }", "function cleanUpNodesAfterPrune(remainingNodePath) {\n if (n.VariableDeclaration.check(remainingNodePath.node)) {\n var declarations = remainingNodePath.get('declarations').value;\n if (!declarations || declarations.length === 0) {\n return remainingNodePath.prune();\n }\n } else if (n.ExpressionStatement.check(remainingNodePath.node)) {\n if (!remainingNodePath.get('expression').value) {\n return remainingNodePath.prune();\n }\n } else if (n.IfStatement.check(remainingNodePath.node)) {\n cleanUpIfStatementAfterPrune(remainingNodePath);\n }\n\n return remainingNodePath;\n }", "function cleanUpNodesAfterPrune(remainingNodePath) {\n if (n.VariableDeclaration.check(remainingNodePath.node)) {\n var declarations = remainingNodePath.get('declarations').value;\n if (!declarations || declarations.length === 0) {\n return remainingNodePath.prune();\n }\n } else if (n.ExpressionStatement.check(remainingNodePath.node)) {\n if (!remainingNodePath.get('expression').value) {\n return remainingNodePath.prune();\n }\n } else if (n.IfStatement.check(remainingNodePath.node)) {\n cleanUpIfStatementAfterPrune(remainingNodePath);\n }\n\n return remainingNodePath;\n }", "function _cleanNodes (nodes) {\n nodes.forEach(function (tag) {\n // avoiding circular structure\n delete tag._parent;\n\n // removing temporary tester\n delete tag.match_closer;\n\n // cleaning empty attributes\n if( tag.attrs && Object.keys(tag.attrs).length === 0 ) delete tag.attrs;\n\n // cleaning empty children\n if( tag._ instanceof Array ) {\n if( !tag._.length ) delete tag._;\n else _cleanNodes(tag._);\n }\n\n });\n return nodes;\n}", "remove() {\n if (this.length == 0) return null;\n else if (this.length == 1) {\n let tempNode = this.top;\n this.top = null;\n this.last = null;\n this.length--;\n return tempNode;\n } else {\n let tempNode = this.top;\n this.top = this.top.next;\n this.length--;\n return tempNode;\n }\n }", "function cleanUpNodesAfterPrune(remainingNodePath) {\n if (n.VariableDeclaration.check(remainingNodePath.node)) {\n var declarations = remainingNodePath.get('declarations').value;\n if (!declarations || declarations.length === 0) {\n return remainingNodePath.prune();\n }\n }\n else if (n.ExpressionStatement.check(remainingNodePath.node)) {\n if (!remainingNodePath.get('expression').value) {\n return remainingNodePath.prune();\n }\n }\n else if (n.IfStatement.check(remainingNodePath.node)) {\n cleanUpIfStatementAfterPrune(remainingNodePath);\n }\n return remainingNodePath;\n }", "remove_child(node) {\n delete this.children[node.get_token_string()];\n this.notify_fragment_dirty();\n }", "function removeChildren(node) {\n node = node.lastChild;\n while (node) {\n var next = node.previousSibling;\n recollectNodeTree(node, true);\n node = next;\n }\n }", "function removeUnnecessaryNodes(node) {\n // remove empty null filter nodes\n if (node instanceof FilterInvalidNode && every(vals(node.filter), function (f) { return f === null; })) {\n node.remove();\n }\n // remove output nodes that are not required\n if (node instanceof OutputNode && !node.isRequired()) {\n node.remove();\n }\n node.children.forEach(removeUnnecessaryNodes);\n }", "function cleanUpNodesAfterPrune(remainingNodePath) {\n\t if (n.VariableDeclaration.check(remainingNodePath.node)) {\n\t var declarations = remainingNodePath.get('declarations').value;\n\t if (!declarations || declarations.length === 0) {\n\t return remainingNodePath.prune();\n\t }\n\t } else if (n.ExpressionStatement.check(remainingNodePath.node)) {\n\t if (!remainingNodePath.get('expression').value) {\n\t return remainingNodePath.prune();\n\t }\n\t } else if (n.IfStatement.check(remainingNodePath.node)) {\n\t cleanUpIfStatementAfterPrune(remainingNodePath);\n\t }\n\n\t return remainingNodePath;\n\t}", "function cleanUpNodesAfterPrune(remainingNodePath) {\n\t if (n.VariableDeclaration.check(remainingNodePath.node)) {\n\t var declarations = remainingNodePath.get('declarations').value;\n\t if (!declarations || declarations.length === 0) {\n\t return remainingNodePath.prune();\n\t }\n\t } else if (n.ExpressionStatement.check(remainingNodePath.node)) {\n\t if (!remainingNodePath.get('expression').value) {\n\t return remainingNodePath.prune();\n\t }\n\t } else if (n.IfStatement.check(remainingNodePath.node)) {\n\t cleanUpIfStatementAfterPrune(remainingNodePath);\n\t }\n\n\t return remainingNodePath;\n\t}", "delete(key: K) {\n this.tree.remove([key, null]);\n }", "function strip(tree) {\n tree_forEach(tree, function(n) {\n delete n.tokenizer\n delete n.lineno\n delete n.start\n delete n.end\n delete n.target // break -> switch\n if (typeof n.type === 'number') n.type = tokens[n.type] + '(' + n.type + ')'\n })\n}", "Remove() {}", "remove(data) {\n // A recursive function to perform the node removal.\n const removeNode = function(node, data){\n // Check if we have an empty tree.\n if (node === null) {\n return null;\n }\n // If we find a node that matches the data.\n if (data === node.data) {\n // Base Case 1: node has no children, return null.\n if (node.left === null && node.right === null) {\n return null; // set the reference to the node to null\n }\n // Node has no left child, replace the node reference with\n // whatever on the right.\n if (node.left === null) {\n return node.right;\n }\n // Node has no right child, replace the node reference with\n // whatever on the left.\n if (node.right === null) {\n return node.left;\n }\n // Node has two children.\n var tmpNode = node.right; // go to the right subnode\n // Go all the way left down to the left leaf node.\n while (tmpNode.left !== null) {\n tmpNode = tmpNode.left;\n }\n node.data = tmpNode.data; // update the node data with the left\n // leaf node data\n node.right = removeNode(node.right, tmpNode.data); // recursion\n return node;\n } else if (data < node.data) {\n node.left = removeNode(node.left, data);\n return node;\n } else {\n node.right = removeNode(node.right, data);\n return node;\n }\n }\n this.root = removeNode(this.root, data); // call the function at the end\n }", "trim() {\n // get the reachable nodes from the root\n var reachable = this.reachableNodes;\n var visited = [];\n // remove any nodes that are not reachable from the root\n for(let node in this._nodeMap){\n if(reachable[node] !== true){\n this.removeNode(this._nodeMap[node]);\n }\n }\n }", "function removeAllChildNodes(parent) {\n while (parent.firstChild) {\n parent.removeChild(parent.firstChild);\n }\n }", "function remove (){\n match_list.pop();\n match_list.pop();\n }", "remove(data) {\n const removeNode = function (node, data) {\n if (node === null) {\n return null;\n }\n\n if (data === node.data) {\n // node has no children\n if (node.left === null && node.right === null) {\n return null;\n }\n // node has no left child\n if (node.left === null) {\n return node.right;\n }\n // if node has no right child\n if (node.right === null) {\n return node.left;\n }\n // node has two children\n let tempNode = node.right;\n while(tempNode.left !== null) {\n tempNode = tempNode.left;\n }\n node.data = tempNode.data;\n node.right = removeNode(node.right, tempNode.data);\n return node;\n } else if (data < node.data) {\n node.left = removeNode(node.left, data);\n return node;\n } else {\n node.right = removeNode(node.right, data);\n return node;\n }\n };\n this.root = removeNode(this.root, data);\n }", "[mutation.REMOVE_ELEMENT] (state, id) {\n NodeHelpers.deleteNodeById(id, state.snapshot)\n }", "removeNodesWithValue(value) {\n if(!this.head || value === undefined) return\n\n let curr = this.head, next\n while(curr) {\n next = curr.next\n if(curr.value === value) {\n this.remove(curr)\n }\n curr = next\n }\n }", "removeNode(node){\n delete this.adjList[node];\n\n Object.keys(this.adjList).map(eachNode => {\n let currentNode = this.adjList[eachNode];\n let currentIndex = currentNode.edges.indexOf(node);\n if(currentIndex > -1){\n currentNode.edges.splice(currentIndex,1);\n }\n })\n }", "_remove() {\n\t\tthis.parent._removeChildren( this.index );\n\t}", "clearTree() {\n // ******* TODO: PART VII *******\n\n // You only need two lines of code for this! No loops! \n }", "remove(id) {\n if (!this.apex) {\n throw new Error(\"remove() : attempting remove when tree has no apex\");\n }\n this.removeNode(this.nodes[this.apex], id);\n }", "removeNode(node) {\n if (nodesCount > 0) { nodesCount -= 1; }\n if (node.id < nodesCount && nodesCount > 0) {\n // we do not really delete anything from the buffer.\n // Instead we swap deleted node with the \"last\" node in the\n // buffer and decrease marker of the \"last\" node. Gives nice O(1)\n // performance, but make code slightly harder than it could be:\n webglUtils.copyArrayPart(nodes, node.id * ATTRIBUTES_PER_PRIMITIVE, nodesCount * ATTRIBUTES_PER_PRIMITIVE, ATTRIBUTES_PER_PRIMITIVE);\n }\n }", "function removeNode(node) {\n if (node && node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }", "removeMatches(subject, predicate, object, graph) {\n const stream = new _readableStream.Readable({\n objectMode: true\n });\n stream._read = () => {\n for (const quad of this.readQuads(subject, predicate, object, graph)) stream.push(quad);\n stream.push(null);\n };\n return this.remove(stream);\n }", "function _markRemoved() {\n this.shouldSkip = true;\n this.removed = true;\n this.node = null;\n}", "function _markRemoved() {\n this.shouldSkip = true;\n this.removed = true;\n this.node = null;\n}", "function remove() {\n\t console.trace(\"Path#remove has been renamed to Path#dangerouslyRemove, removing a node is extremely dangerous so please refrain using it.\");\n\t return this.dangerouslyRemove();\n\t}", "function remove() {\n\t console.trace(\"Path#remove has been renamed to Path#dangerouslyRemove, removing a node is extremely dangerous so please refrain using it.\");\n\t return this.dangerouslyRemove();\n\t}", "function TNodes_doRemoveBranch( nd, action ) {\n action = action || 'nothing';\n var sourcenode = {}\n , mynodesobj = {}\n , targetnode = {};\n \n mynodesobj = nd.Owner;// the TNodes-structure of \n targetnode = nd.Parent.Parent;\n /////////////////////////////////////////////////////////////\n // SOURCE: GET THE BRANCH-\"CONTENT\" FROM THE OPPOSITE NODE //\n /////////////////////////////////////////////////////////////\n switch ( nd.Spin ) {\n case 1: sourcenode = nd.Parent.DownNode;\n break;\n case -1: sourcenode = nd.Parent.UpNode;\n break;\n default: sourcenode = nd;\n }//END SWITCH\n \n if ( sourcenode.HasChild ) {\n \n \n \n // first swap the child's up and down to the target in the database\n\n // using json-obj as clipboard \n var jsonsource=mynodesobj.doCopyBranchToJson();\n //remove the split with delete, because the relink has dropped the children\n mynodesobj.doRemove(nd.Parent,'delete'); // owner is TNodes, parent is TSplit\n mynodesobj.doPasteBranchFromJson(jsonsource, targetnode,'relink');\n mynodesobj.doRemove(nd.Parent,'delete'); \n } else if ( sourcenode.ContainerList.Count > 0 ) {\n ///////////////////////////////\n // LOOP TROUGH CONTAINERLIST //\n ///////////////////////////////\n for ( var i in sourcenode.ContainerList.Item ) {\n var container = sourcenode.ContainerList.Item[ i ];\n if ( container !== null ) {\n var storedLabel = container.Label//Store label to override the 'copy of' wich is added after copy\n if ( container.Nature == 'Container' || container.Nature == 'Sticker' ) {\n var copy = targetnode.doContainerMove( container, undefined, true );\n targetnode.ContainerList.Item[ copy ].Label = storedLabel;// Make the copy and overwrite the labal of the copy\n }//END IF \n }//END IF\n }//END LOOP\n mynodesobj.doRemove( nd.Parent, 'delete' ); // owner is TNodes, parent is TSplit\n } else {\n mynodesobj.doRemove( nd.Parent, 'delete' ); // owner is TNodes, parent is TSplit \n }//END ELSE\n }", "removeSelf() {\n this.DOM.wrap.remove();\n\n /*\n this.getChildren.forEach((child) => {\n child.offline();\n });*/\n }", "function removeNotNeededNodes(parentElements, newChildren, oldChildren) {\n var remaining = parentElements.childNodes.length;\n if (oldChildren.length !== remaining) {\n console.warn(\"ZLIQ: Something other then ZLIQ has manipulated the children of the element\", parentElements, \". This can lead to sideffects. Consider using the 'isolated' attribute for this element to prevent updates.\");\n }\n\n for (; remaining > newChildren.length; remaining--) {\n var childToRemove = parentElements.childNodes[remaining - 1];\n parentElements.removeChild(childToRemove);\n\n if (oldChildren.length < remaining) {\n continue;\n } else {\n var cycle = oldChildren[remaining - 1].cycle;\n\n\n triggerLifecycle(childToRemove, { cycle: cycle }, \"removed\");\n }\n }\n}", "function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}", "function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}", "function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}", "function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}", "function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}", "function removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}", "removeAnchoredNode(node) {\n\t\tfor (var i = 0; i < this.anchoredNodes.length; i++) {\n\t\t\tif (node === this.anchoredNodes[i].node) {\n\t\t\t\tthis.anchoredNodes.splice(i,1);\n this.scene.remove(node)\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}", "function removeNode(subtree){\n var par = subtree.parent;\n for (var i = 0; i < par.children.length; ++i){\n if (par.children[i] === subtree) {\n par.children.splice(i, 1);\n break;\n }\n }\n subtree.parent = null;\n}", "delete(termToRemove) {\n let currentNode = store;\n let protectedNode = null;\n let protectedNodeIndex = 0;\n const chars = termToRemove.split('');\n for (let keyIndex in chars) {\n currentNode = currentNode.children[chars[keyIndex]];\n // Check if currentNode is not null\n if(!isNil(currentNode)) {\n const hasDependentNodes = Object.keys(currentNode.children).length > 1;\n const isDifferentWord = keyIndex < chars.length - 1 && currentNode.isDelimiter;\n if(hasDependentNodes || isDifferentWord) {\n protectedNode = currentNode;\n protectedNodeIndex = keyIndex; \n }\n }\n }\n if(isNil(protectedNode)) {\n return this;\n }\n const keyToRemove = chars[Number(protectedNodeIndex) + 1];\n delete protectedNode.children[keyToRemove];\n return this;\n }", "function removeNested(node, removed) {\n\t\tif (removed) {\n\t\t\tnode.remove = false\n\t\t}\n\t\tfor (var key in node) {\n\t\t\tvar val = node[key]\n\t\t\tif (Array.isArray(val)) {\n\t\t\t\tfor (var i = 0 ; i < val.length ; i++) {\n\t\t\t\t\tvar c = val[i]\n\t\t\t\t\tremoveNested(c, removed || node.remove)\n\t\t\t\t}\n\t\t\t} else if (val && typeof val.type === \"string\") {\n\t\t\t\tremoveNested(val, removed || node.remove)\n\t\t\t}\n\t\t}\n\t}", "function cleanNodes() {\n while (container.firstChild) {\n container.removeChild(container.firstChild);\n }\n }", "function restoreCC() {\n\tcy.nodes().forEach(function(item, index, array) {\n\t\tlet cC = item.data().collapsedChildren;\n\t\tif ( cC ) {\n\t\t\titem.data().collapsedChildren = cy.add(cC);\n\t\t\tremovedNodes.restore();\n\t\t\trestoreOE();\n\t\t\tcC.forEach(function(item, index, array) {\n\t\t\t\tremovedNode = cy.$id(item.data.id);\n \t\tremovedNodes = removedNodes.union(removedNode);\n\t\t\t\tremovedNodes.remove();\n \t\t});\n\n \t\t};\n \t});\n\t//Reset removedNodes\n removedNodes = cy.collection();\n}", "remove(index) {\n // accept an index.\n // check if the index is less than zero greate than the length and return undefined. \n if(index < 0 || index > this.length) { \n return undefined;\n }\n // if this index is the same as the length - -1 pop\n if(index === this.length - 1 ) { \n return this.pop();\n }\n // if the index is 0 shift. \n if(index === 0) {\n return this.shift();\n }\n // get the node before the target index. \n let beforeTargetNode = this.get(index - 1);\n // set the nedxt prop to the beforeNode to the next of the removednNode. \n let targetNode = this.get(index);\n beforeTargetNode.next = targetNode.next;\n // Decrement the length\n this.length--;\n // return the value of the removedNode\n return targetNode;\n }", "unsetNodes(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (!Array.isArray(props)) {\n props = [props];\n }\n\n var obj = {};\n\n for (var key of props) {\n obj[key] = null;\n }\n\n Transforms.setNodes(editor, obj, options);\n }", "unsetNodes(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (!Array.isArray(props)) {\n props = [props];\n }\n\n var obj = {};\n\n for (var key of props) {\n obj[key] = null;\n }\n\n Transforms.setNodes(editor, obj, options);\n }", "function clearTree() {\n\n // ******* TODO: PART VII *******\n \n\n}", "@chained\n\tremove() {\n\t\tlet parent = this.element.parentNode;\n\t\tparent.removeChild(this.element);\n\t}" ]
[ "0.64386606", "0.6380425", "0.6355589", "0.6349218", "0.633667", "0.63078254", "0.62934875", "0.61842495", "0.6176571", "0.61399007", "0.6121926", "0.6109569", "0.6104579", "0.6093716", "0.6079177", "0.60260665", "0.6009594", "0.6005983", "0.6000191", "0.5944988", "0.5930063", "0.58851725", "0.5881864", "0.58690774", "0.5850403", "0.5820958", "0.5803458", "0.57718396", "0.57718396", "0.5755378", "0.573658", "0.57271427", "0.5707401", "0.5688748", "0.56656086", "0.56521046", "0.5644833", "0.5640056", "0.561387", "0.56130487", "0.56111526", "0.5610144", "0.5607592", "0.560427", "0.5598283", "0.55979794", "0.55965626", "0.55914044", "0.55901724", "0.5585403", "0.5583894", "0.5583894", "0.5582168", "0.55806214", "0.5578486", "0.557708", "0.5573875", "0.55731523", "0.55681807", "0.55681807", "0.5539169", "0.5537625", "0.5526298", "0.55114144", "0.5509049", "0.54897", "0.54842067", "0.5474027", "0.5473118", "0.54698956", "0.5467692", "0.54500306", "0.5446033", "0.5440011", "0.5434039", "0.54339814", "0.54337454", "0.54325116", "0.54325116", "0.5428759", "0.5428759", "0.54249907", "0.54092956", "0.54057974", "0.53979045", "0.53979045", "0.53979045", "0.53979045", "0.53979045", "0.53979045", "0.53948694", "0.53897005", "0.5378768", "0.5378212", "0.5373555", "0.5369714", "0.536726", "0.53458726", "0.53458726", "0.5343844", "0.53434545" ]
0.0
-1
TODO: Remove after v1
callRuleLint(rule, raw) { const issues = []; function report(data) { const meta = { ...data.meta, severity: rule.severity }; issues.push(new Issue( data.code, data.position, rule.name, meta )); } rule.need ? rule.lint(raw, this.config.legacy_config, { report, rules: this.config.activatedRules }) : rule.lint(raw, rule.config, { report }); return issues; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient protected internal function m189() {}", "transient final protected internal function m174() {}", "static transient final private internal function m43() {}", "obtain(){}", "static transient final protected public internal function m46() {}", "static final private internal function m106() {}", "transient final private protected internal function m167() {}", "static transient final protected internal function m47() {}", "transient private protected public internal function m181() {}", "static private internal function m121() {}", "transient final private internal function m170() {}", "transient private public function m183() {}", "static transient final private protected internal function m40() {}", "constructor() {\n\n\t}", "static transient private protected internal function m55() {}", "constructor () { super() }", "__previnit(){}", "static private protected internal function m118() {}", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "updated() {}", "constructor() {\n\t}", "constructor() {\n\t}", "constructor () {\r\n\t\t\r\n\t}", "transient final private protected public internal function m166() {}", "added() {}", "static transient private protected public internal function m54() {}", "constructor() {\n\t\t// ...\n\t}", "function _____SHARED_functions_____(){}", "static transient final protected function m44() {}", "static transient private public function m56() {}", "static transient final private public function m41() {}", "constructor (){}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "constructor() {\n }", "firstUpdated() {}" ]
[ "0.68101764", "0.64340585", "0.62249184", "0.6182766", "0.6052821", "0.59527016", "0.58985794", "0.5737881", "0.5728914", "0.56370556", "0.56195796", "0.56094825", "0.55589503", "0.5524512", "0.5493151", "0.5487611", "0.54612476", "0.5453937", "0.53796333", "0.53680205", "0.5333321", "0.5318298", "0.5282933", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.52750784", "0.5264487", "0.52527446", "0.52527446", "0.5236143", "0.52270937", "0.5201633", "0.51968855", "0.51927984", "0.5188746", "0.5188298", "0.5169685", "0.5152564", "0.513295", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.51210487", "0.50885606", "0.50885606", "0.50885606", "0.50885606", "0.50885606", "0.50885606", "0.50777465", "0.5058823" ]
0.0
-1
convention method to wrap minimatch for the given file
function is(...patterns) { return patterns.some((pattern) => { if (minimatch(fileName, pattern)) { return true; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "minifyFile(file) {\n // The hash meteor provides seems to change more than\n // necessary, so we create our own here based on only what \n // affects the minified output\n let key\n Profile.time('hash', () => {\n key = this._deepHash({\n content: file.getContentsAsString(),\n sourcemap: JSON.stringify(file.getSourceMap()),\n });\n })\n let result = this._cache.get(key);\n let source = 'memory';\n\n if (!result) {\n Profile.time('readCache', () => {\n result = this._readCache(key);\n source = 'file';\n })\n }\n if (!result) {\n Profile.time('minifyOneFile', () => {\n result = this.minifyOneFile(file);\n });\n this._cache.set(key, result);\n this._writeCacheAsync(key, result);\n source = null;\n }\n\n if (source) {\n this._cacheDebug(`Loaded minified ${file.getPathInBundle()} from ${source} cache`)\n } else {\n this._cacheDebug(`Cache miss for ${file.getPathInBundle()} with the key \"${key}\"`)\n }\n\n return result;\n }", "minify() {\n\n }", "minifyOneFile () {\n throw new Error('CachingMinifier subclass should implement minifyOneFile!');\n }", "function testFilePreprocessor() {\n\n return function(content, file, done) {\n b.bundleFile(file, function(err, content) {\n done(content && content.toString());\n });\n };\n }", "function layouts() {\n return src(input)\n .pipe(fileinclude({\n prefix: '@@',\n basepath: '@file'\n }))\n .pipe(replace(/\\*cachebustthis\\*/g, scriptname)) // adds cachebusted name of scripts to js links file\n .pipe(replace(/\\*cachebustsearch\\*/g, searchname)) // adds cachebusted name of scripts to js links file\n .pipe(replace(/\\*cachebustadmin\\*/g, adminname)) // adds cachebusted name of scripts to js links file\n\n .pipe(dest(test))\n}", "patchConflicter () {\n Conflicter.prototype.collision = function (file, cb) {\n const rfilepath = path.relative(process.cwd(), file.path)\n if (!pathExists.sync(file.path)) {\n this.adapter.log.create(rfilepath)\n cb('create')\n return\n }\n else if (/index.js$/.test(file.path)) {\n this.adapter.log.force(rfilepath)\n cb('force')\n return\n }\n\n if (this.force) {\n this.adapter.log.force(rfilepath)\n cb('force')\n return\n }\n if (detectConflict(file.path, file.contents)) {\n this.adapter.log.conflict(rfilepath)\n this._ask(file, cb)\n }\n else {\n this.adapter.log.identical(rfilepath)\n cb('identical')\n }\n }\n }", "compileOneFile(inputFile) {\n\t\tvar pathInPackage = inputFile.getPathInPackage();\n\t\tvar packageName = inputFile.getPackageName();\n\t\tif (packageName) {\n\t\t\tpackageName = packageName.replace('local-test:', '');\n\t\t}\n\t\tvar fullPath = pathInPackage;\n\t\tif (packageName) {\n\t\t\tfullPath = path.join(packagesPath, packageName, fullPath);\n\t\t}\n\n\t\t// console.log('Compiling...', (packageName || 'app') + '/' + pathInPackage);\n\n\t\tif (pathInPackage.indexOf('node_modules/') !== -1) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its in node_modules');\n\t\t\treturn {};\n\t\t}\n\n\t\tif (pathInPackage.indexOf('typings/') !== -1) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its in typings');\n\t\t\treturn {};\n\t\t}\n\n\t\tif (pathInPackage.substr(-5) === '.d.ts') {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its a definition');\n\t\t\treturn {};\n\t\t}\n\n\t\t// generatePackageRefs();\n\t\tif (\n\t\t\tpackageName &&\n\t\t\ttypescriptPackages[packageName].client.files.indexOf(pathInPackage) === -1 &&\n\t\t\ttypescriptPackages[packageName].server.files.indexOf(pathInPackage) === -1\n\t\t) {\n\t\t\tconsole.log('Ignoring', (packageName || 'app') + '/' + pathInPackage, 'becouse its not added to package.js');\n\t\t\treturn {};\n\t\t}\n\n\t\t// cache check\n\t\tvar cachePath = path.join(cacheDir, isApp && !disableInApp ? path.relative('../', fullPath) : path.relative(meteorPath, fullPath));\n\t\tvar baseName = path.basename(fullPath, '.ts');\n\t\tvar changeTime = fs.statSync(fullPath).mtime;\n\t\tvar jsPath = path.join(path.dirname(cachePath), baseName + '.js');\n\t\tvar error;\n\n\t\t// references\n\t\tvar dir = path.dirname(path.relative('./', fullPath));\n\t\tif (!packageName) {\n\t\t\tif (appDirs.indexOf(dir) == -1) {\n\t\t\t\tappDirs.push(dir);\n\t\t\t}\n\t\t\tif (appRefs.indexOf(pathInPackage) == -1) {\n\t\t\t\tappRefs.push(pathInPackage);\n\t\t\t\tappDirs.forEach(function (dir) {\n\t\t\t\t\tfs.writeFileSync(path.join(dir, '.#ts', \"server.d.ts\"), '///<reference path=\"' + path.relative(dir, path.join('.meteor', '.#ts', 'app-server.d.ts')) + '\" />\\n');\n\t\t\t\t\tfs.writeFileSync(path.join(dir, '.#ts', \"client.d.ts\"), '///<reference path=\"' + path.relative(dir, path.join('.meteor', '.#ts', 'app-client.d.ts')) + '\" />\\n');\n\t\t\t\t});\n\t\t\t\tfs.writeFileSync(path.join('.meteor', '.#ts', 'app-server.d.ts'), getAppRefs('server'));\n\t\t\t\tfs.writeFileSync(path.join('.meteor', '.#ts', 'app-client.d.ts'), getAppRefs('client'));\n\t\t\t}\n\t\t}\n\n\t\tvar doesntExists = !fs.existsSync(jsPath);\n\t\tvar existingTime = !doesntExists && fs.statSync(jsPath).mtime;\n\t\tvar isTooOld = existingTime && changeTime.getTime() > existingTime.getTime();\n\t\tif (doesntExists || isTooOld) {\n\n\t\t\tif (doesntExists) {\n\t\t\t\tconsole.log('Compiling because doesnt exist:', fullPath);\n\t\t\t\t// console.log(\n\t\t\t\t// \ttypescriptPackages[packageName].client.files,\n\t\t\t\t// \ttypescriptPackages[packageName].server.files\n\t\t\t\t// );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log('Compiling because too old:', fullPath);\n\t\t\t}\n\n\t\t\tvar exec = Npm.require('child_process').exec;\n\t\t\tvar Future = Npm.require('fibers/future');\n\n\t\t\tfunction execSync(command) {\n\t\t\t\tvar fut = new Future();\n\t\t\t\texec(command, function (error, stdout, stderr) {\n\t\t\t\t\tfut.return({\n\t\t\t\t\t\tstdout: stdout,\n\t\t\t\t\t\tstderr: stderr || error\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\treturn fut.wait();\n\t\t\t}\n\n\t\t\tvar compileCommand = 'node ' + compilerPath + ' ' +\n\t\t\t\t'--target ES5 ' +\n\t\t\t\t'--sourcemap ' +\n\t\t\t\t'--module amd ' +\n\t\t\t\t'--experimentalDecorators ' +\n\t\t\t\t'--emitDecoratorMetadata ' +\n\t\t\t\t//'--pretty ' +\n\t\t\t\t'--emitVerboseMetadata ' +\n\t\t\t\t'--skipEmitVarForModule ' +\n\t\t\t\t'--outDir ' + cacheDir + ' ' + (disableInApp ? meteorAllPath : allPath);\n\n\t\t\t// console.log(compileCommand);\n\t\t\ttry {\n\t\t\t\tvar result = execSync(compileCommand);\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.log(e);\n\t\t\t}\n\n\t\t\tif (result.stderr) {\n\t\t\t\tvar lines = (typeof result.stderr === 'string' ? result.stderr : result.stdout).split('\\n');\n\t\t\t\tvar errors = [];\n\t\t\t\tfor (var i = 0; i < lines.length; i++) {\n\t\t\t\t\tif (!lines[i]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\terrors.push(lines[i]);\n\t\t\t\t}\n\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\terror = errors.join('\\n');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!error && !fs.existsSync(jsPath)) {\n\t\t\t\terror = 'File was not created: ' + jsPath;\n\t\t\t}\n\t\t\tif (error) {\n\t\t\t\ttry {\n\t\t\t\t\tfs.unlinkSync(jsPath);\n\t\t\t\t\tfs.unlinkSync(cachePath + '.map');\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\t// ignore\n\t\t\t\t}\n\t\t\t\t// ../meteor/packages/marketing/TransactionServer.ts(1078,10)\n\t\t\t\terror = error\n\t\t\t\t\t.replace(/(\\x1b\\[30m)/g, '\\n$1')\n\t\t\t\t\t// .replace(/([a-zA-Z0-9\\.\\/_-]+)\\(([0-9]+),([0-9]+)\\)/g, '\\n\\x1b[42;1m' + process.cwd().replace(new RegExp('^/Users/' + process.env.USER, 'g'), '~') + '/$1:$2 $3\\x1b[0m');\n\t\t\t\tinputFile.error({\n\t\t\t\t\tmessage: error\n\t\t\t\t});\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tvar data = fs.readFileSync(jsPath).toString();\n\n\t\t//console.log('adding: ' + jsPath)\n\t\t// couple of hacks for meteor namespacing\n\t\tvar prep = '';\n\t\tdata = data\n\t\t//.replace(/(new __\\(\\);\\n\\};\\n)var ([a-zA-Z0-9_]+);/, '$1' + prep)\n\t\t\t.replace(/(<reference path=\"[a-zA-Z0-9_\\.\\/-]+\"[ ]*\\/>\\n(\\/\\*(.|\\n)+\\*\\/\\n)?)var ([a-zA-Z0-9_]+);\\n/, '$1' + prep)\n\t\t\t//.replace(/(var __decorate[\\w\\s!=\"\\(\\)&|,.;:}{]*};\\n)var ([a-zA-Z0-9_]+);\\n/, '$1' + prep)\n\t\t\t.replace(/^\\s*var ([a-zA-Z0-9_]+);/, prep)\n\t\t\t.replace(/\\/\\/# sourceMappingURL=.+/, '');\n\t\t//\t\t.replace(/\\}\\)\\(([a-zA-Z0-9_]+) \\|\\| \\(([a-zA-Z0-9_]+) = \\{\\}\\)\\);(\\n\\/\\/# sourceMappingURL)/, '})($1);$3');\n\t\t//\tdata = data\n\t\t//\t\t.replace(/(new __\\(\\);\\n\\};\\n)var ([a-zA-Z0-9_]+);/, '$1this.$2 = this.$2 || {};\\nvar $2 = this.$2;')\n\t\t//\t\t.replace(/(<reference path=\"[a-zA-Z0-9_\\.\\/-]+\"[ ]*\\/>\\n)var ([a-zA-Z0-9_]+);/, '$1this.$2 = this.$2 || {};\\nvar $2 = this.$2;')\n\t\t//\t\t.replace(/^\\s*var ([a-zA-Z0-9_]+);/, 'this.$1 = this.$1 || {};\\nvar $1 = this.$1;');\n\n\t\tvar map = fs.readFileSync(jsPath + '.map')\n\t\t\t.toString()\n\t\t\t.replace(/\"sources\":\\[\"[0-9a-zA-Z-\\/\\.-]+\"]/, '\"sources\":[\"' + inputFile.getDisplayPath() + '\"]');\n\t\tmap = map.substr(0, map.length - 1) + ',\"sourcesContent\":[\"' + fs.readFileSync(fullPath)\n\t\t\t\t.toString()\n\t\t\t\t.replace(/[\\\\]/g, '\\\\\\\\')\n\t\t\t\t.replace(/[\"]/g, '\\\\\"')\n\t\t\t\t.replace(/[\\b]/g, '\\\\b')\n\t\t\t\t.replace(/[\\f]/g, '\\\\f')\n\t\t\t\t.replace(/[\\n]/g, '\\\\n')\n\t\t\t\t.replace(/[\\r]/g, '\\\\r')\n\t\t\t\t.replace(/[\\t]/g, '\\\\t') + '\"]}';\n\t\treturn {\n\t\t\tpath: pathInPackage + \".js\",\n\t\t\tdata: data,\n\t\t\tsourceMap: map\n\t\t};\n\t}", "function patternMatcher(pattern) {\n return function(path, stats) {\n var minimatcher = new minimatch.Minimatch(pattern, {matchBase: true})\n return (!minimatcher.negate || stats.isFile()) && minimatcher.match(path)\n }\n }", "function monkeyPatch() {\n return {\n transform: (code, id) => {\n var file = id.split('/').pop()\n\n // Only one define call per module is allowed by requirejs so\n // we have to remove calls that other libraries make\n if (file === 'FileSaver.js') {\n code = code.replace(/define !== null\\) && \\(define.amd != null/g, '0')\n } else if (file === 'html2canvas.js') {\n code = code.replace(/&&\\s+define.amd/g, '&& define.amd && false')\n }\n\n return code\n }\n }\n}", "function wacthFiles() {\n watch('src/assets/scss/**/*.scss', series(compileCss))\n watch('src/assets/js/**/*.js', series(compileJs))\n watch('src/assets/img/**/*', series(minifyImg))\n watch('src/**/*.hbs', series(resetPages, compileHtml))\n watch('src/data/*.json', series(resetPages, compileHtml))\n}", "function monkeyPatch() {\n return {\n transform: (code, id) => {\n const file = path.parse(id).base;\n\n // Only one define call per module is allowed by requirejs so\n // we have to remove calls that other libraries make\n if (file === 'FileSaver.js') {\n code = code.replace(/define !== null\\) && \\(define.amd != null/g, '0')\n } else if (file === 'html2canvas.js') {\n code = code.replace(/&&\\s+define.amd/g, '&& define.amd && false')\n }\n\n return code\n }\n }\n}", "function doSomethingWithEachFileIndividually(arg) {\n return arg + \" markus\";\n}", "function file(app, pattern) {\n return app.src(pattern, { cwd: __dirname })\n .pipe(app.renderFile('*')).on('error', console.log)\n .pipe(app.conflicts(app.cwd))\n .pipe(app.dest(app.cwd));\n}", "function run(file){\r\n file.process = spawn('stylus', [ abs_path + file['in'], '-o', abs_path + file['out'] ]);\r\n file.process.stdout.on('data', function(data) {\r\n console.log(data.toString());\r\n });\r\n file.process.stderr.on('data', function(data){\r\n console.log(data.toString());\r\n });\r\n file.process.on('exit', function(code){\r\n console.log('Process for file ' + file['in'] + ' exited with code ' + code);\r\n }); \r\n}", "function fileincludeTask(callback) {\n return src([paths.src.html, '!./src/layout/**/*'])\n .pipe(fileinclude({\n prefix: '@@',\n basepath: '@file',\n }))\n .pipe(cached())\n .pipe(dest(paths.temp.basetemp));\n callback();\n}", "function mini() {\n return gulp.src('project/*.html')\n .pipe(useref())\n .pipe(gulpIf('*.js', terse()))\n .pipe(gulpIf('*.css', cssnano()))\n .pipe(gulp.dest('dist'))\n}", "function processFile( fileName ) {\n\t\t\tvar lessFileName, cssFileName, theme, path;\n\t\t\tpath = require( 'path' );\n\t\t\tif ( path.extname( fileName ) === '.json' ) {\n\t\t\t\tlessFileName = fileName.replace( /\\.json$/, '.less' ).replace( /^src/, 'dist/tmp' );\n\t\t\t\ttheme = path.basename( path.dirname( fileName ) );\n\n\t\t\t\tcolorizeSvgFiles[ fileName.replace( /.+\\/(\\w+)\\/([\\w-]+)\\.(?:json|less)$/, '$1-$2' ) ] = {\n\t\t\t\t\toptions: grunt.file.readJSON( fileName ),\n\t\t\t\t\tsrcDir: 'src/themes/' + theme,\n\t\t\t\t\tdestDir: 'dist/themes/' + theme,\n\t\t\t\t\t// This should not be needed, but our dist directory structure is weird\n\t\t\t\t\tcssPrependPath: 'themes/' + theme + '/',\n\t\t\t\t\tdestLessFile: {\n\t\t\t\t\t\tltr: lessFileName,\n\t\t\t\t\t\trtl: rtlPath( lessFileName )\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tcssFileName = fileName.replace( /\\.json$/, '.css' ).replace( /^src/, 'dist/tmp/' + target );\n\t\t\t\tlessFiles[ target ][ cssFileName ] = [ lessFileName ];\n\t\t\t\tlessFiles[ target ][ rtlPath( cssFileName ) ] = [ rtlPath( lessFileName ) ];\n\t\t\t} else {\n\t\t\t\tcssFileName = fileName.replace( /\\.less$/, '.css' ).replace( /^src/, 'dist/tmp/' + target );\n\t\t\t\tlessFiles[ target ][ cssFileName ] = [ fileName ];\n\t\t\t\trtlFiles[ rtlPath( cssFileName ) ] = cssFileName;\n\t\t\t}\n\t\t\treturn cssFileName;\n\t\t}", "function sassMinTask() {\n return src(['src/**/*.scss', 'src/**/*.css', '!src/**/_*.scss', '!src/var.scss'])\n .pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))\n .pipe(autoprefixer())\n .pipe(rename(function (path) {\n path.basename += \".min\";\n return path;\n }))\n .pipe(dest('dist/'))\n}", "function jshint(jshintfile) {\r\n return lazypipe()\r\n .pipe(g.jshint, jshintfile)\r\n .pipe(g.jshint.reporter, stylish)();\r\n}", "function instrument(file) {\n const code = fs.readFile(file, 'utf8');\n\n if (snoozing) {\n debuglog(`Skipped instrumenting ${file}`);\n return code;\n }\n\n debuglog(`Instrumenting ${path.resolve(process.cwd(), file)}`);\n return wrapper + instrumenter.instrumentSync(code, path.relative(process.cwd(), file));\n}", "process(src, filename) {\n var isJISON = filename.match(/\\.jison$/i);\n // Don't bother doing anything to node_modules\n if (filename.indexOf(\"node_modules\") === -1) {\n // Don't load image data - it can't be parsed by jest.\n if (filename.match(/\\.(jpe?g|png|gif|bmp|svg|less|raml)$/i)) {\n return \"\";\n }\n // Use JISON generator for JISON grammar\n if (isJISON) {\n src = new jison.Generator(src).generate();\n }\n if (filename.endsWith(\".ts\") || filename.endsWith(\".tsx\")) {\n src = tsc.transpile(src, tsConfig.compilerOptions, filename, []);\n }\n // Run our modules through Babel before running tests\n if (\n babel.util.canCompile(filename) ||\n isJISON ||\n filename.endsWith(\".ts\") ||\n filename.endsWith(\".tsx\")\n ) {\n src = babel.transform(src, {\n auxiliaryCommentBefore: \" istanbul ignore next \",\n filename,\n presets: [jestPreset].concat(\n [\n \"babel-preset-env\",\n \"babel-preset-stage-3\",\n \"babel-preset-react\"\n ].map(require.resolve)\n ),\n retainLines: true\n }).code;\n }\n // Run our modules through the jest-webpack-alias plugin so we\n // can use the webpack alias in tests. By default, jest doesn't work\n // with webpack at all. webPackAlias matches filenames against the\n // alias settings in webpack.config and rewrites the filename to the\n // aliased path.\n src = webpackAlias.process(src, filename);\n }\n\n return src;\n }", "function jshint (jshintfile) {\n return lazypipe()\n .pipe(g.jshint, jshintfile)\n .pipe(g.jshint.reporter, stylish)();\n}", "CallExpression (path, { file }) {\n const { callee: { name: calleeName }, arguments: args } = path.node\n\n if (calleeName !== 'require' || !args.length || !t.isStringLiteral(args[0])) {\n return\n }\n\n const [{ value }] = args\n\n if (matchExtensions.test(value)) {\n const requiringFile = file.opts.filename\n const stylesheetPath = resolveStylesheetPath(requiringFile, value)\n const tokens = requireCssFile(stylesheetPath)\n\n const css = STYLES.get(stylesheetPath)\n\n // eslint-disable-next-line no-console\n console.log(`[transform-themeable]: ${basename(dirname(requiringFile))}`)\n\n if (!css) return\n\n if (!t.isExpressionStatement(path.parent)) {\n path.replaceWithSourceString(transformCSSRequire(tokens, css))\n } else {\n path.remove()\n }\n }\n }", "function f(a,b){function c(){var f=a[d++];return f?void b.loadFile(f,function(a,d){if(a)return b.complete(a);var g=e(d,f,b);b.patched(f,g,function(a){return a?b.complete(a):void c()})}):b.complete()}\"string\"==typeof a&&(a=/*istanbul ignore start*/(0,g.parsePatch)(a));var d=0;c()}", "function repFile(file, inString, outString) {\n replace({\n regex: inString,\n replacement: outString,\n paths: [file,],\n recursive: true,\n silent: true,\n })\n}", "function watchFiles() {\n const minify = 'minify' in argv; \n if (minify) {\n watch('index.js', series(bundleJs, minifyJs, bundleCss));\n watch('lib/**/*', series(bundleJs, minifyJs, bundleCss));\n } else {\n watch('index.js', series(bundleJs, bundleCss));\n watch('lib/**/*', series(bundleJs, bundleCss));\n }\n}", "function imageMin() {\n return src(files.imgPath)\n .pipe(imagemin())\n .pipe(dest('pub/images')\n );\n}", "function minify(ctxt, callback) {\n\t\tfs.readFile(ctxt.bundlePath, { encoding: 'utf8' }, function (err, content) {\n\t\t\tif (err) {\n\t\t\t\tcallback(err);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar ugly = uglifyString(content);\n\t\t\tfs.writeFile(ctxt.bundlePath, ugly, callback);\n\t\t});\n\t}", "function manifest(ignored) {}", "registerPartialFromFile(name, file) {\n this.registerPartial(name, new fs.File(file).text);\n }", "function parseContent(file, regex){\n return file.src.map(function(filepath) {\n var html;\n\n // Warn on and return error comment (if nonull was set).\n if (!grunt.file.exists(filepath)) {\n grunt.log.warn('Source file \"' + filepath + '\" not found.');\n return '<!--*** File ' + filepath + ' missing ***-->';\n } else {\n html = grunt.file.read(filepath);\n if (html) {\n return html.match(regex);\n }\n }\n })\n .join( grunt.util.normalizelf(options.separator) );\n }", "function min() {\n return src(['src/js/*.js', '!src/js/*.min.js', '!src/js/livereload.js'])\n .pipe(minify({\n ext:{\n src:'.js',\n min:'.min.js'\n },\n ignoreFiles: ['.min.js']\n }))\n .pipe(dest('src/js'))\n}", "function minimize(files, data){\n\tswitch (data.codeType) {\n\t\tcase 'js':\n\t\t\tminimizeJs(files, data);\n\t\t\tbreak;\t\t\t\n\t\tcase 'html':\n\t\t\tminimizeHtml(files, data);\n\t\t\tbreak;\t\t\t\n\t\tcase 'css':\n\t\t\tminimizeCss(files, data);\n\t\t\tbreak;\t\t\t\n\t\tdefault:\n\t\t\tconsole.error('Type to minmize unknown:' + data.codeType);\n\t\t\tbreak;\n\t}\n}", "function fileFromFountain() {\n\t// return a callback function handling the buffered content\n\treturn function(err, buf, callback) {\n\t\t// handle any error\n\t\tif (err) {\n\t\t\tthrow err;\n\t\t}\n\t\t// Use the buffered content\n\t\tfountain.parse(String(buf), function(output) {\n\t\t\t// TODO: HANDLE ERRORS\n\t\t\t// // Report any error with the callback\n\t\t\t// if (err) {\n\t\t\t// \tcallback(new gutil.PluginError(PLUGIN_NAME, err, {\n\t\t\t// \t\tshowStack: true\n\t\t\t// \t}));\n\t\t\t// \t// Give the transformed buffer back\n\t\t\t// } else {\n\t\t\t// \tcallback(null, output.script_html);\n\t\t\t// }\n\n\t\t\tcallback(null, output.script_html);\n\t\t});\n\t};\n}", "getReplace(capture, baseDir, paths, parsedFiles) {\n let parse = pathLib.parse(pathLib.resolve(baseDir, capture + '.scss'));\n let file = parse.dir + '/' + parse.name;\n\n if (file.slice(-3) === '.wp') {\n console.log('Windows Phone not supported \"' + capture);\n // File was already parsed, leave the import commented.\n return '// @import \"' + capture + '\";';\n }\n\n if (!fs.existsSync(file + '.scss')) {\n // File not found, might be a partial file.\n file = parse.dir + '/_' + parse.name;\n }\n\n // If file still not found, try to find the file in the alternative paths.\n let x = 0;\n while (!fs.existsSync(file + '.scss') && paths.length > x) {\n parse = pathLib.parse(pathLib.resolve(paths[x], capture + '.scss'));\n file = parse.dir + '/' + parse.name;\n\n x++;\n }\n\n file = file + '.scss';\n\n if (!fs.existsSync(file)) {\n // File not found. Leave the import there.\n console.log('File \"' + capture + '\" not found');\n return '@import \"' + capture + '\";';\n }\n\n if (parsedFiles.indexOf(file) >= 0) {\n console.log('File \"' + capture + '\" already parsed');\n // File was already parsed, leave the import commented.\n return '// @import \"' + capture + '\";';\n }\n\n parsedFiles.push(file);\n const text = fs.readFileSync(file);\n\n // Recursive call.\n return this.scssCombine(text, parse.dir, paths, parsedFiles);\n }", "function watch (file, opts) {\n var plugins = opts.plugins || []\n var watcher = new Watcher(opts)\n var bundle = postcss(plugins.concat(watcher.plugin()))\n\n // ensure absolute file paths\n if (!path.isAbsolute(file)) file = path.resolve(file)\n\n var cache = {\n file: file,\n watcher: watcher,\n processing: process(file, bundle)\n }\n\n cache.watcher.on('change', function () {\n cache.processing = process(file, bundle)\n })\n\n return cache\n}", "phototaked(file) {}", "compileAll () {\n const { from } = this.data\n globby.sync(from, { onlyFiles: true })\n .map(fromRelative => this.switchCallback('change', fromRelative, false))\n }", "ImportDefaultSpecifier (path, { file }) {\n const { value } = path.parentPath.node.source\n\n if (matchExtensions.test(value)) {\n const requiringFile = file.opts.filename\n const stylesheetPath = resolveStylesheetPath(requiringFile, value)\n const tokens = requireCssFile(stylesheetPath)\n\n const css = STYLES.get(stylesheetPath)\n\n // eslint-disable-next-line no-console\n console.log(`[transform-themeable]: ${basename(dirname(requiringFile))}`)\n\n if (!css) return\n\n path.parentPath.replaceWith(\n generateVariableDeclaration(path.node.local.name, tokens, css)\n )\n }\n }", "function processFile() {\n return (file, callback) => {\n const result = check(file);\n if (result) {\n async.nextTick(callback, new Error(`${file.path}: ${result}`), file);\n return;\n }\n\n async.nextTick(callback, null, file);\n };\n}", "function imageminTask(cb) {\n\n\treturn src(imgFiles)\n\t\t.pipe(imagemin())\n\t\t.pipe(dest(outputImgDir));\n}", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch /*istanbul ignore end*/)(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n }", "function process (file, bundle) {\n return readFile(file, 'utf8').then(function (content) {\n return bundle.process(content, { from: file }).then(function (result) {\n return result.css\n })\n })\n}", "_watch(target, recurse) {\n let start,\n jsFileRE = /[\\w_$-]+\\.(js|jsx|ts)/,\n watchCB\n\n// Configure http and socket communications....\n this._configureHTTP()\n\n// Start the server...\n this._igniteServer(\n process.env.PORT || this.options.watchOpts.port || app.get('port')\n )\n\n watchCB =(fn, pass=false)=> {\n/// If the changed file is valid....\n if (pass || this._validFileName(fn)) {\n// Get start time.....\n start = Date.now()\n\n// Roll up a new bundle....\n this._bundleFiles(this.entryFile, ()=> {\n// Send message via websocket to browser...\n io.emit('file-change', { file: fn })\n })\n// Stop the timer and subtract start time to get elapsed bundle time....\n this.ms = Date.now() - start\n// Stop the spinner with success....\n this.spinner.succeed('🗞')\n }\n }\n\n if (jsFileRE.test(target)) {\n // log('TARGET', 'magenta');log(target)\n// watch the target directory for file changes....\n fs.watchFile(target, (curr, prev)=> {\n// Execute cb.......\n watchCB(target, true)\n })\n } else {\n/// watch the root directory for file changes....\n fs.watch(target, {recursive: recurse}, (event, fileName)=> {\n // log('FILENAME', ['red', 'bold']);log(fileName);log(fileName.includes(this.outputFile));\n// Execute cb.......\n watchCB(fileName)\n })\n }\n }", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "function compileResources(fileInfo) {\r\n // run MakePri\r\n return Q.fcall(makePri, fileInfo.dir, fileInfo.out, true).then(function (priInfo) { \r\n // move generated PRI file into package folder\r\n var targetPath = path.join(fileInfo.dir, path.basename(priInfo.outputFile));\r\n return Q.nfcall(fs.rename, priInfo.outputFile, targetPath);\r\n })\r\n}", "function commentFilename(options){\n return function (files, metalsmith, done) {\n\n var regex = /^(exports|initializers|functions|widgets|bindings|aliases|finalizers)/;\n\n setImmediate(done);\n\n Object.keys(files).forEach(function(file){\n if (regex.test(file)) {\n var data = files[file];\n var input = String(data.contents);\n\n var prefix = options.char.repeat(2);\n var name = path.basename(file, path.extname(file));\n\n var output = '';\n output += '# ' + prefix + ' ';\n output += name + ' ';\n output = rpad(output, 80, options.char);\n output += '\\n\\n' + input;\n\n data.contents = Buffer.from(output);\n }\n });\n\n };\n}", "function keepNonMinified(file) {\n\tvar keep = true;\n\tif(file.path.match('.js$')) {\n\t\tvar minPath = file.path.replace('.js', '.min.js');\n\t\tkeep = !exists(minPath);\n\t}\n\treturn keep;\n}", "'package'(js_file_path, options = {}, callback) {\n\n\t\tlet a = arguments;\n\t\tif (typeof a[2] === 'function') {\n\t\t\tcallback = a[2];\n\t\t\toptions = {\n\t\t\t\t//'babel': 'mini',\n\t\t\t\t'include_sourcemaps': true\n\t\t\t};\n\t\t}\n\n\t\treturn prom_or_cb((resolve, reject) => {\n\t\t\t(async () => {\n\t\t\t\t// options\n\t\t\t\t// may want a replacement within the client-side code.\n\t\t\t\t// Can we call browserify on the code string?\n\t\t\t\t// Creating a modified copy of the file would do.\n\t\t\t\t// Load the file, modify it, save it under a different name\n\n\t\t\t\tlet s = new require('stream').Readable(),\n\t\t\t\t\tpath = require('path').parse(js_file_path);\n\n\t\t\t\tlet fileContents = await fnlfs.load(js_file_path);\n\t\t\t\t//console.log('1) fileContents.length', fileContents.length);\n\t\t\t\t// are there any replacements to do?\n\t\t\t\t// options.replacements\n\n\t\t\t\tif (options.js_mode === 'debug') {\n\t\t\t\t\toptions.include_sourcemaps = true;\n\t\t\t\t}\n\t\t\t\tif (options.js_mode === 'compress' || options.js_mode === 'mini') {\n\t\t\t\t\toptions.include_sourcemaps = false;\n\t\t\t\t\toptions.babel = 'mini';\n\t\t\t\t}\n\n\t\t\t\t//console.log('options.babel', options.babel);\n\n\t\t\t\tif (options.replace) {\n\t\t\t\t\tlet s_file_contents = fileContents.toString();\n\t\t\t\t\t//console.log('s_file_contents', s_file_contents);\n\t\t\t\t\teach(options.replace, (text, key) => {\n\t\t\t\t\t\t//console.log('key', key);\n\t\t\t\t\t\t//console.log('text', text);\n\t\t\t\t\t\tlet running_fn = '(' + text + ')();'\n\t\t\t\t\t\t//console.log('running_fn', running_fn);\n\t\t\t\t\t\ts_file_contents = s_file_contents.split(key).join(running_fn);\n\t\t\t\t\t})\n\t\t\t\t\tfileContents = Buffer.from(s_file_contents);\n\t\t\t\t\t//console.log('2) fileContents.length', fileContents.length);\n\t\t\t\t}\n\t\t\t\t// Then we can replace some of the file contents with specific content given when we tall it to serve that file.\n\t\t\t\t// We have a space for client-side activation.\n\t\t\t\ts.push(fileContents);\n\t\t\t\ts.push(null);\n\n\t\t\t\t//let include_sourcemaps = true;\n\n\t\t\t\tlet b = browserify(s, {\n\t\t\t\t\tbasedir: path.dir,\n\t\t\t\t\t//builtins: false,\n\t\t\t\t\tbuiltins: ['buffer', 'process'],\n\t\t\t\t\t'debug': options.include_sourcemaps\n\t\t\t\t});\n\n\t\t\t\tlet parts = await stream_to_array(b.bundle());\n\n\t\t\t\tconst buffers = parts\n\t\t\t\t\t.map(part => util.isBuffer(part) ? part : Buffer.from(part));\n\t\t\t\tlet buf_js = Buffer.concat(buffers);\n\t\t\t\tlet str_js = buf_js.toString();\n\n\t\t\t\tlet babel_option = options.babel\n\t\t\t\t//console.log('babel_option', babel_option);\n\t\t\t\tif (babel_option === 'es5') {\n\n\t\t\t\t\tlet o_transform = {\n\t\t\t\t\t\t\"presets\": [\n\t\t\t\t\t\t\t\"es2015\",\n\t\t\t\t\t\t\t\"es2017\"\n\t\t\t\t\t\t],\n\t\t\t\t\t\t\"plugins\": [\n\t\t\t\t\t\t\t\"transform-runtime\"\n\t\t\t\t\t\t] //,\n\t\t\t\t\t\t//'sourceMaps': 'inline'\n\t\t\t\t\t};\n\n\t\t\t\t\tif (options.include_sourcemaps) o_transform.sourceMaps = 'inline';\n\t\t\t\t\tlet res_transform = babel.transform(str_js, o_transform);\n\t\t\t\t\t//console.log('res_transform', res_transform);\n\t\t\t\t\t//console.log('Object.keys(res_transform)', Object.keys(res_transform));\n\t\t\t\t\tlet jst_es5 = res_transform.code;\n\t\t\t\t\t//let {jst_es5, map, ast} = babel.transform(str_js);\n\t\t\t\t\t//console.log('jst_es5.length', jst_es5.length);\n\t\t\t\t\tbuf_js = Buffer.from(jst_es5);\n\t\t\t\t} else if (babel_option === 'mini') {\n\t\t\t\t\t/*\n\t\t\t\t\tlet o_transform = {\n\t\t\t\t\t\tpresets: [\"minify\"]//,\n\t\t\t\t\t\t//'sourceMaps': 'inline'\n\t\t\t\t\t};\n\t\t\t\t\t*/\n\t\t\t\t\tlet o_transform = {\n\t\t\t\t\t\t\"presets\": [\n\t\t\t\t\t\t\t[\"minify\", {\n\t\t\t\t\t\t\t\t//\"mangle\": {\n\t\t\t\t\t\t\t\t//\"exclude\": [\"MyCustomError\"]\n\t\t\t\t\t\t\t\t//},\n\t\t\t\t\t\t\t\t//\"unsafe\": {\n\t\t\t\t\t\t\t\t//\t\"typeConstructors\": false\n\t\t\t\t\t\t\t\t//},\n\t\t\t\t\t\t\t\t//\"keepFnName\": true\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t],\n\t\t\t\t\t\t//plugins: [\"minify-dead-code-elimination\"]\n\t\t\t\t\t};\n\t\t\t\t\tif (options.include_sourcemaps) o_transform.sourceMaps = 'inline';\n\n\t\t\t\t\tlet res_transform = babel.transform(str_js, o_transform);\n\t\t\t\t\tbuf_js = Buffer.from(res_transform.code);\n\t\t\t\t} else {\n\t\t\t\t\tbuf_js = Buffer.from(str_js);\n\t\t\t\t}\n\t\t\t\tresolve(buf_js);\n\t\t\t})();\n\t\t}, callback);\n\t}", "function main(filePath) {\n /*// NON-CHEERIO WAY:\nvar manifestObject = generateManifestObject(filePath);\nvar formattedManifest = mapManifestData(manifestObject);*/\n\n // CHEERIO WAY:\n filePath = 'imsmanifest.xml';\n generateManifestObject(filePath);\n formattedManifest = mapManifestData();\n\n return formattedManifest;\n}", "function fileFilter(file) {\n return /\\.less$|\\.lessignore$/.test(file);\n}", "getFiles() {\n recursive(this.path, (err, files) => {\n for(var i in files) {\n var f = files[i];\n var stat = fs.statSync(f);\n\n if(stat.isFile()) {\n var basename = path.basename(f);\n var masks = [/^script\\.js$/, /^style\\.css$/, /^styles\\.css$/, /^.*\\.less$/];\n // if(basename == 'script.js' || basename == 'style.css' || basename == 'styles.css') {\n if( this.checkMask(basename, masks) ) {\n if(! this.files.includes(f)) {\n this.files.push(f);\n\n // if file has`t compressed copy make it\n if(! this.isFileCompressed(f)) {\n this.compressFile(f);\n }\n\n this.watcher(f);\n }\n }\n }\n }\n });\n }", "function base(){\n slushy\n .src( templates.client.base.all() )\n .pipe($.rename( _this.files().replace ) )\n .pipe($.template( filters ))\n .pipe($.conflict( _this.dirs.app ))\n .pipe( slushy.dest( _this.dirs.app ))\n }", "function vimres(start) {\n\tfromDir(start, new RegExp('\\.vimres\\.json'), (filename) => {\n\t\t// get the conifg file\n\t\tgetFiles(filename, (config) => {\n\t\t\tcreateOutPutDir(config, start);\n\t\t\tfromDir(start, new RegExp('\\.(png|jpg|gif|svg)$'), (img) => {\n\t\t\t\t// get img buffer\n\t\t\t\tif (!ignoredDir(start, config.output, img)) {\n\t\t\t\t\tgetFiles(img, (buffer) => {\n\t\t\t\t\t\tlet dir = getBaseDir(img, config.output);\n\t\t\t\t\t\ttransformation.transformation(config, buffer, dir)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t});\n\t\t}, true)\n\t});\n}", "function imgMinify() {\n // return src('src/img/*')\n return src(files.imgPath)\n .pipe(imagemin([\n imagemin.gifsicle({ interlaced: true }),\n imagemin.jpegtran({ progressive: true }),\n imagemin.optipng({ optimizationLevel: 5 }),\n imagemin.svgo({\n plugins: [\n { removeViewBox: true },\n { cleanupIDs: false }\n ]\n })\n ], {\n verbose: true\n }))\n .pipe(dest(files.imgPubPath)) // place images in img-folder\n}", "function createSyncImportHook() {\n var imports = {};\n return function (fpath, kind, cb) {\n fpath = path.resolve(fpath);\n if (imports[fpath]) {\n cb();\n } else {\n imports[fpath] = true;\n cb(null, fs.readFileSync(fpath, {encoding: 'utf8'}));\n }\n };\n}", "function applyPatches(uniDiff, options) {\n if (typeof uniDiff === 'string') {\n uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n }\n\n var currentIndex = 0;\n function processIndex() {\n var index = uniDiff[currentIndex++];\n if (!index) {\n return options.complete();\n }\n\n options.loadFile(index, function (err, data) {\n if (err) {\n return options.complete(err);\n }\n\n var updatedContent = applyPatch(data, index, options);\n options.patched(index, updatedContent, function (err) {\n if (err) {\n return options.complete(err);\n }\n\n processIndex();\n });\n });\n }\n processIndex();\n}", "function processFile(pFileName) {\n\tif(regexImages.exec(pFileName)) resizeImageForAllSizes(pFileName);\n\telse if (regexJson.exec(pFileName)) recalculateJsonForAllSizes(pFileName);\n\telse console.warn('WARN '.yellow + '- ' + pFileName.magenta + ' Vous essayez de modifier autre chose que des PNG ou des JSON, le format JPG n\\'est pas supporté');\n}", "function runSvgmin() {\n return gulp\n .src(path.join(rootPath, options.icon.srcDir, \"**\", \"*.svg\"))\n .pipe(\n flatmap((stream, file) => {\n var filename = file.path.replace(file.base, \"\");\n filename = filename.replace(\n options.icon.renameSrcFile.from,\n options.icon.renameSrcFile.to\n );\n return stream.pipe(svgmin()).pipe(gulpconcat(filename));\n })\n )\n .pipe(gulp.dest(path.join(rootPath, options.icon.minifiedDir)));\n }", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "getMagicCommentMasterFile() {\n const magic = new MagicParser(this.filePath).parse();\n if (!magic || !magic.root) { return null; }\n return path.resolve(this.projectPath, magic.root);\n }", "watch() {\n if (! process.argv.includes('--watch')) return;\n\n this.manualFiles.forEach(file => {\n new File(file).watch(() => {\n File.find(this.manifest.get(file))\n .rename(this.generateHashedFilePath(file))\n .write(File.find(file).read());\n\n this.prune(this.baseDir);\n });\n });\n }", "function imageminComp(cb) {\n return src(\"./src/images/*.+(png|jpg|gif|svg)\",{since: lastRun(imageminComp)})\n .pipe(gulpIf(process.env.NODE_ENV === \"prod\", imageMin([\n imageMin.gifsicle({interlaced: true}),\n imageMin.mozjpeg({quality: 50, progressive: true}),\n imageMin.optipng({optimizationLevel: 5}),\n imageMin.svgo({\n plugins: [\n {removeViewBox: true},\n {cleanupIDs: false}\n ]\n })\n ])))\n .pipe(dest(buildDir+\"images/\"))\n cb();\n}", "function matchPattern(filename, pattern) {\n return ignore_1.default()\n .add(pattern)\n .ignores(filename);\n}", "*replace() {\n yield { \"filter\": \"package.json\" },\n yield { \"filter\": \"Dockerfile\" },\n yield { \"filter\": \".vscode/launch.json\" },\n yield { \"filter\": \"src/index.ts\" }\n }", "function replaceImportFile(func) {\n _importFile = func;\n }", "function minifyJS(f) {\n console.log(\"Begin Minifying \" + f.name);\n src(f.buildDir + f.buildFileName)\n .pipe(uglify())\n .pipe(extReplace(\".min.js\"))\n .pipe(\n dest(f.buildDir));\n console.log(\"End Minifying \" + f.name);\n}", "function fixImportScript(file){//{filename: STRING, src: STRING}\r\n\r\n\tvar fileName = file.filename.replace(__dirname, '').replace(/\\\\/gm, '/');\r\n\tfileName = fileName.replace(/^\\//, '');\r\n\r\n\t//convert importScripts() to require()\r\n\tif(/importScripts\\s*\\(/g.test(file.src)){\r\n\r\n\t\tconsole.log(' detected importScript for '+fileName);\r\n\r\n\t\tif(/^workers\\//i.test(fileName)){\r\n\r\n\t\t\tif(/importScripts\\s*\\(\\s*'/g.test(file.src)){\r\n\t\t\t\tfile.src = file.src.replace(/importScripts\\s*\\(\\s*(')([^']+)(')/g, function(_match, p1, p2, p3){\r\n\t\t\t\t\treturn 'require(' + p1 + 'workers/' + p2.replace(/\\.js$/i, '') + p3;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t\tif(/importScripts\\s*\\(\\s*\"/g.test(file.src)){\r\n\t\t\t\tfile.src = file.src.replace(/importScripts\\s*\\(\\s*(\")([^\"]+)(\")/g, function(_match, p1, p2, p3){\r\n\t\t\t\t\treturn 'require(' + p1 + 'workers/' + p2.replace(/\\.js$/i, '') + p3;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\tfile.src = wrapAsModule(file.src.replace(/importScripts\\s*\\(/g, 'require('));\r\n\r\n\t}\r\n\r\n //DISABLED: env/media/** are now AMD modules (since mmir v5.x)\r\n\t// if(/env\\/media\\//i.test(fileName)){\r\n //\r\n\t// \t//\"pull-up\" simple require-calls (these seem to to not get detected otherwise)\r\n\t// \tdeps = extractSimpleReqCalls(file.src);\r\n //\r\n\t// \tfile.src = wrapAsModule(file.src);//, deps);\r\n\t// }\r\n\r\n if(/tools\\/util_jquery\\//.test(fileName)){\r\n\r\n var jsUtilName = fileName.replace(/.*tools\\/util_jquery\\//, 'tools/util_purejs/').replace(/\\.js$/i, '');\r\n\r\n console.log(' detected jquery module, adding util_purejs variant as depencency -> ', jsUtilName);\r\n\r\n file.src = injectDeps(file.src, [jsUtilName]);\r\n }\r\n\r\n\t//\"convert\" any non-modules to modules\r\n\t// NOTE: this may fail to detect, if a script is not a module (i.e. if there is any \"define(\" contained, but script itself is not a module)\r\n\tif(!/define\\s*\\(/g.test(file.src)){\r\n\t\tfile.src = wrapAsModule(file.src);\r\n\t}\r\n\r\n\r\n\treturn file;\r\n}", "function process(arg) {\n var defaultOpt = {\n psm: 7\n };\n\n var option = (0, _assign2.default)({}, defaultOpt, arg);\n\n return function (filepath) {\n return new _promise2.default(function (resolve, reject) {\n _nodeTesseract2.default.process(filepath, option, function (err, txt) {\n if (err) {\n return reject(err);\n }\n return resolve(txt);\n });\n });\n };\n}", "function cons() {\n return src([\n 'src/js/jquery.custom.min.js',\n 'src/js/menu.min.js',\n 'src/js/swiper.custom.min.js',\n ], { sourcemaps: true })\n .pipe(concat('app.min.js'))\n .pipe(dest('dist/', { sourcemaps: true }))\n}", "fnmatch(pattern) {\n if (pattern.indexOf('*') === -1) {\n return filename => pattern === filename;\n } else {\n let reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n let escaped = pattern.replace(reRegExpChar, '\\\\$&');\n let matcher = new RegExp('^' + escaped.replace(/\\\\\\*/g, '.*') + '$');\n return filename => matcher.test(filename);\n }\n }", "function morefacts (filename,target)\n {var contents = fs.readFileSync(filename).toString();\n var data = readdata(contents);\n definemorefacts(target,data);\n return true}", "function image_smaller1() {\r\n return gulp\r\n .src(smaller1.src, { nodir: true })\r\n .pipe(newer(smaller1.dist + \"smaller\"))\r\n .pipe(imageresize({\r\n width: smaller1.params.width,\r\n height: smaller1.params.height,\r\n crop: smaller1.params.crop,\r\n upscale: false\r\n }))\r\n .pipe(imagemin({\r\n progressive: true,\r\n svgoPlugins: [{ removeViewbox: false}, { removeUselessStrokeAndFill: false }]\r\n }))\r\n .pipe(gulp.dest(smaller1.dist + \"smaller\"));\r\n\r\n}", "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "function applyPatches(uniDiff, options) {\n\t if (typeof uniDiff === 'string') {\n\t uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);\n\t }\n\n\t var currentIndex = 0;\n\t function processIndex() {\n\t var index = uniDiff[currentIndex++];\n\t if (!index) {\n\t return options.complete();\n\t }\n\n\t options.loadFile(index, function (err, data) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t var updatedContent = applyPatch(data, index, options);\n\t options.patched(index, updatedContent, function (err) {\n\t if (err) {\n\t return options.complete(err);\n\t }\n\n\t processIndex();\n\t });\n\t });\n\t }\n\t processIndex();\n\t}", "function processFile(file, jsdom, cb) {\n fs.readFile(file, 'utf8', function(err, body) {\n if(err) return cb(err);\n jsdom.env({\n html: body,\n src: [jquery],\n done: cb\n });\n });\n}", "setFileDetector() {}", "beautify() {\n this.lr = new LineByLineReader(this.args.file);\n\n // register event handlers\n this.lr.on(\"error\", (err) => this.error_handler(err));\n this.lr.on(\"line\", (line) => this.line_handler(line));\n this.lr.on(\"end\", () => this.end_handler());\n }", "function getIncludedContent(fileName, css) {\n return fs.readFileAsync(dirname + fileName, {encoding: 'utf8'}).then(function(data) {\n if (css && conf.cssUrlReplacer) {\n data = data.replace(cssurl, function(matched, pref, theUrl, suf) {\n //console.log('readFileAsync, css replacer: ' + url + ', ' + theUrl);\n return pref + conf.cssUrlReplacer(theUrl) + suf;\n });\n }\n incfiles[fileName] = data;\n })\n .catch(function(e) {\n // If we can't read the file, just issue a console warning and continue.\n // Content for this file will not be inlined.\n console.warn('Inliner:\\n' + e);\n });\n }", "function watchFiles() {\n gulp.watch('assets/css/common.scss', critical);\n gulp.watch('assets/css/critical.scss', critical);\n gulp.watch('assets/css/extends.scss', critical);\n gulp.watch('assets/css/fonts.scss', critical);\n gulp.watch('assets/css/mixins.scss', critical);\n gulp.watch('assets/css/reset.scss', critical);\n gulp.watch('assets/css/variables.scss', critical);\n gulp.watch('assets/css/wufoo.scss', wufoo);\n gulp.watch('assets/js/download.js', webpack);\n gulp.watch('assets/js/header.js', webpack);\n gulp.watch('assets/js/lazy.js', webpack);\n gulp.watch('assets/js/webp.js', webpack);\n gulp.watch('assets/js/wufoo.js', webpack);\n}", "function injectWatcher(handler) {\n\t\treturn function (module, filename) {\n\t\t\tfs.watchFile(filename, watcher);\n\t\t\thandler(module, filename);\n\t\t};\n\t}", "highlightSync (param) {\n if (param == null) { param = {} }\n let { filePath, fileContents, scopeName } = param\n this.loadGrammarsSync()\n\n if (filePath) { if (fileContents == null) { fileContents = fs.readFileSync(filePath, 'utf8') } }\n\n return this._highlightCommon({ filePath, fileContents, scopeName })\n }", "function lint() {\n return gulp.src([\n paths.scripts.src + '*.js',\n `!${paths.scripts.src}*.min.js`,\n ])\n .pipe(jshint())\n .pipe(jshint.reporter('jshint-stylish'));\n}", "async optimizeCwd(cwd) {\n await Promise.all(\n cwd.map(\n (p) =>\n new Promise((done) => {\n this.Console.log(`Optimizing: ${p}`);\n\n fs.readFile(p, (exception, data) => {\n if (exception) {\n return this.Console.error(exception);\n }\n\n if (!data) {\n this.Console.log(`Unable to optimize ${p} since the file is empty`);\n return super.resolve();\n }\n\n const result = minify(data.toString(), this.getOption('minify', {}));\n\n if (!result.code || result.error) {\n if (result.error) {\n this.Console.error(`Minify exception encountered for ${p}: ${result.error}`);\n this.Console.info(`The original state for ${p} will be used instead.`);\n }\n }\n\n return this.write(\n p,\n result.error || this.environment.THEME_ENVIRONMENT === 'development'\n ? data.toString()\n : result.code\n )\n .then(done)\n .catch((e) => {\n this.Console.error(e);\n\n super.reject();\n });\n });\n })\n )\n );\n }", "function matchFile(filename, entries) {\n for (let entry of entries) {\n if (matchPattern(filename, entry.pattern)) {\n return entry;\n }\n }\n return null;\n}", "static process_file(filename)\r\n {\r\n if (fs === null)\r\n {\r\n throw new Error(\"Not in node.js : module fs not defined. Aborting.\");\r\n }\r\n if (DEBUG)\r\n {\r\n console.log('Processing file:', filename);\r\n console.log('--------------------------------------------------------------------------');\r\n }\r\n let data = Hamill.read_file(filename);\r\n let doc = this.process_string(data);\r\n doc.set_name(filename);\r\n return doc;\r\n }", "function transform(filename) {\n if (shouldStub(filename)) {\n return reactStub;\n } else {\n var content = fs.readFileSync(filename, 'utf8');\n return ReactTools.transform(content, {harmony: true});\n }\n}", "_validFileName(file) {\n// Watch file name inclusions and exclusions......\n let ins = this.fileExtensions,\n nots = this.fileExclusions\n\n function includesOne(file) {\n// Ensure that the filename includes at least one of the above file extensions (`ins`) in\n// the file name....\n let res = ins.reduce((accumulator, val)=> {\n return accumulator || file.includes(val)\n }, false)\n\n// Return the result of the reduce function.....\n return res\n }\n\n function excludesAll(file) {\n// Ensure that none of the 'nots' strings are included in the changed file's name....\n let res = nots.reduce((accumulator, val)=> {\n return accumulator && !file.includes(val)\n }, true)\n\n/// Return the result of the reduce function.....\n return res\n }\n\n// return result of both funcs....\n return includesOne(file) && excludesAll(file)\n }", "function compress() {\n return src(['dist/math.js'])\n .pipe(minify({\n ext:{\n min:'.min.js'\n }\n }))\n .pipe(dest('./dist'));\n}", "_patchInsertApply(patchInfo) {\n let info = Object.assign({}, patchInfo, {end: patchInfo.start});\n this._patchReplaceApply(info);\n /*istanbul ignore else*/\n if (patchInfo.reparse) this._parseInvoke();\n }", "function minсss() {\n // Folder with files to minify\n return src(['./css/*.css', '!./css/*.min.css'])\n //The method pipe() allow you to chain multiple tasks together \n //I execute the task to minify the files\n .pipe(rename({\n suffix: '.min'\n }))\n\n .pipe(cleanCSS())\n //I define the destination of the minified files with the method dest\n .pipe(dest('./dist/css'));\n}", "write(target = './compiled/guides/', source = './content/guides/') {\n glob.sync(`${source}/**/*.md`).forEach(filename => {\n new MarkdownProcessor({ \n sourcePath: filename\n }).write({\n from: source,\n to: target\n })\n })\n }", "function discoverFile(file) {\n return discover(require(file));\n}", "function watchFile(opts) {\r\n var bundler = new Browserify(opts.entries, {\r\n cache: {},\r\n packageCache: {},\r\n debug: true,\r\n detectGlobals: false, // dont insert `process`, `global`, `__filename`, and `__dirname`\r\n bundleExternal: false, // dont bundle external modules\r\n plugin: [Watchify]\r\n });\r\n \r\n bundler.on('update', bundle);\r\n\r\n if (opts.skips) {\r\n var skips = opts.skips;\r\n for (var i = 0; i < skips.length; ++i) {\r\n var file = require.resolve(skips[i]);\r\n bundler.ignore(file);\r\n } \r\n }\r\n \r\n function bundle() {\r\n var name = new Date().toTimeString() + ' : browserify for ' + opts.dest + '. ';\r\n console.time(name);\r\n\r\n // append prefix to index.js\r\n var prefix = '';\r\n if (opts.prefix) {\r\n if (typeof opts.prefix === 'function') {\r\n prefix = opts.prefix();\r\n }\r\n else if (typeof opts.prefix === 'string') {\r\n prefix = opts.prefix;\r\n }\r\n }\r\n\r\n bundler.transform(function (file) {\r\n var data = '';\r\n \r\n if (Path.basename(file) === 'index.js') {\r\n data += prefix;\r\n }\r\n\r\n return through(write, end);\r\n\r\n function write (buf) { data += buf; }\r\n function end () {\r\n this.queue(data);\r\n this.queue(null);\r\n }\r\n return;\r\n });\r\n\r\n // do bundle\r\n var b = bundler.bundle();\r\n\r\n b.on('end', function () {\r\n console.timeEnd(name);\r\n });\r\n\r\n b = b.pipe(Fs.createWriteStream(opts.dest));\r\n\r\n // fixed chinese character in source maps\r\n // b = b.pipe(source(Path.basename(opts.dest)))\r\n // .pipe(buffer())\r\n // .pipe(sourcemaps.init({loadMaps: true}))\r\n // .pipe(sourcemaps.write('./'))\r\n // .pipe(gulp.dest(Path.dirname(opts.dest)));\r\n \r\n return b;\r\n }\r\n \r\n return bundle();\r\n}", "maybeWrap () {\n if (this.version === 1) {\n this.data.assets.forEach(asset => {\n if (asset.url === 'app.js' || asset.name === 'app.js') {\n const { code } = asset;\n\n if (code && !/(Ext\\.onReady\\(|Ext\\.application\\(|Ext.setup\\()/.test(code)) {\n asset.code = `Ext.onReady(function() {\\n\\n${code}\\n\\n});`;\n }\n }\n });\n }\n }" ]
[ "0.5433874", "0.5396781", "0.53411776", "0.5238935", "0.5177372", "0.51580524", "0.51441073", "0.51297617", "0.5081722", "0.5060609", "0.5046817", "0.5010978", "0.50093603", "0.49734014", "0.4949765", "0.49160546", "0.48884895", "0.48371965", "0.48274007", "0.4809469", "0.48006466", "0.47867092", "0.47865632", "0.4775788", "0.4766428", "0.476252", "0.47444257", "0.47228885", "0.47163066", "0.4704599", "0.4701913", "0.47008753", "0.46923384", "0.46875", "0.4675021", "0.4664105", "0.46527272", "0.46267962", "0.46096122", "0.45881015", "0.4578116", "0.45775437", "0.45773047", "0.4530148", "0.45196697", "0.45196697", "0.45196697", "0.45196697", "0.45196697", "0.45086202", "0.45055184", "0.4504851", "0.45014393", "0.4499604", "0.44921812", "0.44888085", "0.44809055", "0.44807878", "0.4480569", "0.44796142", "0.44785914", "0.4478264", "0.44754735", "0.4472703", "0.4471553", "0.446725", "0.44661415", "0.4457951", "0.44468287", "0.44467834", "0.44451955", "0.4442545", "0.4439285", "0.44210282", "0.44207206", "0.44189203", "0.44120917", "0.4406885", "0.4406885", "0.4406885", "0.4406885", "0.44052207", "0.44005504", "0.43999293", "0.43969062", "0.43965515", "0.4394633", "0.43837094", "0.43787435", "0.43770465", "0.43738204", "0.43717772", "0.43710053", "0.4369337", "0.43669128", "0.43573964", "0.43547854", "0.43428743", "0.43412223", "0.43391603", "0.43366408" ]
0.0
-1
Encontrar la length de una lista / length: list>number Hallar la length de una lista function length(list) length([1,2,3,4])>4 length([])>0 length([0])>1
function length(list) { if(isEmpty(list)) { return 0; } else { return 1 + length(rest(list)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listLength(){\n return list.length;\n}", "function length() {\n array = ['1', '2', '3'];\n return array.length\n}", "function length(xs){\r\n return xs.length;\r\n}", "function length(xs) {\n for (var i = 0; !is_empty_list(xs); ++i) {\n\t\txs = tail(xs);\n }\n return i;\n}", "function length() {\n\treturn this.listSize;\n}", "function listLength() {\n\tconsole.log(listItems.length);\n\treturn listItems.length;\n}", "function checkListLen() {\n return ul.children.length;\n}", "function listLength() {\n return item.length;\n}", "function listLength() {\n return listItems.length;\n}", "function listLength(){\n\treturn item.length;\n}", "@expression(\"length of <List>\", {\n\t\talias: [\"size of <List>\", \"number of items (of|in) <List>\"]\n\t\ttypes: [ List ],\n\t\treturns: Integer\n\t})\n\tstatic length(list) {\n\t\tif (!(list instanceof List)) return undefined\n\t\treturn list.items.length\n\t}", "function check_len(_indefinite_length, _length)\n {\n if(_indefinite_length == true)\n return 1;\n\n return _length;\n }", "length_list() {\r\n var temp = this.head\r\n let length = 0\r\n while (temp.next != null) {\r\n length++\r\n temp = temp.next\r\n }\r\n return length\r\n }", "get length() {\n this._update();\n return this._list.length;\n }", "function length(list) {\n /**\n * A byte sequence’s length is the number of bytes it contains.\n */\n return list.length;\n}", "function length(array) {\n return array.length | 0;\n}", "function length(array) {\n return array.length | 0;\n}", "function validate_len(list) {\n if (list._list.length > list._context._interpreter._flags.maxContainersLen) {\n throw new Errors.ExceedMemoryLimit(\"List exceeded maximum container length (\" + list._context._interpreter._flags.maxContainersLen + \")\");\n }\n}", "function length1(a) {\n var len = 0;\n while (a[len] !== undefined)\n len++;\n\n}", "function sc_length(l) {\n var res = 0;\n while (l !== null) {\n\tres++;\n\tl = l.cdr;\n }\n return res;\n}", "function rltlength () {\n}", "function length(arr) {\n // code\n var lengthCount = arr.length;\n return lengthCount;\n}", "get length() {\n return this._list.length;\n }", "get length() {\n return this.list.size;\n }", "function length(p0) {\n return filterFunction('length', 'int', p0);\n}", "function getLength(x) {\n return x.length\n}", "getLength() {\r\n\t\tlet len = 0;\r\n\t\tlet itr = this.head;\r\n\t\twhile (itr) {\r\n\t\t\tlen++;\r\n\t\t\titr = itr.next;\r\n\t\t}\r\n\t\treturn len;\r\n\t}", "function length(writer, value) {\n return isArray(value) ? value.length : 0;\n}", "function getLength( list ) {\n if( list == \"ids\" ){\n return ids.length\n }else if( list == \"titles\" ) {\n return titles.length\n }else if( list == \"types\" ) {\n return types.length\n }else if( list == \"uris\" ) {\n return uris.length\n }else if( list == \"thumbUris\" ) {\n return thumbUris.length\n }else {\n console.log( \"list \" + list + \" unknown.\" )\n return -1\n }\n}", "get length() {\n return this.list.length;\n }", "length(){\n let len = 0;\n let runner = this.head;\n while (runner){\n len++;\n runner = runner.next;\n }\n return len;\n }", "length(){\n let len = 0;\n let runner = this.head;\n while (runner){\n len++;\n runner = runner.next;\n }\n return len;\n }", "function size(llist) {\n let currNode = llist.head;\n let counter = 0;\n while (currNode !== null) {\n currNode = currNode.next;\n counter++;\n }\n console.log(\"This list has \" + counter + \" items\");\n}", "set length(value) {}", "set length(value) {}", "function getLength(arr){\n var a = arr.length\n return a\n}", "length(arr) {\n return arr.length;\n }", "function getLength(something) {\n return something.length;\n}", "function length (data, value) {\n assert.not.undefined(value);\n\n return assigned(data) && data.length === value;\n }", "length(){\n let length = 0;\n let current;\n\n for(\n current = head;\n current !=null;\n current = current.next\n ){\n length++\n }\n return length;\n }", "function hasLength (data, length) {\n return assigned(data) && data.length === length;\n }", "function getLength(item) {\r\n if (!IsUndefinedNullOrEmpty(item))\r\n return item.length;\r\n else\r\n return 0;\r\n}", "function arrayLengthTest1() {\n var arr;\n var k;\n\n // base case\n arr = [ 1, 2, undefined, 4 ];\n print(JSON.stringify(arr));\n\n // length must be obeyed even if no elements have been added\n arr = [ 1, 2, undefined, 4 ];\n arr.length = 8;\n print(JSON.stringify(arr));\n\n arr = [ 1, 2 ];\n arr[100] = 'foo';\n arr[3] = 4;\n print(JSON.stringify(arr));\n}", "get length() {\n return array.length == 0\n }", "function\nXATS2JS_jsarray_length\n (xs)\n{\n return (xs.length);\n}", "get length() {\n var _a, _b;\n\n return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n }", "function getLength(drums) {\n return drums.length;\n \n}", "get length() {}", "get length() {}", "get length () {\n return this.list.length\n }", "function ArrayLength(array) {\n\tif(!array){\n\t\treturn 0;\n\t}\n\tvar length = Number(array.length);\n\treturn array instanceof Array || array.length == length\n\t\t/**\n\t\t * \n\t\t */\n\t\t? length\n\t\t/**\n\t\t * support for Collections (such as java.util.Set)\n\t\t */\n\t\t: typeof array.size === 'function' \n\t\t\t? array.size() \n\t\t\t/**\n\t\t\t * failover\n\t\t\t */\n\t\t\t: String(array).split(',').length;\n}", "get length() {\n\t\treturn this.items.length;\n\t}", "function emptyList(size)\n{\n return fillList(size, \"\");\n}", "function getNameListLength(){\r\n var len = getNameLength();\r\n return len;\r\n}", "function unusualFive() {\n let array =[\"a\",\"b\",\"c\",\"d\",\"e\"]\nreturn array.length\n}", "function stream_length(xs) {\n if (is_empty_list(xs)) {\n\treturn 0;\n } else {\n\treturn 1 + stream_length(stream_tail(xs));\n }\n}", "function numOfBlanks(arryVal,arrylen) {\n var trueLen = arryVal.filter(Boolean).length;\n return arrylen - trueLen;\n}", "function listLength(head) {\n let count = 0;\n\n for (let node = head; node != null; node = node.next) {\n count += 1;\n }\n // (...)\n\n return count;\n}", "get length() {\n let entry = this.first;\n let length = 0;\n while (entry) {\n ++length;\n entry = entry.next;\n }\n return length;\n }", "function getSize(list) {\n if (list.head === null)\n return 0;\n let n = list.head;\n let size = 1;\n while (n.next !== null) {\n size++;\n n = n.next;\n }\n return size;\n}", "function setListLength() {\n var $length = $(\"#link-list li\").length;\n $(\".list-counter\").html($length + ' Items');\n}", "length() {\n let length = this.end - this.begin;\n if (length < 0) {\n length = this.doubledCapacity + length;\n }\n return length;\n }", "function getLength(i) {\n return i.length;\n}", "function countListItems(array) {\n if (array.length >= 1 && array.length <= 9) {\n counter.removeClass('hidden');\n counter.html(`<p>${array.length}</p>`);\n } else if (array.length > 9) {\n counter.html(`<p>9+</p>`);\n } else {\n counter.addClass('hidden');\n }\n}", "function arrayLength(anyArray) {\n var count = 0; \n while(anyArray[count] !== undefined) {\n count = count +1; \n }\n return count; \n}", "function checkList() {\n\treturn document.getElementsByTagName('li').length;\n}", "size() {\n let len = 0;\n let runner = this.head;\n\n while (runner) {\n len += 1;\n runner = runner.next;\n }\n return len;\n }", "sizeOfList() {\r\n\t\treturn this.size;\r\n\t}", "length(){\n if(this.head === null){\n return 0;\n }\n let count = 1;\n let currentNode = this.head;\n while(currentNode.next !== null){\n count++;\n currentNode = currentNode.next;\n }\n return count;\n }", "function elementoLength(elemento){\n\t var dimension =0;\n\t //validamos si existe referencia del elemento, de no ser asi (undefined) se significa que hay 0 elementos \n\t //si es diferente de undefined entonces sabemos que 1 o mas elementos\n\t if( elemento !== undefined ){ \n\t\t //verificamos cual es la longitud. length es una propiedad de un arreglo, \n\t\t //si el elemento no es un arreglo (dos o mas elementos),length valdra undefined por lo que consideraremos \n\t\t //que no es un arreglo (solo un valor)\n\t\t dimension = elemento.length;\n\t\t if(dimension === undefined){\n\t\t\tdimension=1;//como es undefined determinamos que la longitud es uno\n\t\t }\n\t }\n\t return dimension; //regresamos cero zonas\n}", "function length(a,b) {\n return a.length - b.length\n}", "get length() {\n return this.items.size;\n }", "function Len() {\r\n}", "function lengths(arr){\n return arr.map(f => f.length);\n}", "function length(arr){\r\n\tvar length = 0;\r\n\tfor(var len in arr){\r\n\t\tlength++;\r\n\t}\r\n\treturn length;\r\n}", "sizeOfList() {\n console.log(\"list size: \", this.size);\n }", "function getLongestListElementSize(p_list) {\n var longestSize = 0;\n var len = p_list.length;\n for (var i = 0; i < len; ++i) {\n if (p_list[i].length > longestSize) {\n longestSize = p_list[i].length;\n }\n }\n return longestSize;\n}", "function foo(x) {\n return x.length;\n}", "function emptyList(size)\n{\n var li = [];\n for(var i = 0; i < size; i++)\n {\n li.push(\"\");\n }\n \n return li;\n}", "sizeOfList() {\n return this.size;\n }", "sizeOfList() {\n return this.size;\n }", "get length() {\n let node = this.head;\n let count = 0;\n while (node !== null) {\n count++;\n node = node.next;\n }\n return count;\n }", "function getLength(input){\n return input.length;\n}", "function wordLength(wordList){\n var wordLength = [];\n for(i = 0; i < wordList.length; i++){\n wordLength.push(wordList[i].length)\n }\n return wordLength\n}", "function getElementCount(array) {\n return array.length;\n}//helper function for number of elements in array", "static verifyLength(value, length) {\n return value.length >= length;\n\n }", "function len(obj){\n\treturn obj.length;\n}", "size_of_list() {\n console.log(_size);\n }", "function ls (lista) {\nreturn lista.sort(function(x, y) {\n return y.length - x.length; \n })\n}", "function lvl5exercise3() {\n\tvar array = [1, \"adam\"];\n console.log(\"3) \" + array.length);\n}", "function arrLength(arr) {\n let length = 0;\n while (arr[length]) {\n length++;\n };\n return length;\n}", "function longitud(list) {\n if(isEmpty(list)) {\n return 0;\n } else {\n return 1 + longitud(rest(list));\n }\n}", "get length() {\n\t\t\t\treturn _collection.length;\n\t\t\t}", "function getLength(array) {\n console.log(array);\n // base case\n if (array[0] === undefined) return 0;\n // recursive call\n // return 1+ getLength(array without the first value)\n return 1 + getLength(array.slice(1));\n}", "function songLength(songArray) {\n var playlist = 0;\n for (var i = 0; i < songArray.length; i++) {\n //does songArray.length = 60?\n //\n }\n}", "function nbItems(list){\n var count = list.length;\n for (var i = 0; i < list.length; i++) {\n count += list[i].users.length;\n }\n return count;\n }", "function length( subject ) {\n return subject.length;\n}", "function length( subject ) {\n return subject.length;\n}", "function length(array)\n{\n\tif (array.height === 0)\n\t{\n\t\treturn array.table.length;\n\t}\n\telse\n\t{\n\t\treturn array.lengths[array.lengths.length - 1];\n\t}\n}", "function length(array)\n{\n\tif (array.height === 0)\n\t{\n\t\treturn array.table.length;\n\t}\n\telse\n\t{\n\t\treturn array.lengths[array.lengths.length - 1];\n\t}\n}" ]
[ "0.7409954", "0.7272885", "0.7251318", "0.72197694", "0.70779467", "0.7034012", "0.70213664", "0.7015795", "0.70146585", "0.7003693", "0.69473493", "0.68112355", "0.67341673", "0.67307425", "0.6651546", "0.6612045", "0.6612045", "0.6524742", "0.64799005", "0.6473605", "0.64724696", "0.6450617", "0.6415806", "0.6414333", "0.6374851", "0.63674974", "0.63650924", "0.63379806", "0.6332736", "0.6324878", "0.63132143", "0.63132143", "0.63118607", "0.62999684", "0.62999684", "0.62902", "0.62887466", "0.6274627", "0.6265213", "0.6247666", "0.6237041", "0.6214325", "0.61930186", "0.61390185", "0.61387235", "0.6135007", "0.61210537", "0.6118009", "0.6118009", "0.6113458", "0.6086907", "0.608566", "0.6084365", "0.60614395", "0.60495996", "0.6040461", "0.60364854", "0.6028193", "0.6010671", "0.60084116", "0.5997555", "0.5991132", "0.5977121", "0.5963887", "0.59634775", "0.59481275", "0.59312415", "0.59189916", "0.5912105", "0.5891124", "0.5889602", "0.58876336", "0.58692485", "0.5867461", "0.5863678", "0.58601594", "0.58555984", "0.58484507", "0.5847461", "0.58034223", "0.58034223", "0.5802839", "0.580078", "0.5797591", "0.5789977", "0.577643", "0.57742476", "0.57729673", "0.5770265", "0.57700795", "0.5756231", "0.57520825", "0.5747573", "0.5741683", "0.57397664", "0.5735301", "0.5728473", "0.5728473", "0.57250285", "0.57250285" ]
0.79612714
0
sumAll:list>number Sumar todos los elementos de una lista function sumAll(list) sumAll([1,2,3])>6 sumAll([0,1])>1 sumAll([1,1])>0
function sumAll(list) { if(length(list) == 1) { return first(list); } else { return first(list) + sumAll(rest(list)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumAll(list) {\n if(length(list) == 1) {\n return first(list);\n } else {\n return first(list) + sumAll(rest(list));\n }\n}", "function sumAll( ) {\n let sum = 0;\n // TODO: loop to add items\n return sum;\n}", "function sumList(l) {\n\tlet sum = 0;\n\tfor (let i = 0; i < l.length; i++)\n {\n\t\tsum += l[i];\n\t}\n\treturn sum;\n}", "function sumaLista(lista) {\n\tif (isEmpty(lista)) return 0\n\treturn first(lista) + sumaLista(rest(lista))\n}", "function sumNumbers(numberList){\n var sum = 0;\n for(i=0; i<numberList.length; i++){\n sum += numberList[i]\n }\n return sum\n}", "function sum(list) {\n var s=0;\n for (let i = 0; i < list.length; i++) {\n s = s+list[i];\n }\n return s;\n}", "function sumAllnumbers(numbersToSum) {\n let sum = 0;\n for (const i = 0; i < numbersToSum.length; i++) {\n sum += numbersToSum[i];\n }\n return sum;\n}", "function sumAll(arr) {\n return 1;\n}", "function sumAll(arr) {\n arr.sort((a, b) => { return a >= b ? 1 : -1 });\n const getSumAllNumbersInRange = (n1, n2) => {\n if (n1 === n2) return n1;\n return n1 + getSumAllNumbersInRange(n1 + 1, n2);\n }\n return getSumAllNumbersInRange(arr[0], arr[1]);\n}", "function listSum(num) {\n let total = 0;\n for (i = 0; i < num.length; i++) {\n total += num[i]\n }\n return total\n}", "function sumAll(...numbers) {\n return numbers.reduce((acc, cur) => acc + cur);\n}", "function sum (numbers) {\n \"use strict\";\n \n let sumOfElements = 0; \n numbers.forEach(element =>\n sumOfElements += element );\n return sumOfElements;\n \n}", "function sum(numbers) {\n\t//your code is here \n\treturn numbers.reduce((acc,item) => acc+item);\n\n}", "function sum(numbers) {\n var total = 0;\n for (var i = 0; i < numbers.length; i++) {\n total += numbers[i];\n }\n return total;\n }", "function sumAll(arr) {\r\n return arr.reduce((a, b) => {\r\n return a + b;\r\n });\r\n}", "function sumLists() {\n \n}", "function sum(list, summer) {\n return _.reduce(list, function(memo, val, index) {\n return memo + _.iteratee(summer)(val, index);\n }, 0);\n }", "function sumAll(...addElm){\n let result;\n for (i=0; i< addElm.length; i++) {\n result += addElm[i]\n }\n return result;\n}", "function sum(nums) {\n return nums.reduce(function(sum, curr) { return sum += curr });\n}", "function sum(numbers) {\n var sum = 0;\n numbers.forEach(function(number) {\n sum = sum + number;\n });\n return sum;\n}", "function sum(numbers) {\n\t//your code is here \n\treturn reduce(numbers,(acc,item) => acc+item);\n\n}", "function addAll(arr){\n let total = 0;\n arr.forEach(element => total += element)\n return total\n}", "function sum(numbers){\n return numbers.reduce((a,b) => a + b);\n }", "function sum(list){\n var l = arguments.length;\n var sum = 0;\n for (var i = 0; i < l; i++){\n sum = sum + arguments[i];\n }\n console.log(\"Exploring arguments in JavaScript------\");\n console.log(\"Sum: \", sum);\n}", "function sumAll(arr) {\n let sort = arr.sort((a, b) => a - b);\n let newArr = [];\n for (let i = sort[0]; i <= sort[1]; i++) {\n newArr.push(i);\n }\n return newArr.reduce((prev, curr) => prev + curr);\n}", "function sum(numbers) {\r\nvar total = 0;\r\nfor (var i = 0; i < numbers.length; i++) {\r\n total += numbers[i];\r\n}\r\nreturn total;\r\n}", "function sumAllDigits(numberList) {\n if (!Array.isArray(numberList) || numberList.length === 0) return 0;\n let sum = 0;\n // numberList.forEach((x) => {\n // for (let index = 0; index < x.toString().length; index++) {\n // sum += +x.toString()[index];\n // }\n // });\n return numberList.reduce((acc, x) => {\n for (let i = 0; i < x.toString().length; i++) {\n acc += +x.toString()[i];\n }\n return acc;\n }, 0);\n // return sum;\n}", "function sum(numbers) {\n return numbers.reduce(function(a,b) {\n return a + b\n });\n}", "function sumAll(a) {\n var c = 0\n for (var i = 0; i < a.length; i++) {\n var v = a[i];\n c += v\n }\n return c\n}", "function sumAll(arr) {\n var max = Math.max(arr[0], arr[1]);\n var min = Math.min(arr[0], arr[1]);\n var temp = 0;\n for(var i = min; i<= max; i++){\n temp += i;\n 6+4\n }\n return temp;\n }", "function sum(numbers) {\n var result = 0;\n numbers.forEach(function (num) {\n result += num;\n });\n return result;\n}", "function sumByAllElementsMultipliedByFour(numbers){\n //initialize sum\n var sum = 0;\n //iterate over number array using each()\n each(numbers, function(el){\n //sum equals the sum of all elements multiplied by 4\n sum += el * 4;\n });\n //return sum\n return sum;\n}", "function sumAll(arr) {\n var sum = 0;\n var max = arr.reduce(function (a, b) {return Math.max(a, b);});\n var min = arr.reduce(function (a, b) {return Math.min(a, b);});\n for (var x = min; x < max + 1; x++) {\n sum += x;\n }\n return sum;\n }", "function sumAll(array) {\n let sum = 0;\n // TODO: loop to add items\n\n for(i in array) { //logic failed with a for of loop, curious as to why\n sum += array[i];\n }\n\n return sum;\n}", "function sumNumbers() {\n let all = 0;\n for (let i = 0; i < arguments.length; ++i) {\n all += arguments[i];\n }\n return all;\n}", "function sumall(...args){\n sum =0;\n for(const arg of args){\n sum+=arg;\n }\n return sum;\n }", "function sumAll(n) { \n let result;\n\n if(n !== 1){\n result = n + sumAll(n-1);\n } else {\n result = n;\n }\n return result;\n }", "function sumAll(arr) {\n arr.sort((a,b) => a -b);\n var sum = arr[0];\n if(arr[0] == arr[1]){\n return sum;\n }else{\n sum++;\n return arr[0] + sumAll([arr[0]+1, arr[1]]);\n }\n}", "function numbersListSum(...numbers){\n var result = numbers.reduce((result, number) => {\n return result + number;\n },0);\n return result;\n}", "function sum(numbers) {\r\n //your code is here \r\n return reduce(numbers, function (result, num) {\r\n return result + num\r\n })\r\n}", "function sumOfAll(...params) {\n let sum = 0;\n for(let param of params){\n sum += param;\n }\n return sum;\n}", "function sumAll(arr) {\n\tlet total = 0;\n\t\n\t// establish the direction and set vars accordingly\n\tlet first = arr[0];\n\tlet last = arr[arr.length - 1];\n\t\n\tif (first === last) {\n\t\t// simple edge case\n\t\treturn first + last;\n\t}\n\telse if (first > last) {\n\t\t// we need to flip direction\n\t\tfirst = last;\n\t\tlast = arr[0];\n\t}\n\telse {\n\t\t\n\t}\n\t\n\t// accumulate total\n for (let i = first; i <= last; i++) {\n \ttotal += i;\n }\n \n return total;\n\n\t\n}", "function computeSum(numbers) {\n var sum = 0;\n numbers.forEach(function (number) {\n sum += number;\n });\n return sum;\n}", "function sumAll(arr) {\n var total = 0;\n if (arguments[0][0] < arguments[0][1]) {\n for (var i = arguments[0][0]; i <= arguments[0][1]; i++) {\n total += i;\n } \n }\n else {\n for (var x = arguments[0][1]; x <= arguments[0][0]; x++) {\n total += x;\n } \n }\n\n return total;\n}", "function sumArray(numbers) {\n let sum = 0;\n numbers.forEach(number => {\n sum += number;\n });\n return sum;\n //\n}", "function sumOfSums(arr) {\n var reducer = (sum, currentEl) => sum + currentEl;\n var newArrSum = 0;\n for (var i = 0; i < arr.length; i++) {\n var currentArr = arr.slice(0, i+1);\n newArrSum += currentArr.reduce(reducer);\n };\n return newArrSum;\n}", "function addAll(...numbers) {\n return numbers.reduce((accu, curr) => accu + curr); \n }", "function sum(numbers) {\n var summed = 0;\n\n for (i = 0; i < numbers.length; i++) {\n summed += numbers[i];\n }\n return summed;\n}", "function sumAll(arr) {\n let sum = 0;\n if (arr[0] <= arr[1]) {\n for (let i = arr[0]; i <= arr[1]; i++) {\n sum += i;\n }\n } else {\n for (let i = arr[1]; i <= arr[0]; i++) {\n sum += i;\n }\n }\n return sum;\n}", "function sumAll(arr) {\n let sortedArr = arr.sort((a, b) => a - b);\n let sum = 0;\n\n for (let i = sortedArr[0]; i <= sortedArr[1]; i++) {\n sum += i;\n }\n\n return sum;\n}", "function sumAll(arr) {\n const numbers = [];\n let indx = arr.sort((a, b) => a - b)[0];\n let extreme = arr.sort((a, b) => a - b)[1];\n while (indx < extreme - 1) {\n indx += 1;\n numbers.push(indx);\n }\n let result = arr.concat(numbers).reduce((a, b) => a + b);\n return result;\n}", "function sum (numbers) {\n var result = 0;\n\n for (var i = 0; i < numbers.length; i++) {\n\tresult = result + numbers[i];\n }\n return result;\n}", "function sum(numbers) {\n var sum = 0;\n for (var i = 0; i < numbers.length; i++)\n sum += numbers[i];\n\n return sum;\n}", "function sumAll(arr) {\n let arrSorted = arr.sort((a,b)=> a-b);\n let total = 0\n\n for(var i = (arrSorted[0]); i <= (arrSorted[arrSorted.length-1]); i++){\n total += i;\n }\n return total;\n \n}", "function sumAll(arr) {\n var sumTillLast = (arr[arr.length-1])*(arr[arr.length-1]+1) /2;\n var sumTillFirst = (arr[0])*(arr[0]+1) /2;\n if(arr[0] < arr[1]) {\n var sum = (sumTillLast-sumTillFirst)+arr[0]; \n } else {\n var sum = sumTillFirst - sumTillLast + arr[1];\n }\n return sum;\n}", "function sumAll(arr) {\n var max = Math.max(...arr);\n var min = Math.min(...arr);\n for (var i = min + 1; i < max; i++) {\n arr.push(i);\n }\n //return newArr;\n var sumResult = arr.reduce(function(a, b) {\n return a + b;\n });\n return sumResult;\n}", "function sumAll(arr) {\n var min = Math.min(arr[0], arr[1]); \n var max = Math.max(arr[0], arr[1]); \n var sum = 0;\n\n for (var i = min; i <= max; i++){\n \tsum += i;\n }\n\n return sum;\n}", "function sumOfAllNumbers(array) {\n var sum = 0;\n for (var i = 0; i < array.length; i++) {\n sum += array[i];\n }\n\n return sum;\n}", "function getSum(numbers){\n var sum =numbers[0];\n for( var i=0; i < numbers.length;i++ ){\n var element =numbers[i];\n sum = element + sum;\n\n }\n return sum\n\n}", "function sumAll(n) {\n if (n == 1) {\n return 1;\n } else {\n return n + sumAll(n - 1);\n }\n}", "function sum(array){\n\tlet somme = 0;\n\tarray.forEach( (element) => { somme+=element;})\n\treturn somme;\n}", "function total(numbers: Array<number>) {\n var result = 0;\n for (var i = 0; i < numbers.length; i++) {\n result += numbers[i];\n }\n return result;\n}", "function sum(numbers, runningTotal = 0) {\n if (numbers.length == 0) return runningTotal;\n return sum(numbers.slice(1), runningTotal + numbers[0]);\n}", "function addAll(...args) {\n return args.reduce((total, number) => total + number, 0);\n}", "function addAll() {\n var sum = 0;\n for (var i = 0; i < arguments.length; i++) {\n sum += arguments[i];\n }\n return sum;\n\n}", "function computeSumOfAllElements(arr) {\n var sumArray = 0;\n\n for (var i = 0; i < arr.length; i++) {\n sumArray += arr[i];\n }\n\n return sumArray;\n}", "function sumatoria(list) {\n if(longitud(list)==1) {\n return first(list);\n }else {\n return first(list) + sumatoria(rest(list));\n }\n}", "function sumAll(arr) {\n var max = Math.max(arr[0], arr[1]);\n var min = Math.min(arr[0], arr[1]);\n var temp = 0;\n for (var i = min; i <= max; i++) {\n temp += i;\n }\n return temp;\n}", "function sumAll(numbers){// gives name to function and assigns variable\n var x = 0; // created initial variable for start of sequence\n for(var i = 0; i < numbers.length; i++){//set initial value, condition and incrementation, treating numbers as an array\n var seq = numbers[i]; //create shorthand notation for numbers as an array which loop will loop through starting at pos 0\n x += seq; //x=x+sequence, mathmatical operation to be exectute in order to add numbers all together and return that value\n } return x; // provides result\n}", "function sum(numbers) {\n let sum = 0;\n for (i = 0; i < numbers.length; i++) {\n sum += numbers[i]\n }\n return sum\n}", "function sum() {\n return [...arguments].reduce((total, el) => {\n total += Number.isInteger(el) ? el : 0;\n return total;\n }, 0);\n}", "function sumAll(a,b,c) {\n return a+b+c;\n}", "function sumAll(arr) {\n let min = Math.min(...arr);\n let max = Math.max(...arr);\n let sum = 0;\n for (let i = min; i <= max; i++) {\n sum += i;\n } return sum;\n}", "function sum(x){\n\tlet total = 0;\n\tfor ( let i = 0; i < x.length; i++ ){\n\t\ttotal += x[i];\n\t} \n\treturn total;\n}", "function sumArray(arr){\n var total = 0;\n arr.forEach(function(element){\n total += elemtnl;\n });\n return total;\n}", "function sum_forEach(array) {\r\n var total = 0;\r\n array.forEach(function(item){\r\n total+= item\r\n });\r\n return total;\r\n}", "function sumAll(arr) {\n var min = Math.min(arr[0], arr[1]);\n var max = Math.max(arr[0], arr[1]);\n var answer = 0;\n for (var i = min; i <= max; i++){\n answer += i;\n }\n return answer;\n}", "function sumArray(array){\n var total = 0;\n array.forEach(function(element){\n total += element;\n });\n return total;\n}", "function getTotal(arrayOfNumbers) {\n \n var sum = arrayOfNumbers[0];\n \n for(var i=0; i<arrayOfNumbers.length; i++) {\n sum += arrayOfNumbers[i];\n console.log(\"the current sum is: \" + sum); \n }\n \n console.log(\"the total is: \" + sum);\n \n }", "function sumArray(array){\n\tvar total = 0;\n\tarray.forEach(function(element){\n\t\ttotal += element;\n\t\n\t});\n\treturn total;\n}", "function sumAll(arr) {\n let min = Math.min(...arr);\n let max = Math.max(...arr);\n let sum = 0;\n for(let i=min; i<max+1; i++){\n sum += i;\n }\n return sum;\n }", "function sum(numbers) {\n return numbers.reduce(function(a, b) {\n return parseInt(a) + parseInt(b)\n });\n}", "function sumAll(arr) {\n let fNum = Math.min(...arr);\n let lNum = Math.max(...arr);\n let n = lNum - fNum + 1;\n\n return (n / 2) * (fNum + lNum);\n}", "function addAll(limit){\n var sumAll = [];\n var sum = 0;\n for(var i = 0; i <= limit; i++){\n sumAll.push(i);\n }\n sum = sumAll.reduce(function(a,b){return a+b;});\n \n return sum;\n}", "function sumArr(nums) {\n // algorithm here\n}", "function sumAll( ) {\n let sum = 0\n for( i=0; i<loopyArray.length; i++) {\n sum +=loopyArray[i];\n }\n\n return sum; //why isn't this changing. loggin the top number? for loop not working...\n}", "function sumAll(x){\n\tvar count = 0; \n\tfor(i in x){\n\t\tcount+=x[i]; \n\t};\n\n\treturn count;\t\n}", "function sumArray(numbers) {\n let total = 0;\n\tfor (let i = 0; i < numbers.length; i++) {\n\t\ttotal += numbers[i];\n\t}\n\treturn total;\n}", "function sumAll(arr) {\n var max = Math.max(arr[0], arr[1]);\n var min = Math.min(arr[0], arr[1]);\n\n return (max + min) * (max - min + 1) / 2;\n}", "function sum(...numbers) {\n let newSum = 0;\n for (let item of numbers ){\n if (item > 0) {\n newSum += item;\n // newSum = newSum + item;\n } \n }\n console.log(newSum);\n}", "function sumOfSubset(index, sum) {\n if (index === numbers.length) {\n if (sum === S) {\n count[0]++;\n }\n return;\n }\n\n sumOfSubset(index + 1, sum + (+numbers[index]));\n sumOfSubset(index + 1, sum);\n}", "function getSumPairs(list, sum) {\n var result = [];\n var mi=0, Mi = list.length-1;\n while(mi<Mi) {\n var ts = list[mi] + list[Mi];\n if(sum == ts) {\n result.push([list[mi], list[Mi]])\n mi++; Mi--;\n } else if(ts < sum) {\n mi++;\n } else {\n Mi--;\n }\n }\n \n return result;\n}", "function addList() {\n var sum = 0\n for (i = 0; i < arguments.length; i++) {\n sum += arguments[i];\n }\n return sum;\n}", "function sum(numbers){\n \"use strict\";\n var amount = 0;\n for (var i = 0; i < numbers.length; i++) {\n amount = amount + numbers[i]\n }\n return amount;\n }", "function sum (numbers) {\n\treturn numbers.reduce(function(r,i) {\n\t\treturn r+i;\n\t},0);\n}", "function addAllB(...nums) {\n let sum = 0;\n nums.forEach(num => (sum += num));\n return sum;\n\n /* return nums.reduce((acc, curr) => acc + curr); */\n}", "function currentSum(sumlist) {\n var total=0;\n for (var i=0;i<sumlist.length;i++) {\n var entry = sumlist[i];\n if (entry.amt>0) {\n total += entry.amt;\n }\n }\n return total;\n}", "function sumAll(arr) {\n \n var min = Math.min(arr[0], arr[1]);\n var max = Math.max(arr[0], arr[1]);\n var total=0;\n \n for(var i = min; i<=max; i++){\n total += i;\n \n }\n \nreturn total;\n}", "function sum(numbers){\n\ttotal = 0\n\tfor (var i = 0; i < numbers.length ;i++){\n\t\t total = (numbers[i] += total);\n\t};\n\tconsole.log(total);\n}", "function sum (numbers) {\n \"use strict\";\n \n return numbers.reduce( \n (acumulator, initialValue) => acumulator + initialValue, 0\n )\n \n \n \n \n}" ]
[ "0.82270014", "0.762839", "0.754866", "0.73812145", "0.7321067", "0.7315798", "0.7231009", "0.72046065", "0.7128877", "0.70032007", "0.6956851", "0.6940685", "0.6890668", "0.6880845", "0.6864643", "0.6859363", "0.6858683", "0.6851558", "0.6838799", "0.68218637", "0.68062884", "0.6806008", "0.6796165", "0.6790062", "0.67856", "0.6773463", "0.6769736", "0.6753037", "0.67473555", "0.6746805", "0.67428035", "0.67416793", "0.6739531", "0.6733523", "0.67277527", "0.67276025", "0.67084575", "0.6708343", "0.66933656", "0.66605735", "0.6651329", "0.6638461", "0.66347253", "0.66310436", "0.66279316", "0.6622565", "0.6611637", "0.6608213", "0.66046864", "0.65760493", "0.65759015", "0.65666735", "0.6551005", "0.65409094", "0.6531811", "0.6530255", "0.65250623", "0.65181047", "0.6517462", "0.65170026", "0.65156305", "0.65073156", "0.6493766", "0.6490663", "0.648277", "0.6482379", "0.6481597", "0.64814013", "0.647536", "0.6472164", "0.6469264", "0.6463171", "0.6459972", "0.64549404", "0.6449549", "0.6449344", "0.64487946", "0.6448402", "0.64471453", "0.6439464", "0.6439347", "0.6433529", "0.6430007", "0.6424925", "0.6413992", "0.6404494", "0.6402319", "0.64012426", "0.6398618", "0.6397384", "0.63972574", "0.6392578", "0.63870794", "0.63854235", "0.6385335", "0.6376572", "0.6374941", "0.6371333", "0.6369878", "0.6367612" ]
0.82037854
1
multiplyAll:list>number Multiplica todos los elementos de una lista. S function multiplyAll(list) multiplyAll([1,2,3])>6 multiplyAll([0,1])>0 multiplyAll([1,1,5])>5
function multiplyAll(list) { if(length(list)==1) { return first(list); } else { return first(list) * multiplyAll(rest(list)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function multiplyAll() {\n var sum = 1;\n for (var i = 0; i < arguments.length; i++) {\n sum *= arguments[i];\n }\n return sum;\n\n}", "function multiplyNumbers(numberList){\n var multiplied = 1;\n for(i=0; i<numberList.length; i++){\n multiplied *= numberList[i]\n }\n return multiplied\n}", "function multiplyAll() {\n if (arguments.length === 0) {\n return 0\n }\n let total = 1;\n for (let i = 0; i < arguments.length; i++) {\n total *= arguments[i]\n }\n return total;\n}", "function mul (...all) {\n let newArr = all.filter(function(number){\n if (typeof number == \"number\"){\n return number;\t\t\n };\n });\n let res = 1;\n if (typeof newArr[0] == \"number\"){\n function mult (value) {\n return res *= value;\n };\n newArr.forEach(mult);\n return res;\n } else if (typeof newArr[0] != \"number\"){\n return res = 0;\n };\n}", "multiplyMany(...numbers) {\n\n }", "function multiplyAll(array) {\n var result = 1;\n for (var i = 0; i < array.length; i++) {\n result *= array[i];\n }\n return result;\n}", "function multiplyAll(arr) {\n var product = 1;\n for (var i = 0; i < arr.length; i++) {\n for (var k = 0; k < arr[i].length; k++) {\n product *= arr[i][k];\n }\n }\n return product;\n}", "function multiply(elements) {\n return elements.reduce((product, element) => {\n product *= element;\n return product;\n }, 1);\n}", "function multiplyAll(arr) {\r\n var product = 1;\r\n for (var i = 0; i < arr.length; i++) {\r\n for (var j = 0; j < arr[i].length; j++) {\r\n product = product * arr[i][j];\r\n }\r\n }\r\n return product;\r\n }", "function multiplyAll(arr){\n var product = 1;\n\n for(var i = 0; i < arr.length; i++){\n for(var j = 0; i < arr[i].length; j++){\n product *=arr[i][j];\n }\n }\n}", "function multiplyAll(arr) {\n var product = 1;\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product = product * arr[i][j];\n }\n }\n return product;\n}", "function multiplyAll(arr) {\n var product = 1;\n\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }\n }\n\n return product;\n}", "function multiply(numbers){\n return numbers.reduce((a,b) => a * b);\n}", "function product(numbers) {\n var result = 1;\n numbers.forEach(function (number) {\n result *= number;\n });\n return result;\n}", "function multiplyAll(arr){\n var product = 1;\n for (var i=0; i < arr.length; i++){\n for (var j=0; j < arr[i].length; j++){\n product *= arr[i][j];\n }\n }\n return product;\n}", "function multiplyAll(arr) {\n var product = 1;\n // Only change code below this line\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }\n }\n // Only change code above this line\n return product;\n}", "function multiplyAll(arr) {\n var product = 1;\n // Only change code below this line\n for (var i=0; i < arr.length; i++) {\n for (var j=0; j < arr[i].length; j++) {\n product *= arr[i][j];\n }}\n // Only change code above this line\n return product;\n}", "function multiplyAll(arr) {\n return function(num){\n return arr.map((el) => el * num)\n }\n}", "function multiplyAll(arr) {\n var product = 1;\n // Only change code below this line\n for (var i=0; i < arr.length; i++) {\n for (var j=0; j < arr[i].length; j++) {\n product = product * arr[i][j];\n }\n}\n // Only change code above this line\n return product;\n}", "function multiply(nums) {\r\n let m = 1;\r\n for (let i = 0 ; i < nums.length ; i++) {\r\n m *= nums[i];\r\n }\r\n return m;\r\n}", "function product(nums) {\n return nums.reduce(function(prod, curr) { return prod *= curr })\n}", "function multiply(arr) {\n let total=1;\n for(let i=0; i< arr.length; i++){\n total *= arr[i]\n }\n return total;\n \n}", "function multiplyArray(numbers) {\n return numbers.reduce((acc, curr) => {\n return acc * curr;\n })\n }", "multiply() {\n\t\treturn this.numbers.map((number) => number * this.mulitplyBy);\n\t}", "function productOfAll(seqOfNumb){\n //returns the product of multiplying all the numbers together\n var product = 1;// tried value of 0 and didn't work for some reason, not sure why\n for (let i = 0; i < seqOfNumb.length; i++) {\n product *= seqOfNumb[i];\n }\n return product;\n}", "function multiply (num) {\n let total = 1;\n for (let i=0; i< num.length; i++) {\n total *= num[i]\n } \n return total;\n}", "multiply() {\n this.result = arguments[0];\n\n for (let i = 0; i < arguments.length; i++) {\n this.result *= arguments[i];\n }\n return this.result;\n }", "function multiplyArray (array){ //function multipleArray return array \n let multiply = 1 //let multiply return value higher than 1\n for (i = 0; i <array.length; i++) { \n multiply *= array[i] // multiple each number in the index and provide the total\n }\n \n return (multiply) //return the total of each number in the index to multiply\n}", "function product( ...numbers ) {\n\n return numbers.reduce( ( acc, number ) => {\n return acc * number;\n }, 1 );\n}", "multiply(times) {\n\n }", "function multiply(multi,...args){\n\treturn args.map(arg => arg * multi)\n}", "function multiplies(arr){\n let result=1;\n for(i=0; i<arr.length; i++){\n result *=arr[i];\n }\n return result;\n }", "function product(xs){\r\n return foldl(unsafeMul, 1, xs);\r\n}", "function multiply(current, next) {\n return current * next;\n }", "multiply() {\n return this.numbers.map((multiplied) => this.multiplyBy * multiplied);\n }", "function mul() {\n var res = 1;\n var count = 0;\n for (var i = 0; i < arguments.length; i++){\n if (typeof(arguments[i])===\"number\"){\n res *=arguments[i];\n count++;\n }\n }\n if (count == 0) return 0;\n return res;\n}", "function multiply(arr) {\n result = 1;\n for (var i = 0; i < arr.length; i++) {\n result *= arr[i]\n }\n console.log(result)\n}", "function multiplyAll(array) {\n var total = array[0];\n //Cycle through the array from the beginning to the end\n for (var i = 0; i < array.length; i++){\n //check if index is a number\n if (!isNaN(array[i])){\n //add the element to the total\n total *= array[i];\n } else {\n //logs an alert\n console.log(\"Hey man, \\'\" + array[i] + \"\\' isn't a number!\");\n //skips the index in question.\n i++;\n }\n }\n //return the total\n return total;\n}", "function multiply(numbers, multiplier) {\n let multipliedNums = [];\n\n for (let idx = 0; idx < numbers.length; idx++) {\n multipliedNums.push(numbers[idx] * multiplier);\n }\n\n return multipliedNums;\n}", "function multiply(...args){\n return args.reduce((total,curVal)=>{\n return total*curVal; \n })\n}", "function multiply(multiplier, ...theArgs) {\n return theArgs.map((element) => {\n return multiplier * element;\n });\n}", "multiply() {\n return this.numbers.map((number) => number * this.multiplyBy);\n }", "function productArray(numbers){\n let result = []\n numbers.forEach((number, index) => {\n let res = 1;\n numbers.forEach((subNumber, subIndex) => {\n if(index !== subIndex) {\n res *= subNumber\n }\n })\n result.push(res)\n })\n return result\n }", "function doTest () {\nlet list = [17, 34, 12, 42, 58, 27, 21, 88, 14, 70];\nlet factor = 3; \ndocument.getElementById(\"array\").innerHTML = list.toString();\ndocument.getElementById(\"factor\").innerHTML = factor;\ndocument.getElementById(\"output\").innerHTML = multiply(list, factor);\n}", "multiply() {\n return this.nums.map((num) => num * this.multiplyBy);\n }", "function multiply(multiplier, ...theArgs) {\n return theArgs.map(function(element) {\n return multiplier * element;\n });\n}", "function multiply(arr, n) {\n var product = 1;\n for (var i = 0; i < n; i++) {\n product *= arr[i];\n }\n return product;\n }", "function multiply(multiplier, ...theArgs) {\n return theArgs.map(function (element) {\n return multiplier * element;\n });\n}", "function productEach(arr){\n let product = 1;\n arr.forEach(el => {\n product = product * el;\n })\n return product;\n}", "function multiply(a, b) {\n return [a[0] * b[0] + a[1] * b[3], a[0] * b[1] + a[1] * b[4], a[0] * b[2] + a[1] * b[5] + a[2], a[3] * b[0] + a[4] * b[3], a[3] * b[1] + a[4] * b[4], a[3] * b[2] + a[4] * b[5] + a[5]];\n}", "function multiple() {\n let result = 1;\n for (let i = 0; i < arguments.length; i++)\n\t\tresult *= arguments[i];\n return result;\n}", "function multiplyValues(array) {\n var result=1;\n for (let value of array) {\n result *= value;\n }\n return result;\n}", "function multiply(arr, n) {\n var product = 1;\n for (var i = 0; i < n; i++) {\n product *= arr[i];\n }\n return product;\n}", "function sc_multi() {\n var product = 1;\n for (var i = 0; i < arguments.length; i++)\n\tproduct *= arguments[i];\n return product;\n}", "function multiplyArray(arr) {\n let total=1;\n for (let i=0;i<arr.length;i++){\n total*=arr[i]\n }\n return total;\n }", "function multiply(arrayNum){\n var product = 1\n for (i=0; i<arrayNum.length; i++){\n product *= arrayNum[i];\n }\n return \"The product of your array is \" + product + \".\"\n}", "function multiply(multiplier, ...theArgs) {\n return theArgs.map(x => multiplier * x);\n}", "function multiply() {\n return Array.from( arguments ).reduce( ( a, b ) => {\n return ( +a * +b );\n }, 1 );\n}", "function product(arr) {\n let product = 1;\n if(arr.length === 0){\n product = 0;\n } else {\n arr.forEach( (el) => product *= el);\n }\n return product;\n}", "function multiply(a, b) {\n return [\n a[0] * b[0] + a[1] * b[3],\n a[0] * b[1] + a[1] * b[4],\n a[0] * b[2] + a[1] * b[5] + a[2],\n a[3] * b[0] + a[4] * b[3],\n a[3] * b[1] + a[4] * b[4],\n a[3] * b[2] + a[4] * b[5] + a[5]\n ];\n}", "function multiply(a, b) {\n return [\n a[0] * b[0] + a[1] * b[3],\n a[0] * b[1] + a[1] * b[4],\n a[0] * b[2] + a[1] * b[5] + a[2],\n a[3] * b[0] + a[4] * b[3],\n a[3] * b[1] + a[4] * b[4],\n a[3] * b[2] + a[4] * b[5] + a[5]\n ];\n}", "function multiply(numbers, multiplier) {\n let numbersClone = numbers.map(function(number) {\n return number * multiplier;\n });\n\n return numbersClone;\n}", "function multy2(...numbers) {\n console.log(numbers);\n console.log(\n numbers.reduce(function (value, curretValue) {\n return value * curretValue;\n })\n );\n}", "multiply(amount){\n if (amount === 0) this.elemList = [];\n if (amount === 1) return;\n for (var i=0; i<this.elemList.length; i++){\n this.elemList[i].amount *= amount;\n }\n\t}", "function multiplyList(array1, array2) {\n var i;\n var newArray = [];\n for (i = 0; i < array1.length; i++) {\n newArray.push(array1[i] * array2[i])\n }\n return newArray;\n}", "multiply() {\n var product = 1;\n // Extracting the number in the string\n if (typeof arguments[0] == \"string\") {\n if (arguments[0].match(/\\d+/)) {\n let slot_num = arguments[0].match(/\\d+/);\n slot_num = Number(slot_num);\n product = this.get_slot(slot_num) * arguments[1];\n return product;\n }\n }\n\n if (arguments[0] == \"LAST\") {\n product = arguments[1] * this.last();\n return product;\n }\n for (let i = 0; i < arguments.length; i++) {\n product = product * arguments[i];\n }\n this.lastNumber = product;\n return product;\n }", "function productOfOtherNumbers(arg){\n\n}", "multiply(){\n return this.numbers.map( (num) => this.multiplyBy * num);\n }", "function multiplyNums(a, b, c) {\n return c(a, b)\n }", "function multiply(myNumbers, number) {\n let result = [];\n\n for (let ind = 0; ind < myNumbers.length; ind += 1) {\n result.push(myNumbers[ind] * number);\n }\n\n return result;\n}", "function sumAndMultiply(numbers) {\n \tvar total = 0;\n \tvar total =1;\n \tfor (var i = 0; i < numbers.length; i++) {\n \t\ttotal += numbers[i];\n \t}\n \tfor (var i = 0; i < numbers.length; i++) {\n \t\ttotal1 = (total1 * numbers[i]);\n \t}\n \treturn \"sum = \" +total \": multiply\" + total1;\n\n }", "function productReduce(array) {\n return array.reduce((total, n) => { return total *= n});\n}", "function multiplyNumbers (firstNumber, secondNumber) {\n\treturn firstNumber * secondNumber;\n}", "function mul() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var acc = args[0];\n for (var i = 1; i < args.length; i++) {\n acc = _mul_two(acc, args[i]);\n }\n return acc;\n}", "function mul(firstNumber){\n return helperMul(firstNumber);\n}", "function product(arr) {\n var sum = 1;\n\n for (var i = 0; i < arr.length; i++) {\n sum *= arr[i];\n }\n\n return sum;\n}", "function multiplyNumbers(num1, num2) {\n return num1 * num2\n }", "function product(numbers){\n\n let total = numbers.reduce((a,b) => a * b);\n\n let answer = [];\n\n numbers.forEach(val => answer.push(total/val));\n\n return answer;\n\n}", "function multiply(multiplier, ...theArg){\n return theArg.map(num => multiplier * num);\n}", "function sumAndProductOfElementInAnArray(arrayOfElements){\n let element = 0\n let sum = 0;\n let product = 1\n while(element < arrayOfElements.length){\n sum += arrayOfElements[element]\n product*= arrayOfElements[element]\n element++;\n }\n return console.log(\"sum : \" + sum, \"product : \" +product)\n}", "function multiplyArguments() {\n\tif(arguments.length === 0)\n\t\treturn 0;\n\tif(arguments.length === 1)\n\t\treturn arguments[arguments.length - 1];\n\tvar product = 1;\n\tfor(var i = 0; i < arguments.length; i++){\n\t\tproduct *= arguments[i];\n\t}\n\treturn product;\n // use the arguments keyword to multiply all of the arguments together and return the product\n // if no arguments are passed in return 0\n // if one argument is passed in just return it\n}", "function productBy(array, f) {\n let total = 1;\n each(numbers, function(num) {\n total += f(total);\n });\n return total;\n}", "function multNums(a, b) {\n let product = a * b;\n return product\n}", "function multiplyList(arr1, arr2) {\n return arr1.map((num, index) => num * arr2[index]);\n}", "function multiply(input) {\n return input * 10;\n}", "function multiply(digits) {\n for (var i = 0; i < indices.length; ++i) {\n var product = 1;\n for (var j = 0; j < indices[i].length; ++j) {\n product = product * digits[indices[i][j]];\n }\n permutationProduct.push(product);\n }\n return product;\n}", "function magic_multiply(x, y){\n\n // For test 4 we need to check that we're not trying to multiple strings.\n if (typeof y === 'string'){\n console.log('Error: Cannot multiple by string');\n return undefined; // Should we return null or undefined.\n }\n\n // For test 5 we want to return a string, repeated 'y' times.\n if (typeof x === 'string'){\n return x.repeat(y);\n }\n\n // For test 3 we need to check if x is an array and multiple each of\n // it's elements by y\n console.log('typeof x', typeof x);\n if(Array.isArray(x)){\n console.log('x is array',x);\n for(let i=0; i<x.length; i++){\n x[i] *= y;\n }\n } else {\n x = x * y;\n }\n return x;\n}", "function multiplier(array) {\n\treturn array.reduce((acc, cur) => acc * cur);\n}", "multiply(a, b) {\n return a * b\n }", "function product(...arr) {\n\tvar numbers = [...arr];\n\tconsole.log(numbers);\n\treturn numbers.reduce(function (acc, number) {\n\t\treturn acc * number;\n\t}, 1);\n}", "function Multinum(numbers){\n this.numbers= 5;\n this.numbers= 6;\n this.numbers= numbers * numbers ;\n this.multiply= function(){\n return number * number;\n console.log(); \n }\n\n}", "function productOfArray(arr) {\n \n}", "function multiply(a, b, c) {\n return (a * b * c);\n}", "function multiplyProduct(x,y){\n let sum=0;\n\n for (let counter=0;counter<y; counter +=1){\n //sum=sum+x \n sum=addNum(sum,x); \n }\n return sum\n}", "function multiply(number1, number2) {\n return number1 * number2;\n}", "function multiply(number1, number2) {\n return number1 * number2;\n}", "multiply() {\n\n let result=1;\n let digit;\n \n for (let i = 0; i < arguments.length; i++) \n \n if(arguments[i]===\"LAST\"){\n result *= parseInt(this.last());\n }\n else \n if(arguments[i]!==\"LAST\"&&typeof(arguments[i])=='string'){\n \n digit = arguments[i].match(this.regex)\n result *= this.memory[parseInt(digit) - 1]\n \n \n }else{\n result *= arguments[i];\n \n }\n this.total = result;\n return parseInt(this.total);\n }", "function multiply(input) {\n return input * numTrials;\n }", "function multiply(input) {\n return input * numTrials;\n }", "function reduceProduct() {\n const product = numbers.reduce((acc, cur) => {\n return acc * cur\n })\n document.getElementById('reduced').innerHTML += ' ' + product\n}" ]
[ "0.78231555", "0.782297", "0.7758679", "0.77257574", "0.75517976", "0.7534918", "0.7376909", "0.7374298", "0.735744", "0.72968316", "0.7295184", "0.7283051", "0.7277243", "0.72751945", "0.7255816", "0.72471815", "0.7235147", "0.70945925", "0.7078581", "0.70738494", "0.69910425", "0.6934981", "0.69315207", "0.69117385", "0.6888129", "0.6883493", "0.68599015", "0.68551064", "0.68184495", "0.6809514", "0.67644525", "0.675456", "0.67302996", "0.6724615", "0.6716691", "0.66938865", "0.6689682", "0.66886324", "0.6686121", "0.6679249", "0.66595846", "0.6643207", "0.6635325", "0.6625187", "0.66137654", "0.6606113", "0.6590253", "0.6567958", "0.65644544", "0.6547421", "0.65471953", "0.654316", "0.6542812", "0.6509326", "0.65023917", "0.6481037", "0.6475501", "0.6465431", "0.6444451", "0.64283645", "0.64283645", "0.6411132", "0.6396007", "0.63863164", "0.638133", "0.6375989", "0.63759166", "0.6367838", "0.63533", "0.6349097", "0.63358235", "0.6324089", "0.6312483", "0.6301291", "0.63008386", "0.629518", "0.62770855", "0.6271987", "0.62416893", "0.6229045", "0.6221696", "0.6206301", "0.61931926", "0.6181629", "0.61808574", "0.61772984", "0.61708075", "0.6162538", "0.6158621", "0.6158539", "0.6149857", "0.6117724", "0.6115536", "0.6112187", "0.610959", "0.610959", "0.6108409", "0.6105116", "0.6105116", "0.6098235" ]
0.85972476
0
invert:list>list Invierte los elementos de una lista invert([1,2,3])>[3,2,1] invert([3,2,1])>[1,2,3]
function invert(list) { if(length(list)==0) { return []; } else { return cons(last(list),invert(pop(list))); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function invert(list) {\n if(length(list)==0) {\n return [];\n } else {\n return cons(last(list),invert(pop(list)));\n }\n}", "function invertir(list) {\n if(longitud(list)==0){\n return [];\n } else {\n return cons(last(list),invertir(pop(list)));\n }\n}", "function invertir(lista) {\n\tif (isEmpty(lista)) return lista\n\treturn appendMC(invertir(rest(lista)), first(lista))\n}", "function invertir(elementos) {\n var invertido = [];\n for (var posicion = 0, posicionInvertido = elementos.length - 1; posicion < elementos.length; posicion++, posicionInvertido--) {\n invertido[posicionInvertido] = elementos[posicion];\n }\n return invertido;\n}", "function invert(arr) {\n // container\n let invertedArr = [];\n for (let i = 0; i < arr.length; i++) {\n invertedArr.push(-arr[i]);\n }\n return invertedArr;\n }", "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;\n }\n return list;\n}", "function invert(array) {\n var newArr = [];\n for(var i = 0; i < array.length; i++){\n newArr.push(-array[i]);\n }\n return newArr;\n }", "function invert(array) {\n\t//return array.map((element) => (element === 0 ? element : -element));\n\treturn array.map((element) => -element);\n}", "function reverseList(list) {\n let reversed = [];\n for (let i = list.length - 1; i >= 0; i--) {\n reversed.push(list[i])\n }\n return reversed\n}", "function invert(array) {\n return array.map(num => num * -1)\n}", "function inverseMirror (array) {\n var inverseMirrorArray = [];\n for (var i = array.length - 1; i >=0; i--) {\n inverseMirrorArray.push(array[i]);\n }\n return inverseMirrorArray;\n }", "function reverseList(list) {\n let buf = [];\n\n for (let n = list; n != null; n = n.next) {\n buf.push(n.data);\n }\n\n return revArrayToList(buf);\n}", "function inverti_array(a){\n var array = new Array();\n //copio l'array in modo da non modificare i valori iniziali\n for(var i=0;i<a.length;i++){\n array[i] = copia_array(a[i])\n }\n for(var i=0;i<array.length/2;i++){\n var a_supp = array[i];\n array[i] = array[array.length-1-i];\n array[array.length-1-i] = a_supp;\n }\n return array;\n }", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "invert () {\n const queue = [this]\n let node\n for (let i = 0; i < queue.length; i++) {\n node = queue[i]\n if (node.plane) node.plane = plane.flip(plane.create(), node.plane)\n if (node.front) queue.push(node.front)\n if (node.back) queue.push(node.back)\n const temp = node.front\n node.front = node.back\n node.back = temp\n }\n }", "invert() {\n this.reverse = !this.reverse;\n this._applySpeed();\n }", "function invertirCicle(input) {\n\tvar ret = new Array;\n\tfor (var i = input.length - 1; i >= 0; i--) {\n\t\tret.push(input[i]);\n\t}\n\treturn ret;\n}", "function toggle_list(x, list) {\n var i = list.indexOf(x);\n var new_list = list.slice(0,list.length);\n if (i == -1) {\n new_list.push(x);\n }\n else {\n new_list.splice(i,1);\n }\n return new_list;\n }", "function reverseList (list) {\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner (list, reversedAlready) {\n if (!list) {\n return reversedAlready\n }\n\n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList)\n}", "function invert_copy(array) {\r\n let arr = []\r\n for (let i = array.length - 1; i >= 0; i--) {\r\n arr.push(array[i]);\r\n }\r\n return arr;\r\n}", "reverse() {\n let currentnode = this.head;\n let prevnode = null;\n let nextnode;\n //swap the head and tail\n [this.head, this.tail] = [this.tail, this.head]\n //loop the process, length of list times \n for (let i = 0; i < this.length; i++) {\n //set next-node to current-node's next \n nextnode = currentnode.next;\n //set current-node's next to previous node \n currentnode.next = prevnode;\n //set previous-node to current-node\n prevnode = currentnode;\n // set current node to nextnode\n currentnode = nextnode;\n }\n //return list\n return this\n }", "function inverti (wordToReverse) {\r\n var parolaInvertita = '';\r\n for (var i = wordToReverse.length - 1; i >= 0; i--) {\r\n parolaInvertita += wordToReverse[i];\r\n }\r\n return parolaInvertita;\r\n}", "function fun1(){\nvar arry=[\"abc\",\"def\",\"ghi\"];\ndocument.write(arry);\n\nvar new_arry=arry.reverse()\ndocument.write(\"<br>\");\ndocument.write(new_arry);\n}", "invert() {\n let rot_inv = this.getRotInv();\n let d = [[this.matrix[3][0]], [this.matrix[3][1]], [this.matrix[3][2]]];\n let d_new_neg = this.multV(Matrix.transpose(rot_inv).matrix, d);\n let r = rot_inv;\n r[0][3] = 0;\n r[1][3] = 0;\n r[2][3] = 0;\n r.push([0, 0, 0, 1]);\n r[3][0] = -d_new_neg[0][0];\n r[3][1] = -d_new_neg[1][0];\n r[3][2] = -d_new_neg[2][0];\n return r;\n }", "invert() {\n this.polygons.forEach(p => p.flip());\n this.plane.flip();\n if (this.front !== null) {\n this.front.invert();\n }\n if (this.back !== null) {\n this.back.invert();\n }\n let temp = this.front;\n this.front = this.back;\n this.back = temp;\n }", "function mirror(ary) {\r\n \r\n var len = ary.length\r\n var revAry = [];\r\n var mirror = [];\r\n\r\n\r\n for (var i = len - 1; i >= 0; i--) {\r\n revAry.push(ary[i]);\r\n }\r\n \r\n console.log(ary.concat(revAry)); \r\n\r\n}", "function reverseList(arr) {\n var length = Math.ceil(arr.length / 2);\n var temp;\n for (var i = 0; i < length; i++) {\n temp = arr[i];\n arr[i] = arr[arr.length - 1 - i];\n arr[arr.length - 1 - i] = temp;\n }\n return arr;\n}", "invert() {\r\n this.data = this.data.map(rows => rows.map(cols => cols*-1));\r\n }", "invert() {\n this.root.invert();\n this.inverted = !this.inverted;\n }", "invert() {\n this.addEffect(new Effects.Invert());\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseList(ll) {\n //need to create a variable to hold the previous\n let currNode = ll.head;\n let previous = null;\n //loop throuhg the arr\n while (currNode) {\n //create a variable to hold the next node \n let saveNode = currNode.next;\n //set node.next to previous\n currNode.next = previous;\n //set previous to node\n previous = currNode;\n //set node to save\n currNode = saveNode;\n }\n ll.head = previous;\n return ll;\n}", "reverse(){\n if(this.length < 1) return null;\n let node = this.head; // switches the head and tail\n this.head = this.tail;\n this.tail = node;\n let prev = null; // assigns prev to start as null\n let next;\n for(let i = 0; i < this.length; i++) {\n next = node.next; // updates next up to be the node.next, this is put at the start of the block, to prevent an extra loop\n node.next = prev; // redirects the next pointers to reverse the list.\n prev = node; // updates previous up to be the node\n node = next; // updates node up to be next\n }\n return list;\n }", "function invert(out, a) {\n\tconst a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t\ta10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t\ta20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t\ta30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\tb00 = a00 * a11 - a01 * a10,\n\t\tb01 = a00 * a12 - a02 * a10,\n\t\tb02 = a00 * a13 - a03 * a10,\n\t\tb03 = a01 * a12 - a02 * a11,\n\t\tb04 = a01 * a13 - a03 * a11,\n\t\tb05 = a02 * a13 - a03 * a12,\n\t\tb06 = a20 * a31 - a21 * a30,\n\t\tb07 = a20 * a32 - a22 * a30,\n\t\tb08 = a20 * a33 - a23 * a30,\n\t\tb09 = a21 * a32 - a22 * a31,\n\t\tb10 = a21 * a33 - a23 * a31,\n\t\tb11 = a22 * a33 - a23 * a32\n\n\t// Calculate the determinant.\n\tlet d = b00 * b11 -\n\t\tb01 * b10 +\n\t\tb02 * b09 +\n\t\tb03 * b08 -\n\t\tb04 * b07 +\n\t\tb05 * b06\n\n\tif (!d) {\n\t\treturn\n\t}\n\n\td = 1 / d\n\n\tout[0] = (a11 * b11 - a12 * b10 + a13 * b09) * d\n\tout[1] = (a02 * b10 - a01 * b11 - a03 * b09) * d\n\tout[2] = (a31 * b05 - a32 * b04 + a33 * b03) * d\n\tout[3] = (a22 * b04 - a21 * b05 - a23 * b03) * d\n\tout[4] = (a12 * b08 - a10 * b11 - a13 * b07) * d\n\tout[5] = (a00 * b11 - a02 * b08 + a03 * b07) * d\n\tout[6] = (a32 * b02 - a30 * b05 - a33 * b01) * d\n\tout[7] = (a20 * b05 - a22 * b02 + a23 * b01) * d\n\tout[8] = (a10 * b10 - a11 * b08 + a13 * b06) * d\n\tout[9] = (a01 * b08 - a00 * b10 - a03 * b06) * d\n\tout[10] = (a30 * b04 - a31 * b02 + a33 * b00) * d\n\tout[11] = (a21 * b02 - a20 * b04 - a23 * b00) * d\n\tout[12] = (a11 * b07 - a10 * b09 - a12 * b06) * d\n\tout[13] = (a00 * b09 - a01 * b07 + a02 * b06) * d\n\tout[14] = (a31 * b01 - a30 * b03 - a32 * b00) * d\n\tout[15] = (a20 * b03 - a21 * b01 + a22 * b00) * d\n}", "function inverseArray(array) {\n oldArray = array;\n newArray = [];\n for (i = array.length - 1; i >= 0; i--) {\n newArray.push(oldArray[i]);\n }\n return newArray;\n}", "function reverseV(x) {\r\n var y=[];\r\n var lt=x.length;\r\n for (igo = 0; igo < lt; igo++) {\r\n y[igo] = x[lt-igo-1];\r\n }\r\n return y;\r\n}", "function consumir_elemento(elemento) {\n console.log(\"[Consumidor] Elemento procesado (invertido): \" + elemento.split(\"\").reverse().join(\"\"));\n}", "function stream_reverse(xs) {\n function rev(original, reversed) {\n\tif (is_empty_list(original)) {\n\t return reversed;\n\t} else {\n\t return rev(stream_tail(original),\n\t\t pair(head(original), function() {return reversed;}));\n\t}\n }\n return rev(xs,[]);\n}", "function invertResults(results) {\n return results.reduce(function (acc, result) {\n return chainResult(function (arr) {\n return mapResult(function (value) {\n return arr.concat(value);\n })(result);\n })(acc);\n }, success([]));\n}", "function reverseList(lst) {\n let result = null;\n let stack = null;\n let current = lst.head;\n while(current) {\n stack.push(current)\n current = current.next;\n } \n // Set head to end of list.\n result = stack.pop() || [];\n current = result;\n \n while (current) {\n current.next = stack.pop();\n current = current.next;\n }\n\n return result;\n}", "function reverseInner (list, reversedAlready) {\n if (!list) {\n return reversedAlready\n }\n\n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverse(numbers) {\n let startIndex = 0;\n let lastIndex = numbers.length-1;\n\n while (startIndex < lastIndex){\n // swapping items here\n [numbers[startIndex], numbers[lastIndex]] = [numbers[lastIndex], numbers[startIndex]];\n startIndex+=1;\n lastIndex-=1;\n }\n\n return numbers;\n}", "function reverse(nums){\n let newArr = []\n nums.map(item => newArr.unshift(item))\n return newArr\n }", "function invertAllStrings(arr) {\n let reversed = [];\n for (let i = 0; i < arr.length; i++) {\n for (let j = arr[i].length - 1; j >= 0; j--) {\n reversed += arr[i][j];\n }\n }\n return reversed;\n}", "reverse(length) {\n for (let i = 0; i < length / 2; i += 1) {\n const p1 = (this.position + i) % this.list.length;\n const p2 = (this.position - i + length - 1) % this.list.length;\n [this.list[p1], this.list[p2]] = [this.list[p2], this.list[p1]];\n }\n }", "function SllReverse(list) {\n if (!list.head || !list.head.next) return list;\n\n let revNodes = [];\n let cur = list.head;\n\n while (cur) {\n revNodes.push(cur);\n cur = cur.next;\n }\n\n // instantiate new list and add the last node in the array as the head;\n let revList = new link.SLL();\n cur = revNodes.pop();\n revList.head = cur;\n\n\n // add the last node in the array to the end of the SLL (cur). Advance 'cur' to that node'. Reset that node's next value\n while (revNodes.length) {\n cur.next = revNodes.pop();\n cur = cur.next;\n cur.next = null;\n }\n revList.tail = cur;\n return revList;\n}", "function reverse(input) {}", "invert() {\n const sqlen = 1 / this.lenSqr();\n this[0] = -this[0] * sqlen;\n this[1] = -this[1] * sqlen;\n this[2] = -this[2] * sqlen;\n this[3] = this[3] * sqlen;\n this[4] = -this[4] * sqlen;\n this[5] = -this[5] * sqlen;\n this[6] = -this[6] * sqlen;\n this[7] = this[7] * sqlen;\n return this;\n }", "function eachReverse(e,t){if(e){var i;for(i=e.length-1;i>-1&&(!e[i]||!t(e[i],i,e));i-=1);}}", "function reverseMutate() {\n let newOnes = ones.slice().reverse();\n console.log(ones);\n console.log(newOnes);\n }", "reverse(){\n let original = this.iterator();\n let curr = this.head;\n let out = new LinkedList(); //empty\n\n while(curr != null){ //non empty\n out.addFront(new ListItem(curr.getData()));\n curr = curr.getNext();\n }\n\n return out;\n }", "function invArray(array) {\n\n\tif (Object.prototype.toString.call(array) == \"[object Number]\") {\n\t\tarray = String(array);\n\t}\n\n\tif (Object.prototype.toString.call(array) == \"[object String]\") {\n\t\tarray = array.split(\"\").map(Number);\n\t}\n\treturn array.reverse();\n\n}", "invert() {\n let result = new Matrix();\n result._matrix = ExtMath.inv(this._matrix);\n return result;\n }", "function reverseArrayInPlace(el){\n return [...el].map(el.pop, el); //? why the second arg?*\n }", "reverse() {\n //swap the head and tail\n //create a variable that will be what our current node is and initialize it to the head property\n let currentNode = this.head;\n //set the current head node to the tail\n this.head = this.tail\n //set the tail node equal to the current head\n this.tail = currentNode;\n //create a variable called next (node after the current node);\n let next;\n //create a variable called prev (node prior to the currentNode) --> initially will be null because there will be nothing prior to the first node (the tail);\n //it needs to be null so that tail.next is null \n let prev = null;\n\n //loop through the list\n for (let i = 0; i < this.length; i++) {\n //next will be set equal to whatever the currentNode's next property is (whatever the current node is pointing to at the moment)\n next = currentNode.next;\n //in order to reverse the direction that the the current node is pointing to, we need to set the current node's next property to equal the previous node (which initially will be null)\n currentNode.next = prev;\n //then shift the window over and set the previous node equal to the current node\n prev = currentNode;\n //then the currentNode now will become the next node\n currentNode = next;\n }\n //return the list;\n return this;\n }", "function list_transcribe(){\n\t\tfor(element in input.list){\n\t\t\tindex = 0\n\t\t\twhile(input.list[element] != alphabet[index]){\n\t\t\t\tindex += 1;\n\t\t\t}\n\t\t\tinput.transcribedsingle.push(index);\n\t\t}\n}", "function invertiParola(parola) {\n var parolaInversa = \"\";\n for (i = parola.length - 1; i >= 0; i--) {\n parolaInversa += parola[i];\n }\n return parolaInversa;\n\n}", "function reverse(list) {\n if(!list.head){\n return;\n }\n let current, reverse = list.head;\n let nextNode = current.next;\n if(current === list.head){\n current.next = null;\n reverse = null;\n }\n while(!current){\n current.next = reverse;\n reverse = current;\n current = nextNode;\n nextNode = nextNode.next;\n }\n}", "function fnInvertKeyValues( aIn )\n{\n\tvar aRet=[];\n\tfor ( var i=0, iLen=aIn.length ; i<iLen ; i++ )\n\t{\n\t\taRet[ aIn[i] ] = i;\n\t}\n\treturn aRet;\n}", "function fnInvertKeyValues( aIn )\n{\n\tvar aRet=[];\n\tfor ( var i=0, iLen=aIn.length ; i<iLen ; i++ )\n\t{\n\t\taRet[ aIn[i] ] = i;\n\t}\n\treturn aRet;\n}", "function fnInvertKeyValues( aIn )\n{\n\tvar aRet=[];\n\tfor ( var i=0, iLen=aIn.length ; i<iLen ; i++ )\n\t{\n\t\taRet[ aIn[i] ] = i;\n\t}\n\treturn aRet;\n}", "function inverse(m) {\n var k = 1 / (m[0] * m[4] - m[1] * m[3]);\n return [k * m[4], -k * m[1], k * (m[1] * m[5] - m[2] * m[4]), -k * m[3], k * m[0], k * (m[2] * m[3] - m[0] * m[5])];\n}", "function invertSet(set){\n\tvar arr = [];\n\tarr.push(['.']);\n\tvar i = 1;\n\tfor(i = 1; i<set.length; i++){\n\t\tvar y = 1;\n\t\tfor(y = 1; y<set.length; y++){\n\t\t\tif(i==set[y].charCodeAt(0)-64){ // found equal\n\t\t\t\t// append i to output\n\t\t\t\tarr.push(String.fromCharCode(y+64));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn arr;\n}", "function toggleInvert(x, i) {\n\treturn i * 1 - x * (i * 2 - 1);\n}", "invert() {\n let inverse = new Mapping();\n inverse.appendMappingInverted(this);\n return inverse;\n }", "function inverseArray(firstRow){\n return _.invert(firstRow);\n }", "function inverse(m) {\n var k = 1 / (m[0] * m[4] - m[1] * m[3]);\n return [\n k * m[4], -k * m[1], k * (m[1] * m[5] - m[2] * m[4]),\n -k * m[3], k * m[0], k * (m[2] * m[3] - m[0] * m[5])\n ];\n}", "function inverse(m) {\n var k = 1 / (m[0] * m[4] - m[1] * m[3]);\n return [\n k * m[4], -k * m[1], k * (m[1] * m[5] - m[2] * m[4]),\n -k * m[3], k * m[0], k * (m[2] * m[3] - m[0] * m[5])\n ];\n}", "reverse() {}", "invert() {\n this.transformType = 'inverted';\n for(var i = 0; i < this.colorTableBuffer.length; i++) {\n this.colorTableBuffer[i] = Math.floor(255 - this.colorTableBuffer[i]);\n }\n }", "reverse() {\n const { _coords } = this\n const numCoords = _coords.length\n const numVertices = numCoords / 2\n let tmp\n\n for (let i = 0; i < numVertices; i += 2) {\n tmp = _coords[i]\n _coords[i] = _coords[numCoords - i - 2]\n _coords[numCoords - i - 2] = tmp\n\n tmp = _coords[i + 1]\n _coords[i + 1] = _coords[numCoords - i - 1]\n _coords[numCoords - i - 1] = tmp\n }\n }", "function reverseI(linkedList) {\n\treturn linkedList;\n}", "reverseList() {\n let index = this.head;\n prevHolder = null;\n while (index != null) {\n prevHolder = index.prev;\n index.prev = index.next;\n index.next = prevHolder;\n index = index.prev;\n }\n\n return this;\n }", "reverseList() {\n if (this.head === null) {\n console.log('Empty list');\n return;\n }\n let previous = null;\n let current = this.head;\n while (current !== null) {\n const changer = current.next;\n current.next = previous;\n previous = current;\n current = changer;\n }\n this.head = previous;\n }" ]
[ "0.81242526", "0.7971842", "0.79231286", "0.70068747", "0.6762789", "0.66901475", "0.6658883", "0.6598854", "0.658907", "0.6394313", "0.6331753", "0.62577516", "0.62554884", "0.6230901", "0.61796653", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6166118", "0.6117604", "0.6018694", "0.6011213", "0.5903158", "0.58762145", "0.5868501", "0.5811448", "0.5810346", "0.58033663", "0.57904506", "0.5762866", "0.57492065", "0.5743657", "0.5734577", "0.5683925", "0.56588376", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5619956", "0.5613487", "0.55644923", "0.5558751", "0.5556213", "0.5516669", "0.5493767", "0.54837924", "0.5470584", "0.5465276", "0.5461424", "0.5461241", "0.5458602", "0.5452648", "0.5437212", "0.5428713", "0.54181445", "0.541612", "0.54154813", "0.5411398", "0.54056895", "0.54000366", "0.5395106", "0.5394367", "0.5393671", "0.5390681", "0.53894955", "0.53870356", "0.5384467", "0.5384467", "0.5384467", "0.53797406", "0.5374235", "0.53675014", "0.53662914", "0.5365753", "0.53352886", "0.53352886", "0.5333314", "0.5332914", "0.53077704", "0.5304971", "0.5297298", "0.52897894" ]
0.8094879
1
removeAllX:list,number>list Remueve todos los elementos X que se encuentre en una lista removeAllX([1,2,3],2)> [1,3] removeAllX([0,2,9,7,1,0], 9) > [0,2,7,1,0] removeAllX([1,1,2,2],2) > [1,1]
function removeAllX(list,x) { if(isEmpty(list)) { return []; } else if(first(list)==x) { return removeAllX(rest(list),x); } else { return cons(first(list),removeAllX(rest(list),x)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeAll() {\n for (const id of this.compareList.keys()) {\n this._removeItem(id);\n }\n }", "function removeFromArray(arr,x){\n\tfor (i=0 ; i<arr.length;i++){\n\t\tif(arr[i] == x){\n\t\tarr.splice(i,1);\n\t\ti = i-1;\n\t\t} \n\t}\n\treturn arr;\n}", "removeAllTodos() {\n let i = 0;\n this.todosArray.forEach(element => {\n let removal = document.getElementsByTagName('li')[i];\n removal.parentNode.removeChild(removal);\n this.activeTodo('Minus');\n });\n this.todosArray.splice(0, (this.todosArray.length));\n }", "function filter_list(l) {\n let nums = Array(1000).fill().map((e,i)=>i+1);\n nums.push(0);\n let result = [];\n for(let i=0; i<l.length; i++){\n if(nums.includes(l[i])){\n result.push(l[i])\n }\n }\n return result;\n}", "function removeAll (f, a) {\n\t var l = a.length\n\t var b = new Array(l)\n\t var j = 0\n\t for (var x, i = 0; i < l; ++i) {\n\t x = a[i]\n\t if (!f(x)) {\n\t b[j] = x\n\t ++j\n\t }\n\t }\n\t\n\t b.length = j\n\t return b\n\t}", "function removeAll (f, a) {\n var l = a.length\n var b = new Array(l)\n var j = 0\n for (var x, i = 0; i < l; ++i) {\n x = a[i]\n if (!f(x)) {\n b[j] = x\n ++j\n }\n }\n\n b.length = j\n return b\n}", "function remove_all(v, xs) {\n if (is_empty_list(xs)) {\n return [];\n } else {\n if (v === head(xs)) {\n return remove_all(v, tail(xs));\n } else {\n return pair(head(xs), remove_all(v, tail(xs)))\n }\n }\n}", "function removeAll(whichOnes){\n for (let q=0; q < whichOnes.length; q++){\n $(whichOnes[q]).remove();\n }\n}", "function removeFromList(x) {\n groceryList.splice(x, 1);\n}", "function removeAll(f, a) {\n var l = a.length;\n var b = new Array(l);\n var j = 0;\n for (var x, i = 0; i < l; ++i) {\n x = a[i];\n if (!f(x)) {\n b[j] = x;\n ++j;\n }\n }\n\n b.length = j;\n return b;\n}", "function removeAll(x, y){\n x = x.toString();\n return replaceAll(x, y , \"\");\n }", "function removeDuplicatedNumbers(numberList) {\n if (!Array.isArray(numberList) || numberList.length === 0) return [];\n const newArray = [];\n numberList.forEach((x) => {\n if (!newArray.includes(x)) newArray.push(x);\n else newArray.splice(newArray.indexOf(x), 1);\n });\n return newArray;\n}", "function intersect_lists(inputs)\n{\n // slice(0) copies the array\n var output = inputs[0].slice(0);\n \n for(var i = 1; i < inputs.length; i++)\n {\n for(var j = output.length - 1; j >= 0; j--)\n {\n // remove output elements not present in any of the other lists\n if(inputs[i].indexOf(output[j]) == -1)\n {\n output.splice(j, 1);\n }\n }\n }\n \n return output;\n}", "function dupRemove(list) {\n newList = []\n for(i = 0; i < list.length; i++) {\n inList = false\n checkValue = list[i]\n for(index = 0; index < newList.length; index++) {\n if(checkValue == newList[index]) {\n inList = true\n }\n }\n if (inList == false) {\n newList.push(checkValue)\n }\n }\n return newList\n}", "removeEmptyElements() {\n this.elements = this.elements.filter(({quantity}) => quantity > 0);\n }", "removeAllOfNumber(n) {\n let initialCount = this.bagList.length;\n this.bagList = this.bagList.filter(i => i !== n);\n return initialCount - this.bagList.length;\n }", "function removeItems(args){\n\t\tvar c = [];\n\t\t//Loop through all of the fullArray items for testing\n\t\tfor (var i = 0; i < args.length; i++) {\n\t\t\t//Check that items are not set for removal with \n\t\t\t//the indexOf parameter. indexOf allows us to filter non matched \n\t\t\t//array loop items. If destroyItems do not match the \n\t\t\t//fullArray loop items we push these clean accepted items to the\n\t\t\t//new array. Also negates having to use nested loops. \n\t\t\tif (destroyItems.indexOf(args[i]) === -1)\n\t\t\t{\n\t\t\t\t//Push all non matched items to a new returned array\n\t\t\t\tc.push(args[i]);\n\t\t\t} \n\t\t}\n\t\treturn c;\n\t} //checkItems Ends", "function removeAll(arr, item){\n\t var idx = indexOf(arr, item);\n\t while (idx !== -1) {\n\t arr.splice(idx, 1);\n\t idx = indexOf(arr, item, idx);\n\t }\n\t }", "function stream_remove_all(v, xs) {\n if (is_empty_list(xs)) {\n\treturn [];\n } else {\n\tif (v === head(xs)) {\n\t return stream_remove_all(v, stream_tail(xs));\n\t} else {\n\t return pair(head(xs),\n\t\t\tfunction() { return stream_remove_all(v, stream_tail(xs)); });\n\t}\n }\n}", "function uniqueItems(...param) { //libovolny pocet vstupu\r\n var result = new Set(); //Set zajisti jedinecne hodnoty\r\n param.forEach(inputArray => { //cyklus pro vsechny pole \r\n inputArray.forEach(item => { result.add(item) }); //cyklus pro vsechny prvky pole; vlozeni prvku do Set pomoci funkce add\r\n });\r\n return result;\r\n}", "function toggle_list(x, list) {\n var i = list.indexOf(x);\n var new_list = list.slice(0,list.length);\n if (i == -1) {\n new_list.push(x);\n }\n else {\n new_list.splice(i,1);\n }\n return new_list;\n }", "clearAllExcept (state, payload) {\n state.list = state.list.filter(data => data.row === payload.row && data.col === payload.col)\n }", "removeElements (elems, checkFunc) {\n // checkFunc returns true if an element is to be deleted\n super.removeElements (elems, checkFunc);\n }", "removeElements (elems, checkFunc) {\n // checkFunc returns true if an element is to be deleted\n super.removeElements (elems, checkFunc);\n }", "function removeListItems() {\n\t\t\tlet allListItems = document.querySelectorAll('li');\n\t\t\tfor (var i = 0; i < allListItems.length; i++) {\n\t\t weeklyList.removeChild(allListItems[i]);\n\t\t }\n\t\t}", "function removeElements (...elements) {\n for(let i = 0; i < elements.length; i++)\n removeElement(elements[i]);\n}", "removeAll(occupant, layer) {\n for (var x=0; x < this.width; x++) {\n for (var y=0; y < this.height; y++) {\n this.remove(occupant, x, y, layer)\n }\n }\n }", "function removeVariable (x,xs) {\n var index = xs.indexOf(x);\n if (index === -1) {\n\treturn xs;\n } else {\n\txs.splice(index,1);\n\treturn xs;\n }\n}", "function destroyer(arr) {\n var checkIn = [];\n for (var dummyIndex = 1; dummyIndex < arguments.length; dummyIndex++) \n checkIn.push(arguments[dummyIndex]);\n return arr.filter(function(x){return checkIn.indexOf(x) == -1});\n}", "function deleteAllCheck(deleteAll, checkBox, listItems){\n deleteAll.addEventListener('click', (e) =>{\n for (let i = 0; i < checkBox.length; i++) {\n if (checkBox[i].checked == true) {\n listItems[i].remove();\n remove(checkBox[i].getAttribute('data-id'));\n }\n }\n })\n}", "function x(e,t){for(;e.length>t;)delete M[e.shift()]}", "remove(num, arr) {\n let arr2 = [];\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] !== num) {\n arr2.push(arr[i]);\n }\n }\n return arr2;\n\n }", "function removeVals(arr,x,y) {\n for(var i = 0; i < arr.length - y - 1; i++){\n arr[i+x] = arr[i+y+1];\n }\n var numNeededToPop = y - x + 1; // numNeededToPop = 7 - 2 + 1 = 6\n for(var j =0; j < numNeededToPop; i++){\n arr.pop();\n }\n return arr;\n}", "remove(range) {\n // this.list.reduce((acc, [start, fin]) => {\n // if (range[0] < start && range[1] > fin) {\n // return acc;\n // }\n // // return acc;\n // }, []);\n this.list = this.list.reduce((acc, [start, end]) => {\n if (range[0] < start && range[1] > end) {\n return acc;\n }\n if (start < range[0] && range[1] < end) {\n acc.push([start, range[0] - 1]);\n acc.push([range[1] + 1, end]);\n } else if (range[0] <= start) {\n acc.push([range[1] + 1, end]);\n } else if (range[0] <= end) {\n acc.push([start, range[0] - 1]);\n } else {\n acc.push([start, end]);\n }\n return acc;\n }, []);\n }", "function clear(list){\n return list.splice(list,size(list));\n}", "function removeUnwanted(list) {\n var seq;\n var i = 0;\n var d = new Date();\n while (i<list.length) {\n seq = list[i];\n if (seq[0].timeStamp.getTime()+15000<d.getTime()) {\n seq[0].unwanted = true;\n }\n if (seq[0].unwanted) {\n // Remove the sequence\n list.splice(i,1);\n } else {\n // Next sequence\n i++;\n }\n }\n}", "function destroyer(arr) {\n var r = arguments[0];\n var x = [];\n\n for(var i = 1; i < arguments.length; i++) {\n x.push(arguments[i]);\n }\n\n return r.filter(\n function (z) {\n for (var i = 0; i <x.length; i++) {\n if (x[i] === z){\n return false;\n }\n }\n return true;\n }\n );\n}", "function removeNElements(startIndex, numRemove) {\n let newArr = [];\n let removedElements = [];\n if (startIndex < 0 || startIndex >= arr.length || numRemove < 1) {\n return []; // return empty array because of invalid parameter\n }\n for (let i=0,j=0; i<arr.length; i++) {\n if (i !== startIndex) {\n newArr[j] = arr[i];\n j++;\n } else {\n for (; i-j < numRemove; i++) {\n removedElements[i-j] = arr[i];\n }\n i--; // above loop increments one more time than needed, so decrement at end\n }\n }\n arr = newArr;\n return removedElements;\n}", "function removeDuplicates(x){\n for(i=0;i<x.length;i++){\n count=0\n for(j=0;j<noDuplicate.length;j++){\n if( noDuplicate[j] === x[i]){\n count++\n }\n\n }\n if ( count==0){\n noDuplicate.push(x[i])\n }\n }\n\n return noDuplicate;\n}", "removeAll () {\r\n const O = this;\r\n const optionList = O.E.find('option');\r\n\r\n for (let x = (optionList.length - 1); x >= 0; x--) {\r\n if (optionList[x].selected !== true) {\r\n O.remove(x);\r\n }\r\n }\r\n\r\n }", "function removeDouble(list) {\r\n var tmp = [];\r\n for(var i = 0; i < list.length; i++){\r\n if(tmp.indexOf(list[i]) == -1){\r\n tmp.push(list[i]);\r\n }\r\n }\r\n return tmp;\r\n }", "clean() {\n this.recentRemovedElements.clear();\n let validElementCount = 0;\n for (let i = 0; i < this.length; i += 1) {\n this.array[i].clean();\n if (this.array[i].isToBeRemoved) {\n this.recentRemovedElements.push(this.array[i]);\n continue;\n }\n this.array[validElementCount] = this.array[i];\n validElementCount += 1;\n }\n this.length = validElementCount;\n }", "clean() {\n this.recentRemovedElements.clear();\n let validElementCount = 0;\n for (let i = 0; i < this.length; i += 1) {\n this.array[i].clean();\n if (this.array[i].isToBeRemoved) {\n this.recentRemovedElements.push(this.array[i]);\n continue;\n }\n this.array[validElementCount] = this.array[i];\n validElementCount += 1;\n }\n this.length = validElementCount;\n }", "clean() {\n this.recentRemovedElements.clear();\n let validElementCount = 0;\n for (let i = 0; i < this.length; i += 1) {\n this.array[i].clean();\n if (this.array[i].isToBeRemoved) {\n this.recentRemovedElements.push(this.array[i]);\n continue;\n }\n this.array[validElementCount] = this.array[i];\n validElementCount += 1;\n }\n this.length = validElementCount;\n }", "function destroyer(arr) {\n let newArr = [];\n\n var args = Array.prototype.slice.call(arguments);\n args.splice(0, 1); // removes the 0 index only\n console.log(args);\n\n for (var i = 0; i < arr.length; i++){\n for(var j = 0; j < args.length; j++){\n if (arr[i] === args[j]){\n delete arr[i];\n }\n }\n }\n\n // need to use filter to remove empty items showing up in arr\n newArr = arr.filter(removeEmptyItems);\n\n console.log(newArr);\n return newArr;\n\n}", "function lista_minus_element(atrybut, tablica) {\n\treturn tablica.filter(function(element){\n\t\t\tif ( atrybut != element) return true;\n\t\t\telse return false;\n\t})\n\n}", "function destroyer(arr) {\n var args = Array.prototype.slice.call(arguments);\n for(var i = 0; i < arr.length; i++){\n for(var j = 0; j < args.length; j++){\n if(arr[i] === args[j]){\n delete arr[i];\n }\n }\n }\n \n return arr.filter(Boolean);\n \n }", "remove(...args) {\n let removedNodes = [];\n for (let current = this.#head.next; // head is dummy, skip it\n current != this.#tail; // tail is dummy, don't go past it\n current = current.next) {\n\n // Is current node in args?\n if (args.includes(current.value)) {\n let node = current;\n removedNodes.push(current.value);\n current = current.next;\n node.prev.next = node.next;\n node.next.prev = node.prev;\n this.#length--;\n }\n }\n\n return removedNodes;\n }", "function deleteElementFromArray(name, flag){\n for(let i=0; i<setOfLists.length && flag; i++){\n if(setOfLists[i].name==name){\n setOfLists.splice(i,1);\n flag=false;\n }\n }\n }", "function remove(v, xs){\n if (is_empty_list(xs)) {\n return [];\n } else {\n if (v === head(xs)) {\n return tail(xs);\n } else {\n return pair(head(xs), remove(v, tail(xs)));\n }\n }\n}", "removeFromSet(set) {\n for (let i = 0; i < set.length; i++)\n if (this.eq(set[i]))\n return set.slice(0, i).concat(set.slice(i + 1));\n return set;\n }", "function destroy(arr,...rest){\n return arr.filter(val => !rest.includes(val))\n}", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (\n var ancestor = node.parent;\n ancestor;\n ancestor = ancestor.parent\n ) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n }", "function BOT_delete(list,atom) {\r\n\tvar l = new Array();\r\n\tfor(i in list) {\r\n\t\tif(list[i] != atom) l = l.concat([list[i]]);\r\n\t}\r\n\treturn l;\r\n}", "arrayRemove(arr, value) {\n return arr.filter(function(ele){\n return ele != value;\n });\n }", "function removeSubstance() {\n var toRemove = document.getElementById('removesubstanceList').value;\n var tmpOp = [];\n var inputRemove = [];\n\n // tracks length of array that holds object of inputs\n var inputLength = inputs.length;\n\n for(var i = 0; i < substancelist.length; i++) {\n\n if(substancelist[i].VARIABLE_DECLARATION.NAME === toRemove) {\n substancelist.splice(i, 1);\n substances.splice(i, 1);\n }\n }\n\n if (operationList.length != 0) {\n\n for (j = 0; j < inputLength; j++) {\n\n // tracks length of operations in use\n var opLength = operationList.length;\n\n // checks if the input name and substance to be removed match\n if (inputs[j].NAME.indexOf(toRemove) != -1) {\n\n // grabs the id of the input to be removed\n var tmpId = inputs[j].ID;\n\n for (k = 0; k < opLength; k++) {\n\n // check if the operation ID and the input to be removed id match\n if (operationList[k].OPERATION.ID === tmpId) {\n\n //inputRemove.push(j);\n inputRemove = getAllIndexes(inputs, tmpId);\n\n if (inputs[j].OUTPUT != null) {\n var output = inputs[j].OUTPUT;\n var tmpOut = checkOutputs(k, output, opLength);\n }\n tmpOp.push(k);\n }\n }\n }\n }\n\n // combines and filters out doubles of indices\n var opRemove = tmpOp.concat(tmpOut.filter(function (item) {return tmpOp.indexOf(item) < 0}));\n\n\n // removes in reverse order the indices of the operations using the substance to be removed\n for (var j = opRemove.length - 1; j >= 0; j--) {\n\n operationList.splice(opRemove[j], 1);\n }\n\n // removes in reverse order the indices of the inputs tied to operations using the substance to be removed\n for (j = inputRemove.length - 1; j >= 0; j--) {\n\n inputs.splice(inputRemove[j], 1);\n }\n }\n //console.log(inputRemove);\n //alert(JSON.stringify(inputRemove));\n //console.log(inputs);\n}", "function filter_list(l) {\n return l.reduce((a, b) => { if (typeof b === 'number') a.push(b); return a; }, []);\n}", "function uniqueArray(numberList) {\n if (!Array.isArray(numberList) || numberList.length === 0) return [];\n\n const newArray = [];\n numberList.forEach((x) => !newArray.includes(x) && newArray.push(x));\n return newArray;\n}", "function remDups(arrArg) {\n return arrArg.filter(function(elem, pos,arr) {\n return arr.indexOf(elem) == pos;\n });\n}", "function removeFromList(i, L, R) {\n\t R[L[i]] = R[i];\n\t L[R[i]] = L[i];\n\t R[i] = i;\n\t L[i] = i;\n\t }", "function removeSubsets$1(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "function destroyer(arr) {\n return [].slice.call(arguments, 1).reduce(function(arr, num) {\n return arr.filter(function(item) {\n return num !== item;\n });\n }, arr);\n}", "function removeChocolates(number){\n var choco_removed = []\n for (let i = 0; i < number; i++) {\n choco_removed[i]=chocolates.shift(); \n }\n return choco_removed;\n}", "function destroyer(arr) {\n // var args = Array.prototype.slice.call(arguments);\n var args = [...arguments]\n args.splice(0,1)\n for (var i = 0; i < arr.length; i++) {\n for (var j = 0; j < args.length; j++) {\n if (arr[i] === args[j]) {\n delete arr[i];\n }\n }\n }\n return arr.filter(ele=>(ele));\n }", "function removeSubsets(nodes) {\n let idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n const node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "removeAll() {\r\n\t\t\tthis.remove();\r\n\t\t}", "function without (list, test, removedFn) {\n return withoutInner(list, removedFn || __WEBPACK_IMPORTED_MODULE_0__functional__[\"i\" /* noop */])\n\n function withoutInner (subList, removedFn) {\n return subList\n ? (test(head(subList))\n ? (removedFn(head(subList)), tail(subList))\n : cons(head(subList), withoutInner(tail(subList), removedFn))\n )\n : emptyList\n }\n}", "function dropRepeats(xs) {\n return dropIf(function(x) {\n return xs.value === x\n }, xs.value, xs)\n}", "function destroyer(arr) {\n // Remove all the values\n var newArr = [];\n for(var i =1; i < arguments.length; i++) {\n newArr.push(arguments[i]);\n }\n return (arr.filter(el => newArr.indexOf(el) === -1 ));\n\n // return arr;\n}", "function arrayRemove(arr1, arr2) {\n return arr1.filter(ele1 => {\n return ele1 != arr2.filter(ele2 => {\n return ele2 == ele1;\n });\n });\n}", "function borrarList(){\n var li = document.getElementsByTagName(\"li\");\n var hijo;\n for(var aux = (li.length-1) ; aux > -1 ; aux--){\n for(var help = (li[aux].childNodes.length - 1) ; help > -1 ; help--){\n hijo = li[aux].childNodes[help];\n li[aux].removeChild(hijo);\n }\n li[aux].parentNode.removeChild(li[aux]);\n }\n}", "function destroyer(arr) {\n\n var args = [].slice.call(arguments);\n args.shift();\n\n arr = arr.filter(function (item) {\n\n for (var i = 0; i < args.length; i++) {\n if (item == args[i]) {\n return false;\n }\n }\n return true;\n\n });\n // Remove all the values\n return arr;\n}", "function removeElementsFromArray(array, elements) {\n for (var i in elements) {\n var element = elements[i];\n var index = array.indexOf(element);\n if (index > -1) {\n array.splice(index, 1);\n }\n }\n\n return array;\n }", "removeOptions() {\n for (let i=0; i<N; i++) {\n for (let j=0; j<N; j++) {\n if (this.state[i][j] == X) {\n this.removeCellOptionsByRow(i, j);\n this.removeCellOptionsByColumn(i, j);\n this.removeCellOptionsByBlock(i, j);\n }\n }\n }\n }", "clearList() {\n const items = this.root.querySelectorAll('.list-item');\n items.forEach((item) => {\n item.remove();\n });\n }", "function removeFruits(fruits, fruitsToRemove) {\n // FILL THIS IN\n for ( var i = 0; i < fruitsToRemove.length; i++ ) {\n for ( var j = fruits.length; j > -1; j-- ) {\n if ( fruits[j] == fruitsToRemove[i] ) { fruits.splice(j, 1); }\n }\n }\n return fruits;\n }", "function clearAll(){\n countProducts = 0;\n countSubstrates = 0;\n checkedSubsNames = [];\n checkedProdsNames = [];\n checkedEnzsNames = []\n\n for(var i = 0; i < substrates.length; i++){\n if(substrates[i].checked){\n substrates[i].checked = false\n }\n }\n for(var j = 0; j < enzymes.length; j++){\n if(enzymes[j].checked){\n enzymes[j].checked = false\n }\n }\n for(var k = 0; k < products.length; k++){\n if(products[k].checked){\n products[k].checked = false\n }\n }\n}", "function destroyer(arr) {\n let args = [];\n for (let i = 1; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n // console.log(args)\n return arr.filter(item => !args.includes(item));\n}", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n\n return nodes;\n}", "function onFilterListRemoveAll(e) {\r\n var id = 'exclusion_filter_list';\r\n if (e.target.id.indexOf('inclusion') == 0) {\r\n id = 'inclusion_filter_list';\r\n }\r\n var list = $(id);\r\n while (list.length != 0) {\r\n list.remove();\r\n }\r\n}", "removeValueArray(array, element) {\n array = array.filter(e => e !== element);\n return array;\n }", "function removeElement(list,elem){\n elem = parseInt(elem);\n if(isEmpty(list)){ \n throw \"La lista está vacía\";\n }\n console.log(\"valor del elemento a borrar \" + list.includes(elem));\n if(!list.includes(elem)){\n throw \"el valor no esta en la lista\";\n }\n //recogemos el valor del indice de la 1º coincidencia\n var index = list.indexOf(elem);\n //guardamos el elemento que vamos a borrar\n var deleted = list[index];\n //borramos el elemento\n list.splice(index,1,);\n //devolvemos el elemento borrado\n return deleted;\n}", "function remove (lista) {\n lista.shift();\n return lista;\n}", "function complement(master, remove) {\n var markToRemove = Array(master.length); //don't have to initialize array values, since we will only check for positive correlation later, not either value\n for (var i = 0; i < remove.length; ++i) {\n var found = 0;\n while ((found = master.indexOf(remove[i], found)) !== -1) {\n markToRemove[found] = true;\n found++;\n }\n }\n //console.log(\"markToRemove:\" + markToRemove);\n var reduced = [];\n for (i = 0; i < markToRemove.length; ++i) {\n if (!markToRemove[i]) {\n reduced.push(master[i]);\n }\n }\n return reduced;\n}", "function clearBoats() {\n for (var x = 0; x < boats_to_remove.length; x++) {\n var remove_id = boats_to_remove[x];\n for (var i = 0; i < boats.length; i++) {\n if (boats[i].id == remove_id) {\n boats.splice(i, 1);\n break;\n }\n }\n }\n boats_to_remove = new Array();\n}", "function deleteAllCompletedTodos() {\nlet allLis = document.getElementsByTagName(\"li\");\n for (let i = 0; i < allLis.length; i++) {\n if (allLis[i].classList.contains(\"apply-line-through\")) {\n let removedItem = { task: `${allLis[i].value}`, completed: `${todos[i].completed}` }\n let index = todos.indexOf(removedItem)\n todos.splice(index, 1)\n allLis[i].remove();\n return todos;\n }\n }\n \n}", "function dropElements(arr, func) {\n // Creating args variable from arguments object\n var args = [...arguments];\n // Setting - array of numbers to be checked - equal to first element of args array\n var numArray = args[0];\n /* untiTrue returns passed array with values dropped from front - that return false from \n function from arguments (args[1]) - until an element returns true*/\n function untilTrue(array) {\n // While first element of array returns false from args[1] -- remove first element\n while (!args[1](array[0])) {\n array.shift();\n }\n // return array with removed elements array[0] now returns true for args[1]\n return array;\n }\n \n console.log(untilTrue(numArray));\n }", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "function removeSubsets(nodes) {\n var idx = nodes.length;\n /*\n * Check if each node (or one of its ancestors) is already contained in the\n * array.\n */\n while (--idx >= 0) {\n var node = nodes[idx];\n /*\n * Remove the node if it is not unique.\n * We are going through the array from the end, so we only\n * have to check nodes that preceed the node under consideration in the array.\n */\n if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {\n nodes.splice(idx, 1);\n continue;\n }\n for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {\n if (nodes.includes(ancestor)) {\n nodes.splice(idx, 1);\n break;\n }\n }\n }\n return nodes;\n}", "function removeElement(nums, val) {\n let i = 0\n let newSize = nums.length\n while (i < newSize){\n if (nums[i] == val)\n nums[i] = nums[--newSize]\n else\n i++\n }\n return newSize\n}", "delete(element) {\n this.arraySet = this.arraySet.filter(el => el !== element);\n }", "function unique(list) {\n var result = [];\n $.each(list, function(i, e42){\n if($.inArray(e42, result) === -1) result.push(e42);\n });\n return result;\n}", "function removerTodosInimigos(){\n\tinimigos.forEach(removeInimigo);\n}", "function stream_remove(v, xs){\n if (is_empty_list(xs)) {\n\treturn [];\n } else {\n\tif (v === head(xs)) {\n\t return stream_tail(xs);\n\t} else {\n\t return pair(head(xs),\n\t\t\tfunction() { return stream_remove(v, stream_tail(xs)); });\n\t}\n }\n}", "function destroy(arr){\n let newArr = Array.from(arguments).slice(1);\n return arr.filter(a => !newArr.includes(a));\n}", "function remove(array,element){\n return array.filter(e =>e !== element)\n}", "removeAll() {\n this._removeAll();\n }" ]
[ "0.59380233", "0.5930293", "0.58921117", "0.58920383", "0.58703995", "0.58417416", "0.5831137", "0.5807421", "0.58052415", "0.5764462", "0.5756017", "0.5698798", "0.5691397", "0.566131", "0.5653099", "0.56518567", "0.5647349", "0.563539", "0.55682", "0.5566958", "0.5561746", "0.5555319", "0.55517876", "0.55517876", "0.5549916", "0.554717", "0.54957587", "0.54731894", "0.5469443", "0.5460255", "0.54558146", "0.54483443", "0.5424796", "0.54123896", "0.54074967", "0.54023784", "0.5390916", "0.5369939", "0.53610474", "0.5357919", "0.53526527", "0.5345281", "0.5345281", "0.5345281", "0.53299135", "0.5323029", "0.5322599", "0.53203547", "0.5320244", "0.53042847", "0.5303931", "0.5303819", "0.52980137", "0.52924764", "0.52503633", "0.5249508", "0.52478415", "0.52465713", "0.52461296", "0.5243649", "0.5236262", "0.52238214", "0.52136946", "0.52025473", "0.5201072", "0.51942056", "0.51865554", "0.5176577", "0.5175563", "0.5174199", "0.5170608", "0.5169476", "0.5168846", "0.5162455", "0.51582617", "0.5157299", "0.5153449", "0.51469374", "0.5144927", "0.5141395", "0.5140443", "0.5129859", "0.5129125", "0.51250315", "0.51221734", "0.5121199", "0.5120832", "0.51199716", "0.51199716", "0.51199716", "0.51199716", "0.51199716", "0.51076794", "0.5097726", "0.5095988", "0.5095208", "0.5091391", "0.50874585", "0.5084392", "0.5083565" ]
0.8037523
0
Concatene dos listas /append:list,list>list Concatena dos listas, en el orden en que cada una tiene sus elementos append([1,2,3],[4,5,6])>[1,2,3,4,5,6] append([2,1],[0,0])>[2,1,0,0] append([],[1,2,3])>[1,2,3] append([1,2],[])>[1,2]
function append(list1,list2) { if(isEmpty(list1)){ return list2; } else { return cons(first(list1),append(rest(list1),list2)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function concat(list1, list2)\n{\n// concatenate 2 arrays\n\n// build a 3rd array which is the result of the 2 lists ,\n// only add items to the list if the starget ource array is not empty\n var list3 = []; // initialize the array\n if (list1.length >0){ // only add from list1 if its not empty\n for (var i =0; i < list1.length;i++)\n list3.push(list1[i]);\n }\n if (list2.length > 0) {\n for (var i =0; i < list2.length;i++)\n list3.push(list2[i]);\n }\n // console.log(\" Final State of list3: \" + list3 +\" \\n\");\n return list3;\n}", "function concat(lista1, lista2) {\n\tif (isEmpty(lista1)) return lista2;\n\treturn cons(first(lista1), concat(rest(lista1), lista2));\n}", "function joinLists(list1, list2, list3, list4) {\n\tvar newList = list1.concat(list2, list3, list4);\n\treturn newList;\n}", "function list(head,tail){return[head].concat(tail);}", "function append(list1,list2) {\n if(isEmpty(list1)){\n return list2;\n } else {\n return cons(first(list1),append(rest(list1),list2));\n }\n}", "function joinNodeLists() {\n\n\tif (!arguments.length) {\n\t\treturn;\n\t}\n\t\n\tvar newList = [];\n\tfor (var i = 0; i < arguments.length; i++) {\n\t\tvar list = arguments[i];\n\t\tfor (var j = 0; j < list.length; j++) {\n\t\t\t// Don't use push() for IE 5 compatibility\n\t\t\t// newList.push(list[j]);\n\t\t\tnewList[newList.length] = list[j];\n\t\t}\n\t}\n\t\n\treturn newList;\n}", "append(...elements) {\n this.elements = this.elements.concat(flatten(elements));\n }", "append(...append) {\n return this.forEach((el => recursiveAppend(el, ...append))), this;\n }", "function combineArr() {\n let concatArr = [];\n for (item of arguments) {\n console.log(item)\n concatArr = concatArr.concat(item);\n }\n\n console.log(concatArr)\n}", "function concatMe(tempArr,tempArr2){\r\n return tempArr.concat(tempArr2);\r\n\r\n }", "function appendListToString(string,list)\n{\n for (var i = 0; i < list.length; i++)\n\tstring += list[i];\n return string;\n}", "function combine_lists(code, description, list1, list2){\n x = [];\n for (i = 0; i < list1.length; i++) {\n \n x.push(code, \"?\", description, \"?\", list1[i], \"?\", list2[i], \"\\n\");\n }\n return(x);\n}", "function b_listConcat(la, lb) {\n\n /* Annotation */ isNullableObject(la);\n if (la === null) return lb;\n\n /* Annotation */ isNullableObject(lb);\n if (lb === null) return la;\n\n /* Annotation */ isNullableObject(la.next);\n if (la.next === null) { la.next = lb; lb.prev = la; return la }\n\n la.next = b_listConcat(la.next, lb);\n return la\n}", "concatElements(elementos){\n \tfor(let i in elementos){\n \t\tthis.concatElement(elementos[i]);\n \t}\n }", "function appendListOperands(ops, args) {\n let first = true;\n for (const op of ops) {\n if (first) first = false;\n else appendSql(\",\", args);\n args.push(op.value);\n args[0].push(\"\");\n }\n}", "function joinArrays(...args) {\n //return args.reduce((prev, curr) => prev.concat(curr), []);\n return [].concat(...args);\n\n}", "function append (items) {\n\n\t\tif (Array.isArray(items)) return push(items);\n\n\t\treturn push([items]);\n\n\t}", "function concatArray(array1=[]){\n if(array1==null)\n return null;\n var string=\"\";\n for(var i=0;i<array1.length;i++){\n //string+=array1[i];\n if(arguments!=null)\n for(var j=0;j<arguments.length;j++)\n {\n if(arguments[j][i]!=null){\n string+=arguments[j][i];\n }\n }\n }\n return string;\n}", "function concatenateArrays() {\n\tconst arr1 = [0, 1, 2, 3];\n\tconst arr2 = [4, 5, 6];\n\tconst arr3 = [7, 8, 9];\n\tconst result = [...arr1, ...arr2, ...arr3];\n\treturn result;\n}", "function list (head, tail) {\n return [head].concat(tail);\n }", "function concatMany(arr){\r\n let result = [];\r\n arr.forEach((el)=> {\r\n if(Array.isArray(el)){\r\n result = result.concat(concatMany(el));\r\n return;\r\n }result.push(el);\r\n });\r\n return result;\r\n }", "function concat(xss){\r\n return foldr(append, [], xss);\r\n}", "function sumLists(list1, list2){\n let arr1 = [], arr2 = [];\n\n while (list1 != null || list2 != null){\n if(list1) {\n arr1.unshift(list1.value)\n list1 = list1.next;\n }\n if(list2) {\n arr2.unshift(list2.value)\n list2 = list2.next;\n }\n }\n\n const resultArray = (parseInt(arr1.join('')) + parseInt(arr2.join(''))).toString().split('');\n\n const result = resultArray.reverse().map((el, idx) => {\n if(idx != resultArray.length-1){\n return el + '->';\n }else {\n return el;\n }\n }).join('');\n \n return result;\n}", "concat(...items) {\n for (let a of items)\n if (a)\n for (let e of a)\n this.push(e);\n return this;\n }", "function concatAll() {\n return args(arguments).reduce(function (a, b) {\n return a.concat(b);\n }, []);\n }", "function join(list, ...separator) {\r\n var resultStr = \"\";\r\n var arrOfStrCombinedWithSeparator = [];\r\n\r\n var copyOfSeparators = [...separator];\r\n if (copyOfSeparators.length === 0) {\r\n list.forEach(function concatStrValue(eachValue) {\r\n var strForm = String(eachValue);\r\n resultStr = resultStr + strForm;\r\n // resultStr.concat(strForm);\r\n });\r\n // each(list, );\r\n let result = list.reduce(function concatStrValue(buildingUp, currentValue) {\r\n var strForm = String(currentValue);\r\n buildingUp = buildingUp + strForm;\r\n return buildingUp;\r\n }, \"\");\r\n return result;\r\n } else {\r\n /***** recursive approach *****/\r\n alert(\"worked!\");\r\n joinRecursive(list, copyOfSeparators);\r\n function joinRecursive(list, arrOfSeparators) {\r\n var result = [];\r\n /* have a copy of the list array outside the scope of the innerRecursive func. \r\n when we had the copy of the list array in innerRecursive, when we remove from the end it mutated the original list too\r\n when we call innerRecursive we want to pass in the original list array with nothing removed\r\n */\r\n // var copyOfList = [...list];\r\n /* find a way to make this work without mutating the array */\r\n // var notMutated = list.slice();\r\n // var mutateThisList = [...list];\r\n innerRecursive(arrOfSeparators);\r\n /***** what if we just passed the original array to secondInnerRecur *****/\r\n function innerRecursive(arrOfSeparators) {\r\n //work with copy of original passed in list\r\n // var copyOfList = innerList.slice();\r\n // var copyOfList = [...list];\r\n // var copyOfList = [].concat(list);\r\n var copyOfList = list.slice();\r\n //([[\"a\",\"b\"],[\"c\",\"d\"],[\"e\",\"f\"]], [\"#\",\"$\",\"%\"]);\r\n if (arrOfSeparators.length === 0) {\r\n return;\r\n }\r\n\r\n var removeFromEndSeparator = arrOfSeparators.pop(); //%;\r\n //recursive call innerRecursive\r\n //call secondInnerRecur in innerRecursive\r\n\r\n secondInnerRecur(copyOfList, removeFromEndSeparator);\r\n //when we call innerRecursive we want to pass the original array into secondInnerRecur\r\n //in our secondInnerRecur we are removing from the end / mutating the array to get the length of the array length to 0 so we can break out of our recursive call\r\n //but our top recursive or innerRecursive we want to call innerRecursive with the list of subarray [[\"a\",\"b\"],[\"c\",\"d\"],[\"e\",\"f\"]] and an array with\r\n //separator decrement by one item from the end because we need to break out of our innerRecur func that is our base case for innerRecur\r\n //when this array [\"#\",\"$\",\"%\"] becomes []\r\n innerRecursive(arrOfSeparators);\r\n }\r\n\r\n function secondInnerRecur(secondList, poppedSeparator) {\r\n //copy list in this func\r\n // var mutateList = secondList.slice();\r\n //([[\"a\",\"b\"],[\"c\",\"d\"],[\"e\",\"f\"]], %);\r\n //work with copy of original passed in list\r\n if (secondList.length === 0) {\r\n // return \"\" from our secondInnerRecur if we want to return a string of the subarray combined with the separator\r\n // \"a%b%c%d%e%f%\"\r\n return;\r\n }\r\n /* code below we are mutated the original array: */\r\n var removeFromEndList = secondList.pop(); //[\"e\",\"f\"]\r\n /***** these algorithm is for when we want to combine the values in the nested array with the separator into one string\r\n * \"a%b%c%d%e%f%\"\r\n * *****/\r\n //we should send a copy of [\"e\",\"f\"] in to call of thirdInnerRecur\r\n var copyOfArrRemovedFromList = removeFromEndList.slice();\r\n var buildUpStrWithSeparator = thirdInnerRecur(\r\n removeFromEndList,\r\n poppedSeparator\r\n );\r\n /*return*/ secondInnerRecur(secondList, poppedSeparator) +\r\n buildUpStrWithSeparator;\r\n /***** these algorithm is for when we want to combine the values in the nested array with the separator into one string\r\n * \"a%b%c%d%e%f%\"\r\n * *****/\r\n /***** we want to make a string with the separator for each subarray/nested arrays *****/\r\n\r\n //we should send a copy of [\"e\",\"f\"] in to call of thirdInnerRecur\r\n var copyOfArrRemovedFromList = removeFromEndList.slice();\r\n\r\n var buildUpStrWithSeparator = thirdInnerRecur(\r\n copyOfArrRemovedFromList,\r\n poppedSeparator\r\n );\r\n\r\n //add buildupStr using thirdInnerRecur to our array that we want to return\r\n //unshift to add shift to remove\r\n result.unshift(buildUpStrWithSeparator);\r\n // we don't have to return anything from our secondInnerRecur\r\n /*return*/ secondInnerRecur(secondList, poppedSeparator);\r\n\r\n /***** we want to make a string with the separator for each subarray/nested arrays *****/\r\n }\r\n\r\n function thirdInnerRecur(poppedSubarrayOfList, separator) {\r\n //([\"e\",\"f\"],%)\r\n if (poppedSubarrayOfList.length === 0) {\r\n return \"\";\r\n }\r\n\r\n var removedValuedFromList = poppedSubarrayOfList.pop(); //f\r\n var buildStrWithSeparator = removedValuedFromList + separator;\r\n //recursively call thirdInnerRecur\r\n return (\r\n thirdInnerRecur(poppedSubarrayOfList, separator) +\r\n buildStrWithSeparator\r\n );\r\n }\r\n }\r\n\r\n return arrOfStrCombinedWithSeparator;\r\n }\r\n}", "function demo() {\n let array1 = ['a', 'b', 'c'];\n let array2 = ['d', 'e', 'f'];\n\n console.log(array1.concat(array2));\n // expected output: Array [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\n\n //Examples\n concatenatingTwoArrays();\n concatenatingThreeArrays();\n concatenatingValuesToAnArray();\n concatenatingNestedArrays();\n}", "concat(...args) {\n let newList = new Single();\n\n // make sure arguments are all lists and add up the total length\n for(let i = 0; i < args.length; i++){\n if(args[i].toString() != '[object Single]') return console.error('arguments must be of type Single');\n\n // iterate over current list and push it to new list\n let currentNode = args[i].head\n let j = 0;\n while(j < args[i].size){\n newList.push(currentNode.value)\n currentNode = currentNode.next;\n j++;\n }\n }\n return newList\n }", "function listeConcatener(concatener){\n let temporaire = [];\n if(concatenerJson === null){\n concatenerJson = concatener;\n } else {\n temporaire = concatenerJson.concat(concatener);\n concatenerJson = temporaire;\n }\n}", "concat(list){\n if(this.isEmpty()){ // if the list is empty, we'll just set this list's head to the new list's head\n this.head = list.head;\n list.head = null; // and set the list's head to null to clear it\n return this;\n } else {\n let runner = this.head; // set our runner\n while(runner.next != null) { // get to the end of our current list\n runner = runner.next;\n }\n runner.next = list.head; // set the last node of this list to the first node of the passed in list\n list.head = null; // and clear the old list\n return this;\n }\n }", "function append(xs, ys) {\n if (is_empty_list(xs)) {\n return ys;\n } else {\n return pair(head(xs), append(tail(xs), ys));\n }\n}", "function concatenateArrays(a, b) {\n\t// your code goes here\n}", "function sc_append() {\n if (arguments.length === 0)\n\treturn null;\n var res = arguments[arguments.length - 1];\n for (var i = arguments.length - 2; i >= 0; i--)\n\tres = sc_dualAppend(arguments[i], res);\n return res;\n}", "concat(list) {\n\t\tlet runner = this.head;\n\t\twhile (runner.next != null) {\n\t\t\trunner = runner.next;\n\t\t}\n\t\trunner.next = list.head;\n\t\tlist.head = null;\n\t}", "function appendAllTo(array, items) {\n\t return array.push.apply(array, items), array;\n\t }", "concat(list){\r\n // We should first check to see if this list is empty.\r\n // If it is, we just set the head to the second list's head.\r\n if(this.isEmpty()) {\r\n this.head = list.head;\r\n // And let's clear the second list just cuz.\r\n list.head = null;\r\n return this;\r\n }\r\n // Let's start a runner\r\n let runner = this.head;\r\n // And move the runner to the end of the list\r\n while(runner.next != null){\r\n runner = runner.next;\r\n }\r\n // Once the runner is at the end of the list, set its .next\r\n // to the head of the second list.\r\n runner.next = list.head;\r\n // And now let's clear list 2.\r\n list.head = null;\r\n // And return our newly increased list!\r\n return this;\r\n\r\n }", "function concat(...arr) {\n result = [];\n numElements = arr.length; \n\n for (var i = 0; i < numElements; i += 1) {\n if (Array.isArray(arr[i])) {\n result = result.concat(arr[i])\n } else {\n result.push(arr[i]);\n }\n }\n\n return result;\n}", "function newConcat(val1, ...restParam) {\n\t// this returns a new array\n\tlet newArray = [...val1];\n\tconsole.log(restParam);\n\tfor (let i = 0; i < restParam.length; i++) {\n\t\tif (Array.isArray(restParam[i])) {\n\t\t\tnewArray = [...newArray, ...restParam[i]];\n\t\t} else {\n\t\t\tnewArray = [...newArray, restParam[i]];\n\t\t}\n\t}\n\treturn newArray;\n}", "function joinArrays(...args){\n return args.reduce((acc, next) => acc.concat(next), [])\n}", "function appendChildren (par,list){\n\t\t\tfor(var i=0;i<list.length;i++){\n\t\t\t\tpar.appendChild(list[i])\n\t\t\t}\n\t\t}", "function concat(list1, list2) {\n last(list1).next = list2\n}", "function concatArrays (arrays) {\n //instantiate results array\n var finalArray = [];\n\n //create inner recursive function to do the work\n function addElementsToFinal (arrayOfArrays) {\n //base case: no remaining elements in input array\n if (!arrayOfArrays.length) {\n return finalArray;\n }\n //for each subarray in the source arrays first element...\n for (var i = 0; i < arrayOfArrays[0].length; i++) {\n //...add to the results array\n finalArray.push(arrayOfArrays[0][i]);\n }\n //recursive function call of the rest of the source array\n return addElementsToFinal (arrayOfArrays.slice(1));\n }\n //call recursive inner function, eventually return results array\n return addElementsToFinal (arrays);\n}", "function flatten(l){\n return [].concat.apply([], l); \n}", "function appendAllTo(array, items) {\n return array.push.apply(array, items), array;\n }", "function appendAllTo(array, items) {\n return array.push.apply(array, items), array;\n }", "static concat(list, totalLength) {\n if (totalLength == undefined) {\n totalLength = 0;\n for (const buf of list) {\n totalLength += buf.length;\n }\n }\n\n const buffer = new Buffer$1(totalLength);\n let pos = 0;\n for (const buf of list) {\n buffer.set(buf, pos);\n pos += buf.length;\n }\n\n return buffer;\n }", "function joinArrays(...args){\n return args.reduce((acc,next) => acc.concat(next), []);\n}", "function append(x, xs) {\n return concat (xs, of (xs.constructor, x));\n }", "function append(x, xs) {\n return concat(xs, of(xs.constructor, x));\n }", "function flatten(lists) {\n return lists.reduce((a, b) => a.concat(b), [])\n}", "function concatenatingNestedArrays() {\n const num1 = [[1]];\n const num2 = [2, [3]];\n\n const numbers = num1.concat(num2);\n\n console.log(numbers);\n // results in [[1], 2, [3]]\n\n // modify the first element of num1\n num1[0].push(4);\n\n console.log(numbers);\n // results in [[1, 4], 2, [3]]\n}", "function combineLists(){\n\t\t\n\t\t//create a new list\n\t\tvar $menu = $('<ul id=\"mmnav\" />');\n\t\t\n\t\t//loop through each menu and extract the list's child items\n\t\t//then append them to the new list\n\t\t$menus.each(function(){\n\t\t\t$(this).children().clone().appendTo($menu);\n\t\t});\n\t\t\n\t\t//de-duplicate any repeated items\n\t\tcheckForDuplicates($menu);\n\t\t\t\t\n\t\t//return new combined list\n\t\treturn $menu;\n\t\t\n\t}//combineLists()", "function joinElements(a) {\r\n return a.join(',');\r\n}", "function join(list, separator = \",\") {\r\n //[\"a\",\"b\",\"c\",\"d\",\"e\"]\r\n var result;\r\n var resultStr = \"\";\r\n if (separator === \"\") {\r\n //use reduce\r\n result = reduce(\r\n list,\r\n function buildStr(buildingUp, currentValue) {\r\n //buildingUp will be \"\"\r\n //currentValue will be values in list. first it will be \"a\"\r\n buildingUp = buildingUp + String(currentValue);\r\n return buildingUp;\r\n },\r\n \"\"\r\n );\r\n //for each\r\n // each(list, function buildingOurStr(eachStr) {\r\n // resultStr = resultStr + String(eachStr);\r\n // });\r\n } else {\r\n //use reduce\r\n result = reduce(\r\n list,\r\n function buildingStrWithReduce(\r\n buildingUp,\r\n currentValue,\r\n currIndex,\r\n listOfReduce\r\n ) {\r\n var lengthOfList = listOfReduce.length;\r\n if (currIndex == lengthOfList - 1) {\r\n buildingUp = buildingUp + String(currentValue);\r\n return buildingUp;\r\n } else {\r\n buildingUp = buildingUp + String(currentValue) + separator;\r\n return buildingUp;\r\n }\r\n },\r\n \"\"\r\n );\r\n //use for each\r\n // each(\r\n // list,\r\n // function buildingOurStrWithForEach(eachStr, index, listOfEach) {\r\n // var lengthOfList = listOfEach.length;\r\n // if (index == lengthOfList - 1) {\r\n // resultStr = resultStr + String(eachStr);\r\n // } else {\r\n // resultStr = resultStr + String(eachStr) + separator;\r\n // }\r\n // }\r\n // );\r\n }\r\n return result;\r\n }", "function joinArrays(...args){\n return args.reduce((acc, next) => acc.concat(next), []);\n}", "function concat(...params) {\n return output(params).apply(array => array.join(\"\"));\n}", "function list (first, rest) {\n return [first].concat(rest);\n }", "function joinArray(a)\r\n\t\t{\r\n\t\t\tvar b;\r\n\t\t\tb = \"[\" + a.join(\"],[\") + \"]\";\r\n\t\t\treturn(b);\r\n\t\t}", "function joinAdjacentLists(opts, node) {\n if (node.kind !== 'document' && node.kind !== 'block') {\n return undefined;\n }\n\n var invalids = node.nodes.map(function (child, i) {\n if (!(0, _utils.isList)(opts, child)) return null;\n var next = node.nodes.get(i + 1);\n if (!next || next.type !== child.type) return null;\n return [child, next];\n }).filter(Boolean);\n\n if (invalids.isEmpty()) {\n return undefined;\n }\n\n /**\n * Join the list pairs\n */\n // We join in reverse order, so that multiple lists folds onto the first one\n return function (change) {\n invalids.reverse().forEach(function (pair) {\n var _pair = _slicedToArray(pair, 2),\n first = _pair[0],\n second = _pair[1];\n\n var updatedSecond = change.value.document.getDescendant(second.key);\n updatedSecond.nodes.forEach(function (secondNode, index) {\n change.insertNodeByKey(first.key, first.nodes.size + index, secondNode, { normalize: false });\n });\n\n change.removeNodeByKey(second.key, { normalize: false });\n });\n };\n}", "function concat(arr1, arr2){\nvar union = []\nfor (var i=0; i<arr1.length; i++){\n\tunion.push(arr1[i])\n}\nfor (var i=0; i<arr2.length; i++){\n\tunion.push(arr2[i])\n}\nreturn union;\n}", "function concat(arrays) {\n return Array.prototype.concat.apply([], arrays);\n}", "function flattenAndConcat(arr, res = [], small_arr = []) {\n\t\tif (!arr.length) {\n\t\t\tsmall_arr = small_arr.join();\n\t\t\tsmall_arr = small_arr.split(',');\n\t\t\tsmall_arr = small_arr.map(Number);\n\t\t\treturn !small_arr.legth ? res.concat(small_arr) : res\n\t\t}\n\t\tlet result = res;\n\t\tlet tmp = arr.shift();\n\t\tif (Array.isArray(tmp)) {\n\t\t\tif (arr.length) {\n\t\t\t\tsmall_arr.push(arr);\n\t\t\t}\n\t\t\treturn flattenAndConcat(tmp, result, small_arr);\n\t\t}\n\t\tresult = res.concat(tmp);\n\t\tif (!small_arr.legth) {\n\t\t\treturn flattenAndConcat(arr, result, small_arr);\n\t\t}\n\t\treturn flattenAndConcat(arr, result)\n\t}", "function concat(arr1, arr2) {\n var result = [];\n for (var i = 0; i < arr1.length; i++) { push(result, arr1[i]); }\n for (var i = 0; i < arr2.length; i++) { push(result, arr2[i]); }\n return result;\n}", "function ConcatenateMergeUrl(lstLoadedUrls,cgiArgs)\n{\n\tvar urlFull;\n\n\t/* If there is one element, we might as well simply return it.\n\tIt is a frequent case. */\n\tconsole.log(\"ConcatenateMergeUrl lstLoadedUrls.array_urls.length=\"+ lstLoadedUrls.array_urls.length);\n\tif( lstLoadedUrls.array_urls.length == 1 )\n\t{\n\t\turlFull = lstLoadedUrls.array_urls[0].m_loaded_url;\n\t\t// No need to merge anything because there is one url only.\n\t\turlFull = AddUrlCgiArg(urlFull, cgiArgs );\n\t}\n\telse\n\t{\n\t\tvar urlMerge = pyMergeScript;\n\t\tvar cgiDelim = \"?url=\";\n\n\t\tfor( var ixLoaded = 0; ixLoaded < lstLoadedUrls.array_urls.length; ixLoaded++ )\n\t\t{\n\t\t\tvar objLoadedUrl = lstLoadedUrls.array_urls[ixLoaded];\n\t\t\tconsole.log(\"m_loaded_title=\"+ objLoadedUrl.m_loaded_title +\" m_loaded_url=\"+objLoadedUrl.m_loaded_url);\n\n\t\t\tvar url64safe = Base64.encodeURI(objLoadedUrl.m_loaded_url);\n\t\t\turlMerge += cgiDelim + url64safe;\n\t\t\tcgiDelim = \"&url=\";\n\t\t}\n\t console.log(\"ConcatenateMergeUrl urlMerge=\"+urlMerge);\n \turlFull = AddUrlPrefix(urlMerge,cgiArgs);\n }\n\n console.log(\"ConcatenateMergeUrl urlFull=\"+urlFull);\n return urlFull;\n}", "function myConcat(separator) {\n var result = \"\"; // initialize list\n var i;\n // iterate through arguments\n for (i = 1; i < arguments.length; i++) {\n result += arguments[i] + separator;\n }\n return result;\n}", "function concat(input1, input2) {}", "function combine(a, b) {\n return a.concat(b);\n}", "function getStringLists(array){\n return [array].push(array)\n}", "function _add_to(stack, item_or_list){\n\n\tvar ret = [];\n\t\n\tif( tcache[stack] ){\n\t if( item_or_list ){\n\t\tif( ! us.isArray(item_or_list) ){ // ensure listy\n\t\t item_or_list = [item_or_list];\n\t\t}\n \t\tret = tcache[stack].concat(item_or_list);\n\t }else{\n\t\tret = tcache[stack].concat();\n\t }\n\t}\n\n\treturn ret;\n }", "function concatenateArrays() {\n //meaning to merge two or more arrays into one array\n const arr1 = [0, 1, 2, 3];\n const arr2 = [4, 5, 6];\n const arr3 = [7, 8, 9];\n const result = [...arr1, ...arr2, ...arr3]; //This expression concatenate 3 arrays into one\n console.group(\"concatenateArrays()\");\n console.log(`const arr1 = [0, 1, 2, 3];\n const arr2 = [4, 5, 6];\n const arr3 = [7, 8, 9];`);\n console.log(`const result = [...arr1, ...arr2, ...arr3];`);\n console.log(`return result; `);\n return result;\n}", "appendList(elements) {\n this.elements.push(elements)\n }", "function concat (arr1, arr2) {\n\treturn reduce (concat, function (total) {\n\t return total + \",\" + arr2;\n\t}, arr1);\n}", "function zip (lista, lista2) {\n return lconcat = lista.concat(lista2);\n}", "function mergeUpdatedList (oldList, newList) {\n return oldList.concat(newList);\n }", "function BOT_concatFree(t1,t2) {\r\n\tif(t2.length == 0) return t1;\r\n\tfor(i in t2) { t1 = BOT_appendFree(t1,t2[i])}\r\n\treturn t1;\r\n}", "function concatArrays(arr1, arr2){\n\n}", "function concat(arr1, arr2) {\n return arr1.concat(arr2);\n }", "function concat (array1, array2)\n{\n for (var i = 0 ; i < array2.length ; i++)\n {\n array1.push(array2[i]); \n }\n return array1;\n}", "function join(){\n var newArray = [];\n for (var i = 0; i < numbers.length; i ++){\n newArray = newArray.concat(numbers[i]);\n }\n for (var j = 0; j < strings.length; j ++){\n newArray = newArray.concat(strings[j]);\n }\n return newArray;\n}", "function concatenateArray(strings) {\n let newString = \"\";\n strings.forEach(string => {\n newString += string;\n })\n return newString;\n}", "function concat(arr) {\n\treturn [].concat(...arr);\n}", "function join(a, b) {\n\t\t Array.prototype.push.apply(a, b);\n\t\t return a;\n \t}", "function c_listAppend(lst, v) {\n var newNode = { val: v, prev : null, next : null };\n\n /* Annotation */ isNullableObject(lst);\n return (lst === null) ? newNode : b_listConcat(lst, newNode)\n}", "function appendArrays (arr1,arr2) {\n var output = [];\n for (var i = 0; i < arr1.length; i++){\n output.push(arr1[i]);\n }\n for (var j = 0; j < arr2.length; j++){\n output.push(arr2[j]);\n }\n return output;\n}", "function flatten(list){var result=[];var i=0;while(i<list.length){var item=list[i];if(Array.isArray(item)){if(item.length>0){list=item.concat(list.slice(i+1));i=0;}else{i++;}}else{result.push(item);i++;}}return result;}", "function arrayAppend ( aFront, aEnd ){\n\tvar i;\n\tvar dest = new Array();\n\tif ( aFront == null )\n\t\treturn arrayAppend ( new Array(), aEnd );\n\telse if ( aEnd == null )\n\t\treturn arrayAppend (aFront, new Array());\n\t\n\tfor (i=0;i<aFront.length;i++)\n\t\tdest.push( aFront[i] );\n\tfor (i=0;i<aEnd.length; i++)\n\t\tdest.push( aEnd[i] );\n\treturn dest;\n}", "function mergeArrays()\n{\n return Array.prototype.slice.call(arguments).reduce(function(p,arg){return p.concat(arg)},[]);\n}", "function concatenate(array1,array2){\n newArray = [];\n for(i=0; i < array1.length; i++){\n newArray[i] = array1[i];\n }\n for(j=0; j < array2.length; j++){\n newArray[array1.length + j] = array2[j];\n }\n return newArray\n}", "concat(other) {\n return this.append(other)\n }", "function concatenateArray(arrayToJoin) {\n\n var tempStr = \"\";\n for (var i in arrayToJoin) {\n tempStr += arrayToJoin[i] + \" \";\n }\n return tempStr;\n}", "i(list) {\n\n if (Array.isArray(list)) {\n\n this.a.push.apply(this.a, list);\n\n } else {\n\n for (var item of list)\n this.a.push(item);\n }\n\n return this;\n }", "function mergeToStringUsingFor(elements, delimiter = ',') {\n\n}", "function combineTwoArrays(array1,array2){\n finalArray = [...array1,...array2];\n console.log(finalArray);\n}", "function concat(arr1,arr2){\n newarr = [];\n for(i = 0; i<arr1.length; i++){\n newarr.push(arr1[i]);\n }\n for(index = 0; index<arr2.length; index++){\n newarr.push(arr2[index]);\n }\n return newarr;\n}", "function concatArrays([...arr1], [...arr2]) {\n const newArr = arr1.concat(arr2);\n console.log(newArr);\n}", "concatComponents(componentes){\n \tfor(let i in componentes){\n \t\tthis.concatComponent(componentes[i]);\n \t}\n }", "i(list) {\n\n if (Array.isArray(list)) {\n\n this.a.push.apply(this.a, list);\n\n } else {\n\n for (let item of list)\n this.a.push(item);\n }\n\n return this;\n }", "niceList(array, join, finalJoin) {\n var arr = array.slice(0), last = arr.pop();\n join = join || ', ';\n finalJoin = finalJoin || ' and ';\n return arr.join(join) + finalJoin + last;\n }", "function concat(a1, a2) {\n var l1 = a1.length;\n var l2 = a2.length;\n var a1a2 = new Array(l1 + l2 | 0);\n for(var i = 0 ,i_finish = l1 - 1 | 0; i <= i_finish; ++i){\n a1a2[i] = a1[i];\n }\n for(var i$1 = 0 ,i_finish$1 = l2 - 1 | 0; i$1 <= i_finish$1; ++i$1){\n a1a2[l1 + i$1 | 0] = a2[i$1];\n }\n return a1a2;\n }", "function weaveLists ({ first = [], second = [], results = [], prefix = []}) {\n count++\n\n /* One list is empty. Add remainder to [a cloned] prefix and store result. */\n if (first.length === 0 || second.length === 0) {\n let result = _.clone(prefix)\n result = result.concat(first)\n result = result.concat(second)\n results.push(result)\n return\n }\n\n /* Recurse with head of first added to the prefix. Removing the head will damage\n * first, so we'll need to put it bback where we found it afterwards.\n */\n const headFirst = first.shift()\n prefix.push(headFirst)\n weaveLists({ first, second, results, prefix })\n prefix.pop()\n first.unshift(headFirst)\n\n /* Do the same thing with second, damaging and then restoring the list. */\n const headSecond = second.shift()\n prefix.push(headSecond)\n weaveLists({ first, second, results, prefix })\n prefix.pop()\n second.unshift(headSecond)\n}" ]
[ "0.7027369", "0.69005924", "0.68246925", "0.6629465", "0.65794337", "0.6502546", "0.6332338", "0.6322995", "0.62115616", "0.6202517", "0.6138647", "0.6137989", "0.60667247", "0.6032472", "0.6028379", "0.60070515", "0.5988056", "0.59743285", "0.5958824", "0.5946305", "0.5937304", "0.5925828", "0.5924673", "0.5881076", "0.5862974", "0.5851389", "0.58454627", "0.5830885", "0.58052564", "0.5805076", "0.57678646", "0.57611", "0.5747262", "0.5746605", "0.5738275", "0.57362646", "0.57345074", "0.5706017", "0.5689096", "0.56772494", "0.56752574", "0.5663813", "0.5653177", "0.5646714", "0.5646714", "0.56431973", "0.56393886", "0.56347847", "0.562215", "0.56188565", "0.56161094", "0.5603943", "0.5587601", "0.55846006", "0.55789524", "0.55568856", "0.55523753", "0.55294377", "0.5525368", "0.5521585", "0.5517574", "0.55045635", "0.54970026", "0.5494515", "0.54927427", "0.5483756", "0.547899", "0.5459937", "0.5455574", "0.54509425", "0.54479945", "0.5441144", "0.54304314", "0.54239464", "0.5419768", "0.54142267", "0.54110247", "0.5395173", "0.53795296", "0.53786594", "0.53737557", "0.53676385", "0.5367234", "0.536229", "0.5355042", "0.535127", "0.53493845", "0.53306067", "0.5324154", "0.5315186", "0.53149253", "0.5306714", "0.52969503", "0.5285782", "0.5282759", "0.5276793", "0.52626413", "0.5259861", "0.52579814", "0.5254867" ]
0.65812373
4
down:list>list Ordena una lista en orden descendente down([1,2,3])>[3,2,1] down([5,7,1,0,3,9])>[9,7,5,3,1,0]
function down(list) { if(length(list)==1) { return list; } else { return cons(maxList(list),down(removeX(list,maxList(list)))); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function invertir(list) {\n if(longitud(list)==0){\n return [];\n } else {\n return cons(last(list),invertir(pop(list)));\n }\n}", "function reverseList(list) {\n let buf = [];\n\n for (let n = list; n != null; n = n.next) {\n buf.push(n.data);\n }\n\n return revArrayToList(buf);\n}", "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;\n }\n return list;\n}", "function ordenaLista(list) {\n //cria uma lista de itens e ordena\n const items = list.children('button').get();\n items.sort(function (a, b) {\n const keyA = $(a).text();\n const keyB = $(b).text();\n if (keyA < keyB) return -1;\n if (keyA > keyB) return 1;\n return 0;\n });\n //remove os itens e adiciona na ordem correta\n $.each(items, function (i, child) {\n list.append(child);\n });\n }", "function invert(list) {\r\n if(length(list)==0) {\r\n return [];\r\n } else {\r\n return cons(last(list),invert(pop(list)));\r\n }\r\n}", "function descend(start,childlist){\n\tvar curchild = start;\n\t//console.log(start);\n\tfor(index in childlist) {\n\t\tvar i = childlist[index];\n\t\tcurchild = curchild.childNodes[i];\n\t}\n\treturn curchild;\n}", "function list(head,tail){return[head].concat(tail);}", "function invert(list) {\n if(length(list)==0) {\n return [];\n } else {\n return cons(last(list),invert(pop(list)));\n }\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "function reverseList(list){ \n\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList);\n}", "bubbleDown() {\n let index = 0;\n while(this.leftChild(index) && (this.leftChild(index) > this.items[index]) || this.rightChild(index) > this.items[index]) {\n let biggerIndex = this.leftChildIndex(index);\n if (this.rightChild(index) && this.rightChild(index) > this.items[biggerIndex]) {\n // if right is smaller, right swaps\n biggerIndex = this.rightChildIndex(index);\n }\n this.swap(biggerIndex, index);\n index = biggerIndex;\n }\n }", "function reverseDoubleLinkList(head) {\n\n}", "function lis (arr) {\n\tvar d = []\n\tlet len = 1;\n\tlet target = [];\n\tfor (let i = 0; i < arr.length; i++) {\n\t\td[i] = [arr[i]];\n\t\tfor (let j = i - 1; j >= 0; j--) {\n\t\t\tif (d[j][0] <= d[i] && j < i) {\n\t\t\t\td[j].forEach(item => {\n\t\t\t\t\td[i].push(item)\n\t\t\t\t})\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (d[i].length > len) {\n\t\t\tlen = d[i].length;\n\t\t\ttarget = d[i]\n\t\t}\n\t}\n\treturn target.reverse();\n}", "moveDown(node) {\n\n let previousNode = null;\n let currentNode = this.head;\n\n // TODO need to be setting node.val.next too\n\n while (currentNode !== null) {\n\n if (currentNode.val.id === node.val.id) {\n\n let nextNodeCopy = currentNode.next;\n\n // currentNode is the first item\n if (previousNode === null) {\n\n currentNode.next = currentNode.next.next;\n currentNode.val.next = currentNode.next.val.id; // DB next\n\n nextNodeCopy.next = currentNode;\n nextNodeCopy.val.next = nextNodeCopy.next.val.id; // DB next\n\n this.head = nextNodeCopy;\n this.head.val.next = this.head.next.val.id; // DB next\n\n return;\n }\n\n // currentNode is the last item\n if (currentNode.next === null) {\n return;\n }\n\n // currentNode is somewhere in the middle\n currentNode.next = currentNode.next.next;\n currentNode.val.next = currentNode.next.val.id; // DB next\n\n nextNodeCopy.next = currentNode;\n nextNodeCopy.val.next = nextNodeCopy.next.val.id; // DB next\n\n previousNode.next = nextNodeCopy;\n previousNode.val.next = previousNode.next.val.id; // DB next\n\n return;\n }\n\n previousNode = currentNode;\n currentNode = currentNode.next;\n }\n }", "function sumListsForwardOrder(list1, list2){ //FORWARD ORDER IMPLEMENTATION\n\n}", "reverseLoop(myList) {\n console.log('Looping');\n let mySteps = myList;\n let listLength = mySteps.length;\n for (let step = listLength - 1; step >= 0; step--) {\n console.log(mySteps[step]);\n }\n }", "function reverseList(list) {\n let reversed = [];\n for (let i = list.length - 1; i >= 0; i--) {\n reversed.push(list[i])\n }\n return reversed\n}", "onDownarrow() {\n const descendingOrder = this.state.columnList.sort((a, b) => a.order - b.order).reverse();\n console.log(\"Dsc: \", descendingOrder)\n this.setState({\n columnList: descendingOrder\n })\n }", "function reverseList (list) {\n // js re-implementation of 3rd solution from:\n // http://www.haskell.org/haskellwiki/99_questions/Solutions/5\n function reverseInner (list, reversedAlready) {\n if (!list) {\n return reversedAlready\n }\n\n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }\n\n return reverseInner(list, emptyList)\n}", "function reverse(list) {\n let newList = null;\n\n while(list !== null) {\n newList = {\n value: list.value,\n next: newList\n };\n\n list = list.next;\n }\n\n return newList;\n\n // const tailFcn = function (list, acc) {\n // if (list === null) {\n // return acc;\n // } else {\n // return tailFcn(list.next, {\n // value: list.value,\n // next: acc\n // });\n // }\n // }\n //\n // tailFcn(list, null);\n}", "function TSplit_doRecursiveDrillDown(){\n\tHelpList.add(this.UpNode);\n\tHelpList.add(this.DownNode);\n\t\t\t\t\n\tif (this.UpNode.HasChild){this.UpNode.Child.doRecursiveDrillDown()}\n\tif (this.DownNode.HasChild){this.DownNode.Child.doRecursiveDrillDown()}\n}", "function TNodes_doIndexDown(index)\n\t\t{\n\t\t\tif (index==this.Count){\n\t\t\t\tthis.Count--;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvar i = 1;\t\n\t\t\t\t\n\t\t\t\tfor (i=index; i<this.Count; i++){\n\t\t\t\t\tthis.Item[i]=this.Item[i+1];\n\t\t\t\t\t// restore internal item-values\n\t\t\t\t\tthis.Item[i].AbsoluteIndex=i;\n\t\t\t\t}\n\t\t\t\tthis.Count--;\n\t\t\t}\n\t\t}", "getOrderedList() {\n let result = []\n let current = this.head\n\n while (current) {\n result.push(current.data)\n current = current.next\n }\n\n return result\n }", "function reverse(start){\n let curr = start; \n let prev = null; \n let temp = null;\n while(curr!=null){\n temp= curr.next; \n curr.next = prev;\n prev= curr;\n curr= temp; \n // console.log('prev',prev&&prev.value,'curr', curr&&curr.value,'temp', temp&&temp.value);\n }\n\n start = prev;\n return start;\n}", "function reverseList(lst) {\n let result = null;\n let stack = null;\n let current = lst.head;\n while(current) {\n stack.push(current)\n current = current.next;\n } \n // Set head to end of list.\n result = stack.pop() || [];\n current = result;\n \n while (current) {\n current.next = stack.pop();\n current = current.next;\n }\n\n return result;\n}", "concat(list) {\n\t\tlet runner = this.head;\n\t\twhile (runner.next != null) {\n\t\t\trunner = runner.next;\n\t\t}\n\t\trunner.next = list.head;\n\t\tlist.head = null;\n\t}", "function listNodesReversed(startNode) {\n var list = new Array();\n var node = startNode;\n while(node) {\n list.push(node);\n node = prevNode(node);\n }\n return list;\n}", "function downGen(){\n //reset sib pos counter ie start at left most child\n sibPos = 0;\n if(selectedNode.siblings('ul').length>0){\n //moving down generation, must be children of selected node\n selectedNode = selectedNode.siblings('ul').find('.node').first();\n\n //style selected node\n $('.node').removeClass('selected');\n selectedNode.addClass('selected');\n }else{\n log('No more children');\n }\n}", "function sortedList (coordinateList) {\n // Not implemented since delaunayMethod should outperform this\n}", "function get_order_list(list) {\n\t\t\tconsole.log(\"sorting list:\", list);\n\t\t\tvar _t_l = [];\n\t\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\t\t_t_l.push({idx:i,val:list[i]});\n\t\t\t}\n\t\t\t_t_l.sort(function(a,b) {return a.val<b.val})\n\t\t\tvar res = [];\n\t\t\tfor (var i = 0; i < _t_l.length; i++) {\n\t\t\t\tres.push(_t_l[i].idx);\n\t\t\t}\n\t\t\treturn res;\n\t\t}", "function descendingOrder() {\n return ascendingOrder(deck).reverse();\n}", "function ordenarListaMe1(listao){\n\n const listaord = listao.sort();\n return listaord;\n}", "function reverseSublist(L, start, finish) {\n let dummyHead = (sublistHead = new ListNode(0, L));\n for (let i = 1; i < start; i++) {\n sublistHead = sublistHead.next;\n }\n\n const sublistIter = sublistHead.next;\n\n for (let i = 0; i < finish - start; i++) {\n let temp = sublistIter.next;\n sublistIter.next = temp.next;\n temp.next = sublistHead.next;\n sublistHead.next = temp;\n }\n\n return dummyHead.next;\n}", "reverseList() {\n if (this.head === null) {\n console.log('Empty list');\n return;\n }\n let previous = null;\n let current = this.head;\n while (current !== null) {\n const changer = current.next;\n current.next = previous;\n previous = current;\n current = changer;\n }\n this.head = previous;\n }", "function findAllDecreasingSubArr(numberList) {\n if (!Array.isArray(numberList) || numberList.length <= 1) return [];\n let newArray = [];\n const newResult = [];\n for (let index = 0; index < numberList.length; index++) {\n if (newArray.length > 0 && numberList[index] < numberList[index + 1]) {\n newArray.push(numberList[index]);\n newResult.push(newArray);\n newArray = [];\n } else if (index === numberList.length - 1 && newArray.length > 1) {\n if (numberList[index] > numberList[index - 1])\n newArray.push(numberList[index]);\n newResult.push(newArray);\n } else {\n newArray.push(numberList[index]);\n }\n }\n return newResult.filter((x) => x.length > 2);\n}", "function listToArray(list) {\n \n let array = [];\n for (let node = list; node; node = node.ref) { // (init node; while node === true the loops goes on; incrementation)\n array.push(node.value);\n \n }\n \n return array;\n \n}", "function reverse(list) {\n if(!list.head){\n return;\n }\n let current, reverse = list.head;\n let nextNode = current.next;\n if(current === list.head){\n current.next = null;\n reverse = null;\n }\n while(!current){\n current.next = reverse;\n reverse = current;\n current = nextNode;\n nextNode = nextNode.next;\n }\n}", "function listOfDepth(tree) {\n return traverseAndLink(0, tree, {})\n}", "function sortList( list ) {\n let switched = true;\n while( switched ) {\n switched = false;\n if ( list.childElementCount ) {\n // for ( let i = 0; i < list.childElementCount - 1; i++ ) {\n for ( let i = 0; i < list.childElementCount; i++ ) {\n let item = list.children[i];\n let idNumber = item.id.match( /\\d+/ )[0];\n let nextItem = list.children[i+1];\n let nextIdNumber = nextItem ? nextItem.id.match( /\\d+/ )[0] : null;\n if ( nextIdNumber && idNumber > nextIdNumber ) {\n // console.log('idNumber:', idNumber, 'nextIdNumber:', nextIdNumber);\n list.insertBefore( nextItem, item );\n switched = true;\n }\n }\n }\n }\n }", "function adjacentInList($list, $target, delta) {\n if ($list.length === 0 || $target.length === 0) {\n return null;\n }\n var target = $target[0];\n var $result = null;\n $list.each(function(index, element) {\n if (target === element) {\n $result = $list.slice(index + delta, index + delta + 1);\n }\n });\n return $result.length > 0 ? $result : null;\n }", "function traverseInOrder(node, list) {\n debugger;\n if (node.left) {\n traverseInOrder(node.left, list);\n }\n list.push(node.value);\n if (node.right) {\n traverseInOrder(node.right, list);\n }\n return list;\n}", "reverse() {\n let currentnode = this.head;\n let prevnode = null;\n let nextnode;\n //swap the head and tail\n [this.head, this.tail] = [this.tail, this.head]\n //loop the process, length of list times \n for (let i = 0; i < this.length; i++) {\n //set next-node to current-node's next \n nextnode = currentnode.next;\n //set current-node's next to previous node \n currentnode.next = prevnode;\n //set previous-node to current-node\n prevnode = currentnode;\n // set current node to nextnode\n currentnode = nextnode;\n }\n //return list\n return this\n }", "reverse(){\n if(this.length < 1) return null;\n let node = this.head; // switches the head and tail\n this.head = this.tail;\n this.tail = node;\n let prev = null; // assigns prev to start as null\n let next;\n for(let i = 0; i < this.length; i++) {\n next = node.next; // updates next up to be the node.next, this is put at the start of the block, to prevent an extra loop\n node.next = prev; // redirects the next pointers to reverse the list.\n prev = node; // updates previous up to be the node\n node = next; // updates node up to be next\n }\n return list;\n }", "function sortDoublyListByLinks(unsortedNodes, listType){\n var links = unsortedNodes.links;\n var nodes = unsortedNodes.nodes;\n var uniqueForwardLink = {};\n var uniqueBackwardLink = {};\n var sortedNodes = [];\n var head = 0;\n\n for(var i = links.length-1; i >= 0; i--){\n if(parseInt(links[i].source) < parseInt(links[i].target)){\n uniqueForwardLink[links[i].source+\"-\"+links[i].target] = links[i];\n }else{\n uniqueBackwardLink[links[i].target+\"-\"+links[i].source] = links[i];\n }\n }\n\n var keys = Object.keys(uniqueForwardLink).sort(function(a,b){\n return parseInt(a.split(\"-\")[0]) - parseInt(b.split(\"-\")[0]);\n });\n\n for(key in keys){\n nodes[head]['forwardlink'] = uniqueForwardLink[keys[key]];\n sortedNodes.push(nodes[head]);\n head = uniqueForwardLink[keys[key]].target;\n }if(sortedNodes.length == nodes.length-1){\n sortedNodes.push(nodes[head]);\n }\n\n for(key in uniqueBackwardLink){\n if(sortedNodes[uniqueBackwardLink[key].target])sortedNodes[uniqueBackwardLink[key].target]['backwardlink'] = uniqueBackwardLink[key];\n }\n\n return sortedNodes;\n}", "bubbleUp() {\n let index = this.items.length - 1;\n while(this.parent(index) && this.parent(index) < this.items[index]) {\n this.swap(this.parentIndex(index), index);\n index = this.parentIndex(index)\n }\n }", "function SllReverse(list) {\n if (!list.head || !list.head.next) return list;\n\n let revNodes = [];\n let cur = list.head;\n\n while (cur) {\n revNodes.push(cur);\n cur = cur.next;\n }\n\n // instantiate new list and add the last node in the array as the head;\n let revList = new link.SLL();\n cur = revNodes.pop();\n revList.head = cur;\n\n\n // add the last node in the array to the end of the SLL (cur). Advance 'cur' to that node'. Reset that node's next value\n while (revNodes.length) {\n cur.next = revNodes.pop();\n cur = cur.next;\n cur.next = null;\n }\n revList.tail = cur;\n return revList;\n}", "function ls (lista) {\nreturn lista.sort(function(x, y) {\n return y.length - x.length; \n })\n}", "siftDown(index) {\n let parentElem = this.storage[index];\n let childLeftIndex = this.storage[index * 2 + 1];\n let childRightIndex = this.storage[index * 2 + 2];\n\n if (childLeftIndex > parentElem && childLeftIndex >= childRightIndex) {\n this.storage[index] = childLeftIndex;\n // Swapping elements\n this.storage[2 * index + 1] = parentElem;\n this.siftDown(2 * index + 1);\n } else if (childRightIndex > parentElem && childRightIndex >= childLeftIndex) {\n this.storage[index] = childRightIndex;\n // swapping elements\n this.storage[index * 2 + 2] = parentElem;\n this.siftDown(index * 2 + 2);\n }\n }", "function LR_moveup(list) {\n\tvar selected = list.selectedIndex;\n\tif ( list.length > 0 ) {\n\t\tif ( selected > 0 ) {\n\t\t\tvar moveText = list[selected].text;\n\t\t\tvar moveValue = list[selected].value;\n\t\t\tlist[selected].text = list[selected-1].text;\n\t\t\tlist[selected].value = list[selected-1].value;\n\t\t\tlist[selected-1].text = moveText;\n\t\t\tlist[selected-1].value = moveValue;\n\t\t\tlist.selectedIndex = selected-1; \n\t\t}\n\t}\n}", "function animateDown() {\n\tconsole.log(document.getElementById('list').scrollHeight);\n\t$('#list').animate({ scrollTop: document.getElementById('list').scrollHeight }, 5000, function() {\n\t\tanimateUp();\n\t});\n}", "function runLengthListDecompressor(list) {\n\tvar decompressedSublist = [];\n\tfor (var i = 0; i < list.length; i++) {\n\t\tif(list[i].length != 1) {\n\t\t\tvar j = 0;\n\t\t\twhile(j<list[i][1]) {\n\t\t\t\tdecompressedSublist.push(list[i][0])\n\t\t\t\tj++\n\t\t\t}\n\t\t} else {\n\t\t\tdecompressedSublist.push(list[i].toString())\n\t\t}\n\t}\n\tconsole.log(\"EX 8: list decompressed form a run-length encoded list: \")\n\tconsole.log(decompressedSublist)\n\n}", "function reverse(list) {\n if(list.head === null){\n console.log('you have an empty linked list');\n return 'You have an empty linked list';\n }\n let currNode = list.head;\n let prevNode = null;\n let nextNode = list.head;\n while(currNode !== null){\n nextNode = currNode.next;\n currNode.next = prevNode;\n prevNode = currNode;\n currNode = nextNode;\n }\n list.head = prevNode;\n display(list);\n return list;\n}", "sortedItems(){\n return this.myList.slice(0).reverse();\n }", "function reverseList(lls) {\n if (!lls.head) {\n return null;\n }\n\n let currNode = lls.head;\n let prevNode = null;\n let tempNode = currNode;\n\n while (currNode !== null) {\n tempNode = currNode.next;\n currNode.next = prevNode;\n prevNode = currNode;\n currNode = tempNode;\n }\n lls.head = prevNode;\n return display(lls);\n // make current value = this.head.next\n // make last value = current value\n}", "_heapifyDownUntil(index) {\n let parentIndex = 0;\n let leftChildIndex = 1;\n let rightChildIndex = 2;\n let childIndex;\n\n while (leftChildIndex < index) {\n childIndex = this._compareChildrenBefore(\n index,\n leftChildIndex,\n rightChildIndex\n );\n\n if (this._shouldSwap(parentIndex, childIndex)) {\n this._swap(parentIndex, childIndex);\n }\n\n parentIndex = childIndex;\n leftChildIndex = (parentIndex * 2) + 1;\n rightChildIndex = (parentIndex * 2) + 2;\n }\n }", "print (list) {\n var result = [];\n var currentNode = list.head;\n while (currentNode) {\n result.push(currentNode.val);\n currentNode=currentNode.next;\n }\n return result;\n }", "function reTraversal(list, fn) {\n var iterator = peek(list);\n if (!iterator) {\n return;\n }\n var end = false;\n var done = function() {\n end = true;\n }\n while (iterator !== list) {\n var tmp = peek(iterator);\n fn(iterator, done);\n if (end) {\n return;\n }\n iterator = tmp;\n }\n }", "function downstream(node){\n\t\tif(node.downstream)\n\t\t\treturn node.downstream;\n\n\t\t// if this is a tail node\n\t\tif(node.next.length === 0)\n\t\t\treturn node.downstream = [0];\n\n\t\tnode.downstream = [];\n\t\tnode.next.forEach(function(next){\n\t\t\tdownstream(next).forEach(function(distance){\n\t\t\t\tif(node.downstream.indexOf(distance) === -1)\n\t\t\t\t\tnode.downstream.push(distance+1);\n\t\t\t});\n\t\t});\n\t\treturn node.downstream;\n\t}", "function findLists() {}", "function decreaseArray(list){\r\n list.unshift(10);\r\n var answer =list.reduce(function(element1, element2){\r\n return element1 + element2; \r\n });\r\n return answer ;\r\n}", "function ListSwitcher(draggables, options) {\n\t options = options || {};\n\t options.stepOn = options.stepOn || new _geometry.Point(-50, 0);\n\t Dragee.List.call(this, draggables, options);\n\t}", "function sortCircularDoublyListByLinks(unsortedNodes, listType){\n var links = unsortedNodes.links,\n nodes = unsortedNodes.nodes,\n uniqueForwardLink = {},\n uniqueBackwardLink = {},\n sortedNodes = [],\n head = 0,\n lastIndex,\n lastElement;\n\n for(var i = links.length-1; i >= 0; i--){\n if(parseInt(links[i].source) < parseInt(links[i].target)){\n uniqueForwardLink[links[i].source+\"-\"+links[i].target] = links[i];\n if(links[i].source == 0 && links[i].target == nodes.length-1){\n nodes[links[i].source]['forwardlink'] = links[i];\n continue;\n }else{\n nodes[links[i].target]['backwardlink'] = links[i];\n continue;\n }\n\n }else{\n uniqueBackwardLink[links[i].source+\"-\"+links[i].target] = links[i];\n if(links[i].source == nodes.length-1 && links[i].target == 0){\n nodes[links[i].target]['backwardlink'] = links[i];\n continue;\n }else{\n nodes[links[i].source]['forwardlink'] = links[i];\n continue;\n }\n }\n }\n\n var keys = Object.keys(uniqueForwardLink).sort(function(a,b){\n if(a.split(\"-\")[0] == b.split(\"-\")[0]){\n if(parseInt(a.split(\"-\")[1]) > parseInt(b.split(\"-\")[1])){\n lastIndexA = a;\n lastIndexB = b;\n }else{\n lastIndexA = a;\n lastIndexB = b;\n }\n }\n return parseInt(b.split(\"-\")[0]) - parseInt(a.split(\"-\")[0]);\n });\n\n\n\n for(var i = 0; i < keys.length; i++){\n sortedNodes.push(nodes[head]);\n head = uniqueForwardLink[keys[i]].target;\n }\n // if(sortedNodes.length == nodes.length-1){\n // sortedNodes.push(nodes[head]);\n // }\n sortedNodes[lastIndexA.split(\"-\")[1]] = nodes[lastIndexB.split(\"-\")[1]];\n\n\n return sortedNodes;\n}", "function ordenarListaMe2(listao){\n\n let aux=[];\n let tam=listao.length;\n \n for(let j=0;j<tam; j++ ){\n console.log(tam);\n console.log(\"Estamos en la vueltaPrimerfase #\"+j);\n for(let i=0;i<=tam-1; i++){\n console.log(\"Estamos en la vuelta2dafase #\"+i);\n if(listao[i]>listao[i+1]){\n aux=listao[i];\n listao[i]=listao[i+1];\n listao[i+1]=aux;\n \n }\n } \n \n }\n return console.log(listao); \n }", "function reverseInner (list, reversedAlready) {\n if (!list) {\n return reversedAlready\n }\n\n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function List (val, tail) {\n this.val = val;\n this.tail = tail;\n}", "function ChangeOrderNoForList(listnode)\n{\n var i = 1;\n $(listnode).children(\"li\").each(function () {\n var id = $(this).attr(\"data-id\");\n ChangeOrderNoForOneElement(id, i);\n i++;\n console.log($(this).attr(\"data-id\"));\n console.log(i);\n });\n\n console.log($(listnode).children(\"li\"));\n}", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "function reverseInner( list, reversedAlready ) {\n if( !list ) {\n return reversedAlready;\n }\n \n return reverseInner(tail(list), cons(head(list), reversedAlready))\n }", "constructor(list) {\n // original array\n this.current = list.sort();\n // indicates whether there are more permutations\n this.done = false;\n // directional info for permutation algorithm\n this.dir = new Map();\n for(let i = 0; i < list.length; ++i) {\n this.dir.set(list[i], true);\n }\n }", "function solution(list) {\n let result = [];\n let queue = [list[0]];\n \n function flush() {\n if (queue.length > 2) {\n result.push(`${queue.shift()}-${queue.pop()}`);\n } else {\n result = result.concat(queue);\n }\n queue = [];\n }\n \n for (let i = 1; i < list.length; i += 1) {\n if ((list[i - 1] + 1) !== list[i]) {\n flush();\n }\n queue.push(list[i]);\n }\n flush();\n \n return result.join(',');\n}", "reverse() {\n //swap the head and tail\n //create a variable that will be what our current node is and initialize it to the head property\n let currentNode = this.head;\n //set the current head node to the tail\n this.head = this.tail\n //set the tail node equal to the current head\n this.tail = currentNode;\n //create a variable called next (node after the current node);\n let next;\n //create a variable called prev (node prior to the currentNode) --> initially will be null because there will be nothing prior to the first node (the tail);\n //it needs to be null so that tail.next is null \n let prev = null;\n\n //loop through the list\n for (let i = 0; i < this.length; i++) {\n //next will be set equal to whatever the currentNode's next property is (whatever the current node is pointing to at the moment)\n next = currentNode.next;\n //in order to reverse the direction that the the current node is pointing to, we need to set the current node's next property to equal the previous node (which initially will be null)\n currentNode.next = prev;\n //then shift the window over and set the previous node equal to the current node\n prev = currentNode;\n //then the currentNode now will become the next node\n currentNode = next;\n }\n //return the list;\n return this;\n }", "function attachDownButtons(li) {\n let down = document.createElement('button');\n down.id = \"downButton\";\n down.className = \"myButton\";\n down.innerHTML = \"down\";\n li.appendChild(down);\n}", "constructor(list) {\n // original array\n this.current = list.sort();\n // indicates whether there are more permutations\n this.done = false;\n // directional info for permutation algorithm\n this.dir = new Map();\n for (let i = 0; i < list.length; ++i) {\n this.dir.set(list[i], true);\n }\n }", "function descending(numbers) {\n var result = [];\n for (var i = numbers.length - 1; i >= 0; i--) {\n result.push(numbers[i]);\n }\n return result;\n}", "function getDifferenceListTest() {\n return this.getDifferenceList(20, 5);\n}", "function processList(editor, command) {\n var clonedNode;\n var relativeSelectionPath;\n if (roosterjs_editor_dom_1.Browser.isChrome && command == \"outdent\" /* Outdent */) {\n var parentLINode = editor.getElementAtCursor('LI');\n if (parentLINode) {\n var currentRange = editor.getSelectionRange();\n if (currentRange.collapsed ||\n (editor.getElementAtCursor('LI', currentRange.startContainer) == parentLINode &&\n editor.getElementAtCursor('LI', currentRange.endContainer) == parentLINode)) {\n relativeSelectionPath = roosterjs_editor_dom_1.getSelectionPath(parentLINode, currentRange);\n // Chrome has some bad behavior when outdenting\n // in order to work around this, we need to take steps to deep clone the current node\n // after the outdent, we'll replace the new LI with the cloned content.\n clonedNode = parentLINode.cloneNode(true);\n }\n }\n workaroundForChrome(editor);\n }\n var existingList = editor.getElementAtCursor('OL,UL');\n editor.getDocument().execCommand(command, false, null);\n var newParentNode;\n editor.queryElements('.' + TEMP_NODE_CLASS, function (node) {\n newParentNode = node.parentNode;\n editor.deleteNode(node);\n });\n var newList = editor.getElementAtCursor('OL,UL');\n if (newList == existingList) {\n newList = null;\n }\n if (newList && clonedNode && newParentNode) {\n // if the clonedNode and the newLIParent share the same tag name\n // we can 1:1 swap them\n if ((clonedNode instanceof HTMLElement)) {\n if (newParentNode instanceof HTMLElement && clonedNode.tagName == newParentNode.tagName) {\n newList.replaceChild(clonedNode, newParentNode);\n }\n if (relativeSelectionPath && document.body.contains(clonedNode)) {\n var newRange = roosterjs_editor_dom_1.getRangeFromSelectionPath(clonedNode, relativeSelectionPath);\n editor.select(newRange);\n }\n }\n // The alternative case is harder to solve, but we didn't specifically handle this before either.\n }\n return newList;\n}" ]
[ "0.6139434", "0.5881532", "0.5802744", "0.57736415", "0.56161153", "0.5616019", "0.56142086", "0.5579915", "0.55656856", "0.5562994", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55487233", "0.55242175", "0.55146927", "0.54742676", "0.5448748", "0.54340637", "0.538482", "0.5379698", "0.5372546", "0.5351866", "0.5316696", "0.52942485", "0.5257868", "0.52576166", "0.52458555", "0.5241032", "0.52405924", "0.52354485", "0.5234056", "0.5222872", "0.52190197", "0.52172065", "0.5203461", "0.51946115", "0.5188868", "0.5186203", "0.51760626", "0.5172593", "0.51696515", "0.5160028", "0.5132474", "0.51235044", "0.5106767", "0.5099961", "0.50890994", "0.5087353", "0.50848544", "0.5083833", "0.50814164", "0.5072901", "0.507072", "0.5060244", "0.50543016", "0.5052076", "0.50406337", "0.5030244", "0.5020913", "0.50146306", "0.50053024", "0.5003328", "0.49993312", "0.49990332", "0.49966505", "0.49961427", "0.49911126", "0.4990273", "0.49864724", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.49859577", "0.497743", "0.49752384", "0.49728653", "0.49726698", "0.49724716", "0.49675253", "0.49542242", "0.49531254" ]
0.74364036
0
static display components / event handlers
customSizeHandler(newState) { const state = { size: BoardSizes.CUSTOM, rows: newState.rows || this.state.rows, cols: newState.cols || this.state.cols, numMines: newState.numMines || this.state.numMines, }; this.props.changeSize(state); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n this._addChooserHandler();\n this._addLoggerListeners();\n this._addButtonHandler();\n }", "static rendered () {}", "static rendered () {}", "function main() {\n init();\n render();\n handleVisibilityChange();\n}", "displayScene() {\n\n //Process all component nodes\n this.processNode(this.idRoot, null, null, 1, 1);\n }", "function renderStaticView() {\n\t// Text for class view\n\tclassViewText();\n\n\t// Rect for line under title\n\t//classViewLine();\n\t// ORDER LEVEL and FAMILY LEVEL label\n\tstaticLabels();\n\t// Legend\n\t//legend();\n\t//incrementProgress();\n\tinstructions();\n}", "function display() {\n\n doSanityCheck();\n initButtons();\n}", "function displayWidget () \n{\n\tif(!window.TGS || !TGS.IsReady())\n\t{\n\t\treturn;\n\t}\n\n\tinitWidget();\n}", "_registerDisplayListeners () {\n this.display = caller('display', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.hide = caller('hide', {postMessage: window.parent.postMessage.bind(window.parent)})\n }", "static show(id, ...args) {\n const component = this.get(id, \"show\");\n if (component) component.show(...args);\n }", "show() {\n\n }", "async onShow() {\n\t}", "function MessageDisplayWidget() {}", "doodle() {\n this.update()\n this.display()\n }", "function initEventsSimple () {\n\t\t\t$controls.children(\"a\").click(function (evt) {\n\t\t\t\tevt.preventDefault();\n\n\t\t\t\tvar $thisLink = $(this),\n\t\t\t\t\t$links = $controls.find(\"a\"),\n\t\t\t\t\taction = $thisLink.attr(\"href\");\n\n\t\t\t\t$links.removeClass(\"ibm-active\");\n\t\t\t\t$thisLink.addClass(\"ibm-active\");\n\n\t\t\t\tif (action === '#show') {\n\t\t\t\t\t$hideables.slideDown(slideDownSpeed);\n\t\t\t\t\t\n\t\t\t\t\t// Fire stats event so they know someone used this widget and what they clicked on.\n\t\t\t\t\tfireStatsEvent(\"show descriptions\", \"descriptions widget\");\n\t\t\t\t}\n\t\t\t\telse if (action === '#hide') {\n\t\t\t\t\t$hideables.slideUp(slideupSpeed);\n\t\t\t\t\t\n\t\t\t\t\t// Fire stats event so they know someone used this widget and what they clicked on.\n\t\t\t\t\tfireStatsEvent(\"hide descriptions\", \"descriptions widget\");\n\t\t\t\t}\n\t\t\t});\n\t\t}", "_initDisplay(value) {}", "_onUpdateDisplay() {}", "function RenderEvent() {}", "function main() {\n init(fontSize);\n\n renderModel = ReadModel();\n renderUI = ReaderBaseFrame(RootContainer);\n renderModel.init(function (data) {\n renderUI(data);\n });\n\n EventHandler();\n }", "show() {}", "displayScene() {\n // entry point for graph rendering\n //TODO: Render loop starting at root of graph\n //console.log(this.nodes)\n this.components[this.idRoot].display();\n }", "function UI() {\n }", "display() {\n this.object.display();\n }", "display(){\n this.htmlBuilder.build();\n this.displayCityName();\n this.displayTodayWeather();\n this.displayWeekWeather();\n this.displayTimeSlots();\n }", "onShown() {\r\n // Stub\r\n }", "function DisplayFactory() {\n }", "yourMethodHere() {\n // any display logic, style, conditional rendering etc\n }", "onShow() {}", "onShow() {}", "onShow() {}", "onShow() {}", "function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n doSomethingAfterRendering(); // 렌더 이후 처리함수 (예 - 서버접속)\n }", "_renderNewRootComponent(/* instance, ... */) { }", "async show() {\n \n }", "function UI() {}", "function UI() {}", "function UI() {}", "function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n }", "showEvents() {\n this.showEventTimespans();\n this.showRaterTimelines();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "function UI(){}", "function UI(){}", "function display(){\r\n\r\n \r\n}", "function changeDisplay(){\n}", "render(){\r\n\r\n\t}", "display() {\n if(this.state.showEvent) {\n return(\n <ShowEvent showCalendar={this.showCalendar} event={this.state.selectedEvent} removeEventHandler={this.removeEventHandler}/>\n )\n } else if(this.state.addNewEvent) {\n return(\n <AddEventHandler moment={this.state.m} addEvent={this.addEvent} showCalendar={this.showCalendar}/>\n )\n } else if(this.state.showCalendar) {\n return(\n <div className=\"calendar\">\n <div className=\"headerBarCalendar\">Calendar</div>\n <div className=\"menu\">\n <button onClick={this.showNewEventHandler}>New Event</button>\n </div>\n <BigCalendar\n selectable\n events={this.props.events}\n defaultDate={new Date(2017, 9, 27)}\n onSelectEvent={event => this.showEvent(event)}\n />\n </div>\n )\n }\n }", "function Main(){\n PubSub.call(this); // super();\n\n // ui system\n this.screens = new Screens(this);\n\n this.onceOn('init', this.init, this);\n }", "function main() {\n\t\t\thtmlModule = new htmlUtil(); // View creation / HTML logic\n\t\t\tarrModule = new arrMethods(); // Array Method shortcuts\n\t\t\tmsg = htmlModule.msg; // Logging\n\t\t\tmsg.set(\"Starting Module\");\n\n\t\t\t// Setup Form.\n\t\t\ttempForm();\n\t\t}", "displayScene() {\n\t\n\t\tif (this.scene.interface.isKeyPressed(\"KeyM\") == true)\n\t\t\tthis.changeMaterials();\n\n\t\tvar root = this.components[this.root];\n\t\tthis.displayComponent(root, root.materials[root.currentMaterial], root.texture, root.texS, root.texT);\n\t\n\t}", "onAfterRendering() {}", "displayScene()\r\n {\r\n this.traverseGraph(this.components[this.idRoot], this.components[this.idRoot].materials, this.components[this.idRoot].texture);\r\n }", "constructor()\n {\n super();\n this.addHandlerShowWindow();\n this.addHandlerHideWindow();\n }", "init() {\n this.$showButton.addEventListener(\"click\", this.onShowButtonClick);\n this.$form.addEventListener(\"submit\", this.onFormSubmit);\n }", "handleVisualize() {\n const { visualizeHandler } = this.props;\n visualizeHandler();\n }", "function main() {\n MenuItem.init();\n sizeUI();\n }", "domListener(){\n this.menuDisplay([\"file\",\"rotate\",\"brush\",\"outline\",\"fills\",\"size\"]);\n }", "render() { }", "render() {\n\n\t}", "render() {\n\n\t}", "_render() {\n\n this._el.innerHTML = `\n <div class='itk-slider'>\n <button class='show-prev-btn'> left </button>\n <img class='slide-img' src=''>\n <button class='show-next-btn'> right </button>\n </div>`;\n\n this.showPrevBtn = this._el.querySelector('.show-prev-btn');\n this.showNextBtn = this._el.querySelector('.show-next-btn');\n this.slideImage = this._el.querySelector('.slide-img');\n }", "onLoad(evt) {\n show(evt, option);\n }", "build() {\r\n this.defineComponents();\r\n this.render();\r\n this.initEventHandlers();\r\n }", "show() {\n super.show();\n this.component.refresh();\n }", "render(){\n console.log('Render Fired')\n return(\n <div>Lifecycle Method Examples</div>\n )\n }", "render_display() {\n this.element.fadeIn();\n this.visible = true;\n }", "function render() {\n\n\t\t\t}", "function displayToScreen() {\n\n\n\t}", "function functionDelegator() {\n colorCalc();\n showColors();\n displayHex();\n displayRGB();\n displayHSL();\n}", "function init() { render(this); }", "renderScreenContent(){}", "function on_paint() {\r\n menu_dt()\r\n menu_idt()\r\n menu_tgt()\r\n menu_aa()\r\n menu_vis()\r\n menu_msc()\r\n handle_vis()\r\n handle_msc_two()\r\n}", "getEventsToRender() {}", "function render() {\n\t\t\t}", "_renderScreen() {\n\t\tif (this._el && this._component) {\n\t\t\tthis._component.render(this._el);\n\t\t}\n\t}", "function module_interface_display(){\n\n $('#main_description').html(g.module_lang.text[g.module_lang.current].main_description);\n\n g.viz_keylist.forEach(function(key){\n interface_titlesscreate(key);\n interface_buttonscreate(key,g.viz_definition[key].buttons_list);\n interface_buttoninteraction(key,g.viz_definition[key].buttons_list);\n });\n\n interface_menucreate();\n interface_menuinteractions();\n\n\n function interface_titlesscreate(key){\n $('#chart_'+key+'_title').html('<b>' + g.module_lang.text[g.module_lang.current]['chart_'+key+'_title'] + '</b><br>' + g.module_lang.text[g.module_lang.current].filtext + ' ' );\n }\n\n function interface_buttonscreate(key,buttons) {\n var html = '';\n buttons.forEach(function(button){\n switch(button){\n case 'reset': \n var icon = '↻';\n break;\n case 'help':\n var icon = '?'; \n break;\n case 'parameters':\n var icon = '⚙';\n break;\n case 'lockcolor': // to be implemented\n var icon = '⬙';\n break;\n case 'expand': // to be implemented\n var icon = '◰';\n break;\n case 'toimage': // to be implemented\n var icon = 'I';\n break;\n\n }\n html += '<button class=\"btn btn-primary btn-sm button '+button+'\" id=\"'+button+'-'+key+'\">'+icon+'</button>';\n });\n $('#buttons-'+key).html(html);\n }\n\n function interface_buttoninteraction(key1,buttons) {\n buttons.forEach(function(button){\n switch(button){\n case 'reset': \n $('#'+button+'-'+key1).click(function(){\n if(key1 == g.viz_timeline){menu_pausePlay();}\n if(key1 == 'multiadm'){\n if ($('#select-'+g.geometry_keylist[0]).val() == 'NA') {\n zoomToGeom(g.geometry_data[g.geometry_keylist[0]],g.viz_definition.multiadm.maps[g.geometry_keylist[0]]);\n }else{\n $('#select-'+g.geometry_keylist[0]).val('NA').change();\n }\n g.geometry_keylist.forEach(function(key2,key2num){\n g.viz_definition[key1].charts[key2].filterAll();\n });\n }else{\n g.viz_definition[key1].chart.filterAll();\n }\n dc.redrawAll(); \n });\n break;\n case 'help':\n $('#'+button+'-'+key1).click(function(){\n g.intro_definition.goToStep(g.intro_step[key1]).start();\n }); \n break;\n case 'parameters': // to be implemented\n $('#'+button+'-'+key1).click(function(){\n window.scrollTo(0, 0);\n \n if(g.medical_datatype == 'outbreak'){\n $('.modal-dialog').css('width','30%'); \n $('.modal-dialog').css('margin-right','2.5%'); \n }else{\n $('.modal-dialog').css('height','7%'); \n $('.modal-dialog').css('width','90%'); \n $('.modal-dialog').css('margin-top','1.5%'); \n $('.modal-dialog').css('margin-left','10%'); \n }\n\n var html = '<div class=\"row\">';\n\n \n // Load Optional Module: module-colorscale.js\n //------------------------------------------------------------------------------------\n html += '<div class=\"col-md-12\">';\n html += module_colorscale_display();\n html += '</div>';\n html += '<div class=\"btn btn-primary btn-sm button\" id=\"gobacktodashboard\"><b>X</b></div>';\n\n html += '</div>';\n $('.modal-content').html(html);\n module_colorscale_interaction();\n $('#modal').modal('show');\n\n $('#gobacktodashboard').click(function(){\n $('#modal').modal('hide');\n });\n });\n break;\n case 'expand': // to be implemented\n $('#'+button+'-'+key1).click(function(){\n g.geometry_keylist.forEach(function(key) {\n if ($('#map-' + key).height() <= 500) {\n setTimeout(function() {\n $('#map-' + key).css('height','845px');\n g.viz_definition.multiadm.maps[key].invalidateSize(true);\n }, 500);\n setTimeout(function() {\n zoomToGeom(g.geometry_data[key],g.viz_definition.multiadm.maps[key]);\n }, 1000);\n }else{\n setTimeout(function() {\n $('#map-' + key).css('height','410px');\n g.viz_definition.multiadm.maps[key].invalidateSize(true);\n }, 500);\n setTimeout(function() {\n zoomToGeom(g.geometry_data[key],g.viz_definition.multiadm.maps[key]);\n },1000); \n }; \n });\n });\n break;\n case 'lockcolor': // to be implemented\n $('#'+button+'-'+key1).click(function(){\n module_colorscale_lockcolor('Manual');\n });\n break;\n\n case 'toimage-a':\n $('#'+button+'-'+key1).click(function(){\n var temp_id = 'chart-' + key1;\n var html = d3.select('.container svg')\n .attr('title', 'some title here')\n .attr('version', 1.1)\n .attr('xmlns', 'http://www.w3.org/2000/svg')\n .node().parentNode.innerHTML;\n\n var img = new Image();\n // http://en.wikipedia.org/wiki/SVG#Native_support\n // https://developer.mozilla.org/en/DOM/window.btoa\n img.src = \"data:image/svg+xml;base64,\" + btoa(svg_xml);\n\n var canvas = document.getElementById('mycanvas');\n var img = canvas.toDataURL('image/png');\n document.write('<img src=\"' + img + '\"/>');\n });\n\n\n case 'toimage-b':\n var fs = require('fs');\n var db_new = document.getElementById(button+'-'+key1);\n \n function handleDbNewFile(e) {\n console.log(e);\n var files = e.target.files;\n var f = files[0];\n var name = f.name;\n var path = f.path;\n\n var map = g.viz_definition.multiadm.maps.admN1;\n leafletImage(map, doImage);\n\n function doImage(err, canvas) {\n var img = document.createElement('img');\n var dimensions = map.getSize();\n img.width = dimensions.x;\n img.height = dimensions.y;\n img.src = canvas.toDataURL();\n\n fs.writeFile('', img, function(err) {\n if(err) {\n console.log(err); //CONSOLE\n } else {\n console.log(\"exported\", new Date()); //CONSOLE\n }\n });\n }\n }\n if(db_new.addEventListener) db_new.addEventListener('click', handleDbNewFile);\n\n $('#'+button+'-').click(function(){\n\n var snapshot = document.getElementById('svgdataurl3');\n var map = g.viz_definition.multiadm.maps.admN1;\n\n leafletImage(map, doImage);\n\n function doImage(err, canvas) {\n var img = document.createElement('img');\n var dimensions = map.getSize();\n img.width = dimensions.x;\n img.height = dimensions.y;\n img.src = canvas.toDataURL();\n\n fs.writeFile('', img, function(err) {\n if(err) {\n console.log(err); //CONSOLE\n } else {\n console.log(\"onexport\", new Date()); //CONSOLE\n console.log(\"JSON saved to \" + outputFilename); //CONSOLE\n }\n }); \n snapshot.innerHTML = '';\n snapshot.appendChild(img);\n }\n\n var snapshot = document.getElementById('svgdataurl2');\n var chart = g.viz_definition.case_bar.chart;\n\n //dcImage(chart, doImage);\n\n /*function doImage(err, canvas) {\n var img = document.createElement('img');\n var dimensions = map.getSize();\n img.width = dimensions.x;\n img.height = dimensions.y;\n img.src = canvas.toDataURL();\n snapshot.innerHTML = '';\n snapshot.appendChild(img);\n }*/\n \n var encoresvg = g.viz_definition.case_bar.chart.svg();\n\n\n //get svg element.\n // var svg = document.getElementById(\"chart-case_bar\").getSVGDocument();\n //var svg = d3.select('#chart-case_bar').select(\"svg\");\n\n var foo = d3.select('#chart-case_bar').select(\"svg\");\n\n // later, where you don't have someDOM but you do have foo\n var svg = foo[0][0];\n //var svg = someDom.ownerSVGElement;\n\n //get svg source.\n var serializer = new XMLSerializer();\n var source = serializer.serializeToString(svg);\n\n //add name spaces.\n if(!source.match(/^<svg[^>]+xmlns=\"http\\:\\/\\/www\\.w3\\.org\\/2000\\/svg\"/)){\n source = source.replace(/^<svg/, '<svg xmlns=\"http://www.w3.org/2000/svg\"');\n }\n if(!source.match(/^<svg[^>]+\"http\\:\\/\\/www\\.w3\\.org\\/1999\\/xlink\"/)){\n source = source.replace(/^<svg/, '<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\"');\n }\n\n //add xml declaration\n source = '<?xml version=\"1.0\" standalone=\"no\"?>\\r\\n' + source;\n\n //convert svg source to URI data scheme.\n var url = \"data:image/svg+xml;charset=utf-8,\"+encodeURIComponent(source);\n\n function importSVG(sourceSVG, targetCanvas) {\n // https://developer.mozilla.org/en/XMLSerializer\n svg_xml = (new XMLSerializer()).serializeToString(sourceSVG);\n var ctx = targetCanvas.getContext('2d');\n\n // this is just a JavaScript (HTML) image\n var img = new Image();\n // http://en.wikipedia.org/wiki/SVG#Native_support\n // https://developer.mozilla.org/en/DOM/window.btoa\n img.src = \"data:image/svg+xml;base64,\" + btoa(svg_xml);\n\n img.onload = function() {\n // after this, Canvas’ origin-clean is DIRTY\n \n ctx.drawImage(img,100, 200);\n }\n }\n console.log(encoresvg);\n \n var test = document.getElementById(\"svgdataurl\");\n\n console.log(test);\n\n importSVG(encoresvg[0][0],test);\n\n var html = encoresvg[0][0]\n .attr('title', 'some title here')\n .attr('version', 1.1)\n .attr('xmlns', 'http://www.w3.org/2000/svg')\n .node().parentNode.innerHTML;\n\n var img = new Image();\n // http://en.wikipedia.org/wiki/SVG#Native_support\n // https://developer.mozilla.org/en/DOM/window.btoa\n img.src = \"data:image/svg+xml;base64,\" + btoa(svg_xml);\n\n var canvas = document.getElementById('svgdataurl2');\n var img = canvas.toDataURL('image/png');\n document.write('<img src=\"' + img + '\"/>');\n hiddenDiv.remove();\n\n }); \n break;\n }\n });\n }\n\n function interface_menucreate(){\n\n // Menu title\n var html = '<div id=\"menu_title\" style=\"font-size:1.2em; text-align:center;\"><b>'+g.module_lang.text[g.module_lang.current].interface_menutitle+'</b></div>';\n\n // Reset button\n html += '<a id=\"menu_reset\" class=\"menu_button btn btn-primary btn-sm\" href=\"javascript:menu_reset();\">'+g.module_lang.text[g.module_lang.current].interface_menureset+'</a>';\n \n // Reload button\n html += '<a id=\"menu_reload\" class=\"menu_button btn btn-primary btn-sm\" href=\"javascript:history.go(0)\">'+g.module_lang.text[g.module_lang.current].interface_menureload+'</a>';\n\n // Help button\n html += '<button id=\"menu_help\" class=\"menu_button btn btn-primary btn-sm\">'+g.module_lang.text[g.module_lang.current].interface_menuhelp+'</button>';\n\n // Quick access to epiweeks button\n html += '<div id=\"menu_epiwk\"><p>'+g.module_lang.text[g.module_lang.current].interface_menuepiwk+'</p>';\n html +='<button class=\"menu_button_epiwk btn btn-primary btn-sm\" id=\"menu_epi4\">4</button>';\n html +='<button class=\"menu_button_epiwk btn btn-primary btn-sm\" id=\"menu_epi8\">8</button>';\n html +='<button class=\"menu_button_epiwk btn btn-primary btn-sm\" id=\"menu_epi12\">12</button>';\n html +='<div>';\n\n // Autoplay button\n html += '<button id=\"menu_autoplay\" class=\"menu_button btn btn-primary btn-sm\">'+g.module_lang.text[g.module_lang.current].interface_menuautoplay.play+'</button>'\n\n // Record count\n //html += '<div id=\"menu_count\"><b><span class=\"filter-count \"></span></b><br>'+g.module_lang.text[g.module_lang.current].interface_menucount[0]+'<br><b><span class=\"total-count \"></span></b><br>'+g.module_lang.text[g.module_lang.current].interface_menucount[1]+'</div>';\n html += '<div id=\"menu_count\">'+g.module_lang.text[g.module_lang.current].interface_menucount[2]+'<br><span id=\"case-info\">'+g.module_lang.text[g.module_lang.current].interface_menucount[3]+' <b><span class=\"filter-count headline\"></span></span></b><br><span id=\"death-info\">'+g.module_lang.text[g.module_lang.current].interface_menucount[4]+' <b><span class=\"filter-count headline\"></span></span></b><br></div>';\n\n /*<span style=\"font-size:2em;\">Chiffres clés :\n <span id=\"casetotal\">Cas : <span class=\"filter-count headline\"></span></span>\n <span id=\"deathtotal\"> | Décès : <span class=\"filter-count headline\"></span></span></span>*/\n\n $('#menu').html(html);\n }\n\n function interface_menuinteractions(){\n\n g.interface_autoplayon = false;\n g.interface_autoplaytime = 0;\n g.interface_autoplaytimer = 0;\n\n $('#menu_autoplay').on('click',function(){\n if (g.interface_autoplayon) {\n menu_pausePlay();\n dc.redrawAll();\n }else{\n g.viz_definition[ g.viz_timeline].chart.filterAll();\n module_colorscale_lockcolor('Auto'); \n g.interface_autoplayon = true;\n $('#menu_autoplay').html(g.module_lang.text[g.module_lang.current].interface_menuautoplay.pause);\n $('#chart-'+ g.viz_timeline).addClass(\"noclick\");\n if(g.viz_timeshare){\n g.viz_timeshare.forEach(function(key) {\n $('#chart-'+ key).addClass(\"noclick\");\n });\n }\n g.interface_autoplaytime = 0;\n g.interface_autoplaytimer = setInterval(function(){menu_autoPlay()}, 500);\n };\n });\n\n $('#menu_help').click(function(){\n g.intro_definition.start();\n });\n\n // Quick epiweeks access\n var quick_filter_list = [4,8,12];\n quick_filter_list.forEach(function(wknumber){\n $('#menu_epi'+wknumber).on('click',function(){\n var temp_mode = g.colorscale_modecurrent;\n g.colorscale_modecurrent = 'Manual';\n menu_pausePlay();\n var temp_domain = g.viz_definition[ g.viz_timeline].domain.slice(Math.max(g.viz_definition[ g.viz_timeline].domain.length - wknumber - 1, 2));\n temp_domain.pop();\n temp_domain.forEach(function(wk){\n g.viz_definition[g.viz_timeline].chart.filter(wk);\n if(g.viz_timeshare){\n g.viz_timeshare.forEach(function(key) {\n g.viz_definition[key].chart.filter(wk);\n });\n }\n });\n g.colorscale_modecurrent = temp_mode;\n module_colorscale_lockcolor('Auto');\n dc.redrawAll();\n });\n });\n }\n}", "function UI() {\n\n}", "displayScene() {\n var root = this.components[this.root];\n if (root == null)\n return \"[displayScene]: root node does not exist!\";\n\n // display scene graph starting at the root component\n root.display(root.materials[root.currentMaterialIndex][1], root.texture);\n }", "onShow(e) {\n // this.showShort('onShow')\n }", "static renderGlobalView() {\n GestionPages.gestionPages(\"dashboard\");\n let contenu = `\n <h5><em>Production Dashboard</em></h5>\n <div id=\"dash\">\n <div id=\"stateorders\">\n <p>State of orders</p>\n </div>\n\n <div id=\"statemachines\">\n <p>State of Machines</p>\n </div>\n\n <div id=\"statistics\">\n <p>Statistics</p>\n </div>\n </div>`;\n document.querySelector(\"#dashboard\").innerHTML = contenu;\n\n //Display page \"state of orders\"\n $(\"#stateorders\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStateOrders();\n });\n\n //Display page \"state of machines\"\n $(\"#statemachines\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStateMachines();\n });\n\n //Display page \"statistics\"\n $(\"#statistics\").click(event => {\n event.preventDefault();\n GestionPages.gestionPages(\"dashboard\");\n Dashboard.renderStatistics();\n });\n }", "render() {\n }", "static AddControl() {}", "render() {\n\n }", "display(){\r\n\r\n this.scene.setActiveShader(this.terrainShader);\r\n this.heightmap.bind(1);\r\n this.colormap.bind(2);\r\n \r\n super.display();\r\n this.scene.setActiveShader(this.scene.defaultShader);\r\n }", "function Events() { }", "function initEvents () {\n\t\t\tif (config.type === \"simple\") {\n\t\t\t\tinitEventsSimple();\n\t\t\t}\n\t\t\telse if (config.type === \"panel\") {\n\t\t\t\tinitEventsPanel();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow \"Invalid showhide type specified: \\\"\" + config.type + \"\\\". Type must be \\\"simple\\\" or \\\"panel.\\\"\";\n\t\t\t}\n\n\t\t\t$(\"h2[data-open='true'] a\", $container).each(function(){\n\t\t\t\topenPanel($(this));\n\t\t\t});\n\t\t}", "static start(){\n this.addressField = new DisplayField(addressFieldId,4,\"UPS-\");\n this.dataField = new DisplayField(dataFieldId,2,\"80\");\n\n Controller.setDisplayFields(this.addressField,this.dataField);\n }", "function showALL() {\n\tshowEP();\n\t showStatics();\n}", "render() {\n this.renderComponents() // dial + outputs, algedonode, brass pads, strips, lights\n this.renderLabels()\n }", "render() {\n // Subclasses should override\n }", "_render()\n {\n if (this.isDisabled())\n return;\n\n this._setContentSizeCss();\n this._setDirection();\n const paragraph = html`<p>${this.text}</p>`;\n let anchor = \"\";\n let action = \"\";\n if (this.link && this.linkText)\n anchor = html`<a href=\"${this.link}\" target=\"_blank\">${this.linkText}</a>`;\n if (this.action && this.actionText)\n action = html`${anchor ? \" | \" : \"\"}<a href=\"javascript:void(0)\" @click=${this.action}>${this.actionText}</a>`;\n let heading = \"\";\n if (this.heading)\n heading = html`<h4>${this.heading}</h4>`;\n\n render(html`${heading}${paragraph}<div id=\"links\">${anchor}${action}</div>`, this.tooltipElem);\n }", "onRender () {\n\t\tthis.registerComponent(App.Compontents, \"app-controls\", TopBarControls, this.$el.find(\"#topbar-container\"), { title: \"Home\" });\n }", "function eventHandlersInit(){\r\n $.logEvent('[dataVisualization.core.eventHandlersInit]');\r\n \r\n var activeModuleObj;\r\n var interactivePluginId;\r\n var inputObj;\r\n \r\n $('#' + dataVisualization.configuration.visualizationWrapperId).on('click', '.module A.reload',function(e){\r\n e.preventDefault();\r\n \r\n activeModuleObj = $(this).parents('.module');\r\n interactivePluginObj = activeModuleObj.find('[data-initialized=\"true\"]');\r\n \r\n // Show the overlay\r\n activeModuleObj\r\n .find('.overlay')\r\n .show();\r\n \r\n // Unload the active component\r\n interactivePluginObj\r\n .removeAttr('style')\r\n .empty();\r\n \r\n // Remove any '.centre-value' DOM elements\r\n $('.centre-value',activeModuleObj).remove();\r\n \r\n // Remove any standalone keys\r\n $('.key',activeModuleObj).remove();\r\n \r\n // Initialize the required functionality for the desired module\r\n dataVisualization.dispatcher.moduleInitialize({\r\n id: interactivePluginObj.attr('id')\r\n })\r\n });\r\n }", "onShowing() {\r\n // Stub\r\n }", "$render(displayRef) {\n if(this.$alive)\n this.render.apply(this, [this, displayRef]);\n }", "function Display () {\n\tthis.board = new five.Board({io: new Raspi()});\n\tthis.led = null;\n\n\tthis.board.on('ready', function () {\n\t\t// Create HT16K33 controller.\n\t\tthis.led = new five.Led.Digits({controller: 'HT16K33', digits: 5});\n\t\t// Set time, if provided.\n\t\tif (this.moment) this.set(this.moment);\n\t}.bind(this));\n}", "show() { return this.tellModule(\"show\") }", "function registerEventHandlers() {\n\n\t\tEventDispatcher.addEventListener( \"LOAD_BUTTON_CLICKED\" , function(){\n\n\t\t\t// Increment number of visible the Articles model unless all are visible\n\t\t\tif( ArticleStore.visibleArticles < ArticleStore.totalArticles ) {\n\n\t\t\t\tArticleStore.visibleArticles++;\n\t\t\t\t\n\t\t\t\trender();\n\n\t\t\t}\n\n\t\t});\n\t}", "render() { this.screen.render() }", "render() {\n return this.toggleEntryDisplay();\n }" ]
[ "0.6961778", "0.6678392", "0.6678392", "0.6509121", "0.64703476", "0.6403252", "0.6342639", "0.6260272", "0.6232546", "0.6196294", "0.6187066", "0.61865664", "0.61660933", "0.6132773", "0.61145025", "0.6035958", "0.6030676", "0.6020146", "0.60148925", "0.59924364", "0.5982424", "0.59580237", "0.59440345", "0.5908575", "0.5907502", "0.58971244", "0.5883626", "0.5879647", "0.5879647", "0.5879647", "0.5879647", "0.5872637", "0.5870816", "0.5844513", "0.5834525", "0.5834525", "0.5834525", "0.5834297", "0.5798839", "0.5794219", "0.5794219", "0.5794219", "0.5771452", "0.5771452", "0.57647175", "0.57608426", "0.57497096", "0.57466197", "0.57455367", "0.5744011", "0.5738486", "0.57288575", "0.5723277", "0.57032144", "0.57012343", "0.5692665", "0.5687786", "0.56762165", "0.56757295", "0.5655186", "0.5655186", "0.56500757", "0.5641316", "0.5635106", "0.5632153", "0.56320965", "0.5621286", "0.5619358", "0.5616931", "0.5610932", "0.56013817", "0.55993706", "0.55943716", "0.55888784", "0.55795723", "0.5579087", "0.55779636", "0.5577819", "0.55731446", "0.55728245", "0.55663717", "0.556405", "0.5562432", "0.5553061", "0.5551731", "0.5550552", "0.5549883", "0.55466616", "0.5545335", "0.5538651", "0.5534944", "0.5526879", "0.5526235", "0.55258274", "0.5525569", "0.5523121", "0.551844", "0.55172336", "0.55088836", "0.54960126", "0.54959923" ]
0.0
-1
This is a recursive function that draws the prime factorization tree for the input number n.
function primeFactors(n, p, x, y, prev) { if (n <= 1) { graph.addNode(x, y, n.toString(), radius); } while (n > 1) { // base case if (n == p) { let leaf = graph.addNode(x, y, n.toString(), radius, radius); leaf.nodeEllipse.style.stroke = '#1bc075'; if (prev != null) { let edge = graph.addEdge(prev, leaf).style.stroke = '#333333'; } return; } // check if the current prime divides the current number. If so, draw the // and the prime factor nodes with an edge between them. Otherwise, call this // function again with the next prime number. if (n % p == 0) { // draw nodes and edges let node = graph.addNode(x, y, n.toString(), radius, radius); node.nodeEllipse.style.stroke = '#333333'; let leaf = graph.addNode(x - 64, y + 64, p.toString(), radius, radius); if (prev) { graph.addEdge(prev, node).style.stroke = '#333333'; } graph.addEdge(node, leaf).style.stroke = '#333333'; leaf.nodeEllipse.style.stroke = '#1bc075'; // update variables n = n / p; x += 64; y += 64; prev = node; } else { p = nextPrime(p); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function primeFactorization(n) {\n var factors = [],\n divisor = 2;\n\n while (n >= 2) {\n if (n % divisor == 0 ) {\n factors.push(divisor);\n n = n / divisor;\n }\n else {\n divisor++;\n }\n }\n return factors;\n}", "function primeFactors(n){\n let result = \"\";\n let factors = {};\n let f = 2; // lowest possible factor\n while (n > 1) {\n if (n % f === 0) {\n if (!factors.hasOwnProperty(f)) {\n factors[f] = 1;\n } else {\n factors[f]++;\n }\n n /= f;\n } else {\n f++;\n }\n }\n for (let key of Object.keys(factors)) {\n if (factors[key] === 1) {\n result += `(${key})`;\n } else {\n result += `(${key}**${factors[key]})`;\n }\n }\n return result;\n}", "function recursiveFactorial(n) {\n if (n <= 1){\n return 1;\n } else {\n return n * recursiveFactorial(n - 1);\n }\n}", "function recursiveFac(n) {\n if (n === 0) { return 1 } \n else { return n * recursiveFac(n - 1) }\n}", "function recursiveFactorial(n) {\n //base case\n if(n == 0 || n == 1){\n return 1;\n //recursive case\n }else{\n return n * recursiveFactorial(n-1);\n }\n}", "function primeFactors(n) {\n while (n != 1) {\n for (let i = 2; i * i <= n; i++) {\n if (n % i == 0) {\n console.log(i + \" \");\n n = Math.floor(n / i);\n break;\n }\n if (i == Math.floor(Math.sqrt(n))) {\n // if we reach √n and still haven't found a factor then the number is prime\n console.log(n + \" \");\n n = Math.floor(n / n);\n }\n }\n }\n}", "primefactor(n) {\n console.log('prime factors of ' + n + ' is :')\n while (n % 2 == 0) {\n console.log(\"2 \")\n n /= 2;\n }\n for (var i = 3; i * i <= n; i++) {\n while (n % i == 0) {\n console.log(i + \" \");\n n /= i;\n\n }\n }\n if (n > 2) {\n console.log(n);\n }\n }", "function fac(n) {\n if (n <= 1)\n\treturn 1;\n return n*fac(n-1);\n}", "function primeFactorization(n) {\n var ret = [];\n var divider = 2;\n while(n > 1) {\n if(n%divider === 0) {\n ret.push(divider);\n n = n/divider;\n }\n else {\n divider++;\n }\n }\n return ret;\n}", "function factarialrecursive(n) {\n if (n == 0) {\n return 1;\n }\n else{\n return n * factarialrecursive(n-1);\n }\n}", "function factorial(n) {\n if (n == 0)\n return 1;\n else\n return n * factorial (n);\n // ^ Problem: the variable n is never reduced, so the recursion goes on. You get stuck running down Bowser's hallway (i.e. in an infinite loop).\n }", "function PrimeFactors(n){\n var factors = [],\n divisor = 2;\n\n while(n>2){\n if (n % divisor == 0){\n factors.push(divisor);\n n= n/ divisor;\n }\n else{\n divisor ++;\n } \n }\n return factors;\n}", "function primeFactors(n) {\n var factors = [];\n if (n < 2 || !Number.isInteger(n)) return factors;\n\n // function to help find next prime to divide by...\n function isPrime(n) {\n if (n < 2 || !Number.isInteger(n)) return false;\n for (var i = 2; i <= n / 2; i++) {\n if (Number.isInteger(n / i)) return false;\n }\n return true;\n }\n\n var prime = 2; // start with smallest prime\n while (!isPrime(n)) {\n if (Number.isInteger(n / prime)) {\n factors.push(prime);\n n = n / prime;\n } else {\n // find next prime\n prime++;\n while (!isPrime(prime)) prime++;\n }\n }\n factors.push(n);\n return factors;\n}", "function primeFactors(n) {\n let factors = [];\n while (n >= 2 && n % 2 === 0) {\n factors.push(2);\n n /= 2;\n }\n\n for (let i = 3; i <= Math.sqrt(n); i += 2) {\n while (n % i === 0) {\n factors.push(i);\n n /= i;\n }\n }\n\n if (n > 2) factors.push(n);\n\n return factors;\n}", "function primeFactors(n) {\n let i = 2, factors = [];\n while (i * i <= n) {\n if (n % i) {\n i++;\n } else {\n n = Math.floor(n / i);\n factors.push(i);\n }\n }\n if (n > 1) factors.push(n);\n return factors;\n}", "function factorial(n) {\n if (n === 0) {\n return 1;\n }\n // This is it! Recursion!!\n return n * factorial(n - 1);\n }", "function getAllPrimeFactors(n){\n\n var primesTilln = [], q, primeFactors = [], obj, str = \"\", add;\n //generate all prime numbers til 'n'\n //here we are checking till the given number including the given number, to display that, if it self is a prime\n for(var i = 0; i <= n; i++){\n if(isPrime(i)){\n primesTilln.push(i);\n }\n }\n console.log(primesTilln);\n //now decompose 'n' with prime factors available from 'primesTilln'\n for(var j = 0; j <= primesTilln.length; j++){\n //divide 'n' with the primes in 'primesTilln' continously unitll it is divisible by a single prime\n while(n % primesTilln[j] === 0){\n q = n / primesTilln[j];\n n = q;\n primeFactors.push(primesTilln[j]);\n }\n }\n obj = getPrimesAndPowersObj(primeFactors);\n for(var x in obj){\n if(obj[x] > 1){\n add = \"(\" + x + \"**\" + obj[x] + \")\";\n }else if(obj[x] === 1){\n add = \"(\" + x + \")\";\n }\n str = str + add;\n }\n return str;\n}", "function factor (n) {\n var i = n - 1; \n while (i>0) {\n if (n % i === 0) {\n console.log(i);\n }\n i--;\n }\n}", "function primeFactors(n){\n const originalInput = n;\n var factors = [];\n var divisor = 2;\n while (n >= 2) {\n if (n % divisor === 0) {\n factors.push(divisor); // store a found factor\n allPrimes.push(divisor); // store for the next stage\n n = n / divisor;\n } else {\n divisor++;\n }\n }\n primeOccurrences.push(factors);\n // factorsMap.set(`${originalInput}`, factors)\n return factors;\n}", "function primeFactors (n) {\n const factors = []\n let divisor = 2\n\n while (n > 2) {\n if (n % divisor === 0) {\n factors.push(divisor)\n n = n / divisor\n }\n else {\n divisor++\n }\n }\n return factors\n}", "function getFactors(n) {\n // Returns all factors of n, given n>1.\n \n // Return empty list for invalid input.\n if (n <= 1) {\n console.log(\"Warning: Invalid input to getFactors().\");\n return [];\n }\n\n // Initialize variables\n var out = [1, n];\n\n for (var i=2; i <= Math.round(n/2); i++) {\n if (n%i == 0){\n out.push(i);\n }\n }\n\n return out.sort();\n}", "function fact(n){\n if(n==0||n==1)\n return 1\n else{\n return n*fact(n-1)\n }\n}", "function factorial(n){\r\n //base case\r\n if(n == 0 || n == 1){\r\n return 1;\r\n //recursive case\r\n }else{\r\n return n * factorial(n-1);\r\n }\r\n}", "function primeFactorList(n) {\n\tif (n < 1) throw \"Argument error\";\n\tlet result = [];\n\twhile (n != 1) {\n\t\tlet factor = smallestFactor(n);\n\t\tresult.push(factor);\n\t\tn /= factor;\n\t}\n\treturn result;\n}", "function factorial(n) {\n \n if (n === 0) {\n return 1;\n }else {\n return n * factorial(n-1);\n }\n }", "function divisibleTriangleNumber2(n) {\n\n // let counter = 0;\n\n if (n < 2) return 1;\n\n let number = 1;\n let sum;\n let factors = {};\n\n do {\n // get a new number\n number++;\n\n // generate the sum of the number\n sum = number * (number + 1) / 2;\n\n // empty the factors object\n factors = {};\n\n // add obvious factors\n factors[1] = 1;\n factors[sum] = 1;\n\n for (let i = 2; i <= sum / 2; i++) {\n if (sum % i === 0) {\n factors[i] = (factors[i] || 0) + 1;\n }\n // counter++;\n }\n\n } while (Object.keys(factors).length < n)\n\n // console.log(`Iterartions: ${counter}`);\n return sum;\n}", "function factorialWithRecursive(n) {\n if (n == 0) {\n return 1;\n } else {\n return n*factorialWithRecursive(n-1);\n }\n}", "function findFactorial(n) {\n if (n === 1 || n === 0) return 1;\n return n * findFactorial(n - 1);\n}", "function primeFactorList(n) {\n if (n < 1) throw new RangeError(\"Argument error\");\n var result = [];\n\n while (n !== 1) {\n var factor = smallestFactor(n);\n result.push(factor);\n n /= factor;\n }\n\n return result;\n}", "function primeFactorList(n) {\n\t\tif (n < 1)\n\t\t\tthrow new RangeError(\"Argument error\");\n\t\tlet result = [];\n\t\twhile (n != 1) {\n\t\t\tconst factor = smallestFactor(n);\n\t\t\tresult.push(factor);\n\t\t\tn /= factor;\n\t\t}\n\t\treturn result;\n\t}", "function findFactors(n) {\n var factors = [];\n var sq = Math.sqrt(n);\n var i;\n for (i = 1; i <= sq; i++) {\n if (n % i === 0) {\n factors.push(i);\n if (i < sq) {\n factors.push(n / i);\n }\n }\n }\n return factors;\n}", "function factorial(n) {\n //Establish base case\n if (n == 0) {\n return 1;\n } else {\n //Run recursive case\n return n * factorial(n - 1);\n }\n}", "function nFactorial(num) {\nif (num > 1){\nreturn num * nFactorial(num - 1);\n}\nelse {\nreturn 1;\n}}", "function recursiveFactorial(num) {\n // your code here\n}", "function factorial(n){\n if (n === 0){\n \t return 1;\n }\n return (n * factorial(n-1));\n }", "function factorial(n){\n\n\tif (n ==1){\n\t\treturn 1;\n\t}\n\n\treturn bigInt(n).multiply(factorial(n-1));\n}", "function factorial(n) {\n\n // Put your code here.\n if (n < 0) {\n console.log(\"Can't make a factorial from a negative number.\");\n return n;\n }\n // Base case\n if (n === 0) {\n return 1;\n }\n // What's wrong with this picture? Why won't this recursion work?\n return n * factorial(n - 1);\n\n}", "function factorial(n) {\n\tif (n === 1) {\n\t\treturn n;\n\t}\n\treturn n * factorial(n-1);\n}", "function PrimeFactorization(N)\n{\n\tif(isPosInteger(N) & N >=2 & N<MAXLIMIT)\n\t{\n\t\tvar p = 2;\n\t\tvar i = 0;\n\t\tvar arr = new Array();\n\t\tvar txt = N + \" = \";\n\t\twhile (N >= p * p)\n\t\t{\n\t\t\tif (N % p == 0)\n\t\t\t{\n\t\t\t\tarr[i]=p;\n\t\t\t\tN = N / p;\t//divide by prime number\n\t\t\t\ti++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp++;\n\t\t\t}\n\t\t}\n\t\tarr[i]=N;\n\t\t\n\t\t// reporting\t\t\n\t\tvar e=0;\n\t\tfor(var j=0; j<arr.length; j++)\n\t\t{\n\t\t\tb=arr[j];\n\t\t\te++;\n\t\t\tif(arr[j]!=arr[j+1])\n\t\t\t{\n\t\t\t\tif(j==arr.length-1)\n\t\t\t\t{\n\t\t\t\t\tif(e>1)\n\t\t\t\t\t{\n\t\t\t\t\t\ttxt += b + \"^\" + e;\n\t\t\t\t\t}\n\t\t\t\t\telse // e==0\n\t\t\t\t\t{\n\t\t\t\t\t\ttxt += b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif(e>1)\n\t\t\t\t\t{\n\t\t\t\t\t\ttxt += b + \"^\" + e + \" * \";\n\t\t\t\t\t}\n\t\t\t\t\telse // e==0\n\t\t\t\t\t{\n\t\t\t\t\t\ttxt += b + \" * \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te=0;\n\t\t\t}\n\t\t}\n\t\treturn txt;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "function factorial(n){\n if(n === 0){\n return 1\n }\n if (n >= 1){\n return(n) * factorial(n-1);\n\t};\n}", "function factorialRecursive(n) {\n if (n <= 1) return n;\n\n return n * factorialRecursive(n - 1);\n}", "function factorialRecursivo (n) {\n if (isNaN(n) || n === 1) {\n return 1;\n }\n return n * factorialRecursivo(n - 1);\n}", "function factorial(n) {\n if(n==0) {\n return 1;\n }\n return n * calcFactorial(n-1);\n }", "function factorial(n) {\n if (n < 0) {\n // Termination condition to prevent infinite recursion\n console.log('help');\n return;\n }\n // Base case\n if (n === 0) {\n return 1;\n }\n // Recursive case\n return n * factorial(n -1);\n}", "function factorial(n){\n if (n === 0 || n === 1) {\n return 1;\n } else {\n var j = 1;\n for(i=1; i<=n; i++){\n j = j*i;\n }\n return j;\n }\n}", "function factorial(n) {\n if (n === 0) {\n return 1;\n } \n // This is it! Recursion!!\n return n * factorial(n - 1);\n \n}", "function primeFactors(n) {\n\tvar result = [],\n\t\tdivisor = 2;\n\n\twhile (n > 2) {\n\t\tif (n % divisor == 0) {\n\t\t\tresult.push(divisor);\n\t\t\tn = n / divisor;\n\t\t}\n\t\telse {\n\t\t\tdivisor++;\n\t\t}\n\t}\n\n\treturn result;\n}", "function factorial(n) { \n let result;\n if(n !== 1) {\n result = n * factorial(n-1);\n } else {\n result = n;\n }\n return result;\n }", "function factorial(n) {\n if( n===0 || n===1 ) {\n return 1;\n } else {\n return factorial(n-1)*n;\n }\n}", "function factorial(n) {\n\tif (n === 1) return 1;\n\n\treturn n * factorial(n - 1);\n}", "function factorial(n) {\n if (n <= 1) {\n return 1;\n }\n return n * factorial(n-1);\n\n}", "function fact(n) {\n if (n == 0){\n return 1 ;\n }\n else{\n return n * fact(n-1) ;\n }\n}", "function factorial(n) {\n if (n==0) {\n return 1;\n\n }\n else{\n return n* factorial (n-1);\n }\n}", "function recursiveFactorial(number) {\n if (number === 0 {\n return 0;\n }\n if (number === 1) {\n return 1;\n } else if (number > 0) {\n return number * recursiveFactorial(number - 1);\n }\n }", "function factorial(n) { \n // Base Case - when n is equal to 0, we stop the recursion\n if (n === 0) {\n return 1;\n }\n // This is our Recursive Case\n // It will run for all other conditions except when n is equal to 0\n return n * factorial(n - 1);\n }", "function fact(n) {\n if (n <= 1) return 1;\n\n return n * fact(n - 1);\n}", "function factorial(n){\n if(n==0){\n return 1;\n }\n else{\n return n * factorial(n-1);\n }\n}", "function factorial(n) {\n if (!n) {\n return (f[n] = 1);\n }\n return (f[n] = factorial(n - 1) * n);\n }", "function factorial(n){\n if(n === 1){\n return n;\n }\n return n * factorial(n-1);\n}", "function factorial(n){\n if( n === 0){\n return 1;\n }else {\n return n * factorial(n-1);\n }\n}", "function factorial (n){\n\tvar result=1;\n\twhile(n>=1){\n\t\tresult = result * n--;\n\t}\n\treturn result;\n}", "function smallestFactor(n) {\n\tif (n < 2)\n\t\tthrow \"Argument error\";\n\tif (n % 2 == 0)\n\t\treturn 2;\n\tlet end = Math.floor(Math.sqrt(n));\n\tfor (let i = 3; i <= end; i += 2) {\n\t\tif (n % i == 0)\n return i;\n\t}\n\treturn n;\n}", "function factorial(n) {\n //Baseline Condition\n if (n < 2) return 1;\n return n * factorial(n - 1);\n}", "function factorial(n){\n if (n > 1) {\n return n * factorial(n-1)\n }\n return n\n\n}", "function factorial(n){\n //se crea una cache para almecenar los resultados\n if (!this.cache) {\n this.cache = {}\n }\n\n if(this.cache[n]){\n return this.cache[n]\n }\n\n if (n === 1) {\n return 1\n }\n\n this.cache[n] = n * factorial (n - 1)\n return this.cache[n]\n}", "function getFactors(n) {\n let factors = [];\n\n for (let i = 1; i < n; i++) {\n if (n % i === 0) {\n factors.push(i);\n }\n }\n\n return factors;\n}", "function factorial(n) {\r\n\tif (n < 0) throw new Error(`Input value ${n} is not a positive integer.`);\r\n\r\n\tif (n <= 1) return 1;\r\n\treturn n * factorial(n - 1);\r\n}", "function factorial(n) {\n // This is our Base Case - when n is equal to 0, we stop the recursion\n if (n === 0) {\n return 1;\n }\n // This is our Recursive Case\n // It will run for all other conditions except when n is equal to 0\n return n * factorial(n - 1);\n }", "function smallestFactor(n) {\n if (n < 2) throw new RangeError(\"Argument error\");\n if (n % 2 === 0) return 2;\n var end = Math.floor(Math.sqrt(n));\n\n for (var i = 3; i <= end; i += 2) {\n if (n % i === 0) return i;\n }\n\n return n;\n}", "function factorial(n){\n if (n < 2) return 1;\n return n * factorial(n - 1);\n}", "function nFactorial(num) \n{ \n if (num < 0) { \n return -1; \n } else if (num === 0) { \n return 1; \n } else { \n return (num * nFactorial(num - 1)); \n } \n}", "function fatorialRecursiva(n) {\n if (n == 1) {\n return 1;\n } else {\n return n * fatorialRecursiva(n - 1);\n }\n}", "function smallestFactor(n) {\n\t\tif (n < 2)\n\t\t\tthrow new RangeError(\"Argument error\");\n\t\tif (n % 2 == 0)\n\t\t\treturn 2;\n\t\tconst end = Math.floor(Math.sqrt(n));\n\t\tfor (let i = 3; i <= end; i += 2) {\n\t\t\tif (n % i == 0)\n\t\t\t\treturn i;\n\t\t}\n\t\treturn n;\n\t}", "function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n-1);\n}", "function factorial(n) {\n // base case and exit recursion\n if (n === 0) return 0\n if (n === 1) return 1\n // recurse with different inputs\n return n * factorial(n - 1)\n}", "function factorial(n) {\n if(n === 1){return n};\n return n * factorial(n-1);\n}", "function dfs(n) {\n var children = spanningTree.successors(n);\n for (var c in children) {\n var child = children[c];\n dfs(child);\n }\n if (n !== spanningTree.graph().root) {\n setCutValue(graph, spanningTree, n);\n }\n }", "function factorial(n) {\n if (n < 2)\n return n\n\n return n * factorial(n - 1);\n}", "function factorial(n) {\n if (n <= 1) return 1;\n return n * factorial(n - 1);\n}", "function factorial(n) {\n\tif (n <= 1) {\n\t\treturn 1\n\t}\n\n\treturn n * factorial(n - 1)\n}", "function factorial(n) {\n if (n <= 1) {\n return 1\n }\n while (n > 1) {\n n--\n result *= n\n }\n return result\n}", "function factorial(n) {\n\n}", "function factorial(n) {\n if (n < 2) return 1;\n return n * factorial(n - 1);\n}", "function factorial (n) {\n if (n < 2) {\n return 1\n } else {\n return n * factorial(n-1)\n }\n}", "function factorial(n) {\n\n if (n == 1) {\n return 1;\n }\n\n else {\n return n * factorial(n - 1)\n }\n}", "function factorial(number) { // Recibe un valor entero positivo\n if (number < 0) // Si es valor es un numero negativo entonces devuelve un -1 para hacer saber al usuario que se ingreso un valor invalido\n return -1; // retorno de valor invalido \n else if (number == 0) // Si el valor es 0, por definicion se devuelve un 1 por que 0! es 1, pero tambien sirve para la recursividad dentro de factorial\n return 1; // Devuelve el valor de 1 si es que el numero original es de 0 o si es la ultima iteracion de la funcion recursiva \n else { // Si el numero es un valor mayor a 1 se entra en la recursividad de la funcion \n return (number * factorial(number - 1)); // La recursividad funciona diciendo que el numero se multiplicara por la funcion - 1, y hasta que el numero dentro de la funcion no se vuelva 0 entonces se restara uno del valor del numero y se volver a multiplicar\n // Si el valor fuese 5, seria 5 * 5 - 1 * 5 - 1 - 1,5-1-1-1 * 5-1-1-1-1 * 0, claro que si se multiplica por 0 entonces el valor final seria 0, pero dentro del if si el valor es 0 hay un return de 1. \n // Pero el valor no sera de 1, dado que este return esta dentro de la primera iteracion de la recursividad, entonces el valor seria 5*4*3*2*1*1 = 120\n }\n}", "function factor(n) {\n if (isNaN(n) || !isFinite(n) || n%1 != 0 || n == 0) return ''+ n;\n if (n < 0) return '-' + factor(-n);\n let minFactor = leastFactor(n);\n if (n == minFactor) return ''+ n;\n return minFactor + '*' + factor(n / minFactor);\n }", "function fact(n) {\n if (n < 0) {\n return 0;\n } else if (n === 0) {\n return 1;\n } else {\n return n * fact(n - 1);\n }\n}", "function factorial(n){\n if(n == 0 || n == 1){\n return 1;\n } \n else{\n return n * factorial(n-1);\n }\n}", "function factorial(n) {\n if (n===0) return 1;\n else return n * factorial(n-1);\n}", "function factor() {\n var n = document.getElementById(\"n\").value;\n //var prod = n;\n //while ((n - 1) > 0) {\n // prod = prod * (n - 1);\n // n--;\n //}\n \n //var prod = 1;\n //for(var i = 2; i <= n; i++) {\n // prod *= i;\n //}\n \n document.getElementById(\"factor\").innerHTML = recfact(n);\n}", "function factoriiPrimi(n) {\n var factors = [];\n \n for (var i = 2; i <= n; i++) {\n while ((n % i) === 0) {\n factors.push(i);\n n /= i;\n }\n }\n \n return factors;\n}", "function factorial(n) {\n if (n === 0) {\n return 1;\n }\n return n * factorial(n - 1);\n}", "function factorial(n){\n if( n == 0){\n return 1;\n }\n else{\n return n * factorial(n-1);\n }\n \n}", "function factorial(n) {\n var result = n\n if (n <= 1) {\n return 1\n }\n while (n > 1) {\n n--\n result *= n\n }\n return result\n}", "function PrimeFactorization0(N)\n{\n\tif(isPosInteger(N) & N >=2 & N<MAXLIMIT)\n\t{\n\t\tp = 2;\n\t\ttxt = N + \" = \";\n\t\twhile (N >= p * p)\n\t\t{\n\t\t\tif (N % p == 0)\n\t\t\t{\n\t\t\t\ttxt += p + \" * \";\n\t\t\t\tN = N / p;\t//divide by prime number\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp++;\n\t\t\t}\n\t\t}\n\t\ttxt += N;\n\t\treturn txt;\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "function leastFactor(n){\n if (isNaN(n) || !isFinite(n)) return NaN;\n if (n==0) return 0;\n if (n%1 || n*n<2) return 1;\n if (n%2==0) return 2;\n if (n%3==0) return 3;\n if (n%5==0) return 5;\n var m = Math.sqrt(n);\n for (var i=7;i<=m;i+=30) {\n if (n%i==0) return i;\n if (n%(i+4)==0) return i+4;\n if (n%(i+6)==0) return i+6;\n if (n%(i+10)==0) return i+10;\n if (n%(i+12)==0) return i+12;\n if (n%(i+16)==0) return i+16;\n if (n%(i+22)==0) return i+22;\n if (n%(i+24)==0) return i+24;\n }\n return n;\n}", "function fact (n) {\n if (n < 0)\n throw \"n < 0\" ;\n else if (n == 0)\n return 1 ;\n else\n return n * fact(n-1) ;\n}", "function factorial(n) {\n if (n === 1) {\n return 1\n }\n return n * factorial(n - 1);\n}", "function factorial(n) {\n if (n === 0) return 1;\n return n * factorial(n - 1);\n}" ]
[ "0.6913972", "0.6880843", "0.6860621", "0.68521947", "0.6797213", "0.67726016", "0.6728849", "0.67203456", "0.6711669", "0.6686903", "0.6619655", "0.6617041", "0.6606457", "0.65930843", "0.6577986", "0.65776634", "0.6548178", "0.6532805", "0.65279347", "0.64855134", "0.6477414", "0.64534926", "0.6441852", "0.6430723", "0.6418919", "0.64149207", "0.64080364", "0.63979495", "0.6396791", "0.6396075", "0.6395912", "0.63804", "0.6375163", "0.63417584", "0.6338666", "0.63341296", "0.63325983", "0.6329267", "0.6304161", "0.6298089", "0.62848294", "0.628235", "0.62778825", "0.62755096", "0.62743324", "0.62638515", "0.6249391", "0.624553", "0.62447673", "0.6244048", "0.6243366", "0.62429", "0.6225092", "0.62220806", "0.6211327", "0.6208596", "0.6202357", "0.6202224", "0.6202026", "0.6200219", "0.6186869", "0.6186121", "0.61858016", "0.6183582", "0.6182794", "0.6181338", "0.6181046", "0.6179766", "0.6179546", "0.6178449", "0.61758214", "0.61749417", "0.6174865", "0.61745465", "0.61734504", "0.6170541", "0.6164642", "0.6155906", "0.61539036", "0.61537665", "0.61522764", "0.6152184", "0.6150873", "0.6150625", "0.61504096", "0.6147751", "0.61469334", "0.614675", "0.61455816", "0.6144668", "0.6143028", "0.6138828", "0.6137712", "0.61369544", "0.61325955", "0.6130594", "0.6128382", "0.61264896", "0.61232156", "0.61198497" ]
0.7521755
0
Worst: O(n) time | O(n) space
function findClosestValueInBst(tree, target) { return findClosestValueInBstHelper(tree, target, Infinity); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function solution(a) { // O(N)\n let max1; // O(1)\n let max2; // O(1)\n\n for (let value of a) { // O(N)\n if (!max1) { // O(1)\n max1 = value; // O(1)\n } else if (value > max1) { // O(1)\n max2 = max1; // O(1)\n max1 = value; // O(1)\n } else if (value < max1) { // O(1)\n if (!max2) { // O(1)\n max2 = value; // O(1)\n } else if (value > max2) { // O(1)\n max2 = value; // O(1)\n }\n }\n }\n\n return max2; // O(1)\n}", "function mostFrequent(arr) {\n \n \n \n}", "function mostFrequent(arr) {\r\n let numTrack = {};\r\n\r\n for (let n of arr) {\r\n if (!n in numTrack) {\r\n // initialize property\r\n numTrack.n = 0;\r\n }\r\n numTrack.n++;\r\n\r\n if (numTrack.n > (arr.length / 2)) {\r\n return n;\r\n }\r\n }\r\n\r\n let biggest = -1;\r\n for (let n of numTrack) {\r\n if (numTrack[n] > biggest) {\r\n biggest = numTrack[n];\r\n }\r\n }\r\n return biggest;\r\n}", "function secondLargest(arr) {\n const uniq = [...new Set(arr)];\n uniq.sort(function(a,b) {return a-b});\n return uniq[uniq.length-2];\n}", "function whichOneHasMax(m, n) {\n if(m[m.length-1] === n[n.length-1]) return 0\n if(m[m.length-1] > n[n.length-1]) return 1\n if(m[m.length-1] < n[n.length-1]) return -1\n }", "findIndexOfGreatest(array) {\n let greatest;\n let indexOfGreatest;\n for (let i = 0; i < array.length; i++) {\n if (greatest === null || greatest === undefined || array[i] > greatest) {\n greatest = array[i];\n indexOfGreatest = i;\n }\n }\n return indexOfGreatest;\n }", "function largestRange(array) {\n let bestRange = [];\n let longestLength = 0;\n const nums = {};\n for (const num of array) {\n nums[num] = true;\n }\n for (const num of array) {\n if (!nums[num]) continue;\n nums[num] = false;\n let currentLength = 1;\n let left = num - 1;\n let right = num + 1;\n while (left in nums) {\n nums[left] = false;\n currentLength++;\n left--;\n }\n while (right in nums) {\n nums[right] = false;\n currentLength++;\n right++;\n }\n if (currentLength > longestLength) {\n longestLength = currentLength;\n bestRange = [left + 1, right - 1];\n }\n }\n return bestRange;\n}", "function indexHighestNumber(arr) {\n var big = -Infinity\n arr.forEach(function(ele){\n if(ele > big) {\n big = ele\n }\n })\n return a.lastIndexOf(\"big\")\n}", "function max_index(n){\n var m = n[0], b = 0;\n for(var i = 1; i < n.length; i++)\n if(n[i] > m) m = n[b = i];\n return b;\n}", "function max_element(n, metric){\n var m = metric(n[0]), b = n[0];\n for(var i = 1; i < n.length; i++){\n var v = metric(n[i]);\n if(v > m){\n m = v;\n b = n[i];\n }\n }\n return b;\n}", "function HighestNmb(arr) {\n return Math.max.apply(null, arr);\n}", "function secLargest(arr){\n var largest = null;\n var secLargest = null;\n if(arr.length < 2){\n return null;\n }\n for(var i = 0; i < arr.length; i++){\n if(arr[i] > largest){\n largest = arr[i]\n }\n if(arr[i] < largest && arr[i] > secLargest){\n secLargest = arr[i];\n }\n }\n return secLargest;\n}", "function secondTOLargest(arr) {\n\n var m1 = arr[0];\n var m2 = 0;\n for(var i=0; i<arr.length; i++) {\n if(arr[i] > m1) {\n m2 = m1;\n m1 = arr[i];\n }\n else if(arr[i] > m2&& arr[i] !== m1) {\n m2 = arr[i];\n }\n }\n return m2;\n}", "function solution(A) {\n let len = A.length;\n let storage = {};\n let maxEl = 0, maxCount = 0;\n\n if (len === 0) {\n return -1;\n }\n\n if (len === 1) {\n return 0;\n }\n\n // Solution\n // we used an object(storage) to save every total count of each different number\n // maxEl is used to save element which has highest number so far\n // e.g array A [3, 4, 3, -1, 3] \n // loop 1: storage { '3' : [0] }, maxEl = 3\n // loop 2: storage { '3' : [0], '4' : [1] }, maxEl = 3\n // loop 3: storage { '3' : [0, 2], '4' : [1] }, maxEl = 3\n // loop 4: storage { '3' : [0, 2], '4' : [1], '-1' : [3] }, maxEl = 3\n // loop 5: storage { '3' : [0, 2, 4], '4' : [1], '-1' : [3] }, maxEl = 3\n // check if max element's count over half of array then return max element array index\n // if not then return -1\n // in this case we should return [0, 2, 4]\n\n for (let i = 0; i < len; i++) {\n let el = A[i];\n\n if (storage[el] === undefined) {\n storage[el] = [];\n storage[el].push(i);\n } else {\n storage[el].push(i);\n }\n\n if (storage[el].length > maxCount) {\n maxEl = el;\n maxCount = storage[el].length;\n }\n }\n\n // If every element has equal count , e.g [1, 2, 3] or [-1, -2, 1]\n if (maxCount === 1) {\n return -1;\n }\n\n // Check if max element's count over half array or not\n if (storage[maxEl].length / len <= 0.5) {\n return -1;\n }\n\n return storage[maxEl][0];\n}", "function mostFrequent (arr) {\n var max = -Infinity;\n var maxI = 0;\n var step = [];\n for (var i = 0; i < arr.length; i++) {\n var k = 0;\n for (var j = 0; j < arr.length; j++) {\n if (arr[i] == arr[j]) {\n k++;\n }\n }\n step[i]=k;\n }\n for (var l = 0; l < arr.length; l++) {\n if (step[l] > max) {\n max = step[l];\n maxI = l;\n }\n }\n return arr[maxI];\n}", "function highestScore() {\n var best = 0;\n for(var i = 1; i < scores.length; i += 2) {\n var current = scores[i];\n if(current > best){\n best = current;\n index = i;\n }\n }\n // console.log(index);\n return index;\n}", "function prune(arr){\r\n//\tGM_log(\"arr.length : \"+arr.length);\r\n\tvar i = 0;\r\n\tfor(j in arr){\r\n\t\ti = j;\r\n\t\t// excluding i where i-1 or i+1 doesn't exist\r\n\t\tif(i > 0 && i < (arr.length -1)){\r\n\t\t\tvar test = Math.abs(arr[i*1+1] - arr[i-1]);\r\n\t\t//\tGM_log(\"test : \"+test+\" = arr[\"+i+\"+1] : \"+arr[i+1]+\" - arr[\"+i+\"-1] : \"+arr[i-1]);\r\n\t\t//\tGM_log(\"All [i] - i : \"+i+\" -> test : \"+test);\r\n\t\t\tif(test < smallest){\r\n\t\t//\t\tGM_log(\"i : \"+i+\" -> test : \"+test);\r\n\t\t\t\tsmallest = test;\r\n\t\t\t\trememberI = i;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n//\tGM_log(\"rememberI : \"+rememberI);\r\n\treturn rememberI;\r\n}", "function most_frequent(arr) {\n var a = 0;\n var b = 1;\n var item;\n for (var i=0; i<arr.length; i++){\n for (var j=i; j<arr.length; j++){\n if (arr[i] == arr[j])\n a++;\n if (b<a){\n b=a;\n item = arr[i];\n }\n }\n a=0;\n }\n console.log(\"Most frequently occuring item in array: \"+ item+\" ( \" +b +\" times ) \") ;\n }", "function findSecondBiggest(arr) {\n\n let biggest = arr[0];\n let secondBiggest = arr[1];\n\n arr.forEach(function (item) {\n\n if (item >= biggest) {\n biggest = item;\n }\n\n else if (item > secondBiggest) {\n secondBiggest = item;\n }\n\n if (biggest < secondBiggest) {\n let temp = secondBiggest;\n secondBiggest = biggest;\n biggest = temp;\n }\n });\n return secondBiggest;\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 6.4.0)\n \n N = 100001\n var bitmap = Array(N).fill(false);\n for (var i = 0; i < A.length; i ++) {\n if (A[i] > 0 && A[i] <= N) {\n bitmap[A[i]] = true;\n }\n }\n \n for(var j = 1; j <= N; j++) {\n if (!bitmap[j]) {\n return j;\n }\n }\n \n return N + 1;\n}", "best() \n {\n let max = -1;\n let bix = 0;\n\n for(let i = 0; i < this.popSize; i++) \n {\n if(this.population[i].fitness > max) \n {\n max = this.population[i].fitness;\n bix = i;\n }\n }\n\n return this.population[bix];\n }", "mostOwed(arr) {\n let index = 0;\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] < arr[index]) {\n index = i;\n }\n }\n return index;\n }", "function bestFit(arr){\n for (var i = 0; i < arr.length; i++){\n if (arr[0] > arr.length){\n console.log(\"Too Big!\");\n }\n if (arr[0]<arr.length){\n console.log(\"Too Small!\");\n }\n if (arr[0] == arr.length) {\n console.log(\"Just Right!\")\n }\n }\n}", "worstSatisfactionDegree() {\n\t\tlet cs = 1;\n\t\tfor (const c of this._cons) {\n\t\t\tconst s = c.satisfactionDegree();\n\t\t\tif (s === Constraint.UNDEFINED) return Constraint.UNDEFINED;\n\t\t\tif (s < cs) cs = s;\n\t\t}\n\t\treturn cs;\n\t}", "mostOwned(arr) {\n let index = 0;\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] > arr[index]) {\n index = i;\n }\n }\n return index;\n }", "function findMost(arr) {\n if (arr.length === 0) {\n return \"arr is empty\"\n }\n var res = {};\n for (let i = 0; i < arr.length; i++) {\n if (!res[arr[i]]) {\n res[arr[i]] = 1;\n } else {\n res[arr[i]]++;\n }\n }\n var maxItem = 0, maxVal = 0;\n var keys = Object.keys(res);\n for (let j = 0; j < keys.length; j++) {\n if (res[keys[j]] > maxVal) {\n maxItem = keys[j];\n maxVal = res[keys[j]];\n }\n }\n console.log(\"maxItem: \" + maxItem + \", maxVal: \" + maxVal);\n}", "function most_frequent(arr) {\n console.log(\"Most frequently occuring item in arr\");\n\n var counter = 0, new_count, max_index, visit = [];\n\n for(var i = 0; i < arr.length; i++)\n visit.push(false);\n \n\n for(var i = 0; i < arr.length; i++)\n {\n\n if(visit[i] == false)\n {\n new_count = 1; // first case we meet\n visit[i] = true;\n\n for(var j = i+1; j < arr.length; j++)\n {\n\n if(arr[j] === arr[i]) // notice this line\n {\n new_count++; // increase upon match\n visit[j] = true;\n }\n }\n\n if(new_count > counter)\n {\n counter = new_count;\n max_index = i;\n }\n }\n }\n\n console.log(arr[max_index] + \" occurs \" + counter + \" times\");\n }", "function boooo(n) {\n for (let i = 0; i < n; i++) { // O(1)\n console.log('booooo');\n }\n}", "function secondLargest(arr){\n var firstLg = arr[0]\n var secondLg = arr[0]\n for(var i = 0; i < arr.length; i++){\n if(arr.length < 2){\n return null\n }\n else if(arr[i] > firstLg){\n secondLg = firstLg\n firstLg = arr[i]\n }\n else if(arr[i] > secondLg && arr[i] < firstLg){\n secondLg = arr[i]\n }\n }\n return secondLg\n }", "function solution (arr) {\n\t// if input has length of 1\n\tif ( arr.length === 1 ) {\n\t\t// return -1\n\t\treturn -1; \n\t}\n\t// make a store\n\tlet store = {};\n\t// make a max\n\tlet max=0;\n\t// iterate th input\n\tfor ( let i = 0; i < arr.length; i ++ ) {\n\t\t// put every value into store\n\t\tstore[arr[i]]= true;\n\t}\n\t// iterate th input again\n\tfor ( let j = 0; j < arr.length; j++ ) {\n\t\t// for every value P\n\t\tlet P = arr[j];\n\t\t\t// for every suprior value Q\n\t\t\tfor (let k = j+1; k < arr.length; k++ ) {\n\t\t\t\tlet Q = arr[k];\n\t\t\t// if abs P - Q is bigger than max\n\t\t\t\tif ( Math.abs( P - Q) > max ) {\n\t\t\t\t\t// make an ongoing run\n\t\t\t\t\tlet ongoingRun = 0\t\n\t\t\t\t\t// get max value btw P and Q\n\t\t\t\t\tconst maxVal = P > Q ? P : Q;\n\t\t\t\t\tconst minVal = P < Q ? P : Q;\n\t\t\t\t\t// go from max to min decrementing 1 (inter value)\n\t\t\t\t\tfor ( let interValue = maxVal-1; interValue >= minVal; interValue -=1 ) {\n\n\t\t\t\t\t\tongoingRun++;\n\t\t\t\t\t\t// if loop has finished : adajcent found\n\t\t\t\t\t\tif ( interValue === minVal ) {\n\t\t\t\t\t\t\t// if ongoing run is bigger than max\n\t\t\t\t\t\t\t// max = ongoing run\n\t\t\t\t\t\t\tmax = max >= ongoingRun ? max : ongoingRun\n\t\t\t\t\t\t\t// exit\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\t\n\t\t\t\t\t\t// if inter value is in store\n\t\t\t\t\t\tif ( store[interValue] === true ) {\n\t\t\t\t\t\t\t// ongoing run = 0\n\t\t\t\t\t\t\tongoingRun=0;\n\t\t\t\t\t\t\t// break\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\t\n\t\t\t\t}\t\t\n\t\t\t}\t\t\n\t}\n\t// return max\n\treturn max;\n}", "function secLargest(array) {\n var firsLargest = 0\n var arr = array[0];\n for (var i = 0; i < array.length; i++) {\n var element = array[i];\n if (arr < element) {\n firsLargest = arr;\n arr = element\n }\n }\n return firsLargest\n\n}", "function my_max(n){\n\tvar out = 0;\n\t\n\tfor (i=0; i < n.length; i++){\n\t\tout = (n[i] > out)?n[i]:out;\n\t}\n\treturn out;\n}", "function largestSumNoAdj1(array) {\r\n if (!array.length) return 0;\r\n if (array.length === 1) return array[0];\r\n let max_including_last = array[1];\r\n let max_excluding_last = array[0];\r\n for (let i = 2; i < array.length; i++) {\r\n const current = Math.max(max_including_last, max_excluding_last + array[i]);\r\n max_excluding_last = max_including_last;\r\n max_including_last = current;\r\n }\r\n return max_including_last;\r\n}", "function thugSort(arr) {\n const max = arr.max(); // O(n)\n const sorted = arrayFromMax(max); // O(m)\n const set = new Set(arr); // O(n)\n return sorted.filter(ele => set.has(ele)); // O(m)\n}", "function findBestFly() {\n\tvar max = -1;\n\n\tfor (i = 0; i < popSize; i++) {\n\t\tif (fly[i].getFitness() > max) {\n\t\t\tmax = fly[i].getFitness();\n\t\t\tbestIndex = i;\n\t\t}\n\t}\n}", "function worst(nodes, side) {\n var cost = sumCosts(nodes);\n\n function aspect(node) {\n return Math.max(\n node.getCost() / cost,\n cost / node.getCost());\n }\n\n var max = aspect(nodes[0]);\n for (var i = 1; i < nodes.length; i++) {\n var a = aspect(nodes[i]);\n if (a > max) max = a;\n }\n\n return max;\n }", "function findSecondMaximum(arr) {\n const sorted = [...new Set(arr.sort((a,b) => a-b))]\n const secondToLast = sorted.length - 2\n return sorted[secondToLast];\n}", "function secondLargest(arr){\n var max = arr[0]\n var secondMax = arr[0]\n if(arr.length < 2){\n return null;\n }\n for(let i = 0; i < arr.length; i++){\n if(arr[i] > max){\n max = arr[i];\n }\n }\n for(let x = 1; x < arr.length; x++){\n if(arr[x] > secondMax && arr[x] != max){\n secondMax = arr[x];\n }\n }\n // return max;\n return secondMax;\n}", "function solution3(arr) {\n let max; // -2\n let i=0; \n while(i< arr.length) {\n i++;\n if (arr[i] < 0) {\n max = arr[i];\n }\n }\n let j=0;\n while(j<arr.length) {\n j++;\n if(arr[j] < 0) {\n if (arr[j] > max) {\n max = arr[j];\n }\n } \n }\n\n console.log(max);\n}", "function h(n,t){var r,u,i,f;if(n===t)return 0;for(r=n.length,u=t.length,i=0,f=Math.min(r,u);i<f;++i)if(n[i]!==t[i]){r=n[i];u=t[i];break}return r<u?-1:u<r?1:0}", "function findBestMatch() {\n bestMatch = songMatches[0];\n for (let i = 1; i < songMatches.length; ++i) {\n if ( songMatches[i].popularity > bestMatch.popularity ) {\n bestMatch = songMatches[i];\n }\n }\n}", "function largestElement(arr){\n var largest = 0;\n \n for(var i=0;i<arr.length-1;i++){\n for(var j=0;j<arr.length-1-i;j++){\n if(arr[j] > arr[j+1]){\n var temp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = temp;\n }\n }\n }\n \n largest = arr[arr.length-1];\n return largest;\n}", "function nthLargest(arr, n){\n console.log('n to Largest');\n var max = [];\n max[0] = arr[0];\n var nth_max = 0;\n if( arr.length < n){\n return 'null';\n }\n for(var i = 1; i < arr.length; i++){\n if(arr[i] > max[0]){\n for(var y = 0; y < max.length; y++){\n max[max.length] = max[max.length -1];\n }\n //max[0] = arr[i];\n }\n //console.log(max[-n]);\n }\n //return max[-n];\n}", "function maxSubArraySum(arr, n){ // O(n^2) // naive solution\r\n let maxSum = 0;\r\n for(let i = 0; i < arr.length - n + 1; i++){ // O(n)\r\n let temp = 0;\r\n for(let j = 0; j < n; j++){ // nested O(n)\r\n temp += arr[i + j];\r\n }\r\n if(temp > maxSum){\r\n maxSum = temp;\r\n }\r\n }\r\n return maxSum;\r\n}", "function findMax(array){\n if(array.length === 1) {\n return array[0];\n }\n var lastValue = array.pop();\n var currentMax = findMax(array);\n if(currentMax < lastValue){\n return lastValue;\n } else {\n return currentMax;\n }\n // if(findMax(array) < lastValue){\n // return lastValue;\n // } else {\n // return findMax(array);\n // }\n}", "function getBiggest(arr){\n let biggest = arr[0];\n\n for (const number of arr) {\n if (number > biggest) {\n biggest = number;\n }\n }\n\n return biggest;\n}", "function findLargest (myArray) {\n var theLargestThing = myArray[0];\n for ( i = 1; i < myArray.length; i++){\n theLargestThing = largestOfTwo(theLargestThing,myArray[i]);\n }\n return (theLargestThing);\n}", "function LargestSum() {\n\tvar test = [1, 3, -5, 23, -11, 6, 37, 21, -31, 10, 9, 19];\n\n\tfunction dpLargeSum(collection) {\n\t\tvar largest = [];\n\t\tlargest[0] = collection[0];\n\t\t// var lastIndex = 0;\n\t\tfor (var i = 1; i < collection.length; i++) {\n\t\t\t// largest[i] represents the largest sum for sub sequence ending with collection[i]\n\t\t\t// largest[i] does not mean the largest sum for the first i items (which could make things much more complicated)\n\t\t\tlargest[i] = largest[i - 1] + collection[i] > collection[i] ? largest[i - 1] + collection[i] : collection[i];\n\t\t}\n\t\tconsole.log(largest);\n\t\treturn max(largest);\n\t}\n\n\tfunction max(collection) {\n\t\tvar maxVal = collection[0];\n\t\tcollection.forEach((item) => {\n\t\t\tif (item > maxVal) {\n\t\t\t\tmaxVal = item;\n\t\t\t}\n\t\t});\n\t\treturn maxVal;\n\t}\n\n\tfunction bruteForce(collection) {\n\t\tvar sum = 0;\n\t\tvar max = 0;\n\t\t// starting index\n\t\tfor (var i = 0; i < collection.length; i++) {\n\t\t\t// define the length of this loop\n\t\t\tfor (var j = 0; j < collection.length - i; j++) {\n\t\t\t\t// starting index to index + length\n\t\t\t\tfor (var k = i; k < j + i + 1; k++) {\n\t\t\t\t\tsum += collection[k]\n\t\t\t\t}\n\t\t\t\tif (sum > max) {\n\t\t\t\t\tmax = sum;\n\t\t\t\t}\n\t\t\t\tsum = 0;\n\t\t\t}\n\t\t}\n\t\treturn max;\n\t}\n\n\tconsole.log(dpLargeSum(test));\n\tconsole.log(bruteForce(test));\n}", "function secondHighest(array) {\n\tvar retval;\n\tvar sortable = array.slice(0);\n\n\tsortable.sort(function(a, b) {\n\t\treturn b - a;\n\t})\n\t\n\tarray.forEach(function(n, idx) {\n\t\tif (n === sortable[1])\n\t\t\tretval = idx\n\t})\n\n\treturn retval;\n}", "function max_score(list, f) {\r\n\tvar part_index;\r\n\tvar highest_index=0;\r\n\tvar highest_score=0;\r\n\r\n\tfor (part_index=0; part_index < list.length; part_index++) {\r\n\t\tconsole.log(f(list[part_index]));\r\n\t\tif (f(list[part_index]) >= f(list[highest_index])) {\r\n\t\t\thighest_index = part_index;\r\n\t\t\thighest_score = f(list[part_index]);\r\n\t\t}\r\n\t\tconsole.log('highest index is: ' + highest_index);\r\n\t}\r\n\t\r\n\treturn highest_index;\r\n}", "function findSecondLargestElem(arr){\n let first = -1 , second = -1;\n\n for(let i = 0; i <= arr.length-1; i++){\n if(arr[i] > first){\n second = first;\n first = arr[i];\n }\n else if( arr[i] > second && arr[i] != first){\n second = arr[i];\n }\n }\n console.log(second);\n}", "function most(array){\nlet obj = {};\nfor(let n of array){\nif(obj[n] === undefined){\n obj[n] = 1;\n}\nelse{\n obj[n]++;\n}\n}\n\nlet max = 0;\nlet count = 0;\n\nfor(let n in obj){\n if(count < obj[n]){\n count = obj[n];\n max = n;\n }\n}\nconsole.log(max);\n}", "function findWorst( champion ){\n var tempWorst = 900;\n var item = \"\";\n var winDiff;\n var kdadiff;\n \n //Check each item in the champ's list\n for( var key in post ){\n if( post.hasOwnProperty(key) ){\n \n //Calulate the difference and account for unplayed\n winDiff = getDifference( 1, 0, 0, key, champion );\n kdaDiff = getDifference( 0, 0, 1, key, champion );\n if(winDiff == \"Unplayed\" || kdaDiff == \"Unplayed\")\n continue;\n\n //Calculate the minimum sum\n if( winDiff + kdaDiff < tempWorst ){\n tempWorst = winDiff + kdaDiff;\n item = key;\n }\n }\n }\n return item;\n}", "function maxInversions2(arr) {\n let arrLength = arr.length;\n let inversionCount = 0;\n\n // Subsequence of 3: Iterate through N^3 possibilities\n for (let i = 0; i < arrLength - 2; i++) {\n for (let j = i + 1; j < arrLength - 1; j++) {\n if (arr[i] > arr[j]) {\n for (let k = j + 1; k < arrLength; k++) {\n if (arr[j] > arr[k]) {\n inversionCount++;\n }\n }\n }\n }\n }\n return inversionCount;\n}", "function secondLargest(array) {\n if(array <= 0 || !Array.isArray(array)) return undefined;\n let filteredNum = [...new Set(array)].filter(e => /\\d+$/.test(e)).map(e => e).sort((a, b) => b - a)[1];\n if(array.every((e, i, arr) => e === arr[0])) return undefined\n return +filteredNum;\n}", "function solution(arr) {\n let max = 0,\n map = arr.reduce((accum, num)=> {\n if(num > 0) accum[num] = true;\n if(num > max) max = num;\n return accum;\n }, {});\n\n for(let i=1; i<=max+1; i++) {\n if(!map[i]) return i;\n }\n}", "function findMostOccurence(number) {\n\n}", "function solution(N) {\n // write your code in JavaScript (Node.js 8.9.4)\n console.debug(\"Showing test input: \", N);\n\n try {\n if (!(N) || typeof (N) !== 'number' || N < 1) {\n throw new Error(\"Invalid input type.\");\n }\n\n const binaryString = (N >>> 0).toString(2);\n var greatestGap = 0;\n var counter = null;\n var lastStartIndex = null;\n\n console.debug(\"Binary View: \", binaryString);\n\n for (let i = 0; i < binaryString.length; i++) {\n if (i === 0) {\n continue\n }\n\n if (binaryString[i - 1] === '1' && binaryString[i] === '0') {\n lastStartIndex = i;\n counter = 1;\n } else if (binaryString[i - 1] === '0' && counter >= 1 && binaryString[i] === '0' && lastStartIndex != null) {\n counter += 1;\n } else if (binaryString[i - 1] === '0' && counter >= 1 && binaryString[i] === '1' && lastStartIndex != null) {\n if (counter >= greatestGap) {\n greatestGap = counter;\n }\n counter = null;\n lastStartIndex = null;\n }\n }\n\n console.debug(\"greatest gap is : \", greatestGap);\n\n return greatestGap;\n }\n catch (err) {\n console.debug(\"Log error: \", err);\n return 0;\n }\n}", "function almostSorted(arr) {\n const getIsIncreasing = array =>{\n let i = 0;\n let isIncreasing = true;\n while(i < array.length - 1){\n if(array[i] > array[i + 1]){\n isIncreasing = false;\n break\n }\n i++;\n }\n return isIncreasing;\n }\n const swap = (i, j) =>{\n const temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n \n }\n \n let swapWorks;\n let reverseWorks;\n \n let firstProblem = -1;\n while(firstProblem + 2 < arr.length && arr[firstProblem + 1] < arr[firstProblem + 2]){\n firstProblem++;\n }\n firstProblem = Math.max(0, firstProblem)\n let lastProblem = arr.length;\n while(lastProblem - 2 >= 0 && arr[lastProblem - 2] < arr[lastProblem - 1]){\n lastProblem--;\n }\n lastProblem = Math.min(lastProblem, arr.length - 1)\n let idx1;\n let idx2;\n // console.log(\"first and last\", firstProblem, lastProblem)\n \n const trySwap = () => {\n const max = Math.max(arr.length, firstProblem + 2)\n for(let i = firstProblem; i < max; i++){\n for(let j = 0; j < arr.length; j++){\n if(!swapWorks){\n swap(i, j);\n if(getIsIncreasing(arr)){\n swapWorks = true;\n idx1 = i;\n idx2 = j\n break\n }\n swap(i, j) \n }\n\n }\n }\n }\n \n const tryReverse = () =>{\n const max = Math.max(arr.length, firstProblem + 2)\n for(let i = firstProblem; i < max; i++){\n for(let j = arr.length - 1; j > firstProblem; j--){\n const array = arr.slice(0, i).concat(\n arr.slice(i, j + 1).reverse()\n ).concat(arr.slice(j + 1))\n if(getIsIncreasing(array)){\n reverseWorks = true;\n idx1 = i;\n idx2 = j\n break\n }\n }\n } \n }\n \n trySwap();\n // console.log(\"swapWorks\", swapWorks)\n if(!swapWorks) tryReverse();\n \n if(swapWorks){\n console.log(\"yes\")\n console.log(\"swap \" + (idx1 + 1).toString() + \" \" + (idx2 + 1).toString())\n } else if(reverseWorks){\n console.log(\"yes\")\n console.log(\"reverse \" + (idx1 + 1).toString() + \" \" + (idx2 + 1).toString())\n } else {\n console.log(\"no\")\n }\n\n}", "function solution(n) {\n d = new Array(30);\n l = 0;\n while (n > 0) {\n d[l] = n % 2;\n n = Math.floor(n / 2);\n l += 1;\n }\n console.log('l = ', l);\n console.log('d = ', d);\n for (p = 1; p < 1 + l; ++p) {\n ok = true;\n for (i = 0; i < l - p; ++i) {\n if (d[i] != d[i + p]) {\n ok = false;\n break;\n }\n }\n if (ok) {\n return p;\n }\n }\n return -1;\n}", "function mostFrequent(buf) {\n let win = -1;\n // Frequency of appearance\n Object.keys(buf).forEach(key => {\n if (win == -1) {\n win = key;\n } else if (buf[key] > buf[win]) {\n win = key;\n }\n });\n //console.log(buf);\n return win;\n}", "function nlognBiggestFish(fishes) {\n // sort the array longest to shortest\n fishes.sort((a, b) => b.length - a.length);\n //return the first element\n return fishes[0];\n}", "function largestRange(array) {\n let nums = {};\n let range = [];\n let largestRange = 0;\n\n for (let num of array) {\n nums[num] = true;\n }\n\n for (let num of array) {\n if (nums[num] === false) continue;\n\n // \t\tlets explore\n nums[num] === false; //******\n let left = num - 1;\n let right = num + 1;\n let currentLength = 1; // ********\n\n while (left in nums) {\n nums[left] = false;\n left -= 1;\n ++currentLength;\n }\n\n while (right in nums) {\n nums[right] = false;\n right += 1;\n ++currentLength;\n }\n\n if (currentLength > largestRange) {\n largestRange = currentLength;\n range = [left + 1, right - 1]; // ******\n }\n }\n\n return range;\n}", "function largestSumNoAdj(array) {\r\n if (!array.length) return 0;\r\n if (array.length == 1) return array[0];\r\n const maxSums = array.slice();\r\n maxSums[1] = Math.max(array[0], array[1]);\r\n for (let i = 2; i < array.length; i++) {\r\n maxSums[i] = Math.max(maxSums[i - 1], maxSums[i - 2] + array[i]);\r\n console.log(maxSums);\r\n }\r\n return maxSums[maxSums.length - 1];\r\n}", "function O(t, n) {\n return void 0 !== t ? t : n;\n}", "function anotherFunChallenge(input) {\n let a = 5; // O(1)\n let b = 10; // O(1)\n let c = 50; // O(1)\n for (let i = 0; i < input; i++) {\n // O(n)\n let x = i + 1; // O(n)\n let y = i + 2; // O(n)\n let z = i + 3; // O(n)\n }\n for (let j = 0; j < input; j++) {\n // O(n)\n let p = j * 2; // O(n)\n let q = j * 2; // O(n)\n }\n let whoAmI = \"I don't know\"; // O(1)\n}", "function takeBiggest(a, b) {\n if (a > b)\n return a;\n return b;\n }", "getNthBest(n) {\n\t\t\tvar sortedPopulation = utils.copyArray(this.population);\n\t\t\tsortedPopulation.sort(function(a, b) {\n\t\t\t\tif(a.fitness > b.fitness)\n\t\t\t\t\treturn -1;\n\t\t\t\tif(b.fitness > a.fitness)\n\t\t\t\t\treturn 1;\n\t\t\t\treturn 0;\n\t\t\t});\n\n\t\t\tvar nthBest = sortedPopulation[n];\n\t\t\treturn {obj: nthBest, index: this.population.indexOf(nthBest)};\n\t\t}", "function mostExpensive(items) {\n var current = groceries[0].cost;\n for(var i = 0; i < groceries.length; i++){\n if(groceries[i].cost > current) {\n current = groceries[i].cost;\n }\n }\n return current;\n}", "function solution(A) {\n\n A.sort();\n for (let i = 0;i < A.length; i++) {\n let br = 1;\n while(A[i] === A[i + 1]) {\n i++;\n br++;\n }\n if(br%2 !== 0){\n return A[i];\n }\n }\n return A[A.length - 1];\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n if (A.length == 1)\n return A[0];\n \n A.sort();\n while (A.length > 0) {\n var a = A.pop();\n var b = A[A.length-1];\n if (a != b)\n return a;\n A.pop(); \n } \n}", "function findMaximumSubarray2(A) {\n \n}", "function avoidObstacles(ints) {\n const sortedArray = ints.sort()\n \n let int = 0\n while(true) {\n int++;\n const passThrough = sortedArray.every((el) => {\n let hump = int;\n while(true) {\n if (hump === el) return false\n if (hump > el) break\n hump = hump + int\n }\n return true\n })\n \n if (passThrough) return int;\n if (int > Math.max(...sortedArray)) break;\n }\n}", "function getMostFrequentElement(array) {\n if (array.length == 0)\n return null;\n var modeMap = {};\n var maxEl = array[0], maxCount = 1;\n for (var i = 0; i < array.length; i++) {\n var el = array[i];\n if(modeMap[el] == null)\n modeMap[el] = 1;\n else\n modeMap[el]++;\n if (modeMap[el] > maxCount) {\n maxEl = el;\n maxCount = modeMap[el];\n }\n }\n return maxEl;\n}", "function secondLargest(arr){\n var max = arr[0];\n var maxTwo = arr[0]\n for(var i = 0; i<arr.length; i++){\n if (arr.length < 3){\n return null;\n }\n else if(arr[i]>max){\n maxTwo = max;\n max = arr[i];\n }\n else if (arr[i]>maxTwo && arr[i]<max)\n maxTwo = arr[i];\n }\n return maxTwo;\n}", "function findSecondMaximumB(arr) {\n let max = null\n let secondmax = null\n for (let val of arr) {\n if ( val > max ) {\n secondmax = max\n max = val\n } else if (val < max && val > secondmax) {\n secondmax = val\n }\n }\n return secondmax\n}", "function o(e,t){if(e===t)return 0\nfor(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i]\nbreak}return r<n?-1:n<r?1:0}", "function majorityElement(nums) {\n var cache = {};\n for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {\n var num = nums_1[_i];\n if (!cache[num]) {\n cache[num] = 1;\n }\n else {\n cache[num] += 1;\n }\n if (cache[num] >= nums.length / 2) {\n debugger;\n return num;\n }\n }\n return 1;\n}", "function linearBiggestFish(fishes) {\n let biggestFish = fishes[0];\n\n for (let fish of fishes) {\n if (fish.length > biggestFish.length) biggestFish = fish;\n }\n\n return biggestFish;\n}", "function findMode(arr) {\n let freqCounter = createFrequencyCounter(arr);\n let count = 0;\n let mostFrequent;\n\n for (let key in freqCounter) {\n //if value of key is more than count\n if (freqCounter[key] > count) {\n mostFrequent = key;\n count = freqCounter[key]\n }\n }\n return +mostFrequent;\n}", "function most_frequent(arr) {\n var most_f = 1;\n var c= 0;\n var item;\n for (var i=0; i<arr.length; i++)\n {\n for (var j=i; j<arr.length; j++)\n {\n if (arr[i] == arr[j])\n c++;\n if (most_f<c)\n {\n most_f=c; \n item = arr[i];\n }\n }\n c=0;\n } \n console.log(item+\" occurs \"+most_f+\" times\" );\n \n}", "function high(arrObj) {\n\tvar highest = arrObj[0];\n\tfor (var i = 1; i < arrObj.length; i++) {\n\t\thighest = (arrObj[i] > highest ? arrObj[i] : highest);\n\t\t}\n\treturn (highest);\t\n\t}", "function secondLargest(array) {\n return [...new Set(Array.isArray(array) ? array : [])].filter(e => ['number', 'string'].includes(typeof e) && !isNaN(+e)).map(Number).sort((a, b) => b - a)[1]\n}", "function bestContainer(list){\n var i;\n // Max store.\n var a = 0;\n \n for (i = 0; i < list.length; i++){\n // Get store count.\n var b = _.sum(list[i].store)\n if(a > b){\n // keep a\n }\n else{\n // keep b and list item\n a = b\n var fullestContainer = list[i]\n }\n }\n // Return highest store.\n return fullestContainer;\n}", "function findMax(array) {\n}", "function secondLargest(arr){\n console.log('Sedond Largest');\n var max = 0;\n var second_max = 0;\n if(arr[0] > arr[1]){\n max = arr[0];\n second_max = arr[1];\n } else if(arr[1] > arr[0]){\n second_max = arr[0];\n max = arr[1];\n } else if( arr.length < 2){\n return 'null';\n }\n for(var i = 0; i < arr.length; i++){\n if(arr[i] > max){\n second_max = max;\n max = arr[i];\n }\n }\n return second_max;\n}", "function solution(N, A) {\r\n // write your code in JavaScript (Node.js 8.9.4)\r\n\tlet counters = new Array(N).fill(0);\r\n\tlet maxNum = 0;\r\n\tlet lastMaxNum = 0;\r\n\t\r\n\tA.forEach(item => {\r\n\t\tif (item <= N) {\r\n\t\t\tif (counters[item - 1] < lastMaxNum) {\r\n\t\t\t\tcounters[item - 1] = lastMaxNum;\r\n\t\t\t}\r\n\t\t\tcounters[item - 1]++;\r\n\t\t\t\r\n\t\t\tif (counters[item - 1] > maxNum) {\r\n\t\t\t\tmaxNum = counters[item - 1];\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tlastMaxNum = maxNum;\r\n\t\t}\r\n\t});\r\n\t\r\n\tfor (const i in counters) {\r\n\t\tif (counters[i] < lastMaxNum) {\r\n\t\t\tcounters[i] = lastMaxNum;\r\n\t\t}\r\n\t}\r\n\t\r\n\treturn counters;\r\n}", "function solution(A) {\n\n A.forEach(function(a){\n\n });\n for (var i = 0;i < A.length - 1; i++) {\n if(A[i] > A[i + 1]){\n return i + 1;\n }\n }\n}", "function max(arr){\n\tvar m={};\n\tvar maxNum=0;\n\tvar maxEle=null;\n\tfor(var i=0;i<arr.length;i++){\n\t\tvar atemp=arr[i];\n\t\tm[atemp]===undefined ? (m[atemp]=1) : (m[atemp]++);\n\t\tif(m[atemp]>maxNum){\n\t\t\tmaxEle=atemp;\n\t\t\tmaxNum=m[atemp];\n\t\t\t\n\t\t}\n\t\t\n\t}\n\tconsole.log(\"出现次数最多的是\"+maxEle+\",次数为\"+maxNum);\n}", "function longest(words) {\n\n // O(n) Solved with simple for loop\n // let maxLength = 0;\n // for (let word of words){\n // if (word.length > maxLength){\n // maxLength = word.length;\n // }\n // }\n\n // O(n) Solved with recursion, using an accumulator of out = 0\n // if (i === words.length) return out;\n // if (words[i].length > out) out = words[i].length;\n // return longest(words, out, i + 1);\n\n // O(n^2) solved with recursion, no accumulator\n if (words.length === 0) return 0;\n return words[0].length > longest(words.slice(1))\n ? words[0].length\n : longest(words.slice(1));\n}", "function secondLargest(arr) {\n max = arr[0]\n second = arr[0]\n for (var i = 1; i < arr.length; i++) {\n if (arr[i] > max) {\n second = max\n max = arr[i]\n }\n else if (arr[i] > second && arr[i] < max){\n second = arr[i]\n }\n }\n return second\n}", "function solution(N) {\n // write your code in JavaScript (Node.js 6.4.0)\n var binary = N.toString(2), i, gap = 0, binaryLength = binary.length, theGap = 0;\n //console.log(binary);\n for(i = 0; i <= binaryLength; i++) {\n if(binary[i] == 0) {\n //console.log('Found 0');\n ++gap\n }\n else {\n if(gap > theGap){\n theGap = gap;\n }\n gap = 0;\n }\n }\n return theGap;\n}", "function B(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0}", "function findMode(arr) {\n let freqCounter = createFrequencyCounter(arr);\n \n let count = 0;\n let mostFrequent;\n \n for (let key in freqCounter) {\n if (freqCounter[key] > count) {\n mostFrequent = key;\n count = freqCounter[key];\n }\n }\n \n return +mostFrequent;\n }", "function largestinArr(arr){\n var largest = arr[0];\n for(var i = 0; i<arr.length; i++){\n if(arr[i] > largest){\n largest = arr[i];\n }\n }\n return largest;\n }", "function majorityElement(nums) {\n debugger\n nums.sort((a,b) => b-a);\n return nums[Math.floor(nums.length / 2)];\n}", "function n(t,e){if(t===e)return 0;for(var A=t.length,n=e.length,i=0,r=Math.min(A,n);i<r;++i)if(t[i]!==e[i]){A=t[i],n=e[i];break}return A<n?-1:n<A?1:0}", "function n(t,e){if(t===e)return 0;for(var A=t.length,n=e.length,i=0,r=Math.min(A,n);i<r;++i)if(t[i]!==e[i]){A=t[i],n=e[i];break}return A<n?-1:n<A?1:0}", "function secondLargest(arr){\n arr.sort((a,b)=>a-b);\n return arr[arr.length-2];\n}", "function isBest(val){\n\tif( bestScores[0]<val){\n\t\tbestScores[0]=val;\n\t\tbestScores.sort(function(a, b){return a-b});\n\t\t$(\"#best\").html('BEST RECORDS<br>1st: '+bestScores[2]+'<br>2nd: '+bestScores[1]+'<br>3rd: '+bestScores[0]);\n\t}\n}", "function findBiggestUtxo(utxos) {\n let largestAmount = 0\n let largestIndex = 0\n\n for (var i = 0; i < utxos.length; i++) {\n const thisUtxo = utxos[i]\n\n if (thisUtxo.satoshis > largestAmount) {\n largestAmount = thisUtxo.satoshis\n largestIndex = i\n }\n }\n\n return utxos[largestIndex]\n}" ]
[ "0.69607484", "0.63074785", "0.60324997", "0.59338874", "0.5930371", "0.59152275", "0.58737236", "0.58107764", "0.5809814", "0.57677877", "0.57537836", "0.57359546", "0.5732138", "0.5723706", "0.56955147", "0.56924915", "0.56691045", "0.56568545", "0.5653764", "0.5628573", "0.56276906", "0.5621396", "0.5615667", "0.56148094", "0.56144583", "0.56108755", "0.55951506", "0.5592316", "0.5585329", "0.55510426", "0.55464375", "0.5543974", "0.55317056", "0.55279624", "0.55219007", "0.55200994", "0.55199623", "0.5517614", "0.5511485", "0.5508462", "0.5502001", "0.55003333", "0.54737127", "0.5457649", "0.54572576", "0.5456462", "0.5452678", "0.5444721", "0.5436905", "0.5435604", "0.543519", "0.54350907", "0.54272115", "0.5426608", "0.54214215", "0.5421001", "0.54203093", "0.54133916", "0.5411654", "0.53947246", "0.5393353", "0.5386785", "0.538278", "0.5373933", "0.53729475", "0.53724676", "0.5370175", "0.5367904", "0.5361831", "0.53612405", "0.5361023", "0.5360931", "0.5359127", "0.53572047", "0.5356484", "0.53554434", "0.5349248", "0.5341157", "0.53408265", "0.534038", "0.5336437", "0.5336057", "0.53349537", "0.5333806", "0.5333621", "0.5329215", "0.532697", "0.5326017", "0.53233886", "0.53211427", "0.53171736", "0.5313421", "0.5311992", "0.530999", "0.53063494", "0.53026116", "0.52973485", "0.52973485", "0.52960044", "0.52953833", "0.5293453" ]
0.0
-1
Gives back the id of the asset or makes a new asset
GetAsset(path, type){ var assets = this.assets.getChildren(); //Check there already is an asset entry for this path for(var i = 0; i < assets.length; i++) if(assets[i].getAttribute("src") === path) return assets[i].getAttribute("id"); //Create a new asset entry if it did not exist yet var asset = document.createElement(type); asset.setAttribute("src",path); //Asset id var id = "asset-" + this.asset_id++; asset.setAttribute("id", id); this.assets.appendChild(asset); return id; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAssetId (index) {\n const newAsset = this.filteredAssets[index]\n const result = this.uploadedAssets.find(asset => asset.name === newAsset)\n if (result && result.id) {\n return result.id\n }\n return -1\n }", "function getAsset(assetId) {\n\n // find the asset\n var foundAsset = _.find(includes.Asset, function (asset) {\n\n return asset.sys.id === assetId;\n\n });\n\n// console.log('GETASSET foundAsset:', foundAsset);\n\n // TODO: Think about returning the found object as-is\n return {\n id: assetId,\n title: foundAsset.fields.title,\n url: foundAsset.fields.file.url\n };\n\n }", "async CreateAsset(ctx, id, owner, quantity, execution_date, ISIN, rt, clino, settlement_price,status,block_id,request_ty,trade_id,trade_version_id, source_system_id,source_system,fii,book,counterparty,settlement_date,alpha_status,pricing_currency,principal,order_id,order_slang) {\n const exists = await this.AssetExists(ctx, id);\n if (exists) {\n throw new Error(`The asset ${id} already exists`);\n }\n\n const asset = {\n ID: id,\n Owner: owner,\n Quantity: quantity,\n Execution_date: execution_date,\n ISIN: ISIN,\n RT: rt,\n CLINO: clino,\n Settlement_price: settlement_price,\n Status: status,\n Block_ID: block_id,\n Request_Ty: request_ty,\n Trade_ID: trade_id,\n Trade_Version_ID: trade_version_id, \n Source_System_ID: source_system_id,\n Source_System: source_system,\n FII: fii,\n Book: book,\n Counterparty: counterparty,\n Settlement_Date: settlement_date,\n Alpha_status: alpha_status,\n Pricing_Currency:pricing_currency,\n Principal: principal,\n Order_ID: order_id,\n Order_Slang: order_slang\n };\n \n await ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));\n return JSON.stringify(asset);\n }", "assetID(id) {\n this.query['asset-id'] = id;\n return this;\n }", "function saveAsset(libAsset){\n let xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function() {\n if(xhr.readyState === 4){\n // get the new library asset with a generated id\n var updatedAsset = JSON.parse(xhr.responseText);\n\n // add the new asset to the table\n addAssetToTable(updatedAsset);\n\n // reset the new asset form\n // this line is in here to avoid some cases of the post request failing\n setCreateFormState();\n\n // let the user know what the new id is\n alert('Asset created with ID: ' + updatedAsset.assetId);\n }\n }\n\n xhr.open('POST', '/library-api/api/library-asset');\n\n xhr.send(JSON.stringify(libAsset));\n}", "function createAsset(mnemonic, defaultFrozen, decimals, totalIssuance, unitName, assetName, assetUrl, manager, reserve, freeze, clawback) {\n var p = new Promise(function (resolve, reject) {\n let account = algosdk.mnemonicToSecretKey(mnemonic);\n // get chain parameters for sending transactions\n algodclient.getTransactionParams().do().then((params) => {\n // use note parameter when you want to attach a string to the transaction\n let note = undefined;\n let assetMetadataHash = undefined;\n // construct the asset creation transaction \n let txn = algosdk.makeAssetCreateTxnWithSuggestedParams(account.addr, note, totalIssuance, decimals, defaultFrozen,\n manager, reserve, freeze, clawback, unitName, assetName, assetUrl, assetMetadataHash, params);\n var signedTxn = algosdk.signTransaction(txn, account.sk);\n algodclient.sendRawTransaction(signedTxn.blob).do().then((tx) => {\n waitForConfirmation(algodclient, tx.txId).then((msg) => {\n console.log(msg);\n algodclient.pendingTransactionInformation(tx.txId).do().then((ptx) => {\n // get the asset ID\n let assetId = ptx[\"asset-index\"];\n resolve(assetId);\n }).catch(reject);\n }).catch(console.log);\n }).catch(console.log);\n }).catch(reject);\n})\n return p;\n}", "function registerAsset(asset){// `push` returns new array length, so the first asset will\n// get id 1 (not 0) to make the value truthy\nreturn assets.push(asset);}", "async TransferAsset(ctx, id, newOwner) {\r\n const assetString = await this.ReadAsset(ctx, id);\r\n const asset = JSON.parse(assetString);\r\n asset.Owner = newOwner;\r\n return ctx.stub.putState(id, Buffer.from(JSON.stringify(asset)));\r\n }", "function handleCreate( res, obj ) {\n if( res.error ) {\n alert( Template.templates.errorWord + res.error );\n return;\n }\n \n var xid = res.result.asset_id.toString() || obj.asset_id;\n app.assetCache.deleteItem( xid );\n\n // Somehow, Vox's code wraps an array in a custom object, which is then \n // used for JSON encoding. We simulate same with a hardcoded \n // toJSON function.\n tmpArray = new Array();\n tmpArray.push(xid);\n tmpArray.toJSON = function() {\n return \"[\\\"\" + xid + \"\\\"]\";\n }\n app.insertAsset({\n ids: tmpArray,\n format: 'auto',\n align: 'center'\n });\n this.close();\n}", "function updateAsset(_id, assetParam){\n\t\n\t var deferred = Q.defer();\n \n //remove the '_id' property from the object\n\t\tvar set = _.omit(assetParam, '_id');\n\t\n\n //use mongo.helper.toObjectID() when using '_id' in queries\n // use $set to apply changes while retaining existing information in the database\n //not using $set and passing an object to update() 's second parameter will rewrite the whole document\n //find if there is another document (different _id) with the same asset_tag\n db.assets.findOne({asset_tag: assetParam.asset_tag, _id: {$not: { $eq: mongo.helper.toObjectID(_id)}}}, function(err, asset){\n if(err){\n deferred.reject(err);\n }\n else if(asset){\n deferred.reject({exists: true});\n }\n else{\n db.assets.update({_id: mongo.helper.toObjectID(_id)}, {$set: set}, function(err){\n if(err) {\n deferred.reject(err);\n console.log(err);\n }\n \n deferred.resolve();\n });\n }\n }); \n \n return deferred.promise; \n }", "getAssetByID(assetId) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n return yield this.getRestData(`/v2/assets/${assetId}`);\n });\n }", "function getAsset(namespace, type, id, bnc) {\n logger.debug('getAsset() called for ' + namespace + '.' + type + '#' + id);\n return new Promise((resolve, reject) => {\n return bnc.getAssetRegistry(namespace + '.' + type).then((reg) => {\n return reg.resolve(id).then((asset) => {\n resolve(asset);\n });\n }).catch((error) => {\n logger.error(error.message);\n reject(error);\n });\n });\n}", "function addAsset(assetParam){\n var deferred = Q.defer();\n \n //check for duplicate 'asset_tag' s\n\t db.assets.findOne({ asset_tag: assetParam['asset_tag'] },\n function (err, asset) {\n if (err) deferred.reject(err);\n \n if (asset) {\n deferred.reject({exists: true});\n } else {\n //if no duplicates, insert to database\n db.assets.insert(assetParam, function(err){\n\t\t\t\t\tif (err) deferred.reject(err);\n\t\t\t\t\tdeferred.resolve();\n\t\t\t\t});\n }\n });\n\n\n // Asset.create(assetParam, function(err){\n // if (err) deferred.reject(err);\n // console.log(err)\n // deferred.resolve();\n // });\n \n return deferred.promise;\n}", "async ReadAsset(ctx, id) {\r\n const assetJSON = await ctx.stub.getState(id); // get the asset from chaincode state\r\n if (!assetJSON || assetJSON.length === 0) {\r\n throw new Error(`The asset ${id} does not exist`);\r\n }\r\n return assetJSON.toString();\r\n }", "async ReadAsset(ctx, id) {\n const assetJSON = await ctx.stub.getState(id); // get the asset from chaincode state\n if (!assetJSON || assetJSON.length === 0) {\n throw new Error(`The asset ${id} does not exist`);\n }\n return assetJSON.toString();\n }", "async ReadAsset(ctx, id) {\n const assetJSON = await ctx.stub.getState(id); // get the asset from chaincode state\n if (!assetJSON || assetJSON.length === 0) {\n throw new Error(`The asset ${id} does not exist`);\n }\n return assetJSON.toString();\n }", "deleteAsset (assetId, assetIndex) {\n console.log('Deleting ' + this.filteredAssets[assetIndex])\n this.octo.repos.deleteReleaseAsset({\n owner: this.config.owner,\n repo: this.config.repo,\n asset_id: assetId\n }).then(result => {\n console.log('Deleted successfully...')\n this.deleteAssetId(assetId)\n this.uploadAsset(assetIndex)\n }).catch(function (e) {\n throw new Error('Unhandled response for deleteAsset: ' + e)\n })\n }", "function checkAsset(client, req) {\n //console.log('name: ['.concat(req.name).concat('] : ').concat(req.priceUsd).concat(' supply ').concat(req.supply));\n const query = \"SELECT * FROM asset WHERE name = ?\";\n client.execute(query, [req.name], (err, result) => {\n if (err) {\n console.log('error: '.concat(err));\n return {msg: err, code: -1};\n }\n if (result.first() !== null) {\n updateAsset(client, result.first().name, result.first().symbol, req, function (err, code) {\n if (code !== 0) {\n console.log(tynt.Red('error').concat(' update asset failed ').concat(err));\n }\n });\n insertData(client, result.first().id, req.priceUsd, function (err, code) {\n if (code !== 0) {\n console.log(tynt.Red('error').concat(' saving data: ').concat(err));\n }\n });\n } else {\n insertAsset(client, req, function (err, code, uuid) {\n if (code === 0) {\n console.log('asset '.concat(req.name).concat(' saved'));\n insertData(client, uuid, req.price, function (err, code) {\n if (code === 0) {\n //console.log('data '.concat(' saved'));\n } else {\n console.log(tynt.Red('error').concat(' saving data: ').concat(err));\n }\n });\n } else {\n console.log(tynt.Red('error').concat(' saving asset: ').concat(err));\n }\n });\n }\n });\n}", "get mainAsset() {}", "function registerAsset(asset) {\n // `push` returns new array length, so the first asset will\n // get id 1 (not 0) to make the value truthy\n return assets.push(asset);\n}", "function registerAsset(asset) {\n // `push` returns new array length, so the first asset will\n // get id 1 (not 0) to make the value truthy\n return assets.push(asset);\n}", "getAsset(input) {\n return (this.assets.find((asset) => {\n return asset.input === input;\n }) || null);\n }", "function AssetManager()\n{\n var assets = [];\n var selectedAssets = [];\n\n var createAssetAction;\n\n this.CreateAsset = function (assetType, asset, notPhysical)\n {\n window.scene.add(asset);\n\n if (!notPhysical)\n {\n asset.userData.isAsset = true;\n collidableMeshList.push(asset);\n }\n\n asset.name = assetType + \" \" + asset.id;\n\n if (!createAssetAction)\n {\n createAssetAction = new CreateAction();\n createAssetAction.Initialize(asset);\n\n actionManager.ActionPerformed(createAssetAction);\n\n createAssetAction = null;\n }\n\n\n assets.push(asset);\n\n Efficio.MessagingSystem.Bus.publish({\n channel: 'Asset',\n topic: 'Create',\n source: \"Charet\",\n data: {\n asset: asset,\n physics: !notPhysical\n }\n });\n }\n\n this.GetAssets = function ()\n {\n return assets;\n }\n\n this.UpdateAsset = function (asset)\n {\n var sceneAsset = scene.getObjectById(asset.name);\n\n sceneAsset.position.copy(asset.position);\n }\n\n this.SelectAsset = function (asset)\n {\n asset.AddHandlesToAsset();\n asset.ChangeAssetColorSelected();\n\n selectedAssets.push(asset);\n }\n\n this.SelectAllAssets = function ()\n {\n for (var asset in assets)\n {\n this.SelectAsset(asset);\n }\n }\n\n this.GetSelectedAssets = function ()\n {\n return selectedAssets;\n }\n\n this.IsSelectedAsset = function (asset)\n {\n for (var i = 0; i < selectedAssets.length; i++)\n {\n if (asset.name === selectedAssets[i].name)\n {\n return true;\n }\n }\n\n return false;\n }\n\n this.DeselectAsset = function (asset)\n {\n for (var i = 0; i < selectedAssets.length; i++)\n {\n if (asset.name === selectedAssets[i].name)\n {\n selectedAssets[i].RemoveHandlesFromAsset();\n selectedAssets[i].ChangeAssetColorDeselected();\n selectedAssets.splice(i, 1);\n }\n }\n }\n\n this.DeselectAllAssets = function ()\n {\n for (var asset in this.GetSelectedAssets())\n {\n asset.RemoveHandlesFromAsset();\n asset.ChangeAssetColorDeselected();\n }\n\n selectedAssets = [];\n } \n\n var updateBoundingBoxesOfSelectedAssets = function (frame)\n {\n var selectedAssets = assetManager.GetSelectedAssets();\n\n for (var i = 0; i < selectedAssets.length; i++)\n {\n if (selectedAssets[i].hasBeenMoved)\n {\n selectedAssets[i].geometry.computeBoundingBox();\n }\n }\n }\n\n frameActions.RegisterAction(\"UpdateBoundingBoxesOfSelectedAssets\", updateBoundingBoxesOfSelectedAssets);\n}", "function getAsset(model) {\n\n var asset = {};\n\n var idField = model.getField('*.id');\n\n if (idField) {\n asset['id'] = idField.value;\n }\n\n var nameField = model.getField('overview.name');\n\n if (nameField) {\n asset['name'] = nameField.value;\n }\n\n\n // asset['lifeCycle']=model.getField('*.lifeCycle').value;\n // asset['lifeCycleState']=model.getField('*.lifeCycleState').value;\n\n return asset;\n }", "function Asset(id, src) {\n this.id = id;\n this.src = src;\n }", "saveAsset ({ commit, dispatch }, { asset }) {\n commit('SAVE_ASSET', asset)\n }", "set mainAsset(value) {}", "function newAsset(sender, type) {\n assets = remote.getGlobal(\"assets\");\n if (type == \"image\") {\n Swal.fire({\n title: config.newPhotoMessage + \" \" + sender,\n showConfirmButton: false,\n timer: 5000,\n type: \"success\"\n }).then((value) => {\n currentAssetIndex = assets.length;\n loadAsset(true, 0);\n });\n } else if (type == \"video\") {\n Swal.fire({\n title: config.newVideoMessage + \" \" + sender,\n showConfirmButton: false,\n timer: 5000,\n type: \"success\"\n }).then((value) => {\n currentAssetIndex = assets.length;\n loadAsset(true, 0);\n });\n } else if (type == \"document\") {\n Swal.fire({\n title: config.newPhotoMessage + \" \" + sender,\n showConfirmButton: false,\n timer: 5000,\n type: \"success\"\n }).then((value) => {\n currentAssetIndex = assets.length;\n loadAsset(true, 0);\n });\n } else if (type == \"text\") {\n Swal.fire({\n title: config.newTextMessage + \" \" + sender,\n showConfirmButton: false,\n timer: 5000,\n type: \"success\"\n }).then((value) => {\n currentAssetIndex = assets.length;\n loadAsset(true, 0);\n });\n }\n}", "function getAssetFormData(){\n // Retrieve data from the Manage Asset form\n var newAssetId = document.getElementById('asset-id-input').value;\n var newTitle = document.getElementById('title-input').value;\n var newAuthor = document.getElementById('author-input').value;\n var newMediaType = document.getElementById('media-type-input').value;\n var newLanguage = document.getElementById('language-input').value;\n var newCollection = document.getElementById('collection-input').value;\n var newLocation = document.getElementById('location-input').value;\n var newLoanType = document.getElementById('loan-type-input').value;\n var newInterLibLoan = document.getElementById('inter-lib-loan-input').checked;\n\n // put the data into a library asset object\n var libAsset = {\n assetId : newAssetId,\n title : newTitle,\n author : newAuthor,\n mediaType : newMediaType,\n language : newLanguage,\n collection : newCollection,\n location : newLocation,\n loanType : newLoanType,\n interLibLoan : newInterLibLoan\n };\n\n return libAsset;\n}", "function check_assetItem (obj, call_shotgun)\r\n {\r\n // define if obj is an object (and dict entry) or an array (coming from shotObj.background_assets)\r\n // check obj status according to Shotgun and/or assets_list\r\n // update the obj using asset_item\r\n // return updated asset_item >> this has to be an OBJECT !\r\n assets_list = readFile(episodeFolder, 'asset');\r\n // if it is an array process to transform to obj\r\n if (obj instanceof Array)\r\n {\r\n if (obj[1].match(/re-use/gi))\r\n {\r\n obj = new reuse_BGAssetObj (obj[2],obj[0]);\r\n }\r\n else if (!obj[1].match(/re-use|undefined/gi))\r\n {\r\n bgasset_name = obj[0];\r\n if (bgasset_name in assets_list)\r\n {\r\n // get the obj from the list\r\n obj = assets_list[bgasset_name];\r\n };\r\n }\r\n else\r\n {\r\n log('err', [$.line, decodeURI(File($.fileName).name)], obj.toSource() + \"\\nis not a valid BG object !\");\r\n };\r\n }\r\n if (obj instanceof Object && obj.BGType != 're-use') // new asset and not BG reuse\r\n {\r\n if (call_shotgun == true)\r\n {\r\n // this part will ask shotgun if asset is uploaded or not\r\n // and if asset has task assigned\r\n // then change asset.status and asset.sg_id accordingly\r\n // first create temp file in local dir containing asset_obj\r\n tmp_path = \"~/Documents/AdobeScripts/ExportTool/.temp\";\r\n tmpFile = new File (tmp_path);\r\n tmpFile.open(\"w\",\"TEXT\",\"????\");\r\n tmpFile.write (obj.toSource());\r\n tmpFile.close();\r\n // then call python script to check the asset\r\n ext_py_script = localize (py_scripts_path, \"sg_checkAssetStatus.py\");\r\n pythonScript = system.callSystem (python_path + ' \\\"' + ext_py_script + '\\\" -a \\\"' + tmp_path + '\\\"');\r\n result = eval(pythonScript);\r\n \r\n log('debug', [$.line, decodeURI(File($.fileName).name)], \"Shotgun call result:\\n\"+ obj['name'] + \"\\n\" + String(result));\r\n if (result[0] == obj['name'] && result[1] != 'undefined')\r\n {\r\n // asset found on shotgun\r\n // if asset has tasks assigned, status = locked, else status = uploaded\r\n // sg_id updated with id of corresponding asset\r\n obj.status = result[1];\r\n obj.sg_id = result[2];\r\n return obj;\r\n }\r\n else\r\n {\r\n // cannot find an asset on shotgun\r\n return obj;\r\n }\r\n }\r\n else\r\n {\r\n // keep obj as it is, and do not update asset.status\r\n return obj;\r\n }\r\n }\r\n else if (obj instanceof Object && obj.BGType == 're-use')\r\n {\r\n // keep obj as it is, and do not update asset.status\r\n return obj;\r\n }\r\n else\r\n {\r\n log('err', [$.line, decodeURI(File($.fileName).name)], (typeof obj) + \"\\nis not valid type of asset !\\n[\"+obj+\"]\");\r\n return;\r\n };\r\n }", "function updateAsset(libAsset){\n let xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function() {\n if(xhr.readyState === 4){\n deleteRowByAssetId(libAsset.assetId);\n addAssetToTable(libAsset);\n \n alert('Asset with ID ' + libAsset.assetId + ' was updated.');\n }\n }\n\n xhr.open('PUT', '/library-api/api/library-asset');\n\n xhr.send(JSON.stringify(libAsset));\n}", "async readMyAsset(ctx, myAssetId) {\n\n const exists = await this.myAssetExists(ctx, myAssetId);\n\n if (!exists) {\n // throw new Error(`The my asset ${myAssetId} does not exist`);\n let response = {};\n response.error = `The my asset ${myAssetId} does not exist`;\n return response;\n }\n\n const buffer = await ctx.stub.getState(myAssetId);\n const asset = JSON.parse(buffer.toString());\n return asset;\n }", "async createAsset() {\n if (!this.state.createAssetName ||\n !this.state.createAssetSymbol ||\n !this.state.createAssetDecimals ||\n !this.state.createAssetTotalSupply) return\n\n let totalSupplyString = this.state.createAssetTotalSupply.toString();\n let totalSupplyBN = this.makeBigNumber(totalSupplyString, this.state.createAssetDecimals);\n let totalSupplyBNHex = \"0x\" + totalSupplyBN.toString(16);\n\n let data = {\n from: this.state.account.address,\n name: this.state.createAssetName,\n symbol: this.state.createAssetSymbol,\n decimals: this.state.createAssetDecimals,\n total: totalSupplyBNHex\n };\n\n\n await web3.fsntx.buildGenAssetTx(data).then(tx => {\n tx.chainId = _CHAINID;\n let gasPrice = web3.utils.toWei(new web3.utils.BN(100), \"gwei\");\n tx.gasPrice = gasPrice.toString();\n return web3.fsn\n .signAndTransmit(tx, this.state.account.signTransaction)\n .then(txHash => {\n this.addOutput(`Transaction Hash : ${txHash}`);\n });\n });\n\n }", "function assetAcquired(assetId) {\n if (assets.assetUseCounts[assetId] === undefined) {\n assets.assetUseCounts[assetId] = 1;\n return;\n }\n assets.assetUseCounts[assetId]++;\n }", "async insertAsset(stub, args, thisClass) {\n if (args.length != 6) { \n\t\tthrow new Error('Incorrect number of arguments. Expecting 6.')\n\t}\n let orderid = args[0] \n\tlet assetState = await stub.getState(orderid)\n\tif (assetState.toString()) {\n\t\tthrow new Error('This asset already exists: ' + orderid)\n\t}\n console.info('--- start insertAsset ---')\n\tlet orderdetails = args[1] \n\tlet itemdetails = args[2] \n\tlet buyerdata = args[3] \n\tlet shippingdata = args[4] \n\tlet customerPO = args[5] \n\n\n \tif (orderdetails.length <= 0) { \n\t\tthrow new Error('Argument orderdetails must be a non-empty string') \n\t}\tif (itemdetails.length <= 0) { \n\t\tthrow new Error('Argument itemdetails must be a non-empty string') \n\t}\tif (buyerdata.length <= 0) { \n\t\tthrow new Error('Argument buyerdata must be a non-empty string') \n\t}\tif (shippingdata.length <= 0) { \n\t\tthrow new Error('Argument shippingdata must be a non-empty string') \n\t}\tif (customerPO.length <= 0) { \n\t\tthrow new Error('Argument customerPO must be a non-empty string') \n\t}\n let asset = {}\n\tasset.docType = \"Order Asset\"\n\tasset.orderid = orderid\n\tasset.orderdetails = orderdetails\n\tasset.itemdetails = itemdetails\n\tasset.buyerdata = buyerdata\n\tasset.shippingdata = shippingdata\n\tasset.customerPO = customerPO\n\n\tawait stub.putState(orderid, Buffer.from(JSON.stringify(asset)))\n\n }", "async UpdateAsset(ctx, id, color, size, owner, appraisedValue) {\r\n const exists = await this.AssetExists(ctx, id);\r\n if (!exists) {\r\n throw new Error(`The asset ${id} does not exist`);\r\n }\r\n\r\n // overwriting original asset with new asset\r\n const updatedAsset = {\r\n ID: id,\r\n Color: color,\r\n Size: size,\r\n Owner: owner,\r\n AppraisedValue: appraisedValue,\r\n };\r\n return ctx.stub.putState(id, Buffer.from(JSON.stringify(updatedAsset)));\r\n }", "function cloneAsset(ele){\n let temp = document.getElementById(\"temp_asset\")\n let clone = document.importNode(temp.content, true)\n let id =`asset_${ele.name.split('.')[0]}`\n assetImage = clone.querySelector('img')\n assetImage.id = id\n assetImage.src = `${BASE_IMAGE_ROOT}${ele.name}`\n assetImage.crossOrigin = 'Anonymous'\n assetImage.onerror = function() { this.style.display = 'none' }\n assetImage.addEventListener('click', event => { \n setCurrentSymbol(event)\n document.getElementById('asset').style.display = \"none\"\n }) \n return clone\n }", "async AssetExists(ctx, id) {\r\n const assetJSON = await ctx.stub.getState(id);\r\n return assetJSON && assetJSON.length > 0;\r\n }", "uploadAsset (assetIndex) {\n if (assetIndex >= this.filteredAssets.length) {\n console.log('Assets uploaded successfully...')\n return\n }\n\n const asset = this.filteredAssets[assetIndex]\n console.log('Uploading ' + asset)\n\n // Check if it's uploaded.\n const assetId = this.getAssetId(assetIndex)\n if (assetId !== -1) {\n console.log(asset + ' is existing, so it will be deleted')\n // Asset exists, so we need to delete it first.\n this.deleteAsset(assetId, assetIndex)\n return\n }\n\n const assetUrl = path.join(this.config.dir, asset)\n this.octo.repos.uploadReleaseAsset({\n url: this.release.upload_url,\n file: fs.readFileSync(assetUrl),\n name: asset,\n headers: {\n 'content-type': mime.getType(assetUrl),\n 'content-length': fs.statSync(assetUrl).size\n }\n }).then(result => {\n console.log('Uploaded successfully...')\n this.uploadAsset(assetIndex + 1)\n }).catch(function (e) {\n throw new Error('Unhandled response for uploadAsset: ' + e)\n })\n }", "function getAssets(assetID) {\n //console.log(`Assets being found`);\n const quizAssets = ASSETS.find(function(asset) {\n return asset.id === assetID;\n });\n return quizAssets;\n}", "async AssetExists(ctx, id) {\n const assetJSON = await ctx.stub.getState(id);\n return assetJSON && assetJSON.length > 0;\n }", "function addAssetToTable(libAsset){\n\n // Create the row and data elements to add to the asset list table\n var newRow = document.createElement('tr');\n var editIcon = document.createElement('td');\n var assetId = document.createElement('td');\n var title = document.createElement('td');\n var author = document.createElement('td');\n var mediaType = document.createElement('td');\n var language = document.createElement('td');\n var collection = document.createElement('td');\n var location = document.createElement('td');\n var loanType = document.createElement('td');\n var interLibLoan = document.createElement('td');\n\n // This is the html for two clickable icons to put in the first column\n // Clicking the first (pencil) icon will bring up the manage-asset-modal in the 'update' state\n // Clicking the second (trash) icon will delete the row and its corresponding asset\n var pencilIcon = \n `<a href=\"#\" onclick=\"editIconClick(this)\" data-bs-toggle=\"modal\" data-bs-target=\"#manage-asset-modal\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-pencil-square\" viewBox=\"0 0 16 16\">\n <title>Edit Asset</title>\n <path d=\"M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z\"/>\n <path fill-rule=\"evenodd\" d=\"M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z\"/>\n </svg></a>\n <a href=\"#\" onclick=\"deleteIconClick(this)\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-trash\" viewBox=\"0 0 16 16\">\n <title>Delete Asset</title>\n <path d=\"M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z\"/>\n <path fill-rule=\"evenodd\" d=\"M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z\"/>\n </svg></a>\n `;\n\n // set the values for each data element\n editIcon.innerHTML = pencilIcon;\n assetId.innerText = libAsset.assetId;\n title.innerText = libAsset.title;\n author.innerText = libAsset.author;\n mediaType.innerText = libAsset.mediaType;\n language.innerText = libAsset.language;\n collection.innerText = libAsset.collection;\n location.innerText = libAsset.location;\n loanType.innerText = libAsset.loanType;\n if(libAsset.interLibLoan){\n interLibLoan.innerText = \"Yes\";\n }else{\n interLibLoan.innerText = \"No\";\n }\n\n // add the data elements to the row\n newRow.appendChild(editIcon);\n newRow.appendChild(assetId);\n newRow.appendChild(title);\n newRow.appendChild(author);\n newRow.appendChild(mediaType);\n newRow.appendChild(language);\n newRow.appendChild(collection);\n newRow.appendChild(location);\n newRow.appendChild(loanType);\n newRow.appendChild(interLibLoan);\n\n // add the row to the table body\n document.getElementById('asset-list-body').appendChild(newRow);\n}", "spawnAsset(asset) {\n var vertices = this.worldVertices();\n var faces = this.worldFaces();\n \n // get vertex from idx stored in face\n var faceIdx = Math.max(0, \n Math.min(Math.floor(Math.random() * faces.length), faces.length - 1));\n var vIdx = Math.max(0, \n Math.min(Math.floor(Math.random() * 3), 2));\n \n var face = faces[faceIdx];\n\n var arr = ['a', 'b', 'c'];\n var char = arr[vIdx];\n \n var vertex = vertices[face[char]];\n asset.vertex = vertex;\n\n // add asset to a random point on the sphere\n this.addAsset(asset, vertex); \n\n // assign normal\n \n asset.faceIdx = faceIdx;\n asset.vIdx = vIdx;\n asset.normal = this.getNormal(asset);\n asset.alignItemsWithNormal(); \n }", "onEditPressed(asset) {\n this.showUpdateAsset(asset);\n }", "async DeleteAsset(ctx, id) {\r\n const exists = await this.AssetExists(ctx, id);\r\n if (!exists) {\r\n throw new Error(`The asset ${id} does not exist`);\r\n }\r\n return ctx.stub.deleteState(id);\r\n }", "function createAssets(config) {\n if(!config.type) {\n console.error(\"You have to specify a type of element to create.\");\n return 0;\n }\n // merge config with assetProps\n var assetProps = {\n \"type\": config[\"type\"],\n \"asset-type\": config[\"asset-type\"],\n \"editable\": config.editable,\n \"id\": config.id || \"asset\" + Math.floor(Math.random() * 1000),\n \"left\": config.left || Math.floor(Math.random() * 500),\n \"top\": config.top || Math.floor(Math.random() * 200),\n \"class\": config.class || \"asset \" + config[\"asset-type\"],\n \"text\": config.text || \"\"\n };\n\n // create the asset with assigned properties\n var asset = $(\"<div>\", {\n id: assetProps['id'],\n class: assetProps['class'],\n \"data-type\": assetProps['type'],\n \"data-asset-type\": assetProps['asset-type'],\n \"data-editable\": assetProps['editable']\n }).offset({\n \"left\": assetProps['left'],\n \"top\": assetProps['top']\n });\n\n var action_btns = $(\"<div>\", {\n class: \"btn_action_container\",\n }).hide();\n\n var btn_close = $(\"<div>\", {\n class: \"btn_close btn_action\"\n }).on(\"click\", function() {\n var asset = $(this).closest(\".asset\");\n asset.remove();\n ComicCache.remove(asset.attr(\"id\"));\n }).appendTo(action_btns);\n\n if(config.editable) {\n assetProps['editable'] = true;\n asset.append($(\"<p>\")\n .on(\"blur\", function() {\n // update the cache with the content\n var currAssetID = $(this).closest(\".asset\").attr(\"id\");\n var currAssetProp = ComicCache.get(currAssetID);\n currAssetProp.text = $(this).text();\n ComicCache.update(currAssetID, currAssetProp);\n })\n .text(assetProps[\"text\"])\n .attr(\"contenteditable\", \"true\")\n .addClass(\"asset_txt\"));\n var btn_edit = $(\"<div>\", {\n class: \"btn_edit btn_action\"\n }).appendTo(action_btns);\n }\n\n asset.append(action_btns);\n asset.appendTo($(\"section#content\"));\n asset.draggable({\n containment: \"section#content\",\n scroll: false,\n stop: function(evt) {\n // update cache\n var currElem = $(this);\n var updatedAssetProps = {\n \"id\": currElem.attr('id'),\n \"left\": currElem.offset()['left'],\n \"top\": currElem.offset()['top'],\n \"class\": currElem.attr('class'),\n \"type\": currElem.data('type'),\n \"asset-type\": currElem.data('asset-type'),\n \"editable\": (currElem.data('editable')) ? true : false,\n \"text\": currElem.text()\n };\n // update cache after element is moved around\n ComicCache.update(currElem.attr(\"id\"), updatedAssetProps);\n }\n });\n asset.hover(function() {\n action_btns.toggle();\n });\n\n // update cache after element is loaded\n ComicCache.update(assetProps.id, assetProps);\n }", "async DeleteAsset(ctx, id) {\n const exists = await this.AssetExists(ctx, id);\n if (!exists) {\n throw new Error(`The asset ${id} does not exist`);\n }\n return ctx.stub.deleteState(id);\n }", "fetchInventoryItem(id){\r\n return Api().get('/inventory/' + id)\r\n }", "addAsset(assetConfig) {\n const asset = new resources_1.Asset({\n input: slash_1.default(assetConfig.input),\n output: slash_1.default(assetConfig.output)\n });\n this.assets.push(asset);\n return asset;\n }", "static createInstance(manufacturer, assetNumber, assetType) {\n\n let newAsset = new Asset({ manufacturer, assetNumber});\n newAsset.assetType = assetType;\n return newAsset;\n }", "function deleteAsset(libAsset){\n let xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = function() {\n if(xhr.readyState === 4){\n deleteRowByAssetId(libAsset.assetId);\n \n alert('Asset with ID ' + libAsset.assetId + ' was deleted.');\n }\n }\n\n xhr.open('DELETE', '/library-api/api/library-asset');\n\n xhr.send(JSON.stringify(libAsset));\n}", "async CreateAsset(ctx, id, laborname, firstname, lastname,birthdate, location, dateandtime, result ) {\r\n const exists = await this.AssetExists(ctx, id);\r\n if (exists) {\r\n throw new Error(`The asset ${id} already exists`);\r\n }\r\n\r\n \r\n\t\tlet testedPersonObject = new TestedPerson( id,firstname,lastname, birthdate\r\n\t\t\r\n\t\t ,laborname,location,dateandtime,result);\r\n\t\t\t\t\t\t\t\t\t\t\t\t \r\n\t\ttestedPersonObject.docType = 'testedPerson';\t\t\t\t\t\t\t\t\t\t \r\n\t\t\r\n await ctx.stub.putState(id, Buffer.from(JSON.stringify(testedPersonObject)));\r\n return JSON.stringify(testedPersonObject);\r\n }", "function blockchainifyAssetId(assetId) {\n if (!assetId)\n throw new Error('Asset ID should not be empty');\n return assetId === constants.WAVES ? '' : assetId;\n}", "async function createApiManagerInstance(assetId, version, groupId) {\n const posting = `{\"endpoint\": { \"type\": \"rest-api\", \"uri\": \"http://google.com\", \"proxyUri\": null, \"muleVersion4OrAbove\": true, \"isCloudHub\": false }, \"instanceLabel\": \"${assetId}\",\"spec\": { \"assetId\": \"${assetId}\", \"version\": \"${version}\", \"groupId\": \"${groupId}\" }}`;\n const token = await getToken();\n const orgId = await getOrganizationId(token);\n const envId = await getDefaultEnvironmentId(token);\n const options = {\n method: 'POST',\n uri: `https://anypoint.mulesoft.com/apimanager/api/v1/organizations/${orgId}/environments/${envId}/apis`,\n // proxy: 'http://proxy.corp.fin:8080',\n body: JSON.parse(posting),\n headers: { Authorization: `bearer ${token}`, 'Content-Type': 'application/json' },\n json: true,\n };\n\n const data = await request(options)\n .then(response => response)\n .catch(err => err);\n\n return data.id;\n}", "retrieveDeletedAsset({commit, state, dispatch}) {\n\n // Run this with \"isRetrieving\" value as true\n dispatch('installNewAssetLocal', true)\n\n }", "function makeItem(id) {\n return getJSON(baseUrl + \"item/\" + id + \".json\");\n}", "function getSet(req, res) {\n var setId = req.swagger.params.setId.value;\n pimaasManger.getPimTx(setId).then(function(pimTx){\n res.status(200).json(pimTx.getTx().asset.data);\n }).catch(function(err) {\n console.log(err)\n res.status(400).json(err);\n })\n}", "deleteAsset ({ commit, dispatch }, { asset }) {\n commit('DELETE_ASSET', asset)\n }", "constructor() {\n this._ah = new igcext.AssetHandler();\n this._id_gen = 0;\n this._objectIdentitiesToIds = {};\n }", "function getAssetInfo(){\n\treturn {\n\t\t'position': {\"x\":-18,\"y\":-17,\"w\":37,\"h\":17},\n\t\t'thumb': \"iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM\\/rhtAAAAHElEQVR42u3BAQEAAACCIP+vbkhA\\nAQAAAAAAfBoZKAABfmfvpAAAAABJRU5ErkJggg==\",\n\t};\n}", "function save (id) {\n console.log('save - id', id);\n // find record\n image.update({_id: id}, {temporary: 0}, function (err, i) {\n if(err) { console.log (err); }\n console.log(i);\n });\n}", "function clickID() {\n const newBook = {\n id: props.id,\n title: props.title, \n authors: props.authors, \n desc: props.desc,\n pic: props.pic, \n link: props.link\n }\n console.log(newBook);\n API.save(newBook);\n }", "function createOrLinkCiToAsset(query, limit, dryRun) {\n try {\n var grAsset = new GlideRecord(\"alm_asset\");\n grAsset.addEncodedQuery(query);\n if (limit > 0) {\n grAsset.setLimit(limit);\n }\n grAsset.query();\n\n while(grAsset.next()) {\n\n //NOTE: Not ideal to do a nested query like tis but this fix script shouldn't be ran often or with huge numbers to casue a performance impact\n var currentAssetTag = grAsset.getValue(\"asset_tag\");\n var grCi = getCiByAssetTag(currentAssetTag);\n if(grCi === false) {\n gs.log(\"createOrLinkCiToAsset(): Creating CI Record for Asset: \" + grAsset.getValue('asset_tag'), \"Asset Update\");\n \n if(dryRun === false) {\n\t\t\t\t\t(new AssetandCI()).createCI(grAsset);\n\t\t\t\t\tgrAsset.update();\n }\n } else {\n gs.log(\"createOrLinkCiToAsset(): Linking CI Record for Asset: \" + grAsset.getValue('asset_tag'), \"Asset Update\");\n\n if(dryRun === false) {\n grAsset.setValue(\"ci\", grCi.getValue(\"sys_id\"));\n grAsset.update();\n \n grCi.setValue(\"asset\", grAsset.getValue(\"sys_id\"));\n grCi.update();\n }\n }\n }\n } catch (ex) {\n gs.addErrorMessage(ex);\n gs.error(\"createOrLinkCiToAsset(): Exception: Failed to Create or Link CI Record \"\n + \"\\nMessage : \" + ex.message\n + \"\\nLineNumber : \" + ex.lineNumber\n + \"\\nSourceName : \" + ex.sourceName\n + \"\\nName: \" + ex.name, \"Asset Update\");\n return false;\n }\n}", "deleteAssetId (assetId) {\n this.uploadedAssets =\n this.uploadedAssets.filter(asset => asset.id !== assetId)\n }", "async function activateAsset(asset='mateo.randulfe1') {\n// eslint-disable prefer-const\n let myUser = await getAccount();\n\n let config = {\n headers: {\n 'x-access-token': myUser.token,\n },\n };\n\n let payload = {\n 'accountId': myUser.id,\n 'subscription': {\n 'subscriberAccountId': myUser.id,\n 'productId': '610c18fcae701c0030d5be51',\n },\n };\n\n try {\n // eslint-disable-next-line max-len\n let data = await axios.put(api+'/assets/'+asset+'/subscribe', payload, config);\n return data;\n } catch (e) {\n return e.message;\n }\n}", "getAsset(assetSelector) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n if (typeof assetSelector === 'number') {\n return yield this.getAssetByID(assetSelector);\n }\n else {\n return yield this.getAssetBySymbol(assetSelector);\n }\n });\n }", "getRandomId() {\n return fetch(`${remoteURL}/brands`)\n .then(result => result.json())\n .then(brands => {\n // random function, many ways out there to get random\n const randomIndex = Math.floor(Math.random() * brands.length);\n //look at the id of the reuturning brands, and assign to randomBrand and return the id of that brand \n const randomBrand = brands[randomIndex];\n return randomBrand.id;\n });\n}", "openAsset(type, user, name) {\n // TODO: get location query ???? - or location query should be handled by QLink?\n utilPushTo(null, `/assetEdit/${type}/${user}/${name}`)\n }", "updateAsset(conditions, update) {\n\t\tlet url = '/api/update-asset';\n\t\n\t\treturn fetch(url, {\n\t\t\tmethod: 'POST', \n\t\t\theaders: {\n\t\t\t 'Accept': 'application/json',\n\t\t\t 'Content-Type': 'application/json'\n\t\t\t },\n\t\t\tbody: JSON.stringify({\n\t\t\t\tconditions: conditions,\n\t\t\t\tupdate: update\n\t\t\t})})\n\t\t\t.then(result => {\n\t\t\t\treturn result.json();\n\t\t\t})\n\t\t\t.then(asset => {\n\t\t\t\treturn asset;\n\t\t\t})\n\t\t\t.catch(err => console.log(err));\n\t}", "async UpdateAsset(ctx, key, value) {\n const exists = await this.AssetExists(ctx, key);\n if (!exists) {\n throw new Error(`The asset ${key} does not exist`);\n }\n\n // overwriting original asset with new asset\n return ctx.stub.putState(key, Buffer.from(value));\n }", "function issue(params) {\n return new Promise((resolve, reject) => {\n var response;\n var address = params.address;\n var asset = params.assetName;\n var quantity = params.quantity;\n var units = params.amount;\n\n multichain.issue({\n address: address,\n asset: asset,\n qty: quantity,\n open: true,\n units: units\n },\n (err, res) => {\n if (err == null) {\n return resolve({\n response: res,\n message: \"your asset has been created\"\n });\n } else {\n console.log(err)\n return reject({\n status: 500,\n message: 'Internal Server Error !'\n });\n }\n })\n })\n}", "getResource(internal_name) {\n if (IsString(internal_name, true)) {\n const resource = this.asset.resource.get(internal_name);\n return resource ? resource : {};\n }\n }", "newInvest(ID1, data){\n\t\tvar newAsset = data.asset;\n\t\treturn Stock.getStockStatus(newAsset)\n\t\t\t.then(comp =>\n\t\t\t\tuserModel.findOneAndUpdate(\n\t\t\t\t\t{ personalID: ID1 },\n\t\t\t\t\t{\n\t\t\t\t\t\t$push: {\n\t\t\t\t\t\t\tstocks: {\n\t\t\t\t\t\t\t\tasset: data.asset,\n\t\t\t\t\t\t\t\tinvestment: data.investment,\n\t\t\t\t\t\t\t\tinitialStockStauts: comp\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{ new: true }\n\t\t\t\t)\n\t\t\t)\n\t\t\t.then(users => {\n\t\t\t\treturn users;\n\t\t\t}, e => {\n\t\t\t\treturn e;\n\t\t\t});\n\t}", "get assetImporter() {}", "async function MintingTheAsset() {\n // === Describe the new asset ===\n // The first steps in creating a new asset using Avalanche.js is to determine the qualties of the asset.\n //We will give the asset a name, a ticker symbol, as well as a denomination.\n\n // The fee to pay for the asset, we assume this network is fee-less\n let fee = new BN(0);\n\n // Name our new coin and give it a symbol\n let name = \"Kikicoin is the most intelligent coin\";\n let symbol = \"KIKI\";\n\n // Where is the decimal point indicate what 1 asset is and where fractional assets begin\n // Ex: 1 $AVAX is denomination 9, so the smallest unit of $AVAX is nano-AVAX ($nAVAX) at 10^-9 $AVAX\n let denomination = 9;\n\n // === Creating the initial state ===\n // We want to mint an asset with 400 coins to all of our managed keys, 500 to the second address we know of, \n // and 600 to the second and third address. This sets up the state that will result from the Create Asset transaction.\n // Note: This example assumes we have the keys already managed in our AVM Keychain.\n\n // Create outputs for the asset's initial state\n let secpOutput1 = new avalanche.SecpOutput(new BN(400), new BN(400), 1, addresses);\n let secpOutput2 = new avalanche.SecpOutput(new BN(500), new BN(500), 1, [addresses[1]]);\n let secpOutput3 = new avalanche.SecpOutput(new BN(600), new BN(600), 1, [addresses[1], addresses[2]]);\n\n console.log(\"secpOutput1: \", secpOutput1)\n console.log(\"secpOutput2: \", secpOutput2)\n console.log(\"secpOutput3: \", secpOutput3)\n\n // Populate the initialState array\n // The AVM needs to know what type of output is produced.\n // The constant avalanche.AVMConstants.SECPFXID is the correct output.\n // It specifies that we are using a secp256k1 signature scheme for this output.\n let initialState = new avalanche.InitialStates();\n initialState.addOutput(secpOutput1, avalanche.AVMConstants.SECPFXID);\n initialState.addOutput(secpOutput2, avalanche.AVMConstants.SECPFXID);\n initialState.addOutput(secpOutput3, avalanche.AVMConstants.SECPFXID);\n\n /// === Creating the signed transaction ===\n /// Now that we know what we want an asset to look like, we create an output to send to the network.\n /// There is an AVM helper function buildCreateAssetTx() which does just that.\n // Fetch the UTXOSet for our addresses\n let utxos = await avm.getUTXOs(addresses);\n \n console.log(\"UTXOC: \", utxos)\n\n // Make an unsigned Create Asset transaction from the data compiled earlier\n let unsigned = await avm.buildCreateAssetTx(utxos, fee, addresses, initialState, name, symbol, denomination);\n\n let signed = avm.keyChain().signTx(unsigned); //returns a Tx class\n \n console.log(\"TX Signed:\", signed)\n\n /// === Issue the signed transaction ===\n /// Now that we have a signed transaction ready to send to the network, let’s issue it!\n /// Using the Avalanche.js AVM API, we going to call the issueTx function. \n /// This function can take either the Tx class returned in the previous step, \n /// a base-58 string Avalanche serialized representation of the transaction, or a raw Buffer class with the data for the transaction.\n \n // using the Tx class\n let txid = await avm.issueTx(signed); //returns an Avalanche serialized string for the TxID\n // or... using the base-58 representation\n //let txid = await avm.issueTx(signed.toString()); //returns an Avalanche serialized string for the TxID\n // or... using the transaction Buffer\n //let txid = await avm.issueTx(signed.toBuffer()); //returns an Avalanche serialized string for the TxID\n\n /// === Get the status of the transaction ===\n /// Now that we sent the transaction to the network, it takes a few seconds to determine if the transaction has gone through.\n /// We can get an updated status on the transaction using the TxID through the AVM API.\n // returns one of: \"Accepted\", \"Processing\", \"Unknown\", and \"Rejected\"\n let status = await avm.getTxStatus(txid); \n \n console.log(\"Status of the transaction: \", status);\n}", "function handlePlanImage(id) {\n alert(id);\n }", "function resolveAsset(options,type,id,warnMissing){/* istanbul ignore if */if(typeof id!=='string'){return;}var assets=options[type];// check local registration variations first\n\tif(hasOwn(assets,id)){return assets[id];}var camelizedId=camelize(id);if(hasOwn(assets,camelizedId)){return assets[camelizedId];}var PascalCaseId=capitalize(camelizedId);if(hasOwn(assets,PascalCaseId)){return assets[PascalCaseId];}// fallback to prototype chain\n\tvar res=assets[id]||assets[camelizedId]||assets[PascalCaseId];if(\"development\"!=='production'&&warnMissing&&!res){warn('Failed to resolve '+type.slice(0,-1)+': '+id,options);}return res;}", "async myAssetExists(ctx, myAssetId) {\n const buffer = await ctx.stub.getState(myAssetId);\n return (!!buffer && buffer.length > 0);\n\n }", "function getAssetInfo(){\n\treturn {\n\t\t'position': {\"x\":0,\"y\":0,\"w\":40,\"h\":40},\n\t\t'thumb': null,\n\t};\n}", "function resolveAsset(options,type,id,warnMissing){/* istanbul ignore if */if(typeof id!=='string'){return;}var assets=options[type];// check local registration variations first\nif(hasOwn(assets,id)){return assets[id];}var camelizedId=camelize(id);if(hasOwn(assets,camelizedId)){return assets[camelizedId];}var PascalCaseId=capitalize(camelizedId);if(hasOwn(assets,PascalCaseId)){return assets[PascalCaseId];}// fallback to prototype chain\nvar res=assets[id]||assets[camelizedId]||assets[PascalCaseId];if(\"development\"!=='production'&&warnMissing&&!res){warn('Failed to resolve '+type.slice(0,-1)+': '+id,options);}return res;}", "function resolveAsset(options,type,id,warnMissing){/* istanbul ignore if */if(typeof id!=='string'){return;}var assets=options[type];// check local registration variations first\nif(hasOwn(assets,id)){return assets[id];}var camelizedId=camelize(id);if(hasOwn(assets,camelizedId)){return assets[camelizedId];}var PascalCaseId=capitalize(camelizedId);if(hasOwn(assets,PascalCaseId)){return assets[PascalCaseId];}// fallback to prototype chain\nvar res=assets[id]||assets[camelizedId]||assets[PascalCaseId];if(\"development\"!=='production'&&warnMissing&&!res){warn('Failed to resolve '+type.slice(0,-1)+': '+id,options);}return res;}", "assetAquired (_obj, _name) {\n this.cargo.addAsset(_name, _obj)\n this.assetCount++\n this.pct = this.assetCount / this.assetTotal\n this.progBar.style.width = `${this.pct * 100}%`\n if (this.assetCount === this.assetTotal) {\n this.complete()\n }\n }", "async confirmReservation(stub, args, thisClass) {\n if (args.length != 6) { \n\t\t\tthrow new Error('Incorrect number of arguments. Expecting 6.')\n\t\t}\n\t\tlet id = args[0] \n\t\tlet assetState = await stub.getState(id)\n\t\tif (assetState.toString()) {\n\t\t\tthrow new Error('This asset already exists: ' + id)\n\t\t}\n\t\tconsole.info('--- start insertAsset ---')\n\t\tlet Time = parseInt(args[1])\n\t\tlet OrgId = args[2] \n\t\tlet UserId = args[3] \n\t\tlet DoctorId = args[4] \n\t\tlet ReservationTime = parseInt(args[5])\n\n\t\tif (id.length <= 0){ \n\t\t\treturn shim.error('Argument id must be a non-empty string') \n\t\t}\n\t\tif (typeof Time !== \"number\") {\n\t\t\treturn shim.error('Time is not a number');\n\t\t}\n\t\tif (OrgId.length <= 0) { \n\t\t\tthrow new Error('Argument OrgId must be a non-empty string') \n\t\t}\n\t\tif (UserId.length <= 0) { \n\t\t\tthrow new Error('Argument UserId must be a non-empty string') \n\t\t}\n\t\tif (DoctorId.length <= 0) { \n\t\t\tthrow new Error('Argument DoctorId must be a non-empty string') \n\t\t}\n\t\tif (typeof ReservationTime !== \"number\") {\n\t\t\treturn shim.error('ReservationTime is not a number');\n\t\t}\n\n\t\tlet asset = {}\n\t\tasset.docType = \"reservation\"\n\t\tasset.id = id\n\t\tasset.Time = Time\n\t\tasset.OrgId = OrgId\n\t\tasset.UserId = UserId\n\t\tasset.DoctorId = DoctorId\n\t\tasset.ReservationTime = ReservationTime\n\t\tasset.Canceled = false \n\t\tasset.Rejected = false \n\n\t\tawait stub.putState(id, Buffer.from(JSON.stringify(asset)))\n\t\tlet indexName0 = \"OrgId~id\"\n\t\tlet OrgIdIdIndexKey = await stub.createCompositeKey(indexName0, [asset.OrgId, asset.id])\n\t\tconsole.info(OrgIdIdIndexKey)\n\t\tawait stub.putState(OrgIdIdIndexKey, Buffer.from(''))\n\t\tlet indexName1 = \"UserId~id\"\n\t\tlet UserIdIdIndexKey = await stub.createCompositeKey(indexName1, [asset.UserId, asset.id])\n\t\tconsole.info(UserIdIdIndexKey)\n\t\tawait stub.putState(UserIdIdIndexKey, Buffer.from(''))\n\t\tlet indexName2 = \"DoctorId~id\"\n\t\tlet DoctorIdIdIndexKey = await stub.createCompositeKey(indexName2, [asset.DoctorId, asset.id])\n\t\tconsole.info(DoctorIdIdIndexKey)\n\t\tawait stub.putState(DoctorIdIdIndexKey, Buffer.from(''))\n }", "asset(id) {\n let query = `\n\n `\n\n }", "constructor(scope, id, props) {\n super(scope, id, { type: CfnAsset.CFN_RESOURCE_TYPE_NAME, properties: props });\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_iotsitewise_CfnAssetProps(props);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, CfnAsset);\n }\n throw error;\n }\n cdk.requireProperty(props, 'assetModelId', this);\n cdk.requireProperty(props, 'assetName', this);\n this.attrAssetArn = cdk.Token.asString(this.getAtt('AssetArn', cdk.ResolutionTypeHint.STRING));\n this.attrAssetId = cdk.Token.asString(this.getAtt('AssetId', cdk.ResolutionTypeHint.STRING));\n this.assetModelId = props.assetModelId;\n this.assetName = props.assetName;\n this.assetDescription = props.assetDescription;\n this.assetHierarchies = props.assetHierarchies;\n this.assetProperties = props.assetProperties;\n this.tags = new cdk.TagManager(cdk.TagType.STANDARD, \"AWS::IoTSiteWise::Asset\", props.tags, { tagPropertyName: 'tags' });\n }", "function buscarImagen(id, datos){\n const imagen = datos.includes.Asset.find((asset) => {\n return asset.sys.id == id; });\n return imagen \n}", "async UpdateAsset(ctx, id, owner, quantity, execution_date, ISIN, rt, clino, settlement_price, status) {\n const exists = await this.AssetExists(ctx, id);\n if (!exists) {\n throw new Error(`The asset ${id} does not exist`);\n }\n\n // overwriting original asset with new asset\n const updatedAsset = {\n ID: id,\n Owner: owner,\n Quantity: quantity,\n Execution_date: execution_date,\n ISIN: ISIN,\n RT: rt,\n CLINO: clino,\n Settlement_price: settlement_price,\n Status: status\n };\n\n return ctx.stub.putState(id, Buffer.from(JSON.stringify(updatedAsset)));\n }", "static addAsset(_asset) {\n if (_asset instanceof WebEngine.FudgeNode) {\n if (this.FudgeNodes[_asset.Name] === undefined) {\n this.FudgeNodes[_asset.Name] = _asset;\n }\n else {\n throw new Error(`There is allready a fudgenode named '${_asset.Name}'.`);\n }\n }\n else if (_asset instanceof WebEngine.Material) {\n if (this.Materials[_asset.Name] === undefined) {\n this.Materials[_asset.Name] = _asset;\n }\n else {\n throw new Error(`There is allready a material named '${_asset.Name}'.`);\n }\n }\n else if (_asset instanceof WebEngine.Viewport) {\n if (this.Viewports[_asset.Name] === undefined) {\n this.Viewports[_asset.Name] = _asset;\n }\n else {\n throw new Error(`There is allready a viewport named '${_asset.Name}'.`);\n }\n }\n }", "async saveItem(item) {\r\n let response = await axios.post(\"http://127.0.0.1:5000/api/catalog\", item);\r\n let newItem = response.data;\r\n // hot fix: add and id if missing\r\n // TODO: ensure server always returns an ID\r\n if (!newItem._id) {\r\n newItem._id = Math.random().toString();\r\n }\r\n console.log(\"Save Item: \", newItem);\r\n return newItem;\r\n }", "_onAddAsset(asset) {\n // remove from waiting list\n var index = this._waitingAssets.indexOf(asset);\n if (index >= 0) {\n this._waitingAssets.splice(index, 1);\n }\n\n this._assets.push(asset);\n var i;\n var l = this._assets.length;\n for (i = 0; i < l; i++) {\n asset = this._assets[i];\n\n if (!asset.loading && !asset.loaded) {\n this._registry.load(asset);\n }\n }\n }", "async ReadAsset(ctx, key) {\n const value = await ctx.stub.getState(key); // get the asset from chaincode state\n if (!value) {\n throw new Error(`The asset ${key} does not exist`);\n }\n return value;\n }", "function imageAsset(id, params, type, defaultMinWidth, defaultMinHeight) {\n return params ? {\n id,\n required: params.required ? 1 : 0,\n img: {\n type,\n wmin: params.wmin || defaultMinWidth,\n hmin: params.hmin || defaultMinHeight,\n }\n } : null;\n}", "function dataAsset(id, params, type, defaultLen) {\n return params ? {\n id,\n required: params.required ? 1 : 0,\n data: {\n type,\n len: params.len || defaultLen,\n }\n } : null;\n}", "function resolveAsset(options, type, id, warnMissing) {\n\t\t /* istanbul ignore if */\n\t\t if (typeof id !== 'string') {\n\t\t return;\n\t\t }\n\t\t var assets = options[type];\n\t\t var res = assets[id] ||\n\t\t // camelCase ID\n\t\t assets[camelize(id)] ||\n\t\t // Pascal Case ID\n\t\t assets[capitalize(camelize(id))];\n\t\t if (false) {\n\t\t warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);\n\t\t }\n\t\t return res;\n\t\t}", "function addAsset(assets, asset) {\n if (asset) {\n assets.push(asset);\n }\n}", "async readMyAsset(ctx, serialNumber) {\n const myAsset = await this.getAsset(ctx, serialNumber);\n return myAsset;\n }", "function assetUrl (asset, extraParams) {\n try {\n var url = asset.fields.file.url;\n if (extraParams) {\n var queryString = '';\n for (var key in extraParams) {\n queryString += '&' + key + '=' + extraParams[key];\n }\n url += '?' + queryString.substr(1);\n }\n return url;\n } catch (e) {\n console.error('Asset had no file URL:', asset);\n return 'images/show_item_01.jpg';\n }\n }", "function openSaveAs() {\n var ediv = $(\"#edit-widget-content\").get(0);\n if ($.data(ediv, \"assetid\")) {\n saveAssetContent(null,null);\n } else {\n if (contentEditCriteria.producesResource) {\n $.perc_browser({on_save:onSave, initial_val:\"\"});\n } else {\n saveAssetContent(contentEditCriteria.contentName,null);\n }\n }\n }", "getById(id) {\n return this.get(id).then(response => {\n const item = response.data.data;\n this.setCid(item);\n return item;\n });\n }", "async CreateAsset(ctx, key, value) {\n return ctx.stub.putState(key, Buffer.from(value));\n }" ]
[ "0.6776127", "0.6742735", "0.65310824", "0.65288943", "0.63195705", "0.6302168", "0.6283423", "0.6222852", "0.60851216", "0.60726696", "0.6070996", "0.60332114", "0.6005652", "0.59481317", "0.59154123", "0.59154123", "0.59107244", "0.59047353", "0.588191", "0.5868168", "0.5868168", "0.5800464", "0.5769102", "0.57610184", "0.5746457", "0.57374626", "0.571231", "0.57043123", "0.5690456", "0.56636447", "0.56460917", "0.5622503", "0.560616", "0.55689335", "0.5546922", "0.5540556", "0.55283475", "0.5522866", "0.55124885", "0.550697", "0.54823196", "0.5481721", "0.54681283", "0.5461016", "0.54498637", "0.5402523", "0.5399951", "0.53570694", "0.53526616", "0.5351013", "0.53470325", "0.5343856", "0.5321866", "0.53191215", "0.5301255", "0.52920896", "0.52786505", "0.5265711", "0.5257532", "0.52435625", "0.52427715", "0.5242095", "0.52398986", "0.523691", "0.5212961", "0.5209112", "0.520603", "0.5196557", "0.5193823", "0.51869047", "0.51868093", "0.51691943", "0.51679534", "0.51663285", "0.51611805", "0.5149299", "0.5133391", "0.5125425", "0.5123561", "0.51127595", "0.51127595", "0.51109034", "0.5094451", "0.509443", "0.50912154", "0.50893515", "0.50695854", "0.50670266", "0.5059764", "0.5058131", "0.50544304", "0.50499433", "0.5046506", "0.5041689", "0.5038904", "0.5028986", "0.50256056", "0.50209314", "0.5016731", "0.501527" ]
0.637831
4
Return spherical distance between points on earth surface in meters p1 and p2 given as array [lon,lat]
function pointDistance(p1, p2) { var lon1 = p1[0] * deg2rad; var lon2 = p2[0] * deg2rad; var lat1 = p1[1] * deg2rad; var lat2 = p2[1] * deg2rad; a = Math.sin(lat1)*Math.sin(lat2) + Math.cos(lat1)*Math.cos(lat2) * Math.cos(lon2-lon1); // due to rounding errors a may exceed the legal argument range for acos if (a < -1.0) { a = -1.0; } if (a > 1.0) { a = 1.0; } return Math.acos(a) * R; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sphericalDistance(a, b) {\n\t var x = lonToMeters(a[0] - b[0], (a[1] + b[1]) / 2),\n\t y = latToMeters(a[1] - b[1]);\n\t return Math.sqrt((x * x) + (y * y));\n\t}", "function sphericalDistance(lam1, phi1, lam2, phi2) {\n var dlam = lam2 - lam1,\n dphi = phi2 - phi1,\n a = Math.sin(dphi / 2) * Math.sin(dphi / 2) +\n Math.cos(phi1) * Math.cos(phi2) *\n Math.sin(dlam / 2) * Math.sin(dlam / 2),\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return c;\n }", "function distance(p1, p2) {\r\n lat1r = deg2rad(p1.lat);\r\n lat2r = deg2rad(p2.lat);\r\n\r\n x = (p2.lng - p1.lng) * Math.cos((lat1r + lat2r) / 2);\r\n y = p2.lat - p1.lat;\r\n return Math.sqrt(x * x + y * y) * deg2rad(R);\r\n}", "function computeDistance(p1, p2) {\n var R = 6371000; // m\n var d = Math.acos(Math.sin(p1.latitude) * Math.sin(p2.latitude) +\n Math.cos(p1.latitude) * Math.cos(p2.latitude) *\n Math.cos(p2.longitude - p1.longitude)) * R;\n return d;\n}", "function distance (p1, p2){\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2)).toFixed(2);\n }", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295;\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p)/2 + c(lat1 * p) * c(lat2 * p) * (1 - c((lon2 - lon1) * p))/2;\n return 12742 * Math.asin(Math.sqrt(a)) * 0.621371;\n }", "function calcDistance(p1, p2){\r\n\t//returns distance between the points with no decimals and in meters.\r\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2)).toFixed(0);\r\n}", "function calcDistance(lat1,lon1,lat2,lon2){\n\tvar R = 6371; //earth's radius (KM)\n\treturn Math.acos(Math.sin(toRads(lat1))*Math.sin(toRads(lat2)) + \n Math.cos(toRads(lat1))*Math.cos(toRads(lat2)) *\n Math.cos(toRads(lon2-lon1))) * R;\n\n}", "function distance(lat1, lon1, lat2, lon2) {\n\treturn Math.acos(Math.sin(lat1.toRadians()) * Math.sin(lat2.toRadians()) + Math.cos(lat1.toRadians()) * Math.cos(lat2.toRadians()) * Math.cos((lon2-lon1).toRadians())) * 6371e3;\n}", "function distanciaPuntos(lat1,lon1,lat2,lon2)\n{\n\tvar R = 6371e3;//Radio de la tierra\n\tvar Ang1 = lat1 * Math.PI/180;\n\tvar Ang2 = lat2 * Math.PI/180;\n\tvar A1 = (lat2-lat1) * Math.PI/180;\n\tvar A2 = (lon2-lon1) * Math.PI/180;\n\n\tvar a = Math.sin(A1/2) * Math.sin(A1/2) +\n\t\t\t Math.cos(Ang1) * Math.cos(Ang2) *\n\t\t\t Math.sin(A2/2) * Math.sin(A2/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n\treturn ((R * c)/1000).toFixed(2)+\" Km\";\n}", "function calcDistance(p1, p2){\r\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2)/1000).toFixed(3);\r\n }", "function calcDistance(p1, p2) {\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 1000).toFixed(1);\n}", "function calcDistance(p1, p2) {\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 1000).toFixed(2);\n}", "function getDistance(p1, p2) {\r\n var R = 6378137; // Earth’s mean radius in meter\r\n var dLat = rad(p2.lat() - p1.lat());\r\n var dLong = rad(p2.lng() - p1.lng());\r\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\r\n Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) *\r\n Math.sin(dLong / 2) * Math.sin(dLong / 2);\r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\r\n var d = R * c;\r\n return d.toFixed(0); // returns the distance in meter\r\n}", "function coordinateDistance(latitude1, longitude1, latitude2, longitude2) {\n\n\tvar h = haversin(radian(latitude2 - latitude1)) + Math.cos(radian(latitude2))*Math.cos(radian(latitude1))*haversin(radian(longitude2 - longitude1));\n\n\t//h needs to be less than 1 (possible floating point error); it's mentioned in the wikipedia article\n\tif(h > 1.0) {\n\t\th = 1.0;\n\t}\n\n\t// distance = 2 * (earth radius) * arcsin ( sqrt ( h ) )\n\t// 3963.191 = earth's radius in miles\n\treturn 2.0 * 3963.191 * Math.asin(Math.sqrt(h));\n}", "function calc_distance(lat1,lon1,lat2,lon2){//in degrees\n var R = 6371e3; //radius of earth in meters\n var φ1 = lat1.toRadians();\n var φ2 = lat2.toRadians();\n var Δφ = (lat2-lat1).toRadians();\n var Δλ = (lon2-lon1).toRadians();\n\n var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) +\n Math.cos(φ1) * Math.cos(φ2) *\n Math.sin(Δλ/2) * Math.sin(Δλ/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n var d = R * c;\n \n return d;\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n\n var a = 0.5 - c((lat2 - lat1) * p)/2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p))/2;\n\n return 2 * 3959 * Math.asin(Math.sqrt(a)); // Earth's Radius = 3959 miles\n}", "function distance(p1, p2) {\n var distance;\n distance = Math.sqrt(Math.pow((p1.x-p2.x), 2) + Math.pow((p1.y-p2.y), 2) + Math.pow((p1.z-p2.z), 2));\n return distance;\n}", "calcDistance(lat1, lon1, lat2, lon2) {\n let radlat1 = Math.PI * lat1/180;\n \tlet radlat2 = Math.PI * lat2/180;\n \tlet theta = lon1-lon2;\n \tlet radtheta = Math.PI * theta/180;\n \tlet dist = Math.sin(radlat1) * Math.sin(radlat2)\n + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tdist = Math.acos(dist);\n \tdist = dist * 180/Math.PI;\n \tdist = dist * 60 * 1.1515;\n dist = dist * 1609.344;\n \treturn dist;\n }", "function computeDistance( lat1, lon1, lat2, lon2 ) {\r\n\tvar degreeToSM = 60 * 1.15078; // 60 NM * (NM->SM factor)\r\n\tvar dlat = Math.abs( lat1 - lat2 ) * degreeToSM;\r\n\tvar dlon = Math.abs( lon1 - lon2 ) * degreeToSM * Math.cos( lat1 * Math.PI / 180 );\r\n\treturn Math.sqrt( dlat * dlat, dlon * dlon );\r\n}", "function calcDistance(p1, p2) {\n\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 628).toFixed(3);\n }", "distance(lat1, lon1, lat2, lon2) {\n var radLat1 = Math.PI * lat1 / 180,\n radLat2 = Math.PI * lat2 / 180;\n\n var theta = lon1 - lon2,\n radTheta = Math.PI * theta / 180;\n\n var dist = Math.sin(radLat1) * Math.sin(radLat2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.cos(radTheta);\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515;\n return dist;\n }", "function getDistance(lat1, lon1, lat2, lon2) {\n let R = 6371; // Radius of the earth in km\n let dLat = deg2rad(lat2 - lat1); // deg2rad below\n let dLon = deg2rad(lon2 - lon1);\n let a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\n let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n let d = R * c; // Distance in km\n\n distanceArray.push(d);\n \n }", "function dist(lat1, lon1, lat2, lon2) {\n var R = 6371e3; // metres\n var thetaOne = toRadians(lat1);\n var thetaTwo = toRadians(lat2);\n var deltaTheta = toRadians(lat2-lat1);\n var deltaLambda = toRadians(lon2-lon1);\n \n var a = Math.sin(deltaTheta/2) * Math.sin(deltaTheta/2) +\n Math.cos(thetaOne) * Math.cos(thetaTwo) *\n Math.sin(deltaLambda/2) * Math.sin(deltaLambda/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n \n var d = R * c;\n \n return d;\n}", "function distHaversine(p1, p2) {\n\n var R = 6371; // earth's mean radius in km\n\n var dLat = rad(p2.lat() - p1.lat());\n\n var dLong = rad(p2.lng() - p1.lng());\n\n\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\n Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) * Math.sin(dLong/2) * Math.sin(dLong/2);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n var d = R * c;\n\n\n\n return d.toFixed(3);\n\n }", "function distance(lat1, lon1, lat2, lon2) {\n\n\tvar radlat1 = Math.PI * lat1 / 180;\n\tvar radlat2 = Math.PI * lat2 / 180;\n\tvar radlon1 = Math.PI * lon1 / 180;\n\tvar radlon2 = Math.PI * lon2 / 180;\n\tvar theta = lon1 - lon2;\n\tvar radtheta = Math.PI * theta / 180;\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist);\n\tdist = dist * 180 / Math.PI;\n\tdist = dist * 60 * 1.1515;\n\tdist = dist * 1.609344 * 1000;\n\treturn dist;\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p)/2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p))/2;\n\n return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p)/2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p))/2;\n\n return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n\tvar radlat1 = Math.PI * lat1/180;\n\tvar radlat2 = Math.PI * lat2/180;\n\tvar theta = lon1-lon2;\n\tvar radtheta = Math.PI * theta/180;\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist);\n\tdist = dist * 180/Math.PI;\n\tdist = dist * 60 * 1.1515;\n\treturn dist;\n}", "function distance(lat1, lon1, lat2, lon2) {\n const p = 0.017453292519943295; // Math.PI / 180\n const c = Math.cos;\n const a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n\n return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km\n}", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 3959; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function distanceBetweenPoints(p1, p2) {\r\n var R = 6371; // earth's mean radius in km\r\n var dLat = (p2.lat() - p1.lat())*Math.PI/180;\r\n var dLong =(p2.lng() - p1.lng())*Math.PI/180;\r\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos((p1.lat())*Math.PI/180) * Math.cos((p2.lat())*Math.PI/180) * Math.sin(dLong / 2) * Math.sin(dLong / 2);\r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\r\n var d = R * c;\r\n return d;\r\n}", "function distance(lon1, lat1, lon2, lat2) {\n var R = 6371; // Radius of the earth in km\n var dLat = (lat2 - lat1) * Math.PI / 180; // deg2rad below\n var dLon = (lon2 - lon1) * Math.PI / 180;\n var a = \n 0.5 - Math.cos(dLat)/2 + \n Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * \n (1 - Math.cos(dLon))/2;\n\n return R * 2 * Math.asin(Math.sqrt(a));\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km\n }", "function distance(lat1, lon1, lat2, lon2) {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var radlon1 = Math.PI * lon1/180;\n var radlon2 = Math.PI * lon2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n\n unit = \"K\";\n if (unit==\"K\") { dist = dist * 1.609344; }\n if (unit==\"N\") { dist = dist * 0.8684; }\n return dist;\n}", "function distance(p1, p2) {\r\n\treturn Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2) + Math.pow(p1[2] - p2[2], 2));\r\n}", "function distance(lat1, lon1, lat2, lon2) {\n\tvar radlat1 = Math.PI * lat1/180\n\tvar radlat2 = Math.PI * lat2/180\n\tvar theta = lon1-lon2\n\tvar radtheta = Math.PI * theta/180\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tif (dist > 1) {\n\t\tdist = 1;\n\t}\n\tdist = Math.acos(dist)\n\tdist = dist * 180/Math.PI\n\tdist = dist * 60 * 1.1515\n\treturn dist\n}", "function gps_distance(lat1, lon1, lat2, lon2)\r\n{\r\n\t// http://www.movable-type.co.uk/scripts/latlong.html contains Algorithm\r\n var R = 6371; // km\r\n var dLat = (lat2-lat1) * (Math.PI / 180);\r\n var dLon = (lon2-lon1) * (Math.PI / 180);\r\n var lat1 = lat1 * (Math.PI / 180);\r\n var lat2 = lat2 * (Math.PI / 180);\r\n\r\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\r\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\r\n var d = R * c;\r\n\r\n return d;\r\n}", "function distance(lat1, long1, lat2, long2) {\n var R = 3959; // Earth's radius in miles\n var x = (long2 - long1) * Math.cos((lat1 + lat2)/2);\n var y = lat2 - lat1;\n var d = Math.sqrt(x*x + y*y) * R;\n return d;\n}", "function getDistance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p)/2 + \n c(lat1 * p) * c(lat2 * p) * \n (1 - c((lon2 - lon1) * p))/2;\n \n return 12742 * Math.asin(Math.sqrt(a)); // 2 * R; R = 6371 km\n}", "function calculateDistance(lon1,lat1,lon2,lat2){\n\n var dGridSizeXReduction = Math.abs(Math.cos(lat1 * Math.PI / 180.0 ));\n var dRed2 = dGridSizeXReduction * dGridSizeXReduction;\n var dMinDist2 = (lon1 - lon2) * (lon1 - lon2) * dRed2 + (lat1 - lat2) * (lat1 - lat2);\t\n return Math.sqrt(dMinDist2);\n}", "function getDistanceInKilometers(p1, p2) {\n // Credit: adapts code for Haversine formula and degrees-to-radian conversion found at:\n // http://www.movable-type.co.uk/scripts/latlong.html\n\n var R = 6371; // earth's radius in kilometers\n var dLat = degreesToRadians(p2.lat - p1.lat);\n var dLon = degreesToRadians(p2.lng - p1.lng); \n var lat1 = degreesToRadians(p1.lat);\n var lat2 = degreesToRadians(p2.lat);\n\n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2)\n + Math.sin(dLon/2) * Math.sin(dLon/2)\n * Math.cos(lat1) * Math.cos(lat2);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var distance = R * c; // kilomter\n return distance;\n}", "function getDistance(p1, p2){\r\n\tvar dLon = Math.radians(p2.lng - p1.lng); \r\n\tvar dLat = Math.radians(p2.lat - p1.lat);\r\n\tvar lat1 = Math.radians(p1.lat);\r\n\tvar lat2 = Math.radians(p2.lat);\r\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \r\n\tvar c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a) ) ;\r\n\tvar output = 6371 * c ;\r\n\treturn output;\r\n}", "function distance(p1, p2) {\n var deltaX = p1[0] - p2[0],\n deltaY = p1[1] - p2[1];\n return sqrt(deltaX * deltaX + deltaY * deltaY);\n }", "function distance (point1, point2) {\n Math.sqrt(Math.pow(point1[0] - point1[1], 2) + Math.pow(point2[0] - point2[1], 2))\n}", "function distanceCalc(lat1,lon1,lat2,lon2) {\n \n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2);\n \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c * 1000; // Distance in metres\n return d;\n}", "_getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\r\n var R = 6371; // Radius of the earth in km\r\n var dLat = this._deg2rad(lat2-lat1);\r\n var dLon = this._deg2rad(lon2-lon1); \r\n var a = \r\n Math.sin(dLat/2) * Math.sin(dLat/2) +\r\n Math.cos(this._deg2rad(lat1)) * Math.cos(this._deg2rad(lat2)) * \r\n Math.sin(dLon/2) * Math.sin(dLon/2)\r\n ; \r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \r\n var d = R * c; // Distance in km\r\n return d;\r\n }", "function distanceTwoPoints(point){\n var origin = new google.maps.LatLng(roomCoordinates.lat, roomCoordinates.lng);\n return (google.maps.geometry.spherical.computeDistanceBetween(origin, point) / 1000); //dividing by 1000 to get Kilometers\n }", "function distance(p1, p2) {\n var firstPoint;\n var secondPoint;\n var theXs;\n var theYs;\n var result;\n\n firstPoint = new createjs.Point();\n secondPoint = new createjs.Point();\n\n firstPoint.x = p1.x;\n firstPoint.y = p1.y;\n\n secondPoint.x = p2.x;\n secondPoint.y = p2.y;\n\n theXs = secondPoint.x - firstPoint.x;\n theYs = secondPoint.y - firstPoint.y;\n\n theXs = theXs * theXs;\n theYs = theYs * theYs;\n\n result = Math.sqrt(theXs + theYs);\n\n return result;\n}", "function gps_distance(lat1, lon1, lat2, lon2) {\n // http://www.movable-type.co.uk/scripts/latlong.html\n var R = 6371; // km\n var dLat = (lat2 - lat1) * (Math.PI / 180);\n var dLon = (lon2 - lon1) * (Math.PI / 180);\n var lat1 = lat1 * (Math.PI / 180);\n var lat2 = lat2 * (Math.PI / 180);\n\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n\n return d;\n}", "function calcDistance(fromLat, fromLng, toLat, toLng) {\n return google.maps.geometry.spherical.computeDistanceBetween(\n new google.maps.LatLng(fromLat, fromLng), new google.maps.LatLng(toLat, toLng));\n}", "function distance(p1, p2)\n{\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function distance(P1, P2) {\n var x1 = P1[0];\n var y1 = P1[1];\n var x2 = P2[0];\n var y2 = P2[1];\n var d = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n return d;\n}", "GetDistance(lat1, lng1, lat2, lng2) {// coordinates of two GPS positions\n    var radLat1 = this.Rad(lat1);\n     var radLat2 = this.Rad(lat2);\n var a = radLat1 - radLat2;\n var b = this.Rad(lng1) - this.Rad(lng2);\n var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +\n     Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));\n     s = s * 6378.137;// EARTH_RADIUS;\n   s = Math.round(s * 10000) / 10000; //output unit is kilo\n     s = s.toFixed(2);//2 digitals after dot\n return s;\n }", "function distHaversine(p1, p2) {\n var R = 6371; // earth's mean radius in km\n var dLat = rad(p2.lat() - p1.lat());\n var dLong = rad(p2.lng() - p1.lng());\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) * Math.sin(dLong/2) * Math.sin(dLong/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n\n return d.toFixed(3);\n }", "function distancia_punto_punto(coord1,coord2)\n{\nreturn Math.sqrt(Math.pow(coord1[0]-coord2[0])+Math.pow(coord1[1]-coord2[1]));\n}", "function distance(p1, p2) {\n\treturn Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\r\r var radlat1 = Math.PI * lat1/180\r\r var radlat2 = Math.PI * lat2/180\r\r var radlon1 = Math.PI * lon1/180\r\r var radlon2 = Math.PI * lon2/180\r\r var theta = lon1-lon2\r\r var radtheta = Math.PI * theta/180\r\r var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\r dist = Math.acos(dist)\r\r dist = dist * 180/Math.PI\r\r dist = dist * 60 * 1.1515\r\r if (unit==\"K\") { dist = dist * 1.609344 }", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)); \n }", "function dist(p1, p2) {\n return Math.sqrt(Math.pow(p1[0] - p2[0], 2)\n + Math.pow(p1[1] - p2[1], 2));\n}", "function distance(point1, point2){\n return Math.sqrt(Math.pow(point1[0]-point2[0], 2) + Math.pow(point1[1]-point2[1], 2));\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function harversineDistance(lat1, lon1, lat2, lon2){\n\t\tvar dLat = toRad(lat2-lat1);\n\t\tvar dLon = toRad(lon2-lon1);\n\t\tvar lat1 = toRad(lat1);\n\t\tvar lat2 = toRad(lat2);\n\t\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n \t Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n\t\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\t\tvar distance = R * c;\n\treturn distance;\n\t}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}", "function distance(lat1, lon1, lat2, lon2) {\n var R = 6371 // Radius of the earth in km\n var dLat = rad(lat2-lat1) // rad below\n var dLon = rad(lon2-lon1)\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(rad(lat1)) * Math.cos(rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2)\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n var d = R * c // Distance in km\n return (d / 1.609344).toPrecision(3) // Convert to mi\n}", "function distanceInKmBetweenCoords(lat1, lon1, lat2, lon2) {\n var earthRadiusKm = 6371;\n\n var dLat = degreesToRadians(lat2-lat1);\n var dLon = degreesToRadians(lon2-lon1);\n\n lat1 = degreesToRadians(lat1);\n lat2 = degreesToRadians(lat2);\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n return earthRadiusKm * c;\n}", "function CalcDistance(lat1, lon1, lat2, lon2) {\r\n if ((lat1 == lat2) && (lon1 == lon2)) {\r\n return 0;\r\n }\r\n else {\r\n var radlat1 = Math.PI * lat1 / 180;\r\n var radlat2 = Math.PI * lat2 / 180;\r\n var theta = lon1 - lon2;\r\n var radtheta = Math.PI * theta / 180;\r\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n if (dist > 1) {\r\n dist = 1;\r\n }\r\n dist = Math.acos(dist);\r\n dist = dist * 180 / Math.PI;\r\n dist = dist * 60 * 1.1515;\r\n dist = dist * 1.609344; //km\r\n return Math.round(dist * 1000) / 1000;\r\n }\r\n} //end function CalcDistance()", "function getDist(lat1, lon1, lat2, lon2) {\n var R = 3959; // miles\n // Function to convert lat/lon degrees into radians\n function toRad(degrees) {\n return degrees * (Math.PI/180);\n }\n var dLat = toRad(lat2-lat1);\n var dLon = toRad(lon2-lon1);\n var lat1 = toRad(lat1);\n var lat2 = toRad(lat2);\n\n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * \n Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n // return distance\n return d;\n }", "function distance(p1, p2){\n\tvar result = 0;\n\tfor(var i = 0; i < 3; i++){\n\t\tresult += Math.pow( p1[i] - p2[i], 2);\n\t}\n\treturn result;\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n\tvar radlat1 = Math.PI * lat1/180\n\tvar radlat2 = Math.PI * lat2/180\n\tvar radlon1 = Math.PI * lon1/180\n\tvar radlon2 = Math.PI * lon2/180\n\tvar theta = lon1-lon2\n\tvar radtheta = Math.PI * theta/180\n\tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n\tdist = Math.acos(dist)\n\tdist = dist * 180/Math.PI\n\tdist = dist * 60 * 1.1515\n\tif (unit==\"K\") { dist = dist * 1.609344 }\n\tif (unit==\"N\") { dist = dist * 0.8684 }\n\treturn dist\n}", "function calculateDistance(lat1, lat2, long1, long2) {\n // Earth radius in kilometers\n var R = 6378\n var x = (long2-long1) * Math.cos((lat1+lat2)/2);\n var y = (lat2-lat1);\n var d = Math.sqrt(x*x + y*y) * R;\n return d\n }", "function distance(lat1, lon1, lat2, lon2, unit) {\n \tvar radlat1 = Math.PI * lat1/180\n \tvar radlat2 = Math.PI * lat2/180\n \tvar theta = lon1-lon2\n \tvar radtheta = Math.PI * theta/180\n \tvar dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tdist = Math.acos(dist)\n \tdist = dist * 180/Math.PI\n \tdist = dist * 60 * 1.1515\n \tif (unit==\"K\") { dist = dist * 1.609344 }\n \tif (unit==\"N\") { dist = dist * 0.8684 }\n \treturn dist\n }", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n\t\t\t\t var R = 6371; // Radius of the earth in km\n\t\t\t\t var dLat = deg2rad(lat2-lat1); // deg2rad below\n\t\t\t\t var dLon = deg2rad(lon2-lon1); \n\t\t\t\t var a = \n\t\t\t\t Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\t\t\t Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n\t\t\t\t Math.sin(dLon/2) * Math.sin(dLon/2)\n\t\t\t\t ; \n\t\t\t\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\t\t\t\t var d = R * c; // Distance in km\n\t\t\t\t return d;\n\t\t\t\t}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n \n function deg2rad(deg) {\n return deg * (Math.PI/180)\n }\n\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function haversine_distance(pt1Lat, pt1Long, pt2Lat, pt2Long)\n{\n var R = 6371.0710; //using kilometers\n var rlat1 = pt1Lat * (Math.PI / 180); // Convert degrees to radians\n var rlat2 = pt2Lat * (Math.PI / 180); // Convert degrees to radians\n var difflat = rlat2 - rlat1; // Radian difference (latitudes)\n var difflon = (pt2Long - pt1Long) * (Math.PI / 180); // Radian difference (longitudes)\n\n var d = 2 * R * Math.asin(Math.sqrt(Math.sin(difflat / 2) * Math.sin(difflat / 2) + Math.cos(rlat1) * Math.cos(rlat2) * Math.sin(difflon / 2) * Math.sin(difflon / 2)));\n return d;\n}", "function distanzaAppartamenti(lat1,lon1,lat2,lon2)\n {\n var R = 6372.8; // Earth Radius in Kilometers\n\n var dLat = deg2Rad(lat2-lat1);\n var dLon = deg2Rad(lon2-lon1);\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(deg2Rad(lat1)) * Math.cos(deg2Rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n\n // Return Distance in Kilometers\n return d;\n }", "function getDistanceBetweenTwoLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = degTorad(lat2 - lat1); \n var dLon = degTorad(lon2 - lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(degTorad(lat1)) * Math.cos(degTorad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1/180\n var radlat2 = Math.PI * lat2/180\n var theta = lon1-lon2\n var radtheta = Math.PI * theta/180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \n if (dist > 1) {\n dist = 1;\n }\n\n dist = Math.acos(dist)\n dist = dist * 180/Math.PI\n dist = dist * 60 * 1.1515\n \n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n \n return dist\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1);\n var a =\n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c; // Distance in km\n return d;\n}", "function calcDistanceFrom(lat1, lon1, lat2, lon2) {\n\tvar R = 6371; // km\n\tvar dLat = toRad(lat2-lat1);\n\tvar dLon = toRad(lon2-lon1);\n\tlat1 = toRad(lat1);\n\tlat2 = toRad(lat2);\n\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\tvar d = R * c;\n\treturn d;\n}", "function distBetweenTwoGeoPoints(lat, long, lat2, long2) {\n const earthRadius = 6371;\n var deltaPhi = ((lat2 - lat) * Math.PI) / 180;\n var deltaLambda = ((long2 - long) * Math.PI) / 180;\n\n phi1 = (lat * Math.PI) / 180;\n phi2 = (lat2 * Math.PI) / 180;\n\n var a =\n Math.sin(deltaPhi / 2) ** 2 +\n Math.cos(phi1) * Math.cos(phi2) * Math.sin(deltaLambda / 2) ** 2;\n var c = 2 * Math.atan(Math.sqrt(a), Math.sqrt(1 - a));\n\n return earthRadius * c;\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1/180\n var radlat2 = Math.PI * lat2/180\n var theta = lon1-lon2\n var radtheta = Math.PI * theta/180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180/Math.PI\n dist = dist * 60 * 1.1515\n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n return dist\n }", "function getDistanceFromLatLonInKm(lat1, lon1, cosLat1, lat2, lon2, cosLat2) {\n\n var dLat = (lat2 - lat1) * (Math.PI / 180);\n var dLon = (lon2 - lon1) * (Math.PI / 180);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n cosLat1 * cosLat2 *\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return R * c;\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distanceBetween(lat1, lng1, lat2, lng2) {\n var earthRadius = 6371000.; // meters\n var dLat = toRadians(lat2 - lat1);\n var dLng = toRadians(lng2 - lng1);\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) *\n Math.sin(dLng / 2) * Math.sin(dLng / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var dist = earthRadius * c;\n\n return dist;\n}", "function findDistance(lat1, lat2, lon1, lon2) {\n let distance = 0;\n // Earth's radius\n const R = 6371e3;\n const lat1_rad = (lat1 * Math.PI) / 180;\n const lat2_rad = (lat2 * Math.PI) / 180;\n const latDiff_rad = ((lat2 - lat1) * Math.PI) / 180;\n const lonDiff_rad = ((lon2 - lon1) * Math.PI) / 180;\n const a =\n Math.sin(latDiff_rad / 2) * Math.sin(latDiff_rad / 2) +\n Math.cos(lat1_rad) *\n Math.cos(lat2_rad) *\n Math.sin(lonDiff_rad / 2) *\n Math.sin(lonDiff_rad);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n // Distance in meters\n distance = R * c;\n\n return distance;\n}", "function distance(p1, p2) {\n return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) +\n (p1.y - p2.y) * (p1.y - p2.y));\n}", "function r_dist(lat1, lng1, lat2, lng2){\n\t//Credit to https://www.movable-type.co.uk/scripts/latlong.html\n\tvar R = 6371e3; // metres\n\tvar φ1 = degToRad(lat1)\n\tvar φ2 = degToRad(lat2)\n\tvar Δφ = degToRad(lat2-lat1)\n\tvar Δλ = degToRad(lng2-lng1)\n\n\tvar a = Math.sin(Δφ/2) * Math.sin(Δφ/2) +\n\t Math.cos(φ1) * Math.cos(φ2) *\n\t Math.sin(Δλ/2) * Math.sin(Δλ/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n\tvar d = R * c;\n\n\treturn d;\n}", "function calDistance(lat1, lon1, lat2, lon2, unit) {\n if ((lat1 === lat2) && (lon1 === lon2)) {\n return 0;\n }\n else {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit===\"K\") { dist = dist * 1.609344 }\n if (unit===\"N\") { dist = dist * 0.8684 }\n return dist;\n }\n}", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n return d;\n}", "function distance(p1, p2) {\n return Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));\n }", "function euclDistance2D(p1, p2) {\n return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2));\n}", "function distance(p1, p2) {\n\t\treturn Math.sqrt(Math.pow(p2.y - p1.y, 2) + Math.pow(p2.x - p1.x, 2));\n\t}", "static calculateDistance( coords1, coords2 ) {\n\n const xpart = Math.pow( coords1[ 0 ] - coords2[ 0 ], 2 );\n const ypart = Math.pow( coords1[ 1 ] - coords2[ 1 ], 2 );\n const zpart = Math.pow( coords1[ 2 ] - coords2[ 2 ], 2 );\n\n return Math.sqrt( xpart + ypart + zpart );\n\n }", "function calcDistance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1 / 180\n var radlat2 = Math.PI * lat2 / 180\n var theta = lon1 - lon2\n var radtheta = Math.PI * theta / 180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180 / Math.PI\n dist = dist * 60 * 1.1515\n if (unit == \"K\") {\n dist = dist * 1.609344\n }\n if (unit == \"N\") {\n dist = dist * 0.8684\n }\n return dist\n}" ]
[ "0.7437743", "0.733985", "0.72668856", "0.72580886", "0.7224401", "0.7212317", "0.7190487", "0.70879495", "0.70514625", "0.6997556", "0.6971698", "0.69597197", "0.69541484", "0.69528157", "0.69281584", "0.6923197", "0.6906247", "0.69006747", "0.68871176", "0.6884561", "0.68773407", "0.6877209", "0.68702525", "0.68699", "0.6862921", "0.68619347", "0.6848432", "0.6848432", "0.684565", "0.6834674", "0.6819942", "0.6817405", "0.6814401", "0.681351", "0.6808398", "0.6805035", "0.6766256", "0.6764032", "0.67631143", "0.67628306", "0.6762477", "0.67440236", "0.6743464", "0.6741343", "0.67337227", "0.67272455", "0.67271507", "0.67143595", "0.67101383", "0.66925097", "0.6677301", "0.6667871", "0.6663816", "0.6661987", "0.66523266", "0.66356647", "0.663166", "0.6631645", "0.6615262", "0.66099274", "0.6604487", "0.65951604", "0.6589304", "0.65880114", "0.65880114", "0.65880114", "0.65880114", "0.658295", "0.6560289", "0.6552249", "0.6547223", "0.653505", "0.65295446", "0.65234995", "0.65120345", "0.65097415", "0.6504487", "0.65028375", "0.6496417", "0.6489357", "0.6484119", "0.64765716", "0.647388", "0.6472518", "0.64693624", "0.64686364", "0.6467234", "0.6467234", "0.6465305", "0.6461417", "0.6456858", "0.6454653", "0.6453904", "0.64481044", "0.64419776", "0.6441466", "0.6440822", "0.643928", "0.6438856" ]
0.7124219
8
Eliminate points from a way unnecessary at a coarse precision
function scarceWay(coords, deviation) { // one node minimum assert(coords.length); if (coords.length < 2) { return coords; } // 2-node way if (coords.length == 2) { if (pointDistance(coords[0],coords[1]) <= deviation) { // for a 2-point way with minimal length, shrink to a single point return [[(coords[0][0]+coords[1][0])*0.5, (coords[0][1]+coords[1][1])*0.5]]; } else { return coords; } } // 3-plus-node-way var scarce = processForwardInTriplets(coords, deviation, dropTheMiddleman); scarce = processBackwardInTriplets(coords, deviation, dropTheMiddleman); // call recursively as long as the scarcity can be improved if (scarce.length < coords.length) { return scarceWay(scarce, deviation); } return scarce; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function antiAliase(stations) {\n var m = refPts;\n stations[m].lat = stations[m].lat * cur +\n stations[m-1].lat * oneOff + stations[m+1].lat * oneOff +\n stations[m-2].lat * twoOff + stations[m+2].lat * twoOff;\n\n stations[m].lng = stations[m].lng * cur +\n stations[m-1].lng * oneOff + stations[m+1].lng * oneOff +\n stations[m-2].lng * twoOff + stations[m+2].lng * twoOff;\n\n return stations[m];\n }", "function reducePointDensity(points, desiredNumberOfPoints) {\n console.log(\"removing points\");\n\n var startTime = points[0][0];\n console.log(\"startTime: \"+startTime);\n var endTime = points[points.length-1][0];\n console.log(\"endTime: \"+endTime);\n var desiredInterval = (endTime - startTime) / desiredNumberOfPoints;\n console.log(\"desiredInterval: \"+desiredInterval);\n\n var newPoints = [points[0]];\n var lastIndex = 0;\n for (i=1; i<points.length; i++) {\n var interval = points[i][0] - points[lastIndex][0];\n //console.log(\"interval: \"+interval);\n if (interval >= desiredInterval) {\n newPoints.push(points[i]);\n lastIndex = i;\n }\n }\n\n // Push the last point too, ensuring the total span of time\n // doesn't change (which ensures the graph doesn't jump around).\n if (lastIndex != points.length-1) {\n newPoints.push(points[points.length -1 ]);\n }\n \n return newPoints;\n}", "function _reducePoints(points, sqTolerance) {\r\n \tvar reducedPoints = [points[0]];\r\n\r\n \tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n \t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n \t\t\treducedPoints.push(points[i]);\r\n \t\t\tprev = i;\r\n \t\t}\r\n \t}\r\n \tif (prev < len - 1) {\r\n \t\treducedPoints.push(points[len - 1]);\r\n \t}\r\n \treturn reducedPoints;\r\n }", "optimizeTetromino() {\r\n for (let p = this.tetrominos.length - 1; p >= 0; p--) {\r\n if (this.tetrominos[p].y1 > 2000 && this.tetrominos[p].y2 > 2000 &&\r\n this.tetrominos[p].y3 > 2000 && this.tetrominos[p].y4 > 2000) {\r\n this.tetrominos.splice(p, 1);\r\n }\r\n }\r\n }", "function _reducePoints(points, sqTolerance) {\r\n\t \tvar reducedPoints = [points[0]];\r\n\r\n\t \tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t \t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t \t\t\treducedPoints.push(points[i]);\r\n\t \t\t\tprev = i;\r\n\t \t\t}\r\n\t \t}\r\n\t \tif (prev < len - 1) {\r\n\t \t\treducedPoints.push(points[len - 1]);\r\n\t \t}\r\n\t \treturn reducedPoints;\r\n\t }", "filter_points(all_points, application_point, threshold) {\n this.filtered_point_indices = [];\n this.inv_filtered_indices = [];\n for(var point_idx = 0; point_idx < all_points.length; point_idx++) {\n if(this.compare_application_points(all_points[point_idx].application_point, application_point, threshold)) {\n this.inv_filtered_indices.push(this.filtered_point_indices.length);\n this.filtered_point_indices.push(point_idx);\n }\n else this.inv_filtered_indices.push(null);\n }\n\n let old_selected_point_indices = this.selected_point_indices;\n this.selected_point_indices = [];\n for(let selected_point_idx = 0; selected_point_idx < old_selected_point_indices.length; selected_point_idx++) {\n let old_point = all_points[old_selected_point_indices[selected_point_idx]];\n let best_new_point_idx = -1;\n\n for(let new_point_index = 0; new_point_index < this.filtered_point_indices.length; new_point_index++) {\n let best_dist = best_new_point_idx == -1 ? 10e10 : this.distance_design_performance(old_point, all_points[best_new_point_idx]);\n let new_dist = this.distance_design_performance(old_point, all_points[this.filtered_point_indices[new_point_index]]);\n\n if(new_dist < best_dist) {\n best_new_point_idx = this.filtered_point_indices[new_point_index];\n }\n }\n\n if(best_new_point_idx != -1) {\n this.selected_point_indices.push(best_new_point_idx);\n }\n }\n\n // make sure that points are not selected twice\n if (this.selected_point_indices.length > 0)\n this.selected_point_indices = Array.from(new Set(this.selected_point_indices));\n\n // if we weren't able to pick a single point just chose the first one\n if(this.selected_point_indices.length == 0)\n this.selected_point_indices = this.filtered_point_indices.length > 0 ? [this.filtered_point_indices[0]] : [];\n }", "function _reducePoints(points, sqTolerance) {\r\n \tvar reducedPoints = [points[0]];\r\n\r\n \tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n \t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n \t\t\treducedPoints.push(points[i]);\r\n \t\t\tprev = i;\r\n \t\t}\r\n \t}\r\n \tif (prev < len - 1) {\r\n \t\treducedPoints.push(points[len - 1]);\r\n \t}\r\n \treturn reducedPoints;\r\n }", "function _reducePoints(points, sqTolerance) {\r\n \tvar reducedPoints = [points[0]];\r\n\r\n \tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n \t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n \t\t\treducedPoints.push(points[i]);\r\n \t\t\tprev = i;\r\n \t\t}\r\n \t}\r\n \tif (prev < len - 1) {\r\n \t\treducedPoints.push(points[len - 1]);\r\n \t}\r\n \treturn reducedPoints;\r\n }", "function removeInflexionPoint(array) {\n const N = array.length;\n let a = array[N - 1];\n let b = array[0];\n let c = array[1];\n const result = [];\n const index_inf = [];\n for(let i = 0; i < N; i++) {\n const p = (a[1] - b[1]) / (c[1] - b[1]);\n if (b[1] > c[1] && a[0] - b[0] >= p * (c[0] - b[0]) || !(b[1] > c[1]) && a[0] - b[0] <= p * (c[0] - b[0]))\n result.push(b);\n else\n index_inf.push(i);\n a = b;\n b = c;\n c = array[(i + 2) % N];\n } \n return [result, index_inf];\n }", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\r\n\tvar reducedPoints = [points[0]];\r\n\r\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\r\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\r\n\t\t\treducedPoints.push(points[i]);\r\n\t\t\tprev = i;\r\n\t\t}\r\n\t}\r\n\tif (prev < len - 1) {\r\n\t\treducedPoints.push(points[len - 1]);\r\n\t}\r\n\treturn reducedPoints;\r\n}", "function _reducePoints(points, sqTolerance) {\n \tvar reducedPoints = [points[0]];\n\n \tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n \t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n \t\t\treducedPoints.push(points[i]);\n \t\t\tprev = i;\n \t\t}\n \t}\n \tif (prev < len - 1) {\n \t\treducedPoints.push(points[len - 1]);\n \t}\n \treturn reducedPoints;\n }", "function _reducePoints(points, sqTolerance) {\n \tvar reducedPoints = [points[0]];\n\n \tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n \t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n \t\t\treducedPoints.push(points[i]);\n \t\t\tprev = i;\n \t\t}\n \t}\n \tif (prev < len - 1) {\n \t\treducedPoints.push(points[len - 1]);\n \t}\n \treturn reducedPoints;\n }", "filterInternal(points) {\n const bbox = this.boundingBox();\n\n const tests = points\n .filter(p => bbox.testPoint(p))\n .map(p => ({ p, c: false }));\n\n if (tests.length === 0) return tests;\n\n cycle(this.vertices, (v, vn) => {\n for (let i = 0; i < tests.length; i++) {\n const { p } = tests[i];\n if (\n ((v.y > p.y) !== (vn.y > p.y)) &&\n (p.x < (vn.x - v.x) * (p.y - v.y) / (vn.y - v.y) + v.x)\n ) { tests[i].c = !tests[i].c; }\n }\n });\n return tests.filter(t => t.c).map(t => t.p);\n }", "function _reducePoints(points, sqTolerance) {\n\tvar reducedPoints = [points[0]];\n\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n\t\t\treducedPoints.push(points[i]);\n\t\t\tprev = i;\n\t\t}\n\t}\n\tif (prev < len - 1) {\n\t\treducedPoints.push(points[len - 1]);\n\t}\n\treturn reducedPoints;\n}", "function _reducePoints(points, sqTolerance) {\n\tvar reducedPoints = [points[0]];\n\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n\t\t\treducedPoints.push(points[i]);\n\t\t\tprev = i;\n\t\t}\n\t}\n\tif (prev < len - 1) {\n\t\treducedPoints.push(points[len - 1]);\n\t}\n\treturn reducedPoints;\n}", "function _reducePoints(points, sqTolerance) {\n\tvar reducedPoints = [points[0]];\n\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n\t\t\treducedPoints.push(points[i]);\n\t\t\tprev = i;\n\t\t}\n\t}\n\tif (prev < len - 1) {\n\t\treducedPoints.push(points[len - 1]);\n\t}\n\treturn reducedPoints;\n}", "function _reducePoints(points, sqTolerance) {\n\tvar reducedPoints = [points[0]];\n\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n\t\t\treducedPoints.push(points[i]);\n\t\t\tprev = i;\n\t\t}\n\t}\n\tif (prev < len - 1) {\n\t\treducedPoints.push(points[len - 1]);\n\t}\n\treturn reducedPoints;\n}", "function _reducePoints(points, sqTolerance) {\n\tvar reducedPoints = [points[0]];\n\n\tfor (var i = 1, prev = 0, len = points.length; i < len; i++) {\n\t\tif (_sqDist(points[i], points[prev]) > sqTolerance) {\n\t\t\treducedPoints.push(points[i]);\n\t\t\tprev = i;\n\t\t}\n\t}\n\tif (prev < len - 1) {\n\t\treducedPoints.push(points[len - 1]);\n\t}\n\treturn reducedPoints;\n}", "function removeUseless(tfs, precision) {\n\treturn tfs.filter(tf => {\n\n\t\tconst data = tf.data.map(x => Math.round(x*precision)/precision);\n\n\t\treturn !(\n\t\t\t\n\t\t\t// translate(0), rotate(0[, cx, cy]), skewX(0), skewY(0)\n\t\t\t['translate', 'rotate', 'skewX', 'skewY'].includes(tf.name) && (data.length===1 || tf.name==='rotate') && data[0]==0 ||\n\n\t\t\t// translate(0, 0)\n\t\t\ttf.name==='translate' && data[0]==0 && data[1]==0 ||\n\n\t\t\t// scale(1)\n\t\t\ttf.name==='scale' && data[0]==1 && (data.length===1 || data[1]==1) ||\n\n\t\t\t// matrix(1 0 0 1 0 0)\n\t\t\ttf.name==='matrix' && data[0]==1 && data[3]==1 && data[1]==0 && data[2]==0 && data[4]==0 && data[5]==0\n\t\t)\n\t});\n}", "removePoints() {\n const block = this;\n for (let i = this.inputs.length - 1; i >= 0; i--) {\n block.removePoint(this.inputs[i]);\n }\n for (let i = this.outputs.length - 1; i >= 0; i--) {\n block.removePoint(this.outputs[i]);\n }\n }", "identifyConcavePoints() {\n\n //for each point in the fixture we need to remove it then calculate the area if the area is greater without it then that point was a concave point\n this.concavePoints = [];\n this.maybeConcave = [];\n let originalArea = this.calculateArea(this.pixelVectorsLeft);\n let concavePointLabels = [];\n for (let i = 0; i < this.pixelVectorsLeft.length; i++) {\n let newVecs = [];\n for (let v of this.pixelVectorsLeft) {\n if (v !== this.pixelVectorsLeft[i]) {\n newVecs.push(v);\n }\n }\n //if removing this point creates a line cross then our algorithm for calculating area doesnt work, so we need to assume its a concave point\n this.maybeConcave.push(this.anyLinesCross(newVecs));\n //if removing this point increases the area of the shape then this point is concave\n this.concavePoints.push(originalArea < this.calculateArea(newVecs));\n }\n }", "addNoise(feature){\n\n\t\ttry{\n\t\t\tfeature.geometry.coordinates.map((outline) => {\n\t\t\t\t//'outline' is one of the perimeters in the polygon \"feature\", either the perimeter of the whole polygon or one of its holes.\n\t\t\t\tif(outline.length<4096){\n\t\t\t\t\t//Because the list is changing as it is being operated on, the original length is stored in a variable.\n\t\t\t\t\t//Removing the placeholder value from the end of the array, as it distorts the noise function\n\t\t\t\t\tlet cap = outline.pop();\n\t\t\t\t\tlet iterations = (outline.length-1);\n\t\t\t\t\tlet point0, point1;\n\n\t\t\t\t\tfor(let i=0; i<iterations*2;i+=2){\n\t\t\t\t\t\tpoint0 = outline[i];\n\t\t\t\t\t\tpoint1 = outline[i+1];\n\t\t\t\t\t\t//console.log(point0, point1);\n\n\t\t\t\t\t\toutline.splice(i+1, 0, noisyPoint(point0, point1));\n\t\t\t\t\t}\n\n\t\t\t\t\t//Does an additional calculation between the first and last points.\n\t\t\t\t\tpoint0 = outline[outline.length-1];\n\t\t\t\t\tpoint1 = outline[0];\n\t\t\t\t\toutline.push(noisyPoint(point0, point1));\n\n\t\t\t\t\toutline.push(cap);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tcatch (e){\n\t\t\t//If the shape throws a TypeError, it is likely that a bad polygon is appended at the end of the perimeter array.\n\t\t\t//The fix for this is to simply remove the bad element; if it is another error, then it will be thrown as normal.\n\t\t\tif(e instanceof TypeError){\n\t\t\t\tfeature.geometry.coordinates.pop();\n\t\t\t\treturn this.addNoise(feature);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tthrow e\n\t\t\t}\n\t\t}\n\t\t\n\t\t//console.log(feature.geometry.coordinates[0]);\n\t\treturn feature;\n\t}", "function simplify(points, tolerance, highestQuality) {\n\n if (points.length <= 2) return points;\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n}", "function simplify(points, tolerance, highestQuality) {\n if (points.length <= 2) return points;\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n }", "function simplify(points, tolerance) {\n\n\t var sqTolerance = tolerance * tolerance,\n\t len = points.length,\n\t first = 0,\n\t last = len - 1,\n\t stack = [],\n\t i, maxSqDist, sqDist, index;\n\n\t // always retain the endpoints (1 is the max value)\n\t points[first][2] = 1;\n\t points[last][2] = 1;\n\n\t // avoid recursion by using a stack\n\t while (last) {\n\n\t maxSqDist = 0;\n\n\t for (i = first + 1; i < last; i++) {\n\t sqDist = getSqSegDist(points[i], points[first], points[last]);\n\n\t if (sqDist > maxSqDist) {\n\t index = i;\n\t maxSqDist = sqDist;\n\t }\n\t }\n\n\t if (maxSqDist > sqTolerance) {\n\t points[index][2] = maxSqDist; // save the point importance in squared pixels as a z coordinate\n\t stack.push(first);\n\t stack.push(index);\n\t first = index;\n\n\t } else {\n\t last = stack.pop();\n\t first = stack.pop();\n\t }\n\t }\n\t}", "function simplify(points, tolerance) {\n\t\n\t var sqTolerance = tolerance * tolerance,\n\t len = points.length,\n\t first = 0,\n\t last = len - 1,\n\t stack = [],\n\t i, maxSqDist, sqDist, index;\n\t\n\t // always retain the endpoints (1 is the max value)\n\t points[first][2] = 1;\n\t points[last][2] = 1;\n\t\n\t // avoid recursion by using a stack\n\t while (last) {\n\t\n\t maxSqDist = 0;\n\t\n\t for (i = first + 1; i < last; i++) {\n\t sqDist = getSqSegDist(points[i], points[first], points[last]);\n\t\n\t if (sqDist > maxSqDist) {\n\t index = i;\n\t maxSqDist = sqDist;\n\t }\n\t }\n\t\n\t if (maxSqDist > sqTolerance) {\n\t points[index][2] = maxSqDist; // save the point importance in squared pixels as a z coordinate\n\t stack.push(first);\n\t stack.push(index);\n\t first = index;\n\t\n\t } else {\n\t last = stack.pop();\n\t first = stack.pop();\n\t }\n\t }\n\t}", "function cleanZone(point) {\n\n // console.log(\"Entered the cleanZone function\");\n // scans the entire active array\n\n // var neighborhoodOfActiveNodes = this.getNeighborhoodOfPoint(point, minRadius, activeNodes);\n // for (var i = 0; i < neighborhoodOfActiveNodes.length; i++) {\n // for (var i = 0; i < activeNodes.length; i++) {\n // // check to see if the points are close\n //\n //\n // // if (checkDistance(neighborhoodOfActiveNodes[i], point)) {\n // if (checkDistance(activeNodes[i], point)) {\n // activeNodes.splice(i, 1); // remove the offending point\n // i--; // decrement, since the activeNode length just decremented\n // }\n // }\n\n\n // NEW VERSION:\n // /*\n // sortByXValue :: (point1: Point, point2: Point) -> float\n //\n // returns whether point1 has a x coord greater than (>0), equal to (==0), or less than (<0) point2 does\n // */\n // function sortByXValue(point1, point2) {\n // return point1.x - point2.x;\n // }\n // // do a binary search to find the minimum and maximum x values\n // var minX = Utils.binarySearch(activeNodes, {x: point.x - minRadius}, sortByXValue);\n // var maxX = Utils.binarySearch(activeNodes, {x: point.x + minRadius}, sortByXValue);\n // var nearbyNodes = activeNodes.slice(minX, maxX + 1); // make a copy of all nodes nearby to point\n // var maxDistance = Math.pow(minRadius, 2);\n // var notTooClose = nearbyNodes.filter(function(currentPoint) { // filter out all the points that are not close\n // if ( (point.y - radius >= currentPoint.y) && (point.y + radius <= currentPoint.y)) { // check to see if the y value is close\n // return Math.pow(currentPoint.x - point.x, 2) + Math.pow(currentPoint.y - point.y, 2) > maxDistance; // check to see if distance is not within radius\n // }\n // return true; // if the y value is not close, the point is fine\n // });\n // // concat the array of all points with x values smaller than minX with the notTooClose points with the points with x values larger than maxX\n // activeNodes = activeNodes.slice(0, minX).concat(notTooClose, activeNodes.slice(maxX - 1, activeNodes.length) );\n\n\n // NEW NEW VERSION (Which uses Map.getNeighborhoodOfPoint)\n // // Add an index to each point in the activeNodes\n // var index = 0;\n // activeNodes.forEach(function(currentPoint) {\n // currentPoint.index = index;\n // index++;\n // });\n // var neighborhood = Map.getNeighborhoodOfPoint(point, minRadius, activeNodes); // get the neighborhood of the point\n // var neighborhoodLength = neighborhood.length;\n // for (var i = neighborhoodLength; i <= 0; i--) { // cycle backwards (backwards to ensure the indices don't change for lower values) through the neighborhood\n // activeNodes.splice(neighborhood[i].index, 1); // remove each element of activeNodes which is in the neighborhood\n // }\n\n // ON THIRD THOUGHT VERSION\n /*\n sortByXValue :: (point1: Point, point2: Point) -> float\n\n returns whether point1 has a x coord greater than (>0), equal to (==0), or less than (<0) point2 does\n */\n // function sortByXValue(point1, point2) {\n // return point1.x - point2.x;\n // }\n\n var index = 0;\n activeNodes.forEach(function(target){\n if(distanceBetween(target, point) < minRadius){\n activeNodes.splice(index, 1);\n } else {\n index ++;\n }\n });\n\n\n // TODO VERSION W/ BINARY SEARCH\n // var neighborhood = activeNodes.getNeighborhood(point, minRadius); // get the neighborhood of the point\n //\n // var index;\n // for (var i = 0; i < neighborhood.length; i++) {\n // index = Utils.binarySearch(activeNodes, neighborhood[i], sortPoints()); // find the index of the point which is in the neighborhood\n // activeNodes.splice(index, 1); // remove the point from the activeNodes\n // }\n // TODO VERSION W/ BINARY SEARCH\n }", "function simplify(points, tolerance, highestQuality) {\n\n if (points.length <= 2) return points;\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n}", "removeAllPoints() {\n if (glb == null || glb == undefined) {\n return;\n }\n glb.removePoints();\n }", "function filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}", "function filterPoints( start, end ) {\n\n\t\tif ( ! start ) return start;\n\t\tif ( ! end ) end = start;\n\n\t\tlet p = start,\n\t\t\tagain;\n\t\tdo {\n\n\t\t\tagain = false;\n\n\t\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tp = end = p.prev;\n\t\t\t\tif ( p === p.next ) break;\n\t\t\t\tagain = true;\n\n\t\t\t} else {\n\n\t\t\t\tp = p.next;\n\n\t\t\t}\n\n\t\t} while ( again || p !== end );\n\n\t\treturn end;\n\n\t}", "function simplify(points, tolerance) {\n\n var sqTolerance = tolerance * tolerance,\n len = points.length,\n first = 0,\n last = len - 1,\n stack = [],\n i, maxSqDist, sqDist, index;\n\n // always retain the endpoints (1 is the max value)\n points[first][2] = 1;\n points[last][2] = 1;\n\n // avoid recursion by using a stack\n while (last) {\n\n maxSqDist = 0;\n\n for (i = first + 1; i < last; i++) {\n sqDist = getSqSegDist(points[i], points[first], points[last]);\n\n if (sqDist > maxSqDist) {\n index = i;\n maxSqDist = sqDist;\n }\n }\n\n if (maxSqDist > sqTolerance) {\n points[index][2] = maxSqDist; // save the point importance in squared pixels as a z coordinate\n stack.push(first);\n stack.push(index);\n first = index;\n\n } else {\n last = stack.pop();\n first = stack.pop();\n }\n }\n}", "function simplify(points, tolerance) {\n\n var sqTolerance = tolerance * tolerance,\n len = points.length,\n first = 0,\n last = len - 1,\n stack = [],\n i, maxSqDist, sqDist, index;\n\n // always retain the endpoints (1 is the max value)\n points[first][2] = 1;\n points[last][2] = 1;\n\n // avoid recursion by using a stack\n while (last) {\n\n maxSqDist = 0;\n\n for (i = first + 1; i < last; i++) {\n sqDist = getSqSegDist(points[i], points[first], points[last]);\n\n if (sqDist > maxSqDist) {\n index = i;\n maxSqDist = sqDist;\n }\n }\n\n if (maxSqDist > sqTolerance) {\n points[index][2] = maxSqDist; // save the point importance in squared pixels as a z coordinate\n stack.push(first);\n stack.push(index);\n first = index;\n\n } else {\n last = stack.pop();\n first = stack.pop();\n }\n }\n}", "function simplify(points, tolerance, highestQuality) {\n\t\n\t var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\t\n\t points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n\t points = simplifyDouglasPeucker(points, sqTolerance);\n\t\n\t return points;\n\t}", "function deletePoint(event) {\n\t//Nao permite remover pontos se nao houver linhas\n\tif(qttCurves == 0){\n\t\talert(\"Crie uma curva para remover pontos.\")\n\t\treturn;\n\t}\n\tvar mouseX = event.offsetX, mouseY = event.offsetY;\n\t//busca os pontos da curva atualmente selecionada\n\tvar points = getPoints();\n\tvar i;\n\tvar cx, cy, r;\n\tvar found = false;\n\t//busca o primeiro ponto que o mouse encontra\n\tfor (i = 0; i < points.length; i++) {\n\t\tcx = parseInt(points[i].getAttribute(\"cx\"));\n\t\tcy = parseInt(points[i].getAttribute(\"cy\"));\n\t\tr = 6;\n\t\tif(inRange(cx, cy, r, mouseX, mouseY)){\n\t\t\t//Remove o ponto selecionado do SVG e do array de pontos\n\t\t\tmainCanvas.removeChild(points[i]);\n\t\t\tfound = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\t//Se o ponto clicado for valido\n\tif(found){\n\t\tvar lines = getLines();\n\t\tif(i == 0){\n\t\t\t//Se for o ponto inicial, retire somente a primeira linha\n\t\t\tmainCanvas.removeChild(lines[i]);\n\t\t}else if(i-1 == lines.length-1){\n\t\t\t//Se for o ultimo ponto, retire somente a ultima linha\n\t\t\tmainCanvas.removeChild(lines[lines.length-1]);\n\t\t}else{\n\t\t\t//Caso contrario, conecta a linha anterior ao final da linha posterior e remove a linha posterior\n\t\t\tlines[i-1].setAttribute('x2', lines[i].getAttribute('x2'));\n\t\t\tlines[i-1].setAttribute('y2', lines[i].getAttribute('y2'));\n\t\t\tmainCanvas.removeChild(lines[i]);\n\t\t}\n\n\t\tdeleteBezier();\n\t\tmakeBezier(apb[selCurve]);\n\t}\n}", "function removeNegativeValues(data) {\n x = data.x;\n y = data.y;\n\n for (let x_index = 0; x_index < x.length; x_index++) {\n if (y[x_index] < 0) {\n data.x.splice(x_index, 1);\n data.y.splice(x_index, 1);\n x_index--\n }\n }\n\n return data\n}", "function calculateThesholdLinePoints() {\n\tconst xCoords = [];\n\tconst step = (maxX - minX) / NUM_POINTS_ON_CURVE;\n\tfor (let i = 0; i < NUM_POINTS_ON_CURVE; i++) {\n\t\tlet x = minX + i * step;\n\t\txCoords.push(x);\n\t}\n\tconst yLows = [];\n\tconst yHighs = [];\n\tconst floatLambda = parseFloat(lambda);\n\tconst exponent = 1.0 / floatLambda;\n\tconsole.log(\"lambda: \" + floatLambda);\n\tconsole.log(\"exponent: \" + exponent);\n\tconsole.log(\"cutoff residual: \" + cutoffResidual);\n\tfor (let i = 0; i < NUM_POINTS_ON_CURVE; i++) {\n\t\tlet y = computeY(xCoords[i], intercept);\n\t\t//console.log(\"y: \" + y);\n\t\tlet yLow = Math.pow((y - cutoffResidual) * floatLambda + 1, exponent);\n\t\tlet yHigh = Math.pow((y + cutoffResidual) * floatLambda + 1, exponent);\n\t\t//console.log(\"yHigh: \" + yHigh);\n\t\tyLows.push(yLow);\n\t\tyHighs.push(yHigh);\n\t}\n\tconst threshPoints = {};\n\tthreshPoints.low = \"\";\n\tthreshPoints.high = \"\";\n\tlet lowCount = 0;\n\tlet highCount = 0;\n\tfor (let i = 0; i < NUM_POINTS_ON_CURVE; i++) {\n\t\tlet x = xCoords[i];\n\t\tlet yLow = yLows[i];\n\t\tif (yLow >= minY && yLow <= maxY) {\n\t\t\tlowCount++;\n\t\t\tlet coord = xScale(x) + \",\" + yScale(yLow);\n\t\t\tif (lowCount > 1) {\n\t\t\t\tcoord = \" \" + coord;\n\t\t\t}\n\t\t\tthreshPoints.low += coord;\n\t\t}\n\t\tlet yHigh = yHighs[i];\n\t\t//console.log(yHigh);\n\t\tif (yHigh >= minY && yHigh <= maxY) {\n\t\t\thighCount++;\n\t\t\tlet coord = xScale(x) + \",\" + yScale(yHigh);\n\t\t\tif (highCount > 1) {\n\t\t\t\tcoord = \" \" + coord;\n\t\t\t}\n\t\t\tthreshPoints.high += coord;\n\t\t}\n\t}\n\treturn threshPoints;\n}", "function _filterPoints(points) {\n var filteredPoints = [];\n\n for (var i = 0, len = points.length; i < len; i++) {\n var point = points[i];\n\n if (!isNaN(point.x) && !isNaN(point.y)) {\n filteredPoints.push(point);\n }\n }\n\n return filteredPoints;\n}", "function removeSpikesInPath(ids) {\n var n = ids.length;\n if (n >= 2) {\n if (ids[0] == ~ids[n-1]) {\n ids.pop();\n ids.shift();\n } else {\n for (var i=1; i<n; i++) {\n if (ids[i-1] == ~ids[i]) {\n ids.splice(i-1, 2);\n break;\n }\n }\n }\n if (ids.length < n) {\n removeSpikesInPath(ids);\n }\n }\n }", "function removeAllWaypoints() {\n if(!canvas_flag_active) {\n number_of_coordinates = 0;\n current_coordinate_list = [];\n canvas_flag_position = {x:undefined,y:undefined};\n var coordinates = document.querySelectorAll('#coordinates-list > div');\n coordinates.forEach((coordinate) => {\n document.querySelector('#coordinates-list').removeChild(coordinate);\n });\n }\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function simplify(points, tolerance, highestQuality) {\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n}", "function simplify(points, tolerance, highestQuality) {\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n}", "function simplify(points, tolerance, highestQuality) {\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n}", "function simplify(points, tolerance, highestQuality) {\n\n var sqTolerance = tolerance !== undefined ? tolerance * tolerance : 1;\n\n points = highestQuality ? points : simplifyRadialDist(points, sqTolerance);\n points = simplifyDouglasPeucker(points, sqTolerance);\n\n return points;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}", "function filterPoints( start, end ) {\n\n\tif ( ! start ) { return start; }\n\tif ( ! end ) { end = start; }\n\n\tvar p = start, again;\n\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) { break; }\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}", "function computeMainPoints(totalPoints, mainPoints, epsilon = 0.0001) {\n var ans = [];\n for (var i = 0; i < totalPoints.length; i++) {\n var runningPoint = totalPoints[i];\n for (var j = 0; j < mainPoints.length; j++) {\n var runningPassenger = mainPoints[j];\n\n // si\n // lat match\n var siLatMatch = Math.abs(runningPoint.lat - runningPassenger.lat) < epsilon;\n var siLngMatch = Math.abs(runningPoint.lng - runningPassenger.lng) < epsilon;\n\n if (siLatMatch && siLngMatch) {\n // console.log(\"Including point: \", runningPoint, \" because it's equal to existing main point: \", runningPassenger, \" at index: \" + j);\n ans.push(runningPoint);\n break;\n }\n\n }\n }\n return ans;\n}", "function filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tvar p = start, again;\n\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}", "function filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tvar p = start, again;\n\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}", "function filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tvar p = start, again;\n\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}", "function prune(map, max) {\n if (map.size > max) {\n var times = []\n map.forEach(function (calc, key) {\n times.push([calc._opt.pathTime, calc, key])\n })\n times.sort(function (a, b) { return a[0] - b[0] })\n .slice(0, map.size - max * 0.8)\n .forEach(function (a) {\n map.delete(a[2])\n a[1].release()\n })\n }\n }", "function simplifyRadialDist(points, sqTolerance) {\n\t\n\t var prevPoint = points[0],\n\t newPoints = [prevPoint],\n\t point;\n\t\n\t for (var i = 1, len = points.length; i < len; i++) {\n\t point = points[i];\n\t\n\t if (getSqDist(point, prevPoint) > sqTolerance) {\n\t newPoints.push(point);\n\t prevPoint = point;\n\t }\n\t }\n\t\n\t if (prevPoint !== point) newPoints.push(point);\n\t\n\t return newPoints;\n\t}", "removePoint() {\n const i = this.pointObjects.indexOf(this.selectedPoint);\n this.splinePoints.splice(i, 1);\n this.deselectPoint();\n this.updateTrajectory();\n }", "adjustPointsSpacing(points) {\n return points.reduce((acc, point, i) => {\n if (i === 0 || (i === points.length - 1 && !this.wrapEnd)) {\n acc.push(point);\n return acc;\n }\n\n let next = points[i + 1];\n\n if (this.wrapEnd && !next) next = points[0];\n\n const distance = pointDistance(point, next);\n\n if (distance > this.curveSize) {\n // Add points\n const numInsertPoints = Math.round((distance / this.curveSize) * this.insertionFactor) + 1;\n for (let k = 0; k < numInsertPoints; k++) {\n const ratio = (1 / numInsertPoints) * k;\n const nx = lerp(point.x, next.x, ratio);\n const ny = lerp(point.y, next.y, ratio);\n acc.push(new Vector(nx, ny));\n }\n } else if (this.canRemovePoint(i, points) && distance < this.pointRemoveProx) {\n // Remove points\n } else {\n acc.push(point);\n }\n return acc;\n }, []);\n }", "function nonMaximumSuppression(x,y){ \n var c;\n var ns;\n var we;\n var nwse;\n var nesw;\n \n for (c=0; c<4; c++){ \n if (c==3)\n {newImageData.data[idx+c] = 255;}\n else{\n \n var n = pixelComponents[(x + (y-1) * canvas.width)*4];\n var s = pixelComponents[(x + (y+1) * canvas.width)*4];\n if (n >= pixelComponents[idx+c] || s >= pixelComponents[idx+c])\n {ns = 0;} else {ns = newImageData.data[idx+c];} \n \n var w = pixelComponents[((x-1) + y * canvas.width)*4];\n var e = pixelComponents[((x+1) + y * canvas.width)*4];\n if (w >= pixelComponents[idx+c] || e >= pixelComponents[idx+c])\n {we = 0;} else {we = newImageData.data[idx+c];} \n \n var ne = pixelComponents[((x+1) + (y-1) * canvas.width)*4];\n var sw = pixelComponents[((x-1) + (y+1) * canvas.width)*4]; \n if (ne >= pixelComponents[idx+c] || sw >= pixelComponents[idx+c])\n {nesw = 0;} else { nesw = newImageData.data[idx+c];} \n \n var se = pixelComponents[((x+1) + (y+1) * canvas.width)*4];\n var nw = pixelComponents[((x-1) + (y-1) * canvas.width)*4];\n if (nw >= pixelComponents[idx+c] || se >= pixelComponents[idx+c])\n {nwse = 0 } else {nwse = newImageData.data[idx+c];} \n \n newImageData.data[idx+c] = ns + we + nesw + nwse;\n \n }\n } \n }", "function filterPoints(start, end) {\n\t if (!start) { return start; }\n\t if (!end) { end = start; }\n\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) { break; }\n\t again = true;\n\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\n\t return end;\n\t}", "function filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}", "function filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}", "function filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}", "function filterPoints( start, end ) {\n\n\t\tif ( ! start ) return start;\n\t\tif ( ! end ) end = start;\n\n\t\tvar p = start, again;\n\n\t\tdo {\n\n\t\t\tagain = false;\n\n\t\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tp = end = p.prev;\n\t\t\t\tif ( p === p.next ) break;\n\t\t\t\tagain = true;\n\n\t\t\t} else {\n\n\t\t\t\tp = p.next;\n\n\t\t\t}\n\n\t\t} while ( again || p !== end );\n\n\t\treturn end;\n\n\t}", "function filterPoints( start, end ) {\n\n\t\tif ( ! start ) return start;\n\t\tif ( ! end ) end = start;\n\n\t\tvar p = start, again;\n\n\t\tdo {\n\n\t\t\tagain = false;\n\n\t\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tp = end = p.prev;\n\t\t\t\tif ( p === p.next ) break;\n\t\t\t\tagain = true;\n\n\t\t\t} else {\n\n\t\t\t\tp = p.next;\n\n\t\t\t}\n\n\t\t} while ( again || p !== end );\n\n\t\treturn end;\n\n\t}", "function filterPoints( start, end ) {\n\n\t\tif ( ! start ) return start;\n\t\tif ( ! end ) end = start;\n\n\t\tvar p = start, again;\n\n\t\tdo {\n\n\t\t\tagain = false;\n\n\t\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tp = end = p.prev;\n\t\t\t\tif ( p === p.next ) break;\n\t\t\t\tagain = true;\n\n\t\t\t} else {\n\n\t\t\t\tp = p.next;\n\n\t\t\t}\n\n\t\t} while ( again || p !== end );\n\n\t\treturn end;\n\n\t}", "function antiAliaseEndpoints(stations) {\n var m = middle;\n stations[m].lat = stations[m].lat * 0.4 +\n stations[m-1].lat * 0.3 + stations[m+1].lat * 0.3;\n stations[m].lng = stations[m].lng * 0.4 +\n stations[m-1].lng * 0.3 + stations[m+1].lng * 0.3;\n\n return stations[m];\n }", "function filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\n\t return end;\n\t}", "function filterPoints(start, end) {\n\n\tif (!start) return start;\n\tif (!end) end = start;\n\n\tvar p = start,\n\t again;\n\n\tdo {\n\n\t\tagain = false;\n\n\t\tif (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\n\t\t\tremoveNode(p);\n\t\t\tp = end = p.prev;\n\t\t\tif (p === p.next) break;\n\t\t\tagain = true;\n\t\t} else {\n\n\t\t\tp = p.next;\n\t\t}\n\t} while (again || p !== end);\n\n\treturn end;\n}", "refineKnots(ukList) {\r\n let m = this.knots.length - 1;\r\n let p = this.degree;\r\n let n = m - p - 1;\r\n let dim = this.dimension;\r\n let X = ukList;\r\n let r = ukList.length - 1;\r\n let P = this.cpoints;\r\n let Q = new common_1.NDArray({ shape: [P.length + r + 1, dim] });\r\n let U = this.knots;\r\n let Ubar = new common_1.NDArray({ shape: [U.length + r + 1] });\r\n let Wp, Wq;\r\n if (this.weights) {\r\n Wq = new common_1.NDArray({ shape: [P.length + r + 1] });\r\n Wp = this.weights;\r\n }\r\n let a = this.findSpan(X[0]);\r\n let b = this.findSpan(X[r]);\r\n b += 1;\r\n // Copy control points and weights for u < a and u > b\r\n for (let j = 0; j < a - p + 1; j++) {\r\n for (let k = 0; k < dim; k++) {\r\n Q.set(j, k, P.get(j, k));\r\n }\r\n if (Wp && Wq) {\r\n Wq.set(j, Wp.get(j));\r\n }\r\n }\r\n for (let j = b - 1; j < n + 1; j++) {\r\n for (let k = 0; k < dim; k++) {\r\n Q.set(j + r + 1, k, P.get(j, k));\r\n }\r\n if (Wp && Wq) {\r\n Wq.set(j + r + 1, Wp.get(j));\r\n }\r\n }\r\n // Copy knots for u < a and u > b\r\n for (let j = 0; j < a + 1; j++) {\r\n Ubar.set(j, U.get(j));\r\n }\r\n for (let j = b + p; j < m + 1; j++) {\r\n Ubar.set(j + r + 1, U.get(j));\r\n }\r\n // For values of u between a and b\r\n let i = b + p - 1;\r\n let k = b + p + r;\r\n for (let j = r; j >= 0; j--) {\r\n while (X[j] <= U.get(i) && i > a) {\r\n for (let z = 0; z < dim; z++) {\r\n Q.set(k - p - 1, z, P.get(i - p - 1, z));\r\n }\r\n if (Wp && Wq) {\r\n Wq.set(k - p - 1, Wp.get(i - p - 1));\r\n }\r\n Ubar.set(k, U.get(i));\r\n k -= 1;\r\n i -= 1;\r\n }\r\n for (let z = 0; z < dim; z++) {\r\n Q.set(k - p - 1, z, Q.get(k - p, z));\r\n }\r\n if (Wp && Wq) {\r\n Wq.set(k - p - 1, Wq.get(k - p));\r\n }\r\n for (let l = 1; l < p + 1; l++) {\r\n let ind = k - p + l;\r\n let alpha = Ubar.get(k + l) - X[j];\r\n if (Math.abs(alpha) === 0.0) {\r\n for (let z = 0; z < dim; z++) {\r\n Q.set(ind - 1, z, Q.get(ind, z));\r\n }\r\n if (Wp && Wq) {\r\n Wq.set(ind - 1, Wq.get(ind));\r\n }\r\n }\r\n else {\r\n alpha = alpha / (Ubar.get(k + l) - U.get(i - p + l));\r\n for (let z = 0; z < dim; z++) {\r\n Q.set(ind - 1, z, alpha * Q.get(ind - 1, z) +\r\n (1.0 - alpha) * Q.get(ind, z));\r\n }\r\n if (Wq) {\r\n Wq.set(ind - 1, alpha * Wq.get(ind - 1) +\r\n (1.0 - alpha) * Wq.get(ind));\r\n }\r\n }\r\n }\r\n Ubar.set(k, X[j]);\r\n k -= 1;\r\n }\r\n this.knots = Ubar;\r\n this.cpoints = Q;\r\n if (this.weights) {\r\n this.weights = Wq;\r\n }\r\n }", "function simplifyRadialDist(points, sqTolerance) {\n var prevPoint = points[0],\n newPoints = [prevPoint],\n point;\n\n for (var i = 1, len = points.length; i < len; i++) {\n point = points[i];\n\n if (getSqDist(point, prevPoint) > sqTolerance) {\n newPoints.push(point);\n prevPoint = point;\n }\n }\n\n if (prevPoint !== point) newPoints.push(point);\n\n return newPoints;\n }", "function isSuspicious(point,pointsDB)\n{\n let rangeOfAverage = 5\n isnormal = false\n for (let i = 0; i < pointsDB.length; i++) {\n currentPoint = pointsDB[i]\n if(Math.abs(currentPoint.x - point.x) <= rangeOfAverage)\n {\n if(Math.abs(currentPoint.y - point.y) <= rangeOfAverage){\n isnormal = true\n break;\n }\n }\n \n }\n return !isnormal\n}", "curvatureInfluence(point, i, allPoints) {\n const curvature = this.averageMCurvature(this.getPointsToMeasure(i, allPoints)) * this.segCurveMultiplier;\n const curveDirection = curvature < 0 ? 1 : -1;\n\n let nextPoint = allPoints[i + 1];\n\n if (!nextPoint && this.wrapEnd) {\n // If wrapped, the next point at the end is the start\n nextPoint = allPoints[0];\n }\n\n const tangent = nextPoint.sub(point);\n const biangle = tangent.angle() + 1.5708 * curveDirection;\n const bitangent = uvFromAngle(biangle).setMag(Math.abs(curvature));\n\n const a = tangent.normalize();\n const b = bitangent.normalize();\n let mVector = a.mix(b, this.mixTangentRatio);\n\n // Noise to add interesting extra flows\n if (this.noiseFn) {\n const t = this.noiseFn(point.x, point.y);\n\n if (this.noiseMode === 'mix' && Math.abs(t) > this.noiseStrengthAffect) {\n // Mix the strength of the noise\n const n = uvFromAngle(t);\n mVector = mVector.mix(n, this.mixNoiseRatio);\n } else if (this.noiseMode === 'flowInTo') {\n // \"Flow\" into lower areas, zero out high areas\n if (t < 0) {\n const n = uvFromAngle(t);\n mVector = mVector.mix(n, this.mixNoiseRatio);\n } else {\n // TODO scale down based on noise, not zero\n mVector = new Vector(0, 0);\n }\n } else if (this.noiseMode === 'scaleMag') {\n const nscale = mapRange(0, this.noiseStrengthAffect, 5, 1, 3, Math.abs(t));\n mVector = mVector.setMag(nscale);\n }\n }\n\n // Increase the strength\n if (this.mixMagnitude) {\n mVector = mVector.setMag(this.mixMagnitude);\n }\n\n // Limit the length\n if (this.influenceLimit > 0) {\n mVector = mVector.limit(this.influenceLimit);\n }\n\n return mVector;\n }", "function delaunay(points) {\n if (points.length === 0 || points.length === 1)\n return [];\n if (points.length === 2)\n return [{ u: points[0], v: points[1] }];\n if (points.length === 3)\n return [{ u: points[0], v: points[1] },\n { u: points[0], v: points[2] },\n { u: points[1], v: points[2] }];\n // recurse on left and right point partitions\n var split = Math.floor(points.length / 2);\n var left = points.slice(0, split);\n var right = points.slice(split);\n var L = delaunay(left);\n var R = delaunay(right);\n // merge left and right solutions\n // the initial base selection is not as fast as it could be\n // (actually, it might be slower than the incremental flipping algorithm!)\n var base = left.map(function (u) { return right.map(function (v) { return { u: u, v: v }; }); })\n .reduce(function (acc, x) { return acc.concat(x); }, [])\n .filter(function (e1) { return L.concat(R).every(function (e2) { return !intersect(e1, e2); }); })\n .sort(function (e1, e2) { return Math.min(e1.u.y, e1.v.y) - Math.min(e2.u.y, e2.v.y); })[0];\n var solution = [base];\n var cL = candidateL(base, left, L);\n var cR = candidateR(base, right, R);\n while (cL || cR) {\n if (!cR || (cL && !incircle(base.u, base.v, cL, cR))) {\n base = { u: cL, v: base.v };\n if (R.some(function (edge) { return intersect(base, edge); }))\n console.log(\"oops! L\");\n }\n else {\n base = { u: base.u, v: cR };\n if (L.some(function (edge) { return intersect(base, edge); }))\n console.log(\"oops! R\");\n }\n solution.push(base);\n cL = candidateL(base, left, L);\n cR = candidateR(base, right, R);\n }\n return solution.concat(L).concat(R);\n}", "function erasePoint(array, xVal, yVal,size){\n for(let i = -1; i <= 1; i++){\n for(let j = -1; j <= 1; j++){\n let index = isItemInArray(array, xVal + (size*i), yVal + (size*j));\n if (index > -1){\n array.splice(index,1);\n }\n }\n }\n }", "function simplifyRadialDist(points, sqTolerance) {\n\n var prevPoint = points[0],\n newPoints = [prevPoint],\n point;\n\n for (var i = 1, len = points.length; i < len; i++) {\n point = points[i];\n\n if (getSqDist(point, prevPoint) > sqTolerance) {\n newPoints.push(point);\n prevPoint = point;\n }\n }\n\n if (prevPoint !== point) newPoints.push(point);\n\n return newPoints;\n}", "function stopGoodTones() {\n gainNodes.forEach(function (g) {\n g.gain.linearRampToValueAtTime(0, audioCtx.currentTime + ramp);\n });\n }", "function simplifyDouglasPeucker(points, sqTolerance) {\n\t\n\t var len = points.length,\n\t MarkerArray = typeof Uint8Array !== 'undefined' ? Uint8Array : Array,\n\t markers = new MarkerArray(len),\n\t first = 0,\n\t last = len - 1,\n\t stack = [],\n\t newPoints = [],\n\t i, maxSqDist, sqDist, index;\n\t\n\t markers[first] = markers[last] = 1;\n\t\n\t while (last) {\n\t\n\t maxSqDist = 0;\n\t\n\t for (i = first + 1; i < last; i++) {\n\t sqDist = getSqSegDist(points[i], points[first], points[last]);\n\t\n\t if (sqDist > maxSqDist) {\n\t index = i;\n\t maxSqDist = sqDist;\n\t }\n\t }\n\t\n\t if (maxSqDist > sqTolerance) {\n\t markers[index] = 1;\n\t stack.push(first, index, index, last);\n\t }\n\t\n\t last = stack.pop();\n\t first = stack.pop();\n\t }\n\t\n\t for (i = 0; i < len; i++) {\n\t if (markers[i]) newPoints.push(points[i]);\n\t }\n\t\n\t return newPoints;\n\t}", "function largeStraightPoints() {\n let freq = frequency();\n for (let i = 2; i < freq.length; i++) {\n if (freq[i] != 1) {\n return 0;\n\n }\n }\n return 20;\n}", "function removeOldPoints(points, maxAge) {\n var endTime = points[points.length-1][0];\n var desiredStartTime = endTime - (maxAge*1000);\n\n for (i=1; i<points.length; i++) { \n if (points[i][0] > desiredStartTime) {\n return points;\n }\n points.shift();\n }\n}" ]
[ "0.6315107", "0.6173462", "0.6111221", "0.6088243", "0.6061998", "0.60539246", "0.6042643", "0.6042643", "0.59813124", "0.59536225", "0.59536225", "0.59536225", "0.59536225", "0.59536225", "0.59536225", "0.59536225", "0.5946711", "0.5946711", "0.591609", "0.5857821", "0.5857821", "0.5857821", "0.5857821", "0.5857821", "0.57929546", "0.57767576", "0.573024", "0.5658033", "0.5650826", "0.5646288", "0.56456536", "0.5610788", "0.5609591", "0.5602415", "0.5554903", "0.5541087", "0.5530534", "0.5521664", "0.5521664", "0.5500103", "0.54865545", "0.5485505", "0.54746574", "0.5470736", "0.54627675", "0.546264", "0.54608274", "0.54608274", "0.54608274", "0.54608274", "0.54608274", "0.54608274", "0.54608274", "0.54548323", "0.54548323", "0.54548323", "0.54548323", "0.54417676", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.54353404", "0.5429324", "0.5429324", "0.5425761", "0.54246664", "0.5424659", "0.5424659", "0.5424659", "0.54209626", "0.54201", "0.5417038", "0.54130167", "0.5409134", "0.54057837", "0.5401879", "0.5401879", "0.5401879", "0.53976184", "0.53976184", "0.53976184", "0.5381425", "0.53758126", "0.536929", "0.5362115", "0.53508335", "0.5339727", "0.53389615", "0.53223985", "0.53203446", "0.5313284", "0.5295083", "0.52930075", "0.5288154", "0.5271119" ]
0.0
-1
This call memoizes intermediate results in the recursive invocation. The scope of the memo cache is the resolve() call, so that multiple resolve() calls don't walk all over each other, and memory used for the memoization can be garbage collected. The memoization addresses issue 232. It looks like the memoization uses only the context and doesn't look at originalName, stop_spine and stop_branch arguments. This is valid because whenever in every recursive call operates on a "deeper" or else a newly created context. Therefore the collection of [originalName, stop_spine, stop_branch] can all be associated with a unique context. This argument is easier to see in a recursive rewrite of the resolveCtx function than with the while loop optimization where the recursive steps always operate on a different context. This might make it seem that the resolution results can be stored on the context object itself, but that would not work in general because multiple resolve() calls will walk over each other's cache results, which fails tests. So the memoization uses only a context's unique instance numbers as the memoization key and is local to each resolve() call. With this memoization, the time complexity of the resolveCtx call is no longer exponential for the cases in issue 232.
function resolveCtx(originalName, ctx, stop_spine, stop_branch, cache) { if (!ctx) { return originalName; } var key = ctx.instNum; return cache[key] || (cache[key] = resolveCtxFull(originalName, ctx, stop_spine, stop_branch, cache)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resolver(name, depth, callback) {\n // Exceeded recursive maximum depth\n if (depth === 0) {\n const errMsg = `could not resolve name (recursion limit of ${defaultMaximumRecursiveDepth} exceeded)`;\n log.error(errMsg);\n return callback(errcode(new Error(errMsg), 'ERR_RESOLVE_RECURSION_LIMIT'));\n }\n\n this._resolveName(name, (err, res) => {\n if (err) {\n return callback(err);\n }\n\n const nameSegments = res.split('/'); // If obtained a ipfs cid or recursive option is disabled\n\n if (nameSegments[1] === 'ipfs' || !depth) {\n return callback(null, res);\n } // continue recursively until depth equals 0\n\n\n this.resolver(nameSegments[2], depth - 1, callback);\n });\n }", "function resolve (options, callback, nested) {\n var keys = Object.keys(options)\n , i = keys.length\n , remaining = []\n , pending\n , item\n , key;\n\n while (i--) {\n key = keys[i];\n item = options[key];\n if (Q.isPromiseAlike(item)) {\n item.key = key;\n remaining.push(item);\n }\n }\n\n pending = remaining.length;\n if (options.locals) ++pending;\n\n if (!pending) {\n return callback(null, options);\n }\n\n function error (err) {\n if (error.ran) return;\n callback(error.ran = err);\n }\n\n remaining.forEach(function (item) {\n Q.when(item)\n .then(function(result){\n options[item.key] = result;\n --pending || callback(null, options); \n })\n .fail(function(err){\n return error(err);\n })\n });\n\n if (nested) return;\n\n // locals support\n if (options.locals) {\n return resolve(options.locals, function (err, resolved) {\n if (err) return error(err);\n options.locals = resolved;\n if (--pending) return;\n return callback(null, options);\n }, true);\n }\n }", "function _resolve(dangerous, resolved) {\n\t // detect infinite recursion\n\t // todo: possibly have a max length on this just to be safe\n\t if (resolved && resolved.indexOf(this) >= 0) return;\n\n\t // we store all the paths we've \"resolved\" in this array to prevent infinite recursion\n\t resolved = resolved || [];\n\t resolved.push(this);\n\n\t if (this.isVariableDeclarator()) {\n\t if (this.get(\"id\").isIdentifier()) {\n\t return this.get(\"init\").resolve(dangerous, resolved);\n\t } else {\n\t // otherwise it's a request for a pattern and that's a bit more tricky\n\t }\n\t } else if (this.isReferencedIdentifier()) {\n\t var binding = this.scope.getBinding(this.node.name);\n\t if (!binding) return;\n\n\t // reassigned so we can't really resolve it\n\t if (!binding.constant) return;\n\n\t // todo - lookup module in dependency graph\n\t if (binding.kind === \"module\") return;\n\n\t if (binding.path !== this) {\n\t return binding.path.resolve(dangerous, resolved);\n\t }\n\t } else if (this.isTypeCastExpression()) {\n\t return this.get(\"expression\").resolve(dangerous, resolved);\n\t } else if (dangerous && this.isMemberExpression()) {\n\t // this is dangerous, as non-direct target assignments will mutate it's state\n\t // making this resolution inaccurate\n\n\t var targetKey = this.toComputedKey();\n\t if (!t.isLiteral(targetKey)) return;\n\n\t var targetName = targetKey.value;\n\n\t var target = this.get(\"object\").resolve(dangerous, resolved);\n\n\t if (target.isObjectExpression()) {\n\t var props = target.get(\"properties\");\n\t var _arr = props;\n\t for (var _i = 0; _i < _arr.length; _i++) {\n\t var prop = _arr[_i];\n\t if (!prop.isProperty()) continue;\n\n\t var key = prop.get(\"key\");\n\n\t // { foo: obj }\n\t var match = prop.isnt(\"computed\") && key.isIdentifier({ name: targetName });\n\n\t // { \"foo\": \"obj\" } or { [\"foo\"]: \"obj\" }\n\t match = match || key.isLiteral({ value: targetName });\n\n\t if (match) return prop.get(\"value\").resolve(dangerous, resolved);\n\t }\n\t } else if (target.isArrayExpression() && !isNaN(+targetName)) {\n\t var elems = target.get(\"elements\");\n\t var elem = elems[targetName];\n\t if (elem) return elem.resolve(dangerous, resolved);\n\t }\n\t }\n\t}", "function _resolve(dangerous, resolved) {\n\t // detect infinite recursion\n\t // todo: possibly have a max length on this just to be safe\n\t if (resolved && resolved.indexOf(this) >= 0) return;\n\n\t // we store all the paths we've \"resolved\" in this array to prevent infinite recursion\n\t resolved = resolved || [];\n\t resolved.push(this);\n\n\t if (this.isVariableDeclarator()) {\n\t if (this.get(\"id\").isIdentifier()) {\n\t return this.get(\"init\").resolve(dangerous, resolved);\n\t } else {\n\t // otherwise it's a request for a pattern and that's a bit more tricky\n\t }\n\t } else if (this.isReferencedIdentifier()) {\n\t var binding = this.scope.getBinding(this.node.name);\n\t if (!binding) return;\n\n\t // reassigned so we can't really resolve it\n\t if (!binding.constant) return;\n\n\t // todo - lookup module in dependency graph\n\t if (binding.kind === \"module\") return;\n\n\t if (binding.path !== this) {\n\t return binding.path.resolve(dangerous, resolved);\n\t }\n\t } else if (this.isTypeCastExpression()) {\n\t return this.get(\"expression\").resolve(dangerous, resolved);\n\t } else if (dangerous && this.isMemberExpression()) {\n\t // this is dangerous, as non-direct target assignments will mutate it's state\n\t // making this resolution inaccurate\n\n\t var targetKey = this.toComputedKey();\n\t if (!t.isLiteral(targetKey)) return;\n\n\t var targetName = targetKey.value;\n\n\t var target = this.get(\"object\").resolve(dangerous, resolved);\n\n\t if (target.isObjectExpression()) {\n\t var props = target.get(\"properties\");\n\t var _arr = props;\n\t for (var _i = 0; _i < _arr.length; _i++) {\n\t var prop = _arr[_i];\n\t if (!prop.isProperty()) continue;\n\n\t var key = prop.get(\"key\");\n\n\t // { foo: obj }\n\t var match = prop.isnt(\"computed\") && key.isIdentifier({ name: targetName });\n\n\t // { \"foo\": \"obj\" } or { [\"foo\"]: \"obj\" }\n\t match = match || key.isLiteral({ value: targetName });\n\n\t if (match) return prop.get(\"value\").resolve(dangerous, resolved);\n\t }\n\t } else if (target.isArrayExpression() && !isNaN(+targetName)) {\n\t var elems = target.get(\"elements\");\n\t var elem = elems[targetName];\n\t if (elem) return elem.resolve(dangerous, resolved);\n\t }\n\t }\n\t}", "function _resolve(dangerous, resolved) {\n // detect infinite recursion\n // todo: possibly have a max length on this just to be safe\n if (resolved && resolved.indexOf(this) >= 0) return;\n\n // we store all the paths we've \"resolved\" in this array to prevent infinite recursion\n resolved = resolved || [];\n resolved.push(this);\n\n if (this.isVariableDeclarator()) {\n if (this.get(\"id\").isIdentifier()) {\n return this.get(\"init\").resolve(dangerous, resolved);\n } else {\n // otherwise it's a request for a pattern and that's a bit more tricky\n }\n } else if (this.isReferencedIdentifier()) {\n var binding = this.scope.getBinding(this.node.name);\n if (!binding) return;\n\n // reassigned so we can't really resolve it\n if (!binding.constant) return;\n\n // todo - lookup module in dependency graph\n if (binding.kind === \"module\") return;\n\n if (binding.path !== this) {\n return binding.path.resolve(dangerous, resolved);\n }\n } else if (this.isTypeCastExpression()) {\n return this.get(\"expression\").resolve(dangerous, resolved);\n } else if (dangerous && this.isMemberExpression()) {\n // this is dangerous, as non-direct target assignments will mutate it's state\n // making this resolution inaccurate\n\n var targetKey = this.toComputedKey();\n if (!t.isLiteral(targetKey)) return;\n\n var targetName = targetKey.value;\n\n var target = this.get(\"object\").resolve(dangerous, resolved);\n\n if (target.isObjectExpression()) {\n var props = target.get(\"properties\");\n var _arr = props;\n for (var _i = 0; _i < _arr.length; _i++) {\n var prop = _arr[_i];\n if (!prop.isProperty()) continue;\n\n var key = prop.get(\"key\");\n\n // { foo: obj }\n var match = prop.isnt(\"computed\") && key.isIdentifier({ name: targetName });\n\n // { \"foo\": \"obj\" } or { [\"foo\"]: \"obj\" }\n match = match || key.isLiteral({ value: targetName });\n\n if (match) return prop.get(\"value\").resolve(dangerous, resolved);\n }\n } else if (target.isArrayExpression() && !isNaN(+targetName)) {\n var elems = target.get(\"elements\");\n var elem = elems[targetName];\n if (elem) return elem.resolve(dangerous, resolved);\n }\n }\n}", "function resolve() {\n var deferred = this,\n clone = deferred.benchmark,\n bench = clone._original;\n\n if (bench.aborted) {\n // cycle() -> clone cycle/complete event -> compute()'s invoked bench.run() cycle/complete.\n deferred.teardown();\n clone.running = false;\n cycle(deferred);\n }\n else if (++deferred.cycles < clone.count) {\n clone.compiled.call(deferred, context, timer);\n }\n else {\n timer.stop(deferred);\n deferred.teardown();\n delay(clone, function() { cycle(deferred); });\n }\n }", "function resolve() {\n\t var deferred = this,\n\t clone = deferred.benchmark,\n\t bench = clone._original;\n\n\t if (bench.aborted) {\n\t // cycle() -> clone cycle/complete event -> compute()'s invoked bench.run() cycle/complete.\n\t deferred.teardown();\n\t clone.running = false;\n\t cycle(deferred);\n\t }\n\t else if (++deferred.cycles < clone.count) {\n\t clone.compiled.call(deferred, context, timer);\n\t }\n\t else {\n\t timer.stop(deferred);\n\t deferred.teardown();\n\t delay(clone, function() { cycle(deferred); });\n\t }\n\t }", "function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) {\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\n if (ignoreNullOrUndefinedResult === void 0) { ignoreNullOrUndefinedResult = false; }\n // Avoid breaking scenarios which don't have weak map.\n if (!_weakMap) {\n return cb;\n }\n if (!_initializedStylesheetResets) {\n var stylesheet = _fluentui_merge_styles__WEBPACK_IMPORTED_MODULE_0__.Stylesheet.getInstance();\n if (stylesheet && stylesheet.onReset) {\n _fluentui_merge_styles__WEBPACK_IMPORTED_MODULE_0__.Stylesheet.getInstance().onReset(resetMemoizations);\n }\n _initializedStylesheetResets = true;\n }\n var rootNode;\n var cacheSize = 0;\n var localResetCounter = _resetCounter;\n return function memoizedFunction() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var currentNode = rootNode;\n if (rootNode === undefined ||\n localResetCounter !== _resetCounter ||\n (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\n rootNode = _createNode();\n cacheSize = 0;\n localResetCounter = _resetCounter;\n }\n currentNode = rootNode;\n // Traverse the tree until we find the match.\n for (var i = 0; i < args.length; i++) {\n var arg = _normalizeArg(args[i]);\n if (!currentNode.map.has(arg)) {\n currentNode.map.set(arg, _createNode());\n }\n currentNode = currentNode.map.get(arg);\n }\n if (!currentNode.hasOwnProperty('value')) {\n currentNode.value = cb.apply(void 0, args);\n cacheSize++;\n }\n if (ignoreNullOrUndefinedResult && (currentNode.value === null || currentNode.value === undefined)) {\n currentNode.value = cb.apply(void 0, args);\n }\n return currentNode.value;\n };\n}", "function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) {\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\n if (ignoreNullOrUndefinedResult === void 0) { ignoreNullOrUndefinedResult = false; }\n // Avoid breaking scenarios which don't have weak map.\n if (!_weakMap) {\n return cb;\n }\n if (!_initializedStylesheetResets) {\n var stylesheet = _fluentui_merge_styles__WEBPACK_IMPORTED_MODULE_0__.Stylesheet.getInstance();\n if (stylesheet && stylesheet.onReset) {\n _fluentui_merge_styles__WEBPACK_IMPORTED_MODULE_0__.Stylesheet.getInstance().onReset(resetMemoizations);\n }\n _initializedStylesheetResets = true;\n }\n var rootNode;\n var cacheSize = 0;\n var localResetCounter = _resetCounter;\n return function memoizedFunction() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var currentNode = rootNode;\n if (rootNode === undefined ||\n localResetCounter !== _resetCounter ||\n (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\n rootNode = _createNode();\n cacheSize = 0;\n localResetCounter = _resetCounter;\n }\n currentNode = rootNode;\n // Traverse the tree until we find the match.\n for (var i = 0; i < args.length; i++) {\n var arg = _normalizeArg(args[i]);\n if (!currentNode.map.has(arg)) {\n currentNode.map.set(arg, _createNode());\n }\n currentNode = currentNode.map.get(arg);\n }\n if (!currentNode.hasOwnProperty('value')) {\n currentNode.value = cb.apply(void 0, args);\n cacheSize++;\n }\n if (ignoreNullOrUndefinedResult && (currentNode.value === null || currentNode.value === undefined)) {\n currentNode.value = cb.apply(void 0, args);\n }\n return currentNode.value;\n };\n}", "function walk(key, value, depth, memo) {\r\n if (depth === void 0) {\r\n depth = +Infinity;\r\n }\r\n if (memo === void 0) {\r\n memo = new _memo__WEBPACK_IMPORTED_MODULE_1__[\"Memo\"]();\r\n }\r\n // If we reach the maximum depth, serialize whatever has left\r\n if (depth === 0) {\r\n return serializeValue(value);\r\n }\r\n // If value implements `toJSON` method, call it and return early\r\n // tslint:disable:no-unsafe-any\r\n if (value !== null && value !== undefined && typeof value.toJSON === 'function') {\r\n return value.toJSON();\r\n }\r\n // tslint:enable:no-unsafe-any\r\n // If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further\r\n var normalized = normalizeValue(value, key);\r\n if (Object(_is__WEBPACK_IMPORTED_MODULE_0__[\"isPrimitive\"])(normalized)) {\r\n return normalized;\r\n }\r\n // Create source that we will use for next itterations, either objectified error object (Error type with extracted keys:value pairs) or the input itself\r\n var source = Object(_is__WEBPACK_IMPORTED_MODULE_0__[\"isError\"])(value) ? objectifyError(value) : value;\r\n // Create an accumulator that will act as a parent for all future itterations of that branch\r\n var acc = Array.isArray(value) ? [] : {};\r\n // If we already walked that branch, bail out, as it's circular reference\r\n if (memo.memoize(value)) {\r\n return '[Circular ~]';\r\n }\r\n // Walk all keys of the source\r\n for (var innerKey in source) {\r\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\r\n if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {\r\n continue;\r\n }\r\n // Recursively walk through all the child nodes\r\n acc[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);\r\n }\r\n // Once walked through all the branches, remove the parent from memo storage\r\n memo.unmemoize(value);\r\n // Return accumulated values\r\n return acc;\r\n}", "function walk(key, value, depth, memo) {\n if (depth === void 0) { depth = +Infinity; }\n if (memo === void 0) { memo = new _memo__WEBPACK_IMPORTED_MODULE_2__[\"Memo\"](); }\n // If we reach the maximum depth, serialize whatever has left\n if (depth === 0) {\n return serializeValue(value);\n }\n // If value implements `toJSON` method, call it and return early\n // tslint:disable:no-unsafe-any\n if (value !== null && value !== undefined && typeof value.toJSON === 'function') {\n return value.toJSON();\n }\n // tslint:enable:no-unsafe-any\n // If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further\n var normalized = normalizeValue(value, key);\n if (Object(_is__WEBPACK_IMPORTED_MODULE_1__[\"isPrimitive\"])(normalized)) {\n return normalized;\n }\n // Create source that we will use for next itterations, either objectified error object (Error type with extracted keys:value pairs) or the input itself\n var source = getWalkSource(value);\n // Create an accumulator that will act as a parent for all future itterations of that branch\n var acc = Array.isArray(value) ? [] : {};\n // If we already walked that branch, bail out, as it's circular reference\n if (memo.memoize(value)) {\n return '[Circular ~]';\n }\n // Walk all keys of the source\n for (var innerKey in source) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {\n continue;\n }\n // Recursively walk through all the child nodes\n acc[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);\n }\n // Once walked through all the branches, remove the parent from memo storage\n memo.unmemoize(value);\n // Return accumulated values\n return acc;\n}", "function walk(key, value, depth, memo) {\n if (depth === void 0) { depth = +Infinity; }\n if (memo === void 0) { memo = new _memo__WEBPACK_IMPORTED_MODULE_3__[/* Memo */ \"a\"](); }\n // If we reach the maximum depth, serialize whatever has left\n if (depth === 0) {\n return serializeValue(value);\n }\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // If value implements `toJSON` method, call it and return early\n if (value !== null && value !== undefined && typeof value.toJSON === 'function') {\n return value.toJSON();\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n // If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further\n var normalized = normalizeValue(value, key);\n if (Object(_is__WEBPACK_IMPORTED_MODULE_2__[/* isPrimitive */ \"i\"])(normalized)) {\n return normalized;\n }\n // Create source that we will use for next itterations, either objectified error object (Error type with extracted keys:value pairs) or the input itself\n var source = getWalkSource(value);\n // Create an accumulator that will act as a parent for all future itterations of that branch\n var acc = Array.isArray(value) ? [] : {};\n // If we already walked that branch, bail out, as it's circular reference\n if (memo.memoize(value)) {\n return '[Circular ~]';\n }\n // Walk all keys of the source\n for (var innerKey in source) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {\n continue;\n }\n // Recursively walk through all the child nodes\n acc[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);\n }\n // Once walked through all the branches, remove the parent from memo storage\n memo.unmemoize(value);\n // Return accumulated values\n return acc;\n}", "function memoize(fn){\n const cache={}\n return function(...args){\n if(cache[args]) return cache[args]\n \n const result = fn.apply(this,args)\n cache[args]=result\n \n return result\n }\n }", "function memoization() {\n const cache = {};\n return function (n) {\n if (n in cache) {\n return cache[n];\n } else {\n console.log(\"not cached\");\n cache[n] = n * n;\n return cache[n];\n }\n };\n}", "function memoize(fn) {\nconst cache = {};\n return function(...args) {\n if (cache[args]) {\n return cache[args];\n }\n const result = fn.apply(this, args);\n cache[args] = result;\n\n return result;\n };\n}", "function memoizeFunction(cb, maxCacheSize) {\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\n // Avoid breaking scenarios which don't have weak map.\n if (!_weakMap) {\n return cb;\n }\n var rootNode;\n var cacheSize = 0;\n var localResetCounter = _resetCounter;\n // tslint:disable-next-line:no-function-expression\n return function memoizedFunction() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var currentNode = rootNode;\n if (rootNode === undefined ||\n localResetCounter !== _resetCounter ||\n (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\n rootNode = _createNode();\n cacheSize = 0;\n localResetCounter = _resetCounter;\n }\n currentNode = rootNode;\n // Traverse the tree until we find the match.\n for (var i = 0; i < args.length; i++) {\n var arg = _normalizeArg(args[i]);\n if (!currentNode.map.has(arg)) {\n currentNode.map.set(arg, _createNode());\n }\n currentNode = currentNode.map.get(arg);\n }\n if (!currentNode.hasOwnProperty('value')) {\n currentNode.value = cb.apply(void 0, args);\n cacheSize++;\n }\n return currentNode.value;\n };\n}", "function memoizeFunction(cb, maxCacheSize) {\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\n // Avoid breaking scenarios which don't have weak map.\n if (!_weakMap) {\n return cb;\n }\n var rootNode;\n var cacheSize = 0;\n var localResetCounter = _resetCounter;\n // tslint:disable-next-line:no-function-expression\n return function memoizedFunction() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var currentNode = rootNode;\n if (rootNode === undefined || localResetCounter !== _resetCounter || (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\n rootNode = _createNode();\n cacheSize = 0;\n localResetCounter = _resetCounter;\n }\n currentNode = rootNode;\n // Traverse the tree until we find the match.\n for (var i = 0; i < args.length; i++) {\n var arg = _normalizeArg(args[i]);\n if (!currentNode.map.has(arg)) {\n currentNode.map.set(arg, _createNode());\n }\n currentNode = currentNode.map.get(arg);\n }\n if (!currentNode.hasOwnProperty('value')) {\n currentNode.value = cb.apply(void 0, args);\n cacheSize++;\n }\n return currentNode.value;\n };\n}", "function memoize(fn) {\n\n\t// storage object that holds all previous\n\t// calls to fn() and their respective results\n\tconst cache = {};\n\n\t// return super-charged function\n\t// ...args => don't know how many arguments will be\n\t// sent to this function, but take them and put in an array []\n\treturn function(...args) {\n\t\tif (cache[args]) {\n\t\t\treturn cache[args];\n\t\t}\n\n\t\t// never called that function with those arguments before\n\t\tconst result = fn.apply(this, args);\n\t\tcache[args] = result;\n\t\t\n\t\t// console.log('cache =', cache);\n\t\treturn result;\n\t}\n}", "function walk(key, value, depth, memo) {\n if (depth === void 0) { depth = +Infinity; }\n if (memo === void 0) { memo = new memo_1.Memo(); }\n // If we reach the maximum depth, serialize whatever has left\n if (depth === 0) {\n return serializeValue(value);\n }\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // If value implements `toJSON` method, call it and return early\n if (value !== null && value !== undefined && typeof value.toJSON === 'function') {\n return value.toJSON();\n }\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n // If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further\n var normalized = normalizeValue(value, key);\n if (is_1.isPrimitive(normalized)) {\n return normalized;\n }\n // Create source that we will use for next itterations, either objectified error object (Error type with extracted keys:value pairs) or the input itself\n var source = getWalkSource(value);\n // Create an accumulator that will act as a parent for all future itterations of that branch\n var acc = Array.isArray(value) ? [] : {};\n // If we already walked that branch, bail out, as it's circular reference\n if (memo.memoize(value)) {\n return '[Circular ~]';\n }\n // Walk all keys of the source\n for (var innerKey in source) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {\n continue;\n }\n // Recursively walk through all the child nodes\n acc[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);\n }\n // Once walked through all the branches, remove the parent from memo storage\n memo.unmemoize(value);\n // Return accumulated values\n return acc;\n}", "function memoizeFunction(cb, maxCacheSize) {\r\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\r\n // Avoid breaking scenarios which don't have weak map.\r\n if (!_weakMap) {\r\n return cb;\r\n }\r\n var rootNode;\r\n var cacheSize = 0;\r\n var localResetCounter = _resetCounter;\r\n // tslint:disable-next-line:no-function-expression\r\n return function memoizedFunction() {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var currentNode = rootNode;\r\n if (rootNode === undefined || localResetCounter !== _resetCounter || (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\r\n rootNode = _createNode();\r\n cacheSize = 0;\r\n localResetCounter = _resetCounter;\r\n }\r\n currentNode = rootNode;\r\n // Traverse the tree until we find the match.\r\n for (var i = 0; i < args.length; i++) {\r\n var arg = _normalizeArg(args[i]);\r\n if (!currentNode.map.has(arg)) {\r\n currentNode.map.set(arg, _createNode());\r\n }\r\n currentNode = currentNode.map.get(arg);\r\n }\r\n if (!currentNode.hasOwnProperty('value')) {\r\n currentNode.value = cb.apply(void 0, args);\r\n cacheSize++;\r\n }\r\n return currentNode.value;\r\n };\r\n}", "function memoizeFunction(cb, maxCacheSize) {\r\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\r\n // Avoid breaking scenarios which don't have weak map.\r\n if (!_weakMap) {\r\n return cb;\r\n }\r\n var rootNode;\r\n var cacheSize = 0;\r\n var localResetCounter = _resetCounter;\r\n // tslint:disable-next-line:no-function-expression\r\n return function memoizedFunction() {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var currentNode = rootNode;\r\n if (rootNode === undefined || localResetCounter !== _resetCounter || (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\r\n rootNode = _createNode();\r\n cacheSize = 0;\r\n localResetCounter = _resetCounter;\r\n }\r\n currentNode = rootNode;\r\n // Traverse the tree until we find the match.\r\n for (var i = 0; i < args.length; i++) {\r\n var arg = _normalizeArg(args[i]);\r\n if (!currentNode.map.has(arg)) {\r\n currentNode.map.set(arg, _createNode());\r\n }\r\n currentNode = currentNode.map.get(arg);\r\n }\r\n if (!currentNode.hasOwnProperty('value')) {\r\n currentNode.value = cb.apply(void 0, args);\r\n cacheSize++;\r\n }\r\n return currentNode.value;\r\n };\r\n}", "_memoize (...args) {\n var param = stringify(args);\n\n return (param in this._cache) ?\n this._cache[param] :\n this._cache[param] = this.f.apply(null, args);\n }", "function advanceMemoizedAddTo80(){\n let functionChache = {}; // We put cache inside the function to avoide polutting global scope and keep it priivate\n\n // We return a function and use cache from HOF to trigger closure\n return function(n){\n if (n in functionChache){\n return functionChache[n]; \n } else {\n console.log('long time advanced memo')\n functionChache[n] = n + 80;\n return functionChache[n]\n }\n }\n}", "memo (name /*, ...processors */) {\n let index = this.lookup(name)\n let processors = toArray(arguments, 1)\n let last = null\n let answer = null\n\n return () => {\n let next = index()\n\n if (next !== last) {\n last = next\n answer = pipeline(index(), processors, this.state)\n }\n\n return answer\n }\n }", "function resolveString(input, string, path, opts, incomingBreadCrumbPath) {\n if (incomingBreadCrumbPath === void 0) {\n incomingBreadCrumbPath = [];\n } // precautions from recursion\n\n if (incomingBreadCrumbPath.includes(path)) {\n var extra = \"\";\n\n if (incomingBreadCrumbPath.length > 1) {\n // extra = ` Here's the path we travelled up until we hit the recursion: ${incomingBreadCrumbPath.join(' - ')}.`\n var separator = \" →\\n\";\n extra = incomingBreadCrumbPath.reduce(function (accum, curr, idx) {\n return accum + (idx === 0 ? \"\" : separator) + (curr === path ? \"💥 \" : \" \") + curr;\n }, \" Here's the path we travelled up until we hit the recursion:\\n\\n\");\n extra += separator + \"\\uD83D\\uDCA5 \" + path;\n }\n\n throw new Error(\"json-variables/resolveString(): [THROW_ID_19] While trying to resolve: \\\"\" + string + \"\\\" at path \\\"\" + path + \"\\\", we encountered a closed loop, the key is referencing itself.\\\"\" + extra);\n } // The Secret Data Stash, a way to cache previously resolved values and reuse the\n // values, saving resources. It can't be on the root because it would get retained\n // between different calls on the library, potentially giving wrong results (from\n // the previous resolved variable, from the previous function call).\n\n\n var secretResolvedVarsStash = {}; // 0. Add current path into breadCrumbPath\n // =======================================\n\n var breadCrumbPath = Array.from(incomingBreadCrumbPath);\n breadCrumbPath.push(path); // 1. First, extract all vars\n // ==========================\n\n var finalRangesArr = new rangesPush.Ranges();\n\n function processHeadsAndTails(arr, dontWrapTheseVars, wholeValueIsVariable) {\n for (var i = 0, len = arr.length; i < len; i++) {\n var obj = arr[i];\n var varName = string.slice(obj.headsEndAt, obj.tailsStartAt);\n\n if (varName.length === 0) {\n finalRangesArr.push(obj.headsStartAt, // replace from index\n obj.tailsEndAt // replace upto index - no third argument, just deletion of heads/tails\n );\n } else if (has.call(secretResolvedVarsStash, varName) && isStr(secretResolvedVarsStash[varName])) {\n // check, maybe the value was already resolved before and present in secret stash:\n finalRangesArr.push(obj.headsStartAt, // replace from index\n obj.tailsEndAt, // replace upto index\n secretResolvedVarsStash[varName] // replacement value\n );\n } else {\n // it's not in the stash unfortunately, so let's search for it then:\n var resolvedValue = findValues(input, // input\n varName.trim(), // varName\n path, // path\n opts // opts\n );\n\n if (resolvedValue === undefined) {\n if (opts.allowUnresolved === true) {\n resolvedValue = \"\";\n } else if (typeof opts.allowUnresolved === \"string\") {\n resolvedValue = opts.allowUnresolved;\n } else {\n throw new Error(\"json-variables/processHeadsAndTails(): [THROW_ID_18] We couldn't find the value to resolve the variable \" + string.slice(obj.headsEndAt, obj.tailsStartAt) + \". We're at path: \\\"\" + path + \"\\\".\");\n }\n }\n\n if (!wholeValueIsVariable && opts.throwWhenNonStringInsertedInString && !isStr(resolvedValue)) {\n throw new Error(\"json-variables/processHeadsAndTails(): [THROW_ID_23] While resolving the variable \" + string.slice(obj.headsEndAt, obj.tailsStartAt) + \" at path \" + path + \", it resolved into a non-string value, \" + JSON.stringify(resolvedValue, null, 4) + \". This is happening because options setting \\\"throwWhenNonStringInsertedInString\\\" is active (set to \\\"true\\\").\");\n }\n\n if (isBool(resolvedValue)) {\n if (opts.resolveToBoolIfAnyValuesContainBool) {\n finalRangesArr.wipe();\n\n if (!opts.resolveToFalseIfAnyValuesContainBool) {\n return resolvedValue;\n }\n\n return false;\n }\n\n resolvedValue = \"\";\n } else if (isNull(resolvedValue) && wholeValueIsVariable) {\n finalRangesArr.wipe();\n return resolvedValue;\n } else if (Array.isArray(resolvedValue)) {\n resolvedValue = String(resolvedValue.join(\"\"));\n } else if (isNull(resolvedValue)) {\n resolvedValue = \"\";\n } else {\n resolvedValue = String(resolvedValue);\n }\n var newPath = path.includes(\".\") ? goLevelUp(path) + \".\" + varName : varName;\n\n if (containsHeadsOrTails(resolvedValue, opts)) {\n var replacementVal = wrap(resolveString( // replacement value <--------- R E C U R S I O N\n input, resolvedValue, newPath, opts, breadCrumbPath), opts, dontWrapTheseVars, breadCrumbPath, newPath, varName.trim());\n\n if (isStr(replacementVal)) {\n finalRangesArr.push(obj.headsStartAt, // replace from index\n obj.tailsEndAt, // replace upto index\n replacementVal);\n }\n } else {\n // 1. store it in the stash for the future\n secretResolvedVarsStash[varName] = resolvedValue;\n\n var _replacementVal = wrap(resolvedValue, opts, dontWrapTheseVars, breadCrumbPath, newPath, varName.trim()); // replacement value\n\n\n if (isStr(_replacementVal)) {\n // 2. submit to be replaced\n finalRangesArr.push(obj.headsStartAt, // replace from index\n obj.tailsEndAt, // replace upto index\n _replacementVal);\n }\n }\n }\n }\n\n return undefined;\n }\n\n var foundHeadsAndTails; // reusing same var as container for both wrapping- and non-wrapping types\n // 1. normal (possibly wrapping-type) heads and tails\n\n try {\n // strFindHeadsTails() can throw as well if there's mismatch in heads and tails,\n // for example, so it needs to be contained:\n foundHeadsAndTails = stringFindHeadsTails.strFindHeadsTails(string, opts.heads, opts.tails, {\n source: \"\",\n throwWhenSomethingWrongIsDetected: false\n });\n } catch (error) {\n throw new Error(\"json-variables/resolveString(): [THROW_ID_17] While trying to resolve string: \\\"\" + string + \"\\\" at path \" + path + \", something wrong with heads and tails was detected! Here's the internal error message:\\n\" + error);\n } // if heads and tails array has only one range inside and it spans whole string's\n // length, this means key is equal to a whole variable, like {a: '%%_b_%%'}.\n // In those cases, there are extra considerations when value is null, because\n // null among string characters is resolved to empty string, but null as a whole\n // value is retained as null. This means, we need to pass this as a flag to\n // processHeadsAndTails() so it can resolve properly...\n\n var wholeValueIsVariable = false; // we'll reuse it for non-wrap heads/tails too\n\n if (foundHeadsAndTails.length === 1 && rangesApply.rApply(string, [[foundHeadsAndTails[0].headsStartAt, foundHeadsAndTails[0].tailsEndAt]]).trim() === \"\") {\n wholeValueIsVariable = true;\n }\n\n var temp1 = processHeadsAndTails(foundHeadsAndTails, false, wholeValueIsVariable);\n\n if (isBool(temp1)) {\n return temp1;\n }\n\n if (isNull(temp1)) {\n return temp1;\n } // 2. Process opts.headsNoWrap, opts.tailsNoWrap as well\n\n\n try {\n // strFindHeadsTails() can throw as well if there's mismatch in heads and tails,\n // for example, so it needs to be contained:\n foundHeadsAndTails = stringFindHeadsTails.strFindHeadsTails(string, opts.headsNoWrap, opts.tailsNoWrap, {\n source: \"\",\n throwWhenSomethingWrongIsDetected: false\n });\n } catch (error) {\n throw new Error(\"json-variables/resolveString(): [THROW_ID_22] While trying to resolve string: \\\"\" + string + \"\\\" at path \" + path + \", something wrong with no-wrap heads and no-wrap tails was detected! Here's the internal error message:\\n\" + error);\n }\n\n if (foundHeadsAndTails.length === 1 && rangesApply.rApply(string, [[foundHeadsAndTails[0].headsStartAt, foundHeadsAndTails[0].tailsEndAt]]).trim() === \"\") {\n wholeValueIsVariable = true;\n }\n\n var temp2 = processHeadsAndTails(foundHeadsAndTails, true, wholeValueIsVariable);\n\n if (isBool(temp2)) {\n return temp2;\n }\n\n if (isNull(temp2)) {\n return temp2;\n } // 3. Then, work the finalRangesArr list\n // ================================\n\n if (finalRangesArr && finalRangesArr.current()) {\n return rangesApply.rApply(string, finalRangesArr.current());\n }\n\n return string;\n}", "function makeResolve (root) {\n return function resolve (name, version, basedir) {\n return when.promise(function (resolve, reject) {\n console.log('RESOLVING', name, basedir)\n resolveModule(name + '/package.json', {basedir: basedir || root}, function (err, location) {\n console.log('lOC', location)\n if (err) return reject(err)\n resolve(path.dirname(location))\n })\n })\n }\n}", "function memoize( fn ) {\n return function () {\n var args = Array.prototype.slice.call(arguments),\n hash = \"\",\n i = args.length;\n currentArg = null;\n while (i--) {\n currentArg = args[i];\n hash += (currentArg === Object(currentArg)) ?\n JSON.stringify(currentArg) : currentArg;\n fn.memoize || (fn.memoize = {});\n }\n return (hash in fn.memoize) ? fn.memoize[hash] :\n fn.memoize[hash] = fn.apply(this, args);\n };\n}", "function memoize(name, fn) {\n\tlet cache;\n\treturn function() {\n\t\tif (cache === undefined) {\n\t\t\tcache = fn();\n\t\t}\n\t\treturn cache;\n\t};\n}", "function memoizeFunction(cb, maxCacheSize) {\n if (maxCacheSize === void 0) { maxCacheSize = 100; }\n var rootNode;\n var cacheSize = 0;\n // tslint:disable-next-line:no-function-expression\n return function memoizedFunction() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var currentNode = rootNode;\n if (rootNode === undefined || (maxCacheSize > 0 && cacheSize > maxCacheSize)) {\n rootNode = _createNode();\n cacheSize = 0;\n }\n currentNode = rootNode;\n // Traverse the tree until we find the match.\n for (var i = 0; i < args.length; i++) {\n var arg = _normalizeArg(args[i]);\n if (!currentNode.map.has(arg)) {\n currentNode.map.set(arg, _createNode());\n }\n currentNode = currentNode.map.get(arg);\n }\n if (!currentNode.hasOwnProperty('value')) {\n currentNode.value = cb.apply(void 0, args);\n cacheSize++;\n }\n return currentNode.value;\n };\n}", "recursiveDistance(node1, node2) {\n if (node1.isLeaf() && node2.isLeaf()) {\n throw \"Distance cache should have prepopulated all pairwise node \"\n + \"distances, but we tried to call recursiveDistance on leaves \"\n + node1 + \" and \" + node2;\n }\n\n let c1 = node1.leftChild;\n let c2 = node1.rightChild;\n let c3 = node2;\n\n // if node1 is a leaf or the cache is missing its child values\n // then splitting the other node will work.\n if (c1 == null\n || c2 == null\n || !this.distanceCache.contains(c1.values, c3.values)) {\n c1 = node2.leftChild;\n c2 = node2.rightChild;\n c3 = node1;\n }\n\n let n1 = c1.values.size;\n let n2 = c2.values.size;\n let n3 = c3.values.size;\n let n = n1 + n2 + n3;\n let d12 = this.distance(c1, c2);\n let d13 = this.distance(c1, c3);\n let d23 = this.distance(c2, c3);\n\n let coeff13 = (1.0 * n1 + n3) / n;\n let coeff23 = (1.0 * n2 + n3) / n;\n let coeff12 = -1.0 * n3 / n;\n let value = coeff13 * d13 + coeff23 * d23 - coeff12 * d12;\n return value;\n }", "function memoize(fn){\n const cache = {};\n return function(...args){\n if(cache[args]){\n return cache[args];\n }\n const result = fn.apply(this,args);\n cache[args] = result;\n return result;\n };\n}", "solve_intern(steps: number, gk: number) {\r\n let this2 = this;\r\n\r\n let dag_trigger = function () {\r\n this2.dag_update(\"on_solve\", true);\r\n\r\n //XXX hack, need to fix windowmanager.js to call this more often\r\n the_global_dag.exec(g_app_state.screen.ctx);\r\n }\r\n\r\n //propagate update flags to draw flags\r\n for (let v of this.verts) {\r\n if (v.flag & SplineFlags.UPDATE) {\r\n for (let i = 0; i < v.segments.length; i++) {\r\n let seg = v.segments[i];\r\n\r\n seg.flag |= SplineFlags.REDRAW_PRE;\r\n\r\n let l = seg.l;\r\n if (!l)\r\n continue;\r\n\r\n let _i = 0;\r\n do {\r\n if (_i++ > 5000) {\r\n console.warn(\"infinite loop!\");\r\n break;\r\n }\r\n\r\n l.f.flag |= SplineFlags.REDRAW_PRE;\r\n l = l.radial_next;\r\n } while (l !== seg.l);\r\n }\r\n }\r\n }\r\n\r\n this.propagate_draw_flags();\r\n\r\n if (window.DISABLE_SOLVE || config.DISABLE_SOLVE) {\r\n return new Promise((accept, reject) => {\r\n accept();\r\n });\r\n }\r\n\r\n if (!DEBUG.no_native && config.USE_WASM && native_api.isReady()) {\r\n let ret = native_api.do_solve(SplineFlags, this, steps, gk, true);\r\n\r\n ret.then(function () {\r\n this2._pending_solve = undefined;\r\n this2.solving = false;\r\n this2._do_post_solve();\r\n\r\n dag_trigger();\r\n\r\n if (this2._resolve_after) {\r\n let cb = this2._resolve_after;\r\n this2._resolve_after = undefined;\r\n\r\n this2._pending_solve = this2.solve_intern().then(function () {\r\n cb.call(this2);\r\n });\r\n this2.solving = true;\r\n }\r\n });\r\n\r\n return ret;\r\n } else if (!DEBUG.no_native && config.USE_NACL && window.common !== undefined && window.common.naclModule !== undefined) {\r\n let ret = do_solve(SplineFlags, this, steps, gk, true);\r\n\r\n ret.then(function () {\r\n this2._pending_solve = undefined;\r\n this2.solving = false;\r\n this2._do_post_solve();\r\n\r\n dag_trigger();\r\n\r\n if (this2._resolve_after) {\r\n let cb = this2._resolve_after;\r\n this2._resolve_after = undefined;\r\n\r\n this2._pending_solve = this2.solve_intern().then(function () {\r\n cb.call(this2);\r\n });\r\n this2.solving = true;\r\n }\r\n });\r\n\r\n return ret;\r\n } else {\r\n let do_accept;\r\n\r\n let promise = new Promise(function (accept, reject) {\r\n do_accept = function () {\r\n accept();\r\n }\r\n });\r\n\r\n let this2 = this;\r\n let timer = window.setInterval(function () {\r\n window.clearInterval(timer);\r\n\r\n do_solve(SplineFlags, this2, steps, gk);\r\n this2._pending_solve = undefined;\r\n this2.solving = false;\r\n\r\n do_accept();\r\n this2._do_post_solve();\r\n\r\n dag_trigger();\r\n\r\n if (this2._resolve_after) {\r\n let cb = this2._resolve_after;\r\n this2._resolve_after = undefined;\r\n\r\n this2._pending_solve = this2.solve_intern().then(function () {\r\n cb.call(this2);\r\n });\r\n this2.solving = true;\r\n }\r\n\r\n }, 10);\r\n\r\n return promise;\r\n }\r\n }", "function doResolve(fn,self){var done=false;try{fn(function(value){if(done)return;done=true;resolve(self,value);},function(reason){if(done)return;done=true;reject(self,reason);});}catch(ex){if(done)return;done=true;reject(self,ex);}}", "function doResolve(fn,self){var done=false;try{fn(function(value){if(done)return;done=true;resolve(self,value);},function(reason){if(done)return;done=true;reject(self,reason);});}catch(ex){if(done)return;done=true;reject(self,ex);}}", "resolve(name) {\n if (Object.prototype.hasOwnProperty.call(this.values, name)) {\n return this;\n }\n\n if (this.enclosing === null) {\n throw new ReferenceError(`Variable ${name} is not defined.`);\n }\n\n return this.enclosing.resolve(name);\n }", "function memoize(fn, timeout, context) {\n var store = {};\n return function () {\n var key = hashCode(arguments);\n if (key && store[key]) return store[key];\n\n if (!isNaN(timeout) && timeout !== null) {\n setTimeout(function () {\n delete store[key];\n }, timeout);\n }\n\n return store[key] = fn.apply(context || this, Array.prototype.slice.call(arguments));\n };\n }", "function memoizedFactorial() {\n let cache = [1];\n function inner(n) {\n if (!cache[n]) {\n cache[n] = inner(n - 1) * n \n } \n return cache[n]\n }\n return inner\n }", "function memoizeAddTo80(n) {\n let cache = {};\n return function (n) {\n if (n in cache) {\n return cache[n];\n } else {\n console.log('long time');\n const answer = n + 80;\n cache[n] = answer;\n return answer;\n }\n }\n}", "dfsRecursive(start){ \n let results = []\n let visited = {}\n let adjacenyList = this.adjacenyList\n \n function traverse(vertex){\n if(!vertex) return null\n results.push(vertex)\n visited[vertex] = true\n adjacenyList[vertex].forEach(neighbour => {\n if(!visited[neighbour]){\n return traverse(neighbour)\n }\n })\n }\n\n traverse(start)\n return results\n }", "function walk(node, fn){\n\t\tvar previous = node.prev();\n\t\tif (!previous.length){\n\t\t\tprevious = node.parent();\n\t\t}\n\t\tvar oldContext = node.data('context'); // maintain contexts as a stack\n\t\tnode = fn(node);\n\t\tif (!node.length){\n\t\t\tprint('node replaced, backtracking');\n\t\t\tnode = previous;\n\t\t// } if (oldContext){\n\t\t// \tnode.data('context', oldContext);\n\t\t}\n\t\tvar child = node.children().first();\n\t\twhile(child.length){\n\t\t\tchild = walk(child, fn).next();\n\t\t}\n\t\treturn node;\n\t}", "function memoize(fn) {\n const cache = {};\n \n return function(...args) {\n if(cache[args]) {\n return cache[args];\n }\n\n const result = fn.apply(this, args);\n cache[args] = result;\n\n return result;\n };\n}", "_resolve(dataSet) {\n\t}", "function familyTreeRecursive({\n // public parameters\n // @param callback: function({depth, from, infolocal, fullinfo})\n // @param from: family search identifier XXXX-YYY\n // @param depthmax: maximal depth\n // @param callbackEnd: called at the end\n callback=function(){{depth=0, from='UNKNOWN', infolocal={}, fullinfo={}, chain=[]}},\n from=getCurrentId(),\n depthmax=10,\n callbackBeforePerson=function(identifier) {return true;},\n callbackEnd=function({visited=0, errors=0}){console.log(\"Default ended method\");},\n // private parameters\n // @param depth: the current depth\n // @param currentChain: the current chain to the current 'from' (not included) [{id, name, nextisfather}]\n // @param currentalgo: shared parameters for the current process\n depth=0, currentChain=[], shareddata={},\n currentalgo={totaldone:0, currentmax:0, errors:0}}={}) {\n\n function familyTreeRecursiveCheckEnd() {\n if (currentalgo.totaldone == currentalgo.currentmax) {\n console.log(\"Ended, \" + currentalgo.totaldone + \" visited, \"+currentalgo.errors+\" errors.\");\n callbackEnd({visited:currentalgo.totaldone, errors:currentalgo.errors, shareddata:shareddata})\n }\n }\n if (!callbackBeforePerson(from)) {\n return;\n }\n currentalgo.currentmax++;\n //console.log(\"After call:\" + from + \" \" + objectId(currentalgo));\n fetch(familyTreeRecursive_urlSimple(from)\n )\n .then(response => {\n return response.json();\n })\n .then(function (infolocal) {\n fetch(familyTreeRecursive_urlComplete(from)).then(response => {\n return response.json();\n }).then(function (fullinfo) {\n var command = callback({depth:depth, from:from, infolocal:infolocal, fullinfo:fullinfo, chain:currentChain, shareddata:shareddata});\n if (command == \"stop\") {\n // do not go deeper\n return;\n }\n if (depth < depthmax && fullinfo.data.parents) {\n for (var i=0; i < fullinfo.data.parents.length; i++) {\n //console.log(\"In \"+from+\", parent \" + i)\n //console.log(fullinfo.data.parents[i]);\n // new chain in order to tell we are in a father\n var newChain = currentChain.slice(0);\n newChain.push({id:from, name:infolocal.name, nextisfather:true});\n var arguments = {callback:callback, depthmax:depthmax, callbackEnd:callbackEnd, callbackBeforePerson:callbackBeforePerson,\n currentChain:newChain, depth:depth+1, currentalgo:currentalgo, shareddata:shareddata};\n //console.log(\"Before any call:\" + from + \" \" + objectId(currentalgo) + \" \" + objectId(arguments.currentalgo));\n // checking father (husband of couple)\n if (typeof fullinfo.data.parents[i].husband != \"undefined\") {\n arguments.from = fullinfo.data.parents[i].husband.id;\n //console.log(\"Before call1:\" + arguments.from + \" \" + objectId(currentalgo) + \" \" + objectId(arguments.currentalgo));\n familyTreeRecursive(arguments);\n }\n if (typeof fullinfo.data.parents[i].wife != \"undefined\") {\n // new parameters in order to tell we are in a mother\n arguments.from = fullinfo.data.parents[i].wife.id;\n arguments.currentChain = newChain = currentChain.slice(0);\n newChain.push({id:from, name:infolocal.name, nextisfather:false});\n arguments.currentalgo = currentalgo;\n //console.log(\"Before call2:\" + arguments.from + \" \" + objectId(currentalgo));\n familyTreeRecursive(arguments);\n }\n [\"spouse1\", \"spouse2\"].forEach(function (attr) {\n if (typeof fullinfo.data.parents[i][attr] != \"undefined\") {\n // new parameters in order to tell we are in a mother or father\n var arguments = {callback:callback, depthmax:depthmax, callbackEnd:callbackEnd, callbackBeforePerson:callbackBeforePerson,\n currentChain:newChain, depth:depth+1, currentalgo:currentalgo, shareddata:shareddata};\n var attrvalue = fullinfo.data.parents[i][attr];\n arguments.from = attrvalue.id;\n if (arguments.from == \"UNKNOWN\") return;\n arguments.currentChain = newChain = currentChain.slice(0);\n arguments.currentalgo = currentalgo;\n newChain.push({id:from, name:infolocal.name, nextisfather:attrvalue.gender == \"MALE\"});\n //console.log(\"Before call3:\" + arguments.from + \" \" + objectId(currentalgo) + \" \" + objectId(arguments.currentalgo));\n familyTreeRecursive(arguments);\n }\n });\n }\n }\n }).catch(function(err) {\n console.log(err);\n currentalgo.errors++;\n }).finally(function() {\n currentalgo.totaldone++;\n familyTreeRecursiveCheckEnd();\n });\n }\n ).catch(function(err) {\n console.log(err);\n currentalgo.currentmax--;\n currentalgo.errors++;\n familyTreeRecursiveCheckEnd();\n });\n}", "function memoize(fn) {\n const cache = {};\n return function(...args) {\n if(cache[args]) { // if result already exists\n return cache[args];\n }\n let result = fn.apply(this, args); // perform function\n cache[args] = result; // save result in cache\n return result; \n }\n}", "function resolve(dangerous, resolved) {\n return this._resolve(dangerous, resolved) || this;\n}", "function memoize(fn) {\n\tconst cache = {}\n\n\treturn (...args) => {\n\t\tif (cache[args]) {\n\t\t\treturn cache[args]\n\t\t}\n\n\t\tconst result = fn.apply(this, args)\n\t\tcache[args] = result\n\n\t\treturn result\n\t}\n}", "function resolve(dangerous, resolved) {\n\t return this._resolve(dangerous, resolved) || this;\n\t}", "function resolve(dangerous, resolved) {\n\t return this._resolve(dangerous, resolved) || this;\n\t}", "function resolve(dangerous, resolved) {\n\t return this._resolve(dangerous, resolved) || this;\n\t}", "function resolve(dangerous, resolved) {\n\t return this._resolve(dangerous, resolved) || this;\n\t}", "function resolve(dangerous, resolved) {\n\t return this._resolve(dangerous, resolved) || this;\n\t}", "function memoize(func){\n\tvar results = {};\n\treturn function(){\n\t\tvar args = Array.prototype.slice.call(arguments);\n\t\tvar hash = args.reduce(function(hash, nextArg){\n\t\t\treturn hash+nextArg;\n\t\t}, '');\n\t\tif(results[hash] === undefined){\n\t\t\tvar result = func.apply(this, args);\n\t\t\tresults[hash] = result;\n\t\t}\n\t\tconsole.log(results);\n\t\treturn results[hash];\n\t}\n}", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "function fDP () {\n let cache = {};\n return function fib (num) {\n calculations++;\n if (num in cache) {\n return cache[num];\n } else {\n if (num < 2) {\n return num\n } else {\n cache[num] = fib(num - 1) + fib(num - 2);\n return cache[num];\n }\n }\n }\n}", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "resolveNodes() {\n const {\n map,\n _cstAliases\n } = this;\n Object.keys(map).forEach(a => {\n map[a] = map[a].resolved;\n });\n\n _cstAliases.forEach(a => {\n a.source = a.source.resolved;\n });\n\n delete this._cstAliases;\n }", "expandEntity({ entity, pad }, cb) {\n this.haltAndCatchFire();\n\n const ancestors = this.activeExpansions.slice();\n\n const ticket = {\n active: true,\n increment: () => {\n ticket.length++;\n\n if (ticket.length > this.maxExpansionSize) {\n this.expected(undefined,\n `Entity ${ entity.name } not to expand to larger than the ` +\n `maximum permitted size, ${ this.maxExpansionSize }`\n );\n\n return true;\n }\n\n ancestors.forEach(ticket => ticket.increment());\n },\n length: pad ? -2 : 0,\n name: entity.name,\n path: entity.path\n };\n\n const promise = this.__expansionPromise = new Promise(resolve => {\n const { name } = entity;\n\n this.expansionCount++;\n\n if (this.expansionCount > this.maxExpansionCount) {\n this.expected(undefined,\n `not to surpass the maximum number of permitted expansions, ` +\n `${ this.maxExpansionCount } (at ${ name })`\n );\n }\n\n if (this.activeExpansions.some(expansion => expansion.name === name)) {\n const chain = this.activeExpansions\n .map(expansion => expansion.name)\n .reverse()\n .join(' => ');\n\n this.expected(undefined,\n `entity ${ name } not to include a recursive reference to itself ` +\n `(${ chain } => ${ name })`\n );\n\n return;\n }\n\n this.activeExpansions.unshift(ticket);\n\n resolve(entity.value || this.dereference('extEntity', 'ENTITY', entity));\n }).then(origCPs => {\n entity.value = origCPs;\n\n const cps = pad ? [ SPACE, ...origCPs, SPACE ] : origCPs;\n const iter = cps[Symbol.iterator]();\n\n const expand = () => {\n let cp;\n\n this.__expansionPromise = promise;\n\n // Note: Cannot be for loop due to satanic automatic iterator closing.\n\n while (cp = iter.next().value) {\n if (ticket.increment()) {\n return;\n }\n\n this.eat(cp);\n\n if (this.__expansionPromise !== promise) {\n this.__expansionPromise.then(expand);\n return;\n }\n }\n\n ticket.active = false;\n this.activeExpansions.shift();\n this.unhalt();\n cb();\n };\n\n expand();\n });\n\n return ticket;\n }", "function doResolve(fn, self) {\nvar done = false;\ntry {\nfn(function (value) {\nif (done) return;\ndone = true;\nresolve(self, value);\n}, function (reason) {\nif (done) return;\ndone = true;\nreject(self, reason);\n});\n} catch (ex) {\nif (done) return;\ndone = true;\nreject(self, ex);\n}\n}", "resolve(inner, outer, rootId, promiseLinkType, traceId, asyncPromisifyPromiseId) {\n // const rootId = this.getCurrentVirtualRootContextId();\n const from = getPromiseId(inner);\n const to = getPromiseId(outer);\n // if (!from || !to) {\n // this.logger.error(`resolve link failed: promise did not have an id, from=${from}, to=${to}, trace=${traceCollection.makeTraceInfo(traceId)}`);\n // }\n // else {\n return nestedPromiseCollection.addLink(promiseLinkType, from, to, traceId, rootId, asyncPromisifyPromiseId);\n }", "solveDFS() {\n for (let maxDepth = 0; maxDepth <= 10; maxDepth++) {\n let path = this.dfs(maxDepth);\n if (path) {\n this.drawSolvedPath(path);\n return path;\n }\n }\n return null;\n }", "function resolveNodeValue(node, context) {\n var e_1, _a, e_2, _b;\n var _c, _d;\n if (node == null)\n return undefined;\n var ts = context.ts, checker = context.checker;\n var depth = (context.depth || 0) + 1;\n // Always break when depth is larger than 10.\n // This ensures we cannot run into infinite recursion.\n if (depth > 10)\n return undefined;\n if (ts.isStringLiteralLike(node)) {\n return { value: node.text, node: node };\n }\n else if (ts.isNumericLiteral(node)) {\n return { value: Number(node.text), node: node };\n }\n else if (ts.isPrefixUnaryExpression(node)) {\n var value = (_c = resolveNodeValue(node.operand, __assign(__assign({}, context), { depth: depth }))) === null || _c === void 0 ? void 0 : _c.value;\n return { value: applyPrefixUnaryOperatorToValue(value, node.operator, ts), node: node };\n }\n else if (ts.isObjectLiteralExpression(node)) {\n var object = {};\n try {\n for (var _e = __values(node.properties), _f = _e.next(); !_f.done; _f = _e.next()) {\n var prop = _f.value;\n if (ts.isPropertyAssignment(prop)) {\n // Resolve the \"key\"\n var name_1 = ((_d = resolveNodeValue(prop.name, __assign(__assign({}, context), { depth: depth }))) === null || _d === void 0 ? void 0 : _d.value) || prop.name.getText();\n // Resolve the \"value\n var resolvedValue = resolveNodeValue(prop.initializer, __assign(__assign({}, context), { depth: depth }));\n if (resolvedValue != null && typeof name_1 === \"string\") {\n object[name_1] = resolvedValue.value;\n }\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_f && !_f.done && (_a = _e.return)) _a.call(_e);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return {\n value: object,\n node: node\n };\n }\n else if (node.kind === ts.SyntaxKind.TrueKeyword) {\n return { value: true, node: node };\n }\n else if (node.kind === ts.SyntaxKind.FalseKeyword) {\n return { value: false, node: node };\n }\n else if (node.kind === ts.SyntaxKind.NullKeyword) {\n return { value: null, node: node };\n }\n else if (node.kind === ts.SyntaxKind.UndefinedKeyword) {\n return { value: undefined, node: node };\n }\n // Resolve initializers for variable declarations\n if (ts.isVariableDeclaration(node)) {\n return resolveNodeValue(node.initializer, __assign(__assign({}, context), { depth: depth }));\n }\n // Resolve value of a property access expression. For example: MyEnum.RED\n else if (ts.isPropertyAccessExpression(node)) {\n return resolveNodeValue(node.name, __assign(__assign({}, context), { depth: depth }));\n }\n // Resolve [expression] parts of {[expression]: \"value\"}\n else if (ts.isComputedPropertyName(node)) {\n return resolveNodeValue(node.expression, __assign(__assign({}, context), { depth: depth }));\n }\n // Resolve initializer value of enum members.\n else if (ts.isEnumMember(node)) {\n if (node.initializer != null) {\n return resolveNodeValue(node.initializer, __assign(__assign({}, context), { depth: depth }));\n }\n else {\n return { value: node.parent.name.text + \".\" + node.name.getText(), node: node };\n }\n }\n // Resolve values of variables.\n else if (ts.isIdentifier(node) && checker != null) {\n var declarations = resolveDeclarations(node, { checker: checker, ts: ts });\n if (declarations.length > 0) {\n var resolved = resolveNodeValue(declarations[0], __assign(__assign({}, context), { depth: depth }));\n if (context.strict || resolved != null) {\n return resolved;\n }\n }\n return { value: node.getText(), node: node };\n }\n // Fallthrough\n // - \"my-value\" as string\n // - <any>\"my-value\"\n // - (\"my-value\")\n else if (ts.isAsExpression(node) || ts.isTypeAssertion(node) || ts.isParenthesizedExpression(node)) {\n return resolveNodeValue(node.expression, __assign(__assign({}, context), { depth: depth }));\n }\n // static get is() {\n // return \"my-element\";\n // }\n else if ((ts.isGetAccessor(node) || ts.isMethodDeclaration(node) || ts.isFunctionDeclaration(node)) && node.body != null) {\n try {\n for (var _g = __values(node.body.statements), _h = _g.next(); !_h.done; _h = _g.next()) {\n var stm = _h.value;\n if (ts.isReturnStatement(stm)) {\n return resolveNodeValue(stm.expression, __assign(__assign({}, context), { depth: depth }));\n }\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n // [1, 2]\n else if (ts.isArrayLiteralExpression(node)) {\n return {\n node: node,\n value: node.elements.map(function (el) { var _a; return (_a = resolveNodeValue(el, __assign(__assign({}, context), { depth: depth }))) === null || _a === void 0 ? void 0 : _a.value; })\n };\n }\n return undefined;\n}", "function memoize(fn) {\n const cache = {};\n return (...args) => {\n if (cache[args]) {\n return cache[args];\n }\n\n const result = fn.apply(this, args);\n cache[args] = result;\n\n return result;\n };\n}", "function memoize (fn) {\n return function memoized (...args) {\n let hash = JSON.stringify(args);\n let cache = memoized.cache;\n // if result exists, return it. otherwise compute and store in cache.\n return cache[hash] || (cache[hash] = fn.call(...args));\n }\n memoized.cache = {}; // initialize empty cache\n}", "function resolveFast(stx, env) {\n var name = unwrapSyntax(stx);\n return env.names.get(name) ? resolve(stx) : name;\n }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(\n\t function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t },\n\t function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t }\n\t );\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function resolve (obj, locals) {\n\t\t\t\tvar promises = [];\n\t\t\t\tvar deferred = $q.defer();\n\n\t\t\t\tif(!locals) {\n\t\t\t\t\tlocals = {};\n\t\t\t\t}\n\n\t\t\t\tforEach(obj, function (value, key) {\n\t\t\t\t\tvar done = this.done;\n\t\t\t\t\tvar next = this.next;\n\t\t\t\t\tvar promise = isString(value) ? $injector.get(value) : $injector.invoke(value, {}, obj);\n\n\t\t\t\t\t// If is a promise, add it to the promises variable\n\t\t\t\t\t// to be solved later and only return when, all promises\n\t\t\t\t\t// got resolved.\n\t\t\t\t\tif(promise && promise.then) {\n\t\t\t\t\t\treturn promises.push(promise.then(function (value) {\n\t\t\t\t\t\t\tobj[key] = value;\n\n\t\t\t\t\t\t\tnext();\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\n\t\t\t\t\tobj[key] = promise;\n\n\t\t\t\t\tnext();\n\t\t\t\t})\n\t\t\t\t// Only resolve all the promises\n\t\t\t\t// attached by the invokes/instantiates\n\t\t\t\t// after the $async.forEach finishes the loop.\n\t\t\t\t.then(function () {\n\t\t\t\t\t// Resolve all the queued promises\n\t\t\t\t\t// atached by the invokes/instantiates\n\t\t\t\t\t$q.all(promises).then(function () {\n\t\t\t\t\t\tdeferred.resolve(obj);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\treturn deferred.promise;\n\t\t\t}", "function memoizedAddTo80() {\n let cache = {};\n\n return function (n) {\n if (n in cache) {\n console.log('Cached value');\n return cache[n];\n } else {\n console.log('long time');\n cache[n] = 80 + n;\n return cache[n];\n }\n };\n}", "function familyTreeGetDown({\n // public parameters\n // @param callback: function({depth, from, infolocal, fullinfo})\n // @param from: family search identifier XXXX-YYY\n // @param depthmax: maximal depth\n // @param callbackEnd: called at the end\n callback=function(){{depth=0, from='UNKNOWN', infolocal={}, fullinfo={}, chain=[]}},\n from=getCurrentId(),\n depthmax=10,\n callbackBeforePerson=function(identifier) {return true;},\n callbackEnd=function({visited=0, errors=0}){console.log(\"Default ended method\");},\n // private parameters\n // @param depth: the current depth\n // @param currentChain: the current chain to the current 'from' (not included) [{id, name, nextisfather}]\n // @param currentalgo: shared parameters for the current process\n depth=0, currentChain=[],\n shareddata={},\n currentalgo={totaldone:0, currentmax:0, errors:0}}={}) {\n if (!callbackBeforePerson(from)) {\n return;\n }\n currentalgo.currentmax++;\n //console.log(\"After call:\" + from + \" \" + objectId(currentalgo));\n fetch(familyTreeRecursive_urlSimple(from)\n )\n .then(response => {\n return response.json();\n })\n .then(function (infolocal) {\n fetch(familyTreeRecursive_urlComplete(from)).then(response => {\n return response.json();\n }).then(function (fullinfo) {\n var command = callback({depth:depth, from:from, infolocal:infolocal, fullinfo:fullinfo, chain:currentChain,shareddata:shareddata});\n if (command == \"stop\") {\n // do not go deeper\n return;\n }\n if (depth < depthmax && fullinfo.data.spouses) {\n var childCounter = 0;\n for (var i=0; i < fullinfo.data.spouses.length; i++) {\n if (!fullinfo.data.spouses[i].children) continue;\n for (var j=0; j < fullinfo.data.spouses[i].children.length; j++) {\n var child = fullinfo.data.spouses[i].children[j];\n childCounter++;\n //console.log(\"In \"+from+\", child \" + i + \"-\"+j)\n // new chain in order to tell we are in a father\n var newChain = currentChain.slice(0);\n newChain.push({id:from, name:infolocal.name, child:childCounter});\n var arguments = {callback:callback, depthmax:depthmax, callbackEnd:callbackEnd, currentChain:newChain, depth:depth+1, currentalgo:currentalgo, shareddata:shareddata,\n from:child.id};\n familyTreeGetDown(arguments);\n }\n }\n }\n }).catch(function(e) {\n console.log(e);\n currentalgo.errors++;\n }).finally(function() {\n currentalgo.totaldone++;\n if (currentalgo.totaldone == currentalgo.currentmax) {\n console.log(\"Ended, \" + currentalgo.totaldone + \" visited, \"+currentalgo.errors+\" errors.\");\n callbackEnd({visited:currentalgo.totaldone, errors:currentalgo.errors, shareddata:shareddata})\n }\n });\n }\n ).catch(function(err) {\n console.log(err);\n currentalgo.currentmax--;\n currentalgo.errors++;\n if (currentalgo.totaldone == currentalgo.currentmax) {\n console.log(\"Ended, \" + currentalgo.totaldone + \" visited, \"+currentalgo.errors+\" errors.\");\n callbackEnd({visited:currentalgo.totaldone, errors:currentalgo.errors, shareddata:shareddata})\n }\n });\n}", "function memoize(fn) {\n var cache = {};\n return function (arg) {\n var cachedValue = cache[arg];\n\n // when value is not present in cache, compute it\n if (cachedValue === undefined) {\n cachedValue = cache[arg] = fn(arg);\n }\n return cachedValue;\n }\n }", "function memoize(type, pattern, options, fn) {\n var key = utils.createKey(type + ':' + pattern, options);\n var disabled = options && options.cache === false;\n if (disabled) {\n braces.clearCache();\n return fn(pattern, options);\n }\n\n if (cache.hasOwnProperty(key)) {\n return cache[key];\n }\n\n var res = fn(pattern, options);\n cache[key] = res;\n return res;\n}", "dfsRecursive(start) {\n let listResult = []\n let visited = {}\n let adjacencyList = this.adjacencyList\n function depth(vertex) {\n if (!vertex) {\n return null\n }\n visited[vertex] = true\n listResult.push(vertex)\n for (let i = 0; i < adjacencyList[vertex].length; i++) {\n if (!visited[adjacencyList[vertex][i]]) {\n return depth(adjacencyList[vertex][i])\n }\n }\n\n }\n depth(start)\n\n return listResult\n }", "function memoize(type, pattern, options, fn) {\n var key = utils.createKey(type + ':' + pattern, options);\n var disabled = options && options.cache === false;\n\n if (disabled) {\n braces.clearCache();\n return fn(pattern, options);\n }\n\n if (cache.hasOwnProperty(key)) {\n return cache[key];\n }\n\n var res = fn(pattern, options);\n cache[key] = res;\n return res;\n}", "function memoize(type, pattern, options, fn) {\n var key = utils.createKey(type + ':' + pattern, options);\n var disabled = options && options.cache === false;\n\n if (disabled) {\n braces.clearCache();\n return fn(pattern, options);\n }\n\n if (cache.hasOwnProperty(key)) {\n return cache[key];\n }\n\n var res = fn(pattern, options);\n cache[key] = res;\n return res;\n}", "function memoize(func) {\n // For any given function the results object will contain either promises or the results keyed with the argument value.\n // Only single-argument function memoization is supported in this demo. For multiple argument function memoization see the challenge3.\n var results = {};\n\n return function(arg) {\n if (!results.hasOwnProperty(arg)) {\n var retVal = func(arg);\n \n // this is the same check that uses $.when\n if ($.isFunction(retVal.promise)) {\n results[arg] = retVal.promise();\n } else {\n results[arg] = retVal;\n }\n }\n return results[arg]; \n };\n}", "function memo(key, lookup, fallback) {\n var fell = false;\n var falling = false;\n exports[key] = function (cb) {\n var val = lookup();\n if (!val && !fell && !falling && fallback) {\n fell = true;\n falling = true;\n exec(fallback, function (er, output, stderr) {\n falling = false;\n if (er) return; // oh well, we tried\n val = output.trim();\n });\n }\n exports[key] = function (cb) {\n if (cb) process.nextTick(cb.bind(null, null, val));\n return val;\n };\n if (cb && !falling) process.nextTick(cb.bind(null, null, val));\n return val;\n };\n}", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function memo (key, lookup, fallback) {\n var fell = false\n var falling = false\n exports[key] = function (cb) {\n var val = lookup()\n if (!val && !fell && !falling && fallback) {\n fell = true\n falling = true\n exec(fallback, function (er, output, stderr) {\n falling = false\n if (er) return // oh well, we tried\n val = output.trim()\n })\n }\n exports[key] = function (cb) {\n if (cb) process.nextTick(cb.bind(null, null, val))\n return val\n }\n if (cb && !falling) process.nextTick(cb.bind(null, null, val))\n return val\n }\n}", "function memo (key, lookup, fallback) {\n var fell = false\n var falling = false\n exports[key] = function (cb) {\n var val = lookup()\n if (!val && !fell && !falling && fallback) {\n fell = true\n falling = true\n exec(fallback, function (er, output, stderr) {\n falling = false\n if (er) return // oh well, we tried\n val = output.trim()\n })\n }\n exports[key] = function (cb) {\n if (cb) process.nextTick(cb.bind(null, null, val))\n return val\n }\n if (cb && !falling) process.nextTick(cb.bind(null, null, val))\n return val\n }\n}", "function doResolve(fn, self) {\r\n\t var done = false;\r\n\t try {\r\n\t fn(function (value) {\r\n\t if (done) return;\r\n\t done = true;\r\n\t resolve(self, value);\r\n\t }, function (reason) {\r\n\t if (done) return;\r\n\t done = true;\r\n\t reject(self, reason);\r\n\t });\r\n\t } catch (ex) {\r\n\t if (done) return;\r\n\t done = true;\r\n\t reject(self, ex);\r\n\t }\r\n\t }", "function wordSearch(board, word) {\n for(let i = 0; i < board.length; i++) {\n for(let j = 0; j < board[i].length; j++) {\n // if (_dfs(i, j, 0)) return true;\n if (_dfsBacktracking(i, j, 0)) return true;\n }\n }\n\n return false;\n // hoisted\n // function _dfs(x, y, idx, memo = {}) {\n // if (idx === word.length) return true;\n // if (x < 0 || \n // x >= board.length ||\n // y < 0 ||\n // y >= board[x].length ||\n // memo[[x, y]] ||\n // board[x][y] !== word[idx]) return false;\n \n // memo[[x, y]] = true;\n\n // return _dfs(x + 1, y, idx + 1, Object.assign({}, memo)) ||\n // _dfs(x, y + 1, idx + 1, Object.assign({}, memo)) ||\n // _dfs(x - 1, y, idx + 1, Object.assign({}, memo)) ||\n // _dfs(x, y - 1, idx + 1, Object.assign({}, memo));\n // }\n // a copy of the memo object is copy for each dfs step, very costly\n\n function _dfsBacktracking(x, y, idx) {\n if (idx === word.length) return true;\n if (x < 0 || \n x >= board.length ||\n y < 0 ||\n y >= board[x].length ||\n board[x][y] !== word[idx]) return false;\n\n const temp = board[x][y];\n board[x][y] = \"*\";\n\n const boolean = _dfsBacktracking(x + 1, y, idx + 1) ||\n _dfsBacktracking(x, y + 1, idx + 1) ||\n _dfsBacktracking(x - 1, y, idx + 1) ||\n _dfsBacktracking(x, y - 1, idx + 1);\n\n board[x][y] = temp;\n return boolean;\n }\n // Each letter is replaced with \"*\" in each dfs step, and as call stack \n // is popped, \"*\" is switched back to the original letter\n}", "function traverse(config) {\n const tree = [];\n const stack = [config.filename];\n\n while (stack.length) {\n const dependency = stack.pop();\n debug(`traversing ${dependency}`);\n\n if (config.visited[dependency]) {\n populateFromCache(dependency);\n } else {\n traverseDependency(dependency);\n }\n }\n\n return tree;\n\n function traverseDependency(dependency) {\n const localConfig = config.clone();\n localConfig.filename = dependency;\n\n let dependencies = module.exports._getDependencies(localConfig);\n\n if (config.filter) {\n debug('using filter function to filter out dependencies');\n debug(`number of dependencies before filtering: ${dependencies.length}`);\n dependencies = dependencies.filter(function (filePath) {\n return localConfig.filter(filePath, localConfig.filename);\n });\n debug(`number of dependencies after filtering: ${dependencies.length}`);\n }\n\n debug('cabinet-resolved all dependencies: ', dependencies); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n\n tree[dependency] = dependencies;\n const filePathMap = config.pathMap.find(pathMapEntry => pathMapEntry.file === dependency);\n if (!filePathMap) throw new Error(`file ${dependency} is missing from PathMap`);\n config.visited[dependency] = {\n pathMap: filePathMap,\n missing: config.nonExistent[dependency],\n error: config.errors[dependency]\n };\n stack.push(...dependencies);\n }\n\n function populateFromCache(dependency) {\n debug(`already visited ${dependency}. Will try to find it and its dependencies in the cache`);\n const dependenciesStack = [dependency];\n\n while (dependenciesStack.length) {\n findAllDependenciesInCache(dependenciesStack);\n }\n }\n\n function findAllDependenciesInCache(dependenciesStack) {\n const dependency = dependenciesStack.pop();\n\n if (!config.visited[dependency]) {\n debug(`unable to find ${dependency} in the cache, it was probably filtered before`);\n return;\n }\n\n debug(`found ${dependency} in the cache`);\n const dependencies = config.visited[dependency].pathMap.dependencies.map(d => d.resolvedDep); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n\n tree[dependency] = dependencies;\n config.pathMap.push(config.visited[dependency].pathMap);\n\n if (config.visited[dependency].missing) {\n config.nonExistent[dependency] = config.visited[dependency].missing;\n }\n\n if (config.visited[dependency].error) {\n config.errors[dependency] = config.visited[dependency].error;\n }\n\n dependencies.forEach(d => {\n if (!tree[d]) dependenciesStack.push(d);\n });\n }\n}", "resolve(...paths) {\n // first figure out the minimum number of paths we have to test\n // we always start at cwd, but any absolutes will bump the start\n let r = '';\n for (let i = paths.length - 1; i >= 0; i--) {\n const p = paths[i];\n if (!p || p === '.')\n continue;\n r = r ? `${p}/${r}` : p;\n if (this.isAbsolute(p)) {\n break;\n }\n }\n const cached = this.#resolveCache.get(r);\n if (cached !== undefined) {\n return cached;\n }\n const result = this.cwd.resolve(r).fullpath();\n this.#resolveCache.set(r, result);\n return result;\n }", "__fullyResolveChain(topOfTheChainContextBeforeRedirects,\n contextBeforeRedirects = topOfTheChainContextBeforeRedirects) {\n return this.__findComponentContextAfterAllRedirects(contextBeforeRedirects)\n // `contextAfterRedirects` is always a context with an `HTMLElement` result\n // In other cases the promise gets rejected and .then() is not called\n .then(contextAfterRedirects => {\n const redirectsHappened = contextAfterRedirects !== contextBeforeRedirects;\n const topOfTheChainContextAfterRedirects =\n redirectsHappened ? contextAfterRedirects : topOfTheChainContextBeforeRedirects;\n\n const matchedPath = getPathnameForRouter(\n getMatchedPath(contextAfterRedirects.chain),\n contextAfterRedirects.resolver\n );\n const isFound = (matchedPath === contextAfterRedirects.pathname);\n\n // Recursive method to try matching more child and sibling routes\n const findNextContextIfAny = (context, parent = context.route, prevResult) => {\n return context.next(undefined, parent, prevResult).then(nextContext => {\n if (nextContext === null || nextContext === notFoundResult) {\n // Next context is not found in children, ...\n if (isFound) {\n // ...but original context is already fully matching - use it\n return context;\n } else if (parent.parent !== null) {\n // ...and there is no full match yet - step up to check siblings\n return findNextContextIfAny(context, parent.parent, nextContext);\n } else {\n return nextContext;\n }\n }\n\n return nextContext;\n });\n };\n\n return findNextContextIfAny(contextAfterRedirects).then(nextContext => {\n if (nextContext === null || nextContext === notFoundResult) {\n throw getNotFoundError(topOfTheChainContextAfterRedirects);\n }\n\n return nextContext\n && nextContext !== notFoundResult\n && nextContext !== contextAfterRedirects\n ? this.__fullyResolveChain(topOfTheChainContextAfterRedirects, nextContext)\n : this.__amendWithOnBeforeCallbacks(contextAfterRedirects);\n });\n });\n }", "function fibonacciMaster() {\n //O(n)\n let cache = {};\n return function fib(n) {\n calculations++;\n if (n in cache) {\n return cache[n];\n } else {\n if (n < 2) {\n return n;\n } else {\n cache[n] = fib(n - 1) + fib(n - 2);\n return cache[n];\n }\n }\n };\n}", "solve () {\n while (true) {\n const node = this.findAnOpenNode()\n if (node === null) {\n return\n }\n\n const gcd = greatestCommonDivisor(node.problem.currentSize, node.problem.targetSize)\n if (gcd !== 1) {\n node.reduce(gcd)\n } else if (node.problem.currentSize < node.problem.targetSize) {\n node.rethrow()\n } else if (node.problem.currentSize % node.problem.targetSize === 0) {\n node.reduce(node.problem.targetSize)\n } else {\n node.tryReduce(node.problem.targetSize)\n }\n }\n }", "function resolveContexts(context) {\n /**\n * we split the context apart into the external one and\n * some internal values\n */\n let externalContext = ExtDomQuery_1.ExtConfig.fromNullable(context);\n let internalContext = externalContext.getIf(Const_1.CTX_PARAM_MF_INTERNAL);\n if (!internalContext.isPresent()) {\n internalContext = ExtDomQuery_1.ExtConfig.fromNullable({});\n }\n /**\n * prepare storage for some deferred operations\n */\n internalContext.assign(Const_1.DEFERRED_HEAD_INSERTS).value = [];\n internalContext.assign(Const_1.UPDATE_FORMS).value = [];\n internalContext.assign(Const_1.UPDATE_ELEMS).value = [];\n return { externalContext, internalContext };\n}", "findReferences() {\n this._references = new References();\n const excludedExpressions = new Set();\n const visitCallExpression = (e) => {\n for (const p of e.args) {\n this._references.expressions.add(p);\n }\n //add calls that were not excluded (from loop below)\n if (!excludedExpressions.has(e)) {\n this._references.expressions.add(e);\n }\n //if this call is part of a longer expression that includes a call higher up, find that higher one and remove it\n if (e.callee) {\n let node = e.callee;\n while (node) {\n //the primary goal for this loop. If we found a parent call expression, remove it from `references`\n if ((0, reflection_1.isCallExpression)(node)) {\n this.references.expressions.delete(node);\n excludedExpressions.add(node);\n //stop here. even if there are multiple calls in the chain, each child will find and remove its closest parent, so that reduces excess walking.\n break;\n //when we hit a variable expression, we're definitely at the leftmost expression so stop\n }\n else if ((0, reflection_1.isVariableExpression)(node)) {\n break;\n //if\n }\n else if ((0, reflection_1.isDottedGetExpression)(node) || (0, reflection_1.isIndexedGetExpression)(node)) {\n node = node.obj;\n }\n else {\n //some expression we don't understand. log it and quit the loop\n this.logger.info('Encountered unknown expression while calculating function expression chain', node);\n break;\n }\n }\n }\n };\n this.ast.walk((0, visitors_1.createVisitor)({\n AssignmentStatement: s => {\n this._references.assignmentStatements.push(s);\n this.references.expressions.add(s.value);\n },\n ClassStatement: s => {\n this._references.classStatements.push(s);\n },\n ClassFieldStatement: s => {\n if (s.initialValue) {\n this._references.expressions.add(s.initialValue);\n }\n },\n NamespaceStatement: s => {\n this._references.namespaceStatements.push(s);\n },\n FunctionStatement: s => {\n this._references.functionStatements.push(s);\n },\n ImportStatement: s => {\n this._references.importStatements.push(s);\n },\n LibraryStatement: s => {\n this._references.libraryStatements.push(s);\n },\n FunctionExpression: (expression, parent) => {\n if (!(0, reflection_1.isMethodStatement)(parent)) {\n this._references.functionExpressions.push(expression);\n }\n },\n NewExpression: e => {\n this._references.newExpressions.push(e);\n for (const p of e.call.args) {\n this._references.expressions.add(p);\n }\n },\n ExpressionStatement: s => {\n this._references.expressions.add(s.expression);\n },\n CallfuncExpression: e => {\n visitCallExpression(e);\n },\n CallExpression: e => {\n visitCallExpression(e);\n },\n AALiteralExpression: e => {\n this.addPropertyHints(e);\n this._references.expressions.add(e);\n for (const member of e.elements) {\n if ((0, reflection_1.isAAMemberExpression)(member)) {\n this._references.expressions.add(member.value);\n }\n }\n },\n BinaryExpression: (e, parent) => {\n //walk the chain of binary expressions and add each one to the list of expressions\n const expressions = [e];\n let expression;\n while ((expression = expressions.pop())) {\n if ((0, reflection_1.isBinaryExpression)(expression)) {\n expressions.push(expression.left, expression.right);\n }\n else {\n this._references.expressions.add(expression);\n }\n }\n },\n ArrayLiteralExpression: e => {\n for (const element of e.elements) {\n //keep everything except comments\n if (!(0, reflection_1.isCommentStatement)(element)) {\n this._references.expressions.add(element);\n }\n }\n },\n DottedGetExpression: e => {\n this.addPropertyHints(e.name);\n },\n DottedSetStatement: e => {\n this.addPropertyHints(e.name);\n },\n EnumStatement: e => {\n this._references.enumStatements.push(e);\n },\n ConstStatement: s => {\n this._references.constStatements.push(s);\n },\n UnaryExpression: e => {\n this._references.expressions.add(e);\n },\n IncrementStatement: e => {\n this._references.expressions.add(e);\n }\n }), {\n walkMode: visitors_1.WalkMode.visitAllRecursive\n });\n }", "function memoizedAddTo80() {\n let cache = {};\n return function(n) {\n if (n in cache) {\n return cache[n];\n } else {\n // console.log('long time');\n cache[n] = n + 80;\n return cache[n];\n }\n }\n}", "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInProgress.expirationTime);}", "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInProgress.expirationTime);}", "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInProgress.expirationTime);}", "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInProgress.expirationTime);}", "function reconcileChildren(current,workInProgress,nextChildren){reconcileChildrenAtExpirationTime(current,workInProgress,nextChildren,workInProgress.expirationTime);}" ]
[ "0.5418757", "0.51672536", "0.5159967", "0.5159967", "0.5087206", "0.506638", "0.4995027", "0.49744466", "0.49744466", "0.48883986", "0.48671627", "0.48212388", "0.47679302", "0.4729788", "0.4721245", "0.46949247", "0.46911404", "0.4663517", "0.4611715", "0.46062994", "0.46062994", "0.4603139", "0.4600827", "0.45928276", "0.45923594", "0.4581894", "0.45666456", "0.45572764", "0.45420378", "0.45373908", "0.45223263", "0.45154747", "0.45154348", "0.45154348", "0.45129225", "0.45062765", "0.4491393", "0.44681227", "0.44653976", "0.44637492", "0.44616562", "0.445308", "0.44485083", "0.44390917", "0.44324875", "0.44245523", "0.4418885", "0.4418885", "0.4418885", "0.4418885", "0.4418885", "0.4410539", "0.44073117", "0.44014108", "0.4393706", "0.4393706", "0.4393706", "0.4393706", "0.43913954", "0.4380117", "0.43795907", "0.43685395", "0.43629655", "0.4355832", "0.4352743", "0.43523708", "0.4343699", "0.43291876", "0.4310471", "0.42977616", "0.42954066", "0.42887613", "0.42785138", "0.42727923", "0.42727923", "0.42696154", "0.4260946", "0.42567426", "0.42567426", "0.42567426", "0.42567426", "0.42567426", "0.42567426", "0.42557275", "0.42557275", "0.4232019", "0.42311344", "0.42259306", "0.42226097", "0.4221409", "0.419801", "0.41925442", "0.41887212", "0.4188577", "0.41777262", "0.41676062", "0.41676062", "0.41676062", "0.41676062", "0.41676062" ]
0.70064014
0
fun () > Num
function fresh() { return nextFresh++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numfunc(num) {\n // Defines a function - with one arguement that ust be a number and must returna number\n return num + 1;\n}", "function num1() {\n return 10;\n}", "function retorno2(num1){\n return num1;\n}", "function fun(a){\n // console.log(\"a got :\" + a);\n return a>33;\n}", "function myFunc(num){\n return num + 1;\n}", "function number(val) {\n return +val;\n}", "function FuncionReturn(num1,num2){\n return num1 + num2;\n}", "function CheckNums(num1,num2) { \n\n // code goes here \n \n var rtn = num2 > num1 ? true : num1 == num2 ? -1 : false; \n \n return rtn; \n \n}", "function isNum(num){\r\n return typeof(num) === 'number'; \r\n}", "function comparisonNum(a, b) {\n\tif (a === b) { return true;}\n\t else if(a != b){ return false;}\n}", "function fn(arg) {\n return arg < 5;\n}", "function num1(number1, number2){\n return number1 + number2\n}", "function comparenum(a,b)\n{\n if(a==b)\n {\n return true;\n }\n else\n {\n return false;\n }\n}", "function isPrimse(number) {\n // your code here...\n}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function n(){}", "function myFunction(num1,num2){\n if (num1 > num2){\n console.log(\"nunber is greater than the other\")\n }\n else {\n console.log(\"number 1 is not greater then number 2\")\n }\n}", "function myFunction( num1, num2){\n if (num1 > num2 ){\n console.log(num1)\n }\n else if (num1 < num2 ){\n console.log(num2)\n }\n }", "function isNum(num){\r\n return typeof(num) === 'number'; \r\n}", "function myFunction( num1, num2){\n if (num1 < num2 ){\n console.log(num1)\n }\n else if (num1 > num2 ){\n console.log(num2)\n }\n }", "function isNumber(val) {\n return typeof val == \"number\";\n}", "function number1(num1, num2){\n return num1 + num2\n}", "function is1(x){\r\n return x == 1;\r\n}", "function ot(t) {\n return \"number\" == typeof t && Number.isInteger(t) && !it(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;\n}", "function compareNumber(a, b) {\r\n return a - b;\r\n}", "function number(val) {\n\t return +val;\n\t}", "function number(val) {\n\t return +val;\n\t}", "function d(num) {\n\treturn ($defined(v(num)));\n}", "function myFunc(num1, num2) {\n return num1 - num2;\n}", "function numTest() {\n return 1 + 2;\n}", "function iftrue(num) {\n if(num) {\n return num;\n }\n}", "function myFunction( num1,num2){\n if (num1<num2){\n console.log (\"number 1 is less then number 2\")\n }\n else {\n console.log (\" number 1 is not less then number 2\")\n }\n}", "function greaterThan(n){\n return m => m > n;\n}", "function mapFn(x) {\n return Number(x);\n}", "function one() {\n return 1;\n}", "function one() {\n return 1;\n}", "function addNum(a, b) {\n return a + b;\n}", "function a(num1, num2) {\n return num1 + num2\n}", "function a(num1, num2) {\n return num1 + num2\n}", "function a(num1, num2) {\n return num1 + num2\n}", "function MyNumber()\n{\n}", "function num(number) {\n return () => number;\n}", "function over50(num){\n return num > 50;\n}", "function positiveNums(value) {\n return value > 0; \n}", "function SimpleAdding(num) {\n\n // code goes here\n return num;\n\n}", "function myFunction(a,b) {\n\n return a===b\n }", "function over50(num){\n return num > 50;\n}", "function T(){\n\treturn true;\n}", "function fnRelu(value) { return value > 0 ? value : 0 }", "function myFunction (num) {\n return num * 3;\n}", "function foo(x) {\n if(x > 5) return x;\n else return 1;\n}", "function numSquare (num) {\nreturn num * num;\n}", "function add1Functional(number) {\n return number + 1;\n}", "function squareNum(num){\n\treturn num*num;\n}", "function Test(fun, result) {\n console.log(fun === result);\n}", "function Test(fun, result) {\n console.log(fun === result);\n}", "function square(num) {\n\n return num * num;\n\n}", "function positive(x) {\r\n return x > 0;\r\n}", "function plainSum(num){\n return num;\n}", "function squareNumber(num){\n return num*num;\n}", "function callbackfn(val, idx, obj) {\n return '[object Math]' === Object.prototype.toString.call(obj);\n}", "function add()\n{ \n return num1 + num2;\n}", "function greaterThan(num1, num2){\n var num1= 5;\n var num2= 10;\n if (num2 > num1){\n return true;\n } else {\n return false;\n }\n}", "function greater (lhs, rhs) {\n return number(lhs) && lhs > rhs;\n }", "function funcion() {\n return numeracion;\n}", "function convert(num) {\n\n\n}", "function returnNum(num1, num2) {\n return num1 + num2;\n}", "function N(){}", "function addition(num) {\n return num + 1;\n}", "function newFunc(num){\n return num + 1;\n}", "function numAdd (num, number) {\nreturn num + number;\n}", "function fun() { }", "function css__NUMBER_ques_(cssPrimitiveType) /* (cssPrimitiveType : cssPrimitiveType) -> bool */ {\n return (cssPrimitiveType === 2);\n}", "function largerNubmer(num1,num2){\r\n if (num1 > num2){\r\n return num1;\r\n }else{\r\n return num2;\r\n }\r\n}", "function largerNum(a,b) {\n if (a>b) \n return a;\n else\n return b;\n}", "function checkfunction(number){\n var num=11;\n console.log(num);\n}", "function addOne(number){\n return number + 1;\n}", "function not_Function() {\r\n document.getElementById(\"not\").innerHTML = ! (10 < 5);//Returns true\r\n}" ]
[ "0.65743196", "0.64378536", "0.62033254", "0.61884373", "0.6116618", "0.60564345", "0.5928299", "0.5924359", "0.59099394", "0.58900404", "0.58700585", "0.5849647", "0.5848096", "0.58336616", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5829366", "0.5818731", "0.58169794", "0.57841426", "0.57822406", "0.5758708", "0.5758231", "0.57476306", "0.5743142", "0.57414436", "0.5725282", "0.5725282", "0.5719768", "0.5702001", "0.56886315", "0.5673441", "0.56701475", "0.5652702", "0.56473196", "0.5638291", "0.5638291", "0.56362927", "0.5633538", "0.5633538", "0.5633538", "0.562624", "0.5613728", "0.56135815", "0.56118864", "0.559968", "0.5598351", "0.5597492", "0.5590837", "0.5579202", "0.5566657", "0.5565717", "0.5564219", "0.5556586", "0.55517614", "0.5543927", "0.5543927", "0.5540789", "0.5535852", "0.5535038", "0.5532949", "0.55250794", "0.55225515", "0.55223036", "0.5519053", "0.5515142", "0.5509616", "0.5509088", "0.55044776", "0.54969627", "0.54955024", "0.54867095", "0.54852086", "0.5484875", "0.5482243", "0.54811716", "0.54783106", "0.54772115", "0.5476731" ]
0.0
-1
wraps the array of syntax objects in the delimiters given by the second argument ([...CSyntax], CSyntax) > [...CSyntax]
function wrapDelim(towrap, delimSyntax) { assert(delimSyntax.token.type === parser.Token.Delimiter, 'expecting a delimiter token'); return syntaxFromToken({ type: parser.Token.Delimiter, value: delimSyntax.token.value, inner: towrap, range: delimSyntax.token.range, startLineNumber: delimSyntax.token.startLineNumber, lineStart: delimSyntax.token.lineStart }, delimSyntax); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SSyntax() {\r\n}", "function newSyntax() {\n foo::bar();\n const { abc } = { ...oneTwoThree };\n return new.target;\n }", "insertImplicitCloseParen() {\n let argListCode = this.slice(\n this.args[0].contentStart, this.args[this.args.length - 1].contentEnd);\n let isArgListMultiline = argListCode.indexOf('\\n') !== -1;\n let lastTokenType = this.lastToken().type;\n if (!isArgListMultiline || lastTokenType === SourceType.RBRACE || lastTokenType === SourceType.RBRACKET) {\n this.insert(this.contentEnd, ')');\n return;\n }\n\n let followingCloseParen = this.getFollowingCloseParenIfExists();\n if (followingCloseParen) {\n this.insert(followingCloseParen.start, ')');\n return;\n }\n\n let { args } = this;\n let lastArg = args[args.length - 1];\n if (lastArg.isMultiline()) {\n // The CoffeeScript compiler will sometimes reject `.` that is starting a\n // new line following a `)` token. Also, in some cases, it will complain\n // about an indentation error if the `)` is too far indented. So handle\n // this case by moving the `.` to be right after the new `)`.\n let nextSemanticToken = this.getFirstSemanticToken(this.contentEnd);\n if (nextSemanticToken && nextSemanticToken.type === SourceType.DOT) {\n this.overwrite(this.outerEnd, nextSemanticToken.start, ')');\n } else {\n this.insert(this.contentEnd, `\\n${this.getIndent()})`);\n }\n return;\n }\n\n this.insert(this.contentEnd, ')');\n }", "function Arr(){ return Literal.apply(this,arguments) }", "function Braces(options) {\n this.options = extend({}, options);\n}", "function Braces(options) {\n this.options = extend({}, options);\n}", "function Braces(options) {\n this.options = extend({}, options);\n}", "function parse(){\n var syntax = esprima.parse(editor.getValue());\n codeArray = [];\n expand(syntax.body, codeArray, 0);\n}", "\":expression, MetaProperty, TemplateLiteral\"(node) {\n let leftToken = sourceCode.getTokenBefore(node);\n let rightToken = sourceCode.getTokenAfter(node);\n let firstToken = sourceCode.getFirstToken(node);\n\n while (isLeftParen(leftToken) && isRightParen(rightToken)) {\n setOffsetToToken(firstToken, 1, leftToken);\n setOffsetToToken(rightToken, 0, leftToken);\n\n firstToken = leftToken;\n leftToken = sourceCode.getTokenBefore(leftToken);\n rightToken = sourceCode.getTokenAfter(rightToken);\n }\n }", "function Lexer(a){this.tokens=[],this.tokens.links={},this.options=a||Marked.defaults,this.rules=block.normal,this.options.gfm&&(this.options.tables?this.rules=block.tables:this.rules=block.gfm)}", "addImplicitBracesAndParens() {\r\n\t\t\t\t\tvar stack, start;\r\n\t\t\t\t\t// Track current balancing depth (both implicit and explicit) on stack.\r\n\t\t\t\t\tstack = [];\r\n\t\t\t\t\tstart = null;\r\n\t\t\t\t\treturn this.scanTokens(function(token, i, tokens) {\r\n\t\t\t\t\t\tvar endImplicitCall, endImplicitObject, forward, implicitObjectContinues, implicitObjectIndent, inControlFlow, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, isImplicit, isImplicitCall, isImplicitObject, k, newLine, nextTag, nextToken, offset, preContinuationLineIndent, preObjectToken, prevTag, prevToken, ref, ref1, ref2, ref3, ref4, ref5, s, sameLine, stackIdx, stackItem, stackNext, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startIndex, startTag, startsLine, tag;\r\n\t\t\t\t\t\t[tag] = token;\r\n\t\t\t\t\t\t[prevTag] = prevToken = i > 0 ? tokens[i - 1] : [];\r\n\t\t\t\t\t\t[nextTag] = nextToken = i < tokens.length - 1 ? tokens[i + 1] : [];\r\n\t\t\t\t\t\tstackTop = function() {\r\n\t\t\t\t\t\t\treturn stack[stack.length - 1];\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tstartIdx = i;\r\n\t\t\t\t\t\t// Helper function, used for keeping track of the number of tokens consumed\r\n\t\t\t\t\t\t// and spliced, when returning for getting a new token.\r\n\t\t\t\t\t\tforward = function(n) {\r\n\t\t\t\t\t\t\treturn i - startIdx + n;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\t// Helper functions\r\n\t\t\t\t\t\tisImplicit = function(stackItem) {\r\n\t\t\t\t\t\t\tvar ref;\r\n\t\t\t\t\t\t\treturn stackItem != null ? (ref = stackItem[2]) != null ? ref.ours : void 0 : void 0;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tisImplicitObject = function(stackItem) {\r\n\t\t\t\t\t\t\treturn isImplicit(stackItem) && (stackItem != null ? stackItem[0] : void 0) === '{';\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tisImplicitCall = function(stackItem) {\r\n\t\t\t\t\t\t\treturn isImplicit(stackItem) && (stackItem != null ? stackItem[0] : void 0) === '(';\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tinImplicit = function() {\r\n\t\t\t\t\t\t\treturn isImplicit(stackTop());\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tinImplicitCall = function() {\r\n\t\t\t\t\t\t\treturn isImplicitCall(stackTop());\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tinImplicitObject = function() {\r\n\t\t\t\t\t\t\treturn isImplicitObject(stackTop());\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\t// Unclosed control statement inside implicit parens (like\r\n\t\t\t\t\t\t// class declaration or if-conditionals).\r\n\t\t\t\t\t\tinImplicitControl = function() {\r\n\t\t\t\t\t\t\tvar ref;\r\n\t\t\t\t\t\t\treturn inImplicit() && ((ref = stackTop()) != null ? ref[0] : void 0) === 'CONTROL';\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tstartImplicitCall = function(idx) {\r\n\t\t\t\t\t\t\tstack.push([\r\n\t\t\t\t\t\t\t\t'(',\r\n\t\t\t\t\t\t\t\tidx,\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tours: true\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\treturn tokens.splice(idx, 0, generate('CALL_START', '(', ['', 'implicit function call', token[2]], prevToken));\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tendImplicitCall = function() {\r\n\t\t\t\t\t\t\tstack.pop();\r\n\t\t\t\t\t\t\ttokens.splice(i, 0, generate('CALL_END', ')', ['', 'end of input', token[2]], prevToken));\r\n\t\t\t\t\t\t\treturn i += 1;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tstartImplicitObject = function(idx, {startsLine = true, continuationLineIndent} = {}) {\r\n\t\t\t\t\t\t\tvar val;\r\n\t\t\t\t\t\t\tstack.push([\r\n\t\t\t\t\t\t\t\t'{',\r\n\t\t\t\t\t\t\t\tidx,\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tsameLine: true,\r\n\t\t\t\t\t\t\t\t\tstartsLine: startsLine,\r\n\t\t\t\t\t\t\t\t\tours: true,\r\n\t\t\t\t\t\t\t\t\tcontinuationLineIndent: continuationLineIndent\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\tval = new String('{');\r\n\t\t\t\t\t\t\tval.generated = true;\r\n\t\t\t\t\t\t\treturn tokens.splice(idx, 0, generate('{', val, token, prevToken));\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tendImplicitObject = function(j) {\r\n\t\t\t\t\t\t\tj = j != null ? j : i;\r\n\t\t\t\t\t\t\tstack.pop();\r\n\t\t\t\t\t\t\ttokens.splice(j, 0, generate('}', '}', token, prevToken));\r\n\t\t\t\t\t\t\treturn i += 1;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\timplicitObjectContinues = (j) => {\r\n\t\t\t\t\t\t\tvar nextTerminatorIdx;\r\n\t\t\t\t\t\t\tnextTerminatorIdx = null;\r\n\t\t\t\t\t\t\tthis.detectEnd(j, function(token) {\r\n\t\t\t\t\t\t\t\treturn token[0] === 'TERMINATOR';\r\n\t\t\t\t\t\t\t}, function(token, i) {\r\n\t\t\t\t\t\t\t\treturn nextTerminatorIdx = i;\r\n\t\t\t\t\t\t\t}, {\r\n\t\t\t\t\t\t\t\treturnOnNegativeLevel: true\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tif (nextTerminatorIdx == null) {\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn this.looksObjectish(nextTerminatorIdx + 1);\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\t// Don’t end an implicit call/object on next indent if any of these are in an argument/value.\r\n\t\t\t\t\t\tif ((inImplicitCall() || inImplicitObject()) && indexOf.call(CONTROL_IN_IMPLICIT, tag) >= 0 || inImplicitObject() && prevTag === ':' && tag === 'FOR') {\r\n\t\t\t\t\t\t\tstack.push([\r\n\t\t\t\t\t\t\t\t'CONTROL',\r\n\t\t\t\t\t\t\t\ti,\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tours: true\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\treturn forward(1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (tag === 'INDENT' && inImplicit()) {\r\n\t\t\t\t\t\t\t// An `INDENT` closes an implicit call unless\r\n\r\n\t\t\t\t\t\t\t// 1. We have seen a `CONTROL` argument on the line.\r\n\t\t\t\t\t\t\t// 2. The last token before the indent is part of the list below.\r\n\t\t\t\t\t\t\tif (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'ELSE' && prevTag !== '=') {\r\n\t\t\t\t\t\t\t\twhile (inImplicitCall() || inImplicitObject() && prevTag !== ':') {\r\n\t\t\t\t\t\t\t\t\tif (inImplicitCall()) {\r\n\t\t\t\t\t\t\t\t\t\tendImplicitCall();\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tendImplicitObject();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (inImplicitControl()) {\r\n\t\t\t\t\t\t\t\tstack.pop();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tstack.push([tag, i]);\r\n\t\t\t\t\t\t\treturn forward(1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Straightforward start of explicit expression.\r\n\t\t\t\t\t\tif (indexOf.call(EXPRESSION_START, tag) >= 0) {\r\n\t\t\t\t\t\t\tstack.push([tag, i]);\r\n\t\t\t\t\t\t\treturn forward(1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Close all implicit expressions inside of explicitly closed expressions.\r\n\t\t\t\t\t\tif (indexOf.call(EXPRESSION_END, tag) >= 0) {\r\n\t\t\t\t\t\t\twhile (inImplicit()) {\r\n\t\t\t\t\t\t\t\tif (inImplicitCall()) {\r\n\t\t\t\t\t\t\t\t\tendImplicitCall();\r\n\t\t\t\t\t\t\t\t} else if (inImplicitObject()) {\r\n\t\t\t\t\t\t\t\t\tendImplicitObject();\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tstack.pop();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tstart = stack.pop();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tinControlFlow = () => {\r\n\t\t\t\t\t\t\tvar controlFlow, isFunc, seenFor, tagCurrentLine;\r\n\t\t\t\t\t\t\tseenFor = this.findTagsBackwards(i, ['FOR']) && this.findTagsBackwards(i, ['FORIN', 'FOROF', 'FORFROM']);\r\n\t\t\t\t\t\t\tcontrolFlow = seenFor || this.findTagsBackwards(i, ['WHILE', 'UNTIL', 'LOOP', 'LEADING_WHEN']);\r\n\t\t\t\t\t\t\tif (!controlFlow) {\r\n\t\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tisFunc = false;\r\n\t\t\t\t\t\t\ttagCurrentLine = token[2].first_line;\r\n\t\t\t\t\t\t\tthis.detectEnd(i, function(token, i) {\r\n\t\t\t\t\t\t\t\tvar ref;\r\n\t\t\t\t\t\t\t\treturn ref = token[0], indexOf.call(LINEBREAKS, ref) >= 0;\r\n\t\t\t\t\t\t\t}, function(token, i) {\r\n\t\t\t\t\t\t\t\tvar first_line;\r\n\t\t\t\t\t\t\t\t[prevTag, , {first_line}] = tokens[i - 1] || [];\r\n\t\t\t\t\t\t\t\treturn isFunc = tagCurrentLine === first_line && (prevTag === '->' || prevTag === '=>');\r\n\t\t\t\t\t\t\t}, {\r\n\t\t\t\t\t\t\t\treturnOnNegativeLevel: true\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\treturn isFunc;\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\t// Recognize standard implicit calls like\r\n\t\t\t\t\t\t// f a, f() b, f? c, h[0] d etc.\r\n\t\t\t\t\t\t// Added support for spread dots on the left side: f ...a\r\n\t\t\t\t\t\tif ((indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || (nextTag === '...' && (ref = this.tag(i + 2), indexOf.call(IMPLICIT_CALL, ref) >= 0) && !this.findTagsBackwards(i, ['INDEX_START', '['])) || indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !nextToken.spaced && !nextToken.newLine) && !inControlFlow()) {\r\n\t\t\t\t\t\t\tif (tag === '?') {\r\n\t\t\t\t\t\t\t\ttag = token[0] = 'FUNC_EXIST';\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tstartImplicitCall(i + 1);\r\n\t\t\t\t\t\t\treturn forward(2);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Implicit call taking an implicit indented object as first argument.\r\n\r\n\t\t\t\t\t\t// f\r\n\t\t\t\t\t\t// a: b\r\n\t\t\t\t\t\t// c: d\r\n\r\n\t\t\t\t\t\t// Don’t accept implicit calls of this type, when on the same line\r\n\t\t\t\t\t\t// as the control structures below as that may misinterpret constructs like:\r\n\r\n\t\t\t\t\t\t// if f\r\n\t\t\t\t\t\t// a: 1\r\n\t\t\t\t\t\t// as\r\n\r\n\t\t\t\t\t\t// if f(a: 1)\r\n\r\n\t\t\t\t\t\t// which is probably always unintended.\r\n\t\t\t\t\t\t// Furthermore don’t allow this in the first line of a literal array\r\n\t\t\t\t\t\t// or explicit object, as that creates grammatical ambiguities (#5368).\r\n\t\t\t\t\t\tif (indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.indexOfTag(i + 1, 'INDENT') > -1 && this.looksObjectish(i + 2) && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL']) && !(((ref1 = (s = (ref2 = stackTop()) != null ? ref2[0] : void 0)) === '{' || ref1 === '[') && !isImplicit(stackTop()) && this.findTagsBackwards(i, s))) {\r\n\t\t\t\t\t\t\tstartImplicitCall(i + 1);\r\n\t\t\t\t\t\t\tstack.push(['INDENT', i + 2]);\r\n\t\t\t\t\t\t\treturn forward(3);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Implicit objects start here.\r\n\t\t\t\t\t\tif (tag === ':') {\r\n\t\t\t\t\t\t\t// Go back to the (implicit) start of the object.\r\n\t\t\t\t\t\t\ts = (function() {\r\n\t\t\t\t\t\t\t\tvar ref3;\r\n\t\t\t\t\t\t\t\tswitch (false) {\r\n\t\t\t\t\t\t\t\t\tcase ref3 = this.tag(i - 1), indexOf.call(EXPRESSION_END, ref3) < 0:\r\n\t\t\t\t\t\t\t\t\t\t[startTag, startIndex] = start;\r\n\t\t\t\t\t\t\t\t\t\tif (startTag === '[' && startIndex > 0 && this.tag(startIndex - 1) === '@' && !tokens[startIndex - 1].spaced) {\r\n\t\t\t\t\t\t\t\t\t\t\treturn startIndex - 1;\r\n\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\treturn startIndex;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t\tcase this.tag(i - 2) !== '@':\r\n\t\t\t\t\t\t\t\t\t\treturn i - 2;\r\n\t\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\t\treturn i - 1;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}).call(this);\r\n\t\t\t\t\t\t\tstartsLine = s <= 0 || (ref3 = this.tag(s - 1), indexOf.call(LINEBREAKS, ref3) >= 0) || tokens[s - 1].newLine;\r\n\t\t\t\t\t\t\t// Are we just continuing an already declared object?\r\n\t\t\t\t\t\t\t// Including the case where we indent on the line after an explicit '{'.\r\n\t\t\t\t\t\t\tif (stackTop()) {\r\n\t\t\t\t\t\t\t\t[stackTag, stackIdx] = stackTop();\r\n\t\t\t\t\t\t\t\tstackNext = stack[stack.length - 2];\r\n\t\t\t\t\t\t\t\tif ((stackTag === '{' || stackTag === 'INDENT' && (stackNext != null ? stackNext[0] : void 0) === '{' && !isImplicit(stackNext) && this.findTagsBackwards(stackIdx - 1, ['{'])) && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{') && (ref4 = this.tag(s - 1), indexOf.call(UNFINISHED, ref4) < 0)) {\r\n\t\t\t\t\t\t\t\t\treturn forward(1);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tpreObjectToken = i > 1 ? tokens[i - 2] : [];\r\n\t\t\t\t\t\t\tstartImplicitObject(s, {\r\n\t\t\t\t\t\t\t\tstartsLine: !!startsLine,\r\n\t\t\t\t\t\t\t\tcontinuationLineIndent: preObjectToken.continuationLineIndent\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\treturn forward(2);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// End implicit calls when chaining method calls\r\n\t\t\t\t\t\t// like e.g.:\r\n\r\n\t\t\t\t\t\t// f ->\r\n\t\t\t\t\t\t// a\r\n\t\t\t\t\t\t// .g b, ->\r\n\t\t\t\t\t\t// c\r\n\t\t\t\t\t\t// .h a\r\n\r\n\t\t\t\t\t\t// and also\r\n\r\n\t\t\t\t\t\t// f a\r\n\t\t\t\t\t\t// .g b\r\n\t\t\t\t\t\t// .h a\r\n\r\n\t\t\t\t\t\t// Mark all enclosing objects as not sameLine\r\n\t\t\t\t\t\tif (indexOf.call(LINEBREAKS, tag) >= 0) {\r\n\t\t\t\t\t\t\tfor (k = stack.length - 1; k >= 0; k += -1) {\r\n\t\t\t\t\t\t\t\tstackItem = stack[k];\r\n\t\t\t\t\t\t\t\tif (!isImplicit(stackItem)) {\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (isImplicitObject(stackItem)) {\r\n\t\t\t\t\t\t\t\t\tstackItem[2].sameLine = false;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// End indented-continuation-line implicit objects once that indentation is over.\r\n\t\t\t\t\t\tif (tag === 'TERMINATOR' && token.endsContinuationLineIndentation) {\r\n\t\t\t\t\t\t\t({preContinuationLineIndent} = token.endsContinuationLineIndentation);\r\n\t\t\t\t\t\t\twhile (inImplicitObject() && ((implicitObjectIndent = stackTop()[2].continuationLineIndent) != null) && implicitObjectIndent > preContinuationLineIndent) {\r\n\t\t\t\t\t\t\t\tendImplicitObject();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnewLine = prevTag === 'OUTDENT' || prevToken.newLine;\r\n\t\t\t\t\t\tif (indexOf.call(IMPLICIT_END, tag) >= 0 || (indexOf.call(CALL_CLOSERS, tag) >= 0 && newLine) || ((tag === '..' || tag === '...') && this.findTagsBackwards(i, [\"INDEX_START\"]))) {\r\n\t\t\t\t\t\t\twhile (inImplicit()) {\r\n\t\t\t\t\t\t\t\t[stackTag, stackIdx, {sameLine, startsLine}] = stackTop();\r\n\t\t\t\t\t\t\t\t// Close implicit calls when reached end of argument list\r\n\t\t\t\t\t\t\t\tif (inImplicitCall() && prevTag !== ',' || (prevTag === ',' && tag === 'TERMINATOR' && (nextTag == null))) {\r\n\t\t\t\t\t\t\t\t\tendImplicitCall();\r\n\t\t\t\t\t\t\t\t// Close implicit objects such as:\r\n\t\t\t\t\t\t\t\t// return a: 1, b: 2 unless true\r\n\t\t\t\t\t\t\t\t} else if (inImplicitObject() && sameLine && tag !== 'TERMINATOR' && prevTag !== ':' && !((tag === 'POST_IF' || tag === 'FOR' || tag === 'WHILE' || tag === 'UNTIL') && startsLine && implicitObjectContinues(i + 1))) {\r\n\t\t\t\t\t\t\t\t\tendImplicitObject();\r\n\t\t\t\t\t\t\t\t// Close implicit objects when at end of line, line didn't end with a comma\r\n\t\t\t\t\t\t\t\t// and the implicit object didn't start the line or the next line doesn’t look like\r\n\t\t\t\t\t\t\t\t// the continuation of an object.\r\n\t\t\t\t\t\t\t\t} else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) {\r\n\t\t\t\t\t\t\t\t\tendImplicitObject();\r\n\t\t\t\t\t\t\t\t} else if (inImplicitControl() && tokens[stackTop()[1]][0] === 'CLASS' && tag === 'TERMINATOR') {\r\n\t\t\t\t\t\t\t\t\tstack.pop();\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Close implicit object if comma is the last character\r\n\t\t\t\t\t\t// and what comes after doesn’t look like it belongs.\r\n\t\t\t\t\t\t// This is used for trailing commas and calls, like:\r\n\r\n\t\t\t\t\t\t// x =\r\n\t\t\t\t\t\t// a: b,\r\n\t\t\t\t\t\t// c: d,\r\n\t\t\t\t\t\t// e = 2\r\n\r\n\t\t\t\t\t\t// and\r\n\r\n\t\t\t\t\t\t// f a, b: c, d: e, f, g: h: i, j\r\n\r\n\t\t\t\t\t\tif (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && !((ref5 = this.tag(i + 2)) === 'FOROF' || ref5 === 'FORIN') && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) {\r\n\t\t\t\t\t\t\t// When nextTag is OUTDENT the comma is insignificant and\r\n\t\t\t\t\t\t\t// should just be ignored so embed it in the implicit object.\r\n\r\n\t\t\t\t\t\t\t// When it isn’t the comma go on to play a role in a call or\r\n\t\t\t\t\t\t\t// array further up the stack, so give it a chance.\r\n\t\t\t\t\t\t\toffset = nextTag === 'OUTDENT' ? 1 : 0;\r\n\t\t\t\t\t\t\twhile (inImplicitObject()) {\r\n\t\t\t\t\t\t\t\tendImplicitObject(i + offset);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn forward(1);\r\n\t\t\t\t\t});\r\n\t\t\t\t}", "function compile(markup) {\n var loc = 0,\n inBlock = TRUE,\n stack = [],\n top = [],\n content = top,\n current = [, , top];\n\n function pushPreceedingContent(shift) {\n shift -= loc;\n if (shift) {\n var text = markup.substr(loc, shift).replace(/\\n/g, \"\\\\n\");\n if (inBlock) {\n content.push(text);\n } else {\n if (!text.split('\"').length % 2) {\n // This is a {{ or }} within a string parameter, so skip parsing. (Leave in string)\n return TRUE;\n }\n //( path\tor \t\\\"string\\\" )\t or ( path = ( path or \\\"string\\\" )\n (text + \" \").replace(/([\\w\\$\\.\\[\\]]+|(\\\\?['\"])(.*?)\\2)(?=\\s)|([\\w\\$\\.\\[\\]]+)\\=([\\w\\$\\.\\[\\]]+|\\\\(['\"]).*?\\\\\\6)(?=\\s)/g,\n function (all, path, quot, string, lhs, rhs, quot2) {\n content.push(path ? path : [lhs, rhs]); // lhs and rhs are for named params\n }\n );\n }\n }\n }\n\n // Build abstract syntax tree: [ tag, params, content, encoding ]\n markup = markup\n .replace(/\\\\'|'/g, \"\\\\\\'\").replace(/\\\\\"|\"/g, \"\\\\\\\"\") //escape ', and \"\n .split(/\\s+/g).join(\" \") // collapse white-space\n .replace(/^\\s+/, \"\") // trim left\n .replace(/\\s+$/, \"\"); // trim right;\n\n //\t\t\t\t\t {{\t\t #\t\ttag\t\t\t\t\t\t\tsingleCharTag\t\t\t\t\t\t\tcode\t\t\t\t\t\t !encoding endTag\t\t{{/closeBlock}}\n markup.replace(/(?:\\{\\{(?:(\\#)?([\\w\\$\\.\\[\\]]+(?=[\\s\\}!]))|([^\\/\\*\\>$\\w\\s\\d\\x7f\\x00-\\x1f](?=[\\s\\w\\$\\[]))|\\*((?:[^\\}]|\\}(?!\\}))+)\\}\\}))|(!(\\w*))?(\\}\\})|(?:\\{\\{\\/([\\w\\$\\.\\[\\]]+)\\}\\})/g,\n function (all, isBlock, tagName, singleCharTag, code, useEncode, encoding, endTag, closeBlock, index) {\n tagName = tagName || singleCharTag;\n if (inBlock && endTag || pushPreceedingContent(index)) {\n return;\n }\n if (code) {\n if (viewsNs.allowCode) {\n content.push([\"*\", code.replace(/\\\\(['\"])/g, \"$1\")]); // unescape ', and \"\n }\n } else if (tagName) {\n if (tagName === \"else\") {\n current = stack.pop();\n content = current[2];\n isBlock = TRUE;\n }\n stack.push(current);\n content.push(current = [tagName, [], isBlock && 1]);\n } else if (endTag) {\n current[3] = useEncode ? encoding || \"none\" : \"\";\n if (current[2]) {\n current[2] = [];\n } else {\n current = stack.pop();\n }\n } else if (closeBlock) {\n current = stack.pop();\n }\n loc = index + all.length; // location marker - parsed up to here\n inBlock = !tagName && current[2] && current[2] !== 1;\n content = current[inBlock ? 2 : 1];\n });\n\n pushPreceedingContent(markup.length);\n\n return buildTmplFunction(top);\n }", "function _Syntax(name){\n this.name = name;\n this.codeBase = [];\n }", "function Braces(options) {\n this.options = extendShallow$2({}, options);\n}", "function L(...args) { if (TextBracket.DEBUG) Vex.L('Vex.Flow.TextBracket', args); }", "static of(token, stx) {\n\t return new Syntax(token, stx);\n\t }", "function it(type, value, quote) {\n var id, the_token;\n if (type === '(string)' || type === '(range)') {\n if (jx.test(value)) {\n warn_at(bundle.url, line, from);\n }\n }\n the_token = Object.create(syntax[(\n type === '(punctuator)' ||\n (type === '(identifier)' && is_own(syntax, value)) ?\n value :\n type\n )] || syntax['(error)']);\n if (type === '(identifier)') {\n the_token.identifier = true;\n if (value === '__iterator__' || value === '__proto__') {\n fail_at(bundle.reserved_a, line, from, value);\n } else if (option.nomen &&\n (value.charAt(0) === '_' ||\n value.charAt(value.length - 1) === '_')) {\n warn_at(bundle.dangling_a, line, from, value);\n }\n }\n if (value !== undefined) {\n the_token.value = value;\n }\n if (quote) {\n the_token.quote = quote;\n }\n if (comments) {\n the_token.comments = comments;\n comments = null;\n }\n the_token.line = line;\n the_token.from = from;\n the_token.thru = character;\n the_token.prev = older_token;\n id = the_token.id;\n prereg = id && (\n ('(,=:[!&|?{};'.indexOf(id.charAt(id.length - 1)) >= 0) ||\n id === 'return'\n );\n older_token.next = the_token;\n older_token = the_token;\n return the_token;\n }", "function wrap$2(arr, sep, opts) {\n if (sep === '~') { sep = '-'; }\n var str = arr.join(sep);\n var pre = opts && opts.regexPrefix;\n\n // regex logical `or`\n if (sep === '|') {\n str = pre ? pre + str : str;\n str = '(' + str + ')';\n }\n\n // regex character class\n if (sep === '-') {\n str = (pre && pre === '^')\n ? pre + str\n : str;\n str = '[' + str + ']';\n }\n return [str];\n}", "function Brackets( obj ){\n\t\t\tvar data = typeof obj === \"object\" ? obj : {},\n\t\t\t\tregexFirst = typeof data.regexFirst === 'boolean' ? data.regexFirst : Settings.regexFirst,\n\t\t\t\tcloseFirst = typeof data.closeFirst === 'boolean' ? data.closeFirst : Settings.closeFirst,\n\t\t\t\topenTagSources = [],\n\t\t\t\tcloseTagSources = [],\n\t\t\t\tcontentList = [],\n\t\t\t\tmatesList = [];\n\t\t\t\t\n\t\t\t//to add a Mates Object to the matesList and the sources to the Tags Source arrays\n\t\t\tfunction addMatesObject( open, close ){\n\t\t\t\tvar obj = buildMates( open, close, regexFirst );\n\t\t\t\t\n\t\t\t\tmatesList.push( obj );\n\t\t\t\tobj.OpenTags.addSourceTo( openTagSources );\n\t\t\t\tobj.CloseTags.addSourceTo( closeTagSources );\n\t\t\t}\n\t\t\t\n\t\t\t//to create a new bracket from a mate pair\n\t\t\tfunction addMate( mate ){\n\t\t\t\tif( isArray( mate ) ) addMatesObject( mate[0], mate[1] );\n\t\t\t}\n\t\t\t\n\t\t\t//to add content to the content list (only if it is a Brackets object)\n\t\t\tfunction addToContentBrackets( obj ){\n\t\t\t\tif( isArray( obj ) ) obj.forEach( addToContentBrackets );\n\t\t\t\telse if( obj instanceof Brackets ) contentList.push( obj );\n\t\t\t}\n\t\t\t\n\t\t\t//create each Mates object and add to the Mates List\n\t\t\tif( 'mates' in data && isArray( data.mates ) ) data.mates.forEach( addMate );\n\t\t\telse if( 'mate' in data ) addMate( data.mate );\n\t\t\telse addMatesObject( data.open, data.close );\n\t\t\t\n\t\t\t//add each Content Bracket to the Content Brackets List\n\t\t\taddToContentBrackets( data.content );\n\t\t\t\n\t\t\t//to define the properties of this Brackets\n\t\t\tthis.label = data.label || '';\n\t\t\tthis.autoOpen = data.autoOpen instanceof Brackets ? data.autoOpen : Settings.autoOpen;\n\t\t\tthis.EscapeManager = 'escape' in data ? buildEscapeManager( compileRegexList( data.escape, regexFirst ) ) : buildEscapeManager( Settings.escape );\n\t\t\tthis.rejectUnexpectedClose = typeof data.rejectUnexpectedClose === 'boolean' ? data.rejectUnexpectedClose : Settings.rejectUnexpectedClose;\n\t\t\tthis.removeUnmatchedTokens = typeof data.removeUnmatchedTokens === 'boolean' ? data.removeUnmatchedTokens : Settings.removeUnmatchedTokens;\n\t\t\tthis.stripEscapes = typeof data.stripEscapes === 'boolean' ? data.stripEscapes : Settings.stripEscapes;\n\t\t\tthis.eofClose = typeof data.eofClose === 'boolean' ? data.eofClose : Settings.eofClose;\n\t\t\tthis.handle = typeof data.handle === \"function\" ? data.handle : Settings.nestHandle;\n\t\t\tthis.stringHandle = typeof data.stringHandle === \"function\" ? data.stringHandle : Settings.stringHandle;\n\t\t\tthis.openIf = typeof data.openIf === \"function\" ? data.openIf : Settings.openIf;\n\t\t\tthis.closeIf = typeof data.closeIf === \"function\" ? data.closeIf : Settings.closeIf;\n\t\t\tthis.WordBoundaryManager = new WordBoundaryManager( data.wordBoundary, compileRegexList( data.wordRegex, regexFirst ) );\n\t\t\t\n\t\t\t//To add the given Brackets object as content to these Brackets\n\t\t\tthis.addContent = function(){\n\t\t\t\tvar args = Array.prototype.slice.apply( arguments );\n\t\t\t\targs.forEach( addToContentBrackets );\n\t\t\t};\n\t\t\t\n\t\t\t//combine all Mate Open and Close tags each into a single Tag Manager object\n\t\t\tthis.OpenTags = buildTagManager( openTagSources );\n\t\t\tthis.CloseTags = buildTagManager( closeTagSources );\n\t\t\t\n\t\t\t//to create a new Content Manager based on the given Open Tag\n\t\t\tthis.getContentManager = function( tag, parent ){\n\t\t\t\t\n\t\t\t\tvar currentMate, CloseTags;\n\t\t\t\t\n\t\t\t\t//if no parent, then it can't close\n\t\t\t\tif( !parent ) return buildContentManager( contentList, null, closeFirst );\n\t\t\t\t\n\t\t\t\t//Get the current mate based on the open tag\n\t\t\t\t//if there is no open tag, then return the first mate\n\t\t\t\tvar currentMate = tag ? findOpenMatch( tag, matesList ) : matesList[0],\n\t\t\t\t\tCloseTags = currentMate ? currentMate.CloseTags : null;\n\t\t\t\t\t\n\t\t\t\treturn buildContentManager( contentList, CloseTags, closeFirst );\n\t\t\t}\n\t\t\t\n\t\t\t/*\n\t\t\tTo see if the given str is valid\n\t\t\tValid if:\n\t\t\t\t- prevStr does not end with escape AND\n\t\t\t\t- there is a no word boundary error\n\t\t\t*/\n\t\t\tthis.isValid = function( prevStr, str, nextStr ){\n\t\t\t\treturn !this.EscapeManager.isMatch( prevStr ) && this.WordBoundaryManager.isValid( prevStr, str, nextStr );\n\t\t\t}\n\t\t}", "function wrap$1(arr, sep, opts) {\n if (sep === '~') { sep = '-'; }\n var str = arr.join(sep);\n var pre = opts && opts.regexPrefix;\n\n // regex logical `or`\n if (sep === '|') {\n str = pre ? pre + str : str;\n str = '(' + str + ')';\n }\n\n // regex character class\n if (sep === '-') {\n str = (pre && pre === '^')\n ? pre + str\n : str;\n str = '[' + str + ']';\n }\n return [str];\n}", "function tokenizeOpenedParenthesis(state) {\n var nextSymbolCode = state.css.charCodeAt(state.pos + 1);\n var tokensCount = state.tokens.length;\n var prevTokenCssPart = tokensCount ? state.tokens[tokensCount - 1][1] : '';\n\n if (prevTokenCssPart === 'url' && nextSymbolCode !== _globals.singleQuote && nextSymbolCode !== _globals.doubleQuote && nextSymbolCode !== _globals.space && nextSymbolCode !== _globals.newline && nextSymbolCode !== _globals.tab && nextSymbolCode !== _globals.feed && nextSymbolCode !== _globals.carriageReturn) {\n state.nextPos = state.pos;\n\n do {\n state.escaped = false;\n state.nextPos = state.css.indexOf(')', state.nextPos + 1);\n\n if (state.nextPos === -1) {\n (0, _unclosed2.default)(state, 'bracket');\n }\n\n state.escapePos = state.nextPos;\n\n while (state.css.charCodeAt(state.escapePos - 1) === _globals.backslash) {\n state.escapePos -= 1;\n state.escaped = !state.escaped;\n }\n } while (state.escaped);\n\n state.tokens.push(['brackets', state.css.slice(state.pos, state.nextPos + 1), state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);\n state.pos = state.nextPos;\n } else {\n state.nextPos = findClosedParenthesisPosition(state.css, state.length, state.pos);\n state.cssPart = state.css.slice(state.pos, state.nextPos + 1);\n\n var foundParam = state.cssPart.indexOf('@') >= 0;\n var foundString = /['\"]/.test(state.cssPart);\n\n if (state.cssPart.length === 0 || state.cssPart === '...' || foundParam && !foundString) {\n // we're dealing with a mixin param block\n if (state.nextPos === -1) {\n (0, _unclosed2.default)(state, 'bracket');\n }\n\n state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);\n } else {\n var badBracket = _globals.badBracketPattern.test(state.cssPart);\n\n if (state.nextPos === -1 || badBracket) {\n state.tokens.push([state.symbol, state.symbol, state.line, state.pos - state.offset]);\n } else {\n state.tokens.push(['brackets', state.cssPart, state.line, state.pos - state.offset, state.line, state.nextPos - state.offset]);\n state.pos = state.nextPos;\n }\n }\n }\n}", "function cl (...texto) {console.log (...texto)}", "function cl (...texto) {console.log (...texto)}", "function cl (...texto) {console.log (...texto)}", "function\n// a\nf\n// b\n(\n// c\nx\n// d\n,\n// e\ny\n// f\n)\n// g\n{\n// h\n;\n// i\n;\n// j\n}", "function addSyntax(path){\n var jsonObject = _load(path);\n let jsonKey = Object.keys(jsonObject);\n var bold = \"\"\n ,color = \"\"\n ,type = \"\";\n syntax[jsonKey] = new _Syntax(jsonKey[0]);\n for(var i = 0; i < jsonObject[jsonKey].length; i++){\n Object.keys(jsonObject[jsonKey][i]).map(function(objectKey, index) {\n var value = jsonObject[jsonKey][i][objectKey];\n \n if(objectKey==\"bold\"){\n bold = value;\n }\n if(objectKey==\"color\"){\n color = value;\n }\n if(objectKey==\"type\"){\n type = value;\n } \n if(typeof value ==\"object\"){\n Object.keys(value).map(function(tagKey, indexTag) {\n var value = jsonObject[jsonKey][i][objectKey][tagKey];\n syntax[jsonKey].add(value.name, bold, color, type);\n });\n }\n });\n };\n _addStyle(jsonObject);\n }", "function scssTokenize(input) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var css = input.css.valueOf();\n var ignore = options.ignoreErrors;\n\n var code = void 0,\n next = void 0,\n quote = void 0,\n lines = void 0,\n last = void 0,\n content = void 0,\n escape = void 0,\n nextLine = void 0,\n nextOffset = void 0,\n escaped = void 0,\n escapePos = void 0,\n prev = void 0,\n n = void 0,\n currentToken = void 0;\n\n var brackets = void 0; // SCSS PATCH\n\n var length = css.length;\n var offset = -1;\n var line = 1;\n var pos = 0;\n var buffer = [];\n var returned = [];\n\n function unclosed(what) {\n throw input.error('Unclosed ' + what, line, pos - offset);\n }\n\n function endOfFile() {\n return returned.length === 0 && pos >= length;\n }\n\n function nextToken() {\n if (returned.length) return returned.pop();\n if (pos >= length) return;\n\n code = css.charCodeAt(pos);\n if (code === NEWLINE || code === FEED || code === CR && css.charCodeAt(pos + 1) !== NEWLINE) {\n offset = pos;\n line += 1;\n }\n\n switch (code) {\n case NEWLINE:\n case SPACE:\n case TAB:\n case CR:\n case FEED:\n next = pos;\n do {\n next += 1;\n code = css.charCodeAt(next);\n if (code === NEWLINE) {\n offset = next;\n line += 1;\n }\n } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);\n\n currentToken = ['space', css.slice(pos, next)];\n pos = next - 1;\n break;\n\n case OPEN_SQUARE:\n currentToken = ['[', '[', line, pos - offset];\n break;\n\n case CLOSE_SQUARE:\n currentToken = [']', ']', line, pos - offset];\n break;\n\n case OPEN_CURLY:\n currentToken = ['{', '{', line, pos - offset];\n break;\n\n case CLOSE_CURLY:\n currentToken = ['}', '}', line, pos - offset];\n break;\n\n // SCSS PATCH {\n case COMMA:\n currentToken = ['word', ',', line, pos - offset, line, pos - offset + 1];\n break;\n // } SCSS PATCH\n\n case COLON:\n currentToken = [':', ':', line, pos - offset];\n break;\n\n case SEMICOLON:\n currentToken = [';', ';', line, pos - offset];\n break;\n\n case OPEN_PARENTHESES:\n prev = buffer.length ? buffer.pop()[1] : '';\n n = css.charCodeAt(pos + 1);\n if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {\n // SCSS PATCH {\n brackets = 1;\n escaped = false;\n next = pos + 1;\n while (next <= css.length - 1) {\n n = css.charCodeAt(next);\n if (n === BACKSLASH) {\n escaped = !escaped;\n } else if (n === OPEN_PARENTHESES) {\n brackets += 1;\n } else if (n === CLOSE_PARENTHESES) {\n brackets -= 1;\n if (brackets === 0) break;\n }\n next += 1;\n }\n // } SCSS PATCH\n\n currentToken = ['brackets', css.slice(pos, next + 1), line, pos - offset, line, next - offset];\n\n pos = next;\n } else {\n next = css.indexOf(')', pos + 1);\n content = css.slice(pos, next + 1);\n\n if (next === -1 || RE_BAD_BRACKET.test(content)) {\n currentToken = ['(', '(', line, pos - offset];\n } else {\n currentToken = ['brackets', content, line, pos - offset, line, next - offset];\n pos = next;\n }\n }\n\n break;\n\n case CLOSE_PARENTHESES:\n currentToken = [')', ')', line, pos - offset];\n break;\n\n case SINGLE_QUOTE:\n case DOUBLE_QUOTE:\n quote = code === SINGLE_QUOTE ? '\\'' : '\"';\n next = pos;\n do {\n escaped = false;\n next = css.indexOf(quote, next + 1);\n if (next === -1) {\n if (ignore) {\n next = pos + 1;\n break;\n } else {\n unclosed('string');\n }\n }\n escapePos = next;\n while (css.charCodeAt(escapePos - 1) === BACKSLASH) {\n escapePos -= 1;\n escaped = !escaped;\n }\n } while (escaped);\n\n content = css.slice(pos, next + 1);\n lines = content.split('\\n');\n last = lines.length - 1;\n\n if (last > 0) {\n nextLine = line + last;\n nextOffset = next - lines[last].length;\n } else {\n nextLine = line;\n nextOffset = offset;\n }\n\n currentToken = ['string', css.slice(pos, next + 1), line, pos - offset, nextLine, next - nextOffset];\n\n offset = nextOffset;\n line = nextLine;\n pos = next;\n break;\n\n case AT:\n RE_AT_END.lastIndex = pos + 1;\n RE_AT_END.test(css);\n if (RE_AT_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_AT_END.lastIndex - 2;\n }\n\n currentToken = ['at-word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];\n\n pos = next;\n break;\n\n case BACKSLASH:\n next = pos;\n escape = true;\n while (css.charCodeAt(next + 1) === BACKSLASH) {\n next += 1;\n escape = !escape;\n }\n code = css.charCodeAt(next + 1);\n if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {\n next += 1;\n }\n\n currentToken = ['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];\n\n pos = next;\n break;\n\n default:\n // SCSS PATCH {\n n = css.charCodeAt(pos + 1);\n\n if (code === HASH && n === OPEN_CURLY) {\n var deep = 1;\n next = pos;\n while (deep > 0) {\n next += 1;\n if (css.length <= next) unclosed('interpolation');\n\n code = css.charCodeAt(next);\n n = css.charCodeAt(next + 1);\n\n if (code === CLOSE_CURLY) {\n deep -= 1;\n } else if (code === HASH && n === OPEN_CURLY) {\n deep += 1;\n }\n }\n\n content = css.slice(pos, next + 1);\n lines = content.split('\\n');\n last = lines.length - 1;\n\n if (last > 0) {\n nextLine = line + last;\n nextOffset = next - lines[last].length;\n } else {\n nextLine = line;\n nextOffset = offset;\n }\n\n currentToken = ['word', content, line, pos - offset, nextLine, next - nextOffset];\n\n offset = nextOffset;\n line = nextLine;\n pos = next;\n } else if (code === SLASH && n === ASTERISK) {\n // } SCSS PATCH\n next = css.indexOf('*/', pos + 2) + 1;\n if (next === 0) {\n if (ignore) {\n next = css.length;\n } else {\n unclosed('comment');\n }\n }\n\n content = css.slice(pos, next + 1);\n lines = content.split('\\n');\n last = lines.length - 1;\n\n if (last > 0) {\n nextLine = line + last;\n nextOffset = next - lines[last].length;\n } else {\n nextLine = line;\n nextOffset = offset;\n }\n\n currentToken = ['comment', content, line, pos - offset, nextLine, next - nextOffset];\n\n offset = nextOffset;\n line = nextLine;\n pos = next;\n\n // SCSS PATCH {\n } else if (code === SLASH && n === SLASH) {\n RE_NEW_LINE.lastIndex = pos + 1;\n RE_NEW_LINE.test(css);\n if (RE_NEW_LINE.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_NEW_LINE.lastIndex - 2;\n }\n\n content = css.slice(pos, next + 1);\n\n currentToken = ['comment', content, line, pos - offset, line, next - offset, 'inline'];\n\n pos = next;\n // } SCSS PATCH\n } else {\n RE_WORD_END.lastIndex = pos + 1;\n RE_WORD_END.test(css);\n if (RE_WORD_END.lastIndex === 0) {\n next = css.length - 1;\n } else {\n next = RE_WORD_END.lastIndex - 2;\n }\n\n currentToken = ['word', css.slice(pos, next + 1), line, pos - offset, line, next - offset];\n\n buffer.push(currentToken);\n\n pos = next;\n }\n\n break;\n }\n\n pos++;\n return currentToken;\n }\n\n function back(token) {\n returned.push(token);\n }\n\n return {\n back: back,\n nextToken: nextToken,\n endOfFile: endOfFile\n };\n}", "function highlight() {\n var code_blocks = document.body.getElementsByClassName(\"language-c\");\n var keywords = [\n \"auto\", \"break\", \"case\", \"char\", \"const\", \"continue\", \"default\",\n \"do\", \"double\", \"else\", \"enum\", \"extern\", \"float\", \"for\", \"goto\",\n \"if\", \"inline\", \"int\", \"long\", \"register\", \"restrict\", \"return\",\n \"short\", \"signed\", \"sizeof\", \"static\", \"struct\", \"switch\",\n \"typedef\", \"union\", \"unsigned\", \"void\", \"volatile\", \"while\",\n ];\n var regex_var = /\\b[A-z][A-z0-9]*/;\n var regex_number = /\\b0[xX][0-9a-fA-F]+\\b|\\b[0-9]*\\.[0-9]+\\b|\\b[0-9]*\\b/;\n var regex_string = /\"[^\"]*\"/;\n var regex_symbol = /&gt;|&lt;|\\ |\\(|\\)|;|-/;\n for (var i = 0; i < code_blocks.length; i++) {\n var element = code_blocks.item(i);\n var code_lines = element.innerHTML.split('\\n');\n var cursor = 0;\n\n var parts = [];\n var insert_index = 0;\n function insert_at(index, insertable) {\n if (index < insert_index) console.error(\"inserting before last insert!!\");\n parts.push(element.innerHTML.substr(insert_index, index - insert_index));\n parts.push(insertable);\n insert_index = index;\n }\n\n var in_block_comment = false;\n\n for (var j = 0; j < code_lines.length; j++) {\n var words = code_lines[j].split(regex_symbol);\n var in_line_comment = false;\n\n for (var k = 0; k < words.length; k++) {\n var word = words[k];\n\n // Special case for < and >, because they're escaped in\n // innerHTML.\n var to_be_processed_html = element.innerHTML.substr(cursor);\n if (to_be_processed_html.startsWith(\"lt;\") ||\n to_be_processed_html.startsWith(\"gt;\")) {\n cursor += 3;\n }\n\n if (in_block_comment) {\n if (word == \"*/\") {\n in_block_comment = false;\n insert_at(cursor + word.length, \"</span>\"); // close comment block\n }\n } else {\n if (!in_line_comment) {\n if (word == \"//\") {\n in_line_comment = true;\n insert_at(cursor, \"<span class='syntax-comment'>\"); // open comment line\n }\n if (word == \"/*\") {\n in_block_comment = true;\n insert_at(cursor, \"<span class='syntax-comment'>\"); // open comment block\n }\n }\n\n if (!in_line_comment && !in_block_comment) {\n if (keywords.indexOf(word) != -1) {\n insert_at(cursor, \"<span class='syntax-keyword'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_string.test(word)) {\n insert_at(cursor, \"<span class='syntax-string'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_var.test(word) && element.innerHTML.substr(cursor + word.length, 1) == \"(\") {\n insert_at(cursor, \"<span class='syntax-call'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_var.test(word)) {\n insert_at(cursor, \"<span class='syntax-variable'>\");\n insert_at(cursor + word.length, \"</span>\");\n } else if (regex_number.test(word)) {\n insert_at(cursor, \"<span class='syntax-number'>\");\n insert_at(cursor + word.length, \"</span>\");\n }\n }\n }\n\n cursor += word.length + 1;\n }\n\n if (in_line_comment) {\n insert_at(cursor, \"</span>\"); // close comment line\n }\n }\n\n parts.push(element.innerHTML.substr(insert_index));\n element.innerHTML = parts.join('');\n\n // When processing, using &lt; and &gt; is forced upon us. Now we\n // can fix that to allow for good copypasting.\n element.innerHTML.replace(/&lt;/g, \"<\");\n element.innerHTML.replace(/&gt;/g, \">\");\n }\n}", "function wrap(arr, sep, opts) {\n if (sep === '~') {\n sep = '-';\n }\n var str = arr.join(sep);\n var pre = opts && opts.regexPrefix;\n\n // regex logical `or`\n if (sep === '|') {\n str = pre ? pre + str : str;\n str = '(' + str + ')';\n }\n\n // regex character class\n if (sep === '-') {\n str = pre && pre === '^' ? pre + str : str;\n str = '[' + str + ']';\n }\n return [str];\n}", "function wrapArrayEvaluators(arrayNodes) {\n if ( !arrayNodes ) {\n return [];\n }\n\n var result = [];\n for ( var i = arrayNodes.length - 1; i >= 0; i-- ) {\n result[i] = wrapLiteral(createEvaluator(arrayNodes[i]));\n }\n return result;\n }", "function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error(\"Tokens array requires a `links` property.\")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}", "mySyntaxSugarMethod(myArgs) {\n\t\tconsole.log('myArgs from the syntax sugar', myArgs);\n\t}", "function extractInternalsFromBrackets(parts, token, indexOffset = 0){\n var depth = -1;\n var args = [];\n for( var i = indexOffset; i < parts.length; i++){\n var inversToken = getInversToken(token);\n var startingIndex;\n var intermediateIndex;\n switch(parts[i]){\n\n case token:\n if(depth < 0)\n intermediateIndex = startingIndex = i + 1;\n depth++;\n break;\n\n case inversToken:\n if(depth == 0){\n args.push(parts.slice(intermediateIndex,i))\n return { endingIndex: i, startingIndex, args };\n }\n depth--;\n break;\n\n case \",\":\n if(depth == 0 && token === \"(\"){\n args.push(parts.slice(intermediateIndex,i));\n intermediateIndex = i + 1;\n }\n break;\n\n default:\n if(token === \"(\" && parts[i].match(/\\($/)){\n if(depth < 0)\n intermediateIndex = startingIndex = i + 1;\n depth++;\n break;\n }\n }\n }\n err(`Missing ${inversToken}`);\n return;\n }", "function tokenize(content) {\n\t\n\tif (!content.endsWith('\\n')) {\n\t\tcontent += '\\n';\n\t}\n\t\n\t//Not the full list of tokens; namely, brackets aren't in this list.\n\t//Sorted by longest first, for greediness.\n\tvar tokens = [\n\t\t\"==\",\n\t\t\"!=\",\n\t\t\"<=\",\n\t\t\">=\",\n\t\t\"+=\",\n\t\t\"-=\",\n\t\t\"*=\",\n\t\t\"/=\",\n\t\t\"%=\",\n\t\t\"**=\",\n\t\t\"<\",\n\t\t\">\",\n\t\t\"=\",\n\t\t\"++\",\n\t\t\"--\",\n\t\t\"+\",\n\t\t\"-\",\n\t\t\",\",\n\t\t\"/\",\n\t\t\"%\",\n\t\t\"**\",\n\t\t\"*\",\n\t\t\".\",\n\t\t\":\",\n\t\t\"\\\\\",\n\t];\n\t\n\t\n\tvar rules = [];\n\tvar macros = [];\n\t\n\tvar isInSpecial = false;\n\t//var isInString = false;\n\tvar currentStrDelimiter = \"\";\n\tvar isInLineComment = false;\n\tvar isInStrComment = false;\n\tvar isInMacro = false;\n\tvar currentStrCommentDelimiter = \"\";\n\tvar bracketsLevel = 0;\n\tvar isInRule = false;\n\tvar currentRule = {};\n\tvar currentRuleLine = {};\n\t//var currentToken = {\"text\":\"\"};\n\tvar currentMacro = {};\n\tvar isBackslashed = false;\n\tvar isInTextToken = false;\n\t\n\t//\"Timer\" used for end of special zones (eg: the end of a multiline string is 3 characters long).\n\tvar timer = 0;\n\t\n\t//Timer used when inside a macro resolution, in order to stop incrementing column+line.\n\tvar macroTimer = 0;\n\tvar macroCols = 0;\n\tvar macroLines = 0;\n\t\n\tcurrentLineNb = 1;\n\tcurrentColNb = 0;\n\t\n\tvar i = 0;\n\t\n\tfunction addToken(text) {\n\t\t\n\t\tif (text.length === 0) {\n\t\t\terror(\"Token is empty, lexer broke\");\n\t\t}\n\t\t\n\t\t//debug(\"Adding token '\"+text+\"' at \"+currentLineNb+\":\"+currentColNb);\n\t\t\n\t\tcurrentRuleLine.tokens.push({\n\t\t\t\"lineNb\":currentLineNb,\n\t\t\t\"colNb\":currentColNb,\n\t\t\t\"text\":text\n\t\t});\n\t\t\n\t\ti += text.length-1;\n\t\tcurrentColNb += text.length-1;\n\t}\n\t\n\tfunction newRuleLine() {\n\t\t\n\t\tif (currentRuleLine.tokens !== undefined && currentRuleLine.tokens.length > 0) {\n\t\t\tcurrentRule.lines.push(currentRuleLine);\n\t\t}\n\t\t\n\t\tcurrentRuleLine = {\n\t\t\t\"indentLevel\":0,\n\t\t\t\"tokens\":[]\n\t\t};\n\t}\n\t\n\tnewRuleLine();\n\t\t\n\tfor (i = 0; i < content.length; i++) {\n\t\t\n\t\t//console.log(i);\n\t\t//await sleep(5);\n\t\t\n\t\tisInSpecial = (isInLineComment || isInStrComment || isInMacro);\n\t\t\n\t\t\n\t\tif (macroTimer > 0) {\n\t\t\tmacroTimer--;\n\t\t\tif (macroTimer === 0) {\n\t\t\t\t//debug(\"macro lines = \"+macroLines+\", macro cols = \"+macroCols);\n\t\t\t\tcurrentLineNb += macroLines;\n\t\t\t\tcurrentColNb = macroCols;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (macroTimer === 0) {\n\t\t\tcurrentColNb++;\n\t\t}\n\t\t\n\t\t\n\t\tif (timer > 0) {\n\t\t\ttimer--;\n\t\t\tif (timer === 0) {\n\t\t\t\tisInStrComment = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (content[i] === '\\n') {\n\t\t\tif (!isBackslashed) {\n\t\t\t\tif (isInMacro) {\n\t\t\t\t\tisInMacro = false;\n\t\t\t\t\tmacros.push(parseMacro(currentMacro));\n\t\t\t\t}\n\t\t\t}\n\t\t\t//For some reason, in Python, line comments aren't affected by backslashes before new lines.\n\t\t\tif (isInLineComment) {\n\t\t\t\tisInLineComment = false;\n\t\t\t\t\n\t\t\t\n\t\t\t//Do not end the instruction if there is a line break inside a function, or the line is backslashed.\n\t\t\t} else if (bracketsLevel === 0 && isInRule && !isBackslashed) {\n\t\t\t\tnewRuleLine();\n\t\t\t\t\n\t\t\t}\n\t\t\tif (macroTimer === 0) {\n\t\t\t\tcurrentLineNb++;\n\t\t\t\tcurrentColNb = 0;\n\t\t\t}\n\t\t\t\n\t\t} else if (!isInStrComment && !isInMacro && !isInLineComment) {\n\t\t\t\n\t\t\tif (content.startsWith(\" \", i) && currentRuleLine.tokens.length === 0) {\n\t\t\t\tcurrentRuleLine.indentLevel++;\n\t\t\t\tcurrentColNb += \" \".length-1;\n\t\t\t} else if (content.startsWith(\"\\t\", i)) {\n\t\t\t\tif (currentRuleLine.tokens.length === 0) {\n\t\t\t\t\tcurrentRuleLine.indentLevel++;\n\t\t\t\t}\n\t\t\t} else if (content[i] === ' ') {\n\t\t\t\t//do nothing\n\t\t\t} else if (content[i] === '\\\\') {\n\t\t\t\t//do nothing\n\t\t\t} else if (content[i] === '(' || content[i] === '[' || content[i] === '{') {\n\t\t\t\tbracketsLevel++;\n\t\t\t\taddToken(content[i]);\n\t\t\t\t\n\t\t\t} else if (content[i] === ')' || content[i] === ']' || content[i] === '}') {\n\t\t\t\tbracketsLevel--;\n\t\t\t\tif (bracketsLevel < 0) {\n\t\t\t\t\terror(\"Brackets level below 0\");\n\t\t\t\t}\n\t\t\t\taddToken(content[i]);\n\t\t\t\t\n\t\t\t} else if (content.startsWith(\"#!\", i)) {\n\t\t\t\tif (!isInRule) {\n\t\t\t\t\tisInMacro = true;\n\t\t\t\t\tcurrentMacro = {\n\t\t\t\t\t\t\"lineStart\":currentLineNb,\n\t\t\t\t\t\t\"content\":\"\"\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\terror(\"Cannot declare macro inside a rule\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else if (content[i] === '#') {\n\t\t\t\tisInLineComment = true;\n\t\t\t\n\t\t\t} else if (content.startsWith(\"'''\", i)) {\n\t\t\t\tisInStrComment = true;\n\t\t\t\tcurrentStrCommentDelimiter = \"'''\";\n\t\t\t\t\n\t\t\t} else if (content.startsWith('\"\"\"', i)) {\n\t\t\t\tisInStrComment = true;\n\t\t\t\tcurrentStrCommentDelimiter = '\"\"\"';\n\t\t\t\t\n\t\t\t} else if (content[i] === '\"' || content[i] === '\\'') {\n\t\t\t\tcurrentStrDelimiter = content[i];\n\t\t\t\t//Get to the end of the string\n\t\t\t\tvar j = i+1;\n\t\t\t\tfor (; j < content.length; j++) {\n\t\t\t\t\t\n\t\t\t\t\t//Test for potentially unclosed string\n\t\t\t\t\tif (!isBackslashed && content[j] === '\\n') {\n\t\t\t\t\t\terror(\"Unclosed string\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!isBackslashed && content[j] === currentStrDelimiter) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\tif (content[j] === '\\\\') {\n\t\t\t\t\t\tisBackslashed = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tisBackslashed = false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tj += 1; //account for closing delimiter\n\t\t\t\t\n\t\t\t\tif (j > i) {\n\t\t\t\t\taddToken(content.substring(i, j));\n\t\t\t\t} else {\n\t\t\t\t\terror(\"Failed to parse string '\"+content.substring(i, j)+\"' (malformed string?)\");\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//Test each macro\n\t\t\t\tfor (var j = 0; j < macros.length; j++) {\n\t\t\t\t\tif (content.startsWith(macros[j].name, i)) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar text;\n\t\t\t\t\t\tvar replacement;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (macros[j].isFunction) {\n\t\t\t\t\t\t\t//debug(\"Resolving function macro \"+macros[j].name);\n\t\t\t\t\t\t\tvar bracketPos = getBracketPositions(content.substring(i), true);\n\t\t\t\t\t\t\ttext = content.substring(i, i+bracketPos[1]+1);\n\t\t\t\t\t\t\tvar macroArgs = getArgs(content.substring(i+bracketPos[0]+1, i+bracketPos[1]));\n\t\t\t\t\t\t\treplacement = resolveMacro(macros[j], macroArgs);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//debug(\"Resolving normal macro \"+macros[j].name);\n\t\t\t\t\t\t\ttext = macros[j].name;\n\t\t\t\t\t\t\treplacement = macros[j].replacement;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tcontent = content.substring(0, i) + replacement + content.substring(i+text.length);\n\t\t\t\t\t\tif (macroTimer === 0) {\n\t\t\t\t\t\t\tif (text.indexOf('\\n') >= 0) {\n\t\t\t\t\t\t\t\tmacroCols = text.length - text.lastIndexOf('\\n');\n\t\t\t\t\t\t\t\tmacroLines = text.split('\\n').length-1;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmacroCols = text.length;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmacroTimer += replacement.length;\n\t\t\t\t\t\t\n\t\t\t\t\t\t//debug(\"Text: \"+text);\n\t\t\t\t\t\t//debug(\"Replacement: \"+replacement);\n\t\t\t\t\t\t\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Get token\n\t\t\t\tvar j = i;\n\t\t\t\tfor (; j < content.length && isVarChar(content[j]); j++);\n\t\t\t\t\n\t\t\t\tif (j > i) {\n\t\t\t\t\tif (content.substring(i, j) === \"@Rule\") {\n\t\t\t\t\t\tisInRule = true;\n\t\t\t\t\t\trules.push(currentRule);\n\t\t\t\t\t\tcurrentRule = {\n\t\t\t\t\t\t\t\"lineStart\":currentLineNb,\n\t\t\t\t\t\t\t\"lines\":[]\n\t\t\t\t\t\t};\n\t\t\t\t\t\tnewRuleLine();\n\t\t\t\t\t} else if (!isInRule) {\n\t\t\t\t\t\terror(\"Found code outside a rule : \"+content[i]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//Handle the special case of min= and max= operators\n\t\t\t\t\tif ((content.substring(i,j) === \"min\" || content.substring(i,j) === \"max\") && content[i+\"min\".length] === '=') {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\taddToken(content.substring(i, j))\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tvar hasTokenBeenFound = false;\n\t\t\t\t\t//Test each remaining token\n\t\t\t\t\tfor (var h = 0; h < tokens.length; h++) {\n\t\t\t\t\t\tif (content.startsWith(tokens[h], i)) {\n\t\t\t\t\t\t\taddToken(content.substring(i, i+tokens[h].length));\n\t\t\t\t\t\t\thasTokenBeenFound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!hasTokenBeenFound) {\n\t\t\t\t\t\terror(\"Unknown token '\"+content[i]+\"'\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t} else if (isInStrComment && content.startsWith(currentStrCommentDelimiter, i)) {\n\t\t\ttimer = 3;\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tif (content[i] === '\\\\') {\n\t\t\tisBackslashed = true;\n\t\t} else {\n\t\t\tisBackslashed = false;\n\t\t}\n\t\t\n\t\tif (isInMacro) {\n\t\t\tcurrentMacro.content += content[i];\n\t\t}\n\t}\n\t\n\trules.push(currentRule);\n\t\n\tconsole.log(\"macros = \");\n\tconsole.log(macros);\n\t\n\treturn rules.slice(1)\n\t\n}", "tokenBefore(types) {\n let token = language.syntaxTree(this.state).resolveInner(this.pos, -1);\n while (token && types.indexOf(token.name) < 0)\n token = token.parent;\n return token ? { from: token.from, to: this.pos,\n text: this.state.sliceDoc(token.from, this.pos),\n type: token.type } : null;\n }", "function tokenize_latex_math(input)\n{\n var result = new Array();\n var in_text_mode = 0;\n var brace_level = [];\n var pos = 0;\n\n if(input.charAt(0) == '$' &&\n input.charAt(input.length-1) == '$')\n input = input.slice(1, input.length-1);\n\n while(1) {\n if(!in_text_mode) {\n tokenize_re.lastIndex = pos;\n var m = tokenize_re.exec(input);\n pos = tokenize_re.lastIndex;\n\n if(m == null)\n {\n return result;\n }\n else if( m[1] != null) {\n result.push(m[1], m[2]);\n } else if(m[3] == '\\\\sp') {\n result.push('^');\n } else if(m[3] == '\\\\sb') {\n result.push('_');\n } else\n {\n if(m[0] == '$') {\n in_text_mode = 1;\n } else if(m[4] != null) {\n continue;\n } else if(m[3] != null && m[3] in tokenize_text_commands) {\n in_text_mode = 2;\n brace_level.push(0);\n }\n\n result.push(m[0]);\n }\n }\n else // in_text_mode:\n {\n tokenize_text_re.lastIndex = pos;\n var m = tokenize_text_re.exec(input);\n pos = tokenize_text_re.lastIndex;\n\n if(m == null) {\n return result;\n } else if(m[0] == '$') {\n in_text_mode = 0;\n } else if(m[0] == '{') {\n brace_level[brace_level.length-1]++;\n } else if(m[0] == '}') {\n if(--brace_level[brace_level.length-1] <= 0) {\n in_text_mode = 0;\n brace_level.pop();\n }\n }\n result.push(m[0]);\n }\n }\n}", "function Brackets(whereFactory) {\n this.whereFactory = whereFactory;\n }", "parse() {\n\t\tlet mainFunctionBlock = [];\n\n\t\twhile (this.peek() !== undefined) {\n\t\t\tlet expr = this.parseExpression();\n\t\t\tif(expr) mainFunctionBlock.push(expr);\n\n\t\t\tif (this.peek() !== undefined) {\n\t\t\t\tthis.optionalSkip('punctuation', ';');\n\t\t\t}\n\t\t}\n\n\t\tthis.main.setBlock({\n\t\t\texpressions: mainFunctionBlock\n\t\t});\n\n\t\tlet fObj = this.main;\n\t\tfObj.isEntry = true;\n\n\t\tthis.functions.unshift(fObj);\n\n\t\treturn {\n\t\t\ttype: 'script',\n\t\t\tfunctions: this.functions\n\t\t};\n\t}", "tokenize(code, opts = {}) {\r\n\t\t\t\tvar consumed, end, i, ref;\r\n\t\t\t\tthis.literate = opts.literate; // Are we lexing literate CoffeeScript?\r\n\t\t\t\tthis.indent = 0; // The current indentation level.\r\n\t\t\t\tthis.baseIndent = 0; // The overall minimum indentation level.\r\n\t\t\t\tthis.continuationLineAdditionalIndent = 0; // The over-indentation at the current level.\r\n\t\t\t\tthis.outdebt = 0; // The under-outdentation at the current level.\r\n\t\t\t\tthis.indents = []; // The stack of all current indentation levels.\r\n\t\t\t\tthis.indentLiteral = ''; // The indentation.\r\n\t\t\t\tthis.ends = []; // The stack for pairing up tokens.\r\n\t\t\t\tthis.tokens = []; // Stream of parsed tokens in the form `['TYPE', value, location data]`.\r\n\t\t\t\tthis.seenFor = false; // Used to recognize `FORIN`, `FOROF` and `FORFROM` tokens.\r\n\t\t\t\tthis.seenImport = false; // Used to recognize `IMPORT FROM? AS?` tokens.\r\n\t\t\t\tthis.seenExport = false; // Used to recognize `EXPORT FROM? AS?` tokens.\r\n\t\t\t\tthis.importSpecifierList = false; // Used to identify when in an `IMPORT {...} FROM? ...`.\r\n\t\t\t\tthis.exportSpecifierList = false; // Used to identify when in an `EXPORT {...} FROM? ...`.\r\n\t\t\t\tthis.jsxDepth = 0; // Used to optimize JSX checks, how deep in JSX we are.\r\n\t\t\t\tthis.jsxObjAttribute = {}; // Used to detect if JSX attributes is wrapped in {} (<div {props...} />).\r\n\t\t\t\tthis.chunkLine = opts.line || 0; // The start line for the current @chunk.\r\n\t\t\t\tthis.chunkColumn = opts.column || 0; // The start column of the current @chunk.\r\n\t\t\t\tthis.chunkOffset = opts.offset || 0; // The start offset for the current @chunk.\r\n\t\t\t\tthis.locationDataCompensations = opts.locationDataCompensations || {};\r\n\t\t\t\tcode = this.clean(code); // The stripped, cleaned original source code.\r\n\t\t\t\t\r\n\t\t\t\t// At every position, run through this list of attempted matches,\r\n\t\t\t\t// short-circuiting if any of them succeed. Their order determines precedence:\r\n\t\t\t\t// `@literalToken` is the fallback catch-all.\r\n\t\t\t\ti = 0;\r\n\t\t\t\twhile (this.chunk = code.slice(i)) {\r\n\t\t\t\t\tconsumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.stringToken() || this.numberToken() || this.jsxToken() || this.regexToken() || this.jsToken() || this.literalToken();\r\n\t\t\t\t\t// Update position.\r\n\t\t\t\t\t[this.chunkLine, this.chunkColumn, this.chunkOffset] = this.getLineAndColumnFromChunk(consumed);\r\n\t\t\t\t\ti += consumed;\r\n\t\t\t\t\tif (opts.untilBalanced && this.ends.length === 0) {\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\ttokens: this.tokens,\r\n\t\t\t\t\t\t\tindex: i\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tthis.closeIndentation();\r\n\t\t\t\tif (end = this.ends.pop()) {\r\n\t\t\t\t\tthis.error(`missing ${end.tag}`, ((ref = end.origin) != null ? ref : end)[2]);\r\n\t\t\t\t}\r\n\t\t\t\tif (opts.rewrite === false) {\r\n\t\t\t\t\treturn this.tokens;\r\n\t\t\t\t}\r\n\t\t\t\treturn (new Rewriter()).rewrite(this.tokens);\r\n\t\t\t}", "function X(a){for(var b,c=[],d=/\\[([^\\]]*)\\]|\\(([^\\)]*)\\)|(LT|(\\w)\\4*o?)|([^\\w\\[\\(]+)/g;b=d.exec(a);)b[1]?// a literal string inside [ ... ]\nc.push(b[1]):b[2]?// non-zero formatting inside ( ... )\nc.push({maybe:X(b[2])}):b[3]?// a formatting token\nc.push({token:b[3]}):b[5]&&// an unenclosed literal string\nc.push(b[5]);return c}", "function getParseTokens(){\n\treturn {\n\t\t'union' : \"+\",\n\t\t'intersection' : \"^^\"\n\t};\n}", "parseBlock() {\n\t\tvar program = this.delimited('{', '}', null, this.parseExpression.bind(this));\n\t\treturn {\n\t\t\ttype: 'block',\n\t\t\texpressions: program\n\t\t};\n\t}", "function patcher(str, generalOpts) {\n // insurance\n // ---------------------------------------------------------------------------\n // if inputs are wrong, just return what was given\n if (typeof str !== \"string\" || str.length === 0) {\n return {\n result: str\n };\n } // setup\n // ---------------------------------------------------------------------------\n // clone the defaults, don't mutate the input argument object\n\n\n var opts = _objectSpread__default['default'](_objectSpread__default['default']({}, defaults), generalOpts);\n\n if (opts.cssStylesContent && ( // if not a string was passed\n typeof opts.cssStylesContent !== \"string\" || // or it was empty of full of whitespace\n !opts.cssStylesContent.trim())) {\n opts.cssStylesContent = \"\";\n } // the bizness\n // ---------------------------------------------------------------------------\n // traversal is done from a callback, same like Array.prototype.forEach()\n // you don't assign anything, as in \"const x = traverse(...\" -\n // instead, you do the deed inside the callback function\n //\n // ensure that we don't traverse inside comment tokens\n // practically we achieve that by comparing does current path start with\n // and of the known comment token paths:\n\n var knownCommentTokenPaths = [];\n astMonkeyTraverseWithLookahead.traverse(codsenParser.cparser(str), function (token, _val, innerObj) {\n /* istanbul ignore else */\n if (isObj(token) && token.type === \"comment\" && !knownCommentTokenPaths.some(function (oneOfRecordedPaths) {\n return innerObj.path.startsWith(oneOfRecordedPaths);\n })) {\n knownCommentTokenPaths.push(innerObj.path);\n } else if ( // tags are always stuck in an array, \"root\" level is array too\n // ast-monkey reports array elements as \"key\" and \"value\" is undefined.\n // if this was object, \"key\" would be key of key/value pair, \"value\"\n // would be value of the key/value pair.\n //\n // The tag itself is a plain object:\n isObj(token) && // filter by type and tag name\n token.type === \"tag\" && token.tagName === \"table\" && !knownCommentTokenPaths.some(function (oneOfKnownCommentPaths) {\n return innerObj.path.startsWith(oneOfKnownCommentPaths);\n }) && // ensure it's not closing, otherwise closing tags will be caught too:\n !token.closing && // we wrap either raw text or esp template tag nodes only:\n token.children.some(function (childNodeObj) {\n return [\"text\", \"esp\"].includes(childNodeObj.type);\n })) {\n // so this table does have some text nodes straight inside TABLE tag // find out how many TD's are there on TR's that have TD's (if any exist)\n // then, that value, if greater then 1 will be the colspan value -\n // we'll wrap this text node's contents with one TR and one TD - but\n // set TD colspan to this value:\n\n var colspanVal = 1; // if td we decide the colspan contains some attributes, we'll note\n // down the range of where first attrib starts and last attrib ends\n // then slice that range and insert of every td, along the colspan\n\n var centered = false;\n var firstTrFound = {};\n\n if ( // some TR's exist inside this TABLE tag\n token.children.some(function (childNodeObj) {\n return childNodeObj.type === \"tag\" && childNodeObj.tagName === \"tr\" && !childNodeObj.closing && (firstTrFound = childNodeObj);\n })) { // console.log(\n // `108 ${`\\u001b[${33}m${`firstTrFound`}\\u001b[${39}m`} = ${JSON.stringify(\n // firstTrFound,\n // null,\n // 4\n // )}`\n // );\n // colspanVal is equal to the count of TD's inside children[] array\n // the only condition - we count consecutive TD's, any ESP or text\n // token breaks the counting\n\n var count = 0; // console.log(\n // `132 FILTER ${`\\u001b[${33}m${`firstTrFound.children`}\\u001b[${39}m`} = ${JSON.stringify(\n // firstTrFound.children,\n // null,\n // 4\n // )}`\n // );\n\n for (var i = 0, len = firstTrFound.children.length; i < len; i++) {\n var obj = firstTrFound.children[i]; // console.log(\n // `141 ---------------- ${`\\u001b[${33}m${`obj`}\\u001b[${39}m`} = ${JSON.stringify(\n // obj,\n // null,\n // 4\n // )}`\n // );\n // count consecutive TD's\n\n if (obj.type === \"tag\" && obj.tagName === \"td\") {\n if (!obj.closing) {\n // detect center-alignment\n centered = obj.attribs.some(function (attrib) {\n return attrib.attribName === \"align\" && attrib.attribValueRaw === \"center\" || attrib.attribName === \"style\" && /text-align:\\s*center/i.test(attrib.attribValueRaw);\n });\n count++;\n\n if (count > colspanVal) {\n colspanVal = count;\n }\n } // else - ignore closing tags\n\n } else if (obj.type !== \"text\" || obj.value.replace(htmlCommentRegex, \"\").trim()) {\n // reset\n count = 0;\n } // console.log(\n // `174 ${`\\u001b[${33}m${`count`}\\u001b[${39}m`} = ${JSON.stringify(\n // count,\n // null,\n // 4\n // )}`\n // );\n\n }\n } //\n //\n //\n // T Y P E I.\n //\n //\n //\n // ----------------------------------------------------------------------------- // now filter all \"text\" type children nodes from this TABLE tag\n // this key below is the table tag we filtered in the beginning\n\n token.children // filter out text nodes:\n .filter(function (childNodeObj) {\n return [\"text\", \"esp\"].includes(childNodeObj.type);\n }) // wrap each with TR+TD with colspan:\n .forEach(function (obj) {\n\n if (obj.value.replace(htmlCommentRegex, \"\").trim()) {\n // There will always be whitespace in nicely formatted tags,\n // so ignore text tokens which have values that trim to zero length.\n //\n // Since trimmed value of zero length is already falsey, we don't\n // need to do\n // \"if (obj.value.trim().length)\" or\n // \"if (obj.value.trim() === \"\")\" or\n // \"if (obj.value.trim().length === 0)\"\n //\n ranges.push(obj.start, obj.end, \"\\n<tr>\\n <td\" + (colspanVal > 1 ? \" colspan=\\\"\" + colspanVal + \"\\\"\" : \"\") + (opts.alwaysCenter || centered ? \" align=\\\"center\\\"\" : \"\") + (opts.cssStylesContent ? \" style=\\\"\" + opts.cssStylesContent + \"\\\"\" : \"\") + \">\\n \" + obj.value.trim() + \"\\n </td>\\n</tr>\\n\");\n }\n }); //\n //\n //\n // T Y P E II.\n //\n //\n //\n // -----------------------------------------------------------------------------\n token.children // filter out text nodes:\n .filter(function (obj) {\n return obj.type === \"tag\" && obj.tagName === \"tr\" && !obj.closing;\n }).forEach(function (trTag) {\n // console.log(\n // `224 ██ ${`\\u001b[${33}m${`trTag`}\\u001b[${39}m`} = ${JSON.stringify(\n // trTag,\n // null,\n // 4\n // )}`\n // );\n // we use for loop because we need to look back, what token was\n // before, plus filter\n var doNothing = false;\n\n for (var _i = 0, _len = trTag.children.length; _i < _len; _i++) {\n var childNodeObj = trTag.children[_i]; // deactivate\n\n if (doNothing && childNodeObj.type === \"comment\" && childNodeObj.closing) {\n doNothing = false;\n continue;\n } // if a child node is opening comment node, activate doNothing\n // until closing counterpart is found\n\n\n if (!doNothing && childNodeObj.type === \"comment\" && !childNodeObj.closing) {\n doNothing = true;\n }\n\n if (!doNothing && [\"text\", \"esp\"].includes(childNodeObj.type) && childNodeObj.value.trim()) {\n\n if (childNodeObj.value.trim()) {\n // There will always be whitespace in nicely formatted tags,\n // so ignore text tokens which have values that trim to zero length.\n\n if (!_i) {\n ranges.push(childNodeObj.start, childNodeObj.end, \"\\n <td\" + (colspanVal > 1 ? \" colspan=\\\"\" + colspanVal + \"\\\"\" : \"\") + (opts.alwaysCenter || centered ? \" align=\\\"center\\\"\" : \"\") + (opts.cssStylesContent ? \" style=\\\"\" + opts.cssStylesContent + \"\\\"\" : \"\") + \">\\n \" + childNodeObj.value.trim() + \"\\n </td>\\n</tr>\\n<tr>\\n\");\n } else if (_i && _len > 1 && _i === _len - 1) {\n ranges.push(childNodeObj.start, childNodeObj.end, \"\\n</tr>\\n<tr>\\n <td\" + (colspanVal > 1 ? \" colspan=\\\"\" + colspanVal + \"\\\"\" : \"\") + (opts.alwaysCenter || centered ? \" align=\\\"center\\\"\" : \"\") + (opts.cssStylesContent ? \" style=\\\"\" + opts.cssStylesContent + \"\\\"\" : \"\") + \">\\n \" + childNodeObj.value.trim() + \"\\n </td>\\n\");\n } else {\n ranges.push(childNodeObj.start, childNodeObj.end, \"\\n</tr>\\n<tr>\\n <td\" + (colspanVal > 1 ? \" colspan=\\\"\" + colspanVal + \"\\\"\" : \"\") + (opts.alwaysCenter || centered ? \" align=\\\"center\\\"\" : \"\") + (opts.cssStylesContent ? \" style=\\\"\" + opts.cssStylesContent + \"\\\"\" : \"\") + \">\\n \" + childNodeObj.value.trim() + \"\\n </td>\\n</tr>\\n<tr>\\n\");\n }\n }\n }\n }\n });\n }\n });\n\n if (ranges.current()) {\n var result = rangesApply.rApply(str, ranges.current());\n ranges.wipe();\n return {\n result: result\n };\n }\n\n return {\n result: str\n };\n}", "tokenTypes(){ return [] }", "function closeBrackets() {\n return [inputHandler, bracketState];\n}", "function flatten(stx) {\n return _.reduce(stx, function (acc, stx$2) {\n if (stx$2.token.type === parser.Token.Delimiter) {\n var exposed = stx$2.expose();\n var openParen = syntaxFromToken({\n type: parser.Token.Punctuator,\n value: stx$2.token.value[0],\n range: stx$2.token.startRange,\n sm_range: typeof stx$2.token.sm_startRange == 'undefined' ? stx$2.token.startRange : stx$2.token.sm_startRange,\n lineNumber: stx$2.token.startLineNumber,\n sm_lineNumber: typeof stx$2.token.sm_startLineNumber == 'undefined' ? stx$2.token.startLineNumber : stx$2.token.sm_startLineNumber,\n lineStart: stx$2.token.startLineStart,\n sm_lineStart: typeof stx$2.token.sm_startLineStart == 'undefined' ? stx$2.token.startLineStart : stx$2.token.sm_startLineStart\n }, exposed);\n var closeParen = syntaxFromToken({\n type: parser.Token.Punctuator,\n value: stx$2.token.value[1],\n range: stx$2.token.endRange,\n sm_range: typeof stx$2.token.sm_endRange == 'undefined' ? stx$2.token.endRange : stx$2.token.sm_endRange,\n lineNumber: stx$2.token.endLineNumber,\n sm_lineNumber: typeof stx$2.token.sm_endLineNumber == 'undefined' ? stx$2.token.endLineNumber : stx$2.token.sm_endLineNumber,\n lineStart: stx$2.token.endLineStart,\n sm_lineStart: typeof stx$2.token.sm_endLineStart == 'undefined' ? stx$2.token.endLineStart : stx$2.token.sm_endLineStart\n }, exposed);\n if (stx$2.token.leadingComments) {\n openParen.token.leadingComments = stx$2.token.leadingComments;\n }\n if (stx$2.token.trailingComments) {\n openParen.token.trailingComments = stx$2.token.trailingComments;\n }\n acc.push(openParen);\n push.apply(acc, flatten(exposed.token.inner));\n acc.push(closeParen);\n return acc;\n }\n stx$2.token.sm_lineNumber = stx$2.token.sm_lineNumber ? stx$2.token.sm_lineNumber : stx$2.token.lineNumber;\n stx$2.token.sm_lineStart = stx$2.token.sm_lineStart ? stx$2.token.sm_lineStart : stx$2.token.lineStart;\n stx$2.token.sm_range = stx$2.token.sm_range ? stx$2.token.sm_range : stx$2.token.range;\n acc.push(stx$2);\n return acc;\n }, []);\n }", "function $viewsDelimiters(openChars, closeChars, link) {\n\t// Set the tag opening and closing delimiters and 'link' character. Default is \"{{\", \"}}\" and \"^\"\n\t// openChars, closeChars: opening and closing strings, each with two characters\n\tif (!openChars) {\n\t\treturn $subSettings.delimiters;\n\t}\n\tif ($isArray(openChars)) {\n\t\treturn $viewsDelimiters.apply($views, openChars);\n\t}\n\n\t$subSettings.delimiters = [openChars, closeChars, linkChar = link ? link.charAt(0) : linkChar];\n\n\tdelimOpenChar0 = openChars.charAt(0); // Escape the characters - since they could be regex special characters\n\tdelimOpenChar1 = openChars.charAt(1);\n\tdelimCloseChar0 = closeChars.charAt(0);\n\tdelimCloseChar1 = closeChars.charAt(1);\n\topenChars = \"\\\\\" + delimOpenChar0 + \"(\\\\\" + linkChar + \")?\\\\\" + delimOpenChar1; // Default is \"{^{\"\n\tcloseChars = \"\\\\\" + delimCloseChar0 + \"\\\\\" + delimCloseChar1; // Default is \"}}\"\n\t// Build regex with new delimiters\n\t// [tag (followed by / space or }) or cvtr+colon or html or code] followed by space+params then convertBack?\n\trTag = \"(?:(\\\\w+(?=[\\\\/\\\\s\\\\\" + delimCloseChar0 + \"]))|(\\\\w+)?(:)|(>)|(\\\\*))\\\\s*((?:[^\\\\\"\n\t\t+ delimCloseChar0 + \"]|\\\\\" + delimCloseChar0 + \"(?!\\\\\" + delimCloseChar1 + \"))*?)\";\n\n\t// Make rTag available to JsViews (or other components) for parsing binding expressions\n\t$sub.rTag = \"(?:\" + rTag + \")\";\n\t// { ^? { tag+params slash? or closingTag or comment\n\trTag = new RegExp(\"(?:\" + openChars + rTag + \"(\\\\/)?|\\\\\" + delimOpenChar0 + \"(\\\\\" + linkChar + \")?\\\\\" + delimOpenChar1 + \"(?:(?:\\\\/(\\\\w+))\\\\s*|!--[\\\\s\\\\S]*?--))\" + closeChars, \"g\");\n\n\t// Default: bind tagName cvt cln html code params slash bind2 closeBlk comment\n\t// /(?:{(\\^)?{(?:(\\w+(?=[\\/\\s}]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^}]|}(?!}))*?)(\\/)?|{(\\^)?{(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))}}\n\n\t$sub.rTmpl = new RegExp(\"^\\\\s|\\\\s$|<.*>|([^\\\\\\\\]|^)[{}]|\" + openChars + \".*\" + closeChars);\n\t// $sub.rTmpl looks for initial or final white space, html tags or { or } char not preceded by \\\\, or JsRender tags {{xxx}}.\n\t// Each of these strings are considered NOT to be jQuery selectors\n\treturn $viewsSettings;\n}", "function scanInterp(str) {\n var arr = str.split(\"\");\n var stack = [ \"none\" ];\n var edits = [ ];\n stack.status = function() { return this.length > 0 ? this[this.length - 1] : \"none\"; };\n\n function check(ed) { return ed.start !== undefined; }\n\n var ed = {};\n var i = 0;\n arr.forEach(function(c) {\n switch (stack.status()) {\n case 'none':\n switch (c) {\n case '\\\\':\n stack.push('esc');\n break;\n case '#':\n stack.push('sharp');\n break;\n case '\"':\n stack.push('dquoted');\n break;\n case \"'\":\n stack.push('squoted');\n break;\n case '}':\n if (check(ed)) {\n ed.end = i;\n edits.push(ed);\n }\n break;\n default:\n break;\n }\n break;\n case 'esc':\n stack.pop();\n break;\n case 'dquoted':\n switch (c) {\n case '\\\\':\n stack.push('esc');\n break;\n case '#':\n stack.push('sharp');\n break;\n case '\"':\n stack.pop();\n break;\n case '}':\n if (check(ed)) {\n ed.end = i;\n edits.push(ed);\n }\n break;\n default:\n break;\n }\n break;\n case 'squoted':\n switch (c) {\n case '\\\\':\n stack.push('esc');\n break;\n case '#':\n stack.push('sharp');\n break;\n case \"'\":\n stack.pop();\n break;\n case '}':\n if (check(ed)) {\n ed.end = i;\n edits.push(ed);\n }\n break;\n default:\n break;\n }\n break;\n case 'sharp':\n if (c === '{') {\n ed = { start: i - 1 };\n }\n stack.pop();\n break;\n default:\n break;\n }\n ++i;\n });\n return edits;\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n }", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n }", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\t\n\t if (typeof token === 'string') {\n\t path += token\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name]\n\t var segment\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\t\n\t if (typeof token === 'string') {\n\t path += token\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name]\n\t var segment\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\t\n\t if (typeof token === 'string') {\n\t path += token\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name]\n\t var segment\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment\n\t }\n\t\n\t return path\n\t }\n\t}", "function InlineLexer(links, options) {\r\n\t this.options = options || marked.defaults;\r\n\t this.links = links;\r\n\t this.rules = inline.normal;\r\n\t this.renderer = this.options.renderer || new Renderer;\r\n\t this.renderer.options = this.options;\r\n\t\r\n\t if (!this.links) {\r\n\t throw new\r\n\t Error('Tokens array requires a `links` property.');\r\n\t }\r\n\t\r\n\t if (this.options.gfm) {\r\n\t if (this.options.breaks) {\r\n\t this.rules = inline.breaks;\r\n\t } else {\r\n\t this.rules = inline.gfm;\r\n\t }\r\n\t } else if (this.options.pedantic) {\r\n\t this.rules = inline.pedantic;\r\n\t }\r\n\t}", "function sequence (parserSyntax) {\n const originalPos = pos\n\n const result = []\n\n for (let i = 0; i < parserSyntax.length; i++) {\n const res = parserSyntax[i]()\n\n if (res === null) {\n pos = originalPos\n\n return null\n }\n\n result.push(res)\n }\n\n return result\n }", "mergeInterpolationTokens(tokens, options, fn) {\r\n\t\t\t\tvar $, converted, double, endOffset, firstIndex, heregex, i, indent, j, jsx, k, lastToken, len, len1, locationToken, lparen, placeholderToken, quote, ref, ref1, rparen, tag, token, tokensToPush, val, value;\r\n\t\t\t\t({quote, indent, double, heregex, endOffset, jsx} = options);\r\n\t\t\t\tif (tokens.length > 1) {\r\n\t\t\t\t\tlparen = this.token('STRING_START', '(', {\r\n\t\t\t\t\t\tlength: (ref = quote != null ? quote.length : void 0) != null ? ref : 0,\r\n\t\t\t\t\t\tdata: {quote},\r\n\t\t\t\t\t\tgenerated: !(quote != null ? quote.length : void 0)\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tfirstIndex = this.tokens.length;\r\n\t\t\t\t$ = tokens.length - 1;\r\n\t\t\t\tfor (i = j = 0, len = tokens.length; j < len; i = ++j) {\r\n\t\t\t\t\ttoken = tokens[i];\r\n\t\t\t\t\t[tag, value] = token;\r\n\t\t\t\t\tswitch (tag) {\r\n\t\t\t\t\t\tcase 'TOKENS':\r\n\t\t\t\t\t\t\t// There are comments (and nothing else) in this interpolation.\r\n\t\t\t\t\t\t\tif (value.length === 2 && (value[0].comments || value[1].comments)) {\r\n\t\t\t\t\t\t\t\tplaceholderToken = this.makeToken('JS', '', {\r\n\t\t\t\t\t\t\t\t\tgenerated: true\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t// Use the same location data as the first parenthesis.\r\n\t\t\t\t\t\t\t\tplaceholderToken[2] = value[0][2];\r\n\t\t\t\t\t\t\t\tfor (k = 0, len1 = value.length; k < len1; k++) {\r\n\t\t\t\t\t\t\t\t\tval = value[k];\r\n\t\t\t\t\t\t\t\t\tif (!val.comments) {\r\n\t\t\t\t\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif (placeholderToken.comments == null) {\r\n\t\t\t\t\t\t\t\t\t\tplaceholderToken.comments = [];\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tplaceholderToken.comments.push(...val.comments);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tvalue.splice(1, 0, placeholderToken);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t// Push all the tokens in the fake `'TOKENS'` token. These already have\r\n\t\t\t\t\t\t\t// sane location data.\r\n\t\t\t\t\t\t\tlocationToken = value[0];\r\n\t\t\t\t\t\t\ttokensToPush = value;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase 'NEOSTRING':\r\n\t\t\t\t\t\t\t// Convert `'NEOSTRING'` into `'STRING'`.\r\n\t\t\t\t\t\t\tconverted = fn.call(this, token[1], i);\r\n\t\t\t\t\t\t\tif (i === 0) {\r\n\t\t\t\t\t\t\t\taddTokenData(token, {\r\n\t\t\t\t\t\t\t\t\tinitialChunk: true\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (i === $) {\r\n\t\t\t\t\t\t\t\taddTokenData(token, {\r\n\t\t\t\t\t\t\t\t\tfinalChunk: true\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\taddTokenData(token, {indent, quote, double});\r\n\t\t\t\t\t\t\tif (heregex) {\r\n\t\t\t\t\t\t\t\taddTokenData(token, {heregex});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (jsx) {\r\n\t\t\t\t\t\t\t\taddTokenData(token, {jsx});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttoken[0] = 'STRING';\r\n\t\t\t\t\t\t\ttoken[1] = '\"' + converted + '\"';\r\n\t\t\t\t\t\t\tif (tokens.length === 1 && (quote != null)) {\r\n\t\t\t\t\t\t\t\ttoken[2].first_column -= quote.length;\r\n\t\t\t\t\t\t\t\tif (token[1].substr(-2, 1) === '\\n') {\r\n\t\t\t\t\t\t\t\t\ttoken[2].last_line += 1;\r\n\t\t\t\t\t\t\t\t\ttoken[2].last_column = quote.length - 1;\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\ttoken[2].last_column += quote.length;\r\n\t\t\t\t\t\t\t\t\tif (token[1].length === 2) {\r\n\t\t\t\t\t\t\t\t\t\ttoken[2].last_column -= 1;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\ttoken[2].last_column_exclusive += quote.length;\r\n\t\t\t\t\t\t\t\ttoken[2].range = [token[2].range[0] - quote.length, token[2].range[1] + quote.length];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tlocationToken = token;\r\n\t\t\t\t\t\t\ttokensToPush = [token];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.tokens.push(...tokensToPush);\r\n\t\t\t\t}\r\n\t\t\t\tif (lparen) {\r\n\t\t\t\t\t[lastToken] = slice.call(tokens, -1);\r\n\t\t\t\t\tlparen.origin = [\r\n\t\t\t\t\t\t'STRING',\r\n\t\t\t\t\t\tnull,\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tfirst_line: lparen[2].first_line,\r\n\t\t\t\t\t\t\tfirst_column: lparen[2].first_column,\r\n\t\t\t\t\t\t\tlast_line: lastToken[2].last_line,\r\n\t\t\t\t\t\t\tlast_column: lastToken[2].last_column,\r\n\t\t\t\t\t\t\tlast_line_exclusive: lastToken[2].last_line_exclusive,\r\n\t\t\t\t\t\t\tlast_column_exclusive: lastToken[2].last_column_exclusive,\r\n\t\t\t\t\t\t\trange: [lparen[2].range[0],\r\n\t\t\t\t\t\tlastToken[2].range[1]]\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t];\r\n\t\t\t\t\tif (!(quote != null ? quote.length : void 0)) {\r\n\t\t\t\t\t\tlparen[2] = lparen.origin[2];\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn rparen = this.token('STRING_END', ')', {\r\n\t\t\t\t\t\toffset: endOffset - (quote != null ? quote : '').length,\r\n\t\t\t\t\t\tlength: (ref1 = quote != null ? quote.length : void 0) != null ? ref1 : 0,\r\n\t\t\t\t\t\tgenerated: !(quote != null ? quote.length : void 0)\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}", "function InlineLexer(links, options) {\n\t this.options = options || marked.defaults;\n\t this.links = links;\n\t this.rules = inline.normal;\n\t this.renderer = this.options.renderer || new Renderer;\n\t this.renderer.options = this.options;\n\t\n\t if (!this.links) {\n\t throw new\n\t Error('Tokens array requires a `links` property.');\n\t }\n\t\n\t if (this.options.gfm) {\n\t if (this.options.breaks) {\n\t this.rules = inline.breaks;\n\t } else {\n\t this.rules = inline.gfm;\n\t }\n\t } else if (this.options.pedantic) {\n\t this.rules = inline.pedantic;\n\t }\n\t}", "function InlineLexer(links, options) {\n\t\t this.options = options || marked.defaults;\n\t\t this.links = links;\n\t\t this.rules = inline.normal;\n\t\t this.renderer = this.options.renderer || new Renderer;\n\t\t this.renderer.options = this.options;\n\t\t\n\t\t if (!this.links) {\n\t\t throw new\n\t\t Error('Tokens array requires a `links` property.');\n\t\t }\n\t\t\n\t\t if (this.options.gfm) {\n\t\t if (this.options.breaks) {\n\t\t this.rules = inline.breaks;\n\t\t } else {\n\t\t this.rules = inline.gfm;\n\t\t }\n\t\t } else if (this.options.pedantic) {\n\t\t this.rules = inline.pedantic;\n\t\t }\n\t\t}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n \n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n \n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n }", "function objectCompletions() {\n var hints = [];\n var command = token.string.trim();\n if (command in lastMessage.hints) {\n hints = lastMessage.hints[command]\n .map(function (item) {\n var additionalText = \"\";\n if (command == \"set\") {\n additionalText = \" ->\"\n if (item.options.length == 0)\n additionalText += \" \\\"text\\\"\";\n }\n\n return {\n text: item.text + additionalText,\n displayText: item.text\n }\n });\n }\n\n return {\n list: hints,\n from: CodeMirror.Pos(cursor.line, token.end),\n to: CodeMirror.Pos(cursor.line, token.end)\n };\n }", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer();\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.pedantic) {\n this.rules = inline.pedantic;\n } else if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n }\n}", "function postProcess(state) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x2B/* + */) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = 'ins_open';\n token.tag = 'ins';\n token.nesting = 1;\n token.markup = '++';\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = 'ins_close';\n token.tag = 'ins';\n token.nesting = -1;\n token.markup = '++';\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '+') {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === 'ins_close') {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n }", "function postProcess(state) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== delimiter.charCodeAt(0)) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = `${ruleName}_open` \n token.tag = 'span';\n token.attrs = [['class', ruleName]];\n token.nesting = 1;\n token.markup = delimiter;\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = `${ruleName}_close` \n token.tag = 'span';\n token.nesting = -1;\n token.markup = delimiter;\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === delimiter.charAt(0)) {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === `${ruleName}_close`) {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n }", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function annotateQuote(quote) {\n return {\n target: [\n {\n selector: [quoteSelector(quote)],\n },\n ],\n };\n}", "preprocess() {\n\t\tlet s = []; // pointer stack\n\t\tthis.s = {}; // pointer cache\n\t\tthis.c = 0; // code pointer\n\t\t\n\t\tthis.log('Validating syntax...');\n\t\twhile (this.c < this.code.length) {\n\t\t\tif (OPCODES.includes(this.C)) {\n\t\t\t\tif (this.C == '[') {\n\t\t\t\t\ts.push(this.c);\n\t\t\t\t} else if (this.C == ']') {\n\t\t\t\t\tlet p = s.pop();\n\t\t\t\t\tif (p === undefined) {\n\t\t\t\t\t\tthrow new SyntaxError(`Unexpected ${this.C} at ${this.c}.`);\n\t\t\t\t\t}\n\t\t\t\t\tthis.s[this.c] = p;\n\t\t\t\t\tthis.s[p] = this.c;\n\t\t\t\t}\n\t\t\t} else if (this.options.strict) {\n\t\t\t\tthrow new SyntaxError(`${this.C} at ${this.c} is not a valid opcode.`);\n\t\t\t}\n\t\t\tthis.c++;\n\t\t}\n\t\tif (s.length) {\n\t\t\tthrow new SyntaxError(`Missing ] for bracket(s) at ${s.join(', ')}`);\n\t\t}\n\t\t// valid syntax!\n\t\treturn true;\n\t}", "function InlineLexer(links, options) {\n\t this.options = options || marked.defaults;\n\t this.links = links;\n\t this.rules = inline.normal;\n\t this.renderer = this.options.renderer || new Renderer();\n\t this.renderer.options = this.options;\n\n\t if (!this.links) {\n\t throw new Error('Tokens array requires a `links` property.');\n\t }\n\n\t if (this.options.gfm) {\n\t if (this.options.breaks) {\n\t this.rules = inline.breaks;\n\t } else {\n\t this.rules = inline.gfm;\n\t }\n\t } else if (this.options.pedantic) {\n\t this.rules = inline.pedantic;\n\t }\n\t }", "function InlineLexer(links, options) {\n\t this.options = options || marked.defaults;\n\t this.links = links;\n\t this.rules = inline.normal;\n\t this.renderer = this.options.renderer || new Renderer();\n\t this.renderer.options = this.options;\n\n\t if (!this.links) {\n\t throw new Error('Tokens array requires a `links` property.');\n\t }\n\n\t if (this.options.gfm) {\n\t if (this.options.breaks) {\n\t this.rules = inline.breaks;\n\t } else {\n\t this.rules = inline.gfm;\n\t }\n\t } else if (this.options.pedantic) {\n\t this.rules = inline.pedantic;\n\t }\n\t }", "function InlineLexer(links, options) {\n\t this.options = options || marked.defaults;\n\t this.links = links;\n\t this.rules = inline.normal;\n\t this.renderer = this.options.renderer || new Renderer;\n\t this.renderer.options = this.options;\n\n\t if (!this.links) {\n\t throw new\n\t Error('Tokens array requires a `links` property.');\n\t }\n\n\t if (this.options.gfm) {\n\t if (this.options.breaks) {\n\t this.rules = inline.breaks;\n\t } else {\n\t this.rules = inline.gfm;\n\t }\n\t } else if (this.options.pedantic) {\n\t this.rules = inline.pedantic;\n\t }\n\t}", "function InlineLexer(links, options) {\n\t this.options = options || marked.defaults;\n\t this.links = links;\n\t this.rules = inline.normal;\n\t this.renderer = this.options.renderer || new Renderer;\n\t this.renderer.options = this.options;\n\n\t if (!this.links) {\n\t throw new\n\t Error('Tokens array requires a `links` property.');\n\t }\n\n\t if (this.options.gfm) {\n\t if (this.options.breaks) {\n\t this.rules = inline.breaks;\n\t } else {\n\t this.rules = inline.gfm;\n\t }\n\t } else if (this.options.pedantic) {\n\t this.rules = inline.pedantic;\n\t }\n\t}", "function InlineLexer(links, options) {\n\t this.options = options || marked.defaults;\n\t this.links = links;\n\t this.rules = inline.normal;\n\t this.renderer = this.options.renderer || new Renderer;\n\t this.renderer.options = this.options;\n\n\t if (!this.links) {\n\t throw new\n\t Error('Tokens array requires a `links` property.');\n\t }\n\n\t if (this.options.gfm) {\n\t if (this.options.breaks) {\n\t this.rules = inline.breaks;\n\t } else {\n\t this.rules = inline.gfm;\n\t }\n\t } else if (this.options.pedantic) {\n\t this.rules = inline.pedantic;\n\t }\n\t}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function InlineLexer(links, options) {\n this.options = options || marked.defaults;\n this.links = links;\n this.rules = inline.normal;\n this.renderer = this.options.renderer || new Renderer;\n this.renderer.options = this.options;\n\n if (!this.links) {\n throw new\n Error('Tokens array requires a `links` property.');\n }\n\n if (this.options.gfm) {\n if (this.options.breaks) {\n this.rules = inline.breaks;\n } else {\n this.rules = inline.gfm;\n }\n } else if (this.options.pedantic) {\n this.rules = inline.pedantic;\n }\n}", "function BatchDetectSyntaxCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }" ]
[ "0.5688169", "0.55967265", "0.5357904", "0.5290633", "0.51772964", "0.51772964", "0.51772964", "0.5155771", "0.5089622", "0.50681895", "0.50666285", "0.504761", "0.50194293", "0.50102824", "0.49902156", "0.49351317", "0.48759824", "0.4871724", "0.48672825", "0.48601577", "0.48559", "0.48424664", "0.48424664", "0.48424664", "0.4834912", "0.48289648", "0.482036", "0.4818424", "0.48146147", "0.4776585", "0.47733185", "0.47674978", "0.4766566", "0.47612166", "0.47576565", "0.4757001", "0.47549272", "0.47518873", "0.47464928", "0.47436285", "0.47136182", "0.47126013", "0.47071272", "0.46892416", "0.46830624", "0.46828604", "0.46777034", "0.46766213", "0.46608984", "0.46608984", "0.46569166", "0.46569166", "0.46569166", "0.46555352", "0.46493432", "0.46480066", "0.46476147", "0.46396917", "0.46396515", "0.46263972", "0.46160385", "0.46160385", "0.46160385", "0.46160385", "0.46159986", "0.46159986", "0.46159986", "0.46159986", "0.46159986", "0.46159986", "0.46151954", "0.46105543", "0.45904753", "0.45904753", "0.45904753", "0.45904753", "0.4589028", "0.4588591", "0.45884", "0.45884", "0.45867062", "0.45867062", "0.45867062", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45811275", "0.45801866" ]
0.49037382
16
A TermTree is the core data structure for the macro expansion process. It acts as a semistructured representation of the syntax.
function TermTree() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function expandTermTreeToFinal(term, context) {\n assert(context && context.env, 'environment map is required');\n if (term.isArrayLiteral) {\n term.array.delim.token.inner = expand(term.array.delim.expose().token.inner, context);\n return term;\n } else if (term.isBlock) {\n term.body.delim.token.inner = expand(term.body.delim.expose().token.inner, context);\n return term;\n } else if (term.isParenExpression) {\n assert(term.expr.delim.token.inner.length === 1, 'Paren expressions always have a single term inside the delimiter');\n term.expr.delim.token.inner = [expandTermTreeToFinal(term.expr.delim.token.inner[0], context)];\n return term;\n } else if (term.isCall) {\n term.fun = expandTermTreeToFinal(term.fun, context);\n term.args = _.map(term.args, function (arg) {\n return expandTermTreeToFinal(arg, context);\n });\n return term;\n } else if (term.isConst) {\n term.call = expandTermTreeToFinal(term.call, context);\n return term;\n } else if (term.isUnaryOp) {\n term.expr = expandTermTreeToFinal(term.expr, context);\n return term;\n } else if (term.isBinOp || term.isAssignmentExpression) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right = expandTermTreeToFinal(term.right, context);\n return term;\n } else if (term.isObjGet) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right.delim.token.inner = expand(term.right.delim.expose().token.inner, context);\n return term;\n } else if (term.isObjDotGet) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right = expandTermTreeToFinal(term.right, context);\n return term;\n } else if (term.isConditionalExpression) {\n term.cond = expandTermTreeToFinal(term.cond, context);\n term.tru = expandTermTreeToFinal(term.tru, context);\n term.fls = expandTermTreeToFinal(term.fls, context);\n return term;\n } else if (term.isVariableDeclaration) {\n if (term.init) {\n term.init = expandTermTreeToFinal(term.init, context);\n }\n return term;\n } else if (term.isVariableStatement) {\n term.decls = _.map(term.decls, function (decl) {\n return expandTermTreeToFinal(decl, context);\n });\n return term;\n } else if (term.isDelimiter) {\n // expand inside the delimiter and then continue on\n term.delim.token.inner = expand(term.delim.expose().token.inner, context);\n return term;\n } else if (term.isNamedFun || term.isAnonFun || term.isCatchClause || term.isArrowFun || term.isModule) {\n // function definitions need a bunch of hygiene logic\n // push down a fresh definition context\n var newDef = [];\n var bodyContext = makeExpanderContext(_.defaults({ defscope: newDef }, context));\n var paramSingleIdent = term.params && term.params.token.type === parser.Token.Identifier;\n var params;\n if (term.params && term.params.token.type === parser.Token.Delimiter) {\n params = term.params.expose();\n } else if (paramSingleIdent) {\n params = term.params;\n } else {\n params = syn.makeDelim('()', [], null);\n }\n var bodies;\n if (Array.isArray(term.body)) {\n bodies = syn.makeDelim('{}', term.body, null);\n } else {\n bodies = term.body;\n }\n bodies = bodies.addDefCtx(newDef);\n var paramNames = _.map(getParamIdentifiers(params), function (param) {\n var freshName = fresh();\n return {\n freshName: freshName,\n originalParam: param,\n renamedParam: param.rename(param, freshName)\n };\n });\n // rename the function body for each of the parameters\n var renamedBody = _.reduce(paramNames, function (accBody, p) {\n return accBody.rename(p.originalParam, p.freshName);\n }, bodies);\n renamedBody = renamedBody.expose();\n var expandedResult = expandToTermTree(renamedBody.token.inner, bodyContext);\n var bodyTerms = expandedResult.terms;\n if (expandedResult.restStx) {\n // The expansion was halted prematurely. Just stop and\n // return what we have so far, along with the rest of the syntax\n renamedBody.token.inner = expandedResult.terms.concat(expandedResult.restStx);\n if (Array.isArray(term.body)) {\n term.body = renamedBody.token.inner;\n } else {\n term.body = renamedBody;\n }\n return term;\n }\n var renamedParams = _.map(paramNames, function (p) {\n return p.renamedParam;\n });\n var flatArgs;\n if (paramSingleIdent) {\n flatArgs = renamedParams[0];\n } else {\n flatArgs = syn.makeDelim('()', joinSyntax(renamedParams, ','), term.params || null);\n }\n var expandedArgs = expand([flatArgs], bodyContext);\n assert(expandedArgs.length === 1, 'should only get back one result');\n // stitch up the function with all the renamings\n if (term.params) {\n term.params = expandedArgs[0];\n }\n bodyTerms = _.map(bodyTerms, function (bodyTerm) {\n // add the definition context to the result of\n // expansion (this makes sure that syntax objects\n // introduced by expansion have the def context)\n if (bodyTerm.isBlock) {\n // we need to expand blocks before adding the defctx since\n // blocks defer macro expansion.\n var blockFinal = expandTermTreeToFinal(bodyTerm, expandedResult.context);\n return blockFinal.addDefCtx(newDef);\n } else {\n var termWithCtx = bodyTerm.addDefCtx(newDef);\n // finish expansion\n return expandTermTreeToFinal(termWithCtx, expandedResult.context);\n }\n });\n if (term.isModule) {\n bodyTerms = _.filter(bodyTerms, function (bodyTerm) {\n if (bodyTerm.isExport) {\n term.exports.push(bodyTerm);\n return false;\n } else {\n return true;\n }\n });\n }\n renamedBody.token.inner = bodyTerms;\n if (Array.isArray(term.body)) {\n term.body = renamedBody.token.inner;\n } else {\n term.body = renamedBody;\n }\n // and continue expand the rest\n return term;\n }\n // the term is fine as is\n return term;\n }", "parseTerm() {\n const assertion = this.maybeParseAssertion();\n if (assertion) {\n return assertion;\n }\n return {\n type: 'Term',\n capturingParenthesesBefore: this.capturingGroups.length,\n Atom: this.parseAtom(),\n Quantifier: this.maybeParseQuantifier(),\n };\n }", "function syntaxTree(state) {\n let field = state.field(Language.state, false);\n return field ? field.tree : common.Tree.empty;\n}", "function macroExpand(syntaxTree) {\n\t\tvar i;\n\t\t\n\t\tfor (i = 0; i < syntaxTree.length; i++) {\n\t\t\tif (Array.isArray(syntaxTree[i])) {\n\t\t\t\tsyntaxTree[i] = macroExpand(syntaxTree[i]);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (syntaxTree.length > 0 && typeof macros[syntaxTree[0]] === 'function') {\n\t\t\treturn macros[syntaxTree[0]](syntaxTree.splice(1));\n\t\t}\n\t\treturn syntaxTree;\n\t}", "function TreeParser() {\n var orderOfOperations,\n tokens,\n length,\n index,\n peekAtNextToken,\n parse,\n parseExpression,\n parseAdditive,\n parseMultiplicative,\n parsePrimary,\n isInLevel,\n parseBinary,\n calculate,\n mathOperations;\n\n orderOfOperations = [['+', '-'],['*', '/'], ['^']];\n\n mathOperations = {\n '+' : function(x, y) {\n return x + y;\n },\n\n '-' : function(x, y) {\n return x - y;\n },\n\n '*' : function(x, y) {\n return x * y;\n },\n\n '/' : function(x, y) {\n if (y === 0) {\n throw 'the right operand of a divide operator cannot be zero';\n }\n return x / y;\n },\n\n '^' : function(x, y) {\n return Math.pow(x, y);\n } \n }\n\n tokens = [];\n length = 0;\n index = 0;\n\n peekAtNextToken = function () {\n if (index === length) {\n return null;\n }\n return tokens[index];\n };\n\n /**\n * creates an abstract tree from a tokens array\n * this function does not validate the expression mathematically\n * @param {array} tokensArr an array that contains tokens\n * @return {object} the abstract expression tree root\n */\n parse = function (tokensArr) {\n tokens = tokensArr;\n length = tokens.length;\n if (length === 0) {\n return;\n }\n index = 0;\n\n //we want to parse the expression from left to right to avoid problems like 1-1-1=1\n tokens = tokens.reverse();\n return parseExpression();\n };\n\n /**\n * parses an assignment expression\n * @return {object} the abstract expression tree assignment node\n */\n parseExpression = function () {\n return parseBinary(0);\n };\n\n /**\n * parses an assignment expression\n * @return {object} the abstract expression tree assignment node\n */\n isInLevel = function (operator, order) {\n return orderOfOperations[order].indexOf(operator) > -1;\n };\n\n /**\n * recursivly parses a binary expression by order of operations\n * each recursion level represents the more immidiate operation\n * @param {Number} order the current order of operation\n * @return {object} the abstract expression tree node\n */\n parseBinary = function (order) {\n var right,\n token,\n node;\n\n right = order == orderOfOperations.length - 1\n ? parsePrimary()\n : parseBinary(order + 1);\n \n token = peekAtNextToken();\n if (token === null) {\n return right;\n }\n\n while (isInLevel(token.value, order)) {\n index += 1;\n node = {};\n node = token;\n node.right = right;\n node.left = parseBinary(order);\n right = node;\n \n token = peekAtNextToken();\n if (token === null) {\n return right;\n }\n }\n\n return right;\n };\n\n /**\n * parses a term expression i.e. a finite number, an varialbe or an expression in parens\n * @return {object} the abstract expression tree primary node\n */\n parsePrimary = function () {\n var token,\n node;\n\n if (index === length) {\n throw \"error: there are no more tokens to parse\";\n }\n\n token = tokens[index];\n if (token.type === tokenType.num || token.type === tokenType.id) {\n index += 1;\n node = {};\n node = token;\n return node;\n }\n\n if (token.value === ')') {\n index += 1;\n node = parseExpression();\n\n token = peekAtNextToken();\n if (token.value !== '(') {\n throw \"error: '(' was expected\";\n }\n\n index += 1;\n return node;\n }\n\n throw \"error: token '\" + token.value + \"' was not expected\";\n };\n\n /**\n * calculates the result from mathematical tree\n * @param {object} the ree/sub tree token node\n * @return {Number} the result of the calculation\n */\n calculate = function (node) {\n var left,\n right,\n operator,\n result;\n\n if (node === null) return;\n if (node.type === tokenType.id) {\n throw 'variables are not supported at this point';\n }\n \n if (node.type === tokenType.num) {\n return parseFloat(node.value);\n }\n\n left = node.left.type === tokenType.num\n ? parseFloat(node.left.value)\n : calculate(node.left);\n\n right = node.right.type === tokenType.num\n ? parseFloat(node.right.value)\n : calculate(node.right);\n\n if (node.type !== tokenType.op) {\n throw 'an operator was expected';\n }\n\n result = mathOperations[node.value](left, right);\n return result; \n }\n\n return {\n parse: parse,\n calculate: calculate\n };\n }", "treefy(tokenArray) {\n // Parent tree\n let tree = new Node();\n\n let index = 0;\n let depth = 0;\n let subarray = [];\n\n while (index < tokenArray.length) {\n\n let token = tokenArray[index++];\n\n if (token.type == Token.SPACE || token.type == Token.COMMENT)\n continue;\n\n // Open\n if (token.type == Token.OPEN) {\n\n depth++;\n\n if (depth == 1) {\n subarray = [];\n continue;\n }\n }\n\n // Close\n else if (token.type == Token.CLOSE) {\n\n depth--;\n\n // Depth cannot be smaller than 0\n if (depth < 0)\n return new Error(Error.SYNTAX, \"Surplus ')' exists\", token.lineNumber);\n\n if (depth == 0) {\n\n // Create sub-tree\n let subtree = this.treefy(subarray);\n\n // If error, just pass beyond (no stack push)\n if (subtree instanceof Error)\n return subtree;\n\n tree.addChild(subtree);\n continue;\n }\n }\n\n // Direct (siblings) token\n if (depth == 0) {\n tree.addChild(new Node(token));\n }\n\n // Subarray (children) token\n else if (depth > 0) {\n subarray.push(token);\n }\n }\n\n // Depth must be 0 at the termination point\n if (depth > 0)\n return new Error(Error.SYNTAX, \"'(' not closed\", tokenArray[tokenArray.length - 1].lineNumber);\n\n return tree;\n }", "function parseTerm() {\n var left = parseFactor();\n var op = tokens[position];\n while (op === '*' || op === '/') {\n ++position;\n var right = parseFactor();\n left = new BinaryOperation(left, op, right);\n op = tokens[position];\n }\n return left;\n }", "function Trees() {\n}", "function Trees() {\n}", "function Tree() {\n this.root = new TreeNode(this);\n }", "function AbstractSyntaxTree(root, current) {\n this.root = root;\n this.current = current;\n this.root = root;\n this.current = current;\n }", "function enforest(toks, context, prevStx, prevTerms) {\n assert(toks.length > 0, 'enforest assumes there are tokens to work with');\n prevStx = prevStx || [];\n prevTerms = prevTerms || [];\n if (expandCount >= maxExpands) {\n return {\n result: null,\n rest: toks\n };\n }\n function step(head, rest, opCtx) {\n var innerTokens;\n assert(Array.isArray(rest), 'result must at least be an empty array');\n if (head.isTermTree) {\n var isCustomOp = false;\n var uopMacroObj;\n var uopSyntax;\n if (head.isPunc || head.isKeyword || head.isId) {\n if (head.isPunc) {\n uopSyntax = head.punc;\n } else if (head.isKeyword) {\n uopSyntax = head.keyword;\n } else if (head.isId) {\n uopSyntax = head.id;\n }\n uopMacroObj = getMacroInEnv(uopSyntax, rest, context.env);\n isCustomOp = uopMacroObj && uopMacroObj.isOp;\n }\n // look up once (we want to check multiple properties on bopMacroObj\n // without repeatedly calling getMacroInEnv)\n var bopMacroObj;\n if (rest[0] && rest[1]) {\n bopMacroObj = getMacroInEnv(rest[0], rest.slice(1), context.env);\n }\n // unary operator\n if (isCustomOp && uopMacroObj.unary || uopSyntax && stxIsUnaryOp(uopSyntax)) {\n var uopPrec;\n if (isCustomOp && uopMacroObj.unary) {\n uopPrec = uopMacroObj.unary.prec;\n } else {\n uopPrec = getUnaryOpPrec(unwrapSyntax(uopSyntax));\n }\n var opRest = rest;\n var uopMacroName;\n if (uopMacroObj) {\n uopMacroName = [uopSyntax].concat(rest.slice(0, uopMacroObj.fullName.length - 1));\n opRest = rest.slice(uopMacroObj.fullName.length - 1);\n }\n var leftLeft = opCtx.prevTerms[0] && opCtx.prevTerms[0].isPartial ? opCtx.prevTerms[0] : null;\n var unopTerm = PartialOperation.create(head, leftLeft);\n var unopPrevStx = tagWithTerm(unopTerm, head.destruct().reverse()).concat(opCtx.prevStx);\n var unopPrevTerms = [unopTerm].concat(opCtx.prevTerms);\n var unopOpCtx = _.extend({}, opCtx, {\n combine: function (t) {\n if (t.isExpr) {\n if (isCustomOp && uopMacroObj.unary) {\n var rt$2 = expandMacro(uopMacroName.concat(t.destruct()), context, opCtx, 'unary');\n var newt = get_expression(rt$2.result, context);\n assert(newt.rest.length === 0, 'should never have left over syntax');\n return opCtx.combine(newt.result);\n }\n return opCtx.combine(UnaryOp.create(uopSyntax, t));\n } else {\n // not actually an expression so don't create\n // a UnaryOp term just return with the punctuator\n return opCtx.combine(head);\n }\n },\n prec: uopPrec,\n prevStx: unopPrevStx,\n prevTerms: unopPrevTerms,\n op: unopTerm\n });\n return step(opRest[0], opRest.slice(1), unopOpCtx);\n } // BinOp\n else if (head.isExpr && (rest[0] && rest[1] && (stxIsBinOp(rest[0]) && !bopMacroObj || bopMacroObj && bopMacroObj.isOp && bopMacroObj.binary))) {\n var opRes;\n var op = rest[0];\n var left = head;\n var rightStx = rest.slice(1);\n var leftLeft = opCtx.prevTerms[0] && opCtx.prevTerms[0].isPartial ? opCtx.prevTerms[0] : null;\n var leftTerm = PartialExpression.create(head.destruct(), leftLeft, function () {\n return step(head, [], opCtx);\n });\n var opTerm = PartialOperation.create(op, leftTerm);\n var opPrevStx = tagWithTerm(opTerm, [rest[0]]).concat(tagWithTerm(leftTerm, head.destruct()).reverse(), opCtx.prevStx);\n var opPrevTerms = [\n opTerm,\n leftTerm\n ].concat(opCtx.prevTerms);\n var isCustomOp = bopMacroObj && bopMacroObj.isOp && bopMacroObj.binary;\n var bopPrec;\n var bopAssoc;\n if (isCustomOp && bopMacroObj.binary) {\n bopPrec = bopMacroObj.binary.prec;\n bopAssoc = bopMacroObj.binary.assoc;\n } else {\n bopPrec = getBinaryOpPrec(unwrapSyntax(op));\n bopAssoc = getBinaryOpAssoc(unwrapSyntax(op));\n }\n assert(bopPrec !== undefined, 'expecting a precedence for operator: ' + op);\n var newStack;\n if (comparePrec(bopPrec, opCtx.prec, bopAssoc)) {\n var bopCtx = opCtx;\n var combResult = opCtx.combine(head);\n if (opCtx.stack.length > 0) {\n return step(combResult.term, rest, opCtx.stack[0]);\n }\n left = combResult.term;\n newStack = opCtx.stack;\n opPrevStx = combResult.prevStx;\n opPrevTerms = combResult.prevTerms;\n } else {\n newStack = [opCtx].concat(opCtx.stack);\n }\n assert(opCtx.combine !== undefined, 'expecting a combine function');\n var opRightStx = rightStx;\n var bopMacroName;\n if (isCustomOp) {\n bopMacroName = rest.slice(0, bopMacroObj.fullName.length);\n opRightStx = rightStx.slice(bopMacroObj.fullName.length - 1);\n }\n var bopOpCtx = _.extend({}, opCtx, {\n combine: function (right) {\n if (right.isExpr) {\n if (isCustomOp && bopMacroObj.binary) {\n var leftStx = left.destruct();\n var rightStx$2 = right.destruct();\n var rt$2 = expandMacro(bopMacroName.concat(syn.makeDelim('()', leftStx, leftStx[0]), syn.makeDelim('()', rightStx$2, rightStx$2[0])), context, opCtx, 'binary');\n var newt = get_expression(rt$2.result, context);\n assert(newt.rest.length === 0, 'should never have left over syntax');\n return {\n term: newt.result,\n prevStx: opCtx.prevStx,\n prevTerms: opCtx.prevTerms\n };\n }\n return {\n term: BinOp.create(left, op, right),\n prevStx: opCtx.prevStx,\n prevTerms: opCtx.prevTerms\n };\n } else {\n return {\n term: head,\n prevStx: opCtx.prevStx,\n prevTerms: opCtx.prevTerms\n };\n }\n },\n prec: bopPrec,\n op: opTerm,\n stack: newStack,\n prevStx: opPrevStx,\n prevTerms: opPrevTerms\n });\n return step(opRightStx[0], opRightStx.slice(1), bopOpCtx);\n } // Call\n else if (head.isExpr && (rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()')) {\n var argRes, enforestedArgs = [], commas = [];\n rest[0].expose();\n innerTokens = rest[0].token.inner;\n while (innerTokens.length > 0) {\n argRes = enforest(innerTokens, context);\n if (!argRes.result) {\n break;\n }\n enforestedArgs.push(argRes.result);\n innerTokens = argRes.rest;\n if (innerTokens[0] && innerTokens[0].token.value === ',') {\n // record the comma for later\n commas.push(innerTokens[0]);\n // but dump it for the next loop turn\n innerTokens = innerTokens.slice(1);\n } else {\n // either there are no more tokens or\n // they aren't a comma, either way we\n // are done with the loop\n break;\n }\n }\n var argsAreExprs = _.all(enforestedArgs, function (argTerm) {\n return argTerm.isExpr;\n });\n // only a call if we can completely enforest each argument and\n // each argument is an expression\n if (innerTokens.length === 0 && argsAreExprs) {\n return step(Call.create(head, enforestedArgs, rest[0], commas), rest.slice(1), opCtx);\n }\n } // Conditional ( x ? true : false)\n else if (head.isExpr && (rest[0] && resolveFast(rest[0], context.env) === '?')) {\n var question = rest[0];\n var condRes = enforest(rest.slice(1), context);\n if (condRes.result) {\n var truExpr = condRes.result;\n var condRight = condRes.rest;\n if (truExpr.isExpr && condRight[0] && resolveFast(condRight[0], context.env) === ':') {\n var colon = condRight[0];\n var flsRes = enforest(condRight.slice(1), context);\n var flsExpr = flsRes.result;\n if (flsExpr.isExpr) {\n return step(ConditionalExpression.create(head, question, truExpr, colon, flsExpr), flsRes.rest, opCtx);\n }\n }\n }\n } // Constructor\n else if (head.isKeyword && resolveFast(head.keyword, context.env) === 'new' && rest[0]) {\n var newCallRes = enforest(rest, context);\n if (newCallRes && newCallRes.result.isExpr) {\n return step(Const.create(head, newCallRes.result), newCallRes.rest, opCtx);\n }\n } // Arrow functions with expression bodies\n else if (head.isDelimiter && head.delim.token.value === '()' && rest[0] && rest[0].token.type === parser.Token.Punctuator && resolveFast(rest[0], context.env) === '=>') {\n var arrowRes = enforest(rest.slice(1), context);\n if (arrowRes.result && arrowRes.result.isExpr) {\n return step(ArrowFun.create(head.delim, rest[0], arrowRes.result.destruct()), arrowRes.rest, opCtx);\n } else {\n throwSyntaxError('enforest', 'Body of arrow function must be an expression', rest.slice(1));\n }\n } // Arrow functions with expression bodies\n else if (head.isId && rest[0] && rest[0].token.type === parser.Token.Punctuator && resolveFast(rest[0], context.env) === '=>') {\n var res = enforest(rest.slice(1), context);\n if (res.result && res.result.isExpr) {\n return step(ArrowFun.create(head.id, rest[0], res.result.destruct()), res.rest, opCtx);\n } else {\n throwSyntaxError('enforest', 'Body of arrow function must be an expression', rest.slice(1));\n }\n } // ParenExpr\n else if (head.isDelimiter && head.delim.token.value === '()') {\n innerTokens = head.delim.expose().token.inner;\n // empty parens are acceptable but enforest\n // doesn't accept empty arrays so short\n // circuit here\n if (innerTokens.length === 0) {\n head.delim.token.inner = [Empty.create()];\n return step(ParenExpression.create(head), rest, opCtx);\n } else {\n var innerTerm = get_expression(innerTokens, context);\n if (innerTerm.result && innerTerm.result.isExpr && innerTerm.rest.length === 0) {\n head.delim.token.inner = [innerTerm.result];\n return step(ParenExpression.create(head), rest, opCtx);\n }\n } // if the tokens inside the paren aren't an expression\n // we just leave it as a delimiter\n } // AssignmentExpression\n else if (head.isExpr && ((head.isId || head.isObjGet || head.isObjDotGet || head.isThisExpression) && rest[0] && rest[1] && !bopMacroObj && stxIsAssignOp(rest[0]))) {\n var opRes = enforestAssignment(rest, context, head, prevStx, prevTerms);\n if (opRes && opRes.result) {\n return step(opRes.result, opRes.rest, _.extend({}, opCtx, {\n prevStx: opRes.prevStx,\n prevTerms: opRes.prevTerms\n }));\n }\n } // Postfix\n else if (head.isExpr && (rest[0] && (unwrapSyntax(rest[0]) === '++' || unwrapSyntax(rest[0]) === '--'))) {\n // Check if the operator is a macro first.\n if (context.env.has(resolveFast(rest[0], context.env))) {\n var headStx = tagWithTerm(head, head.destruct().reverse());\n var opPrevStx = headStx.concat(prevStx);\n var opPrevTerms = [head].concat(prevTerms);\n var opRes = enforest(rest, context, opPrevStx, opPrevTerms);\n if (opRes.prevTerms.length < opPrevTerms.length) {\n return opRes;\n } else if (opRes.result) {\n return step(head, opRes.result.destruct().concat(opRes.rest), opCtx);\n }\n }\n return step(PostfixOp.create(head, rest[0]), rest.slice(1), opCtx);\n } // ObjectGet (computed)\n else if (head.isExpr && (rest[0] && rest[0].token.value === '[]')) {\n return step(ObjGet.create(head, Delimiter.create(rest[0].expose())), rest.slice(1), opCtx);\n } // ObjectGet\n else if (head.isExpr && (rest[0] && unwrapSyntax(rest[0]) === '.' && !context.env.has(resolveFast(rest[0], context.env)) && rest[1] && (rest[1].token.type === parser.Token.Identifier || rest[1].token.type === parser.Token.Keyword))) {\n // Check if the identifier is a macro first.\n if (context.env.has(resolveFast(rest[1], context.env))) {\n var headStx = tagWithTerm(head, head.destruct().reverse());\n var dotTerm = Punc.create(rest[0]);\n var dotTerms = [dotTerm].concat(head, prevTerms);\n var dotStx = tagWithTerm(dotTerm, [rest[0]]).concat(headStx, prevStx);\n var dotRes = enforest(rest.slice(1), context, dotStx, dotTerms);\n if (dotRes.prevTerms.length < dotTerms.length) {\n return dotRes;\n } else if (dotRes.result) {\n return step(head, [rest[0]].concat(dotRes.result.destruct(), dotRes.rest), opCtx);\n }\n }\n return step(ObjDotGet.create(head, rest[0], rest[1]), rest.slice(2), opCtx);\n } // ArrayLiteral\n else if (head.isDelimiter && head.delim.token.value === '[]') {\n return step(ArrayLiteral.create(head), rest, opCtx);\n } // Block\n else if (head.isDelimiter && head.delim.token.value === '{}') {\n return step(Block.create(head), rest, opCtx);\n } // quote syntax\n else if (head.isId && unwrapSyntax(head.id) === '#quoteSyntax' && rest[0] && rest[0].token.value === '{}') {\n var tempId = fresh();\n context.templateMap.set(tempId, rest[0].token.inner);\n return step(syn.makeIdent('getTemplate', head.id), [syn.makeDelim('()', [syn.makeValue(tempId, head.id)], head.id)].concat(rest.slice(1)), opCtx);\n } // let statements\n else if (head.isKeyword && unwrapSyntax(head.keyword) === 'let') {\n var nameTokens = [];\n if (rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()') {\n nameTokens = rest[0].token.inner;\n } else {\n nameTokens.push(rest[0]);\n }\n // Let macro\n if (rest[1] && rest[1].token.value === '=' && rest[2] && rest[2].token.value === 'macro') {\n var mac = enforest(rest.slice(2), context);\n if (mac.result) {\n if (!mac.result.isAnonMacro) {\n throwSyntaxError('enforest', 'expecting an anonymous macro definition in syntax let binding', rest.slice(2));\n }\n return step(LetMacro.create(nameTokens, mac.result.body), mac.rest, opCtx);\n }\n } // Let statement\n else {\n var lsRes = enforestVarStatement(rest, context, head.keyword);\n if (lsRes && lsRes.result) {\n return step(LetStatement.create(head, lsRes.result), lsRes.rest, opCtx);\n }\n }\n } // VariableStatement\n else if (head.isKeyword && unwrapSyntax(head.keyword) === 'var' && rest[0]) {\n var vsRes = enforestVarStatement(rest, context, head.keyword);\n if (vsRes && vsRes.result) {\n return step(VariableStatement.create(head, vsRes.result), vsRes.rest, opCtx);\n }\n } // Const Statement\n else if (head.isKeyword && unwrapSyntax(head.keyword) === 'const' && rest[0]) {\n var csRes = enforestVarStatement(rest, context, head.keyword);\n if (csRes && csRes.result) {\n return step(ConstStatement.create(head, csRes.result), csRes.rest, opCtx);\n }\n } // for statement\n else if (head.isKeyword && unwrapSyntax(head.keyword) === 'for' && rest[0] && rest[0].token.value === '()') {\n return step(ForStatement.create(head.keyword, rest[0]), rest.slice(1), opCtx);\n } // yield statement\n else if (head.isKeyword && unwrapSyntax(head.keyword) === 'yield') {\n var yieldExprRes = enforest(rest, context);\n if (yieldExprRes.result && yieldExprRes.result.isExpr) {\n return step(YieldExpression.create(head.keyword, yieldExprRes.result), yieldExprRes.rest, opCtx);\n }\n }\n } else {\n assert(head && head.token, 'assuming head is a syntax object');\n var macroObj = expandCount < maxExpands && getMacroInEnv(head, rest, context.env);\n // macro invocation\n if (macroObj && !macroObj.isOp) {\n var rt = expandMacro([head].concat(rest), context, opCtx, null, macroObj);\n var newOpCtx = opCtx;\n if (rt.prevTerms && rt.prevTerms.length < opCtx.prevTerms.length) {\n newOpCtx = rewindOpCtx(opCtx, rt);\n }\n if (rt.result.length > 0) {\n return step(rt.result[0], rt.result.slice(1).concat(rt.rest), newOpCtx);\n } else {\n return step(Empty.create(), rt.rest, newOpCtx);\n }\n } // anon macro definition\n else if (head.token.type === parser.Token.Identifier && resolve(head) === 'macro' && rest[0] && rest[0].token.value === '{}') {\n return step(AnonMacro.create(rest[0].expose().token.inner), rest.slice(1), opCtx);\n } // macro definition\n else if (head.token.type === parser.Token.Identifier && resolve(head) === 'macro') {\n var nameTokens = [];\n if (rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()') {\n nameTokens = rest[0].expose().token.inner;\n } else {\n nameTokens.push(rest[0]);\n }\n if (rest[1] && rest[1].token.type === parser.Token.Delimiter) {\n return step(Macro.create(nameTokens, rest[1].expose().token.inner), rest.slice(2), opCtx);\n } else {\n throwSyntaxError('enforest', 'Macro declaration must include body', rest[1]);\n }\n } // operator definition\n // unaryop (neg) 1 { macro { rule { $op:expr } => { $op } } }\n else if (head.token.type === parser.Token.Identifier && head.token.value === 'unaryop' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.NumericLiteral && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2] && rest[2].token.value === '{}') {\n var trans = enforest(rest[2].expose().token.inner, context);\n return step(OperatorDefinition.create('unary', rest[0].expose().token.inner, rest[1], null, trans.result.body), rest.slice(3), opCtx);\n } // operator definition\n // binaryop (neg) 1 left { macro { rule { $op:expr } => { $op } } }\n else if (head.token.type === parser.Token.Identifier && head.token.value === 'binaryop' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.NumericLiteral && rest[2] && rest[2].token.type === parser.Token.Identifier && rest[3] && rest[3].token.type === parser.Token.Delimiter && rest[3] && rest[3].token.value === '{}') {\n var trans = enforest(rest[3].expose().token.inner, context);\n return step(OperatorDefinition.create('binary', rest[0].expose().token.inner, rest[1], rest[2], trans.result.body), rest.slice(4), opCtx);\n } // module definition\n else if (unwrapSyntax(head) === 'module' && rest[0] && rest[0].token.value === '{}') {\n return step(Module.create(rest[0], []), rest.slice(1), opCtx);\n } // function definition\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Identifier && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '()' && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2].token.value === '{}') {\n rest[1].token.inner = rest[1].expose().token.inner;\n rest[2].token.inner = rest[2].expose().token.inner;\n return step(NamedFun.create(head, null, rest[0], rest[1], rest[2]), rest.slice(3), opCtx);\n } // generator function definition\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Punctuator && rest[0].token.value === '*' && rest[1] && rest[1].token.type === parser.Token.Identifier && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2].token.value === '()' && rest[3] && rest[3].token.type === parser.Token.Delimiter && rest[3].token.value === '{}') {\n rest[2].token.inner = rest[2].expose().token.inner;\n rest[3].token.inner = rest[3].expose().token.inner;\n return step(NamedFun.create(head, rest[0], rest[1], rest[2], rest[3]), rest.slice(4), opCtx);\n } // anonymous function definition\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '{}') {\n rest[0].token.inner = rest[0].expose().token.inner;\n rest[1].token.inner = rest[1].expose().token.inner;\n return step(AnonFun.create(head, null, rest[0], rest[1]), rest.slice(2), opCtx);\n } // anonymous generator function definition\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Punctuator && rest[0].token.value === '*' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '()' && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2].token.value === '{}') {\n rest[1].token.inner = rest[1].expose().token.inner;\n rest[2].token.inner = rest[2].expose().token.inner;\n return step(AnonFun.create(head, rest[0], rest[1], rest[2]), rest.slice(3), opCtx);\n } // arrow function\n else if ((head.token.type === parser.Token.Delimiter && head.token.value === '()' || head.token.type === parser.Token.Identifier) && rest[0] && rest[0].token.type === parser.Token.Punctuator && resolveFast(rest[0], context.env) === '=>' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '{}') {\n return step(ArrowFun.create(head, rest[0], rest[1]), rest.slice(2), opCtx);\n } // catch statement\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'catch' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '{}') {\n rest[0].token.inner = rest[0].expose().token.inner;\n rest[1].token.inner = rest[1].expose().token.inner;\n return step(CatchClause.create(head, rest[0], rest[1]), rest.slice(2), opCtx);\n } // this expression\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'this') {\n return step(ThisExpression.create(head), rest, opCtx);\n } // literal\n else if (head.token.type === parser.Token.NumericLiteral || head.token.type === parser.Token.StringLiteral || head.token.type === parser.Token.BooleanLiteral || head.token.type === parser.Token.RegularExpression || head.token.type === parser.Token.NullLiteral) {\n return step(Lit.create(head), rest, opCtx);\n } // export\n else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'export' && rest[0] && (rest[0].token.type === parser.Token.Identifier || rest[0].token.type === parser.Token.Keyword || rest[0].token.type === parser.Token.Punctuator || rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()')) {\n return step(Export.create(rest[0]), rest.slice(1), opCtx);\n } // identifier\n else if (head.token.type === parser.Token.Identifier) {\n return step(Id.create(head), rest, opCtx);\n } // punctuator\n else if (head.token.type === parser.Token.Punctuator) {\n return step(Punc.create(head), rest, opCtx);\n } else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'with') {\n throwSyntaxError('enforest', 'with is not supported in sweet.js', head);\n } // keyword\n else if (head.token.type === parser.Token.Keyword) {\n return step(Keyword.create(head), rest, opCtx);\n } // Delimiter\n else if (head.token.type === parser.Token.Delimiter) {\n return step(Delimiter.create(head.expose()), rest, opCtx);\n } else if (head.token.type === parser.Token.Template) {\n return step(Template.create(head), rest, opCtx);\n } // end of file\n else if (head.token.type === parser.Token.EOF) {\n assert(rest.length === 0, 'nothing should be after an EOF');\n return step(EOF.create(head), [], opCtx);\n } else {\n // todo: are we missing cases?\n assert(false, 'not implemented');\n }\n }\n // Potentially an infix macro\n if (head.isExpr && rest.length && nameInEnv(rest[0], rest.slice(1), context.env)) {\n var infLeftTerm = opCtx.prevTerms[0] && opCtx.prevTerms[0].isPartial ? opCtx.prevTerms[0] : null;\n var infTerm = PartialExpression.create(head.destruct(), infLeftTerm, function () {\n return step(head, [], opCtx);\n });\n var infPrevStx = tagWithTerm(infTerm, head.destruct()).reverse().concat(opCtx.prevStx);\n var infPrevTerms = [infTerm].concat(opCtx.prevTerms);\n var infRes = expandMacro(rest, context, {\n prevStx: infPrevStx,\n prevTerms: infPrevTerms\n });\n if (infRes.prevTerms && infRes.prevTerms.length < infPrevTerms.length) {\n var infOpCtx = rewindOpCtx(opCtx, infRes);\n return step(infRes.result[0], infRes.result.slice(1).concat(infRes.rest), infOpCtx);\n } else {\n return step(head, infRes.result.concat(infRes.rest), opCtx);\n }\n }\n // done with current step so combine and continue on\n var combResult = opCtx.combine(head);\n if (opCtx.stack.length === 0) {\n return {\n result: combResult.term,\n rest: rest,\n prevStx: combResult.prevStx,\n prevTerms: combResult.prevTerms\n };\n } else {\n return step(combResult.term, rest, opCtx.stack[0]);\n }\n }\n return step(toks[0], toks.slice(1), {\n combine: function (t) {\n return {\n term: t,\n prevStx: prevStx,\n prevTerms: prevTerms\n };\n },\n prec: 0,\n stack: [],\n op: null,\n prevStx: prevStx,\n prevTerms: prevTerms\n });\n }", "function tokenize(content) {\n\t\n\tif (!content.endsWith('\\n')) {\n\t\tcontent += '\\n';\n\t}\n\t\n\t//Not the full list of tokens; namely, brackets aren't in this list.\n\t//Sorted by longest first, for greediness.\n\tvar tokens = [\n\t\t\"==\",\n\t\t\"!=\",\n\t\t\"<=\",\n\t\t\">=\",\n\t\t\"+=\",\n\t\t\"-=\",\n\t\t\"*=\",\n\t\t\"/=\",\n\t\t\"%=\",\n\t\t\"**=\",\n\t\t\"<\",\n\t\t\">\",\n\t\t\"=\",\n\t\t\"++\",\n\t\t\"--\",\n\t\t\"+\",\n\t\t\"-\",\n\t\t\",\",\n\t\t\"/\",\n\t\t\"%\",\n\t\t\"**\",\n\t\t\"*\",\n\t\t\".\",\n\t\t\":\",\n\t\t\"\\\\\",\n\t];\n\t\n\t\n\tvar rules = [];\n\tvar macros = [];\n\t\n\tvar isInSpecial = false;\n\t//var isInString = false;\n\tvar currentStrDelimiter = \"\";\n\tvar isInLineComment = false;\n\tvar isInStrComment = false;\n\tvar isInMacro = false;\n\tvar currentStrCommentDelimiter = \"\";\n\tvar bracketsLevel = 0;\n\tvar isInRule = false;\n\tvar currentRule = {};\n\tvar currentRuleLine = {};\n\t//var currentToken = {\"text\":\"\"};\n\tvar currentMacro = {};\n\tvar isBackslashed = false;\n\tvar isInTextToken = false;\n\t\n\t//\"Timer\" used for end of special zones (eg: the end of a multiline string is 3 characters long).\n\tvar timer = 0;\n\t\n\t//Timer used when inside a macro resolution, in order to stop incrementing column+line.\n\tvar macroTimer = 0;\n\tvar macroCols = 0;\n\tvar macroLines = 0;\n\t\n\tcurrentLineNb = 1;\n\tcurrentColNb = 0;\n\t\n\tvar i = 0;\n\t\n\tfunction addToken(text) {\n\t\t\n\t\tif (text.length === 0) {\n\t\t\terror(\"Token is empty, lexer broke\");\n\t\t}\n\t\t\n\t\t//debug(\"Adding token '\"+text+\"' at \"+currentLineNb+\":\"+currentColNb);\n\t\t\n\t\tcurrentRuleLine.tokens.push({\n\t\t\t\"lineNb\":currentLineNb,\n\t\t\t\"colNb\":currentColNb,\n\t\t\t\"text\":text\n\t\t});\n\t\t\n\t\ti += text.length-1;\n\t\tcurrentColNb += text.length-1;\n\t}\n\t\n\tfunction newRuleLine() {\n\t\t\n\t\tif (currentRuleLine.tokens !== undefined && currentRuleLine.tokens.length > 0) {\n\t\t\tcurrentRule.lines.push(currentRuleLine);\n\t\t}\n\t\t\n\t\tcurrentRuleLine = {\n\t\t\t\"indentLevel\":0,\n\t\t\t\"tokens\":[]\n\t\t};\n\t}\n\t\n\tnewRuleLine();\n\t\t\n\tfor (i = 0; i < content.length; i++) {\n\t\t\n\t\t//console.log(i);\n\t\t//await sleep(5);\n\t\t\n\t\tisInSpecial = (isInLineComment || isInStrComment || isInMacro);\n\t\t\n\t\t\n\t\tif (macroTimer > 0) {\n\t\t\tmacroTimer--;\n\t\t\tif (macroTimer === 0) {\n\t\t\t\t//debug(\"macro lines = \"+macroLines+\", macro cols = \"+macroCols);\n\t\t\t\tcurrentLineNb += macroLines;\n\t\t\t\tcurrentColNb = macroCols;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (macroTimer === 0) {\n\t\t\tcurrentColNb++;\n\t\t}\n\t\t\n\t\t\n\t\tif (timer > 0) {\n\t\t\ttimer--;\n\t\t\tif (timer === 0) {\n\t\t\t\tisInStrComment = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (content[i] === '\\n') {\n\t\t\tif (!isBackslashed) {\n\t\t\t\tif (isInMacro) {\n\t\t\t\t\tisInMacro = false;\n\t\t\t\t\tmacros.push(parseMacro(currentMacro));\n\t\t\t\t}\n\t\t\t}\n\t\t\t//For some reason, in Python, line comments aren't affected by backslashes before new lines.\n\t\t\tif (isInLineComment) {\n\t\t\t\tisInLineComment = false;\n\t\t\t\t\n\t\t\t\n\t\t\t//Do not end the instruction if there is a line break inside a function, or the line is backslashed.\n\t\t\t} else if (bracketsLevel === 0 && isInRule && !isBackslashed) {\n\t\t\t\tnewRuleLine();\n\t\t\t\t\n\t\t\t}\n\t\t\tif (macroTimer === 0) {\n\t\t\t\tcurrentLineNb++;\n\t\t\t\tcurrentColNb = 0;\n\t\t\t}\n\t\t\t\n\t\t} else if (!isInStrComment && !isInMacro && !isInLineComment) {\n\t\t\t\n\t\t\tif (content.startsWith(\" \", i) && currentRuleLine.tokens.length === 0) {\n\t\t\t\tcurrentRuleLine.indentLevel++;\n\t\t\t\tcurrentColNb += \" \".length-1;\n\t\t\t} else if (content.startsWith(\"\\t\", i)) {\n\t\t\t\tif (currentRuleLine.tokens.length === 0) {\n\t\t\t\t\tcurrentRuleLine.indentLevel++;\n\t\t\t\t}\n\t\t\t} else if (content[i] === ' ') {\n\t\t\t\t//do nothing\n\t\t\t} else if (content[i] === '\\\\') {\n\t\t\t\t//do nothing\n\t\t\t} else if (content[i] === '(' || content[i] === '[' || content[i] === '{') {\n\t\t\t\tbracketsLevel++;\n\t\t\t\taddToken(content[i]);\n\t\t\t\t\n\t\t\t} else if (content[i] === ')' || content[i] === ']' || content[i] === '}') {\n\t\t\t\tbracketsLevel--;\n\t\t\t\tif (bracketsLevel < 0) {\n\t\t\t\t\terror(\"Brackets level below 0\");\n\t\t\t\t}\n\t\t\t\taddToken(content[i]);\n\t\t\t\t\n\t\t\t} else if (content.startsWith(\"#!\", i)) {\n\t\t\t\tif (!isInRule) {\n\t\t\t\t\tisInMacro = true;\n\t\t\t\t\tcurrentMacro = {\n\t\t\t\t\t\t\"lineStart\":currentLineNb,\n\t\t\t\t\t\t\"content\":\"\"\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\terror(\"Cannot declare macro inside a rule\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else if (content[i] === '#') {\n\t\t\t\tisInLineComment = true;\n\t\t\t\n\t\t\t} else if (content.startsWith(\"'''\", i)) {\n\t\t\t\tisInStrComment = true;\n\t\t\t\tcurrentStrCommentDelimiter = \"'''\";\n\t\t\t\t\n\t\t\t} else if (content.startsWith('\"\"\"', i)) {\n\t\t\t\tisInStrComment = true;\n\t\t\t\tcurrentStrCommentDelimiter = '\"\"\"';\n\t\t\t\t\n\t\t\t} else if (content[i] === '\"' || content[i] === '\\'') {\n\t\t\t\tcurrentStrDelimiter = content[i];\n\t\t\t\t//Get to the end of the string\n\t\t\t\tvar j = i+1;\n\t\t\t\tfor (; j < content.length; j++) {\n\t\t\t\t\t\n\t\t\t\t\t//Test for potentially unclosed string\n\t\t\t\t\tif (!isBackslashed && content[j] === '\\n') {\n\t\t\t\t\t\terror(\"Unclosed string\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!isBackslashed && content[j] === currentStrDelimiter) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\tif (content[j] === '\\\\') {\n\t\t\t\t\t\tisBackslashed = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tisBackslashed = false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tj += 1; //account for closing delimiter\n\t\t\t\t\n\t\t\t\tif (j > i) {\n\t\t\t\t\taddToken(content.substring(i, j));\n\t\t\t\t} else {\n\t\t\t\t\terror(\"Failed to parse string '\"+content.substring(i, j)+\"' (malformed string?)\");\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//Test each macro\n\t\t\t\tfor (var j = 0; j < macros.length; j++) {\n\t\t\t\t\tif (content.startsWith(macros[j].name, i)) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar text;\n\t\t\t\t\t\tvar replacement;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (macros[j].isFunction) {\n\t\t\t\t\t\t\t//debug(\"Resolving function macro \"+macros[j].name);\n\t\t\t\t\t\t\tvar bracketPos = getBracketPositions(content.substring(i), true);\n\t\t\t\t\t\t\ttext = content.substring(i, i+bracketPos[1]+1);\n\t\t\t\t\t\t\tvar macroArgs = getArgs(content.substring(i+bracketPos[0]+1, i+bracketPos[1]));\n\t\t\t\t\t\t\treplacement = resolveMacro(macros[j], macroArgs);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//debug(\"Resolving normal macro \"+macros[j].name);\n\t\t\t\t\t\t\ttext = macros[j].name;\n\t\t\t\t\t\t\treplacement = macros[j].replacement;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tcontent = content.substring(0, i) + replacement + content.substring(i+text.length);\n\t\t\t\t\t\tif (macroTimer === 0) {\n\t\t\t\t\t\t\tif (text.indexOf('\\n') >= 0) {\n\t\t\t\t\t\t\t\tmacroCols = text.length - text.lastIndexOf('\\n');\n\t\t\t\t\t\t\t\tmacroLines = text.split('\\n').length-1;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmacroCols = text.length;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmacroTimer += replacement.length;\n\t\t\t\t\t\t\n\t\t\t\t\t\t//debug(\"Text: \"+text);\n\t\t\t\t\t\t//debug(\"Replacement: \"+replacement);\n\t\t\t\t\t\t\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Get token\n\t\t\t\tvar j = i;\n\t\t\t\tfor (; j < content.length && isVarChar(content[j]); j++);\n\t\t\t\t\n\t\t\t\tif (j > i) {\n\t\t\t\t\tif (content.substring(i, j) === \"@Rule\") {\n\t\t\t\t\t\tisInRule = true;\n\t\t\t\t\t\trules.push(currentRule);\n\t\t\t\t\t\tcurrentRule = {\n\t\t\t\t\t\t\t\"lineStart\":currentLineNb,\n\t\t\t\t\t\t\t\"lines\":[]\n\t\t\t\t\t\t};\n\t\t\t\t\t\tnewRuleLine();\n\t\t\t\t\t} else if (!isInRule) {\n\t\t\t\t\t\terror(\"Found code outside a rule : \"+content[i]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//Handle the special case of min= and max= operators\n\t\t\t\t\tif ((content.substring(i,j) === \"min\" || content.substring(i,j) === \"max\") && content[i+\"min\".length] === '=') {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\taddToken(content.substring(i, j))\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tvar hasTokenBeenFound = false;\n\t\t\t\t\t//Test each remaining token\n\t\t\t\t\tfor (var h = 0; h < tokens.length; h++) {\n\t\t\t\t\t\tif (content.startsWith(tokens[h], i)) {\n\t\t\t\t\t\t\taddToken(content.substring(i, i+tokens[h].length));\n\t\t\t\t\t\t\thasTokenBeenFound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!hasTokenBeenFound) {\n\t\t\t\t\t\terror(\"Unknown token '\"+content[i]+\"'\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t} else if (isInStrComment && content.startsWith(currentStrCommentDelimiter, i)) {\n\t\t\ttimer = 3;\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tif (content[i] === '\\\\') {\n\t\t\tisBackslashed = true;\n\t\t} else {\n\t\t\tisBackslashed = false;\n\t\t}\n\t\t\n\t\tif (isInMacro) {\n\t\t\tcurrentMacro.content += content[i];\n\t\t}\n\t}\n\t\n\trules.push(currentRule);\n\t\n\tconsole.log(\"macros = \");\n\tconsole.log(macros);\n\t\n\treturn rules.slice(1)\n\t\n}", "function Tree (value) {\n this.value =value;\n this.children = [];\n }", "function expandTree(tree) {\n\t\ttraverseTree(tree, function(tree, char, i) {\n\t\t\ttree[i] = expandChar(char);\n\t\t});\n\t\treturn tree;\n\t}", "function parse(array,tree){\n\tvar currentToken = 0;\n\tvar parseString = \"\";\n var cstString = \"\";\n var astString = \"\";\n\tvar errors = false;\n var cstDepth = 0;\n var astDepth = 0;\n\n //Boolean assist\n var boolDepth = 0;\n\n //Add assist\n var addDepth = 0;\n\n //Tree Object Vars\n var asTree = new Tree();\n var scope = -1;\n var blockList = [];\n var string = \"\";\n\n //Symbol Table Helpers\n var symbolArray = []; //array of declared symbols\n\n var returnArr;\n \n parseString += \"PARSER: parse()\\n\";\n\n parseProgram();\n\n returnArr = [errors, parseString, cstString, astString, asTree, symbolArray];\n return returnArr;\n\n\tfunction treeMaker(e){\n\t\tvar treeBranch = \"\";\n\t\tif(e > 0){\n\t\t\tfor(l = 0; l < e; l++){\n\t\t\t\ttreeBranch+=\"-\";\n\t\t\t}\n\t\t}\n\t\treturn treeBranch;\n }\n\n\tfunction match(t){\n\t\tif(array[currentToken][0] != t && errors == false){\n\t\t\tparseString+= \"PARSER: ERROR: Expected \" + t + \" got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t} else if(array[currentToken][0] != t){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t} else {\n\t\t\tcstString+= treeMaker(cstDepth)+\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseProgram(){\n\t\tparseString+= \"PARSER: parseProgram()\\n\";\n\t\tcstString+= \"<Program>\\n\";\n\t\tparseBlock([0]);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_EOP\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBlock(arr){\n\t\tparseString+= \"PARSER: parseBlock()\\n\";\n \n //CST\n cstDepth++;\n\t\tcstString+= treeMaker(cstDepth)+\"<Block>\\n\";\n cstDepth++;\n //AST\n astString+= treeMaker(astDepth)+\"< BLOCK >\\n\";\n astDepth++;\n\n //Tree\n scope++;\n blockList.push([\"BLOCK\", array[currentToken][2], scope]); //add block to blocklist\n\n if (arr.length == 1){\n if (scope > 0){\n asTree.add(blockList[scope],blockList[scope-1]); //parent will be previous scope's block node\n } else {\n asTree.add(blockList[scope]);\n }\n } else {\n asTree.add(blockList[scope], arr); //parent will be if or while\n }\n\n\t\tmatch(\"T_LBRACE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n parseStatementList();\n \n scope--;\n\n\t\tmatch(\"T_RBRACE\");\n \n cstDepth--;\n astDepth--;\n \n if(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseStatementList(){\n parseString+= \"PARSER: parseStatementList()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement List>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\" || array[currentToken][0]==\"T_ID\" || \n\t\t array[currentToken][0]==\"T_VAR_TYPE_INT\" || array[currentToken][0]==\"T_VAR_TYPE_STRING\" ||\n\t\t array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\" || array[currentToken][0]==\"T_WHILE\" ||\n\t\t array[currentToken][0]==\"T_IF\" || array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tcstDepth++;\n\t\t\tparseStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tcstDepth-=2;\n\t\t\tparseStatementList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseStatement(){\n parseString+= \"PARSER: parseStatement()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\"){\n\t\t\tparsePrintStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseAssignmentStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_INT\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_STRING\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tparseVarDecl();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_WHILE\"){\n\t\t\tparseWhileStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_IF\"){\n\t\t\tparseIfStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tparseBlock([0]);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected print/id/int/string/boolean/while/if/lbrace got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parsePrintStatement(){\n parseString+= \"PARSER: parsePrintStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Print Statement>\\n\";\n //AST\n astString+= treeMaker(astDepth) + \"< Print Statement >\\n\";\n\n //Tree\n var printNode = [\"Print Statement\", array[currentToken][2], scope];\n asTree.add(printNode,blockList[scope]); //add [print node, parent block]\n \n\t\tmatch(\"T_PRINT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_LPAREN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n \n astDepth++;\n\n\t\tparseExpr(printNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n match(\"T_RPAREN\");\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseAssignmentStatement(){\n\t\tparseString+= \"PARSER: parseAssignmentStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Assignment Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Assignment Statement >\\n\";\n astDepth++;\n \n //Tree\n var assignmentNode = [\"Assignment Statement\", array[currentToken][2],scope];\n\n asTree.add(assignmentNode, blockList[scope]); //add [assignment node, parent block]\n\n parseId(assignmentNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_ASSIGN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseExpr(assignmentNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseVarDecl(){\n\t\tparseString+= \"PARSER: parseVarDecl()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Variable Declaration Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Variable Declaration >\\n\";\n astDepth++;\n\n //Tree\n var declarationNode = [\"Variable Declaration\", array[currentToken][2], scope];\n\n asTree.add(declarationNode, blockList[scope]); //add [variable decl node, parent block]\n\n //Symbol Table Helper\n\n symbolArray.push([array[currentToken + 1][1], array[currentToken][1], scope, array[currentToken][2]]);\n\n\t\tparseType(declarationNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseId(declarationNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseWhileStatement(){\n\t\tparseString+= \"PARSER: parseWhileStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<While Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< While Statement >\\n\";\n astDepth++;\n\n //Tree\n var whileNode = [\"While Statement\", array[currentToken][2], scope];\n\n asTree.add(whileNode, blockList[scope]); //add [while node, parent block]\n\n\t\tmatch(\"T_WHILE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(whileNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(whileNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseIfStatement(){\n\t\tparseString+= \"PARSER: parseIfStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<If Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< If Statement >\\n\";\n astDepth++;\n\n //Tree\n var ifNode = [\"If Statement\", array[currentToken][2], scope];\n\n asTree.add(ifNode, blockList[scope]); //add [if node, parent block]\n\n\t\tmatch(\"T_IF\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(ifNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(ifNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseExpr(arr){\n\t\tparseString+= \"PARSER: parseExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Expression>\\n\";\n\n\t\tif(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseIntExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_QUOTE\"){\n\t\t\tparseStringExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n else if (array[currentToken][0] == \"T_LPAREN\"){\n parseBooleanExpr(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if (array[currentToken][0] == \"T_FALSE\" ||\n array[currentToken][0] == \"T_TRUE\"){\n parseBoolVal(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseId(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT or T_QUOTE or T_LPAREN or T_ID or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n }\n\n\tfunction parseIntExpr(arr){\n parseString+= \"PARSER: parseIntExpr()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Integer Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_DIGIT\" && array[currentToken+1][0]==\"T_ADD\"){\n //AST\n astString += treeMaker(astDepth) + \"< Add >\\n\";\n astDepth++;\n addDepth++;\n\n //Tree\n var addNode = [\"Add\", array[currentToken][2], scope, addDepth];\n\n asTree.add(addNode, arr); //add [add node, parent]\n\n\t\t\tparseDigit(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseIntOp();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseDigit(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n }\n //astDepth--;\n\t}\n\n\tfunction parseStringExpr(arr){\n\t\tparseString+= \"PARSER: parseStringExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<String Expression>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \";\n\n string = \"\"; //reset variable\n var stringLine = array[currentToken][2];\n\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseCharList();\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n //AST\n astString += \" ]\\n\";\n //ADD THE RIGHT STRING NODE TO THE AST\n //Tree\n var stringNode = [\"T_STRING\", string, stringLine,scope];\n asTree.add(stringNode, arr); //add [string node, parent]\n string = \"\"; //reset variable\n\n\t}\n\n\tfunction parseBooleanExpr(arr){\n\t\tparseString+= \"PARSER: parseBooleanExpr()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Boolean Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_LPAREN\"){\n //AST\n astString += treeMaker(astDepth) + \"< Boolean Expression >\\n\";\n astDepth++;\n boolDepth++;\n //Tree\n var boolExpNode = [\"Boolean Expression\", array[currentToken][2], scope, boolDepth];\n asTree.add(boolExpNode, arr); //add [bool exp node, parent block]\n\t\t\tmatch(\"T_LPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseBoolOp(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n match(\"T_RPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n } else if (array[currentToken][0] == \"T_TRUE\" || array[currentToken][0] == \"T_FALSE\"){\n parseBoolVal(arr);\n if(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n } else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_LPAREN or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseId(arr){\n\t\tparseString+= \"PARSER: parseId()\\n\";\n cstString+= treeMaker(cstDepth)+\"<ID>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n \n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [id node, parent]\n \n match(\"T_ID\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\t\t\n\t}\n\n\tfunction parseCharList(){\n\t\tparseString+= \"PARSER: parseCharList()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Character List>\\n\";\n if (array[currentToken][0] == \"T_CHAR\" && array[currentToken][1] == \" \") {\n parseSpace();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n parseCharList();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if(array[currentToken][0]==\"T_CHAR\"){\n\t\t\tparseChar();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseCharList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseType(arr){\n\t\tparseString+= \"PARSER: parseType()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Type>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tif(array[currentToken][0]==\"T_VAR_TYPE_INT\"){\n\t\t\tmatch(\"T_VAR_TYPE_INT\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_STRING\"){\n\t\t\tmatch(\"T_VAR_TYPE_STRING\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tmatch(\"T_VAR_TYPE_BOOLEAN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_VAR_TYPE_INT/STRING/BOOLEAN got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseChar(){\n\t\tparseString+= \"PARSER: parseChar()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tmatch(\"T_CHAR\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n\t}\n\n\tfunction parseSpace(){\n\t\tparseString+= \"PARSER: parseSpace()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Space Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tif(array[currentToken][1] != \" \"){\n\t\t\tparseString+= \"PARSER: ERROR: Expected ' ' got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t} else {\n cstString += treeMaker(cstDepth) +\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseDigit(arr){\n\t\tparseString+= \"PARSER: parseDigit()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Digit>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tmatch(\"T_DIGIT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBoolOp(arr){\n\t\tparseString+= \"PARSER: parseBoolOp()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Operator>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool op node, parent]\n\t\tif(array[currentToken][0]==\"T_EQ\"){\n\t\t\tmatch(\"T_EQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_INEQ\"){\n\t\t\tmatch(\"T_INEQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_EQ or T_INEQ got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseBoolVal(arr){\n\t\tparseString+= \"PARSER: parseBoolVal()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Value>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool val node, parent]\n\t\tif(array[currentToken][0]==\"T_FALSE\"){\n\t\t\tmatch(\"T_FALSE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_TRUE\"){\n\t\t\tmatch(\"T_TRUE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseIntOp(){\n\t\tparseString+= \"PARSER: parseIntOp()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Addition>\\n\";\n\t\tmatch(\"T_ADD\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n}", "function Node(code, type, term) {\n // interpreted value (parsed or calculated)\n this.value = term;\n // prototype defined in the grammar\n this.type = type;\n // code used in the transformed grammatic rules\n this.code = code;\n // input term associated with the node\n this.term = term;\n }", "static create_tree() {\n return new Tree();\n }", "function GrammarNode() {\n\t//---Super Class------------------------\n\tthis.SuperClass = MatrixColumn;\n\tthis.SuperClass();\n\t//-------------------------------------\n\t//---Attributes-----------------------\n\t//this.nonterm =\"Non-terminal Symbol\";\n this.nonterm \t\t\t=\"row3col1\";\n this.expand_string \t\t= \"\";\n this.post_string\t\t= \"\";\n this.eval_expand_string = 0;\n this.assRules = -1;\n\t//-------------------------------------\n\t//---Methods--------------------------\n this.expand = m_expand_Grammarnode;\n this.handle_overwrite = m_handle_overwrite_GrammarNode;\n\t//-------------------------------------\n}", "function Tree(value) {\n this.value = value;\n this.children = [];\n}", "function AbstractTree() {\n\n\tthis.root = null;\n\tthis.cur = null;\n\n\t// Add a node: kind = [branch|leaf]\n\tthis.addNode = function(token, kind) {\n\n\t\t// Construct the node object\n\t\tvar node = new Node(token, this.cur);\n\n\t\t// if there are no nodes in the tree yet, start the tree here\n\t\tif(!this.cur) {\n\t\t\tthis.cur = node;\n\n\t\t// otherwise, add this node to the children array\n\t\t} else {\n\t\t\tthis.cur.addChild(node);\n\t\t}\n\n\t\t// if we are an interior/branch node, then update the current node to be this node\n\t\tif (kind === \"branch\") {\n\t\t\tthis.cur = node;\n\t\t}\n\n\t\t// if this node is the super root, set it as the root of the tree\n\t\tif(token === \"Super Root\") {\n\t\t\tthis.root = node;\n\t\t}\n\n\t\toutVerbose(parseTabs() + \"Added node -> \" + node.toString());\n\n\t};\n\n\tthis.startBranch = function(branchName) {\n\t\tthis.addNode(branchName, \"branch\");\n\n\t\tif((typeof branchName === \"object\") && !isNaN(branchName.type)) {\n\t\t\tif(branchName.value) {\n\t\t\t\tbranchName = getTokenType(branchName.type) + \" \" + branchName.value;\n\t\t\t} else {\n\t\t\t\tbranchName = getTokenType(branchName.type);\n\t\t\t}\n\t\t}\n\n\t\toutVerbose(parseTabs() + \"Creating \" + branchName + \" branch\");\n\t\tnumTabs++;\n\t};\n\n\tthis.endBranch = function() {\n\n\t\t// if the current node has a parent (i.e. is NOT the superRoot)\n\t\tif(this.cur.parent) {\n\n\t\t\t// move the current node up to this node's parent\n\t\t\tthis.cur = this.cur.parent;\n\n\t\t// otherwise, we have a problem\n\t\t} else {\n\t\t\toutError(\"ERROR: can't end branch because parent does not exist.\");\n\t\t}\n\n\t\tnumTabs--;\n\n\t};\n\n\tthis.traverseTree = function(treeRoot) {\n\n\t\t// if token type is a number\n\t\tif(!isNaN(treeRoot.token.type)) {\n\t\t\tthis.addNode(treeRoot.token, \"leaf\");\n\t\t\treturn;\n\t\t}\n\n\t\tswitch(treeRoot.token) {\n\n\t\t\tcase \"Statement\":\n\n\t\t\t\t// print statement\n\t\t\t\tif(treeRoot.children[0].token.type === T_TYPE.PRINT) {\n\t\t\t\t\tthis.startBranch(\"print\");\n\t\t\t\t\tthis.traverseTree(treeRoot.children[2]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t}\n\n\t\t\t\t// assignment statement\n\t\t\t\telse if(treeRoot.children[1] && treeRoot.children[1].token.type === T_TYPE.EQUAL) {\n\t\t\t\t\tthis.startBranch(\"assign\");\n\t\t\t\t\tthis.addNode(treeRoot.children[0].token, \"leaf\");\n\t\t\t\t\tthis.traverseTree(treeRoot.children[2]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t}\n\n\t\t\t\t// block\n\t\t\t\telse if(treeRoot.children[0] && treeRoot.children[0].token.type === T_TYPE.BRACE) {\n\t\t\t\t\tthis.startBranch(\"block\");\n\t\t\t\t\t// ignore } if it's the next node\n\t\t\t\t\tif(treeRoot.children[1].token.type !== T_TYPE.BRACE && treeRoot.children[1].token.value !== \"}\") {\n\t\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t\t}\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t}\n\n\t\t\t\t// otherwise (VarDecl)\n\t\t\t\telse if(treeRoot.children[0]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase \"IfStatement\":\n\t\t\t\tthis.startBranch(\"if\");\n\n\t\t\t\t// BooleanExpr\n\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\n\t\t\t\t// block\n\t\t\t\tthis.startBranch(\"block\");\n\t\t\t\t// ignore } if it's the next node\n\t\t\t\tif(treeRoot.children[3].token.type !== T_TYPE.BRACE && treeRoot.children[3].token.value !== \"}\") {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[3]);\n\t\t\t\t}\n\t\t\t\tthis.endBranch();\n\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tcase \"WhileStatement\":\n\t\t\t\tthis.startBranch(\"while\");\n\n\t\t\t\t// BooleanExpr\n\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\n\t\t\t\t// block\n\t\t\t\tthis.startBranch(\"block\");\n\t\t\t\t// ignore } if it's the next node\n\t\t\t\tif(treeRoot.children[3].token.type !== T_TYPE.BRACE && treeRoot.children[3].token.value !== \"}\") {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[3]);\n\t\t\t\t}\n\t\t\t\tthis.endBranch();\n\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tcase \"StatementList\":\n\t\t\t\tif(treeRoot.children[0]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"IntExpr\":\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.startBranch(treeRoot.children[1].token); // use operation as branch root\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t\tthis.traverseTree(treeRoot.children[2]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t} else {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"StringExpr\":\n\t\t\t\tthis.startBranch(\"string\");\n\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tcase \"BooleanExpr\":\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.startBranch(\"equal?\");\n\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t\tthis.traverseTree(treeRoot.children[3]);\n\t\t\t\t\tthis.endBranch();\n\t\t\t\t} else {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"CharList\":\n\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\tif(treeRoot.children[1]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[1]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"VarDecl\":\n\t\t\t\tthis.startBranch(\"declare\");\n\t\t\t\tthis.addNode(treeRoot.children[0].token, \"leaf\"); // Type\n\t\t\t\tthis.addNode(treeRoot.children[1].token, \"leaf\"); // Id\n\t\t\t\tthis.endBranch();\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tif(treeRoot.children[0]) {\n\t\t\t\t\tthis.traverseTree(treeRoot.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t}\n\n\t};\n\n\tthis.addNode(\"Super Root\", \"branch\");\n\tthis.traverseTree(parseTree.root);\n\n}", "function parseTerm(tok) {\n\tvar startPosition = tok.position();\n\t\n\t// Parse groups and elements\n\tvar items = [];\n\twhile (true) {\n\t\tvar next = tok.peek();\n\t\tif (next == null)\n\t\t\tbreak;\n\t\telse if (next == \"(\")\n\t\t\titems.push(parseGroup(tok));\n\t\telse if (/^[A-Za-z][a-z]*$/.test(next))\n\t\t\titems.push(parseElement(tok));\n\t\telse\n\t\t\tbreak;\n\t}\n\t\n\t// Parse optional charge\n\tvar charge = 0;\n\tvar next = tok.peek();\n\tif (next != null && next == \"^\") {\n\t\ttok.consume(\"^\");\n\t\tnext = tok.peek();\n\t\tif (next == null)\n\t\t\tthrow {message: \"Number or sign expected\", start: tok.position()};\n\t\telse\n\t\t\tcharge = parseOptionalNumber(tok);\n\t\t\n\t\tnext = tok.peek();\n\t\tif (next == \"+\")\n\t\t\tcharge = +charge; // No-op\n\t\telse if (next == \"-\")\n\t\t\tcharge = -charge;\n\t\telse\n\t\t\tthrow {message: \"Sign expected\", start: tok.position()};\n\t\ttok.take(); // Consume the sign\n\t}\n\t\n\t// Check if term is valid\n\tvar elems = new Set();\n\tfor (var i = 0; i < items.length; i++)\n\t\titems[i].getElements(elems);\n\telems = elems.toArray(); // List of all elements used in this term, with no repeats\n\tif (items.length == 0) {\n\t\tthrow {message: \"Invalid term - empty\", start: startPosition, end: tok.position()};\n\t} else if (indexOf(elems, \"e\") != -1) { // If it's the special electron element\n\t\tif (items.length > 1)\n\t\t\tthrow {message: \"Invalid term - electron needs to stand alone\", start: startPosition, end: tok.position()};\n\t\telse if (charge != 0 && charge != -1)\n\t\t\tthrow {message: \"Invalid term - invalid charge for electron\", start: startPosition, end: tok.position()};\n\t\t// Tweak data\n\t\titems = [];\n\t\tcharge = -1;\n\t} else { // Otherwise, a term must not contain an element that starts with lowercase\n\t\tfor (var i = 0; i < elems.length; i++) {\n\t\t\tif (/^[a-z]+$/.test(elems[i]))\n\t\t\t\tthrow {message: 'Invalid element name \"' + elems[i] + '\"', start: startPosition, end: tok.position()};\n\t\t}\n\t}\n\t\n\treturn new Term(items, charge);\n}", "function Tree() {\n this.root = null;\n}", "function Tree(id, formElement) {\n\tthis.id = id; // identifier for the tree\n\tthis.root = null; // the root element of the tree (an object of type treegroup)\n\tthis.runAt = RunAt.SERVER;\n\tthis.linesAtRoot = true; // Show lines at the top level\n\tthis.expandMode = ExpandMode.SINGLE;\n\tthis.showLines = true;\n\tthis.showRoot = true; // false, if the root element should be hidden\n\tthis.action = ''; // action to process if an item is clicked\n\tthis.checkboxes = false; // true if checkboxes should be displayed\n\tthis.imagemap = null; // imagemap used for tree icons\n\tthis.formElement = (arguments.length >= 2) ? formElement : false; // indicates if the TabSet should act as a form element.\n\tthis.disabled = false; // control is disabled\n\tthis.maxlength = -1; // Maxlength of the labels\n\tthis.groupSelect = true; // Drilldow on a group allowd\n\tthis.styleClass = null; // Customized sytlesheet class\n\tthis.imageMap = null; // an optional associated imagemap for image resources\n\tthis.selectNode = true; // highlight the node if it was selected on a drilldown\n}", "expand(preventRecursion) {\n if (!this.isExpanded) {\n this.isExpanded = true\n\n this.expansionErrors = []\n\n // Types of nodes\n // -1: raw, needs parsing\n // 0: Plaintext\n // 1: Tag (\"#symbol.mod.mod2.mod3#\" or \"#[pushTarget:pushRule]symbol.mod\")\n // 2: Action (\"[pushTarget:pushRule], [pushTarget:POP]\", more in the future)\n\n switch (this.type) {\n // Raw rule\n case -1:\n\n this.expandChildren(this.raw, preventRecursion)\n break\n\n // Plaintext, do nothing but copy text into finsihed text\n case 0:\n this.finishedText = this.raw\n break\n\n // Tag\n case 1: {\n // Parse to find any actions, and figure out what the symbol is\n this.preactions = []\n this.postactions = []\n\n const parsed = Parser.parseTag(this.raw)\n\n // Break into symbol actions and modifiers\n this.symbol = parsed.symbol\n this.modifiers = parsed.modifiers\n\n // Create all the preactions from the raw syntax\n parsed.preactions.forEach((preaction, i) => {\n this.preactions[i] = new NodeAction(this, preaction.raw)\n })\n\n // Make undo actions for all preactions (pops for each push)\n this.preactions.forEach(pa => {\n if (pa.type === 0) {\n this.postactions.push(pa.createUndo())\n }\n })\n\n // Activate all the preactions\n this.preactions.forEach(pa => pa.activate())\n\n this.finishedText = this.raw\n\n // Expand (passing the node, this allows tracking of recursion depth)\n const selectedRule = this.grammar.selectRule(this.symbol, this, this.errors)\n\n this.expandChildren(selectedRule, preventRecursion)\n\n // Apply modifiers\n this.modifiers.forEach(modName => {\n let modParams = []\n if (modName.indexOf('(') > 0) {\n const regExp = /\\(([^)]+)\\)/\n\n const results = regExp.exec(modName)\n if (results && results.length >= 2) {\n modParams = results[1].split(',')\n modName = modName.substring(0, modName.indexOf('('))\n }\n }\n\n const mod = this.grammar.modifiers[modName]\n\n // Missing modifier?\n if (mod) {\n this.finishedText = mod(this.finishedText, modParams)\n } else {\n this.errors.push('Missing modifier ' + modName)\n this.finishedText += '((.' + modName + '))'\n }\n })\n\n // Perform post-actions\n this.postactions.forEach(pa => pa.activate())\n break\n }\n case 2:\n // Just a bare action? Expand it!\n this.action = new NodeAction(this, this.raw)\n this.action.activate()\n\n // No visible text for an action\n this.finishedText = ''\n break\n default:\n\n }\n }\n }", "function ConcreteSyntaxTree(root, current) {\n this.root = root;\n this.current = current;\n this.root = root;\n this.current = current;\n }", "function parse(){\n var syntax = esprima.parse(editor.getValue());\n codeArray = [];\n expand(syntax.body, codeArray, 0);\n}", "function objectTree(obj) {\n var res;\n switch(obj.termType) {\n case 'symbol':\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', obj.uri)\n anchor.addEventListener('click', tabulator.panes.utils.openHrefInOutlineMode, true);\n anchor.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n return anchor;\n \n case 'literal':\n\n if (!obj.datatype || !obj.datatype.uri) {\n res = myDocument.createElement('div');\n res.setAttribute('style', 'white-space: pre-wrap;');\n res.textContent = obj.value;\n return res\n } else if (obj.datatype.uri == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {\n res = myDocument.createElement('div');\n res.setAttribute('class', 'embeddedXHTML');\n res.innerHTML = obj.value; // Try that @@@ beware embedded dangerous code\n return res;\n };\n return myDocument.createTextNode(obj.value); // placeholder - could be smarter, \n \n case 'bnode':\n if (obj.toNT() in doneBnodes) { // Break infinite recursion\n referencedBnodes[(obj.toNT())] = true;\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', '#'+obj.toNT().slice(2))\n anchor.setAttribute('class','bnodeRef')\n anchor.textContent = '*'+obj.toNT().slice(3);\n return anchor; \n }\n doneBnodes[obj.toNT()] = true; // Flag to prevent infinite recusruion in propertyTree\n var newTable = propertyTree(obj);\n doneBnodes[obj.toNT()] = newTable; // Track where we mentioned it first\n if (tabulator.Util.ancestor(newTable, 'TABLE') && tabulator.Util.ancestor(newTable, 'TABLE').style.backgroundColor=='white') {\n newTable.style.backgroundColor='#eee'\n } else {\n newTable.style.backgroundColor='white'\n }\n return newTable;\n \n case 'collection':\n var res = myDocument.createElement('table')\n res.setAttribute('class', 'collectionAsTables')\n for (var i=0; i<obj.elements.length; i++) {\n var tr = myDocument.createElement('tr');\n res.appendChild(tr);\n tr.appendChild(objectTree(obj.elements[i]));\n }\n return res;\n case 'formula':\n var res = tabulator.panes.dataContentPane.statementsAsTables(obj.statements, myDocument);\n res.setAttribute('class', 'nestedFormula')\n return res;\n case 'variable':\n var res = myDocument.createTextNode('?' + obj.uri);\n return res;\n \n }\n throw \"Unhandled node type: \"+obj.termType\n }", "function Term(hiragana, kanji, definition) {\n this.hiragana_ = hiragana;\n this.kanji_ = kanji;\n this.definition_ = definition;\n}", "getTreeInternal() {\n const op = this;\n return new class extends Tree {\n /**\n * @param {!Visitor<P, R>} visitor\n * @param {P} arg\n * @return {R}\n * @template P, R\n */\n visit(visitor, arg) {\n const handler = op[visitor.symbol];\n if (handler) {\n return handler.call(\n op, args.map(a => visitor.wrap(a, arg)), arg);\n }\n return visitor.default(args, arg);\n }\n };\n }", "function tree(context) {\n let root = trees.get(context);\n if (!root) {\n root = {children: {}, observers: []};\n trees.set(context, root);\n }\n return root;\n}", "function tree(trunks) {\n this.trunks = trunks;\n this.branches = trunks * 10;\n this.twigs = trunks * 100;\n this.leaves = trunks * 1000;\n}", "function Tree(oct1, oct2, oct3, oct4, maskBits){\n\tlet intIP = oct1 * Math.pow(256,3) + oct2 * Math.pow(256,2) + oct3 * 256 + oct4;\n let n = new Node(intIP, maskBits);\n\n this.root = n; // Root Node\n this.deep = 1; // Tree Depth\n\n this.root.depth \t= 1;\n this.root.leaves \t= 1;\n this.root.id \t\t= Math.pow(2, 32 - 1);\n this.root.path.push(this.root.id);\n}", "term() {\n const startToken = this.currentToken;\n\n try {\n return this.binaryProduction(this.factor, OperatorsTerm);\n } catch (e) {\n throw new ParserException('Error processing TERM', startToken, e);\n }\n }", "function Tree() {\n // ----------\n // Attributes\n // ----------\n\n this.root = null; // Note the NULL root node of this tree.\n this.cur = {}; // Note the EMPTY current node of the tree we're building.\n\n\n // -- ------- --\n // -- Methods --\n // -- ------- --\n\n // Add a node: kind in {branch, leaf}.\n this.addNode = function(name, kind) {\n // Construct the node object.\n var node = {\n name: name,\n children: [],\n parent: {}\n };\n\n // Check to see if it needs to be the root node.\n if ((this.root == null) || (!this.root)) {\n // We are the root node.\n this.root = node;\n } else {\n // We are the children.\n // Make our parent the CURrent node...\n node.parent = this.cur;\n // ... and add ourselves (via the unfrotunately-named\n // \"push\" function) to the children array of the current node.\n this.cur.children.push(node);\n }\n // If we are an interior/branch node, then...\n if (kind == \"branch\") {\n // ... update the CURrent node pointer to ourselves.\n this.cur = node;\n }\n };\n\n // Note that we're done with this branch of the tree...\n this.endChildren = function() {\n // ... by moving \"up\" to our parent node (if possible).\n if ((this.cur.parent !== null) && (this.cur.parent.name !== undefined)) {\n this.cur = this.cur.parent;\n } else {\n // TODO: Some sort of error logging.\n // This really should not happen, but it will, of course.\n }\n };\n\n // Return a string representation of the tree.\n this.toString = function() {\n // Initialize the result string.\n var traversalResult = \"\";\n var level = 0;\n // Recursive function to handle the expansion of the nodes.\n function expand(node, depth) {\n // Space out based on the current depth so\n // this looks at least a little tree-like.\n for (var i = 0; i < depth; i++) {\n traversalResult += \"-\";\n }\n\n // If there are no children (i.e., leaf nodes)...\n if (!node.children || node.children.length === 0) {\n // ... note the leaf node.\n traversalResult += \"[\" + node.name + \"]\";\n traversalResult += \"\\n\";\n } else {\n // There are children, so note these interior/branch nodes and ...\n traversalResult += \"<\" + node.name + \"> \\n\";\n // .. recursively expand them.\n for (var i = 0; i < node.children.length; i++) {\n expand(node.children[i], depth + 1);\n }\n // depth-=1;\n }\n }\n // Make the initial call to expand from the root.\n expand(this.root, 0);\n // Return the result.\n return traversalResult;\n };\n}", "get termType() {\n return 'NamedNode';\n }", "get termType() {\n return 'NamedNode';\n }", "static definition() {\n return 'A tree is a perennial plant with an elongated stem, or trunk, supporting branches and leaves.'\n }", "function make_node(tok) {\n var node = {};\n if (tok.id === \"(string)\") {\n node.parse = function() { return tok.value };\n }\n else {\n node = Y.Node.create(tok.template);\n if (tok.id === \"(indent)\") {\n node.setData(\"indent\", tok.value);\n }\n node.parse = tok.parse;\n node.transition = tok.transition;\n }\n return node;\n}", "function t(text) { return {'macro_name': 'plaintext', 'text': text}; }", "function createParseTreeView (node) {\n let text = node.token.text.replace(HTMLCharsToEscape, (match) => HTMLEscapeReplacements[match]);\n let nodeInfo = `<div class=\"node-info ${node.ASType.category}\">${text}</div>`;\n let nodeChildren = `<div class=\"node-children\">${node.children.map(createParseTreeView).join(\"\")}</div>`;\n return `<div class=\"ast-node\">${nodeInfo}${nodeChildren}</div>`;\n}", "function T(str) {\r\n return NodeFactory.term(str)\r\n}", "function Tree(data) {\n this.data = data\n this.left = this.right = null\n}", "function Token (type, children, text) {\n this.type = type\n\n if (children) {\n this.children = children\n }\n\n if (text) {\n this.text = text\n }\n }", "constructor() {\n\t\tthis.un_op = '~';\n\t\tthis.log_ops = ['~', '^', 'v', '->', '<->'];\n\t\tthis.half_ops = ['<', '-', '<-', '>'];\n\t\tthis.poss_ops = ['~', '^', 'v', '->', '<->', '-', '<', '>'];\n\t\tthis.prec = ['(', '[', '~', '^', 'v', '->', '<->'];\n\t\tthis.braces = ['(', ')', '[', ']', '{', '}'];\n\t\tthis.braces_open = ['(', '[', '{'];\n\t\tthis.braces_closed = [')', ']', '}'];\n\t\tthis.w_space = ['\\n', '\\t', ' '];\n\t\tthis.space = ' ';\n\t\tthis.newline = '\\n';\n\t\tthis.terms = return_alpha();\n\t\tthis.op_stack = [];\n\t\tthis.b_stack = [];\n\t\tthis.l_stack = [];\n\t\tthis.postfix = [];\n\t\tthis.seen = [];\n\t\tthis.tmp = [];\n\t\tthis.expressions = [];\n\t\tthis.t_count = 0;\n\t\tthis.prev = undefined;\n\t}", "function Tree() {\n this.root = new Node(null);\n}", "function Tree(branch) {\n this.branch = branch;\n this.branch = branch;\n }", "function subjectTree(subject, stats) {\n if (subject.termType == 'bnode' && !stats.incoming[subject])\n return objectTree(subject, stats, true).concat(['.']); // Anonymous bnode subject\n return [ termToN3(subject, stats) ].concat([propertyTree(subject, stats)]).concat(['.']);\n }", "function subjectTree(subject, stats) {\r\n\t\t\tif (subject.termType == 'bnode' && !stats.incoming[subject])\r\n\t\t\t\treturn objectTree(subject, stats, true).concat([ \".\" ]); // Anonymous\r\n\t\t\t// bnode\r\n\t\t\t// subject\r\n\t\t\treturn [ termToN3(subject, stats) ].concat(\r\n\t\t\t\t\t[ propertyTree(subject, stats) ]).concat([ \".\" ]);\r\n\t\t}", "function buildTree(node) {\n if (node.value.length == 1) {\n node.value = node.value[0];\n node.arrayIndex = node.arrayIndex[0];\n } else if (findHighestSymbol(node.value)) {\n let topNodeSymbol = findHighestSymbol(node.value);\n setNodeAndChildren(node, topNodeSymbol);\n node.children.forEach(child => buildTree(child));\n } else {\n removeBrackets(node);\n buildTree(node);\n }\n}", "function tree (a_items, a_template) {\n this.n_tid = trees.length;\n trees[this.n_tid] = this;\n \n this.a_tpl = a_template;\n this.a_config = a_items;\n this.o_root = this;\n this.a_index = [];\n this.a_selected = [];\n this.a_deleted = [];\n this.b_selected = false;\n this.n_depth = -1;\n this.select_all = select_all;\n this.select_none= select_none;\n this.upstatus = function() {};//nothing\n this.o_parent = null;\n this.a_custom_menus = [];\n this.a_custom_menu_ids = [];\n this.n_items = 0;\n this.b_cache_children = true;\n this.get_item = function(id) { return this.a_index[id]; };\n this.item_count = function() { return this.n_items; };\n this.get_first_item = get_first_item;\n this.get_next_item = get_next_item;\n this.deleteAllChildren = deleteAllChildren;\n this.action = null;\n this.border = null;\n this.a_columns= null;\n this.a_columnWidths = null;\n this.add_tree_column = add_tree_column;\n this.timeoutId = 0; \n\n var o_icone = new Image();\n var o_iconl = new Image();\n o_icone.src = a_template['icon_e'];\n o_iconl.src = a_template['icon_l'];\n a_template['im_e'] = o_icone;\n a_template['im_l'] = o_iconl;\n\n for (var i = 0; i < 64; i++)\n if (a_template['icon_' + i]) \n {\n var o_icon = new Image();\n a_template['im_' + i] = o_icon;\n o_icon.src = a_template['icon_' + i];\n }\n \n this.expand = item_expand;\n this.toggle = toggle;\n this.select = function (n_id, e, treeid) { return this.get_item(n_id).select(e, treeid); };\n this.mover = mouse_over_item;\n this.mout = mouse_left_item;\n this.oncontextmenu = function (n_id, e, treeid) { return this.get_item(n_id).oncontextmenu(e, treeid) };\n this.show_context_menu = show_context_menu;\n this.handle_command = handle_command;\n this.on_sel_changed = null;\n this.on_expanding = null;\n this.on_context_menu= null;\n this.on_command = null;\n \n this.get_custom_menu = function(menu_name) {\n var index = this.a_custom_menu_ids[menu_name];\n return (index != undefined) ? this.a_custom_menus[index] : null;\n }\n this.add_custom_menu = function(menu_name, a_menu) { \n if (!this.get_custom_menu(menu_name))\n {\n var index = this.a_custom_menus.length;\n this.a_custom_menus[index] = a_menu;\n this.a_custom_menu_ids[menu_name] = index;\n }\n return index;\n }\n \n this.a_children = [];\n for (var i = 0; i < a_items.length; i++)\n new tree_item(this, i, this.a_config[i + (this.n_depth + 1 ? 2 : 0)]);\n\n var n_children = this.a_children.length;\n if (n_children) {\n var div = document.getElementById('tree_' + this.n_tid);\n var a_html = [];\n for (var i=0; i<n_children; i++) {\n var child = this.a_children[i];\n a_html[i] = child.init();\n child.expand();\n }\n div.innerHTML = a_html.join('');\n }\n}", "function T(str) {\n return NodeFactory.term(str)\n}", "function buildAST(root) {\n //If not a leaf node...\n if (root !== null && root.children.length > 0) {\n //For each CST child...\n for (var i = 0; i < root.children.length; i++) {\n //If the CST node is useful to the AST...\n if (typeof ASTNodes[root.children[i].nodeName] !== \"undefined\") {\n //Rename from CST to AST nodeName\n //Block\n if (ASTNodes[root.children[i].nodeName] === \"Block\") {\n //Add a block AST node\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]); //with new name.\n //Recurse over Statements\n buildAST(root.children[i]);\n //Back up to Block when done - close this scope\n AST.backtrack();\n }\n else if (root.nodeName === \"IntegerExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"int\";\n }\n }\n else if (root.nodeName === \"StringExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"string\";\n activeValue.nodeVal = joinString(root, \"\"); //sets string value to full string\n }\n }\n else if (root.nodeName === \"BooleanExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"boolean\";\n }\n }\n else if (root.nodeName === \"ID\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"ID\";\n }\n }\n else if (ASTNodes[root.children[i].nodeName] === \"VariableDeclaration\") {\n //New VariableDeclaration node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //Left - the type\n AST.addLeafNode(\"LeftVal\", root.children[i].children[0].nodeVal, true, root.children[i].children[0].lineNumber);\n //Right - the variable name\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[0].nodeVal, true, root.children[i].children[1].children[0].lineNumber);\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Assignment\") {\n //New Assignment node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //LeftVal - a variable\n AST.addLeafNode(\"LeftVal\", root.children[i].children[0].children[0].nodeVal, true, root.children[i].children[0].children[0].lineNumber);\n //RightVal - an Expression\n if (root.children[i].children[2].children[0].nodeName === \"IntegerExpression\") {\n if (root.children[i].children[2].children[0].children.length > 2 && root.children[i].children[2].children[0].children[1].nodeName === \"T_intop\") {\n AST.addLeafNode(\"RightVal\", findIDInAdd(root.children[i].children[2].children[0]), true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"RightVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n }\n else {\n AST.addLeafNode(\"RightVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Output\") {\n //New Output node\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //If printing from a variable\n if (root.children[i].children[2].children[0].nodeName === \"ID\") {\n AST.addLeafNode(\"OutputVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"OutputVal\", findIDInAdd(root.children[i].children[2].children[0]), true, root.children[i].lineNumber);\n }\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"If\" || ASTNodes[root.children[i].nodeName] === \"While\") {\n /*!= vs ==*/\n //New If or While node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //New CompareTest node!\n AST.addBranchNode(\"CompareTest\");\n //Add left and right of comparison\n if (root.children[i].children[1].children[1].children.length !== 0) {\n AST.addLeafNode(\"LeftVal\", root.children[i].children[1].children[1].children[0].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].children[0].lineNumber);\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[3].children[0].children[0].nodeVal, true, root.children[i].children[1].children[3].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"LeftVal\", root.children[i].children[1].children[1].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].lineNumber);\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[1].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].lineNumber);\n }\n //Backtrack up to If/While from Compare\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Add\") {\n //New Add tree\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //Backtrack\n AST.backtrack();\n }\n }\n //This subtree\n var saved = root.children[i];\n //Block handles own recursive call. Otherwise...\n if (ASTNodes[root.children[i].nodeName] !== \"Block\") {\n buildAST(saved); //recursively call until traversed whole CST\n }\n }\n }\n else {\n //return; //this is a value - no recursion needed\n if (ASTNodes[root.nodeName] === \"Add\") {\n }\n }\n}", "function build_tree(t, lengths, loffset, num) {\n var offs = __offs;\n var i, sum;\n\n /* clear code length count table */\n for (i = 0; i < 16; ++i)\n t.table[i] = 0;\n\n /* scan symbol lengths, and sum code length counts */\n for (i = 0; i < num; ++i)\n t.table[lengths[loffset + i]]++;\n\n t.table[0] = 0;\n\n /* compute offset table for distribution sort */\n for (sum = 0, i = 0; i < 16; ++i) {\n offs[i] = sum;\n sum += t.table[i];\n }\n\n /* create code->symbol translation table (symbols sorted by code) */\n for (i = 0; i < num; ++i) {\n if (lengths[loffset + i])\n t.trans[offs[lengths[loffset + i]]++] = i;\n }\n }", "function Tree(x) {\n this.value = x;\n this.children = []; // instance state\n}", "function RBTree() {\n this._root = null;\n }", "function term_part(peg_parser, tree_obj){\n// \t\tconsole.log(tree_obj);\n\t\tvar non_empty = \"\";\n\t\tfor (var node_name in tree_obj){\n\t\t\tif (!tree_helpers.is_nil_node(tree_obj[node_name])){\n\t\t\t\tnon_empty = node_name;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar node = tree_obj[non_empty];\n\t\tswitch (non_empty){\n\t\t\tcase \"fork\":\n\t\t\t\treturn fork(peg_parser, node);\n\t\t\tcase \"call_rule\":\n\t\t\t\treturn peg_parser.rule(node.rule_name.value);\n\t\t\tcase \"string\":\n\t\t\t\treturn peg_parser.word(node.value);\n\t\t\tcase \"end\":\n\t\t\t\treturn peg_parser.end();\n\t\t\tcase \"ws\":\n\t\t\t\treturn peg_parser.ws();\n\t\t}\n\t\treturn peg_parser.word(\"\");\n\t}", "getTree() {\n\n var result = ['cond',\n this.predicate.getTree(),\n this.consequent.getTree(),\n ];\n\n if (this.alternate) {\n result.push(this.alternate.getTree());\n }\n\n return result;\n }", "function Tree () {\n this.sentinel = new TreeNode(null)\n this.head = this.sentinel;\n}", "function term(peg_parser, tree_obj){\n\t\tvar _term_part = term_part(peg_parser, tree_obj.term_part);\n\t\tvar possible_apps = [\"any\", \"some\", \"not\", \"without\"];\n\t\tfor (var i = 0; i < possible_apps.length; i++){\n\t\t\tvar app = possible_apps[i];\n\t\t\tif (tree_helpers.is_leaf(tree_obj[app])){\n\t\t\t\treturn peg_parser[app](_term_part);\n\t\t\t}\n\t\t}\n\t\tif (!tree_helpers.is_nil_node(tree_obj.time)){\n\t\t\tvar numbers = tree_obj.times.number;\n\t\t\treturn peg_parser.times_range(_term_part, numbers[0], numbers[1]);\n\t\t}\n\t\treturn _term_part;\n\t}", "evalTree() {\n\t\treturn this.evalTreeHelper(this);\t//pass in self as the root for the first pass\n\t}", "function Tree(x) {\n this.value = x;\n this.left = null;\n this.right = null;\n}", "parse(tree, depth) {\n if (Array.isArray(tree)) {\n return tree.map(node => this.parse(node, depth + 1)).join('');\n\n } else if(isProperty(tree)) {\n return this.addComment(tree, depth) + this.parseProperty(tree, depth);\n\n } else if (isExprStatement(tree)) {\n return this.parseExpression(tree);\n\n } else if (isVarDeclarator(tree)) {\n if (isCallableExpr(tree) || isArrowFunctionExpr(tree)) {\n return this.parseExpression(tree, true);\n }\n return tree.init.properties.map(node => this.parse(node, depth + 1)).join('');\n\n } else if (isVarDeclaration(tree)) {\n return tree.declarations.map(n => this.parse(n, depth - 1)).join('');\n\n } else if (isLabelStatement(tree) || isBlockStatement(tree)) {\n throw new Error('Grid options should be wrapped inside: const gridOptions = { ... }');\n\n } else {\n throw new Error(`Unexpected node encountered:\\n\\n${JSON.stringify(tree)}`);\n }\n }", "function _createAstRoot() {\n var root = obj();\n root.type = 'nj_root';\n root.content = [];\n\n return root;\n}", "function FBXTree() {}", "function FBXTree() {}", "function FBXTree() { }", "buildTree(ex) { //expression is a string of numbers/operators\n\t\tvar unprocessed = []; //stack\n\n\t\tfor(var i = 0; i < ex.length; i++) {\n\t\t\tvar current = ex[i].trim();\t//cut down on O(n) iterations\n\n //if current is a number\n\t\t\tif( this.isOperand(current) ) { //Leave as String here for convenient evaluation\n\t\t\t\tunprocessed.push(new TreeNode(current) );\t//Create it as a TreeNode when you push\n\n } else if( this.isOperator(current) ) {\n\t\t\t\tvar right = unprocessed.pop(); //Everything on stack is already a TreeNode\n var left = unprocessed.pop();\n\t\t\t\t//creates a sub-tree with operator as root and last 2 operands as the left and right sub-nodes\n\t\t\t\tvar root = new TreeNode(current, left, right);\n\n\t\t\t\tunprocessed.push(root); //replace last 2 operands with a reference to the tree node that has them as leaves\n\t\t\t}\n\t\t}\n\t\treturn unprocessed.pop();\t//push that mini expression back onto the stack\n\t}", "function tree (treeBuild) {\n\tnumberChars = 1;\n\tvar spacesForTree = treeBuild.height - 1;\n\t\t// width of tree \"box\" = (height * 2) - 1\n\tfor (var i = 0; i < treeBuild.height; i++) {\n\t\taddBlanks(spacesForTree);\n\t\taddChars(treeBuild.char);\n\t\tprintTree();\n\t\tspacesForTree--;\n\t}\n}", "function parseTree(text, errors, options) {\n if (errors === void 0) { errors = []; }\n if (options === void 0) { options = ParseOptions.DEFAULT; }\n var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: void 0 }; // artificial root\n function ensurePropertyComplete(endOffset) {\n if (currentParent.type === 'property') {\n currentParent.length = endOffset - currentParent.offset;\n currentParent = currentParent.parent;\n }\n }\n function onValue(valueNode) {\n currentParent.children.push(valueNode);\n return valueNode;\n }\n var visitor = {\n onObjectBegin: function (offset) {\n currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onObjectProperty: function (name, offset, length) {\n currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });\n currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });\n },\n onObjectEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onArrayBegin: function (offset, length) {\n currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onArrayEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onLiteralValue: function (value, offset, length) {\n onValue({ type: getLiteralNodeType(value), offset: offset, length: length, parent: currentParent, value: value });\n ensurePropertyComplete(offset + length);\n },\n onSeparator: function (sep, offset, length) {\n if (currentParent.type === 'property') {\n if (sep === ':') {\n currentParent.colonOffset = offset;\n }\n else if (sep === ',') {\n ensurePropertyComplete(offset);\n }\n }\n },\n onError: function (error, offset, length) {\n errors.push({ error: error, offset: offset, length: length });\n }\n };\n visit(text, visitor, options);\n var result = currentParent.children[0];\n if (result) {\n delete result.parent;\n }\n return result;\n}", "function make_terminal(node) {\n return {\n name: node.title,\n size: 1,\n meta: {\n text: node.text,\n type: \"statement\",\n }\n };\n}", "function Tree(node, treemodel, options){\n\t\t\tvar rack = $('<ul/>').addClass(options.treeClass).appendTo(node);\n\t\t\tvar tree = this;\n\t\t\t/**item can be text, a jOWL object, or a jOWL array */\n\t\t\tthis.root = function(item){\n\t\t\t\tvar rt = null; //root\n\t\t\t\track.empty(); \n\t\t\t\tif(item && item.each) {\n\t\t\t\t\trt = [];\n\t\t\t\t\titem.each(function(it){\n\t\t\t\t\t\tvar x = new fn.node(it, true); \n\t\t\t\t\t\tx.wrapper.addClass(\"tv\");\n\t\t\t\t\t\tx.jnode.appendTo(rack);\n\t\t\t\t\t\tx.invParents = it.invParents; it.invParents = null;\t//reset for later use\n\t\t\t\t\t\trt.push(x);\n\t\t\t\t\t}); \n\t\t\t\t\treturn rt;\n\t\t\t\t}\n\t\t\t\trt = new fn.node(item, true);\n\t\t\t\trt.wrapper.addClass(\"tv\"); \n\t\t\t\trt.jnode.appendTo(rack);\n\t\t\t\treturn rt;\n\t\t\t};\n\n\t\t\tvar fn = {};\n\t\t\tfn.node = function(text, isRoot){ //creates a new node\n\t\t\t\tthis.jnode = isRoot ? $('<li/>').addClass(options.rootClass) : $('<li class=\"tvi\"/>');\n\t\t\t\tthis.$name = null;\n\t\t\t\tif(text){\n\t\t\t\t\tthis.$name = $('<span/>').addClass(options.nameClass);\n\t\t\t\t\tif(typeof text == \"string\") { this.$name.html(text); }\n\t\t\t\t\telse if(text.bind) { text.bind(this.$name); }\n\t\t\t\t\tvar n = this.$name; \n\t\t\t\t\tthis.$name.appendTo(this.jnode).click(function(){\n\t\t\t\t\t\tvar entry = jOWL(n.attr('title'));\n\t\t\t\t\t\tif(entry && options.onSelect.call(n, entry) === false) { return; }\n\t\t\t\t\t\ttree.broadcast(entry); \n\t\t\t\t\t\tif(options.isStatic) { tree.propertyChange(entry); }\n\t\t\t\t\t\treturn false;});\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthis.wrapper = $('<ul/>').appendTo(this.jnode);\n\t\t\t\tvar self = this;\n\t\t\t\t\tself.jnode.click(function(){toggle(); return false;});\n\n\t\t\t\tthis.add = function(text){\n\t\t\t\t\tvar nn = new fn.node(text);\n\t\t\t\t\tif(!self.wrapper.children().length) { toNode();\t}\n\t\t\t\t\telse { \n\t\t\t\t\t\tvar lastchild = self.wrapper.children(':last'); \n\t\t\t\t\t\tlastchild.swapClass(\"tvilc\", \"tvic\");\n\t\t\t\t\t\tlastchild.swapClass(\"tvile\", \"tvie\");\n\t\t\t\t\t\tlastchild.swapClass(\"tvil\", \"tvi\");\n\t\t\t\t\t\t\n\t\t\t\t\t\t}//children - change end of list\n\t\t\t\t\tself.wrapper.append(nn.jnode.swapClass('tvi', 'tvil'));\n\t\t\t\t\treturn nn;\n\t\t\t\t\t};\n\n\t\t\t\tfunction toggle(){ \n\t\t\t\t\tvar t = self.jnode.hasClass(\"tvic\") || self.jnode.hasClass(\"tvie\") || self.jnode.hasClass(\"tvilc\") || self.jnode.hasClass(\"tvile\");\n\t\t\t\t\tif(!t) { return; }\n\t\t\t\t\tself.jnode.swapClass('tvic', 'tvie'); self.jnode.swapClass('tvilc', 'tvile');\n\t\t\t\t\tself.wrapper.slideToggle();\n\t\t\t\t\t}\n\n\t\t\t\tfunction toNode(){ \n\t\t\t\t\tself.jnode.swapClass('tvil', 'tvilc');\n\t\t\t\t\tself.jnode.swapClass('tvi', 'tvic');\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\treturn this;\n\t\t}// end Tree", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function parseTerm(list){\n // Must start with a factor\n var left=parseFactor(list)\n if(left===null)return null\n\n var position=list.getPosition()\n // Can be followed by * / or % and another term\n var tkn=list.next()\n if(tkn!=null && (tkn.data===\"*\" || tkn.data===\"/\" || tkn.data===\"%\")){\n // Must end with another term\n\t\tvar right=parseTerm(list)\n\t\tif(right==null)throw new ParseException(tkn,\"Parser\",\"Isolated operator found at the end\");\n\t\tvar expr=new Expression(ExpressionType.OPERATOR,tkn);\n\t\texpr.left=left\n expr.right=right\n\t\treturn expr\n\t}\n\n // This did not end with another term, reset and return initial factor\n list.setPosition(position)\n return left\n}", "constructor(value){\n this.value = value;\n this.children = {};\n this.isWord = false;\n }", "curTreeType() {\n this.init();\n }", "function Tree(label, left, right) {\n this.label = label;\n this.left = left;\n this.right = right;\n}", "function replaceNestedTextmacros() {\n var count = Number.MAX_VALUE;\n var previousCount;\n do {\n previousCount = count;\n count = 0;\n for (macroName in macros.text) {\n if (macros.text.hasOwnProperty(macroName)) {\n var result = replaceMacros(macros.text[macroName].value, macros.text);\n count += result.count;\n macros.text[macroName].value = result.text;\n }\n }\n } while (count > 0 && count < previousCount);\n if (count >= previousCount) throw 'Circular Macro';\n }", "function FlatTree(root, comment) {\n var lines = [];\n function traverse(node, indent) {\n if(comment != null) {\n var s = \"\";\n for(var j = 0; j < indent; j++) {\n s += \" \";\n }\n s += comment + \" <<\" + node.Name + \">> ( \" + node.Filename + \":\" + node.Linenumber + \" )\";\n \n lines.push(s);\n }\n for(var i = 0; i < node.MacroContentArray.length; i++) {\n var c = node.MacroContentArray[i];\n if(c.IsMacroReference) {\n if(\"Ref\" in c && c.Ref != null) {\n traverse(c.Ref, indent + c.Indent);\n } else {\n lines.push(\"<<\" + c.Name + \">>\");\n }\n } else {\n // indent the line\n var s = \"\";\n for(var j = 0; j < indent + c.Indent; j++) {\n s += \" \";\n }\n lines.push(s + c.Code);\n }\n }\n }\n traverse(root, 0);\n return lines;\n}", "function parse_Expr() {\n tree.addNode('Expr', 'branch');\n if (foundTokensCopy[parseCounter][1] == \"digit\") {\n console.log('its a gooda digit');\n parse_IntExpr();\n //tree.endChildren();\n\n\n } else if (foundTokensCopy[parseCounter][0] == '\"') {\n parse_StringExpr();\n //tree.endChildren();\n\n } else if (foundTokensCopy[parseCounter][0] == '(' || foundTokensCopy[parseCounter][0] == 'false' || foundTokensCopy[parseCounter][0] == 'true') {\n parse_BooleanExpr();\n //tree.endChildren();\n\n\n } else if (foundTokensCopy[parseCounter][1] == 'identifier') {\n parse_ID();\n //tree.endChildren();\n\n\n }\n else {\n document.getElementById('parse').value += \"PARSE ERROR: KILLING PARSER\"\n throw new Error(\"Something went badly wrong!\");\n }\n tree.endChildren();\n\n}", "function walk_tree(ast) {\n var walker = {\n \"assign\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n assign_expr.left_expr = walk_tree(ast[2]);\n assign_expr.right_expr = walk_tree(ast[3]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr;\n },\n \n \"var\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n \n assign_expr.left_expr = new type_object();\n assign_expr.left_expr.name = ast[1][0][0];\n assign_expr.right_expr = walk_tree(ast[1][0][1]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr; \n },\n \n \"stat\" : function() {\n return walk_tree(ast[1]);\n },\n \n \"dot\" : function() {\n var dot_obj = walk_tree(ast[1]);\n dot_obj.child = new type_object();\n dot_obj.child.name = ast[2];\n dot_obj.child.parent = dot_obj;\n return dot_obj;\n },\n \n \"name\" : function() {\n var new_obj = new type_object();\n new_obj.type = \"name\";\n new_obj.name = ast[1];\n return new_obj;\n },\n \n \"new\" : function() {\n var expr = walk_tree(ast[1]);\n expr.type = \"composition\";\n return expr;\n },\n \n \"function\" : function() {\n var func = new type_function(\"function\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"defun\" : function() { \n var func = new type_function(\"defun\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"return\" : function() {\n var return_expr = new type_expression();\n return_expr.type = \"return_expr\";\n return_expr.expr = walk_tree(ast[1]);\n return return_expr;\n },\n \n \"string\" : function() {\n var obj = new type_object();\n obj.type = \"string\";\n obj.value = ast[1];\n return obj;\n },\n \n \"num\" : function() {\n var obj = new type_object();\n obj.type = \"num\";\n obj.value = ast[1];\n return obj;\n },\n \n \"binary\" : function() {\n var binary_expr = new binary_expression();\n binary_expr.type = \"binary_expr\";\n binary_expr.binary_lhs = walk_tree(ast[2]);\n binary_expr.binary_rhs = walk_tree(ast[3]);\n },\n }\n \n var parent = ast[0];\n \n var func = walker[parent];\n \n return func(ast);\n}", "getTree() {\n\n return [\n 'apply',\n this.address.getTree(),\n this.args.map(arg => arg.getTree()),\n this.block\n ];\n }", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function tcl(hljs) {\n return {\n name: 'Tcl',\n aliases: ['tk'],\n keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +\n 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +\n 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +\n 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +\n 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +\n 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+\n 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+\n 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+\n 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+\n 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+\n 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+\n 'uplevel upvar variable vwait while',\n contains: [\n hljs.COMMENT(';[ \\\\t]*#', '$'),\n hljs.COMMENT('^[ \\\\t]*#', '$'),\n {\n beginKeywords: 'proc',\n end: '[\\\\{]',\n excludeEnd: true,\n contains: [\n {\n className: 'title',\n begin: '[ \\\\t\\\\n\\\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '[ \\\\t\\\\n\\\\r]',\n endsWithParent: true,\n excludeEnd: true\n }\n ]\n },\n {\n excludeEnd: true,\n variants: [\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\\\(([a-zA-Z0-9_])*\\\\)',\n end: '[^a-zA-Z0-9_\\\\}\\\\$]'\n },\n {\n begin: '\\\\$(\\\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',\n end: '(\\\\))?[^a-zA-Z0-9_\\\\}\\\\$]'\n }\n ]\n },\n {\n className: 'string',\n contains: [hljs.BACKSLASH_ESCAPE],\n variants: [\n hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})\n ]\n },\n {\n className: 'number',\n variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]\n }\n ]\n }\n}", "function getTrees() {\n let trees = [];\n for (let i = 1; i <= 5; i++) {\n let trunkElm = $(`#trunk-${i}`);\n let leavesElm = $(`#leaves-${i}`);\n let startPathTrunk = trunkElm.getAttribute(\"d\");\n let startPathLeaves = leavesElm.getAttribute(\"d\");\n let endPathTrunk = _getEndPath(startPathTrunk);\n let endPathLeaves = _getEndPath(startPathLeaves);\n let obj = {\n leaves: { elm: leavesElm, paths: [startPathLeaves, ...endPathLeaves] },\n trunk: { elm: trunkElm, paths: [startPathTrunk, ...endPathTrunk] },\n tilt: i <= 3 ? \"right\" : \"left\"\n };\n trees.push(obj);\n }\n return trees;\n}", "function EqnLeaf()\n{\n // type - operator, number, id, variable - defined and wont change\n this.leafType = 0;\n this.leafValue = null;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "parseTreeSelector() {\n this.skipSpace(); // Ignore space after a comma, for example\n\n // A tree selector must begin with a node selector\n let ns = this.parseNodeSelector();\n\n for (;;) {\n // Now check the next token. If there is none, or if it is a\n // comma, then we're done with the treeSelector. Otherwise\n // we expect a combinator followed by another node selector.\n // If we don't see a combinator, we throw an error. If we\n // do see a combinator and another node selector then we\n // combine the current node selector with the new node selector\n // using a Selector subclass that depends on the combinator.\n const token = this.nextToken();\n\n if (!token || token === \",\") {\n break;\n } else if (token === \" \") {\n this.consume();\n ns = new AncestorCombinator(ns, this.parseNodeSelector());\n } else if (token === \">\") {\n this.consume();\n ns = new ParentCombinator(ns, this.parseNodeSelector());\n } else if (token === \"+\") {\n this.consume();\n ns = new PreviousCombinator(ns, this.parseNodeSelector());\n } else if (token === \"~\") {\n this.consume();\n ns = new SiblingCombinator(ns, this.parseNodeSelector());\n } else {\n throw new ParseError(\"Unexpected token: \" + token);\n }\n }\n\n return ns;\n }", "function createTOC () {\r\n var headings = [];\r\n \r\n createGlossary ();\r\n \r\n // retrieve all headings\r\n for (var i=1; i<=MAX_HEADINGS; i+=1) {\r\n $(\".module h\" + i).each (function () {\r\n var s = $(this).text();\r\n headings.push (s);\r\n });\r\n } headings.sort (); // sort headings\r\n \r\n // begin constructing TOC by defining the root\r\n $('#toc').append (\"<ol class='toc-root''></ol>\");\r\n \r\n // build subtrees\r\n function build (prefix, level, tree) {\r\n var code = \"\";\r\n for (var i=0; i<tree.length; i++) {\r\n if (getDepth(tree[i]) == level && getPrefix(tree[i], level) == prefix) {\r\n code = code + \"<li class='toc-parent'>\" + tree[i] + \"</li>\";\r\n code = code + \"<ol class='toc-child'>\";\r\n for (var j=0;j<40;j++) {\r\n code = code + build(prefix + \".\" + j, level+1, tree);\r\n }\r\n code = code + \"</ol>\";\r\n }\r\n }\r\n return code;\r\n }\r\n \r\n // get the module headings\r\n var num_modules = 0;\r\n for (var i=0; i<headings.length; i++) {\r\n if (getDepth(headings[i]) == 1) {\r\n num_modules++;\r\n }\r\n }\r\n \r\n // build subtrees for all modules\r\n var code = \"\";\r\n for (var i=0; i<num_modules; i++) {\r\n code = code + build (i, 1, headings);\r\n }\r\n \r\n $(\".toc-root\").append (code);\r\n \r\n // change parents with empty subtrees to leaves\r\n $(\".toc-parent\").each (function (key, val) {\r\n if ($.trim($(this).next().text()) == \"\") {\r\n $(this).removeClass (\"toc-parent\");\r\n $(this).addClass (\"toc-leaf\");\r\n }\r\n });\r\n\r\n initializeModules();\r\n linker ();\r\n detectEmptySections ();\r\n createButtons ();\r\n toggleTOCSections ();\r\n scrollToTopAnimation ();\r\n openModuleClickTOC ();\r\n}", "function expand(stx, context) {\n assert(context, 'must provide an expander context');\n var trees = expandToTermTree(stx, context);\n var terms = _.map(trees.terms, function (term) {\n return expandTermTreeToFinal(term, trees.context);\n });\n if (trees.restStx) {\n terms.push.apply(terms, trees.restStx);\n }\n return terms;\n }" ]
[ "0.6618771", "0.5954941", "0.58743894", "0.5807066", "0.5762332", "0.56107986", "0.54209614", "0.53674185", "0.53674185", "0.5338555", "0.52622247", "0.523543", "0.5233892", "0.52177334", "0.5181093", "0.51378644", "0.5136577", "0.5131451", "0.5129106", "0.5105356", "0.5104436", "0.5093499", "0.508612", "0.50830185", "0.5079794", "0.50661576", "0.5065964", "0.50573474", "0.505632", "0.5047283", "0.5002237", "0.49992168", "0.49893838", "0.4985289", "0.49818498", "0.49654016", "0.49654016", "0.496254", "0.4946747", "0.4940307", "0.49345243", "0.49250695", "0.49169132", "0.49125543", "0.48976034", "0.4893064", "0.48907647", "0.48903883", "0.4889349", "0.48868158", "0.48852935", "0.48831418", "0.48829666", "0.48822293", "0.48757675", "0.4873977", "0.48335516", "0.4827719", "0.48203856", "0.48136812", "0.48091048", "0.48049554", "0.47964448", "0.47946078", "0.47892174", "0.47892174", "0.47886077", "0.47850764", "0.4782028", "0.47729978", "0.47720233", "0.47560856", "0.47447035", "0.47447035", "0.47447035", "0.47447035", "0.4739075", "0.4726846", "0.4723661", "0.4716471", "0.4716227", "0.4702066", "0.46977094", "0.46974692", "0.46954852", "0.46941826", "0.46941826", "0.46941826", "0.46941826", "0.46936244", "0.46932617", "0.46852642", "0.46852642", "0.46852642", "0.46852642", "0.46852642", "0.46852642", "0.46814868", "0.4678539", "0.46774256" ]
0.77228624
0
This should only be used on things that can't be rebound except by macros (puncs, keywords).
function resolveFast(stx, env) { var name = unwrapSyntax(stx); return env.names.get(name) ? resolve(stx) : name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bindable(){\n\t\t\n\t}", "function Bind_A_Oother() {\r\n}", "function Bind_A_Obound() {\r\n}", "function hardBound(){\n hard.call(obj)\n}", "function Bind_A_A_R() {\r\n}", "function wrappedCallbackPreprocessor(val) {\n // Matches either an isolated identifier or something ending with a property accessor\n if (/^([$_a-z][$\\w]*|.+(\\.\\s*[$_a-z][$\\w]*|\\[.+\\]))$/i.test(val)) {\n return 'function(_x,_y,_z){return(' + val + ')(_x,_y,_z);}';\n } else {\n return val;\n }\n }", "function Class_checkPrebind(object) {\n if ('prebind' in object && isArray(object.prebind)) {\n object.prebind.each(function(method) {\n object[method] = object[method].bind(object);\n });\n }\n}", "function StupidBug() {}", "defineFn(name, words) {this.fnDefs[name] = words;}", "function _() { undefined; }", "function __func(){}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function Bind_A_Oliteral() {\r\n}", "function Bind_A_A_A() {\r\n}", "function p(t,e){return t.name===e&&!t.ctrl&&!t.shift&&!t.meta}", "function If_bound_bound_literal() {\r\n}", "function If_bound_other_other() {\r\n}", "__eval__(__source__, __boundValues__) { return eval(__source__) }", "function $__(arg)\n{\n return $_(arg).add(arg);\n}", "function reserved(){}", "function If_other_bound_other() {\r\n}", "function dummy() {}", "function dummy() {}", "function dummy() {}", "function If_bound_bound_other() {\r\n}", "function simpleBind(context, fn) { // 14775\n return function(value) { // 14776\n fn.call(context, value); // 14777\n }; // 14778\n } // 14779", "function Bind_Obound() {\r\n}", "static final private internal function m106() {}", "function If_bound_other_literal() {\r\n}", "function __(x) {\r\n\tx = undefined;\r\n}", "function l(t,e,n,i){return function(t){t.input.removeListener(\"keypress\",t.onKeypress)}(t),t.rl.close(),t.callback(e,r.pluck(\n/*!\n * Clean vestigial arguments out of the arguments array so that it may be sent to the caller\n * as a completed command\n */\nfunction(t){return r.filter(t,function(t){return t.quote||\"\"!==t.str})}\n/*!\n * Convenience function to convert a potential string or undefined ps string to a function that\n * returns the same string.\n */(n),\"str\"),i)}", "function patchViaCapturingAllTheEvents() {\n eventNames.forEach(function (property) {\n var onproperty = 'on' + property;\n document.addEventListener(property, function (event) {\n var elt = event.target, bound;\n while (elt) {\n if (elt[onproperty] && !elt[onproperty]._unbound) {\n bound = global.zone.bind(elt[onproperty]);\n bound._unbound = elt[onproperty];\n elt[onproperty] = bound;\n }\n elt = elt.parentElement;\n }\n }, true);\n });\n}", "function _noop$1() {}", "function bind(e,t){return function(){return t.apply(e,arguments)}}", "Bind(IDispatch, string, string) {\n\n }", "function doHandleBinding(cm, bound, dropShift) {\n\t\t if (typeof bound == \"string\") {\n\t\t bound = commands[bound];\n\t\t if (!bound) { return false }\n\t\t }\n\t\t // Ensure previous input has been read, so that the handler sees a\n\t\t // consistent view of the document\n\t\t cm.display.input.ensurePolled();\n\t\t var prevShift = cm.display.shift, done = false;\n\t\t try {\n\t\t if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n\t\t if (dropShift) { cm.display.shift = false; }\n\t\t done = bound(cm) != Pass;\n\t\t } finally {\n\t\t cm.display.shift = prevShift;\n\t\t cm.state.suppressEdits = false;\n\t\t }\n\t\t return done\n\t\t }", "function makeUnwrapping0ArgMethod(primitive) {\n return function builtin() {\n var vHandler = safeWeakMapGet(directProxies, this);\n if (vHandler !== undefined) {\n return builtin.call(vHandler.target);\n } else {\n return primitive.call(this);\n }\n }\n}", "function makeUnwrapping0ArgMethod(primitive) {\n return function builtin() {\n var vHandler = safeWeakMapGet(directProxies, this);\n if (vHandler !== undefined) {\n return builtin.call(vHandler.target);\n } else {\n return primitive.call(this);\n }\n }\n}", "function doHandleBinding(cm, bound, dropShift) {\n\t\t if (typeof bound == \"string\") {\n\t\t bound = commands[bound];\n\t\t if (!bound) return false;\n\t\t }\n\t\t // Ensure previous input has been read, so that the handler sees a\n\t\t // consistent view of the document\n\t\t cm.display.input.ensurePolled();\n\t\t var prevShift = cm.display.shift, done = false;\n\t\t try {\n\t\t if (cm.isReadOnly()) cm.state.suppressEdits = true;\n\t\t if (dropShift) cm.display.shift = false;\n\t\t done = bound(cm) != Pass;\n\t\t } finally {\n\t\t cm.display.shift = prevShift;\n\t\t cm.state.suppressEdits = false;\n\t\t }\n\t\t return done;\n\t\t }", "function __(thunkish,nocache)\n{\n while (thunkish instanceof $)\n thunkish = thunkish.force(nocache);\n return thunkish;\n}", "function UnboundDataCompiler() {\n\n }", "function Bind_Oliteral() {\r\n}", "function simpleBind(context,fn){return function(value){fn.call(context,value);};}", "function promoterenhancer(){\n\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}", "function If_bound_literal_literal() {\r\n}", "function doHandleBinding(cm, bound, dropShift) {\n\t if (typeof bound == \"string\") {\n\t bound = commands[bound];\n\t if (!bound) return false;\n\t }\n\t // Ensure previous input has been read, so that the handler sees a\n\t // consistent view of the document\n\t cm.display.input.ensurePolled();\n\t var prevShift = cm.display.shift, done = false;\n\t try {\n\t if (cm.isReadOnly()) cm.state.suppressEdits = true;\n\t if (dropShift) cm.display.shift = false;\n\t done = bound(cm) != Pass;\n\t } finally {\n\t cm.display.shift = prevShift;\n\t cm.state.suppressEdits = false;\n\t }\n\t return done;\n\t }", "function doHandleBinding(cm, bound, dropShift) {\n\t if (typeof bound == \"string\") {\n\t bound = commands[bound];\n\t if (!bound) return false;\n\t }\n\t // Ensure previous input has been read, so that the handler sees a\n\t // consistent view of the document\n\t cm.display.input.ensurePolled();\n\t var prevShift = cm.display.shift, done = false;\n\t try {\n\t if (cm.isReadOnly()) cm.state.suppressEdits = true;\n\t if (dropShift) cm.display.shift = false;\n\t done = bound(cm) != Pass;\n\t } finally {\n\t cm.display.shift = prevShift;\n\t cm.state.suppressEdits = false;\n\t }\n\t return done;\n\t }", "function doHandleBinding(cm, bound, dropShift) {\n\t if (typeof bound == \"string\") {\n\t bound = commands[bound];\n\t if (!bound) return false;\n\t }\n\t // Ensure previous input has been read, so that the handler sees a\n\t // consistent view of the document\n\t cm.display.input.ensurePolled();\n\t var prevShift = cm.display.shift, done = false;\n\t try {\n\t if (cm.isReadOnly()) cm.state.suppressEdits = true;\n\t if (dropShift) cm.display.shift = false;\n\t done = bound(cm) != Pass;\n\t } finally {\n\t cm.display.shift = prevShift;\n\t cm.state.suppressEdits = false;\n\t }\n\t return done;\n\t }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n }", "function partiallyApplied(handler){var args=[].slice.call(arguments,1);return function(){if(typeof handler===\"function\"){handler.apply(undefined,args);}else{new Function(\"\"+handler)();}};}", "function polyfillBind (fn, ctx) {\r\n function boundFn (a) {\r\n var l = arguments.length;\r\n return l\r\n ? l > 1\r\n ? fn.apply(ctx, arguments)\r\n : fn.call(ctx, a)\r\n : fn.call(ctx)\r\n }\r\n\r\n boundFn._length = fn.length;\r\n return boundFn\r\n}", "function register() {\n if (Object.prototype.copy !== boundCopy) {\n ocopy = Object.prototype.copy;\n Object.prototype.copy = boundCopy;\n }\n }", "function register() {\n if (Object.prototype.copy !== boundCopy) {\n ocopy = Object.prototype.copy;\n Object.prototype.copy = boundCopy;\n }\n }", "function doHandleBinding(cm, bound, dropShift) {\r\n if (typeof bound == \"string\") {\r\n bound = commands[bound];\r\n if (!bound) { return false }\r\n }\r\n // Ensure previous input has been read, so that the handler sees a\r\n // consistent view of the document\r\n cm.display.input.ensurePolled();\r\n var prevShift = cm.display.shift, done = false;\r\n try {\r\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\r\n if (dropShift) { cm.display.shift = false; }\r\n done = bound(cm) != Pass;\r\n } finally {\r\n cm.display.shift = prevShift;\r\n cm.state.suppressEdits = false;\r\n }\r\n return done\r\n}", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) cm.state.suppressEdits = true;\n if (dropShift) cm.display.shift = false;\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done;\n }", "function handleRPBindAttribute(clone, obj, itemName) {\n var attrName = 'rp-bind';\n // check children of clone\n [].slice.call(clone.querySelectorAll('[' + attrName + ']')).forEach(function (node) {\n getLoopValueFromAttribute(node, obj, itemName, attrName, function (val) {\n if (typeof val === 'function') {\n if (val(node) === false) {\n // remove node if function returns false\n node.parentNode.removeChild(node); \n }\n } else {\n console.error('repeat:can not register control function without a function pointer', node);\n }\n });\n });\n }", "private public function m246() {}", "function register() {\n if (Object.prototype.typeOf !== boundTypeOf) {\n otypeof = Object.prototype.typeOf;\n Object.prototype.typeOf = boundTypeOf;\n }\n }", "function register() {\n if (Object.prototype.typeOf !== boundTypeOf) {\n otypeof = Object.prototype.typeOf;\n Object.prototype.typeOf = boundTypeOf;\n }\n }", "transient private protected internal function m182() {}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ?\n l > 1 ?\n fn.apply(ctx, arguments) :\n fn.call(ctx, a) :\n fn.call(ctx)\n }\n\n boundFn._length = fn.length;\n return boundFn\n }", "function pn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);fn(e);try{return t.apply(e,arguments)}finally{on(e)}}}", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound]\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled()\n var prevShift = cm.display.shift, done = false\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true }\n if (dropShift) { cm.display.shift = false }\n done = bound(cm) != Pass\n } finally {\n cm.display.shift = prevShift\n cm.state.suppressEdits = false\n }\n return done\n}", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound]\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled()\n var prevShift = cm.display.shift, done = false\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true }\n if (dropShift) { cm.display.shift = false }\n done = bound(cm) != Pass\n } finally {\n cm.display.shift = prevShift\n cm.state.suppressEdits = false\n }\n return done\n}", "function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (isReadOnly(cm)) cm.state.suppressEdits = true;\n if (dropShift) cm.display.shift = false;\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done;\n }", "function ninja() {}", "function polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l\n ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a)\n : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n }", "function bind_shim() {\n\n if (!Function.prototype.bind) {\n\n Function.prototype.bind = function(oThis) {\n\n if (typeof this !== \"function\") {\n // closest thing possible to the ECMAScript 5 internal IsCallable function\n throw new TypeError(\n \"Function.prototype.bind - what is trying to be bound is not callable\");\n }\n\n var fSlice = Array.prototype.slice, aArgs = fSlice.call(arguments, 1), fToBind = this;\n\n /**\n * @constructor\n */\n var fNOP = function() {\n\n };\n\n var fBound = function() {\n\n return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs\n .concat(fSlice.call(arguments)));\n };\n\n fNOP.prototype = this.prototype;\n fBound.prototype = new fNOP();\n\n return fBound;\n };\n }\n\n}", "function doHandleBinding(cm, bound, dropShift) {\r\n if (typeof bound == \"string\") {\r\n bound = commands[bound];\r\n if (!bound) return false;\r\n }\r\n // Ensure previous input has been read, so that the handler sees a\r\n // consistent view of the document\r\n if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;\r\n var prevShift = cm.display.shift, done = false;\r\n try {\r\n if (isReadOnly(cm)) cm.state.suppressEdits = true;\r\n if (dropShift) cm.display.shift = false;\r\n done = bound(cm) != Pass;\r\n } finally {\r\n cm.display.shift = prevShift;\r\n cm.state.suppressEdits = false;\r\n }\r\n return done;\r\n }", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}" ]
[ "0.5658762", "0.55640066", "0.5505738", "0.5474551", "0.542629", "0.53443706", "0.5343808", "0.53326213", "0.5325792", "0.53203434", "0.5315431", "0.5270324", "0.5270324", "0.5270324", "0.5267028", "0.5260755", "0.52444047", "0.5241858", "0.52308846", "0.5219925", "0.5212031", "0.52087903", "0.52083755", "0.5206085", "0.5206085", "0.5206085", "0.51984173", "0.5185172", "0.5180455", "0.5133244", "0.5123949", "0.5116697", "0.5113939", "0.50904256", "0.50903744", "0.5084988", "0.5081156", "0.5069875", "0.50662106", "0.50662106", "0.5057613", "0.50548637", "0.50385916", "0.50287634", "0.5020352", "0.5017426", "0.5015938", "0.5015938", "0.5015938", "0.5015938", "0.5015938", "0.5015938", "0.5015938", "0.5009858", "0.50048816", "0.50048816", "0.50048816", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.50001705", "0.49960104", "0.4988018", "0.49875632", "0.49836296", "0.49836296", "0.49815845", "0.4978948", "0.49755833", "0.49739346", "0.49695542", "0.49695542", "0.49669164", "0.49602666", "0.49547017", "0.49505347", "0.49505347", "0.49498177", "0.49493304", "0.49468967", "0.49461868", "0.49449494", "0.49440044", "0.49440044", "0.49440044", "0.49440044", "0.49440044", "0.49440044" ]
0.0
-1
enforest the tokens, returns an object with the `result` TermTree and the uninterpreted `rest` of the syntax
function enforest(toks, context, prevStx, prevTerms) { assert(toks.length > 0, 'enforest assumes there are tokens to work with'); prevStx = prevStx || []; prevTerms = prevTerms || []; if (expandCount >= maxExpands) { return { result: null, rest: toks }; } function step(head, rest, opCtx) { var innerTokens; assert(Array.isArray(rest), 'result must at least be an empty array'); if (head.isTermTree) { var isCustomOp = false; var uopMacroObj; var uopSyntax; if (head.isPunc || head.isKeyword || head.isId) { if (head.isPunc) { uopSyntax = head.punc; } else if (head.isKeyword) { uopSyntax = head.keyword; } else if (head.isId) { uopSyntax = head.id; } uopMacroObj = getMacroInEnv(uopSyntax, rest, context.env); isCustomOp = uopMacroObj && uopMacroObj.isOp; } // look up once (we want to check multiple properties on bopMacroObj // without repeatedly calling getMacroInEnv) var bopMacroObj; if (rest[0] && rest[1]) { bopMacroObj = getMacroInEnv(rest[0], rest.slice(1), context.env); } // unary operator if (isCustomOp && uopMacroObj.unary || uopSyntax && stxIsUnaryOp(uopSyntax)) { var uopPrec; if (isCustomOp && uopMacroObj.unary) { uopPrec = uopMacroObj.unary.prec; } else { uopPrec = getUnaryOpPrec(unwrapSyntax(uopSyntax)); } var opRest = rest; var uopMacroName; if (uopMacroObj) { uopMacroName = [uopSyntax].concat(rest.slice(0, uopMacroObj.fullName.length - 1)); opRest = rest.slice(uopMacroObj.fullName.length - 1); } var leftLeft = opCtx.prevTerms[0] && opCtx.prevTerms[0].isPartial ? opCtx.prevTerms[0] : null; var unopTerm = PartialOperation.create(head, leftLeft); var unopPrevStx = tagWithTerm(unopTerm, head.destruct().reverse()).concat(opCtx.prevStx); var unopPrevTerms = [unopTerm].concat(opCtx.prevTerms); var unopOpCtx = _.extend({}, opCtx, { combine: function (t) { if (t.isExpr) { if (isCustomOp && uopMacroObj.unary) { var rt$2 = expandMacro(uopMacroName.concat(t.destruct()), context, opCtx, 'unary'); var newt = get_expression(rt$2.result, context); assert(newt.rest.length === 0, 'should never have left over syntax'); return opCtx.combine(newt.result); } return opCtx.combine(UnaryOp.create(uopSyntax, t)); } else { // not actually an expression so don't create // a UnaryOp term just return with the punctuator return opCtx.combine(head); } }, prec: uopPrec, prevStx: unopPrevStx, prevTerms: unopPrevTerms, op: unopTerm }); return step(opRest[0], opRest.slice(1), unopOpCtx); } // BinOp else if (head.isExpr && (rest[0] && rest[1] && (stxIsBinOp(rest[0]) && !bopMacroObj || bopMacroObj && bopMacroObj.isOp && bopMacroObj.binary))) { var opRes; var op = rest[0]; var left = head; var rightStx = rest.slice(1); var leftLeft = opCtx.prevTerms[0] && opCtx.prevTerms[0].isPartial ? opCtx.prevTerms[0] : null; var leftTerm = PartialExpression.create(head.destruct(), leftLeft, function () { return step(head, [], opCtx); }); var opTerm = PartialOperation.create(op, leftTerm); var opPrevStx = tagWithTerm(opTerm, [rest[0]]).concat(tagWithTerm(leftTerm, head.destruct()).reverse(), opCtx.prevStx); var opPrevTerms = [ opTerm, leftTerm ].concat(opCtx.prevTerms); var isCustomOp = bopMacroObj && bopMacroObj.isOp && bopMacroObj.binary; var bopPrec; var bopAssoc; if (isCustomOp && bopMacroObj.binary) { bopPrec = bopMacroObj.binary.prec; bopAssoc = bopMacroObj.binary.assoc; } else { bopPrec = getBinaryOpPrec(unwrapSyntax(op)); bopAssoc = getBinaryOpAssoc(unwrapSyntax(op)); } assert(bopPrec !== undefined, 'expecting a precedence for operator: ' + op); var newStack; if (comparePrec(bopPrec, opCtx.prec, bopAssoc)) { var bopCtx = opCtx; var combResult = opCtx.combine(head); if (opCtx.stack.length > 0) { return step(combResult.term, rest, opCtx.stack[0]); } left = combResult.term; newStack = opCtx.stack; opPrevStx = combResult.prevStx; opPrevTerms = combResult.prevTerms; } else { newStack = [opCtx].concat(opCtx.stack); } assert(opCtx.combine !== undefined, 'expecting a combine function'); var opRightStx = rightStx; var bopMacroName; if (isCustomOp) { bopMacroName = rest.slice(0, bopMacroObj.fullName.length); opRightStx = rightStx.slice(bopMacroObj.fullName.length - 1); } var bopOpCtx = _.extend({}, opCtx, { combine: function (right) { if (right.isExpr) { if (isCustomOp && bopMacroObj.binary) { var leftStx = left.destruct(); var rightStx$2 = right.destruct(); var rt$2 = expandMacro(bopMacroName.concat(syn.makeDelim('()', leftStx, leftStx[0]), syn.makeDelim('()', rightStx$2, rightStx$2[0])), context, opCtx, 'binary'); var newt = get_expression(rt$2.result, context); assert(newt.rest.length === 0, 'should never have left over syntax'); return { term: newt.result, prevStx: opCtx.prevStx, prevTerms: opCtx.prevTerms }; } return { term: BinOp.create(left, op, right), prevStx: opCtx.prevStx, prevTerms: opCtx.prevTerms }; } else { return { term: head, prevStx: opCtx.prevStx, prevTerms: opCtx.prevTerms }; } }, prec: bopPrec, op: opTerm, stack: newStack, prevStx: opPrevStx, prevTerms: opPrevTerms }); return step(opRightStx[0], opRightStx.slice(1), bopOpCtx); } // Call else if (head.isExpr && (rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()')) { var argRes, enforestedArgs = [], commas = []; rest[0].expose(); innerTokens = rest[0].token.inner; while (innerTokens.length > 0) { argRes = enforest(innerTokens, context); if (!argRes.result) { break; } enforestedArgs.push(argRes.result); innerTokens = argRes.rest; if (innerTokens[0] && innerTokens[0].token.value === ',') { // record the comma for later commas.push(innerTokens[0]); // but dump it for the next loop turn innerTokens = innerTokens.slice(1); } else { // either there are no more tokens or // they aren't a comma, either way we // are done with the loop break; } } var argsAreExprs = _.all(enforestedArgs, function (argTerm) { return argTerm.isExpr; }); // only a call if we can completely enforest each argument and // each argument is an expression if (innerTokens.length === 0 && argsAreExprs) { return step(Call.create(head, enforestedArgs, rest[0], commas), rest.slice(1), opCtx); } } // Conditional ( x ? true : false) else if (head.isExpr && (rest[0] && resolveFast(rest[0], context.env) === '?')) { var question = rest[0]; var condRes = enforest(rest.slice(1), context); if (condRes.result) { var truExpr = condRes.result; var condRight = condRes.rest; if (truExpr.isExpr && condRight[0] && resolveFast(condRight[0], context.env) === ':') { var colon = condRight[0]; var flsRes = enforest(condRight.slice(1), context); var flsExpr = flsRes.result; if (flsExpr.isExpr) { return step(ConditionalExpression.create(head, question, truExpr, colon, flsExpr), flsRes.rest, opCtx); } } } } // Constructor else if (head.isKeyword && resolveFast(head.keyword, context.env) === 'new' && rest[0]) { var newCallRes = enforest(rest, context); if (newCallRes && newCallRes.result.isExpr) { return step(Const.create(head, newCallRes.result), newCallRes.rest, opCtx); } } // Arrow functions with expression bodies else if (head.isDelimiter && head.delim.token.value === '()' && rest[0] && rest[0].token.type === parser.Token.Punctuator && resolveFast(rest[0], context.env) === '=>') { var arrowRes = enforest(rest.slice(1), context); if (arrowRes.result && arrowRes.result.isExpr) { return step(ArrowFun.create(head.delim, rest[0], arrowRes.result.destruct()), arrowRes.rest, opCtx); } else { throwSyntaxError('enforest', 'Body of arrow function must be an expression', rest.slice(1)); } } // Arrow functions with expression bodies else if (head.isId && rest[0] && rest[0].token.type === parser.Token.Punctuator && resolveFast(rest[0], context.env) === '=>') { var res = enforest(rest.slice(1), context); if (res.result && res.result.isExpr) { return step(ArrowFun.create(head.id, rest[0], res.result.destruct()), res.rest, opCtx); } else { throwSyntaxError('enforest', 'Body of arrow function must be an expression', rest.slice(1)); } } // ParenExpr else if (head.isDelimiter && head.delim.token.value === '()') { innerTokens = head.delim.expose().token.inner; // empty parens are acceptable but enforest // doesn't accept empty arrays so short // circuit here if (innerTokens.length === 0) { head.delim.token.inner = [Empty.create()]; return step(ParenExpression.create(head), rest, opCtx); } else { var innerTerm = get_expression(innerTokens, context); if (innerTerm.result && innerTerm.result.isExpr && innerTerm.rest.length === 0) { head.delim.token.inner = [innerTerm.result]; return step(ParenExpression.create(head), rest, opCtx); } } // if the tokens inside the paren aren't an expression // we just leave it as a delimiter } // AssignmentExpression else if (head.isExpr && ((head.isId || head.isObjGet || head.isObjDotGet || head.isThisExpression) && rest[0] && rest[1] && !bopMacroObj && stxIsAssignOp(rest[0]))) { var opRes = enforestAssignment(rest, context, head, prevStx, prevTerms); if (opRes && opRes.result) { return step(opRes.result, opRes.rest, _.extend({}, opCtx, { prevStx: opRes.prevStx, prevTerms: opRes.prevTerms })); } } // Postfix else if (head.isExpr && (rest[0] && (unwrapSyntax(rest[0]) === '++' || unwrapSyntax(rest[0]) === '--'))) { // Check if the operator is a macro first. if (context.env.has(resolveFast(rest[0], context.env))) { var headStx = tagWithTerm(head, head.destruct().reverse()); var opPrevStx = headStx.concat(prevStx); var opPrevTerms = [head].concat(prevTerms); var opRes = enforest(rest, context, opPrevStx, opPrevTerms); if (opRes.prevTerms.length < opPrevTerms.length) { return opRes; } else if (opRes.result) { return step(head, opRes.result.destruct().concat(opRes.rest), opCtx); } } return step(PostfixOp.create(head, rest[0]), rest.slice(1), opCtx); } // ObjectGet (computed) else if (head.isExpr && (rest[0] && rest[0].token.value === '[]')) { return step(ObjGet.create(head, Delimiter.create(rest[0].expose())), rest.slice(1), opCtx); } // ObjectGet else if (head.isExpr && (rest[0] && unwrapSyntax(rest[0]) === '.' && !context.env.has(resolveFast(rest[0], context.env)) && rest[1] && (rest[1].token.type === parser.Token.Identifier || rest[1].token.type === parser.Token.Keyword))) { // Check if the identifier is a macro first. if (context.env.has(resolveFast(rest[1], context.env))) { var headStx = tagWithTerm(head, head.destruct().reverse()); var dotTerm = Punc.create(rest[0]); var dotTerms = [dotTerm].concat(head, prevTerms); var dotStx = tagWithTerm(dotTerm, [rest[0]]).concat(headStx, prevStx); var dotRes = enforest(rest.slice(1), context, dotStx, dotTerms); if (dotRes.prevTerms.length < dotTerms.length) { return dotRes; } else if (dotRes.result) { return step(head, [rest[0]].concat(dotRes.result.destruct(), dotRes.rest), opCtx); } } return step(ObjDotGet.create(head, rest[0], rest[1]), rest.slice(2), opCtx); } // ArrayLiteral else if (head.isDelimiter && head.delim.token.value === '[]') { return step(ArrayLiteral.create(head), rest, opCtx); } // Block else if (head.isDelimiter && head.delim.token.value === '{}') { return step(Block.create(head), rest, opCtx); } // quote syntax else if (head.isId && unwrapSyntax(head.id) === '#quoteSyntax' && rest[0] && rest[0].token.value === '{}') { var tempId = fresh(); context.templateMap.set(tempId, rest[0].token.inner); return step(syn.makeIdent('getTemplate', head.id), [syn.makeDelim('()', [syn.makeValue(tempId, head.id)], head.id)].concat(rest.slice(1)), opCtx); } // let statements else if (head.isKeyword && unwrapSyntax(head.keyword) === 'let') { var nameTokens = []; if (rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()') { nameTokens = rest[0].token.inner; } else { nameTokens.push(rest[0]); } // Let macro if (rest[1] && rest[1].token.value === '=' && rest[2] && rest[2].token.value === 'macro') { var mac = enforest(rest.slice(2), context); if (mac.result) { if (!mac.result.isAnonMacro) { throwSyntaxError('enforest', 'expecting an anonymous macro definition in syntax let binding', rest.slice(2)); } return step(LetMacro.create(nameTokens, mac.result.body), mac.rest, opCtx); } } // Let statement else { var lsRes = enforestVarStatement(rest, context, head.keyword); if (lsRes && lsRes.result) { return step(LetStatement.create(head, lsRes.result), lsRes.rest, opCtx); } } } // VariableStatement else if (head.isKeyword && unwrapSyntax(head.keyword) === 'var' && rest[0]) { var vsRes = enforestVarStatement(rest, context, head.keyword); if (vsRes && vsRes.result) { return step(VariableStatement.create(head, vsRes.result), vsRes.rest, opCtx); } } // Const Statement else if (head.isKeyword && unwrapSyntax(head.keyword) === 'const' && rest[0]) { var csRes = enforestVarStatement(rest, context, head.keyword); if (csRes && csRes.result) { return step(ConstStatement.create(head, csRes.result), csRes.rest, opCtx); } } // for statement else if (head.isKeyword && unwrapSyntax(head.keyword) === 'for' && rest[0] && rest[0].token.value === '()') { return step(ForStatement.create(head.keyword, rest[0]), rest.slice(1), opCtx); } // yield statement else if (head.isKeyword && unwrapSyntax(head.keyword) === 'yield') { var yieldExprRes = enforest(rest, context); if (yieldExprRes.result && yieldExprRes.result.isExpr) { return step(YieldExpression.create(head.keyword, yieldExprRes.result), yieldExprRes.rest, opCtx); } } } else { assert(head && head.token, 'assuming head is a syntax object'); var macroObj = expandCount < maxExpands && getMacroInEnv(head, rest, context.env); // macro invocation if (macroObj && !macroObj.isOp) { var rt = expandMacro([head].concat(rest), context, opCtx, null, macroObj); var newOpCtx = opCtx; if (rt.prevTerms && rt.prevTerms.length < opCtx.prevTerms.length) { newOpCtx = rewindOpCtx(opCtx, rt); } if (rt.result.length > 0) { return step(rt.result[0], rt.result.slice(1).concat(rt.rest), newOpCtx); } else { return step(Empty.create(), rt.rest, newOpCtx); } } // anon macro definition else if (head.token.type === parser.Token.Identifier && resolve(head) === 'macro' && rest[0] && rest[0].token.value === '{}') { return step(AnonMacro.create(rest[0].expose().token.inner), rest.slice(1), opCtx); } // macro definition else if (head.token.type === parser.Token.Identifier && resolve(head) === 'macro') { var nameTokens = []; if (rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()') { nameTokens = rest[0].expose().token.inner; } else { nameTokens.push(rest[0]); } if (rest[1] && rest[1].token.type === parser.Token.Delimiter) { return step(Macro.create(nameTokens, rest[1].expose().token.inner), rest.slice(2), opCtx); } else { throwSyntaxError('enforest', 'Macro declaration must include body', rest[1]); } } // operator definition // unaryop (neg) 1 { macro { rule { $op:expr } => { $op } } } else if (head.token.type === parser.Token.Identifier && head.token.value === 'unaryop' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.NumericLiteral && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2] && rest[2].token.value === '{}') { var trans = enforest(rest[2].expose().token.inner, context); return step(OperatorDefinition.create('unary', rest[0].expose().token.inner, rest[1], null, trans.result.body), rest.slice(3), opCtx); } // operator definition // binaryop (neg) 1 left { macro { rule { $op:expr } => { $op } } } else if (head.token.type === parser.Token.Identifier && head.token.value === 'binaryop' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.NumericLiteral && rest[2] && rest[2].token.type === parser.Token.Identifier && rest[3] && rest[3].token.type === parser.Token.Delimiter && rest[3] && rest[3].token.value === '{}') { var trans = enforest(rest[3].expose().token.inner, context); return step(OperatorDefinition.create('binary', rest[0].expose().token.inner, rest[1], rest[2], trans.result.body), rest.slice(4), opCtx); } // module definition else if (unwrapSyntax(head) === 'module' && rest[0] && rest[0].token.value === '{}') { return step(Module.create(rest[0], []), rest.slice(1), opCtx); } // function definition else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Identifier && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '()' && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2].token.value === '{}') { rest[1].token.inner = rest[1].expose().token.inner; rest[2].token.inner = rest[2].expose().token.inner; return step(NamedFun.create(head, null, rest[0], rest[1], rest[2]), rest.slice(3), opCtx); } // generator function definition else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Punctuator && rest[0].token.value === '*' && rest[1] && rest[1].token.type === parser.Token.Identifier && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2].token.value === '()' && rest[3] && rest[3].token.type === parser.Token.Delimiter && rest[3].token.value === '{}') { rest[2].token.inner = rest[2].expose().token.inner; rest[3].token.inner = rest[3].expose().token.inner; return step(NamedFun.create(head, rest[0], rest[1], rest[2], rest[3]), rest.slice(4), opCtx); } // anonymous function definition else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '{}') { rest[0].token.inner = rest[0].expose().token.inner; rest[1].token.inner = rest[1].expose().token.inner; return step(AnonFun.create(head, null, rest[0], rest[1]), rest.slice(2), opCtx); } // anonymous generator function definition else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'function' && rest[0] && rest[0].token.type === parser.Token.Punctuator && rest[0].token.value === '*' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '()' && rest[2] && rest[2].token.type === parser.Token.Delimiter && rest[2].token.value === '{}') { rest[1].token.inner = rest[1].expose().token.inner; rest[2].token.inner = rest[2].expose().token.inner; return step(AnonFun.create(head, rest[0], rest[1], rest[2]), rest.slice(3), opCtx); } // arrow function else if ((head.token.type === parser.Token.Delimiter && head.token.value === '()' || head.token.type === parser.Token.Identifier) && rest[0] && rest[0].token.type === parser.Token.Punctuator && resolveFast(rest[0], context.env) === '=>' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '{}') { return step(ArrowFun.create(head, rest[0], rest[1]), rest.slice(2), opCtx); } // catch statement else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'catch' && rest[0] && rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()' && rest[1] && rest[1].token.type === parser.Token.Delimiter && rest[1].token.value === '{}') { rest[0].token.inner = rest[0].expose().token.inner; rest[1].token.inner = rest[1].expose().token.inner; return step(CatchClause.create(head, rest[0], rest[1]), rest.slice(2), opCtx); } // this expression else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'this') { return step(ThisExpression.create(head), rest, opCtx); } // literal else if (head.token.type === parser.Token.NumericLiteral || head.token.type === parser.Token.StringLiteral || head.token.type === parser.Token.BooleanLiteral || head.token.type === parser.Token.RegularExpression || head.token.type === parser.Token.NullLiteral) { return step(Lit.create(head), rest, opCtx); } // export else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'export' && rest[0] && (rest[0].token.type === parser.Token.Identifier || rest[0].token.type === parser.Token.Keyword || rest[0].token.type === parser.Token.Punctuator || rest[0].token.type === parser.Token.Delimiter && rest[0].token.value === '()')) { return step(Export.create(rest[0]), rest.slice(1), opCtx); } // identifier else if (head.token.type === parser.Token.Identifier) { return step(Id.create(head), rest, opCtx); } // punctuator else if (head.token.type === parser.Token.Punctuator) { return step(Punc.create(head), rest, opCtx); } else if (head.token.type === parser.Token.Keyword && unwrapSyntax(head) === 'with') { throwSyntaxError('enforest', 'with is not supported in sweet.js', head); } // keyword else if (head.token.type === parser.Token.Keyword) { return step(Keyword.create(head), rest, opCtx); } // Delimiter else if (head.token.type === parser.Token.Delimiter) { return step(Delimiter.create(head.expose()), rest, opCtx); } else if (head.token.type === parser.Token.Template) { return step(Template.create(head), rest, opCtx); } // end of file else if (head.token.type === parser.Token.EOF) { assert(rest.length === 0, 'nothing should be after an EOF'); return step(EOF.create(head), [], opCtx); } else { // todo: are we missing cases? assert(false, 'not implemented'); } } // Potentially an infix macro if (head.isExpr && rest.length && nameInEnv(rest[0], rest.slice(1), context.env)) { var infLeftTerm = opCtx.prevTerms[0] && opCtx.prevTerms[0].isPartial ? opCtx.prevTerms[0] : null; var infTerm = PartialExpression.create(head.destruct(), infLeftTerm, function () { return step(head, [], opCtx); }); var infPrevStx = tagWithTerm(infTerm, head.destruct()).reverse().concat(opCtx.prevStx); var infPrevTerms = [infTerm].concat(opCtx.prevTerms); var infRes = expandMacro(rest, context, { prevStx: infPrevStx, prevTerms: infPrevTerms }); if (infRes.prevTerms && infRes.prevTerms.length < infPrevTerms.length) { var infOpCtx = rewindOpCtx(opCtx, infRes); return step(infRes.result[0], infRes.result.slice(1).concat(infRes.rest), infOpCtx); } else { return step(head, infRes.result.concat(infRes.rest), opCtx); } } // done with current step so combine and continue on var combResult = opCtx.combine(head); if (opCtx.stack.length === 0) { return { result: combResult.term, rest: rest, prevStx: combResult.prevStx, prevTerms: combResult.prevTerms }; } else { return step(combResult.term, rest, opCtx.stack[0]); } } return step(toks[0], toks.slice(1), { combine: function (t) { return { term: t, prevStx: prevStx, prevTerms: prevTerms }; }, prec: 0, stack: [], op: null, prevStx: prevStx, prevTerms: prevTerms }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "enforest() {\n\t let type = arguments.length <= 0 || arguments[0] === undefined ? \"Module\" : arguments[0];\n\n\t // initialize the term\n\t this.term = null;\n\n\t if (this.rest.size === 0) {\n\t this.done = true;\n\t return this.term;\n\t }\n\n\t if (this.isEOF(this.peek())) {\n\t this.term = new _terms2.default(\"EOF\", {});\n\t this.advance();\n\t return this.term;\n\t }\n\n\t let result;\n\t if (type === \"expression\") {\n\t result = this.enforestExpressionLoop();\n\t } else {\n\t result = this.enforestModule();\n\t }\n\n\t if (this.rest.size === 0) {\n\t this.done = true;\n\t }\n\t return result;\n\t }", "enforest(type = \"Module\") {\n // initialize the term\n this.term = null;\n\n if (this.rest.size === 0) {\n this.done = true;\n return this.term;\n }\n\n if (this.isEOF(this.peek())) {\n this.term = new Term(\"EOF\", {});\n this.advance();\n return this.term;\n }\n\n let result;\n if (type === \"expression\") {\n result = this.enforestExpressionLoop();\n } else {\n result = this.enforestModule();\n }\n\n if (this.rest.size === 0) {\n this.done = true;\n }\n return result;\n }", "function expandTermTreeToFinal(term, context) {\n assert(context && context.env, 'environment map is required');\n if (term.isArrayLiteral) {\n term.array.delim.token.inner = expand(term.array.delim.expose().token.inner, context);\n return term;\n } else if (term.isBlock) {\n term.body.delim.token.inner = expand(term.body.delim.expose().token.inner, context);\n return term;\n } else if (term.isParenExpression) {\n assert(term.expr.delim.token.inner.length === 1, 'Paren expressions always have a single term inside the delimiter');\n term.expr.delim.token.inner = [expandTermTreeToFinal(term.expr.delim.token.inner[0], context)];\n return term;\n } else if (term.isCall) {\n term.fun = expandTermTreeToFinal(term.fun, context);\n term.args = _.map(term.args, function (arg) {\n return expandTermTreeToFinal(arg, context);\n });\n return term;\n } else if (term.isConst) {\n term.call = expandTermTreeToFinal(term.call, context);\n return term;\n } else if (term.isUnaryOp) {\n term.expr = expandTermTreeToFinal(term.expr, context);\n return term;\n } else if (term.isBinOp || term.isAssignmentExpression) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right = expandTermTreeToFinal(term.right, context);\n return term;\n } else if (term.isObjGet) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right.delim.token.inner = expand(term.right.delim.expose().token.inner, context);\n return term;\n } else if (term.isObjDotGet) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right = expandTermTreeToFinal(term.right, context);\n return term;\n } else if (term.isConditionalExpression) {\n term.cond = expandTermTreeToFinal(term.cond, context);\n term.tru = expandTermTreeToFinal(term.tru, context);\n term.fls = expandTermTreeToFinal(term.fls, context);\n return term;\n } else if (term.isVariableDeclaration) {\n if (term.init) {\n term.init = expandTermTreeToFinal(term.init, context);\n }\n return term;\n } else if (term.isVariableStatement) {\n term.decls = _.map(term.decls, function (decl) {\n return expandTermTreeToFinal(decl, context);\n });\n return term;\n } else if (term.isDelimiter) {\n // expand inside the delimiter and then continue on\n term.delim.token.inner = expand(term.delim.expose().token.inner, context);\n return term;\n } else if (term.isNamedFun || term.isAnonFun || term.isCatchClause || term.isArrowFun || term.isModule) {\n // function definitions need a bunch of hygiene logic\n // push down a fresh definition context\n var newDef = [];\n var bodyContext = makeExpanderContext(_.defaults({ defscope: newDef }, context));\n var paramSingleIdent = term.params && term.params.token.type === parser.Token.Identifier;\n var params;\n if (term.params && term.params.token.type === parser.Token.Delimiter) {\n params = term.params.expose();\n } else if (paramSingleIdent) {\n params = term.params;\n } else {\n params = syn.makeDelim('()', [], null);\n }\n var bodies;\n if (Array.isArray(term.body)) {\n bodies = syn.makeDelim('{}', term.body, null);\n } else {\n bodies = term.body;\n }\n bodies = bodies.addDefCtx(newDef);\n var paramNames = _.map(getParamIdentifiers(params), function (param) {\n var freshName = fresh();\n return {\n freshName: freshName,\n originalParam: param,\n renamedParam: param.rename(param, freshName)\n };\n });\n // rename the function body for each of the parameters\n var renamedBody = _.reduce(paramNames, function (accBody, p) {\n return accBody.rename(p.originalParam, p.freshName);\n }, bodies);\n renamedBody = renamedBody.expose();\n var expandedResult = expandToTermTree(renamedBody.token.inner, bodyContext);\n var bodyTerms = expandedResult.terms;\n if (expandedResult.restStx) {\n // The expansion was halted prematurely. Just stop and\n // return what we have so far, along with the rest of the syntax\n renamedBody.token.inner = expandedResult.terms.concat(expandedResult.restStx);\n if (Array.isArray(term.body)) {\n term.body = renamedBody.token.inner;\n } else {\n term.body = renamedBody;\n }\n return term;\n }\n var renamedParams = _.map(paramNames, function (p) {\n return p.renamedParam;\n });\n var flatArgs;\n if (paramSingleIdent) {\n flatArgs = renamedParams[0];\n } else {\n flatArgs = syn.makeDelim('()', joinSyntax(renamedParams, ','), term.params || null);\n }\n var expandedArgs = expand([flatArgs], bodyContext);\n assert(expandedArgs.length === 1, 'should only get back one result');\n // stitch up the function with all the renamings\n if (term.params) {\n term.params = expandedArgs[0];\n }\n bodyTerms = _.map(bodyTerms, function (bodyTerm) {\n // add the definition context to the result of\n // expansion (this makes sure that syntax objects\n // introduced by expansion have the def context)\n if (bodyTerm.isBlock) {\n // we need to expand blocks before adding the defctx since\n // blocks defer macro expansion.\n var blockFinal = expandTermTreeToFinal(bodyTerm, expandedResult.context);\n return blockFinal.addDefCtx(newDef);\n } else {\n var termWithCtx = bodyTerm.addDefCtx(newDef);\n // finish expansion\n return expandTermTreeToFinal(termWithCtx, expandedResult.context);\n }\n });\n if (term.isModule) {\n bodyTerms = _.filter(bodyTerms, function (bodyTerm) {\n if (bodyTerm.isExport) {\n term.exports.push(bodyTerm);\n return false;\n } else {\n return true;\n }\n });\n }\n renamedBody.token.inner = bodyTerms;\n if (Array.isArray(term.body)) {\n term.body = renamedBody.token.inner;\n } else {\n term.body = renamedBody;\n }\n // and continue expand the rest\n return term;\n }\n // the term is fine as is\n return term;\n }", "function tokenToAction(token) {\n var word = token.value;\n var definition = context.dictionary.lookup(word);\n\n if (token.isStringLiteral) {\n return namedFunction(\"String: \" + word, function (context) {\n return word;\n });\n }\n // TODO: contributed part on StringPushLiteral s\" (TODO make PR)\n else if (token.isStringPushLiteral) {\n return namedFunction(\"PushString: \" + word, function (context) {\n context.stack.push(word);\n });\n }\n // TODO: contributed part on NeoSyscallLiteral syscall\" (TODO: do not make PR, think on something better...)\n else if (token.isNeoSyscallLiteral) {\n\n if(word == \"Neo.Learn.Call\") { // special syscall \n var execAction = context.stack.pop();\n var definedAction = context.dictionary.lookup(execAction);\n return definedAction; // TODO\n }\n else \n return namedFunction(\"NeoSyscallString: \" + word, function (context) {\n invokeNeoSyscall(word);\n /*\n if(sname == \"Neo.Learn.Execute\") // special syscall \n {\n // invoke tokenizer on read string\n // ????????? TODO\n var str = context.stack.pop();\n next(str);\n }*/\n // TODO: Neo Syscall!!\n\n });\n } \n else if (definition !== null) {\n return definition;\n } else if (isFinite(word)) {\n return namedFunction(\"Number: \" + word, function (context) {\n context.stack.push(+word);\n });\n } else {\n throw new MissingWordError(word);\n }\n\n return function () {\n return \"\";\n };\n }", "function astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}", "apply(obj){\n if( obj.isError() ) return obj\n return new Token(obj.input, obj.start, obj.end, this.inner_apply(obj), JXONMeaner.TAG)\n }", "function backWordFormat(itok,tokArray) {\n\t//alert('backWordFormat '+tokArray[itok][0]);\n\tvar tmp;\n\tswitch(tokArray[itok][0]) {\n\t case 'sqrt': // tok0 tok1\n\t\tmmlString = mmlString + \"<msqrt>\";\n\t\ttokEx(tokArray.slice(1,2));\n\t\tmmlString = mmlString + \"</msqrt>\";\n\t\treturn tokArray.slice(2);\n\t\tbreak;\n\t case 'root': // \\root tok1 \\of tok3, check that \\of is really there\n\t\tmmlString = mmlString + \"<mroot>\";\n\t\ttokEx(tokArray.slice(3,4));\n\t\ttokEx(tokArray.slice(1,2));\n\t\tmmlString = mmlString + \"</mroot>\";\n\t\treturn tokArray.slice(4);\n\t\tbreak;\n\t case 'of': // this should be handled in conjunction with \\root\n\t\treturn;\n\t\tbreak;\n\t case 'underline': // \\underline tok1, this isn't quite right but I can't get the plain underline\n\t\tmmlString = mmlString + \"<munder accent=\\\"true\\\">\";\n\t\ttokEx(tokArray.slice(1,2));\n\t\tmmlString = mmlString + \"<mo stretchy=\\\"true\\\">&#x023b4;</mo></munder>\";\n\t\treturn tokArray.slice(2);\n\t\tbreak;\n\t case 'overline':\n\t\treturn;\n\t\tbreak;\n\t case 'underbrace': // \\underbrace tok1, &UnderBrace; should give &#x0fe38;\n\t\tmmlString = mmlString + \"<munder accent=\\\"true\\\">\";\n\t\ttokEx(tokArray.slice(1,2));\n\t\tmmlString = mmlString + \"<mo>&#x0fe38;</mo></munder>\";\n\t\treturn tokArray.slice(2);\n\t\tbreak;\n\t case 'over': // tok0 tok1 ... tok(n-1) \\over tok(n+1) ... tokN\n\t\tmmlString = mmlString + \"<mfrac>\";\n\t\ttokEx(tokArray.slice(0,itok));\n\t\ttokEx(tokArray.slice(itok+1));\n\t\tmmlString = mmlString + \"</mfrac>\";\n\t\treturn tokArray.slice(tokArray.length + 1);\n\t\tbreak;\n\t case 'frac': // \\frac tok1 tok2\n\t\tmmlString = mmlString + \"<mfrac>\";\n\t\ttokEx(tokArray.slice(0,itok));\n\t\ttokEx(tokArray.slice(itok+1));\n\t\tmmlString = mmlString + \"</mfrac>\";\n\t\treturn tokArray.slice(tokArray.length + 1);\n\t\tbreak;\n\t case 'matrix': // e.g. \\matrix {x11 \\\\amp x12 \\\\amp x13 \\cr x21 \\\\amp x22 \\\\amp x23 \\cr x31 \\\\amp x32 \\\\amp x33 \\cr}\n\t\t// last \\cr is optional\n\t\tmmlString = mmlString + \"<mtable>\";\n\t\t// peel off first and last brace\n\t\tvar tmpString = tokArray[itok+1][0].slice(1,tokArray[itok+1][0].length-1);\n\t\tvar tmpArray = tmpString.split('\\\\cr');\n\t\t// discard last element if empty string, corresponding to trailing \\cr\n\t\tif ( tmpArray[tmpArray.length-1] == \"\" ) tmpArray = tmpArray.slice(0,tmpArray.length-1);\n\t\tfor ( var row = 0; row < tmpArray.length; row++ ) {\n\t\t mmlString = mmlString + \"<mtr>\";\n\t\t var eltArray = tmpArray[row].split('\\\\amp');\n\t\t for ( var elt = 0; elt < eltArray.length; elt++) {\n\t\t\tmmlString = mmlString + \"<mtd>\";\n\t\t\tstringFormat(eltArray[elt]);\n\t\t\tmmlString = mmlString + \"</mtd>\";\n\t\t }\n\t\t mmlString = mmlString + \"</mtr>\";\n\t\t}\n\t\tmmlString = mmlString + \"</mtable>\";\n\t\treturn tokArray.slice(2);\n\t\tbreak;\n\t case 'sum':\n\t\tmmlString = mmlString + \"<mo>&#x02211;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'prod':\n\t\tmmlString = mmlString + \"<mo>&#x0220f;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'int':\n\t\tmmlString = mmlString + \"<mo>&#x0222b;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'prime':\n\t\tmmlString = mmlString + \"<mo>&#x02032;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'aleph':\n\t\tmmlString = mmlString + \"<mi>&#x02135;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'hbar':\n\t\tmmlString = mmlString + \"<mi>&#x0210f;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'imath':\n\t\tmmlString = mmlString + \"<mi>imath</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'jmath':\n\t\tmmlString = mmlString + \"<mi>jmath</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'ell':\n\t\tmmlString = mmlString + \"<mi>&#x02113</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Re':\n\t\tmmlString = mmlString + \"<mo>Re</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Im':\n\t\tmmlString = mmlString + \"<mo>Im</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'partial':\n\t\tmmlString = mmlString + \"<mo>&#x02202;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'infty':\n\t\tmmlString = mmlString + \"<mi>&#x0221e;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'emptyset':\n\t\tmmlString = mmlString + \"<mi>&#x02205;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'nabla':\n\t\tmmlString = mmlString + \"<mo>&#x02207;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'surd':\n\t\tmmlString = mmlString + \"<mo>&#x0221a;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'top':\n\t\tmmlString = mmlString + \"<mo>&#x022a4;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'bot':\n\t\tmmlString = mmlString + \"<mo>&#x022a5;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'angle':\n\t\tmmlString = mmlString + \"<mo>&#x02220;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'triangle':\n\t\tmmlString = mmlString + \"<mo>&#x025b3;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'backslash':\n\t\tmmlString = mmlString + \"<mo>&#x02216;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'forall':\n\t\tmmlString = mmlString + \"<mo>&#x02200;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'exists':\n\t\tmmlString = mmlString + \"<mo>&#x02203;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'neg':\n\t\tmmlString = mmlString + \"<mo>&#x000ac;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'wp':\n\t\tmmlString = mmlString + \"<mi>&#x02118;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'flat':\n\t\tmmlString = mmlString + \"<mo>&#x0266d;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'natural':\n\t\tmmlString = mmlString + \"<mo>&#x0266e;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sharp':\n\t\tmmlString = mmlString + \"<mo>&#x0266f;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'clubsuit':\n\t\tmmlString = mmlString + \"<mi>&#x02663;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'diamondsuit':\n\t\tmmlString = mmlString + \"<mi>&#x02662;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'heartsuit':\n\t\tmmlString = mmlString + \"<mi>&#x02661;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'spadesuit':\n\t\tmmlString = mmlString + \"<mi>&#x02664;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case '':\n\t\tmmlString = mmlString + \"<mi>&#x;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case '':\n\t\tmmlString = mmlString + \"<mi>&#x;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case '':\n\t\tmmlString = mmlString + \"<mi>&#x;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'leq':\n\t\tmmlString = mmlString + \"<mo>&#x02264;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'geq':\n\t\tmmlString = mmlString + \"<mo>&#x02267;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'equiv':\n\t\tmmlString = mmlString + \"<mo>&#x02261;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'prec':\n\t\tmmlString = mmlString + \"<mo>&#x0227a;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'succ':\n\t\tmmlString = mmlString + \"<mo>&#x227b;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sim':\n\t\tmmlString = mmlString + \"<mo>&#x0223c;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'preceq':\n\t\tmmlString = mmlString + \"<mo>&#x0227c;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'succeq':\n\t\tmmlString = mmlString + \"<mo>&#x0227d;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'simeq':\n\t\tmmlString = mmlString + \"<mo>&#x02243;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'll':\n\t\tmmlString = mmlString + \"<mo>&#x0226a;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'gg':\n\t\tmmlString = mmlString + \"<mo>&#x0226b;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'asymp':\n\t\tmmlString = mmlString + \"<mo>&#x0224d;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'subset':\n\t\tmmlString = mmlString + \"<mo>&#x02282;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'supset':\n\t\tmmlString = mmlString + \"<mo>&#x02283;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'approx':\n\t\tmmlString = mmlString + \"<mo>&#x02248;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'subseteq':\n\t\tmmlString = mmlString + \"<mo>&#x02286;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'supseteq':\n\t\tmmlString = mmlString + \"<mo>&#x02287;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'cong':\n\t\tmmlString = mmlString + \"<mo>&#x02245;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sqsubseteq':\n\t\tmmlString = mmlString + \"<mo>&#x02291;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sqsupseteq':\n\t\tmmlString = mmlString + \"<mo>&#x02292;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sqsubset':\n\t\tmmlString = mmlString + \"<mo>&#x0228f;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sqsupset':\n\t\tmmlString = mmlString + \"<mo>&#x02290;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'bowtie':\n\t\tmmlString = mmlString + \"<mo>&#x022c8;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'in':\n\t\tmmlString = mmlString + \"<mo>&#x02208;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'ni':\n\t\tmmlString = mmlString + \"<mo>&#x0220b;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'propto':\n\t\tmmlString = mmlString + \"<mo>&#x0221d;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'vdash':\n\t\tmmlString = mmlString + \"<mo>&#x022a2;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'dashv':\n\t\tmmlString = mmlString + \"<mo>&#x022a3;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'models':\n\t\tmmlString = mmlString + \"<mo>&#x022a8;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'smile':\n\t\tmmlString = mmlString + \"<mo>smile</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'frown':\n\t\tmmlString = mmlString + \"<mo>frown</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'mid':\n\t\tmmlString = mmlString + \"<mo>&#x02758;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'parallel':\n\t\tmmlString = mmlString + \"<mo>&#x02016;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'doteq':\n\t\tmmlString = mmlString + \"<mo>&#x02250;</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'perp':\n\t\tmmlString = mmlString + \"<mo>perp</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case '':\n\t\treturn;\n\t\tbreak;\n\t case 'cos':\n\t\tmmlString = mmlString + \"<mo>cos</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sin':\n\t\tmmlString = mmlString + \"<mo>sin</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'tan':\n\t\tmmlString = mmlString + \"<mo>tan</mo>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'csc':\n\t\treturn ;\n\t\tbreak;\n\t case 'sec':\n\t\treturn ;\n\t\tbreak;\n\t case 'cot':\n\t\treturn ;\n\t\tbreak;\n\t case 'arccos':\n\t\treturn ;\n\t\tbreak;\n\t case 'arcsin':\n\t\treturn ;\n\t\tbreak;\n\t case 'arctan':\n\t\treturn ;\n\t\tbreak;\n\t case 'cosh':\n\t\treturn ;\n\t\tbreak;\n\t case 'sinh':\n\t\treturn ;\n\t\tbreak;\n\t case 'tanh':\n\t\treturn ;\n\t\tbreak;\n\t case 'coth':\n\t\treturn ;\n\t\tbreak;\n\t case 'exp':\n\t\treturn ;\n\t\tbreak;\n\t case 'log':\n\t\treturn ;\n\t\tbreak;\n\t case 'arg':\n\t\treturn ;\n\t\tbreak;\n\t case 'deg':\n\t\treturn ;\n\t\tbreak;\n\t case 'det':\n\t\treturn ;\n\t\tbreak;\n\t case 'dim':\n\t\treturn ;\n\t\tbreak;\n\t case 'gcd':\n\t\treturn ;\n\t\tbreak;\n\t case 'hom':\n\t\treturn ;\n\t\tbreak;\n\t case 'inf':\n\t\treturn ;\n\t\tbreak;\n\t case 'ker':\n\t\treturn ;\n\t\tbreak;\n\t case 'lg':\n\t\treturn ;\n\t\tbreak;\n\t case 'lim':\n\t\treturn ;\n\t\tbreak;\n\t case 'liminf':\n\t\treturn ;\n\t\tbreak;\n\t case 'limsup':\n\t\treturn ;\n\t\tbreak;\n\t case 'ln':\n\t\treturn ;\n\t\tbreak;\n\t case 'max':\n\t\treturn ;\n\t\tbreak;\n\t case 'min':\n\t\treturn ;\n\t\tbreak;\n\t case 'Pr':\n\t\treturn ;\n\t\tbreak;\n\t case 'sup':\n\t\treturn ;\n\t\tbreak;\n// Greek\n\t case 'Alpha':\n\t\tmmlString = mmlString + \"<mi>&#x;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'alpha':\n\t\tmmlString = mmlString + \"<mi>&#x003b1;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Beta':\n\t\treturn ;\n\t\tbreak;\n\t case 'beta':\n\t\tmmlString = mmlString + \"<mi>&#x003b2;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Gamma':\n\t\tmmlString = mmlString + \"<mi>&#x00393;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'gamma':\n\t\tmmlString = mmlString + \"<mi>&#x003b3;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Delta':\n\t\tmmlString = mmlString + \"<mi>&#x00394;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'delta':\n\t\tmmlString = mmlString + \"<mi>&#x003b4;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Epsilon':\n\t\treturn ;\n\t\tbreak;\n\t case 'epsilon':\n\t\tmmlString = mmlString + \"<mi>&#x003b5;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'varepsilon':\n\t\treturn;\n\t\tbreak;\n\t case 'Zeta':\n\t\treturn ;\n\t\tbreak;\n\t case 'zeta':\n\t\tmmlString = mmlString + \"<mi>&#x003b6;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Eta':\n\t\treturn ;\n\t\tbreak;\n\t case 'eta':\n\t\tmmlString = mmlString + \"<mi>&#x003b7;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Theta':\n\t\tmmlString = mmlString + \"<mi>&#x00398;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'theta':\n\t\tmmlString = mmlString + \"<mi>&#x003b8;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'vartheta':\n\t\treturn;\n\t\tbreak;\n\t case 'Iota':\n\t\treturn ;\n\t\tbreak;\n\t case 'iota':\n\t\tmmlString = mmlString + \"<mi>&#x003b9;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Kappa':\n\t\treturn ;\n\t\tbreak;\n\t case 'kappa':\n\t\tmmlString = mmlString + \"<mi>&#x003ba;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Lambda':\n\t\tmmlString = mmlString + \"<mi>&#x0039b;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'lambda':\n\t\tmmlString = mmlString + \"<mi>&#x003bb;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Mu':\n\t\treturn ;\n\t\tbreak;\n\t case 'mu':\n\t\tmmlString = mmlString + \"<mi>&#x003bc;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Nu':\n\t\treturn ;\n\t\tbreak;\n\t case 'nu':\n\t\tmmlString = mmlString + \"<mi>&#x003bd;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Xi':\n\t\tmmlString = mmlString + \"<mi>&#x0039e;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'xi':\n\t\tmmlString = mmlString + \"<mi>&#x003be;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Omicron':\n\t\treturn ;\n\t\tbreak;\n\t case 'omicron':\n\t\treturn ;\n\t\tbreak;\n\t case 'Pi':\n\t\tmmlString = mmlString + \"<mi>&#x003a0;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'pi':\n\t\tmmlString = mmlString + \"<mi>&#x003c0;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Rho':\n\t\treturn ;\n\t\tbreak;\n\t case 'rho':\n\t\tmmlString = mmlString + \"<mi>&#x003c1;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'varrho':\n\t\tmmlString = mmlString + \"<mi>&#x003f1;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Sigma':\n\t\tmmlString = mmlString + \"<mi>&#x003f3;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'sigma':\n\t\tmmlString = mmlString + \"<mi>&#x003c3;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Tau':\n\t\treturn ;\n\t\tbreak;\n\t case 'tau':\n\t\tmmlString = mmlString + \"<mi>&#x003c4;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Upsilon':\n\t\tmmlString = mmlString + \"<mi>&#x003a5;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'upsilon':\n\t\tmmlString = mmlString + \"<mi>&#x003c5;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Phi':\n\t\tmmlString = mmlString + \"<mi>&#x003a6;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'phi':\n\t\tmmlString = mmlString + \"<mi>&#x003c6;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'varphi':\n\t\tmmlString = mmlString + \"<mi>&#x003d5;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Chi':\n\t\treturn ;\n\t\tbreak;\n\t case 'chi':\n\t\tmmlString = mmlString + \"<mi>&#x003c7;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Psi':\n\t\tmmlString = mmlString + \"<mi>&#x003a8;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'psi':\n\t\tmmlString = mmlString + \"<mi>&#x003c8;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'Omega':\n\t\tmmlString = mmlString + \"<mi>&#x003a9;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case 'omega':\n\t\tmmlString = mmlString + \"<mi>&#x003c9;</mi>\";\n\t\treturn tokArray.slice(1);\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t case '':\n\t\treturn ;\n\t\tbreak;\n\t}\n\tmmlString = mmlString + tmp;\n\treturn tokArray.slice(1);\n }", "function church_astify(tokens) {\n\t// astify changes the opening bracket tokens so the end site is the matching closing bracket\n\tfunction astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction traverse(ast, fn, stopfn) {\n\t\tif (!util.is_leaf(ast) && ast.children.length > 0 && (!stopfn || !stopfn(ast))) {\n\t\t\tast = fn(ast);\n\t\t\tfor (var i = 0; i < ast.children.length; i++) {\n\t\t\t\tast.children[i] = traverse(ast.children[i], fn, stopfn);\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction is_special_form(text) {\n\t\treturn [\"define\", \"lambda\", \"case\", \"cond\", \"if\", \"let\"].indexOf(text) != -1;\n\t}\n\n\tfunction assert_not_special_form(node) {\n\t\tif (is_special_form(node.text)) {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", node.start, node.end, \"Special form \" + node.text + \" cannot be used as an atom\");\n\t\t}\n\t}\n\n\tfunction validate_leaves(ast) {\n\t\tfor (var i = 1; i < ast.children.length; i++) {\n\t\t\tassert_not_special_form(ast.children[i]);\n\t\t}\n\t\treturn ast;\n\t}\n\n\t// NOTE: Many of the desugar functions don't add range information.\n\t// For now, it seems unlikely they'll be needed.\n\n\tfunction dsgr_define(ast) {\n\t\tif (ast.children[0].text==\"define\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"Invalid define\");\n\t\t\t}\n\t\t\t// Function define sugar\n\t\t\tif (!util.is_leaf(ast.children[1])) {\n\t\t\t\tvar lambda_args;\n\t\t\t\t// Variadic sugar\n\t\t\t\tif (ast.children[1].children.length == 3 && ast.children[1].children[1].text == \".\") {\n\t\t\t\t\tlambda_args = ast.children[1].children[2];\n\t\t\t\t} else {\n\t\t\t\t\tlambda_args = {children: ast.children[1].children.slice(1)};\n\t\t\t\t}\n\t\t\t\tvar lambda = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\tlambda_args\n\t\t\t\t\t].concat(ast.children.slice(2))\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tchildren: [ast.children[0], ast.children[1].children[0], lambda],\n\t\t\t\t\tstart: ast.start,\n\t\t\t\t\tend: ast.end\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_lambda(ast) {\n\t\tif (ast.children[0].text==\"lambda\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"lambda has no body\");\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_let(ast) {\n\t\tvar let_varieties = [\"let\", \"let*\"];\n\n\t\tif (let_varieties.indexOf(ast.children[0].text)!=-1) {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has no body\");\n\t\t\t}\n\t\t\tvar bindings = ast.children[1];\n\t\t\tvar valid_bindings = true;\n\t\t\tif (util.is_leaf(bindings)) {\n\t\t\t\tvalid_bindings = false;\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < bindings.children.length; i++) {\n\t\t\t\t\tif (util.is_leaf(bindings.children[i]) || bindings.children[i].children.length != 2) {\n\t\t\t\t\t\tvalid_bindings = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!valid_bindings) {\n\t\t\t\tthrow util.make_church_error_range(\"SyntaxError\", bindings.start, bindings.end, ast.children[0].text + \" has invalid bindings\");\n\t\t\t}\n\n\t\t\tswitch (ast.children[0].text) {\n\t\t\t\tcase \"let\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t{children: bindings.children.map(function(x) {return x.children[0]})},\n\t\t\t\t\t\t\t\t\tast.children[2]\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t].concat(bindings.children.map(function(x) {return x.children[1]}))\n\t\t\t\t\t};\n\t\t\t\tcase \"let*\":\n\t\t\t\t\tvar new_ast = {\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t{children: []},\n\t\t\t\t\t\t\t\t\tast.children[2]\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tfor (var i = bindings.children.length-1; i >= 0; i--) {\n\t\t\t\t\t\t// console.log(JSON.stringify(bindings.children[i].children[0],undefined,2))\n\t\t\t\t\t\tnew_ast = {\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t\t{children: [bindings.children[i].children[0]]},\n\t\t\t\t\t\t\t\t\t\tnew_ast\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbindings.children[i].children[1]\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn new_ast;\n\t\t\t}\n\n\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n\tfunction dsgr_quote(ast) {\n\t\tvar last = ast.children[ast.children.length-1];\n\t\tif (last.text==\"'\") {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", last.start, last.end, \"Invalid single quote\");\n\t\t}\n\t\tfor (var i = ast.children.length - 2; i >= 0; i--) {\n\t\t\tif (ast.children[i].text == \"'\") {\n\t\t\t\tast.children.splice(i, 2, {\n\t\t\t\t\tchildren: [{text: \"quote\", start: ast.children[i].start, end: ast.children[i].end}, ast.children[i+1]],\n\t\t\t\t\tstart: ast.children[i].start,\n\t\t\t\t\tend: ast.children[i+1].end\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_case(ast) {\n\t\tfunction case_helper(key, clauses) {\n\t\t\tif (clauses.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tvar clause = clauses[0];\n\t\t\tif (util.is_leaf(clause) || clause.children.length != 2 ||\n\t\t\t\t(util.is_leaf(clause.children[0]) && clause.children[0].text!=\"else\")) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad clause for case\");\n\t\t\t}\n\n\t\t\tif (clause.children[0].text==\"else\") {\n\t\t\t\tif (clauses.length > 1) {\n\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad placement of else clause in case\");\n\t\t\t\t} else {\n\t\t\t\t\treturn clause.children[1];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < clause.children[0]; i++) {\n\t\t\t\t\tvar datum = clause.children[0].children[i];\n\t\t\t\t\tif (util.is_leaf(datum)) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", datum.start, datum.end, \" for case\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar next = case_helper(key, clauses.slice(1));\n\t\t\t\tvar new_ast = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"if\"},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{text: \"member\"},\n\t\t\t\t\t\t\t\tkey,\n {children: [{text: \"list\"}].concat(clause.children[0].children)}\n\t\t\t\t\t\t\t\t// {children: [{text: \"list\"}].concat(clause.children[0])}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclause.children[1]\n\t\t\t\t\t]\n\t\t\t\t};\n\t\t\t\tif (next) {\n\t\t\t\t\tnew_ast.children.push(next);\n\t\t\t\t}\n\t\t\t\treturn new_ast;\n\t\t\t}\n\t\t}\n\n\t\tif (ast.children[0].text==\"case\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"case is missing clauses\");\n\t\t\t}\n\t\t\treturn case_helper(ast.children[1], ast.children.slice(2));\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n\tfunction dsgr_cond(ast) {\n\t\tfunction cond_helper(clauses) {\n\t\t\tif (clauses.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tvar clause = clauses[0];\n\t\t\tif (util.is_leaf(clause) || clause.children.length != 2) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad clause for cond\");\n\t\t\t}\n\t\t\tif (clause.children[0].text==\"else\") {\n\t\t\t\tif (clauses.length > 1) {\n\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad placement of else clause in cond\");\n\t\t\t\t} else {\n\t\t\t\t\treturn clause.children[1];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar next = cond_helper(\n\t\t\t\t\tclauses.slice(1));\n\t\t\t\tvar new_ast = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"if\"},\n\t\t\t\t\t\tclause.children[0],\n\t\t\t\t\t\tclause.children[1]\n\t\t\t\t\t]\n\t\t\t\t};\n\t\t\t\tif (next) {\n\t\t\t\t\tnew_ast.children.push(next);\n\t\t\t\t}\n\t\t\t\treturn new_ast;\n\t\t\t}\n\t\t}\n\n\t\tif (ast.children[0].text==\"cond\") {\n\t\t\tif (ast.children.length < 2) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"cond is missing clauses\");\n\t\t\t}\n\t\t\treturn cond_helper(ast.children.slice(1));\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n function dsgr_eval(ast) {\n if (ast.children[0].text == \"eval\") {\n return {\n\t\t\t\tchildren: [\n\t\t\t\t\t{text: \"eval\"},\n\t\t\t\t\t{\n children: [\n // churchToBareJs: for use in eval only\n {text: \"churchToBareJs\"},\n {\n children: [\n {text: \"formatResult\"},\n ast.children[1]\n ]\n }\n ]\n } \n ]\n }\n\t\t\n\t}\n return ast;\n };\n\n\tfunction dsgr_query(ast) {\n\t\t// Makes the lambda that's passed to the query function\n\t\tfunction query_helper(statements, condition, args) {\n\t\t\tif (util.is_leaf(condition) ||\n (condition.children[0].text != \"condition\" && condition.children[0].text != \"factor\")) {\n\t\t\t\tcondition = {\n\t\t\t\t\tchildren: [{text: \"condition\"}, condition],\n\t\t\t\t\tstart: condition.start,\n\t\t\t\t\tend: condition.end\n\t\t\t\t};\n\t\t\t}\n\t\t\targs = args || {children: []};\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\targs\n\t\t\t\t].concat(statements.slice(0, -1)).concat(condition).concat(statements[statements.length-1])\n\t\t\t};\n\t\t}\n\t\t\n\t\tif ([\"rejection-query\", \"enumeration-query\"].indexOf(ast.children[0].text) != -1) {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has the wrong number of arguments\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\tast.children[0],\n\t\t\t\t\tquery_helper(ast.children.slice(1, -1), ast.children[ast.children.length-1])\n\t\t\t\t],\n\t\t\t\tstart: ast.start,\n\t\t\t\tend: ast.end\n\t\t\t};\n\t\t}\n\t\tif ([\"mh-query\"].indexOf(ast.children[0].text) != -1) {\n\t\t\tif (ast.children.length < 6) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has the wrong number of arguments\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\tast.children[0],\n\t\t\t\t\tquery_helper(ast.children.slice(3, -1), ast.children[ast.children.length-1])\n\t\t\t\t].concat(ast.children.slice(1, 3)),\n\t\t\t\tstart: ast.start,\n\t\t\t\tend: ast.end\n\t\t\t};\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction validate_if(ast) {\n\t\tif (ast.children[0].text==\"if\") {\n\t\t\tif (ast.children.length < 3 || ast.children.length > 4) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"if has the wrong number of arguments\");\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n \n\tfunction transform_equals_condition(ast) {\n\t\tfunction is_equals_conditionable(ast) {\n\t\t\tif (util.is_leaf(ast)) return false;\n\t\t\tvar fn = church_builtins.__annotations__[rename_map[ast.children[0].text]];\n\t\t\treturn fn && fn.erp && ast.children[fn.numArgs[fn.numArgs.length-1]] == undefined;\n\t\t}\n\n\t\tfunction transform_erp(erp, conditioned_value) {\n\t\t\terp.children.push(conditioned_value);\n\t\t}\n\n\t\tfunction try_transform(left, right) {\n\t\t\tif (left == undefined) return false;\n\t\t\tif (is_equals_conditionable(left)) {\n\t\t\t\ttransform_erp(left, right);\n\t\t\t\tstatements.splice(i, 1, left);\n\t\t\t\treturn true;\n\t\t\t} else if (util.is_leaf(left) && define_table[left.text]) {\n\t\t\t\tvar left_entry = define_table[left.text];\n\t\t\t\tif (!util.is_identifier(right.text) || (\n\t\t\t\t\t\tdefine_table[right.text] && left_entry.index > define_table[right.text].index)) {\n\t\t\t\t\ttransform_erp(left_entry.def, right);\n\t\t\t\t\tstatements.splice(i, 1);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tvar transformed;\n\t\tif ([\"rejection-query\", \"enumeration-query\", \"mh-query\"].indexOf(ast.children[0].text) != -1) {\t\t\t\n\t\t\tvar define_table = {};\n\t\t\t// Assumes preprocessing through dsgr_query\n\t\t\tvar statements = ast.children[1].children.slice(2);\n\t\t\tvar i = 0;\n\t\t\t// Iterate through each lambda statement\n\t\t\tfor (var i = 0; i < statements.length; i++) {\n\t\t\t\tif (!util.is_leaf(statements[i])) {\n\t\t\t\t\t// If statement is a define and an ERP without an existing condition, put it in a table\n\t\t\t\t\tif (statements[i].children[0].text == \"define\" && is_equals_conditionable(statements[i].children[2])) {\n\t\t\t\t\t\tdefine_table[statements[i].children[1].text] = {\n\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\tdef: statements[i].children[2]\n\t\t\t\t\t\t};\n\t\t\t\t\t// If statement is a condition, check if it's an equality and attempt to transform\n\t\t\t\t\t} else if (statements[i].children[0].text == \"condition\") {\n\t\t\t\t\t\tvar condition = statements[i].children[1];\n\t\t\t\t\t\tif (!util.is_leaf(condition) && [\"=\", \"equal?\"].indexOf(condition.children[0].text) != -1 && condition.children.length == 3) {\n\t\t\t\t\t\t\tvar left = condition.children[1];\n\t\t\t\t\t\t\tvar right = condition.children[2];\n\t\t\t\t\t\t\tif (!try_transform(left, right)) try_transform(right, left);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn ast;\n\t}\n\n\t// Order is important, particularly desugaring quotes before anything else.\n\tvar desugar_fns = [validate_leaves, dsgr_define, dsgr_lambda, dsgr_let, dsgr_case, dsgr_cond, dsgr_eval, dsgr_query, validate_if, transform_equals_condition];\n\n\tvar ast = astify(tokens);\n\t// Special top-level check\n\tfor (var i = 0; i < ast.children.length; i++) {\n\t\tassert_not_special_form(ast.children[i]);\n\t}\n ast = traverse(ast, dsgr_quote);\n\tfor (var i = 0; i < desugar_fns.length; i++) {\n\t\tast = traverse(ast, desugar_fns[i], isquote);\n\t}\n\n\treturn ast;\n}", "function parse(nextToken){\r\n\t//current token\r\n\tvar type,word; //NOTE: word is only update right after next()ing. don't rely on it laaaaater\r\n\t//stored tokens\r\n\tvar newType,newWord;\r\n\t//keep track of stored tokens\r\n\tvar readNext=1;\r\n\t//false=not, 1=no paren, 2=()\r\n\tvar defType=false,nextDefCommon=false,defs={};\r\n\t\r\n\tvar blocks=[];\r\n\tvar current={};\r\n\tvar currentBlocks=[];\r\n\t\r\n\tfunction startBlock(){\r\n\t\tcurrent.code=[];\r\n\t\tcurrent.line=lineNumber;\r\n\t\tcurrentBlocks.push(current);\r\n\t\tcurrent={};\r\n\t}\r\n\tfunction endBlock(){\r\n\t\tvar block=currentBlocks.pop();\r\n\t\tcurrentBlocks[currentBlocks.length-1].code.push(block);\r\n\t}\r\n\tfunction endDef(){\r\n\t\tvar block=currentBlocks.pop();\r\n\t\tdefs[block.name]=block;\r\n\t}\r\n\t\r\n\tvar ifThisLine=false,codeAfterThen;\r\n\t//var nextFunctionGetsOneMore=0;\r\n\tvar expr=[];\r\n\t\r\n\tcurrent.type=\"main\";\r\n\tstartBlock();\r\n\t\r\n\tdo{\r\n\t\ttry{\r\n\t\t\treadStatement();\r\n\t\t}catch(error){\r\n\t\t\tif(error.name===\"ParseError\"){\r\n\t\t\t\treturn error.message+\" on line \"+lineNumber;\r\n\t\t\t//bad error!!!\r\n\t\t\t}else{\r\n\t\t\t\tthrow error;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t}while(type!==\"eof\");;;\r\n\t\r\n\t//read a \"line\" of code\r\n\tfunction readStatement(){\r\n\t\tnext();\r\n\t\tif(type!=\"comment\" && ifThisLine && type!=\"linebreak\")\r\n\t\t\tcodeAfterThen=true;\r\n\t\tswitch(type){\r\n\t\t\t//keywords with no arguments\r\n\t\t\tcase \"BREAK\":\r\n\t\t\t\tcurrent.type=\"BREAK\";\r\n\t\t\t\tcurrent.levels=readExpression();\r\n\t\t\tbreak;case \"CONTINUE\":\r\n\t\t\t\tcurrent.type=\"CONTINUE\";\r\n\t\t\t\tcurrent.levels=readExpression();\r\n\t\t\tbreak;case \"ELSE\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tif(currentType===\"CASE\"){\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\t\tcurrent.type=\"CASE\";\r\n\t\t\t\t\tstartBlock();\r\n\t\t\t\t}else{\r\n\t\t\t\t\tassert(currentBlock().type===\"IF\"||currentBlock().type===\"ELSEIF\",\"ELSE without IF\");\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\t\tcurrent.type=\"ELSE\";\r\n\t\t\t\t\tstartBlock();\r\n\t\t\t\t}\r\n\t\t\tbreak;case \"ENDSWITCH\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tif(currentType===\"CASE\")\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\telse\r\n\t\t\t\t\tassert(currentType===\"SWITCH\",\"ENDSW without SWITCH\");\r\n\t\t\t\tendBlock();\r\n\t\t\tbreak;case \"ENDIF\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tassert(currentType===\"IF\" || currentType===\"ELSE\" || currentType===\"ELSEIF\",\"ENDIF without IF\");\r\n\t\t\t\tendBlock();\r\n\t\t\t\tifThisLine=false;\r\n\t\t\tbreak;case \"SWITCH\":\r\n\t\t\t\tcurrent.type=\"SWITCH\"\r\n\t\t\t\tassert(current.condition=readExpression(),\"Missing argument to keyword\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"CASE\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tif(currentType===\"CASE\")\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\telse\r\n\t\t\t\t\tassert(currentType===\"SWITCH\",\"invalid CASE\");\r\n\t\t\t\tcurrent.type=\"CASE\"\r\n\t\t\t\tassert(current.conditions=readList(readExpression),\"Missing argument to keyword\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"STOP\":\r\n\t\t\t\tcurrent.type=\"STOP\";\r\n\t\t\tbreak;case \"REPEAT\":\r\n\t\t\t\tcurrent.type=\"REPEAT\";\r\n\t\t\t\tstartBlock();\r\n\t\t\t//SWAP\r\n\t\t\tbreak;case \"SWAP\":\r\n\t\t\t\tcurrent.type=\"SWAP\";\r\n\t\t\t\tassert(current.variable=readVariable(),\"Missing variable in SWAP\");\r\n\t\t\t\tassert(readToken(\",\"),\"Missing comma in SWAP\");\r\n\t\t\t\tassert(current.variable2=readVariable(),\"Missing variable in SWAP\");\r\n\t\t\t//IF, ELSEIF\r\n\t\t\tbreak;case \"ELSEIF\":\r\n\t\t\t\tassert(currentBlock().type==\"IF\"||currentBlock().type==\"ELSEIF\",\"ELSEIF without IF\");\r\n\t\t\t\tendBlock();\r\n\t\t\t\tcurrent.type=\"ELSEIF\"\r\n\t\t\t\tcurrent.condition=readExpression();\r\n\t\t\t\tassert(readToken(\"THEN\"),\"ELSEIF without THEN\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"IF\":\r\n\t\t\t\tcurrent.type=\"IF\"\r\n\t\t\t\tassert(current.condition=readExpression(),\"Missing IF condition\");\r\n\t\t\t\tassert(readToken(\"THEN\"),\"IF without THEN\");\r\n\t\t\t\tstartBlock();\r\n\t\t\t\tifThisLine=true;\r\n\t\t\t\tcodeAfterThen=false;\r\n\t\t\t//FOR\r\n\t\t\tbreak;case \"FOR\":\r\n\t\t\t\tcurrent.type=\"FOR\";\r\n\t\t\t\tassert(current.variable=readVariable(),\"Missing FOR variable\");\r\n\t\t\t\tassert(readToken(\"=\"),\"Missing = in FOR\");\r\n\t\t\t\tcurrent.start=readExpression();\r\n\t\t\t\tassert(readToken(\"word\") && word===\"TO\",\"Missing TO in FOR\");\r\n\t\t\t\tcurrent.end=readExpression();\r\n\t\t\t\tif(readToken(\"word\") && word===\"STEP\")\r\n\t\t\t\t\tcurrent.step=readExpression();\r\n\t\t\t\telse\r\n\t\t\t\t\treadNext=0; //heck\r\n\t\t\t\tstartBlock();\r\n\t\t\t//WHILE <condition>\r\n\t\t\tbreak;case \"WHILE\":\r\n\t\t\t\tcurrent.type=\"WHILE\"\r\n\t\t\t\tassert(current.condition=readExpression(),\"Missing argument to keyword\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"WEND\":\r\n\t\t\t\tassert(currentBlock().type==\"WHILE\",\"WEND without WHILE\");\r\n\t\t\t\tendBlock();\r\n\t\t\t//do/LOOP\r\n\t\t\tbreak;case \"DO\":\r\n\t\t\t\tcurrent.type=\"DO\"\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"LOOP\":\r\n\t\t\t\tassert(currentBlock().type==\"DO\",\"LOOP without DO\");\r\n\t\t\t\tendBlock();\r\n\t\t\t//UNTIL <condition>\r\n\t\t\tbreak;case \"UNTIL\":\r\n\t\t\t\tassert(currentBlock().type==\"REPEAT\",\"UNTIL without REPEAT\");\r\n\t\t\t\tassert(currentBlock().condition=readExpression(),\"Missing UNTIL condition\");\r\n\t\t\t\tendBlock();\r\n\t\t\t//NEXT\r\n\t\t\tbreak;case \"NEXT\":\r\n\t\t\t\tassert(currentBlock().type==\"FOR\",\"NEXT without FOR\");\r\n\t\t\t\treadExpression();\r\n\t\t\t\tendBlock();\r\n\t\t\t//OUT/THEN\r\n\t\t\tbreak;case \"OUT\":case \"THEN\":\r\n\t\t\t\tassert(false,\"Illegal OUT/THEN\");\r\n\t\t\t//other words\r\n\t\t\tbreak;case \"word\":\r\n\t\t\t\t//var name=text;\r\n\t\t\t\treadNext=readNext-1;\r\n\t\t\t\tvar x=readVariable(true);\r\n\t\t\t\tif(readToken(\"=\")){\r\n\t\t\t\t\tcurrent.type=\"assignment\";\r\n\t\t\t\t\tcurrent.variable=x;\r\n\t\t\t\t\tassert(current.value=readExpression(),\"Missing value in assignment\");\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcurrent.type=\"function\";\r\n\t\t\t\t\tcurrent.name=x.name;\r\n\t\t\t\t\tcurrent.inputs=readList(readExpression);\r\n\t\t\t\t\tif(readToken(\"OUT\"))\r\n\t\t\t\t\t\tcurrent.outputs=readList(readVariable);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tcurrent.outputs=[];\r\n\t\t\t\t}\r\n\t\t\t//comment\r\n\t\t\tbreak;case \"comment\":\r\n\t\t\t//colon NOP\r\n\t\t\tbreak;case \":\":\r\n\t\t\t//line break, end\r\n\t\t\tbreak;case \"eof\":\r\n\t\t\tcase \"linebreak\":\r\n\t\t\t\tif(ifThisLine){\r\n\t\t\t\t\tifThisLine=false;\r\n\t\t\t\t\tif(codeAfterThen){\r\n\t\t\t\t\t\tendBlock();\r\n\t\t\t\t\t\tconsole.log(\"ended single line IF\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\tbreak;default:\r\n\t\t\t\tassert(false,\"Expected statement, got \"+type+\" '\"+word+\"'\");\r\n\t\t}\r\n\t\tif(current.type){\r\n\t\t\tcurrent.line=lineNumber;\r\n\t\t\tcurrentBlocks[currentBlocks.length-1].code.push(current)//push to current block!\r\n\t\t\tcurrent={}\r\n\t\t}\r\n\t}\r\n\t\r\n\tfunction currentBlock(){\r\n\t\treturn currentBlocks[currentBlocks.length-1]\r\n\t}\r\n\t\r\n\t//check if next token is of a specific type\r\n\tfunction peekToken(wantedType){\r\n\t\tvar prevType=type,prevWord=word;\r\n\t\tnext();\r\n\t\treadNext=-1;\r\n\t\tnewType=type;\r\n\t\tnewWord=word;\r\n\t\ttype=prevType;\r\n\t\tword=prevWord;\r\n\t\treturn newType===wantedType;\r\n\t}\r\n\t//check if next token is of a specific type\r\n\tfunction peekWord(wantedWord){\r\n\t\tvar prevType=type,prevWord=word;\r\n\t\tnext();\r\n\t\treadNext=-1;\r\n\t\tnewType=type;\r\n\t\tnewWord=word;\r\n\t\ttype=prevType;\r\n\t\tword=prevWord;\r\n\t\treturn newType===\"word\" && newWord.trimLeft().toUpperCase()===wantedWord;\r\n\t}\r\n\t\r\n\t//Try to read a specific token\r\n\tfunction readToken(wantedType){\r\n\t\tnext();\r\n\t\tif(type===wantedType){\r\n\t\t\treadNext=1;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treadNext=0;\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t//Read list\r\n\t//reader: function to read item (readExpression etc.)\r\n\t//noNull: throw an error if a null value is found\r\n\tfunction readList(reader){\r\n\t\tvar ret=[];\r\n\t\tvar x=reader();\r\n\t\tif(x)\r\n\t\t\tret.push(x);\r\n\t\tif(readToken(\",\",\"\")){\r\n\t\t\tassert(x,\"Null value not allowed\");\r\n\t\t\tdo\r\n\t\t\t\tassert(ret.push(reader()),\"Null value not allowed\");\r\n\t\t\twhile(readToken(\",\"));;;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\t\r\n\tfunction readList2(reader){\r\n\t\tvar ret=[];\r\n\t\tvar x=reader();\r\n\t\tif(x)\r\n\t\t\tret.push(x);\r\n\t\tif(readToken(\",\",\"\")&&expr.push({type:\"comma\"})){\r\n\t\t\tassert(x,\"Null value not allowed\");\r\n\t\t\tdo\r\n\t\t\t\tassert(ret.push(reader()),\"Null value not allowed\");\r\n\t\t\twhile(readToken(\",\")&&expr.push({type:\"comma\"}));;;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\t\r\n\t//read normal expression\r\n\t//SHould return RPN list\r\n\tfunction readExpression(){\r\n\t\texpr=[];\r\n\t\t//var rpn=[],stack=[];\r\n\t\t//rpn parse tokens as they are read?\r\n\t\tif(readExpression2())\r\n\t\t\treturn rpnFromExpr(expr);\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tfunction prec(token){\r\n\t\tif(token.type===\"unary\" || token.type===\"comma\")\r\n\t\t\treturn Infinity;\r\n\t\telse\r\n\t\t\tswitch(token.name){\r\n\t\t\t\tcase \"^\":\r\n\t\t\t\t\treturn 11;\r\n\t\t\t\tcase \"*\":case \"/\": case \"\\\\\": case \"%\":\r\n\t\t\t\t\treturn 10;\r\n\t\t\t\tcase \"+\":case \"-\":\r\n\t\t\t\t\treturn 9;\r\n\t\t\t\tcase \"<<\":case \">>\":\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\tcase \"<\":case \"<=\":case \">\":case \">=\":\r\n\t\t\t\t\treturn 7;\r\n\t\t\t\tcase \"==\":case \"!=\":\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\tcase \"&\":\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\tcase \"~\":\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\tcase \"|\":\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\tcase \"AND\":\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\tcase \"OR\":\r\n\t\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\tconsole.log(token);\r\n\t\tassert(false,\"error prec \"+token.name);\r\n\t}\r\n\tfunction left(token){\r\n\t\treturn 0\r\n\t}\r\n\t\r\n\tfunction rpnFromExpr(expr){\r\n\t\tconsole.log({...expr},\"expr\");\r\n\t\tvar rpn=[],stack=[];\r\n\t\tfor(var i=0;i<expr.length;i++){\r\n\t\t\tvar token=expr[i];\r\n\t\t\tswitch(token.type){\r\n\t\t\t\tcase \"number\":case \"string\":case \"variable\":case \"function\":case \"array\": //see, functions are actually pushed AFTER their arguments, so we can just send them directly to the output! :D\r\n\t\t\t\t\trpn.push(token);\r\n\t\t\t\tbreak;case \"operator\":case \"unary\":\r\n\t\t\t\t\twhile(stack.length){\r\n\t\t\t\t\t\tvar top=stack[stack.length-1]\r\n\t\t\t\t\t\t//console.log(top)\r\n\t\t\t\t\t\tif(top.type!=\"(\"&&(prec(top)>=prec(token) || (prec(top)==prec(token) && left(token)))){\r\n\t\t\t\t\t\t\trpn.push(stack.pop());\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstack.push(token);\r\n\t\t\t\tbreak;case \"comma\":\r\n\t\t\t\t\twhile(stack.length){\r\n\t\t\t\t\t\tvar top=stack[stack.length-1]\r\n\t\t\t\t\t\t//console.log(top)\r\n\t\t\t\t\t\tif(top.type!=\"(\"){\r\n\t\t\t\t\t\t\trpn.push(stack.pop());\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\tbreak;case \"(\":\r\n\t\t\t\t\tstack.push(token);\r\n\t\t\t\tbreak;case \")\":\r\n\t\t\t\t\twhile(1){\r\n\t\t\t\t\t\tvar top=stack[stack.length-1]\r\n\t\t\t\t\t\tif(top.type!=\"(\")\r\n\t\t\t\t\t\t\trpn.push(stack.pop());\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstack.pop();\r\n\t\t\t\tbreak;default:\r\n\t\t\t\tassert(false,\"error typ \"+token.type)\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile(stack.length)\r\n\t\t\trpn.push(stack.pop());\r\n\t\treturn rpn;\r\n\t}\r\n\t\r\n\tfunction readExpression2(){\r\n\t\tvar ret=false;\r\n\t\tnext();\r\n\t\tswitch(type){\r\n\t\t\t//function or variable\r\n\t\t\tcase \"word\":\r\n\t\t\t\tvar name=word;\r\n\t\t\t\tif(readToken(\"(\")){\r\n\t\t\t\t\texpr.push({type:\"(\"}); //all we needed!\r\n\t\t\t\t\tvar x=readList2(readExpression2);\r\n\t\t\t\t\tassert(readToken(\")\"),\"Missing \\\")\\\" in function call\");\r\n\t\t\t\t\texpr.push({type:\")\"});\r\n\t\t\t\t\texpr.push({type:\"function\",name:name,args:x.length});\r\n\t\t\t\t}else\r\n\t\t\t\t\texpr.push({type:\"variable\",name:name});\r\n\t\t\t//number literals\r\n\t\t\tbreak;case \"number\":\r\n\t\t\t\texpr.push({type:\"number\",value:word});\r\n\t\t\t//string/label\r\n\t\t\tbreak;case \"string\":\r\n\t\t\t\texpr.push({type:\"string\",value:word});\r\n\t\t\t//operator (unary)\r\n\t\t\tbreak;case \"unary\":case \"minus\":case \"xor\":\r\n\t\t\t\t//unary op\r\n\t\t\t\texpr.push({type:\"unary\",name:word,args:1});\r\n\t\t\t\t//expr.push({type:\"(\"}); //actual fear\r\n\t\t\t\tassert(readExpression2(),\"Missing operator argument\");\r\n\t\t\t\t//expr.push({type:\")\"});\r\n\t\t\t\t\r\n\t\t\t//open parenthesis\r\n\t\t\tbreak;case \"(\":\r\n\t\t\t\texpr.push({type:\"(\"});\r\n\t\t\t\treadExpression2();\r\n\t\t\t\tassert(readToken(\")\"),\"Missing \\\")\\\"\");\r\n\t\t\t\texpr.push({type:\")\"});\r\n\t\t\tbreak;case \"[\":\r\n\t\t\t\texpr.push({type:\"(\"});\r\n\t\t\t\tvar x=readList2(readExpression2);\r\n\t\t\t\texpr.push({type:\"array\",args:x.length});\r\n\t\t\t\tassert(readToken(\"]\"),\"Missing \\\"]\\\"\");\r\n\t\t\t\texpr.push({type:\")\"});\r\n\t\t\t\t\r\n\t\t\t//other crap\r\n\t\t\tbreak;default:\r\n\t\t\t\treadNext=0;\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\twhile(readToken(\"dot\")){\r\n\t\t\tassert(readToken(\"word\"),\"Dot missing function\");\r\n\t\t\tvar name=word;\r\n\t\t\tassert(readToken(\"(\"),\"Dot missing function\");\r\n\t\t\texpr.push({type:\"(\"}); //all we needed!\r\n\t\t\tvar x=readList2(readExpression2);\r\n\t\t\tassert(readToken(\")\"),\"Missing \\\")\\\" in function call\");\r\n\t\t\texpr.push({type:\")\"});\r\n\t\t\texpr.push({type:\"function\",name:name,args:x.length+1});\r\n\t\t}\r\n\t\t//read infix operators\r\n\t\t//this might have to be WHILE not IF\r\n\t\tif(readToken(\"operator\")||readToken(\"minus\")||readToken(\"xor\")){\r\n\t\t\texpr.push({type:\"operator\",name:word,args:2});\r\n\t\t\tassert(readExpression2(),\"Operator missing second argument\");\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//read function definition argument\r\n\tfunction readArgument(){\r\n\t\tif(readToken(\"word\"))\r\n\t\t\treturn word;\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}\r\n\t\r\n\t//read variable declaration\r\n\tfunction readDeclaration(){\r\n\t\tvar ret={};\r\n\t\tif(readToken(\"word\")){\r\n\t\t\tret.name=word;\r\n\t\t\tif(readToken(\"=\"))\r\n\t\t\t\tret.value=readExpression();\r\n\t\t\treturn ret;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t//keys:\r\n\t//name: [variable name expr token list]\r\n\t//indexes: [index list]\r\n\tfunction readVariable(){\r\n\t\tvar ret={name:\"\"};\r\n\t\tnext();\r\n\t\treturn {name:word}\r\n\t\tswitch(type){\r\n\t\t\tcase \"word\":\r\n\t\t\t\tret.name=word;\r\n\t\t\tbreak;default:\r\n\t\t\t\treadNext=0;\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\t\r\n\t//throw error with message if condition is false\r\n\tfunction assert(condition,message){\r\n\t\tif(!condition){\r\n\t\t\t//message//+=\" on line \"+lineNumber;\r\n\t\t\tconsole.log(message);\r\n\t\t\tvar error=new Error(message);\r\n\t\t\terror.name=\"ParseError\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\t\r\n\t//I forgot how this works...\r\n\tfunction next(){\r\n\t\tif(readNext===1){\r\n\t\t\tvar items=nextToken();\r\n\t\t\ttype=items.type;\r\n\t\t\tword=items.word;\r\n\t\t}else if(readNext===-1){\r\n\t\t\ttype=newType;\r\n\t\t\tword=newWord;\r\n\t\t\treadNext=1;\r\n\t\t//I don't think this ever happens?\r\n\t\t}else if(readNext===-2)\r\n\t\t\treadNext=-1;\r\n\t\telse\r\n\t\t\treadNext=1;\r\n\t}\r\n\t\r\n\t//handle single line IF blocks at the end of the program (temporary fix)\r\n\tif(ifThisLine){\r\n\t\tifThisLine=false;\r\n\t\tif(codeAfterThen){\r\n\t\t\tendBlock();\r\n\t\t\tconsole.log(\"ended single line IF\");\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(currentBlocks.length>=2)\r\n\t\treturn \"Unclosed \"+currentBlocks[1].type;\r\n\t//currentBlocks[1]=defs;\r\n\treturn currentBlocks;\r\n}", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function tokenTransform(token, f) {\r\n\t\tvar noteRE = /[a-gA-G][0-9]?[',]*/;\r\n\t\tif (token.type === 'alpha') {\r\n\t\t\tvar toProcess = token.token;\r\n\t\t\tvar note = '';\r\n\t\t\twhile (toProcess) {\r\n\t\t\t\tvar next = toProcess.match(noteRE);\r\n\t\t\t\tif (next) {\r\n\t\t\t\t\tnote += f(next[0]);\r\n\t\t\t\t\ttoProcess = toProcess.substring(next[0].length);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnote += toProcess;\r\n\t\t\t\t\ttoProcess = null;\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn Object.assign({}, token, {token: note});\r\n\t\t} else {\r\n\t\t\treturn token;\t\r\n\t\t}\r\n\t}", "mean(t) {\n if(t.isError()) return t\n var a = t.value\n var symbols = {}\n this.symbols(a[1],symbols)\n var tokenizer=null\n var parser = null\n var rules = []\n var exp = this.operators(a[1])\n for(var i=0; i<exp.length; i++) {\n var e = exp[i]\n var type = e[0]\n var p = e[2]\n var pf = {}\n var opers = []\n var opers_type = []\n for(var op in p) {\n //if(symbols[op] === undefined) {\n var key = ParserGenerator.escape_all(op)\n symbols[op] = p[op]\n opers.push(key)\n opers_type.push(GeneratorConstants.CHAR)\n pf[key] = p[op]\n //}\n }\n rules.push(new DisjointRule(type+GeneratorConstants.OPER, opers_type, opers))\n var ftype = e[3]\n var fvalue = e[4]\n rules.push(new ExpressionRule(type, ftype, fvalue, type+GeneratorConstants.OPER, pf))\n }\n var obj = null\n var sb = ''\n var c = ''\n for(var word in symbols) {\n sb += c + word\n c='|'\n }\n if(sb.length>0) {\n sb = '{'+sb+'}'\n obj = new GeneratorLexeme(GeneratorConstants.CHAR, sb,true)\n }\n tokenizer = this.tokenizer(a[0], obj)\n \n this.exprule(a[1], rules, \"\")\n parser = new GenericParser(tokenizer,rules,rules[0].type)\n return new Token(t.input, t.start, t.end, t.type, parser)\n }", "parseTerm() {\n const assertion = this.maybeParseAssertion();\n if (assertion) {\n return assertion;\n }\n return {\n type: 'Term',\n capturingParenthesesBefore: this.capturingGroups.length,\n Atom: this.parseAtom(),\n Quantifier: this.maybeParseQuantifier(),\n };\n }", "tokenizer(token , isEndOfInput , previousTokens , terminal , config){\n }", "function flatten(stx) {\n return _.reduce(stx, function (acc, stx$2) {\n if (stx$2.token.type === parser.Token.Delimiter) {\n var exposed = stx$2.expose();\n var openParen = syntaxFromToken({\n type: parser.Token.Punctuator,\n value: stx$2.token.value[0],\n range: stx$2.token.startRange,\n sm_range: typeof stx$2.token.sm_startRange == 'undefined' ? stx$2.token.startRange : stx$2.token.sm_startRange,\n lineNumber: stx$2.token.startLineNumber,\n sm_lineNumber: typeof stx$2.token.sm_startLineNumber == 'undefined' ? stx$2.token.startLineNumber : stx$2.token.sm_startLineNumber,\n lineStart: stx$2.token.startLineStart,\n sm_lineStart: typeof stx$2.token.sm_startLineStart == 'undefined' ? stx$2.token.startLineStart : stx$2.token.sm_startLineStart\n }, exposed);\n var closeParen = syntaxFromToken({\n type: parser.Token.Punctuator,\n value: stx$2.token.value[1],\n range: stx$2.token.endRange,\n sm_range: typeof stx$2.token.sm_endRange == 'undefined' ? stx$2.token.endRange : stx$2.token.sm_endRange,\n lineNumber: stx$2.token.endLineNumber,\n sm_lineNumber: typeof stx$2.token.sm_endLineNumber == 'undefined' ? stx$2.token.endLineNumber : stx$2.token.sm_endLineNumber,\n lineStart: stx$2.token.endLineStart,\n sm_lineStart: typeof stx$2.token.sm_endLineStart == 'undefined' ? stx$2.token.endLineStart : stx$2.token.sm_endLineStart\n }, exposed);\n if (stx$2.token.leadingComments) {\n openParen.token.leadingComments = stx$2.token.leadingComments;\n }\n if (stx$2.token.trailingComments) {\n openParen.token.trailingComments = stx$2.token.trailingComments;\n }\n acc.push(openParen);\n push.apply(acc, flatten(exposed.token.inner));\n acc.push(closeParen);\n return acc;\n }\n stx$2.token.sm_lineNumber = stx$2.token.sm_lineNumber ? stx$2.token.sm_lineNumber : stx$2.token.lineNumber;\n stx$2.token.sm_lineStart = stx$2.token.sm_lineStart ? stx$2.token.sm_lineStart : stx$2.token.lineStart;\n stx$2.token.sm_range = stx$2.token.sm_range ? stx$2.token.sm_range : stx$2.token.range;\n acc.push(stx$2);\n return acc;\n }, []);\n }", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\t\n\t if (typeof token === 'string') {\n\t path += token\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name]\n\t var segment\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\t\n\t if (typeof token === 'string') {\n\t path += token\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name]\n\t var segment\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\t\n\t if (typeof token === 'string') {\n\t path += token\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name]\n\t var segment\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (index$1(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path\n\t }\n\t}", "function tokensToFunction(tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\t\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (_typeof(tokens[i]) === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\t\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\t\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\t\n\t if (typeof token === 'string') {\n\t path += token;\n\t\n\t continue;\n\t }\n\t\n\t var value = data[token.name];\n\t var segment;\n\t\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\t\n\t continue;\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined');\n\t }\n\t }\n\t\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`');\n\t }\n\t\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue;\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty');\n\t }\n\t }\n\t\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`');\n\t }\n\t\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\t\n\t continue;\n\t }\n\t\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\t\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"');\n\t }\n\t\n\t path += token.prefix + segment;\n\t }\n\t\n\t return path;\n\t };\n\t}", "function tokensToFunction(tokens, options) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length)\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))\n }\n }\n\n return function (obj, opts) {\n var path = ''\n var data = obj || {}\n var options = opts || {}\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i]\n\n if (typeof token === 'string') {\n path += token\n\n continue\n }\n\n var value = data[token.name]\n var segment\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j])\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment\n }\n\n return path\n }\n }", "function getParseTokens(){\n\treturn {\n\t\t'union' : \"+\",\n\t\t'intersection' : \"^^\"\n\t};\n}", "function tokenBase(stream, state) {\n var ch = stream.next();\n if (hooks[ch]) {\n var result = hooks[ch](stream, state);\n if (result !== false) return result;\n }\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n }\n if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n curPunc = ch;\n return null;\n }\n // Asigna la clase de los números\n if (/\\d/.test(ch)) {\n stream.eatWhile(/[\\w\\.]/);\n return \"number\";\n }\n if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n }\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return \"comment\";\n }\n }\n if (isOperatorChar.test(ch)) {\n stream.eatWhile(isOperatorChar);\n return \"operator\";\n }\n stream.eatWhile(/[\\w\\$_]/);\n var cur = stream.current();\n\n // Esto esta agregado por mi para diferenciar de clase los keywords de bloque\n // porque antes no los diferenciaba\n\n if (blockKeywords.propertyIsEnumerable(cur)) {\n return \"blockKeyword\";\n };\n\n\n if (constantKeywords.propertyIsEnumerable(cur)) {\n return \"constantKeyword\";\n }\n\n\n if (outerBlockKeywords.propertyIsEnumerable(cur)) {\n return \"outerBlockKeyword\";\n };\n\n if (keywords.propertyIsEnumerable(cur)) {\n if (blockKeywords.propertyIsEnumerable(cur)) curPunc = \"newstatement\";\n // Esta la clase que asigna\n return \"keyword\";\n }\n if (builtin.propertyIsEnumerable(cur)) {\n if (blockKeywords.propertyIsEnumerable(cur)) curPunc = \"newstatement\";\n return \"builtin\";\n }\n if (atoms.propertyIsEnumerable(cur)) {\n return \"atom\";\n }\n\n\n\n // Si no es nada de todo lo anterior devuelve \"variable\"\n // lo cual me parece que esta como el culo pero por ahora sirve\n //return \"variable\";\n }", "treefy(tokenArray) {\n // Parent tree\n let tree = new Node();\n\n let index = 0;\n let depth = 0;\n let subarray = [];\n\n while (index < tokenArray.length) {\n\n let token = tokenArray[index++];\n\n if (token.type == Token.SPACE || token.type == Token.COMMENT)\n continue;\n\n // Open\n if (token.type == Token.OPEN) {\n\n depth++;\n\n if (depth == 1) {\n subarray = [];\n continue;\n }\n }\n\n // Close\n else if (token.type == Token.CLOSE) {\n\n depth--;\n\n // Depth cannot be smaller than 0\n if (depth < 0)\n return new Error(Error.SYNTAX, \"Surplus ')' exists\", token.lineNumber);\n\n if (depth == 0) {\n\n // Create sub-tree\n let subtree = this.treefy(subarray);\n\n // If error, just pass beyond (no stack push)\n if (subtree instanceof Error)\n return subtree;\n\n tree.addChild(subtree);\n continue;\n }\n }\n\n // Direct (siblings) token\n if (depth == 0) {\n tree.addChild(new Node(token));\n }\n\n // Subarray (children) token\n else if (depth > 0) {\n subarray.push(token);\n }\n }\n\n // Depth must be 0 at the termination point\n if (depth > 0)\n return new Error(Error.SYNTAX, \"'(' not closed\", tokenArray[tokenArray.length - 1].lineNumber);\n\n return tree;\n }", "function flattenMatches(results) {\n if (results.matchedString !== undefined) return results.matchedString;\n if (results.results) return flattenMatches(results.results);\n if (results.length === 1) return flattenMatches(results[0]);\n if (results.length === 0) return null;\n return results.map(flattenMatches);\n} // This is the base parser class. Given an arbitrary context-free grammar, it", "factor() {\n let startToken = this.currentToken;\n\n try {\n let tok = this.currentToken;\n let rhs = undefined;\n let result = undefined;\n\n switch (this.currentToken.type) {\n case Lexer.TokenTypes.INTEGER_CONST:\n this.eat(Lexer.TokenTypes.INTEGER_CONST);\n return new AST.IntegerNode(tok.val, tok);\n\n case Lexer.TokenTypes.REAL_CONST:\n this.eat(Lexer.TokenTypes.REAL_CONST);\n return new AST.RealNode(tok.val, tok);\n\n case Lexer.TokenTypes.BOOLEAN_CONST:\n this.eat(Lexer.TokenTypes.BOOLEAN_CONST);\n return new AST.BooleanNode(tok.val, tok);\n\n case Lexer.TokenTypes.NOT:\n this.eat(Lexer.TokenTypes.NOT);\n rhs = this.factor();\n return new AST.UnaryOpNode(tok, rhs);\n\n case Lexer.TokenTypes.LPAREN:\n this.eat(Lexer.TokenTypes.LPAREN);\n result = this.boolean_expr();\n this.eat(Lexer.TokenTypes.RPAREN);\n return result;\n\n case Lexer.TokenTypes.PLUS:\n this.eat(Lexer.TokenTypes.PLUS);\n rhs = this.factor();\n return new AST.UnaryOpNode(tok, rhs);\n\n case Lexer.TokenTypes.MINUS:\n this.eat(Lexer.TokenTypes.MINUS);\n rhs = this.factor();\n return new AST.UnaryOpNode(tok, rhs);\n\n case Lexer.TokenTypes.ID:\n this.eat(Lexer.TokenTypes.ID);\n if (this.currentToken.type === Lexer.TokenTypes.LPAREN) {\n return this.function_call(tok);\n } else {\n return this.variable(tok);\n }\n\n default:\n throw new ParserException('Invalid token for FACTOR', tok, e);\n }\n } catch(e) {\n throw new ParserException('Error processing FACTOR', startToken, e);\n }\n }", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length)\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = ''\n\t var data = obj || {}\n\t var options = opts || {}\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i]\n\n\t if (typeof token === 'string') {\n\t path += token\n\n\t continue\n\t }\n\n\t var value = data[token.name]\n\t var segment\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j])\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value)\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction(tokens){// Compile all the tokens into regexps.\nvar matches=new Array(tokens.length);// Compile all the patterns before compilation.\nfor(var i=0;i<tokens.length;i++){if(_typeof(tokens[i])==='object'){matches[i]=new RegExp('^(?:'+tokens[i].pattern+')$');}}return function(obj,opts){var path='';var data=obj||{};var options=opts||{};var encode=options.pretty?encodeURIComponentPretty:encodeURIComponent;for(var i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token==='string'){path+=token;continue;}var value=data[token.name];var segment;if(value==null){if(token.optional){// Prepend partial segment prefixes.\nif(token.partial){path+=token.prefix;}continue;}else{throw new TypeError('Expected \"'+token.name+'\" to be defined');}}if(isarray(value)){if(!token.repeat){throw new TypeError('Expected \"'+token.name+'\" to not repeat, but received `'+JSON.stringify(value)+'`');}if(value.length===0){if(token.optional){continue;}else{throw new TypeError('Expected \"'+token.name+'\" to not be empty');}}for(var j=0;j<value.length;j++){segment=encode(value[j]);if(!matches[i].test(segment)){throw new TypeError('Expected all \"'+token.name+'\" to match \"'+token.pattern+'\", but received `'+JSON.stringify(segment)+'`');}path+=(j===0?token.prefix:token.delimiter)+segment;}continue;}segment=token.asterisk?encodeAsterisk(value):encode(value);if(!matches[i].test(segment)){throw new TypeError('Expected \"'+token.name+'\" to match \"'+token.pattern+'\", but received \"'+segment+'\"');}path+=token.prefix+segment;}return path;};}", "function tokensToFunction(tokens){// Compile all the tokens into regexps.\nvar matches=new Array(tokens.length);// Compile all the patterns before compilation.\nfor(var i=0;i<tokens.length;i++){if(_typeof(tokens[i])==='object'){matches[i]=new RegExp('^(?:'+tokens[i].pattern+')$');}}return function(obj,opts){var path='';var data=obj||{};var options=opts||{};var encode=options.pretty?encodeURIComponentPretty:encodeURIComponent;for(var i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token==='string'){path+=token;continue;}var value=data[token.name];var segment;if(value==null){if(token.optional){// Prepend partial segment prefixes.\nif(token.partial){path+=token.prefix;}continue;}else{throw new TypeError('Expected \"'+token.name+'\" to be defined');}}if(isarray(value)){if(!token.repeat){throw new TypeError('Expected \"'+token.name+'\" to not repeat, but received `'+JSON.stringify(value)+'`');}if(value.length===0){if(token.optional){continue;}else{throw new TypeError('Expected \"'+token.name+'\" to not be empty');}}for(var j=0;j<value.length;j++){segment=encode(value[j]);if(!matches[i].test(segment)){throw new TypeError('Expected all \"'+token.name+'\" to match \"'+token.pattern+'\", but received `'+JSON.stringify(segment)+'`');}path+=(j===0?token.prefix:token.delimiter)+segment;}continue;}segment=token.asterisk?encodeAsterisk(value):encode(value);if(!matches[i].test(segment)){throw new TypeError('Expected \"'+token.name+'\" to match \"'+token.pattern+'\", but received \"'+segment+'\"');}path+=token.prefix+segment;}return path;};}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\n\t if (typeof token === 'string') {\n\t path += token;\n\n\t continue\n\t }\n\n\t var value = data[token.name];\n\t var segment;\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment;\n\t }\n\n\t return path\n\t }\n\t}", "function tokensToFunction (tokens) {\n\t // Compile all the tokens into regexps.\n\t var matches = new Array(tokens.length);\n\n\t // Compile all the patterns before compilation.\n\t for (var i = 0; i < tokens.length; i++) {\n\t if (typeof tokens[i] === 'object') {\n\t matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n\t }\n\t }\n\n\t return function (obj, opts) {\n\t var path = '';\n\t var data = obj || {};\n\t var options = opts || {};\n\t var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n\t for (var i = 0; i < tokens.length; i++) {\n\t var token = tokens[i];\n\n\t if (typeof token === 'string') {\n\t path += token;\n\n\t continue\n\t }\n\n\t var value = data[token.name];\n\t var segment;\n\n\t if (value == null) {\n\t if (token.optional) {\n\t // Prepend partial segment prefixes.\n\t if (token.partial) {\n\t path += token.prefix;\n\t }\n\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to be defined')\n\t }\n\t }\n\n\t if (isarray(value)) {\n\t if (!token.repeat) {\n\t throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n\t }\n\n\t if (value.length === 0) {\n\t if (token.optional) {\n\t continue\n\t } else {\n\t throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n\t }\n\t }\n\n\t for (var j = 0; j < value.length; j++) {\n\t segment = encode(value[j]);\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n\t }\n\n\t path += (j === 0 ? token.prefix : token.delimiter) + segment;\n\t }\n\n\t continue\n\t }\n\n\t segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n\t if (!matches[i].test(segment)) {\n\t throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n\t }\n\n\t path += token.prefix + segment;\n\t }\n\n\t return path\n\t }\n\t}", "function parseTokens (tokens) {\n var firstDefined = _.compose (_.head, _.dropWhile (_.compose (_.equals (undefined), _.prop ('Parsed'))));\n var parsed = firstDefined ([undefined]);\n if (parsed == undefined) {\n undefined;\n }\n return _.concat ([parsed.Parsed], parseTokens (undefined));\n}", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function parseTerm() {\n var left = parseFactor();\n var op = tokens[position];\n while (op === '*' || op === '/') {\n ++position;\n var right = parseFactor();\n left = new BinaryOperation(left, op, right);\n op = tokens[position];\n }\n return left;\n }", "function tokensToFunction(tokens){// Compile all the tokens into regexps.\nvar matches=new Array(tokens.length);// Compile all the patterns before compilation.\nfor(var i=0;i<tokens.length;i++){if(_typeof2(tokens[i])==='object'){matches[i]=new RegExp('^(?:'+tokens[i].pattern+')$');}}return function(obj,opts){var path='';var data=obj||{};var options=opts||{};var encode=options.pretty?encodeURIComponentPretty:encodeURIComponent;for(var i=0;i<tokens.length;i++){var token=tokens[i];if(typeof token==='string'){path+=token;continue;}var value=data[token.name];var segment;if(value==null){if(token.optional){// Prepend partial segment prefixes.\nif(token.partial){path+=token.prefix;}continue;}else{throw new TypeError('Expected \"'+token.name+'\" to be defined');}}if(isarray(value)){if(!token.repeat){throw new TypeError('Expected \"'+token.name+'\" to not repeat, but received `'+JSON.stringify(value)+'`');}if(value.length===0){if(token.optional){continue;}else{throw new TypeError('Expected \"'+token.name+'\" to not be empty');}}for(var j=0;j<value.length;j++){segment=encode(value[j]);if(!matches[i].test(segment)){throw new TypeError('Expected all \"'+token.name+'\" to match \"'+token.pattern+'\", but received `'+JSON.stringify(segment)+'`');}path+=(j===0?token.prefix:token.delimiter)+segment;}continue;}segment=token.asterisk?encodeAsterisk(value):encode(value);if(!matches[i].test(segment)){throw new TypeError('Expected \"'+token.name+'\" to match \"'+token.pattern+'\", but received \"'+segment+'\"');}path+=token.prefix+segment;}return path;};}", "function newer_postprocessor(\n parse_tree,\n with_morphology,\n with_spaces,\n with_terminators,\n with_trimming,\n with_selmaho,\n with_nodes_labels,\n without_leaf_prefix,\n with_glossing\n) {\n if (!is_array(parse_tree)) return null;\n /* Building a map of node names to node value replacements */\n if (with_spaces)\n var value_substitution_map = {\"spaces\": \"_\", \"initial_spaces\": \"_\"};\n else var value_substitution_map = {};\n /* Building a map of node names to name replacements */\n var name_substitution_map = {\n \"cmene\": \"C\", \"cmevla\": \"C\", \"gismu\": \"G\", \"lujvo\": \"L\",\n \"fuhivla\": \"Z\", \"prenex\": \"PRENEX\", \"sentence\": \"BRIDI\",\n \"selbri\": \"SELBRI\", \"sumti\": \"SUMTI\"\n };\n if (!with_trimming) name_substitution_map = {};\n var special_selmaho = [\"cmevla\", \"gismu\", \"lujvo\", \"fuhivla\", \"ga_clause\",\n \"gu_clause\"];\n /** Building a node_action_for() function from the selected options **/\n if (with_morphology)\n var is_flattening_target = function (tree) { return false; };\n else var is_flattening_target = function (tree) {\n var targets = special_selmaho;\n return (among(tree[0], targets) || is_selmaho(tree[0]));\n };\n var is_branch_removal_target = function (tree) {\n if (!with_spaces && among(tree[0], [\"spaces\", \"initial_spaces\"]))\n return true;\n return (!with_terminators && is_selmaho(tree[0]) && tree.length == 1);\n };\n var whitelist = [];\n if (with_selmaho)\n whitelist = whitelist.concat(special_selmaho);\n if (with_nodes_labels)\n whitelist = whitelist.concat([\"prenex\", \"sentence\", \"selbri\", \"sumti\"]);\n var is_node_trimming_target = function (tree) {\n if (!with_trimming) return false;\n if (with_terminators && is_selmaho(tree[0]) && tree.length == 1)\n return false;\n if (with_selmaho && is_selmaho(tree[0])) return false;\n return !among(tree[0], whitelist);\n };\n var node_action_for = function (node) {\n if (is_branch_removal_target(node)) return 'DEL';\n var ft = is_flattening_target(node);\n var tt = is_node_trimming_target(node);\n if (ft && tt) return \"TRIMFLAT\";\n if (ft) return 'FLAT';\n if (tt) return 'TRIM';\n if (with_trimming && node.length == 1) return 'UNBOX';\n return 'PASS';\n };\n /* Calling process_parse_tree() with the arguments we've built for it */\n return process_parse_tree(\n parse_tree, value_substitution_map, name_substitution_map,\n node_action_for,\n (with_nodes_labels || with_selmaho) && !without_leaf_prefix,\n with_glossing\n );\n}", "function tokensToFunction(tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (typeof token === 'string') {\n path += token;\n continue;\n }\n var value = data[token.name];\n var segment;\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n continue;\n }\n else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined');\n }\n }\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`');\n }\n if (value.length === 0) {\n if (token.optional) {\n continue;\n }\n else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty');\n }\n }\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`');\n }\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n continue;\n }\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"');\n }\n path += token.prefix + segment;\n }\n return path;\n };\n}", "function nestTokens(tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, len = tokens.length; i < len; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}", "function tokensToFunction (tokens) {\n // Compile all the tokens into regexps.\n var matches = new Array(tokens.length);\n\n // Compile all the patterns before compilation.\n for (var i = 0; i < tokens.length; i++) {\n if (typeof tokens[i] === 'object') {\n matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');\n }\n }\n\n return function (obj, opts) {\n var path = '';\n var data = obj || {};\n var options = opts || {};\n var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;\n\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (typeof token === 'string') {\n path += token;\n\n continue\n }\n\n var value = data[token.name];\n var segment;\n\n if (value == null) {\n if (token.optional) {\n // Prepend partial segment prefixes.\n if (token.partial) {\n path += token.prefix;\n }\n\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to be defined')\n }\n }\n\n if (isarray(value)) {\n if (!token.repeat) {\n throw new TypeError('Expected \"' + token.name + '\" to not repeat, but received `' + JSON.stringify(value) + '`')\n }\n\n if (value.length === 0) {\n if (token.optional) {\n continue\n } else {\n throw new TypeError('Expected \"' + token.name + '\" to not be empty')\n }\n }\n\n for (var j = 0; j < value.length; j++) {\n segment = encode(value[j]);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected all \"' + token.name + '\" to match \"' + token.pattern + '\", but received `' + JSON.stringify(segment) + '`')\n }\n\n path += (j === 0 ? token.prefix : token.delimiter) + segment;\n }\n\n continue\n }\n\n segment = token.asterisk ? encodeAsterisk(value) : encode(value);\n\n if (!matches[i].test(segment)) {\n throw new TypeError('Expected \"' + token.name + '\" to match \"' + token.pattern + '\", but received \"' + segment + '\"')\n }\n\n path += token.prefix + segment;\n }\n\n return path\n }\n}" ]
[ "0.6682996", "0.6266196", "0.59369326", "0.5789823", "0.55184007", "0.5444358", "0.5374127", "0.53472996", "0.530861", "0.52536815", "0.52536815", "0.52536815", "0.52536815", "0.516102", "0.51416516", "0.5139411", "0.5071999", "0.506615", "0.5062205", "0.5062205", "0.5062205", "0.5053398", "0.5051896", "0.5051896", "0.5051896", "0.5051896", "0.50429463", "0.50369126", "0.50235295", "0.50180554", "0.49993464", "0.49939892", "0.49733496", "0.49283528", "0.49283528", "0.49283528", "0.49283528", "0.49283528", "0.49283528", "0.49283528", "0.49283528", "0.49206024", "0.49206024", "0.4920545", "0.4920545", "0.49158567", "0.49070713", "0.49070713", "0.49037564", "0.4899223", "0.48969668", "0.48906803", "0.48678106", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126", "0.48524126" ]
0.70109814
0
mark each syntax object in the pattern environment, mutating the environment
function applyMarkToPatternEnv(newMark, env) { /* Takes a `match` object: { level: <num>, match: [<match> or <syntax>] } where the match property is an array of syntax objects at the bottom (0) level. Does a depth-first search and applys the mark to each syntax object. */ function dfs(match) { if (match.level === 0) { // replace the match property with the marked syntax match.match = _.map(match.match, function (stx) { return stx.mark(newMark); }); } else { _.each(match.match, function (match$2) { dfs(match$2); }); } } _.keys(env).forEach(function (key) { dfs(env[key]); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePattern(pat){ // call the pattern currently being created\n switch(pat) {\n case 0:\n rainbow();\n break;\n case 1:\n rainbowCycle();\n break;\n case 2:\n theaterChaseRainbow();\n break;\n case 3:\n colorWipe(strip.Color(255, 0, 0)); // red\n break; \n } \n}", "setMark() {\r\n mark = stack.length;\r\n }", "setSymbolArt(state, sa) {\n state.parts = sa.parts\n state.lastId = sa.lastId\n state.selected = {}\n state.requestUpdateColorLayers = {}\n state.requestUpdateVertLayers = {}\n state.equestUpdateTypeLayers = {}\n //start history from a fresh state\n state.undoStack = []\n state.redoStack = []\n }", "consumeTreeSitterSyntaxBeta(ts) {\n ts.onMarkersCreated(({editor, markers}) => {\n if (!this.isActive()) return;\n\n const minimap = this.minimapPackage.minimapForEditor(editor);\n if (!minimap) return;\n\n const decorations = markers.map(marker => minimap.decorateMarker(\n marker,\n {\n type: \"highlight\",\n class: \"tree-sitter-syntax\"\n })\n );\n\n this.decorations.push(...decorations);\n });\n }", "function parseObj(isPattern, isBlockScope) {\n // Attach a context ID to the object open and close brace and each object key.\n const contextId = getNextContextId();\n let first = true;\n\n next();\n state.tokens[state.tokens.length - 1].contextId = contextId;\n\n while (!eat(TokenType.braceR) && !state.error) {\n if (first) {\n first = false;\n } else {\n expect(TokenType.comma);\n if (eat(TokenType.braceR)) {\n break;\n }\n }\n\n let isGenerator = false;\n if (match(TokenType.ellipsis)) {\n const previousIndex = state.tokens.length;\n parseSpread();\n if (isPattern) {\n // Mark role when the only thing being spread over is an identifier.\n if (state.tokens.length === previousIndex + 2) {\n markPriorBindingIdentifier(isBlockScope);\n }\n if (eat(TokenType.braceR)) {\n break;\n }\n }\n continue;\n }\n\n if (!isPattern) {\n isGenerator = eat(TokenType.star);\n }\n\n if (!isPattern && isContextual(ContextualKeyword._async)) {\n if (isGenerator) unexpected();\n\n parseIdentifier();\n if (\n match(TokenType.colon) ||\n match(TokenType.parenL) ||\n match(TokenType.braceR) ||\n match(TokenType.eq) ||\n match(TokenType.comma)\n ) {\n // This is a key called \"async\" rather than an async function.\n } else {\n if (match(TokenType.star)) {\n next();\n isGenerator = true;\n }\n parsePropertyName(contextId);\n }\n } else {\n parsePropertyName(contextId);\n }\n\n parseObjPropValue(isPattern, isBlockScope, contextId);\n }\n\n state.tokens[state.tokens.length - 1].contextId = contextId;\n}", "_escapeRegexMatches(content, pattern) {\n return content.replace(pattern, (_, keep) => {\n const replaceBy = `__ph-${this.index}__`;\n this.placeholders.push(keep);\n this.index++;\n return replaceBy;\n });\n }", "_escapeRegexMatches(content, pattern) {\n return content.replace(pattern, (_, keep) => {\n const replaceBy = `__ph-${this.index}__`;\n this.placeholders.push(keep);\n this.index++;\n return replaceBy;\n });\n }", "function Pattern() {\n }", "recomputeDecorations() {\r\n this.uglyDecorationRanges = new DisjointRangeSet_1.DisjointRangeSet();\r\n this.grammarState = [];\r\n for (const subst of this.prettyDecorations.unscoped)\r\n subst.ranges = new DisjointRangeSet_1.DisjointRangeSet();\r\n for (const subst of this.prettyDecorations.scoped)\r\n subst.ranges = new DisjointRangeSet_1.DisjointRangeSet();\r\n this.debugDecorations.forEach((val) => val.ranges = []);\r\n const docRange = new vscode.Range(0, 0, this.document.getLineCount(), 0);\r\n this.reparsePretties(docRange);\r\n }", "findSetters(theCSS, counter) {\n\t\t\t// console.log(theCSS);\n\t\t\tcssVarPoly.varsByBlock[counter] = theCSS.match(/(--[^:; ]+:..*?;)/g);\n\t\t}", "processSetPattern(context, result, inputParams, index) {\n var _a;\n result.element = (_a = result.element) !== null && _a !== void 0 ? _a : [];\n const element = inputParams.element;\n result.element.push(element);\n }", "addHighlightMatch(pat) {\n this._highlights.push(pat);\n }", "mark(idx) {\n\t\treturn this._do(idx, (i)=>i.mark(this.rule));\n\t}", "compile() {\n const scopeRules = this.scopeRule.split(';');\n this.regexScope = [];\n for (let scopeRule of scopeRules) {\n this.regexScope.push(wildcardToRegex(scopeRule));\n }\n try {\n this.regexIgnore = this.isRegEx ? new RegExp(this.ignoreRule, 'i') : wildcardToRegex(this.ignoreRule);\n } catch (e) {\n logger('Invalid RexExp', e);\n this.isActive = false;\n }\n }", "function setHope(){\r\n\thope = true;\r\n\tvar concrete = concreteObjects[concreteObjects.length -1];\r\n\tfor(var i = 0; i<leaves.length; i++){\r\n\t\t//leaves[i].insertAbove(concrete);\r\n\t\tanimateLeaf(leaves[i]);\r\n\t}\r\n\tfor(var i = 0; i<captionObjects.length; i++){\r\n\t\tcaptionObjects[i].fillColor = leafColor;\r\n\t}\r\n}", "activate(state) {\n // Events subscribed to in atom's system can be easily cleaned\n // up with a CompositeDisposable\n this.subscriptions = new CompositeDisposable();\n\n // ========================================================\n // Commands\n // ========================================================\n\n // Register commands to manually fold or unfold all docblocks\n this.subscriptions.add(atom.commands.add('atom-workspace', {\n 'fold-docblocks:fold-all': () => toggleDocblocks('fold'),\n 'fold-docblocks:unfold-all': () => toggleDocblocks('unfold'),\n }));\n\n // Observe all text editors, anytime a new editor is opened, conditionally\n // fold all docblocks\n atom.workspace.observeTextEditors(editor => {\n if (atom.config.get('language-documentation.autoFold')) {\n toggleDocblocks('fold', editor);\n }\n });\n\n // ========================================================\n // Grammar\n // ========================================================\n\n // Check all grammars for js scope\n atom.grammars.getGrammars().forEach(grammar => {\n if (!grammar.scopeName.includes('source.js')) { return; }\n injectPatterns(grammar);\n });\n\n // Observe grammar registry for added grammars that are js scoped\n atom.grammars.onDidAddGrammar(grammar => {\n if (!grammar.scopeName.includes('source.js')) { return; }\n injectPatterns(grammar);\n });\n }", "function findAndReplace(node, state) {\n var comp, parts, c, func\n parts = generators[node.type](node)\n for (var i = 0; i < parsed_dsl[node.type].length; i++) {\n comp = parsed_dsl[node.type][i]\n if (parts.length != comp.length) continue\n\n for (var j = 0; j < parts.length; j++) {\n if (parts[j] === comp[j]) continue\n if (parts[j] === false) continue\n if (~parts[j].indexOf(\".\")) continue\n\n c = _.cloneDeep(node)\n walk(c, { Identifier: function (node, state) { if (node.name === parts[j]) node.name = comp[j] }})\n if (_.isEqual(comp, generators[node.type](c))) {\n func = getScope(parts[j], state)\n if (!func) console.log(state, parts[j], comp[j])\n replaceVar(func, parts[j], comp[j])\n return\n }\n }\n }\n}", "function unmarkAll() {\n for (const elem of inputs) {\n elem.mark(false);\n }\n for (const elem of outputs) {\n elem.mark(false);\n }\n for (const elem of labels) {\n elem.mark(false);\n }\n for (const elem of gates) {\n elem.marked = false;\n }\n for (const elem of customs) {\n elem.marked = false;\n }\n for (const elem of conpoints) {\n elem.marked = false;\n }\n for (const elem of diodes) {\n elem.marked = false;\n }\n for (const elem of wires) {\n elem.marked = false;\n }\n for (const elem of segDisplays) {\n elem.marked = false;\n }\n}", "restack (){\n this._layers.forEach( (layer, key, index) => {\n layer.setDepth(index);\n //layer.objects.forEach(obj => {\n //if (obj.active)\n //obj.depth = index;\n //});\n });\n }", "clear(){\n\t\tconst patterns = instancePatterns.get(this);\n\t\tpatterns.clear();\n\t\tsuper.clear();\n\t}", "clear(){\n\t\tconst patterns = instancePatterns.get(this);\n\t\tpatterns.clear();\n\t\tsuper.clear();\n\t}", "function flushTypeQueue() {\n\t\t\twhile(typeQueue.length) {\n\t\t\t\tvar type = typeQueue.shift();\n\t\t\t\tif (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n\t\t\t\tangular.extend($types[type.name], injector.invoke(type.def));\n\t\t\t}\n\t\t}", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "syncToMarks(marks, inline, view) {\n let keep = 0, depth = this.stack.length >> 1;\n let maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n keep++;\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n let found2 = -1;\n for (let i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n let next = this.top.children[i];\n if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {\n found2 = i;\n break;\n }\n }\n if (found2 > -1) {\n if (found2 > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found2);\n }\n this.top = this.top.children[this.index];\n } else {\n let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while(typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function flushTypeQueue() {\n while (typeQueue.length) {\n var type = typeQueue.shift();\n if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function addSyntax(path){\n var jsonObject = _load(path);\n let jsonKey = Object.keys(jsonObject);\n var bold = \"\"\n ,color = \"\"\n ,type = \"\";\n syntax[jsonKey] = new _Syntax(jsonKey[0]);\n for(var i = 0; i < jsonObject[jsonKey].length; i++){\n Object.keys(jsonObject[jsonKey][i]).map(function(objectKey, index) {\n var value = jsonObject[jsonKey][i][objectKey];\n \n if(objectKey==\"bold\"){\n bold = value;\n }\n if(objectKey==\"color\"){\n color = value;\n }\n if(objectKey==\"type\"){\n type = value;\n } \n if(typeof value ==\"object\"){\n Object.keys(value).map(function(tagKey, indexTag) {\n var value = jsonObject[jsonKey][i][objectKey][tagKey];\n syntax[jsonKey].add(value.name, bold, color, type);\n });\n }\n });\n };\n _addStyle(jsonObject);\n }", "function setAction(obj) {\n if (actionCounter < activeModifiers.length) {\n moveToTarget(obj, activeModifiers[actionCounter]);\n actionCounter++;\n } else {\n moveToTarget(obj, finalBlock);\n }\n}", "function flushTypeQueue() {\n\t while(typeQueue.length) {\n\t var type = typeQueue.shift();\n\t if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n\t angular.extend($types[type.name], injector.invoke(type.def));\n\t }\n\t }", "function flushTypeQueue() {\n\t while(typeQueue.length) {\n\t var type = typeQueue.shift();\n\t if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n\t angular.extend($types[type.name], injector.invoke(type.def));\n\t }\n\t }", "function clobber(obj) { return exports.obliterate( obj, false ) }", "set y(v) {}", "openMark(mark) {\n this.marks = mark.addToSet(this.marks)\n }", "wrapMark(inner, mark) {\n let old = this.marks\n this.marks = (mark.instance || mark).addToSet(old)\n if (inner.call) inner()\n else this.addAll(inner.firstChild, null)\n this.marks = old\n }", "function flushTypeQueue() {\n var type;\n\n while (typeQueue.length) {\n type = typeQueue.shift();\n if (type.pattern) {\n throw new Error(\"You cannot override a type's .pattern at runtime.\");\n }\n angular.extend($types[type.name], injector.invoke(type.def));\n }\n }", "function setRegexListIf( obj, key ){\n\t\t\tif( key in obj ) Settings[key] = compileRegexList( obj[key], Settings.regexFirst );\n\t\t}", "function setuploop() {\n if (firstflag){\n for (var i = 0; i < 800; i++) {\n stars[i] = new outerspace()\n }\n }\n }", "clear() {\n this.literals = new Set();\n this.state.forEach((row, y) => row.forEach((_, x) => this.setClear(x, y)));\n }", "replace(...args) {\n const pairs = args2pairs(args)\n\n pairs.forEach(pair => that.replace.apply(that, pair))\n\n sync()\n return this\n }", "constructor(pattern){\n //\n //Consturct the super constructor.\n super(pattern,'g');\n }", "function setLightSensitives(){\n\ttransformables = new Array(\"ul\", \"li\", \"a.selected\", \"div.tabContent\", \"#pageContainer\", \"#mainHeader\");\n}", "activate() {\n this.registration = this.registry.addGrammar(this);\n }", "set() {}", "function gSregExp(text,ppattern) {\n\n var patt;\n if (ppattern instanceof RegExp) {\n patt = new RegExp(ppattern.source,'g');\n } else {\n //g for search all occurences\n patt = new RegExp(ppattern,'g');\n }\n\n var object;\n\n //var object;\n var data = patt.exec(text);//text.match(patt);\n //console.log('data->'+data);\n if (data==null || data==undefined) {\n return null;\n } else {\n var list = [];\n var i = 0;\n\n while (data!=null && data!=undefined) {\n //console.log('adding data->'+data);\n if (data instanceof Array && data.length>1) {\n list[i] = gSlist(data);\n } else {\n list[i] = data;\n }\n i = i + 1;\n data = patt.exec(text);\n }\n object = inherit(gSlist(list),'RegExp');\n }\n\n gScreateClassNames(object,['java.util.regex.Matcher']);\n\n object.pattern = patt;\n object.text = text;\n\n object.replaceFirst = function(data) {\n return this.text.replaceFirst(this[0],data);\n }\n\n object.replaceAll = function(data) {\n return this.text.replaceAll(this.pattern,data);\n }\n\n object.reset = function() {\n return this;\n }\n\n return object;\n}", "function stash(groups, stashAttr) {\n for (i = 0; i < groups.length; i++) {\n group = groups[i];\n for (axId in group) {\n layoutOut[id2name(axId)][stashAttr] = group;\n }\n }\n }", "set(index, body) {\n if(this.has(index)) { this.remove(index); }\n \n Matter.World.add(this.engine.world, body);\n body.index = index;\n this.indices[index] = body;\n //console.log(\"added body \"+JSON.stringify(body)+\" to index \"+index);\n return index;\n }", "setCodeArray(array) {\n this._lines = array;\n this.renderAll();\n this._highlightedPositionsToBe = this._highlightedPositions;\n this.updateHighlighted();\n }", "focusLexicalStack(event) {\n this.globalState.pathMatchers = getPathMatchers(event.activationEnv);\n this.clearFocus();\n\n this.globalState.pathMatchers.forEach(path => { this.focusPath(path) });\n }", "setNodes(editor, props) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n match,\n at = editor.selection\n } = options;\n var {\n hanging = false,\n mode = 'lowest',\n split = false,\n voids = false\n } = options;\n\n if (!at) {\n return;\n }\n\n if (match == null) {\n match = Path.isPath(at) ? matchPath(editor, at) : n => Editor.isBlock(editor, n);\n }\n\n if (!hanging && Range.isRange(at)) {\n at = Editor.unhangRange(editor, at);\n }\n\n if (split && Range.isRange(at)) {\n if (Range.isCollapsed(at) && Editor.leaf(editor, at.anchor)[0].text.length > 0) {\n // If the range is collapsed in a non-empty node and 'split' is true, there's nothing to\n // set that won't get normalized away\n return;\n }\n\n var rangeRef = Editor.rangeRef(editor, at, {\n affinity: 'inward'\n });\n var [start, end] = Range.edges(at);\n var splitMode = mode === 'lowest' ? 'lowest' : 'highest';\n var endAtEndOfNode = Editor.isEnd(editor, end, end.path);\n Transforms.splitNodes(editor, {\n at: end,\n match,\n mode: splitMode,\n voids,\n always: !endAtEndOfNode\n });\n var startAtStartOfNode = Editor.isStart(editor, start, start.path);\n Transforms.splitNodes(editor, {\n at: start,\n match,\n mode: splitMode,\n voids,\n always: !startAtStartOfNode\n });\n at = rangeRef.unref();\n\n if (options.at == null) {\n Transforms.select(editor, at);\n }\n }\n\n for (var [node, path] of Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n })) {\n var properties = {};\n var newProperties = {}; // You can't set properties on the editor node.\n\n if (path.length === 0) {\n continue;\n }\n\n var hasChanges = false;\n\n for (var k in props) {\n if (k === 'children' || k === 'text') {\n continue;\n }\n\n if (props[k] !== node[k]) {\n hasChanges = true; // Omit new properties from the old properties list\n\n if (node.hasOwnProperty(k)) properties[k] = node[k]; // Omit properties that have been removed from the new properties list\n\n if (props[k] != null) newProperties[k] = props[k];\n }\n }\n\n if (hasChanges) {\n editor.apply({\n type: 'set_node',\n path,\n properties,\n newProperties\n });\n }\n }\n });\n }", "function processSceneryPatterns(patterns) {\n var current, i;\n for(i in patterns) {\n current = patterns[i];\n if(!current.length) continue;\n // The last array in current should be [\"blank\", width]\n current.width = current[current.length - 1][1];\n current.pop();\n }\n}", "_markRow(x,y,wordLength) {\r\n let markedGrid = this.state.grid;\r\n for(let i = y; i<wordLength + y; i++){\r\n markedGrid[x][i].word = true;\r\n }\r\n this.setState({grid: markedGrid});\r\n }", "mark(marks) {\n return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n }", "mark(markName) {\n this.marks[markName] = new Mark()\n }", "function bind(mark) {\n do {\n var properties = mark.$properties;\n for (var i = properties.length - 1; i >= 0; i--) {\n var p = properties[i];\n if (!(p.name in seen)) {\n seen[p.name] = p;\n switch (p.name) {\n case \"data\":\n data = p;\n break;\n case \"visible\":\n visible = p;\n break;\n default:\n types[p.type].push(p);\n break;\n }\n }\n }\n } while (mark = mark.proto);\n }", "setShape() {\n for (let f of this.fixtures) {\n f.setShape();\n }\n }", "evolve() {\n if (this.link) {\n this.memory.body = [\n WORK, WORK, WORK, WORK, WORK, WORK, WORK,\n CARRY, CARRY, CARRY, CARRY, CARRY,\n MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE, MOVE\n ]\n }\n }", "defineStates() {\n // Maximum stack calls\n let maxStackCalls = 400;\n\n // Acquisition lambdas\n let queue = i => {\n return this.text.charAt(i);\n };\n let store = c => {\n this.buffer += c;\n };\n let flush = t => {\n if (this.buffer.length > 0) {\n // Special treatment for id tokens that contain only numbers\n let numberToken = t == Token.ID && !isNaN(this.buffer);\n this.list.push(\n new Token(numberToken ? Token.NUMBER : t, this.buffer, line)\n );\n }\n this.buffer = \"\";\n };\n\n // Line number updater\n let line = 0;\n let newline = i => {\n line++;\n };\n\n // State definitions\n let state = {\n // Transference function\n transference: (i, phase) => {\n if (i < this.text.length) {\n // Prevent stack overflow\n if (i % maxStackCalls == 0 && phase != true) {\n this.index = i;\n return;\n }\n\n // Transfer to the identifier state\n state.identifier(i);\n } else {\n flush(Token.ID);\n this.index = i;\n return;\n }\n },\n\n // For IDs\n identifier: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case '\"':\n case \"'\":\n flush(Token.ID);\n state.string(i + 1, c);\n return;\n case \"\\\\\":\n flush(Token.ID);\n state.extension(i);\n return;\n case \" \":\n case \";\":\n flush(Token.ID);\n state.delimiter(i);\n return;\n case \"#\":\n flush(Token.ID);\n state.comment(i + 1);\n return;\n case \"(\":\n case \")\":\n flush(Token.ID);\n state.parenthesis(i, c);\n return;\n default:\n store(c);\n state.transference(i + 1);\n }\n },\n\n // For strings\n string: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case phase:\n flush(Token.STRING);\n state.transference(i + 1, c);\n return;\n case \"\\\\\":\n state.extension(i + 1);\n return;\n default:\n store(c);\n state.string(i + 1, phase);\n }\n },\n\n // For escape characters\n extension: (i, phase) => {\n let c = queue(i);\n\n store(\"\\\\\" + c);\n state.transference(i + 1);\n },\n\n // For comments\n comment: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case \";\":\n newline();\n flush(Token.COMMENT);\n state.transference(i + 1);\n return;\n default:\n store(c);\n state.comment(i + 1);\n }\n },\n\n // For parenthesis\n parenthesis: (i, phase) => {\n let c = queue(i);\n\n store(c);\n if (phase == \"(\") flush(Token.OPEN);\n else if (phase == \")\") flush(Token.CLOSE);\n state.transference(i + 1);\n },\n\n // For whitespaces and linefeeds\n delimiter: (i, phase) => {\n let c = queue(i);\n\n switch (c) {\n case \";\":\n newline();\n case \" \":\n store(c);\n state.delimiter(i + 1);\n return;\n default:\n flush(Token.SPACE);\n state.transference(i);\n }\n }\n };\n this.state = state;\n }", "mark(...labels) { labels.forEach(label => this.classList.add(label)); }", "function resetUserPattern() { userPattern = [] }", "constructor(spec) {\n this.cached = /* @__PURE__ */ Object.create(null);\n let instanceSpec = this.spec = {};\n for (let prop in spec)\n instanceSpec[prop] = spec[prop];\n instanceSpec.nodes = OrderedMap.from(spec.nodes), instanceSpec.marks = OrderedMap.from(spec.marks || {}), this.nodes = NodeType$1.compile(this.spec.nodes, this);\n this.marks = MarkType.compile(this.spec.marks, this);\n let contentExprCache = /* @__PURE__ */ Object.create(null);\n for (let prop in this.nodes) {\n if (prop in this.marks)\n throw new RangeError(prop + \" can not be both a node and a mark\");\n let type = this.nodes[prop], contentExpr = type.spec.content || \"\", markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n type.markSet = markExpr == \"_\" ? null : markExpr ? gatherMarks(this, markExpr.split(\" \")) : markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (let prop in this.marks) {\n let type = this.marks[prop], excl = type.spec.excludes;\n type.excluded = excl == null ? [type] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n this.nodeFromJSON = this.nodeFromJSON.bind(this);\n this.markFromJSON = this.markFromJSON.bind(this);\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n this.cached.wrappings = /* @__PURE__ */ Object.create(null);\n }", "function beamObj(objs){ //beam objs\r\n\t\tapplied.allobj = objs;\r\n\t\tdrawn.basic = false;\r\n\t}//reiterate members", "initThyratrons(pattern) {\n this.rings = {\n X: {\n 1: INIT_PATTERNS[pattern].X[1].slice().reverse(),\n 2: INIT_PATTERNS[pattern].X[2].slice().reverse(),\n 3: INIT_PATTERNS[pattern].X[3].slice().reverse(),\n 4: INIT_PATTERNS[pattern].X[4].slice().reverse(),\n 5: INIT_PATTERNS[pattern].X[5].slice().reverse()\n },\n M: {\n 1: INIT_PATTERNS[pattern].M[1].slice().reverse(),\n 2: INIT_PATTERNS[pattern].M[2].slice().reverse(),\n },\n S: {\n 1: INIT_PATTERNS[pattern].S[1].slice().reverse(),\n 2: INIT_PATTERNS[pattern].S[2].slice().reverse(),\n 3: INIT_PATTERNS[pattern].S[3].slice().reverse(),\n 4: INIT_PATTERNS[pattern].S[4].slice().reverse(),\n 5: INIT_PATTERNS[pattern].S[5].slice().reverse()\n }\n };\n }", "function resetPlaceholderVariables(){\r\n\t\tPlaceholder.mode = false;\r\n\t\tPlaceholder.fromIndex = Placeholder.toIndex = 0;\r\n\t\tPlaceholder.isCENode = false;\r\n\t\tPlaceholder.node = null;\r\n\t\tPlaceholder.array = null;\r\n\t}", "function w(){this.a={}}", "init() {\n const emoticons = config.markup.emoticons;\n\n this.emoticonSets = Object.keys(emoticons).map((set) => {\n return emoticons[set];\n });\n\n const groups = this.emoticonSets.map((set) => {\n const codes = Object.keys(set.codes).map((code) => {\n // Escape all meta-characters for regular expressions: ^$*+?.|()[]{}.\n return code.replace(/[\\^\\$\\*\\+\\?\\.\\|\\/\\(\\)\\[\\]\\{\\}\\\\]/g, '\\\\$&')\n });\n\n // The sub-expression for the set matches any single emoticon in it.\n return '(' + codes.join('|') + ')';\n });\n\n // The complete expression matches any single emoticon from any set.\n this.emoticonRegex = new RegExp(groups.join('|'), 'g');\n }", "function replace_decoys(bracket){\n if(bracket.is_decoy){\n return bracket.match;\n }else{\n bracket.branch_1 = replace_decoys(bracket.branch_1);\n bracket.branch_2 = replace_decoys(bracket.branch_2);\n return bracket;\n }\n }", "highlightLine(line_num)\n{\n this.highlightSet = line_num;\n}", "*iterateScopedUglies(line, tokens) {\r\n let jumpOffset = undefined;\r\n nextToken: for (let tokenIdx = 0; tokenIdx < tokens.length; ++tokenIdx) {\r\n const token = tokens[tokenIdx];\r\n if (token.startIndex < jumpOffset || token.endIndex === token.startIndex)\r\n continue nextToken; // advance to the next offset we're interested in\r\n const tokenStr = line.substring(token.startIndex, token.endIndex);\r\n let matchScopes = this.prettyDecorations.scoped\r\n .filter(s => tm.matchScope(s.scope, token.scopes));\r\n let matchIter = regexp_iteration_1.iterateMatchArray(tokenStr, matchScopes.map(ms => ms.ugly));\r\n let match = matchIter.next();\r\n for (; !match.done; match = matchIter.next(jumpOffset !== undefined ? jumpOffset - token.startIndex : undefined)) {\r\n const newOffset = yield {\r\n start: token.startIndex + match.value.start,\r\n end: token.startIndex + match.value.end,\r\n matchStart: token.startIndex,\r\n matchEnd: token.endIndex,\r\n id: matchScopes[match.value.id].index\r\n };\r\n if (typeof newOffset === 'number') {\r\n jumpOffset = newOffset;\r\n if (newOffset < token.startIndex)\r\n tokenIdx = -1;\r\n }\r\n }\r\n }\r\n }", "initMaterials() {\n this.materials = [];\n\n for (var key in this.graph.materials) {\n if (this.graph.materials.hasOwnProperty(key)) {\n var material = this.graph.materials[key];\n\n this.materials[key] = new CGFappearance(this);\n\n let ambient = material.ambient;\n let diffuse = material.diffuse;\n let specular = material.specular;\n let emission = material.emission;\n\n this.materials[key].setAmbient(ambient.r, ambient.g, ambient.b, ambient.a);\n this.materials[key].setDiffuse(diffuse.r, diffuse.g, diffuse.b, diffuse.a);\n this.materials[key].setSpecular(specular.r, specular.g, specular.b, specular.a);\n this.materials[key].setEmission(emission.r, emission.g, emission.b, emission.a);\n this.materials[key].setShininess(material.shininess);\n this.materials[key].setTextureWrap('REPEAT','REPEAT');\n }\n }\n }", "function setModifier(count, index) {\n var obj, modifierName, modifFunc;\n\n var objLayerModifs = levels[currentLevel].modifiers[index];\n\n modifierName = objLayerModifs.type;\n\n if (modifierName == 'resize') {\n modifierName = objLayerModifs.type + objLayerModifs[Object.keys(objLayerModifs)[1]].toString();\n }\n\n obj = new Sprite(\n Loader.resources['assets/imgs/' + modifierName + '.png'].texture\n );\n\n obj.anchor.set(0.5, 0.5);\n\n //define funcoes de modificacao\n switch (modifierName) {\n //reduz tamanho\n case 'resize1':\n obj.modFunc = new sizeDown(obj);\n break;\n\n //aumenta tamanho\n case 'resize2':\n obj.modFunc = new sizeUp(obj);\n break;\n\n //muda cor\n case 'colorize':\n obj.modFunc = new colorizeIt(obj);\n break;\n\n case 'select':\n obj.modFunc = new nope(obj);\n break;\n }\n\n switch (count) {\n case 1:\n obj.x = app.view.width * 0.5;\n obj.y = pathProp.pathY;\n break;\n\n case 2:\n obj.x = app.view.width * (0.25 * (index + 1.5));\n obj.y = pathProp.pathY;\n break;\n }\n\n //tratamento para modificador select\n if (modifierName == 'select') {\n obj.interactive = true;\n obj.buttonMode = true;\n obj.on(\"pointerdown\", function () {\n selectModifier(obj);\n });\n }\n\n return obj;\n}", "reset(){\n this.pattern = new ACNLFormat();\n this.pixels_buffer = new ArrayBuffer(4096);\n this.pixels = new Uint8Array(this.pixels_buffer);\n this.drawHandler = basicDrawing;\n this.drawHandlerAlt = basicDrawing;\n this.currentColor = 0;\n this.undoHistory = [];\n this.redoHistory = [];\n this.onLoad();\n }", "set mark1(mark1) {\n this._mark1 = mark1;\n }", "function ge(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText=\"\";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=\"\"}", "update_all_rays() {\n for(let i=0;i<w.rays.length;++i) {\n w.rays[i].need_update = true;\n }\n }", "function setNodes () {\n args.forEach((e) => {\n if (e.search(/^\\w+\\s*(=>)\\s*\\w+$/) !== -1) {\n const node = [e.match(/\\w+$/)[0], e.match(/^\\w+/)[0]];\n nodes.push(node);\n } else {\n const node = e.match(/^\\w+/)[0];\n nodes.unshift([node, node]);\n }\n });\n }", "function initHighlighting() {\n if (initHighlighting.called) return;\n initHighlighting.called = true;\n var blocks = document.querySelectorAll('pre code');\n ArrayProto.forEach.call(blocks, highlightBlock);\n }", "function reset_all( mode )\n{\n\tvar p;\n\t\n\tassoc_level = 1;\n\texec_mode = mode;\n\n\tsymbols = new Array();\n\tproductions = new Array();\n\tstates = new Array();\n\tnfa_states = new Array();\n\tdfa_states = new Array();\n\tlex = new Array();\n\t\n\tcreate_symbol( \"\", SYM_NONTERM, SPECIAL_NO_SPECIAL );\n\tsymbols[0].defined = true;\n\t\n\tp = new PROD();\n\tp.lhs = 0;\n\tp.rhs = new Array();\n\tp.code = new String( \"%% = %1;\" );\n\tsymbols[0].prods.push( productions.length );\n\tproductions.push( p );\n\t\n\twhitespace_token = -1;\n\t\n\t/*\n\tsrc = new String();\n\tsrc_off = 0;\n\tline = 1;\n\tlookahead = void(0);\n\t*/\n\t\n\terrors = 0;\n\tshow_errors = true;\n\twarnings = 0;\n\tshow_warnings = false;\n\t\n\tshifts = 0;\n\treduces = 0;\n\tgotos = 0;\n\t\n\tregex_weight = 0;\n\t\n\tcode_head = new String();\n\tcode_foot = new String();\n}", "function populate(replacements, flags) { \r\n var word, modPos, mod; \r\n for(var key in replacements) { \r\n if((modPos = key.indexOf(\"/\")) > -1) { \r\n mod = key.substring(modPos + 1); \r\n word = key.substring(0, modPos); \r\n } else { \r\n mod = \"\"; \r\n word = key; \r\n } \r\n modifiers.push(mod); \r\n bad.push(new RegExp(word, flags)); \r\n good.push(replacements[key]); \r\n } \r\n}", "function populate(replacements, flags) { \r\n var word, modPos, mod; \r\n for(var key in replacements) { \r\n if((modPos = key.indexOf(\"/\")) > -1) { \r\n mod = key.substring(modPos + 1); \r\n word = key.substring(0, modPos); \r\n } else { \r\n mod = \"\"; \r\n word = key; \r\n } \r\n modifiers.push(mod); \r\n bad.push(new RegExp(word, flags)); \r\n good.push(replacements[key]); \r\n } \r\n}", "visitAll(asts, context) {\n for (const ast of asts) {\n this.visit(ast, context);\n }\n }", "visitAll(asts, context) {\n for (const ast of asts) {\n this.visit(ast, context);\n }\n }", "_reconstructActiveFormattingElements() {\n const listLength = this.activeFormattingElements.entries.length;\n if (listLength) {\n const endIndex = this.activeFormattingElements.entries.findIndex((entry) => entry.type === EntryType.Marker || this.openElements.contains(entry.element));\n const unopenIdx = endIndex < 0 ? listLength - 1 : endIndex - 1;\n for (let i = unopenIdx; i >= 0; i--) {\n const entry = this.activeFormattingElements.entries[i];\n this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element));\n entry.element = this.openElements.current;\n }\n }\n }", "function setReplacementSet(replacementSet) {\n // Loop from 1 to 6, as this is how many \"replaceX\" spans there are\n for (let i=1; i<7; i++){\n $(\"#replace\"+i.toString()).text(replacementSet[i-1]);\n }\n}" ]
[ "0.5055013", "0.5052834", "0.5038943", "0.49668983", "0.4940772", "0.4907777", "0.4907777", "0.48936927", "0.48829216", "0.48823985", "0.4879836", "0.48612398", "0.4812791", "0.47954997", "0.47916326", "0.4739307", "0.46989194", "0.46893525", "0.46801847", "0.46701443", "0.46701443", "0.46664286", "0.4661749", "0.46588722", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46455854", "0.46393996", "0.4623058", "0.46169114", "0.460518", "0.460518", "0.4605036", "0.45867756", "0.45736757", "0.4573196", "0.4572879", "0.45713815", "0.45650238", "0.45626584", "0.4558508", "0.4546398", "0.45240238", "0.45193994", "0.45186055", "0.45173627", "0.45154136", "0.4514145", "0.45085406", "0.45051375", "0.4496436", "0.4495498", "0.4483677", "0.44738296", "0.44697106", "0.44662985", "0.44563636", "0.44382048", "0.4437784", "0.44376585", "0.44289201", "0.44203654", "0.44180986", "0.44164336", "0.44160202", "0.44155228", "0.44119304", "0.4411442", "0.44091484", "0.44085717", "0.4407614", "0.44047847", "0.43976995", "0.4396287", "0.43897492", "0.4389399", "0.4383896", "0.43829086", "0.43804938", "0.43732435", "0.43732435", "0.43709797", "0.43709797", "0.43699777", "0.43658206" ]
0.6791206
0
given the syntax for a macro, produce a macro transformer (Macro) > (([...CSyntax]) > ReadTree)
function loadMacroDef(body, context) { // raw function primitive form if (!(body[0] && body[0].token.type === parser.Token.Keyword && body[0].token.value === 'function')) { throwSyntaxError('load macro', 'Primitive macro form must contain a function for the macro body', body); } var stub = parser.read('()'); stub[0].token.inner = body; var expanded = expand(stub, context); expanded = expanded[0].destruct().concat(expanded[1].eof); var flattend = flatten(expanded); var bodyCode = codegen.generate(parser.parse(flattend)); var macroFn = scopedEval(bodyCode, { makeValue: syn.makeValue, makeRegex: syn.makeRegex, makeIdent: syn.makeIdent, makeKeyword: syn.makeKeyword, makePunc: syn.makePunc, makeDelim: syn.makeDelim, require: function (id) { if (context.requireModule) { return context.requireModule(id, context.filename); } return require(id); }, getExpr: function (stx) { var r; if (stx.length === 0) { return { success: false, result: [], rest: [] }; } r = get_expression(stx, context); return { success: r.result !== null, result: r.result === null ? [] : r.result.destruct(), rest: r.rest }; }, getIdent: function (stx) { if (stx[0] && stx[0].token.type === parser.Token.Identifier) { return { success: true, result: [stx[0]], rest: stx.slice(1) }; } return { success: false, result: [], rest: stx }; }, getLit: function (stx) { if (stx[0] && patternModule.typeIsLiteral(stx[0].token.type)) { return { success: true, result: [stx[0]], rest: stx.slice(1) }; } return { success: false, result: [], rest: stx }; }, unwrapSyntax: syn.unwrapSyntax, throwSyntaxError: throwSyntaxError, throwSyntaxCaseError: throwSyntaxCaseError, prettyPrint: syn.prettyPrint, parser: parser, __fresh: fresh, _: _, patternModule: patternModule, getPattern: function (id) { return context.patternMap.get(id); }, getTemplate: function (id) { return syn.cloneSyntaxArray(context.templateMap.get(id)); }, applyMarkToPatternEnv: applyMarkToPatternEnv, mergeMatches: function (newMatch, oldMatch) { newMatch.patternEnv = _.extend({}, oldMatch.patternEnv, newMatch.patternEnv); return newMatch; } }); return macroFn; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function macroExpand(syntaxTree) {\n\t\tvar i;\n\t\t\n\t\tfor (i = 0; i < syntaxTree.length; i++) {\n\t\t\tif (Array.isArray(syntaxTree[i])) {\n\t\t\t\tsyntaxTree[i] = macroExpand(syntaxTree[i]);\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (syntaxTree.length > 0 && typeof macros[syntaxTree[0]] === 'function') {\n\t\t\treturn macros[syntaxTree[0]](syntaxTree.splice(1));\n\t\t}\n\t\treturn syntaxTree;\n\t}", "_getExpansion(name: string): ?MacroExpansion {\n const definition = this.macros.get(name);\n if (definition == null) { // mainly checking for undefined here\n return definition;\n }\n const expansion =\n typeof definition === \"function\" ? definition(this) : definition;\n if (typeof expansion === \"string\") {\n let numArgs = 0;\n if (expansion.indexOf(\"#\") !== -1) {\n const stripped = expansion.replace(/##/g, \"\");\n while (stripped.indexOf(\"#\" + (numArgs + 1)) !== -1) {\n ++numArgs;\n }\n }\n const bodyLexer = new Lexer(expansion, this.settings);\n const tokens = [];\n let tok = bodyLexer.lex();\n while (tok.text !== \"EOF\") {\n tokens.push(tok);\n tok = bodyLexer.lex();\n }\n tokens.reverse(); // to fit in with stack using push and pop\n const expanded = {tokens, numArgs};\n return expanded;\n }\n\n return expansion;\n }", "function transcribe$2154(macroBody$2257, macroNameStx$2258, env$2259) {\n return _$2124.chain(macroBody$2257).reduce(function (acc$2260, bodyStx$2261, idx$2262, original$2263) {\n // first find the ellipses and mark the syntax objects\n // (note that this step does not eagerly go into delimiter bodies)\n var last$2264 = original$2263[idx$2262 - 1];\n var next$2265 = original$2263[idx$2262 + 1];\n var nextNext$2266 = original$2263[idx$2262 + 2];\n // drop `...`\n if (bodyStx$2261.token.value === '...') {\n return acc$2260;\n }\n // drop `(<separator)` when followed by an ellipse\n if (delimIsSeparator$2140(bodyStx$2261) && next$2265 && next$2265.token.value === '...') {\n return acc$2260;\n }\n // skip the $ in $(...)\n if (bodyStx$2261.token.value === '$' && next$2265 && next$2265.token.type === parser$2126.Token.Delimiter && next$2265.token.value === '()') {\n return acc$2260;\n }\n // mark $[...] as a literal\n if (bodyStx$2261.token.value === '$' && next$2265 && next$2265.token.type === parser$2126.Token.Delimiter && next$2265.token.value === '[]') {\n next$2265.literal = true;\n return acc$2260;\n }\n if (bodyStx$2261.token.type === parser$2126.Token.Delimiter && bodyStx$2261.token.value === '()' && last$2264 && last$2264.token.value === '$') {\n bodyStx$2261.group = true;\n }\n // literal [] delimiters have their bodies just\n // directly passed along\n if (bodyStx$2261.literal === true) {\n assert$2134(bodyStx$2261.token.type === parser$2126.Token.Delimiter, 'expecting a literal to be surrounded by []');\n return acc$2260.concat(bodyStx$2261.token.inner);\n }\n if (next$2265 && next$2265.token.value === '...') {\n bodyStx$2261.repeat = true;\n bodyStx$2261.separator = ' ';\n } // default to space separated\n else if (delimIsSeparator$2140(next$2265) && nextNext$2266 && nextNext$2266.token.value === '...') {\n bodyStx$2261.repeat = true;\n bodyStx$2261.separator = next$2265.token.inner[0].token.value;\n }\n acc$2260.push(bodyStx$2261);\n return acc$2260;\n }, []).reduce(function (acc$2267, bodyStx$2268, idx$2269) {\n // then do the actual transcription\n if (bodyStx$2268.repeat) {\n if (bodyStx$2268.token.type === parser$2126.Token.Delimiter) {\n bodyStx$2268.expose();\n var fv$2270 = _$2124.filter(freeVarsInPattern$2137(bodyStx$2268.token.inner), function (pat$2277) {\n // ignore \"patterns\"\n // that aren't in the\n // environment (treat\n // them like literals)\n return env$2259.hasOwnProperty(pat$2277);\n });\n var restrictedEnv$2271 = [];\n var nonScalar$2272 = _$2124.find(fv$2270, function (pat$2278) {\n return env$2259[pat$2278].level > 0;\n });\n assert$2134(typeof nonScalar$2272 !== 'undefined', 'must have a least one non-scalar in repeat');\n var repeatLength$2273 = env$2259[nonScalar$2272].match.length;\n var sameLength$2274 = _$2124.all(fv$2270, function (pat$2279) {\n return env$2259[pat$2279].level === 0 || env$2259[pat$2279].match.length === repeatLength$2273;\n });\n assert$2134(sameLength$2274, 'all non-scalars must have the same length');\n // create a list of envs restricted to the free vars\n _$2124.each(_$2124.range(repeatLength$2273), function (idx$2280) {\n var renv$2281 = {};\n _$2124.each(fv$2270, function (pat$2283) {\n if (env$2259[pat$2283].level === 0) {\n // copy scalars over\n renv$2281[pat$2283] = env$2259[pat$2283];\n } else {\n // grab the match at this index \n renv$2281[pat$2283] = env$2259[pat$2283].match[idx$2280];\n }\n });\n var allHaveMatch$2282 = Object.keys(renv$2281).every(function (pat$2284) {\n return hasMatch$2153(renv$2281[pat$2284]);\n });\n if (allHaveMatch$2282) {\n restrictedEnv$2271.push(renv$2281);\n }\n });\n var transcribed$2275 = _$2124.map(restrictedEnv$2271, function (renv$2285) {\n if (bodyStx$2268.group) {\n return transcribe$2154(bodyStx$2268.token.inner, macroNameStx$2258, renv$2285);\n } else {\n var newBody$2286 = syntaxFromToken$2130(_$2124.clone(bodyStx$2268.token), bodyStx$2268);\n newBody$2286.token.inner = transcribe$2154(bodyStx$2268.token.inner, macroNameStx$2258, renv$2285);\n return newBody$2286;\n }\n });\n var joined$2276;\n if (bodyStx$2268.group) {\n joined$2276 = joinSyntaxArr$2133(transcribed$2275, bodyStx$2268.separator);\n } else {\n joined$2276 = joinSyntax$2132(transcribed$2275, bodyStx$2268.separator);\n }\n push$2136.apply(acc$2267, joined$2276);\n return acc$2267;\n }\n if (!env$2259[bodyStx$2268.token.value]) {\n throwSyntaxError$2135('patterns', 'The pattern variable is not bound for the template', bodyStx$2268);\n } else if (env$2259[bodyStx$2268.token.value].level !== 1) {\n throwSyntaxError$2135('patterns', 'Ellipses level does not match in the template', bodyStx$2268);\n }\n push$2136.apply(acc$2267, joinRepeatedMatch$2142(env$2259[bodyStx$2268.token.value].match, bodyStx$2268.separator));\n return acc$2267;\n } else {\n if (bodyStx$2268.token.type === parser$2126.Token.Delimiter) {\n bodyStx$2268.expose();\n var newBody$2287 = syntaxFromToken$2130(_$2124.clone(bodyStx$2268.token), macroBody$2257);\n newBody$2287.token.inner = transcribe$2154(bodyStx$2268.token.inner, macroNameStx$2258, env$2259);\n acc$2267.push(newBody$2287);\n return acc$2267;\n }\n if (isPatternVar$2141(bodyStx$2268) && Object.prototype.hasOwnProperty.bind(env$2259)(bodyStx$2268.token.value)) {\n if (!env$2259[bodyStx$2268.token.value]) {\n throwSyntaxError$2135('patterns', 'The pattern variable is not bound for the template', bodyStx$2268);\n } else if (env$2259[bodyStx$2268.token.value].level !== 0) {\n throwSyntaxError$2135('patterns', 'Ellipses level does not match in the template', bodyStx$2268);\n }\n push$2136.apply(acc$2267, takeLineContext$2143(bodyStx$2268, env$2259[bodyStx$2268.token.value].match));\n return acc$2267;\n }\n acc$2267.push(bodyStx$2268);\n return acc$2267;\n }\n }, []).value();\n }", "function tokenize(content) {\n\t\n\tif (!content.endsWith('\\n')) {\n\t\tcontent += '\\n';\n\t}\n\t\n\t//Not the full list of tokens; namely, brackets aren't in this list.\n\t//Sorted by longest first, for greediness.\n\tvar tokens = [\n\t\t\"==\",\n\t\t\"!=\",\n\t\t\"<=\",\n\t\t\">=\",\n\t\t\"+=\",\n\t\t\"-=\",\n\t\t\"*=\",\n\t\t\"/=\",\n\t\t\"%=\",\n\t\t\"**=\",\n\t\t\"<\",\n\t\t\">\",\n\t\t\"=\",\n\t\t\"++\",\n\t\t\"--\",\n\t\t\"+\",\n\t\t\"-\",\n\t\t\",\",\n\t\t\"/\",\n\t\t\"%\",\n\t\t\"**\",\n\t\t\"*\",\n\t\t\".\",\n\t\t\":\",\n\t\t\"\\\\\",\n\t];\n\t\n\t\n\tvar rules = [];\n\tvar macros = [];\n\t\n\tvar isInSpecial = false;\n\t//var isInString = false;\n\tvar currentStrDelimiter = \"\";\n\tvar isInLineComment = false;\n\tvar isInStrComment = false;\n\tvar isInMacro = false;\n\tvar currentStrCommentDelimiter = \"\";\n\tvar bracketsLevel = 0;\n\tvar isInRule = false;\n\tvar currentRule = {};\n\tvar currentRuleLine = {};\n\t//var currentToken = {\"text\":\"\"};\n\tvar currentMacro = {};\n\tvar isBackslashed = false;\n\tvar isInTextToken = false;\n\t\n\t//\"Timer\" used for end of special zones (eg: the end of a multiline string is 3 characters long).\n\tvar timer = 0;\n\t\n\t//Timer used when inside a macro resolution, in order to stop incrementing column+line.\n\tvar macroTimer = 0;\n\tvar macroCols = 0;\n\tvar macroLines = 0;\n\t\n\tcurrentLineNb = 1;\n\tcurrentColNb = 0;\n\t\n\tvar i = 0;\n\t\n\tfunction addToken(text) {\n\t\t\n\t\tif (text.length === 0) {\n\t\t\terror(\"Token is empty, lexer broke\");\n\t\t}\n\t\t\n\t\t//debug(\"Adding token '\"+text+\"' at \"+currentLineNb+\":\"+currentColNb);\n\t\t\n\t\tcurrentRuleLine.tokens.push({\n\t\t\t\"lineNb\":currentLineNb,\n\t\t\t\"colNb\":currentColNb,\n\t\t\t\"text\":text\n\t\t});\n\t\t\n\t\ti += text.length-1;\n\t\tcurrentColNb += text.length-1;\n\t}\n\t\n\tfunction newRuleLine() {\n\t\t\n\t\tif (currentRuleLine.tokens !== undefined && currentRuleLine.tokens.length > 0) {\n\t\t\tcurrentRule.lines.push(currentRuleLine);\n\t\t}\n\t\t\n\t\tcurrentRuleLine = {\n\t\t\t\"indentLevel\":0,\n\t\t\t\"tokens\":[]\n\t\t};\n\t}\n\t\n\tnewRuleLine();\n\t\t\n\tfor (i = 0; i < content.length; i++) {\n\t\t\n\t\t//console.log(i);\n\t\t//await sleep(5);\n\t\t\n\t\tisInSpecial = (isInLineComment || isInStrComment || isInMacro);\n\t\t\n\t\t\n\t\tif (macroTimer > 0) {\n\t\t\tmacroTimer--;\n\t\t\tif (macroTimer === 0) {\n\t\t\t\t//debug(\"macro lines = \"+macroLines+\", macro cols = \"+macroCols);\n\t\t\t\tcurrentLineNb += macroLines;\n\t\t\t\tcurrentColNb = macroCols;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (macroTimer === 0) {\n\t\t\tcurrentColNb++;\n\t\t}\n\t\t\n\t\t\n\t\tif (timer > 0) {\n\t\t\ttimer--;\n\t\t\tif (timer === 0) {\n\t\t\t\tisInStrComment = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (content[i] === '\\n') {\n\t\t\tif (!isBackslashed) {\n\t\t\t\tif (isInMacro) {\n\t\t\t\t\tisInMacro = false;\n\t\t\t\t\tmacros.push(parseMacro(currentMacro));\n\t\t\t\t}\n\t\t\t}\n\t\t\t//For some reason, in Python, line comments aren't affected by backslashes before new lines.\n\t\t\tif (isInLineComment) {\n\t\t\t\tisInLineComment = false;\n\t\t\t\t\n\t\t\t\n\t\t\t//Do not end the instruction if there is a line break inside a function, or the line is backslashed.\n\t\t\t} else if (bracketsLevel === 0 && isInRule && !isBackslashed) {\n\t\t\t\tnewRuleLine();\n\t\t\t\t\n\t\t\t}\n\t\t\tif (macroTimer === 0) {\n\t\t\t\tcurrentLineNb++;\n\t\t\t\tcurrentColNb = 0;\n\t\t\t}\n\t\t\t\n\t\t} else if (!isInStrComment && !isInMacro && !isInLineComment) {\n\t\t\t\n\t\t\tif (content.startsWith(\" \", i) && currentRuleLine.tokens.length === 0) {\n\t\t\t\tcurrentRuleLine.indentLevel++;\n\t\t\t\tcurrentColNb += \" \".length-1;\n\t\t\t} else if (content.startsWith(\"\\t\", i)) {\n\t\t\t\tif (currentRuleLine.tokens.length === 0) {\n\t\t\t\t\tcurrentRuleLine.indentLevel++;\n\t\t\t\t}\n\t\t\t} else if (content[i] === ' ') {\n\t\t\t\t//do nothing\n\t\t\t} else if (content[i] === '\\\\') {\n\t\t\t\t//do nothing\n\t\t\t} else if (content[i] === '(' || content[i] === '[' || content[i] === '{') {\n\t\t\t\tbracketsLevel++;\n\t\t\t\taddToken(content[i]);\n\t\t\t\t\n\t\t\t} else if (content[i] === ')' || content[i] === ']' || content[i] === '}') {\n\t\t\t\tbracketsLevel--;\n\t\t\t\tif (bracketsLevel < 0) {\n\t\t\t\t\terror(\"Brackets level below 0\");\n\t\t\t\t}\n\t\t\t\taddToken(content[i]);\n\t\t\t\t\n\t\t\t} else if (content.startsWith(\"#!\", i)) {\n\t\t\t\tif (!isInRule) {\n\t\t\t\t\tisInMacro = true;\n\t\t\t\t\tcurrentMacro = {\n\t\t\t\t\t\t\"lineStart\":currentLineNb,\n\t\t\t\t\t\t\"content\":\"\"\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\terror(\"Cannot declare macro inside a rule\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else if (content[i] === '#') {\n\t\t\t\tisInLineComment = true;\n\t\t\t\n\t\t\t} else if (content.startsWith(\"'''\", i)) {\n\t\t\t\tisInStrComment = true;\n\t\t\t\tcurrentStrCommentDelimiter = \"'''\";\n\t\t\t\t\n\t\t\t} else if (content.startsWith('\"\"\"', i)) {\n\t\t\t\tisInStrComment = true;\n\t\t\t\tcurrentStrCommentDelimiter = '\"\"\"';\n\t\t\t\t\n\t\t\t} else if (content[i] === '\"' || content[i] === '\\'') {\n\t\t\t\tcurrentStrDelimiter = content[i];\n\t\t\t\t//Get to the end of the string\n\t\t\t\tvar j = i+1;\n\t\t\t\tfor (; j < content.length; j++) {\n\t\t\t\t\t\n\t\t\t\t\t//Test for potentially unclosed string\n\t\t\t\t\tif (!isBackslashed && content[j] === '\\n') {\n\t\t\t\t\t\terror(\"Unclosed string\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!isBackslashed && content[j] === currentStrDelimiter) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\tif (content[j] === '\\\\') {\n\t\t\t\t\t\tisBackslashed = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tisBackslashed = false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tj += 1; //account for closing delimiter\n\t\t\t\t\n\t\t\t\tif (j > i) {\n\t\t\t\t\taddToken(content.substring(i, j));\n\t\t\t\t} else {\n\t\t\t\t\terror(\"Failed to parse string '\"+content.substring(i, j)+\"' (malformed string?)\");\n\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//Test each macro\n\t\t\t\tfor (var j = 0; j < macros.length; j++) {\n\t\t\t\t\tif (content.startsWith(macros[j].name, i)) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar text;\n\t\t\t\t\t\tvar replacement;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (macros[j].isFunction) {\n\t\t\t\t\t\t\t//debug(\"Resolving function macro \"+macros[j].name);\n\t\t\t\t\t\t\tvar bracketPos = getBracketPositions(content.substring(i), true);\n\t\t\t\t\t\t\ttext = content.substring(i, i+bracketPos[1]+1);\n\t\t\t\t\t\t\tvar macroArgs = getArgs(content.substring(i+bracketPos[0]+1, i+bracketPos[1]));\n\t\t\t\t\t\t\treplacement = resolveMacro(macros[j], macroArgs);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t//debug(\"Resolving normal macro \"+macros[j].name);\n\t\t\t\t\t\t\ttext = macros[j].name;\n\t\t\t\t\t\t\treplacement = macros[j].replacement;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tcontent = content.substring(0, i) + replacement + content.substring(i+text.length);\n\t\t\t\t\t\tif (macroTimer === 0) {\n\t\t\t\t\t\t\tif (text.indexOf('\\n') >= 0) {\n\t\t\t\t\t\t\t\tmacroCols = text.length - text.lastIndexOf('\\n');\n\t\t\t\t\t\t\t\tmacroLines = text.split('\\n').length-1;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmacroCols = text.length;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmacroTimer += replacement.length;\n\t\t\t\t\t\t\n\t\t\t\t\t\t//debug(\"Text: \"+text);\n\t\t\t\t\t\t//debug(\"Replacement: \"+replacement);\n\t\t\t\t\t\t\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Get token\n\t\t\t\tvar j = i;\n\t\t\t\tfor (; j < content.length && isVarChar(content[j]); j++);\n\t\t\t\t\n\t\t\t\tif (j > i) {\n\t\t\t\t\tif (content.substring(i, j) === \"@Rule\") {\n\t\t\t\t\t\tisInRule = true;\n\t\t\t\t\t\trules.push(currentRule);\n\t\t\t\t\t\tcurrentRule = {\n\t\t\t\t\t\t\t\"lineStart\":currentLineNb,\n\t\t\t\t\t\t\t\"lines\":[]\n\t\t\t\t\t\t};\n\t\t\t\t\t\tnewRuleLine();\n\t\t\t\t\t} else if (!isInRule) {\n\t\t\t\t\t\terror(\"Found code outside a rule : \"+content[i]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//Handle the special case of min= and max= operators\n\t\t\t\t\tif ((content.substring(i,j) === \"min\" || content.substring(i,j) === \"max\") && content[i+\"min\".length] === '=') {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t}\n\t\t\t\t\taddToken(content.substring(i, j))\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tvar hasTokenBeenFound = false;\n\t\t\t\t\t//Test each remaining token\n\t\t\t\t\tfor (var h = 0; h < tokens.length; h++) {\n\t\t\t\t\t\tif (content.startsWith(tokens[h], i)) {\n\t\t\t\t\t\t\taddToken(content.substring(i, i+tokens[h].length));\n\t\t\t\t\t\t\thasTokenBeenFound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (!hasTokenBeenFound) {\n\t\t\t\t\t\terror(\"Unknown token '\"+content[i]+\"'\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t} else if (isInStrComment && content.startsWith(currentStrCommentDelimiter, i)) {\n\t\t\ttimer = 3;\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tif (content[i] === '\\\\') {\n\t\t\tisBackslashed = true;\n\t\t} else {\n\t\t\tisBackslashed = false;\n\t\t}\n\t\t\n\t\tif (isInMacro) {\n\t\t\tcurrentMacro.content += content[i];\n\t\t}\n\t}\n\t\n\trules.push(currentRule);\n\t\n\tconsole.log(\"macros = \");\n\tconsole.log(macros);\n\t\n\treturn rules.slice(1)\n\t\n}", "function parse(){\n var syntax = esprima.parse(editor.getValue());\n codeArray = [];\n expand(syntax.body, codeArray, 0);\n}", "expandMacroAsText(name: string): string | void {\n const tokens = this.expandMacro(name);\n if (tokens) {\n return tokens.map((token) => token.text).join(\"\");\n } else {\n return tokens;\n }\n }", "expandMacro(name: string): Token[] | void {\n if (!this.macros.get(name)) {\n return undefined;\n }\n const output = [];\n const oldStackLength = this.stack.length;\n this.pushToken(new Token(name));\n while (this.stack.length > oldStackLength) {\n const expanded = this.expandOnce();\n // expandOnce returns Token if and only if it's fully expanded.\n if (expanded instanceof Token) {\n output.push(this.stack.pop());\n }\n }\n return output;\n }", "build(regexp) {\n let ast = regexp;\n\n if (regexp instanceof RegExp) {\n regexp = `${regexp}`;\n }\n\n if (typeof regexp === 'string') {\n ast = parser.parse(regexp, {\n captureLocations: true,\n });\n }\n\n return gen(desugar(ast));\n }", "function macro(x) {\n x.isMacro = true;\n return x;\n}", "function math(ctx, node, index, parent) {\n var type = 'math';\n\n if (node.type === 'inlineMath') {\n try {\n var classes = node.data.hProperties.className;\n type = classes.includes('math-display') ? 'inlineMathDouble' : 'inlineMath';\n } catch (e) {\n console.error(e, 'This rebber math plugin is only compatible with remark-math.');\n }\n }\n\n var macro = has(ctx, 'math') && has(ctx.math, type) && ctx.math[type] || has(defaultMacros, type) && defaultMacros[type];\n var content = all(ctx, node) || node.value || '';\n return macro(content.trim());\n}", "function buildMathML(tree, texExpression, options) {\n var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly, unless it's a single <mrow> or <mtable>.\n\n var wrapper;\n\n if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains([\"mrow\", \"mtable\"], expression[0].type)) {\n wrapper = expression[0];\n } else {\n wrapper = new mathMLTree.MathNode(\"mrow\", expression);\n } // Build a TeX annotation of the source\n\n\n var annotation = new mathMLTree.MathNode(\"annotation\", [new mathMLTree.TextNode(texExpression)]);\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n var semantics = new mathMLTree.MathNode(\"semantics\", [wrapper, annotation]);\n var math = new mathMLTree.MathNode(\"math\", [semantics]); // You can't style <math> nodes, so we wrap the node in a span.\n // NOTE: The span class is not typed to have <math> nodes as children, and\n // we don't want to make the children type more generic since the children\n // of span are expected to have more fields in `buildHtml` contexts.\n // $FlowFixMe\n\n return buildCommon.makeSpan([\"katex-mathml\"], [math]);\n}", "function buildMathML(tree, texExpression, options) {\n var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly, unless it's a single <mrow> or <mtable>.\n\n var wrapper;\n\n if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains([\"mrow\", \"mtable\"], expression[0].type)) {\n wrapper = expression[0];\n } else {\n wrapper = new mathMLTree.MathNode(\"mrow\", expression);\n } // Build a TeX annotation of the source\n\n\n var annotation = new mathMLTree.MathNode(\"annotation\", [new mathMLTree.TextNode(texExpression)]);\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n var semantics = new mathMLTree.MathNode(\"semantics\", [wrapper, annotation]);\n var math = new mathMLTree.MathNode(\"math\", [semantics]); // You can't style <math> nodes, so we wrap the node in a span.\n // NOTE: The span class is not typed to have <math> nodes as children, and\n // we don't want to make the children type more generic since the children\n // of span are expected to have more fields in `buildHtml` contexts.\n // $FlowFixMe\n\n return buildCommon.makeSpan([\"katex-mathml\"], [math]);\n}", "function buildMathML(tree, texExpression, options) {\n var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly, unless it's a single <mrow> or <mtable>.\n\n var wrapper;\n\n if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains([\"mrow\", \"mtable\"], expression[0].type)) {\n wrapper = expression[0];\n } else {\n wrapper = new mathMLTree.MathNode(\"mrow\", expression);\n } // Build a TeX annotation of the source\n\n\n var annotation = new mathMLTree.MathNode(\"annotation\", [new mathMLTree.TextNode(texExpression)]);\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n var semantics = new mathMLTree.MathNode(\"semantics\", [wrapper, annotation]);\n var math = new mathMLTree.MathNode(\"math\", [semantics]); // You can't style <math> nodes, so we wrap the node in a span.\n // NOTE: The span class is not typed to have <math> nodes as children, and\n // we don't want to make the children type more generic since the children\n // of span are expected to have more fields in `buildHtml` contexts.\n // $FlowFixMe\n\n return buildCommon.makeSpan([\"katex-mathml\"], [math]);\n}", "function buildMathML(tree, texExpression, options) {\n var expression = buildExpression(tree, options);\n\n // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly.\n var wrapper = new _mathMLTree2.default.MathNode(\"mrow\", expression);\n\n // Build a TeX annotation of the source\n var annotation = new _mathMLTree2.default.MathNode(\"annotation\", [new _mathMLTree2.default.TextNode(texExpression)]);\n\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n\n var semantics = new _mathMLTree2.default.MathNode(\"semantics\", [wrapper, annotation]);\n\n var math = new _mathMLTree2.default.MathNode(\"math\", [semantics]);\n\n // You can't style <math> nodes, so we wrap the node in a span.\n return _buildCommon2.default.makeSpan([\"katex-mathml\"], [math]);\n}", "function babelMacro(transform) {\n const configName = transform.name;\n return createMacro(\n function effectfulMacro({ references, state, babel, config: args }) {\n Object.assign(config, args, { babel });\n if (references.default && references.default.length)\n config.preprocNS = references.default[0].node.name;\n if (config.macroAdapt !== false) {\n if (config.detectRT) {\n if (!config.importRT) config.importRT = config.detectRT;\n config.detectRT = null;\n }\n }\n run(transform, state);\n },\n { configName }\n );\n}", "static of(token, stx) {\n\t return new Syntax(token, stx);\n\t }", "function expandMacros(src, macros, opts) {\n var expansion_count = 0;\n\n // By the time we call this function `expandMacros` we MUST have expanded and cached all macros already!\n // Hence things should be easy in there:\n\n function expandAllMacrosInSet(s) {\n var i, m, x;\n\n // process *all* the macros inside [...] set:\n if (s.indexOf('{') >= 0) {\n for (i in macros) {\n if (macros.hasOwnProperty(i)) {\n m = macros[i];\n\n var a = s.split('{' + i + '}');\n if (a.length > 1) {\n var x = m.in_set;\n\n assert(x);\n if (x instanceof Error) {\n // this turns out to be an macro with 'issues' and it is used, so the 'issues' do matter: bombs away!\n throw x;\n }\n\n // detect definition loop:\n if (x === false) {\n return new Error('Macro name \"' + i + '\" has an illegal, looping, definition, i.e. it\\'s definition references itself, either directly or indirectly, via other macros.');\n }\n\n s = a.join(x);\n expansion_count++;\n }\n\n // stop the brute-force expansion attempt when we done 'em all:\n if (s.indexOf('{') === -1) {\n break;\n }\n }\n }\n }\n\n return s;\n }\n\n function expandAllMacrosElsewhere(s) {\n var i, m, x;\n\n // When we process the main macro occurrences in the regex\n // every macro used in a lexer rule will become its own capture group.\n //\n // Meanwhile the cached expansion will expand any submacros into\n // *NON*-capturing groups so that the backreference indexes remain as you'ld\n // expect and using macros doesn't require you to know exactly what your\n // used macro will expand into, i.e. which and how many submacros it has.\n //\n // This is a BREAKING CHANGE from vanilla jison 0.4.15!\n if (s.indexOf('{') >= 0) {\n for (i in macros) {\n if (macros.hasOwnProperty(i)) {\n m = macros[i];\n\n var a = s.split('{' + i + '}');\n if (a.length > 1) {\n // These are all main macro expansions, hence CAPTURING grouping is applied:\n x = m.elsewhere;\n assert(x);\n\n // detect definition loop:\n if (x === false) {\n return new Error('Macro name \"' + i + '\" has an illegal, looping, definition, i.e. it\\'s definition references itself, either directly or indirectly, via other macros.');\n }\n\n s = a.join('(' + x + ')');\n expansion_count++;\n }\n\n // stop the brute-force expansion attempt when we done 'em all:\n if (s.indexOf('{') === -1) {\n break;\n }\n }\n }\n }\n\n return s;\n }\n\n\n // When we process the macro occurrences in the regex\n // every macro used in a lexer rule will become its own capture group.\n //\n // Meanwhile the cached expansion will have expanded any submacros into\n // *NON*-capturing groups so that the backreference indexes remain as you'ld\n // expect and using macros doesn't require you to know exactly what your\n // used macro will expand into, i.e. which and how many submacros it has.\n //\n // This is a BREAKING CHANGE from vanilla jison 0.4.15!\n var s2 = reduceRegex(src, null, opts, expandAllMacrosInSet, expandAllMacrosElsewhere);\n // propagate deferred exceptions = error reports.\n if (s2 instanceof Error) {\n throw s2;\n }\n\n // only when we did expand some actual macros do we take the re-interpreted/optimized/regenerated regex from reduceRegex()\n // in order to keep our test cases simple and rules recognizable. This assumes the user can code good regexes on his own,\n // as long as no macros are involved...\n //\n // Also pick the reduced regex when there (potentially) are XRegExp extensions in the original, e.g. `\\\\p{Number}`,\n // unless the `xregexp` output option has been enabled.\n if (expansion_count > 0 || (src.indexOf('\\\\p{') >= 0 && !opts.options.xregexp)) {\n src = s2;\n } else {\n // Check if the reduced regex is smaller in size; when it is, we still go with the new one!\n if (s2.length < src.length) {\n src = s2;\n }\n }\n\n return src;\n}", "function tokenToAction(token) {\n var word = token.value;\n var definition = context.dictionary.lookup(word);\n\n if (token.isStringLiteral) {\n return namedFunction(\"String: \" + word, function (context) {\n return word;\n });\n }\n // TODO: contributed part on StringPushLiteral s\" (TODO make PR)\n else if (token.isStringPushLiteral) {\n return namedFunction(\"PushString: \" + word, function (context) {\n context.stack.push(word);\n });\n }\n // TODO: contributed part on NeoSyscallLiteral syscall\" (TODO: do not make PR, think on something better...)\n else if (token.isNeoSyscallLiteral) {\n\n if(word == \"Neo.Learn.Call\") { // special syscall \n var execAction = context.stack.pop();\n var definedAction = context.dictionary.lookup(execAction);\n return definedAction; // TODO\n }\n else \n return namedFunction(\"NeoSyscallString: \" + word, function (context) {\n invokeNeoSyscall(word);\n /*\n if(sname == \"Neo.Learn.Execute\") // special syscall \n {\n // invoke tokenizer on read string\n // ????????? TODO\n var str = context.stack.pop();\n next(str);\n }*/\n // TODO: Neo Syscall!!\n\n });\n } \n else if (definition !== null) {\n return definition;\n } else if (isFinite(word)) {\n return namedFunction(\"Number: \" + word, function (context) {\n context.stack.push(+word);\n });\n } else {\n throw new MissingWordError(word);\n }\n\n return function () {\n return \"\";\n };\n }", "function expandMacros(src, macros, opts) {\n var expansion_count = 0;\n\n // By the time we call this function `expandMacros` we MUST have expanded and cached all macros already!\n // Hence things should be easy in there:\n\n function expandAllMacrosInSet(s) {\n var i, m, x;\n\n // process *all* the macros inside [...] set:\n if (s.indexOf('{') >= 0) {\n for (i in macros) {\n if (macros.hasOwnProperty(i)) {\n m = macros[i];\n\n var a = s.split('{' + i + '}');\n if (a.length > 1) {\n x = m.in_set;\n\n assert(x);\n if (x instanceof Error) {\n // this turns out to be an macro with 'issues' and it is used, so the 'issues' do matter: bombs away!\n throw x;\n }\n\n // detect definition loop:\n if (x === false) {\n return new Error('Macro name \"' + i + '\" has an illegal, looping, definition, i.e. it\\'s definition references itself, either directly or indirectly, via other macros.');\n }\n\n s = a.join(x);\n expansion_count++;\n }\n\n // stop the brute-force expansion attempt when we done 'em all:\n if (s.indexOf('{') === -1) {\n break;\n }\n }\n }\n }\n\n return s;\n }\n\n function expandAllMacrosElsewhere(s) {\n var i, m, x;\n\n // When we process the main macro occurrences in the regex\n // every macro used in a lexer rule will become its own capture group.\n //\n // Meanwhile the cached expansion will expand any submacros into\n // *NON*-capturing groups so that the backreference indexes remain as you'ld\n // expect and using macros doesn't require you to know exactly what your\n // used macro will expand into, i.e. which and how many submacros it has.\n //\n // This is a BREAKING CHANGE from vanilla jison 0.4.15!\n if (s.indexOf('{') >= 0) {\n for (i in macros) {\n if (macros.hasOwnProperty(i)) {\n m = macros[i];\n\n var a = s.split('{' + i + '}');\n if (a.length > 1) {\n // These are all main macro expansions, hence CAPTURING grouping is applied:\n x = m.elsewhere;\n assert(x);\n\n // detect definition loop:\n if (x === false) {\n return new Error('Macro name \"' + i + '\" has an illegal, looping, definition, i.e. it\\'s definition references itself, either directly or indirectly, via other macros.');\n }\n\n s = a.join('(' + x + ')');\n expansion_count++;\n }\n\n // stop the brute-force expansion attempt when we done 'em all:\n if (s.indexOf('{') === -1) {\n break;\n }\n }\n }\n }\n\n return s;\n }\n\n // When we process the macro occurrences in the regex\n // every macro used in a lexer rule will become its own capture group.\n //\n // Meanwhile the cached expansion will have expanded any submacros into\n // *NON*-capturing groups so that the backreference indexes remain as you'ld\n // expect and using macros doesn't require you to know exactly what your\n // used macro will expand into, i.e. which and how many submacros it has.\n //\n // This is a BREAKING CHANGE from vanilla jison 0.4.15!\n var s2 = reduceRegex(src, null, opts, expandAllMacrosInSet, expandAllMacrosElsewhere);\n // propagate deferred exceptions = error reports.\n if (s2 instanceof Error) {\n throw s2;\n }\n\n // only when we did expand some actual macros do we take the re-interpreted/optimized/regenerated regex from reduceRegex()\n // in order to keep our test cases simple and rules recognizable. This assumes the user can code good regexes on his own,\n // as long as no macros are involved...\n //\n // Also pick the reduced regex when there (potentially) are XRegExp extensions in the original, e.g. `\\\\p{Number}`,\n // unless the `xregexp` output option has been enabled.\n if (expansion_count > 0 || src.indexOf('\\\\p{') >= 0 && !opts.options.xregexp) {\n src = s2;\n } else {\n // Check if the reduced regex is smaller in size; when it is, we still go with the new one!\n if (s2.length < src.length) {\n src = s2;\n }\n }\n\n return src;\n}", "function buildMathML(tree, texExpression, options) {\n var expression = buildExpression(tree, options);\n\n // Wrap up the expression in an mrow so it is presented in the semantics\n // tag correctly.\n var wrapper = new __WEBPACK_IMPORTED_MODULE_2__mathMLTree__[\"a\" /* default */].MathNode(\"mrow\", expression);\n\n // Build a TeX annotation of the source\n var annotation = new __WEBPACK_IMPORTED_MODULE_2__mathMLTree__[\"a\" /* default */].MathNode(\"annotation\", [new __WEBPACK_IMPORTED_MODULE_2__mathMLTree__[\"a\" /* default */].TextNode(texExpression)]);\n\n annotation.setAttribute(\"encoding\", \"application/x-tex\");\n\n var semantics = new __WEBPACK_IMPORTED_MODULE_2__mathMLTree__[\"a\" /* default */].MathNode(\"semantics\", [wrapper, annotation]);\n\n var math = new __WEBPACK_IMPORTED_MODULE_2__mathMLTree__[\"a\" /* default */].MathNode(\"math\", [semantics]);\n\n // You can't style <math> nodes, so we wrap the node in a span.\n return __WEBPACK_IMPORTED_MODULE_0__buildCommon__[\"a\" /* default */].makeSpan([\"katex-mathml\"], [math]);\n}", "tokenBefore(types) {\n let token = language.syntaxTree(this.state).resolveInner(this.pos, -1);\n while (token && types.indexOf(token.name) < 0)\n token = token.parent;\n return token ? { from: token.from, to: this.pos,\n text: this.state.sliceDoc(token.from, this.pos),\n type: token.type } : null;\n }", "function parserCaller(molvi, stick) {\n\n var molV = molvi;\n var rootAdd = true;\n\n function parser(term) {\n var stack = term.content, current, termout = {}, iLeftAbs = 0, iRightAbs = 0, iMiddleAbs = 0;\n var rootAddCurrent;\n rootAddCurrent = rootAdd;\n current = stack[term.left];\n \n while (current !== op.eof) {\n if (isVar(current)) {\n iRightAbs = term.right + term.absolute;\n molV += \"FRIN \" + current + \" \" + iRightAbs + \"^\";\n term.right += 1;\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.bof || current == op.eof) {\n term.right += 1;\n term.left= term.right;\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.lparen) {\n term.middle = term.right;\n termout.left = 0;\n termout.middle = 0;\n termout.right = 0; \n termout.absolute = term.right + term.absolute;\n termout.content = [op.bof];\n term.right +=1;\n var parens = 1;\n while (parens > 0) {\n if (stack[term.right] == op.lparen) {\n parens +=1;\n } else if (stack[term.right] == op.rparen) {\n parens = parens - 1;\n }\n if (parens > 0) {\n termout.content.push(stack[term.right]);\n }\n term.right +=1;\n }\n termout.content.push(op.eof);\n parser(termout);\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.lambda) { \n term.middle = term.right + 1;\n var next = stack[term.middle];\n iMiddleAbs = term.middle + term.absolute;\n if (isVar(next)) {\n molV += \"FROUT \" + next + \" \" + iMiddleAbs + \"^\";\n term.left = term.middle + 1;\n if (stack[term.left] == op.dot) {\n iLeftAbs = term.left + term.absolute;\n iRightAbs = term.right + term.absolute;\n molV += \"L \" + iLeftAbs + \" \" + iMiddleAbs + \" \" + iRightAbs + \"^\";\n term.left = term.left - 2;\n term.right = term.right + 2;\n termout.left = 0;\n termout.middle = 0;\n termout.right = 0; \n termout.absolute = term.right + term.absolute;\n termout.content = [op.bof];\n term.right +=1;\n while (stack[term.right] !== op.eof) {\n termout.content.push(stack[term.right]);\n term.right +=1;\n }\n termout.content.push(op.eof);\n parser(termout);\n term.middle = term.right;\n current = stack[term.right];\n } else {\n errorsline = \"Not a variable in lambda: \\\"\\\\\" + next + \" \" + stack[term.middle] + stack[term.left] + \"\\\"\";\n document.getElementById(\"errors\").innerHTML += errorsline;\n throw \"Not a variable in lambda: \\\"\\\\\" + next + \" \" + stack[term.middle] + stack[term.left] + \"\\\"\";\n } \n } else {\n errorsline = \"Not a variable in lambda: \\\"\\\\\" + stack[term.middle] + \"\\\"\";\n document.getElementById(\"errors\").innerHTML += errorsline;\n throw \"Not a variable in lambda: \\\"\\\\\" + stack[term.middle] + \"\\\"\";\n }\n } else if (current == op.app) {\n term.middle = term.right;\n iLeftAbs = term.left+ term.absolute;\n term.middle +=1;\n if (stack[term.middle] == op.lambda) {\n var itempo = term.right + term.absolute;\n if (rootAdd) {\n molV += \"Arrow\" + \" \" + itempo + \" \" + term.absolute + \"^\";} \n rootAddCurrent = false;\n } \n iMiddleAbs = term.middle + term.absolute;\n iRightAbs = term.right + term.absolute;\n molV += \"A \" + iLeftAbs + \" \" + iMiddleAbs + \" \" + iRightAbs + \"^\";\n term.left = term.right;\n term.right = term.middle; \n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.eof) {\n iRightAbs = term.right + term.absolute;\n molV += \"Arrow\" + iRightAbs + \" \" + term.absolute + \"^\";\n current = stack[term.right];\n }\n }\n iLeftAbs = term.left + term.absolute;\n if (rootAddCurrent) {\n molV += \"Arrow\" + \" \" + iLeftAbs + \" \" + term.absolute + \"^\";}\n }\n\n parser(stick);\n return molV;\n}", "function syntaxTree(state) {\n let field = state.field(Language.state, false);\n return field ? field.tree : common.Tree.empty;\n}", "function createMacro(message,match,command) {\r\n let regEx = new RegExp(command.pattern);\r\n let matches = regEx.exec(match);\r\n\r\n let alias = matches[1];\r\n let commandList = matches[2];\r\n let macroString = matches[3];\r\n\r\n // Parse the command list to an object\r\n let regExSub = new RegExp(command.subpattern);\r\n let inputDef = regExSub.exec(commandList);\r\n\r\n let defaultInputs = {};\r\n while (inputDef) {\r\n defaultInputs[inputDef[1]] = inputDef[2] ? inputDef[2] : '0';\r\n inputDef = regExSub.exec(commandList);\r\n }\r\n\r\n // Save that as the macro function\r\n let activeGame = getGameMode(message);\r\n let channelId = message.channel.id;\r\n let userId = message.author.id;\r\n ensureUser(channelId,activeGame,userId);\r\n\r\n bot.channel[channelId].game[activeGame].user[userId].macro[alias] = {\r\n defaultInputs: defaultInputs,\r\n body: macroString\r\n }\r\n saveBotData();\r\n message.reply('created/updated macro with alias \"' + alias + '\"');\r\n}", "function parse(nextToken){\r\n\t//current token\r\n\tvar type,word; //NOTE: word is only update right after next()ing. don't rely on it laaaaater\r\n\t//stored tokens\r\n\tvar newType,newWord;\r\n\t//keep track of stored tokens\r\n\tvar readNext=1;\r\n\t//false=not, 1=no paren, 2=()\r\n\tvar defType=false,nextDefCommon=false,defs={};\r\n\t\r\n\tvar blocks=[];\r\n\tvar current={};\r\n\tvar currentBlocks=[];\r\n\t\r\n\tfunction startBlock(){\r\n\t\tcurrent.code=[];\r\n\t\tcurrent.line=lineNumber;\r\n\t\tcurrentBlocks.push(current);\r\n\t\tcurrent={};\r\n\t}\r\n\tfunction endBlock(){\r\n\t\tvar block=currentBlocks.pop();\r\n\t\tcurrentBlocks[currentBlocks.length-1].code.push(block);\r\n\t}\r\n\tfunction endDef(){\r\n\t\tvar block=currentBlocks.pop();\r\n\t\tdefs[block.name]=block;\r\n\t}\r\n\t\r\n\tvar ifThisLine=false,codeAfterThen;\r\n\t//var nextFunctionGetsOneMore=0;\r\n\tvar expr=[];\r\n\t\r\n\tcurrent.type=\"main\";\r\n\tstartBlock();\r\n\t\r\n\tdo{\r\n\t\ttry{\r\n\t\t\treadStatement();\r\n\t\t}catch(error){\r\n\t\t\tif(error.name===\"ParseError\"){\r\n\t\t\t\treturn error.message+\" on line \"+lineNumber;\r\n\t\t\t//bad error!!!\r\n\t\t\t}else{\r\n\t\t\t\tthrow error;\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t}while(type!==\"eof\");;;\r\n\t\r\n\t//read a \"line\" of code\r\n\tfunction readStatement(){\r\n\t\tnext();\r\n\t\tif(type!=\"comment\" && ifThisLine && type!=\"linebreak\")\r\n\t\t\tcodeAfterThen=true;\r\n\t\tswitch(type){\r\n\t\t\t//keywords with no arguments\r\n\t\t\tcase \"BREAK\":\r\n\t\t\t\tcurrent.type=\"BREAK\";\r\n\t\t\t\tcurrent.levels=readExpression();\r\n\t\t\tbreak;case \"CONTINUE\":\r\n\t\t\t\tcurrent.type=\"CONTINUE\";\r\n\t\t\t\tcurrent.levels=readExpression();\r\n\t\t\tbreak;case \"ELSE\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tif(currentType===\"CASE\"){\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\t\tcurrent.type=\"CASE\";\r\n\t\t\t\t\tstartBlock();\r\n\t\t\t\t}else{\r\n\t\t\t\t\tassert(currentBlock().type===\"IF\"||currentBlock().type===\"ELSEIF\",\"ELSE without IF\");\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\t\tcurrent.type=\"ELSE\";\r\n\t\t\t\t\tstartBlock();\r\n\t\t\t\t}\r\n\t\t\tbreak;case \"ENDSWITCH\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tif(currentType===\"CASE\")\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\telse\r\n\t\t\t\t\tassert(currentType===\"SWITCH\",\"ENDSW without SWITCH\");\r\n\t\t\t\tendBlock();\r\n\t\t\tbreak;case \"ENDIF\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tassert(currentType===\"IF\" || currentType===\"ELSE\" || currentType===\"ELSEIF\",\"ENDIF without IF\");\r\n\t\t\t\tendBlock();\r\n\t\t\t\tifThisLine=false;\r\n\t\t\tbreak;case \"SWITCH\":\r\n\t\t\t\tcurrent.type=\"SWITCH\"\r\n\t\t\t\tassert(current.condition=readExpression(),\"Missing argument to keyword\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"CASE\":\r\n\t\t\t\tvar currentType=currentBlock().type\r\n\t\t\t\tif(currentType===\"CASE\")\r\n\t\t\t\t\tendBlock();\r\n\t\t\t\telse\r\n\t\t\t\t\tassert(currentType===\"SWITCH\",\"invalid CASE\");\r\n\t\t\t\tcurrent.type=\"CASE\"\r\n\t\t\t\tassert(current.conditions=readList(readExpression),\"Missing argument to keyword\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"STOP\":\r\n\t\t\t\tcurrent.type=\"STOP\";\r\n\t\t\tbreak;case \"REPEAT\":\r\n\t\t\t\tcurrent.type=\"REPEAT\";\r\n\t\t\t\tstartBlock();\r\n\t\t\t//SWAP\r\n\t\t\tbreak;case \"SWAP\":\r\n\t\t\t\tcurrent.type=\"SWAP\";\r\n\t\t\t\tassert(current.variable=readVariable(),\"Missing variable in SWAP\");\r\n\t\t\t\tassert(readToken(\",\"),\"Missing comma in SWAP\");\r\n\t\t\t\tassert(current.variable2=readVariable(),\"Missing variable in SWAP\");\r\n\t\t\t//IF, ELSEIF\r\n\t\t\tbreak;case \"ELSEIF\":\r\n\t\t\t\tassert(currentBlock().type==\"IF\"||currentBlock().type==\"ELSEIF\",\"ELSEIF without IF\");\r\n\t\t\t\tendBlock();\r\n\t\t\t\tcurrent.type=\"ELSEIF\"\r\n\t\t\t\tcurrent.condition=readExpression();\r\n\t\t\t\tassert(readToken(\"THEN\"),\"ELSEIF without THEN\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"IF\":\r\n\t\t\t\tcurrent.type=\"IF\"\r\n\t\t\t\tassert(current.condition=readExpression(),\"Missing IF condition\");\r\n\t\t\t\tassert(readToken(\"THEN\"),\"IF without THEN\");\r\n\t\t\t\tstartBlock();\r\n\t\t\t\tifThisLine=true;\r\n\t\t\t\tcodeAfterThen=false;\r\n\t\t\t//FOR\r\n\t\t\tbreak;case \"FOR\":\r\n\t\t\t\tcurrent.type=\"FOR\";\r\n\t\t\t\tassert(current.variable=readVariable(),\"Missing FOR variable\");\r\n\t\t\t\tassert(readToken(\"=\"),\"Missing = in FOR\");\r\n\t\t\t\tcurrent.start=readExpression();\r\n\t\t\t\tassert(readToken(\"word\") && word===\"TO\",\"Missing TO in FOR\");\r\n\t\t\t\tcurrent.end=readExpression();\r\n\t\t\t\tif(readToken(\"word\") && word===\"STEP\")\r\n\t\t\t\t\tcurrent.step=readExpression();\r\n\t\t\t\telse\r\n\t\t\t\t\treadNext=0; //heck\r\n\t\t\t\tstartBlock();\r\n\t\t\t//WHILE <condition>\r\n\t\t\tbreak;case \"WHILE\":\r\n\t\t\t\tcurrent.type=\"WHILE\"\r\n\t\t\t\tassert(current.condition=readExpression(),\"Missing argument to keyword\");\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"WEND\":\r\n\t\t\t\tassert(currentBlock().type==\"WHILE\",\"WEND without WHILE\");\r\n\t\t\t\tendBlock();\r\n\t\t\t//do/LOOP\r\n\t\t\tbreak;case \"DO\":\r\n\t\t\t\tcurrent.type=\"DO\"\r\n\t\t\t\tstartBlock();\r\n\t\t\tbreak;case \"LOOP\":\r\n\t\t\t\tassert(currentBlock().type==\"DO\",\"LOOP without DO\");\r\n\t\t\t\tendBlock();\r\n\t\t\t//UNTIL <condition>\r\n\t\t\tbreak;case \"UNTIL\":\r\n\t\t\t\tassert(currentBlock().type==\"REPEAT\",\"UNTIL without REPEAT\");\r\n\t\t\t\tassert(currentBlock().condition=readExpression(),\"Missing UNTIL condition\");\r\n\t\t\t\tendBlock();\r\n\t\t\t//NEXT\r\n\t\t\tbreak;case \"NEXT\":\r\n\t\t\t\tassert(currentBlock().type==\"FOR\",\"NEXT without FOR\");\r\n\t\t\t\treadExpression();\r\n\t\t\t\tendBlock();\r\n\t\t\t//OUT/THEN\r\n\t\t\tbreak;case \"OUT\":case \"THEN\":\r\n\t\t\t\tassert(false,\"Illegal OUT/THEN\");\r\n\t\t\t//other words\r\n\t\t\tbreak;case \"word\":\r\n\t\t\t\t//var name=text;\r\n\t\t\t\treadNext=readNext-1;\r\n\t\t\t\tvar x=readVariable(true);\r\n\t\t\t\tif(readToken(\"=\")){\r\n\t\t\t\t\tcurrent.type=\"assignment\";\r\n\t\t\t\t\tcurrent.variable=x;\r\n\t\t\t\t\tassert(current.value=readExpression(),\"Missing value in assignment\");\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcurrent.type=\"function\";\r\n\t\t\t\t\tcurrent.name=x.name;\r\n\t\t\t\t\tcurrent.inputs=readList(readExpression);\r\n\t\t\t\t\tif(readToken(\"OUT\"))\r\n\t\t\t\t\t\tcurrent.outputs=readList(readVariable);\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tcurrent.outputs=[];\r\n\t\t\t\t}\r\n\t\t\t//comment\r\n\t\t\tbreak;case \"comment\":\r\n\t\t\t//colon NOP\r\n\t\t\tbreak;case \":\":\r\n\t\t\t//line break, end\r\n\t\t\tbreak;case \"eof\":\r\n\t\t\tcase \"linebreak\":\r\n\t\t\t\tif(ifThisLine){\r\n\t\t\t\t\tifThisLine=false;\r\n\t\t\t\t\tif(codeAfterThen){\r\n\t\t\t\t\t\tendBlock();\r\n\t\t\t\t\t\tconsole.log(\"ended single line IF\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\tbreak;default:\r\n\t\t\t\tassert(false,\"Expected statement, got \"+type+\" '\"+word+\"'\");\r\n\t\t}\r\n\t\tif(current.type){\r\n\t\t\tcurrent.line=lineNumber;\r\n\t\t\tcurrentBlocks[currentBlocks.length-1].code.push(current)//push to current block!\r\n\t\t\tcurrent={}\r\n\t\t}\r\n\t}\r\n\t\r\n\tfunction currentBlock(){\r\n\t\treturn currentBlocks[currentBlocks.length-1]\r\n\t}\r\n\t\r\n\t//check if next token is of a specific type\r\n\tfunction peekToken(wantedType){\r\n\t\tvar prevType=type,prevWord=word;\r\n\t\tnext();\r\n\t\treadNext=-1;\r\n\t\tnewType=type;\r\n\t\tnewWord=word;\r\n\t\ttype=prevType;\r\n\t\tword=prevWord;\r\n\t\treturn newType===wantedType;\r\n\t}\r\n\t//check if next token is of a specific type\r\n\tfunction peekWord(wantedWord){\r\n\t\tvar prevType=type,prevWord=word;\r\n\t\tnext();\r\n\t\treadNext=-1;\r\n\t\tnewType=type;\r\n\t\tnewWord=word;\r\n\t\ttype=prevType;\r\n\t\tword=prevWord;\r\n\t\treturn newType===\"word\" && newWord.trimLeft().toUpperCase()===wantedWord;\r\n\t}\r\n\t\r\n\t//Try to read a specific token\r\n\tfunction readToken(wantedType){\r\n\t\tnext();\r\n\t\tif(type===wantedType){\r\n\t\t\treadNext=1;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treadNext=0;\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t//Read list\r\n\t//reader: function to read item (readExpression etc.)\r\n\t//noNull: throw an error if a null value is found\r\n\tfunction readList(reader){\r\n\t\tvar ret=[];\r\n\t\tvar x=reader();\r\n\t\tif(x)\r\n\t\t\tret.push(x);\r\n\t\tif(readToken(\",\",\"\")){\r\n\t\t\tassert(x,\"Null value not allowed\");\r\n\t\t\tdo\r\n\t\t\t\tassert(ret.push(reader()),\"Null value not allowed\");\r\n\t\t\twhile(readToken(\",\"));;;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\t\r\n\tfunction readList2(reader){\r\n\t\tvar ret=[];\r\n\t\tvar x=reader();\r\n\t\tif(x)\r\n\t\t\tret.push(x);\r\n\t\tif(readToken(\",\",\"\")&&expr.push({type:\"comma\"})){\r\n\t\t\tassert(x,\"Null value not allowed\");\r\n\t\t\tdo\r\n\t\t\t\tassert(ret.push(reader()),\"Null value not allowed\");\r\n\t\t\twhile(readToken(\",\")&&expr.push({type:\"comma\"}));;;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\t\r\n\t//read normal expression\r\n\t//SHould return RPN list\r\n\tfunction readExpression(){\r\n\t\texpr=[];\r\n\t\t//var rpn=[],stack=[];\r\n\t\t//rpn parse tokens as they are read?\r\n\t\tif(readExpression2())\r\n\t\t\treturn rpnFromExpr(expr);\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\tfunction prec(token){\r\n\t\tif(token.type===\"unary\" || token.type===\"comma\")\r\n\t\t\treturn Infinity;\r\n\t\telse\r\n\t\t\tswitch(token.name){\r\n\t\t\t\tcase \"^\":\r\n\t\t\t\t\treturn 11;\r\n\t\t\t\tcase \"*\":case \"/\": case \"\\\\\": case \"%\":\r\n\t\t\t\t\treturn 10;\r\n\t\t\t\tcase \"+\":case \"-\":\r\n\t\t\t\t\treturn 9;\r\n\t\t\t\tcase \"<<\":case \">>\":\r\n\t\t\t\t\treturn 8;\r\n\t\t\t\tcase \"<\":case \"<=\":case \">\":case \">=\":\r\n\t\t\t\t\treturn 7;\r\n\t\t\t\tcase \"==\":case \"!=\":\r\n\t\t\t\t\treturn 6;\r\n\t\t\t\tcase \"&\":\r\n\t\t\t\t\treturn 5;\r\n\t\t\t\tcase \"~\":\r\n\t\t\t\t\treturn 4;\r\n\t\t\t\tcase \"|\":\r\n\t\t\t\t\treturn 3;\r\n\t\t\t\tcase \"AND\":\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\tcase \"OR\":\r\n\t\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\tconsole.log(token);\r\n\t\tassert(false,\"error prec \"+token.name);\r\n\t}\r\n\tfunction left(token){\r\n\t\treturn 0\r\n\t}\r\n\t\r\n\tfunction rpnFromExpr(expr){\r\n\t\tconsole.log({...expr},\"expr\");\r\n\t\tvar rpn=[],stack=[];\r\n\t\tfor(var i=0;i<expr.length;i++){\r\n\t\t\tvar token=expr[i];\r\n\t\t\tswitch(token.type){\r\n\t\t\t\tcase \"number\":case \"string\":case \"variable\":case \"function\":case \"array\": //see, functions are actually pushed AFTER their arguments, so we can just send them directly to the output! :D\r\n\t\t\t\t\trpn.push(token);\r\n\t\t\t\tbreak;case \"operator\":case \"unary\":\r\n\t\t\t\t\twhile(stack.length){\r\n\t\t\t\t\t\tvar top=stack[stack.length-1]\r\n\t\t\t\t\t\t//console.log(top)\r\n\t\t\t\t\t\tif(top.type!=\"(\"&&(prec(top)>=prec(token) || (prec(top)==prec(token) && left(token)))){\r\n\t\t\t\t\t\t\trpn.push(stack.pop());\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstack.push(token);\r\n\t\t\t\tbreak;case \"comma\":\r\n\t\t\t\t\twhile(stack.length){\r\n\t\t\t\t\t\tvar top=stack[stack.length-1]\r\n\t\t\t\t\t\t//console.log(top)\r\n\t\t\t\t\t\tif(top.type!=\"(\"){\r\n\t\t\t\t\t\t\trpn.push(stack.pop());\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\tbreak;case \"(\":\r\n\t\t\t\t\tstack.push(token);\r\n\t\t\t\tbreak;case \")\":\r\n\t\t\t\t\twhile(1){\r\n\t\t\t\t\t\tvar top=stack[stack.length-1]\r\n\t\t\t\t\t\tif(top.type!=\"(\")\r\n\t\t\t\t\t\t\trpn.push(stack.pop());\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstack.pop();\r\n\t\t\t\tbreak;default:\r\n\t\t\t\tassert(false,\"error typ \"+token.type)\r\n\t\t\t}\r\n\t\t}\r\n\t\twhile(stack.length)\r\n\t\t\trpn.push(stack.pop());\r\n\t\treturn rpn;\r\n\t}\r\n\t\r\n\tfunction readExpression2(){\r\n\t\tvar ret=false;\r\n\t\tnext();\r\n\t\tswitch(type){\r\n\t\t\t//function or variable\r\n\t\t\tcase \"word\":\r\n\t\t\t\tvar name=word;\r\n\t\t\t\tif(readToken(\"(\")){\r\n\t\t\t\t\texpr.push({type:\"(\"}); //all we needed!\r\n\t\t\t\t\tvar x=readList2(readExpression2);\r\n\t\t\t\t\tassert(readToken(\")\"),\"Missing \\\")\\\" in function call\");\r\n\t\t\t\t\texpr.push({type:\")\"});\r\n\t\t\t\t\texpr.push({type:\"function\",name:name,args:x.length});\r\n\t\t\t\t}else\r\n\t\t\t\t\texpr.push({type:\"variable\",name:name});\r\n\t\t\t//number literals\r\n\t\t\tbreak;case \"number\":\r\n\t\t\t\texpr.push({type:\"number\",value:word});\r\n\t\t\t//string/label\r\n\t\t\tbreak;case \"string\":\r\n\t\t\t\texpr.push({type:\"string\",value:word});\r\n\t\t\t//operator (unary)\r\n\t\t\tbreak;case \"unary\":case \"minus\":case \"xor\":\r\n\t\t\t\t//unary op\r\n\t\t\t\texpr.push({type:\"unary\",name:word,args:1});\r\n\t\t\t\t//expr.push({type:\"(\"}); //actual fear\r\n\t\t\t\tassert(readExpression2(),\"Missing operator argument\");\r\n\t\t\t\t//expr.push({type:\")\"});\r\n\t\t\t\t\r\n\t\t\t//open parenthesis\r\n\t\t\tbreak;case \"(\":\r\n\t\t\t\texpr.push({type:\"(\"});\r\n\t\t\t\treadExpression2();\r\n\t\t\t\tassert(readToken(\")\"),\"Missing \\\")\\\"\");\r\n\t\t\t\texpr.push({type:\")\"});\r\n\t\t\tbreak;case \"[\":\r\n\t\t\t\texpr.push({type:\"(\"});\r\n\t\t\t\tvar x=readList2(readExpression2);\r\n\t\t\t\texpr.push({type:\"array\",args:x.length});\r\n\t\t\t\tassert(readToken(\"]\"),\"Missing \\\"]\\\"\");\r\n\t\t\t\texpr.push({type:\")\"});\r\n\t\t\t\t\r\n\t\t\t//other crap\r\n\t\t\tbreak;default:\r\n\t\t\t\treadNext=0;\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\twhile(readToken(\"dot\")){\r\n\t\t\tassert(readToken(\"word\"),\"Dot missing function\");\r\n\t\t\tvar name=word;\r\n\t\t\tassert(readToken(\"(\"),\"Dot missing function\");\r\n\t\t\texpr.push({type:\"(\"}); //all we needed!\r\n\t\t\tvar x=readList2(readExpression2);\r\n\t\t\tassert(readToken(\")\"),\"Missing \\\")\\\" in function call\");\r\n\t\t\texpr.push({type:\")\"});\r\n\t\t\texpr.push({type:\"function\",name:name,args:x.length+1});\r\n\t\t}\r\n\t\t//read infix operators\r\n\t\t//this might have to be WHILE not IF\r\n\t\tif(readToken(\"operator\")||readToken(\"minus\")||readToken(\"xor\")){\r\n\t\t\texpr.push({type:\"operator\",name:word,args:2});\r\n\t\t\tassert(readExpression2(),\"Operator missing second argument\");\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t//read function definition argument\r\n\tfunction readArgument(){\r\n\t\tif(readToken(\"word\"))\r\n\t\t\treturn word;\r\n\t\telse\r\n\t\t\treturn false;\r\n\t}\r\n\t\r\n\t//read variable declaration\r\n\tfunction readDeclaration(){\r\n\t\tvar ret={};\r\n\t\tif(readToken(\"word\")){\r\n\t\t\tret.name=word;\r\n\t\t\tif(readToken(\"=\"))\r\n\t\t\t\tret.value=readExpression();\r\n\t\t\treturn ret;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\t\r\n\t//keys:\r\n\t//name: [variable name expr token list]\r\n\t//indexes: [index list]\r\n\tfunction readVariable(){\r\n\t\tvar ret={name:\"\"};\r\n\t\tnext();\r\n\t\treturn {name:word}\r\n\t\tswitch(type){\r\n\t\t\tcase \"word\":\r\n\t\t\t\tret.name=word;\r\n\t\t\tbreak;default:\r\n\t\t\t\treadNext=0;\r\n\t\t\t\treturn false;\r\n\t\t}\r\n\t\treturn ret;\r\n\t}\r\n\t\r\n\t//throw error with message if condition is false\r\n\tfunction assert(condition,message){\r\n\t\tif(!condition){\r\n\t\t\t//message//+=\" on line \"+lineNumber;\r\n\t\t\tconsole.log(message);\r\n\t\t\tvar error=new Error(message);\r\n\t\t\terror.name=\"ParseError\";\r\n\t\t\tthrow error;\r\n\t\t}\r\n\t}\r\n\t\r\n\t//I forgot how this works...\r\n\tfunction next(){\r\n\t\tif(readNext===1){\r\n\t\t\tvar items=nextToken();\r\n\t\t\ttype=items.type;\r\n\t\t\tword=items.word;\r\n\t\t}else if(readNext===-1){\r\n\t\t\ttype=newType;\r\n\t\t\tword=newWord;\r\n\t\t\treadNext=1;\r\n\t\t//I don't think this ever happens?\r\n\t\t}else if(readNext===-2)\r\n\t\t\treadNext=-1;\r\n\t\telse\r\n\t\t\treadNext=1;\r\n\t}\r\n\t\r\n\t//handle single line IF blocks at the end of the program (temporary fix)\r\n\tif(ifThisLine){\r\n\t\tifThisLine=false;\r\n\t\tif(codeAfterThen){\r\n\t\t\tendBlock();\r\n\t\t\tconsole.log(\"ended single line IF\");\r\n\t\t}\r\n\t}\r\n\t\r\n\tif(currentBlocks.length>=2)\r\n\t\treturn \"Unclosed \"+currentBlocks[1].type;\r\n\t//currentBlocks[1]=defs;\r\n\treturn currentBlocks;\r\n}", "transform(program) {\n var options = AsxFormatter.options(this.file.ast);\n //DefaultFormatter.prototype.transform.apply(this, arguments);\n\n var locals = [];\n var definitions = [];\n var body = [];\n program.body.forEach(item=>{\n switch(item.type){\n case 'ExpressionStatement':\n var exp = item.expression;\n if(exp.type=='Literal' && exp.value.toLowerCase()=='use strict'){\n return;\n }\n break;\n case 'VariableDeclaration':\n item.declarations.forEach(d=>{\n locals.push(d.id);\n });\n break;\n case 'FunctionDeclaration':\n if(item.id.name=='module'){\n item.body.body.forEach(s=>{\n body.push(s);\n })\n return;\n }else\n if(item._class){\n item.id =t.identifier('c$'+item._class);\n body.push(t.expressionStatement(t.callExpression(\n t.memberExpression(\n t.identifier('asx'),\n t.identifier('c$')\n ),[item])));\n return;\n }else{\n locals.push(item.id);\n }\n break;\n }\n body.push(item);\n });\n\n var definer = [];\n\n\n\n if(Object.keys(this.imports).length){\n\n Object.keys(this.imports).forEach(key=>{\n var items = this.imports[key];\n if(items['*'] && typeof items['*']=='string'){\n this.imports[key]=items['*'];\n }\n });\n definer.push(t.property('init',\n t.identifier('imports'),\n t.valueToNode(this.imports)\n ))\n }\n var exports;\n if(this.exports['*']){\n exports = this.exports['*'];\n delete this.exports['*'];\n }\n if(Object.keys(this.exports).length){\n definer.push(t.property('init',\n t.identifier('exports'),\n t.valueToNode(this.exports)\n ))\n }\n if(body.length){\n if(exports){\n var ret = [];\n Object.keys(exports).forEach(key=>{\n var val = exports[key];\n if(typeof val=='string') {\n ret.push(t.property('init',\n t.literal(key), t.identifier(val == '*' ? key : val)\n ))\n }else{\n ret.push(t.property('init',\n t.literal(key), val\n ))\n }\n });\n body.push(t.returnStatement(\n t.objectExpression(ret)\n ));\n }\n var initializer = t.functionExpression(null, [t.identifier('asx')], t.blockStatement(body));\n definer.push(t.property('init',\n t.identifier('execute'),\n initializer\n ))\n }\n definitions.forEach(item=>{\n\n if(item._class){\n definer.push(t.property('init',\n t.literal('.'+item._class),\n item\n ))\n }else{\n definer.push(t.property('init',\n t.literal(':'+item.id.name),\n item\n ))\n }\n\n })\n definer = t.objectExpression(definer);\n\n\n\n /*\n var definer = t.functionExpression(null, [t.identifier(\"module\")], t.blockStatement(body));\n if(options.bind){\n definer = t.callExpression(\n t.memberExpression(\n definer,\n t.identifier(\"bind\")\n ),[\n t.callExpression(t.identifier(\"eval\"),[t.literal(\"this.global=this\")])\n ]\n );\n }*/\n var body = [];\n var definer = util.template(\"asx-module\",{\n MODULE_NAME: t.literal(this.getModuleName()),\n MODULE_BODY: definer\n });\n if(options.runtime){\n var rt = util.template(\"asx-runtime\")\n //rt._compact = true;\n body.push(t.expressionStatement(rt));\n }\n body.push(t.expressionStatement(definer))\n program.body = body;\n }", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw Object(_error_syntaxError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n}", "function tokenize_latex_math(input)\n{\n var result = new Array();\n var in_text_mode = 0;\n var brace_level = [];\n var pos = 0;\n\n if(input.charAt(0) == '$' &&\n input.charAt(input.length-1) == '$')\n input = input.slice(1, input.length-1);\n\n while(1) {\n if(!in_text_mode) {\n tokenize_re.lastIndex = pos;\n var m = tokenize_re.exec(input);\n pos = tokenize_re.lastIndex;\n\n if(m == null)\n {\n return result;\n }\n else if( m[1] != null) {\n result.push(m[1], m[2]);\n } else if(m[3] == '\\\\sp') {\n result.push('^');\n } else if(m[3] == '\\\\sb') {\n result.push('_');\n } else\n {\n if(m[0] == '$') {\n in_text_mode = 1;\n } else if(m[4] != null) {\n continue;\n } else if(m[3] != null && m[3] in tokenize_text_commands) {\n in_text_mode = 2;\n brace_level.push(0);\n }\n\n result.push(m[0]);\n }\n }\n else // in_text_mode:\n {\n tokenize_text_re.lastIndex = pos;\n var m = tokenize_text_re.exec(input);\n pos = tokenize_text_re.lastIndex;\n\n if(m == null) {\n return result;\n } else if(m[0] == '$') {\n in_text_mode = 0;\n } else if(m[0] == '{') {\n brace_level[brace_level.length-1]++;\n } else if(m[0] == '}') {\n if(--brace_level[brace_level.length-1] <= 0) {\n in_text_mode = 0;\n brace_level.pop();\n }\n }\n result.push(m[0]);\n }\n }\n}", "function transcribe$122(macroBody$185, macroNameStx$186, env$187) {\n return _$100.chain(macroBody$185).reduce(function (acc$188, bodyStx$189, idx$190, original$191) {\n // first find the ellipses and mark the syntax objects\n // (note that this step does not eagerly go into delimiter bodies)\n var last$192 = original$191[idx$190 - 1];\n var next$193 = original$191[idx$190 + 1];\n var nextNext$194 = original$191[idx$190 + 2];\n // drop `...`\n if (bodyStx$189.token.value === '...') {\n return acc$188;\n }\n // drop `(<separator)` when followed by an ellipse\n if (delimIsSeparator$113(bodyStx$189) && next$193 && next$193.token.value === '...') {\n return acc$188;\n }\n // skip the $ in $(...)\n if (bodyStx$189.token.value === '$' && next$193 && next$193.token.type === parser$102.Token.Delimiter && next$193.token.value === '()') {\n return acc$188;\n }\n // mark $[...] as a literal\n if (bodyStx$189.token.value === '$' && next$193 && next$193.token.type === parser$102.Token.Delimiter && next$193.token.value === '[]') {\n next$193.literal = true;\n return acc$188;\n }\n if (bodyStx$189.token.type === parser$102.Token.Delimiter && bodyStx$189.token.value === '()' && last$192 && last$192.token.value === '$') {\n bodyStx$189.group = true;\n }\n // literal [] delimiters have their bodies just\n // directly passed along\n if (bodyStx$189.literal === true) {\n parser$102.assert(bodyStx$189.token.type === parser$102.Token.Delimiter, 'expecting a literal to be surrounded by []');\n return acc$188.concat(bodyStx$189.token.inner);\n }\n if (next$193 && next$193.token.value === '...') {\n bodyStx$189.repeat = true;\n bodyStx$189.separator = ' ';\n } // default to space separated\n else if (delimIsSeparator$113(next$193) && nextNext$194 && nextNext$194.token.value === '...') {\n bodyStx$189.repeat = true;\n bodyStx$189.separator = next$193.token.inner[0].token.value;\n }\n return acc$188.concat(bodyStx$189);\n }, []).reduce(function (acc$195, bodyStx$196, idx$197) {\n // then do the actual transcription\n if (bodyStx$196.repeat) {\n if (bodyStx$196.token.type === parser$102.Token.Delimiter) {\n bodyStx$196.expose();\n var fv$198 = _$100.filter(freeVarsInPattern$110(bodyStx$196.token.inner), function (pat$205) {\n // ignore \"patterns\"\n // that aren't in the\n // environment (treat\n // them like literals)\n return env$187.hasOwnProperty(pat$205);\n });\n var restrictedEnv$199 = [];\n var nonScalar$200 = _$100.find(fv$198, function (pat$206) {\n return env$187[pat$206].level > 0;\n });\n parser$102.assert(typeof nonScalar$200 !== 'undefined', 'must have a least one non-scalar in repeat');\n var repeatLength$201 = env$187[nonScalar$200].match.length;\n var sameLength$202 = _$100.all(fv$198, function (pat$207) {\n return env$187[pat$207].level === 0 || env$187[pat$207].match.length === repeatLength$201;\n });\n parser$102.assert(sameLength$202, 'all non-scalars must have the same length');\n // create a list of envs restricted to the free vars\n restrictedEnv$199 = _$100.map(_$100.range(repeatLength$201), function (idx$208) {\n var renv$209 = {};\n _$100.each(fv$198, function (pat$210) {\n if (env$187[pat$210].level === 0) {\n // copy scalars over\n renv$209[pat$210] = env$187[pat$210];\n } else {\n // grab the match at this index\n renv$209[pat$210] = env$187[pat$210].match[idx$208];\n }\n });\n return renv$209;\n });\n var transcribed$203 = _$100.map(restrictedEnv$199, function (renv$211) {\n if (bodyStx$196.group) {\n return transcribe$122(bodyStx$196.token.inner, macroNameStx$186, renv$211);\n } else {\n var newBody$212 = syntaxFromToken$106(_$100.clone(bodyStx$196.token), bodyStx$196);\n newBody$212.token.inner = transcribe$122(bodyStx$196.token.inner, macroNameStx$186, renv$211);\n return newBody$212;\n }\n });\n var joined$204;\n if (bodyStx$196.group) {\n joined$204 = joinSyntaxArr$109(transcribed$203, bodyStx$196.separator);\n } else {\n joined$204 = joinSyntax$108(transcribed$203, bodyStx$196.separator);\n }\n return acc$195.concat(joined$204);\n }\n if (!env$187[bodyStx$196.token.value]) {\n throw new Error('The pattern variable ' + bodyStx$196.token.value + ' is not bound for the template');\n } else if (env$187[bodyStx$196.token.value].level !== 1) {\n throw new Error('Ellipses level for ' + bodyStx$196.token.value + ' does not match in the template');\n }\n return acc$195.concat(joinRepeatedMatch$115(env$187[bodyStx$196.token.value].match, bodyStx$196.separator));\n } else {\n if (bodyStx$196.token.type === parser$102.Token.Delimiter) {\n bodyStx$196.expose();\n var newBody$213 = syntaxFromToken$106(_$100.clone(bodyStx$196.token), macroBody$185);\n newBody$213.token.inner = transcribe$122(bodyStx$196.token.inner, macroNameStx$186, env$187);\n return acc$195.concat(takeLineContext$116(macroNameStx$186, [newBody$213]));\n }\n if (isPatternVar$114(bodyStx$196) && Object.prototype.hasOwnProperty.bind(env$187)(bodyStx$196.token.value)) {\n if (!env$187[bodyStx$196.token.value]) {\n throw new Error('The pattern variable ' + bodyStx$196.token.value + ' is not bound for the template');\n } else if (env$187[bodyStx$196.token.value].level !== 0) {\n throw new Error('Ellipses level for ' + bodyStx$196.token.value + ' does not match in the template');\n }\n return acc$195.concat(takeLineContext$116(macroNameStx$186, env$187[bodyStx$196.token.value].match));\n }\n return acc$195.concat(takeLineContext$116(macroNameStx$186, [bodyStx$196]));\n }\n }, []).value();\n }", "function compile(markup) {\n var loc = 0,\n inBlock = TRUE,\n stack = [],\n top = [],\n content = top,\n current = [, , top];\n\n function pushPreceedingContent(shift) {\n shift -= loc;\n if (shift) {\n var text = markup.substr(loc, shift).replace(/\\n/g, \"\\\\n\");\n if (inBlock) {\n content.push(text);\n } else {\n if (!text.split('\"').length % 2) {\n // This is a {{ or }} within a string parameter, so skip parsing. (Leave in string)\n return TRUE;\n }\n //( path\tor \t\\\"string\\\" )\t or ( path = ( path or \\\"string\\\" )\n (text + \" \").replace(/([\\w\\$\\.\\[\\]]+|(\\\\?['\"])(.*?)\\2)(?=\\s)|([\\w\\$\\.\\[\\]]+)\\=([\\w\\$\\.\\[\\]]+|\\\\(['\"]).*?\\\\\\6)(?=\\s)/g,\n function (all, path, quot, string, lhs, rhs, quot2) {\n content.push(path ? path : [lhs, rhs]); // lhs and rhs are for named params\n }\n );\n }\n }\n }\n\n // Build abstract syntax tree: [ tag, params, content, encoding ]\n markup = markup\n .replace(/\\\\'|'/g, \"\\\\\\'\").replace(/\\\\\"|\"/g, \"\\\\\\\"\") //escape ', and \"\n .split(/\\s+/g).join(\" \") // collapse white-space\n .replace(/^\\s+/, \"\") // trim left\n .replace(/\\s+$/, \"\"); // trim right;\n\n //\t\t\t\t\t {{\t\t #\t\ttag\t\t\t\t\t\t\tsingleCharTag\t\t\t\t\t\t\tcode\t\t\t\t\t\t !encoding endTag\t\t{{/closeBlock}}\n markup.replace(/(?:\\{\\{(?:(\\#)?([\\w\\$\\.\\[\\]]+(?=[\\s\\}!]))|([^\\/\\*\\>$\\w\\s\\d\\x7f\\x00-\\x1f](?=[\\s\\w\\$\\[]))|\\*((?:[^\\}]|\\}(?!\\}))+)\\}\\}))|(!(\\w*))?(\\}\\})|(?:\\{\\{\\/([\\w\\$\\.\\[\\]]+)\\}\\})/g,\n function (all, isBlock, tagName, singleCharTag, code, useEncode, encoding, endTag, closeBlock, index) {\n tagName = tagName || singleCharTag;\n if (inBlock && endTag || pushPreceedingContent(index)) {\n return;\n }\n if (code) {\n if (viewsNs.allowCode) {\n content.push([\"*\", code.replace(/\\\\(['\"])/g, \"$1\")]); // unescape ', and \"\n }\n } else if (tagName) {\n if (tagName === \"else\") {\n current = stack.pop();\n content = current[2];\n isBlock = TRUE;\n }\n stack.push(current);\n content.push(current = [tagName, [], isBlock && 1]);\n } else if (endTag) {\n current[3] = useEncode ? encoding || \"none\" : \"\";\n if (current[2]) {\n current[2] = [];\n } else {\n current = stack.pop();\n }\n } else if (closeBlock) {\n current = stack.pop();\n }\n loc = index + all.length; // location marker - parsed up to here\n inBlock = !tagName && current[2] && current[2] !== 1;\n content = current[inBlock ? 2 : 1];\n });\n\n pushPreceedingContent(markup.length);\n\n return buildTmplFunction(top);\n }", "function evaluate (syntaxTree) {\n\t\tvar index = 0,\n\t\t\tnum, symbolType, wasFunction;\n\t\t\n\t\tif (!Array.isArray(syntaxTree)) {\n\t\t\t// check primitives, scopeStack, then symbol table\n\t\t\tvar i, nativeCode;\n\t\t\t\n\t\t\t// number, string, or variable\n\t\t\tif (isLispNumber(syntaxTree)) {\n\t\t\t\treturn Number(syntaxTree);\n\t\t\t}\n\t\t\t\n\t\t\tif (isLispBool(syntaxTree)) {\n\t\t\t\treturn toLispBool(syntaxTree);\n\t\t\t}\n\t\t\t\n\t\t\tif (isLispString(syntaxTree) || isFunction(syntaxTree)) {\n\t\t\t\treturn syntaxTree;\n\t\t\t}\n\t\t\tif (isObject(syntaxTree)) {\n\t\t\t\treturn toObject(syntaxTree);\n\t\t\t}\n\t\t\t\n\t\t\tfor (i = scopeStack.length - 1; i >= 0; i--) {\n\t\t\t\tif (typeof scopeStack[i][syntaxTree] !== 'undefined') {\n\t\t\t\t\treturn scopeStack[i][syntaxTree];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tnativeCode = eval(syntaxTree);\n\t\t\t\tswitch (typeof nativeCode) {\n\t\t\t\t\tcase 'string': \n\t\t\t\t\t\treturn ('\"' + nativeCode + '\"');\n\t\t\t\t\tcase 'number':\n\t\t\t\t\tcase 'object':\n\t\t\t\t\tcase 'function':\n\t\t\t\t\t\treturn nativeCode;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t\tif (!symbols[syntaxTree]) {\n\t\t\t\tthrow 'Unable to evaluate \\'' + syntaxTree + '\\'';\n\t\t\t}\t\n\t\t\t\n\t\t\tsymbolType = typeof symbols[syntaxTree];\n\t\t\tif (symbolType === 'function') {\n\t\t\t\treturn 'lambda object';\n\t\t\t}\n\t\t\tif (Array.isArray(symbols[syntaxTree]) || symbolType !== 'object') {\n\t\t\t\treturn symbols[syntaxTree];\n\t\t\t}\n\t\t\t\n\t\t\tthrow 'Unable to evaluate...';\n\t\t}\n\t\t\n\t\tif (syntaxTree.length === 0) {\n\t\t\treturn syntaxTree;\n\t\t}\n\t\t\n\t\twasFunction = isFunction(syntaxTree[0]);\n\t\tif (wasFunction) {\n\t\t\tindex = 1;\n\t\t}\n\t\t\n\t\tfor (index; index < syntaxTree.length; index++) {\n\t\t\tsyntaxTree[index] = evaluate(syntaxTree[index]);\n\t\t}\n\t\t\n\t\tif (wasFunction) {\n\t\t\treturn applyFunction(syntaxTree[0], syntaxTree.slice(1));\n\t\t}\n\t\treturn syntaxTree;\n\t}", "function readToken(lexer, prev) {\n\t var source = lexer.source;\n\t var body = source.body;\n\t var bodyLength = body.length;\n\n\t var position = positionAfterWhitespace(body, prev.end, lexer);\n\t var line = lexer.line;\n\t var col = 1 + position - lexer.lineStart;\n\n\t if (position >= bodyLength) {\n\t return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n\t }\n\n\t var code = charCodeAt.call(body, position);\n\n\t // SourceCharacter\n\t if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n\t throw (0, _error.syntaxError)(source, position, 'Invalid character ' + printCharCode(code) + '.');\n\t }\n\n\t switch (code) {\n\t // !\n\t case 33:\n\t return new Tok(BANG, position, position + 1, line, col, prev);\n\t // #\n\t case 35:\n\t return readComment(source, position, line, col, prev);\n\t // $\n\t case 36:\n\t return new Tok(DOLLAR, position, position + 1, line, col, prev);\n\t // (\n\t case 40:\n\t return new Tok(PAREN_L, position, position + 1, line, col, prev);\n\t // )\n\t case 41:\n\t return new Tok(PAREN_R, position, position + 1, line, col, prev);\n\t // .\n\t case 46:\n\t if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n\t return new Tok(SPREAD, position, position + 3, line, col, prev);\n\t }\n\t break;\n\t // :\n\t case 58:\n\t return new Tok(COLON, position, position + 1, line, col, prev);\n\t // =\n\t case 61:\n\t return new Tok(EQUALS, position, position + 1, line, col, prev);\n\t // @\n\t case 64:\n\t return new Tok(AT, position, position + 1, line, col, prev);\n\t // [\n\t case 91:\n\t return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n\t // ]\n\t case 93:\n\t return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n\t // {\n\t case 123:\n\t return new Tok(BRACE_L, position, position + 1, line, col, prev);\n\t // |\n\t case 124:\n\t return new Tok(PIPE, position, position + 1, line, col, prev);\n\t // }\n\t case 125:\n\t return new Tok(BRACE_R, position, position + 1, line, col, prev);\n\t // A-Z _ a-z\n\t case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n\t case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n\t case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n\t case 89:case 90:\n\t case 95:\n\t case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n\t case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n\t case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n\t case 119:case 120:case 121:case 122:\n\t return readName(source, position, line, col, prev);\n\t // - 0-9\n\t case 45:\n\t case 48:case 49:case 50:case 51:case 52:\n\t case 53:case 54:case 55:case 56:case 57:\n\t return readNumber(source, position, code, line, col, prev);\n\t // \"\n\t case 34:\n\t return readString(source, position, line, col, prev);\n\t }\n\n\t throw (0, _error.syntaxError)(source, position, 'Unexpected character ' + printCharCode(code) + '.');\n\t}", "function expand(syntax, codeArray, level){\n\n /* terminating condition:\n * no children statements to JSON object\n */\n if (syntax == null){\n return;\n }\n for (var w = 0; w < syntax.length; w++){\n\n /* adds each statement to array,\n * gets statement name with getName()\n * calls expand() on statement body to find children,\n * adds 1 to level each time\n */\n codeArray.push([getName(syntax[w].type), level, w, false]);\n expand(getChild(syntax[w]), codeArray, level + 1);\n\n // if if-statement, perform the same on else statement\n if (syntax[w].type == 'IfStatement' && syntax[w].alternate != null){\n codeArray.push(['else', level, w, false]);\n expand(getSibling(syntax[w]), codeArray, level + 1);\n }\n }\n}", "function parse (raw){\n var output = '';\n var ast = esprima.parse(raw, {\n range: true,\n raw: true\n });\n\n var defines = ast.body.filter(isDefine);\n\n if ( defines.length > 1 ){\n throw new Error('Each file can have only a single define call. Found \"'+ defines.length +'\"');\n } else if (!defines.length){\n return raw;\n }\n\n var def = defines[0];\n var args = def.expression['arguments'];\n var factory = getFactory( args );\n var useStrict = getUseStrict( factory );\n\n // do replacements in-place to avoid modifying the code more than needed\n if (useStrict) {\n output += useStrict.expression.raw +';\\n';\n }\n output += raw.substring( 0, def.range[0] ); // anything before define\n output += getRequires(args, factory); // add requires\n output += getBody(raw, factory.body, useStrict); // module body\n\n output += raw.substring( def.range[1], raw.length ); // anything after define\n\n return output;\n}", "function t(text) { return {'macro_name': 'plaintext', 'text': text}; }", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // <BOM>\n\n case 9: // \\t\n\n case 32: // <space>\n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw (0,_error_syntaxError_mjs__WEBPACK_IMPORTED_MODULE_2__.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // <BOM>\n\n case 9: // \\t\n\n case 32: // <space>\n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw (0,_error_syntaxError_mjs__WEBPACK_IMPORTED_MODULE_2__.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_0__.Token(_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_1__.TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw (0, error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n if (charCodeAt.call(body, position + 1) === 34 && charCodeAt.call(body, position + 2) === 34) {\n return readBlockString(source, position, line, col, prev);\n }\n return readString(source, position, line, col, prev);\n }\n\n throw (0, error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n case 89:case 90:\n case 95:\n case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n case 119:case 120:case 121:case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:case 49:case 50:case 51:case 52:\n case 53:case 54:case 55:case 56:case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n return readString(source, position, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n case 89:case 90:\n case 95:\n case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n case 119:case 120:case 121:case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:case 49:case 50:case 51:case 52:\n case 53:case 54:case 55:case 56:case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n return readString(source, position, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n case 89:case 90:\n case 95:\n case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n case 119:case 120:case 121:case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:case 49:case 50:case 51:case 52:\n case 53:case 54:case 55:case 56:case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n return readString(source, position, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n case 89:case 90:\n case 95:\n case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n case 119:case 120:case 121:case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:case 49:case 50:case 51:case 52:\n case 53:case 54:case 55:case 56:case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n return readString(source, position, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n case 89:case 90:\n case 95:\n case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n case 119:case 120:case 121:case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:case 49:case 50:case 51:case 52:\n case 53:case 54:case 55:case 56:case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n return readString(source, position, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var position = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + position - lexer.lineStart;\n\n if (position >= bodyLength) {\n return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, position);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(BANG, position, position + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, position, line, col, prev);\n // $\n case 36:\n return new Tok(DOLLAR, position, position + 1, line, col, prev);\n // (\n case 40:\n return new Tok(PAREN_L, position, position + 1, line, col, prev);\n // )\n case 41:\n return new Tok(PAREN_R, position, position + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n return new Tok(SPREAD, position, position + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(COLON, position, position + 1, line, col, prev);\n // =\n case 61:\n return new Tok(EQUALS, position, position + 1, line, col, prev);\n // @\n case 64:\n return new Tok(AT, position, position + 1, line, col, prev);\n // [\n case 91:\n return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n // {\n case 123:\n return new Tok(BRACE_L, position, position + 1, line, col, prev);\n // |\n case 124:\n return new Tok(PIPE, position, position + 1, line, col, prev);\n // }\n case 125:\n return new Tok(BRACE_R, position, position + 1, line, col, prev);\n // A-Z _ a-z\n case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n case 89:case 90:\n case 95:\n case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n case 119:case 120:case 121:case 122:\n return readName(source, position, line, col, prev);\n // - 0-9\n case 45:\n case 48:case 49:case 50:case 51:case 52:\n case 53:case 54:case 55:case 56:case 57:\n return readNumber(source, position, code, line, col, prev);\n // \"\n case 34:\n return readString(source, position, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_1__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_1__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw syntaxError(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n\t var source = lexer.source;\n\t var body = source.body;\n\t var bodyLength = body.length;\n\n\t var position = positionAfterWhitespace(body, prev.end, lexer);\n\t var line = lexer.line;\n\t var col = 1 + position - lexer.lineStart;\n\n\t if (position >= bodyLength) {\n\t return new Tok(EOF, bodyLength, bodyLength, line, col, prev);\n\t }\n\n\t var code = charCodeAt.call(body, position);\n\n\t // SourceCharacter\n\t if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n\t throw (0, _error.syntaxError)(source, position, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n\t }\n\n\t switch (code) {\n\t // !\n\t case 33:\n\t return new Tok(BANG, position, position + 1, line, col, prev);\n\t // #\n\t case 35:\n\t return readComment(source, position, line, col, prev);\n\t // $\n\t case 36:\n\t return new Tok(DOLLAR, position, position + 1, line, col, prev);\n\t // (\n\t case 40:\n\t return new Tok(PAREN_L, position, position + 1, line, col, prev);\n\t // )\n\t case 41:\n\t return new Tok(PAREN_R, position, position + 1, line, col, prev);\n\t // .\n\t case 46:\n\t if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n\t return new Tok(SPREAD, position, position + 3, line, col, prev);\n\t }\n\t break;\n\t // :\n\t case 58:\n\t return new Tok(COLON, position, position + 1, line, col, prev);\n\t // =\n\t case 61:\n\t return new Tok(EQUALS, position, position + 1, line, col, prev);\n\t // @\n\t case 64:\n\t return new Tok(AT, position, position + 1, line, col, prev);\n\t // [\n\t case 91:\n\t return new Tok(BRACKET_L, position, position + 1, line, col, prev);\n\t // ]\n\t case 93:\n\t return new Tok(BRACKET_R, position, position + 1, line, col, prev);\n\t // {\n\t case 123:\n\t return new Tok(BRACE_L, position, position + 1, line, col, prev);\n\t // |\n\t case 124:\n\t return new Tok(PIPE, position, position + 1, line, col, prev);\n\t // }\n\t case 125:\n\t return new Tok(BRACE_R, position, position + 1, line, col, prev);\n\t // A-Z _ a-z\n\t case 65:\n\t case 66:\n\t case 67:\n\t case 68:\n\t case 69:\n\t case 70:\n\t case 71:\n\t case 72:\n\t case 73:\n\t case 74:\n\t case 75:\n\t case 76:\n\t case 77:\n\t case 78:\n\t case 79:\n\t case 80:\n\t case 81:\n\t case 82:\n\t case 83:\n\t case 84:\n\t case 85:\n\t case 86:\n\t case 87:\n\t case 88:\n\t case 89:\n\t case 90:\n\t case 95:\n\t case 97:\n\t case 98:\n\t case 99:\n\t case 100:\n\t case 101:\n\t case 102:\n\t case 103:\n\t case 104:\n\t case 105:\n\t case 106:\n\t case 107:\n\t case 108:\n\t case 109:\n\t case 110:\n\t case 111:\n\t case 112:\n\t case 113:\n\t case 114:\n\t case 115:\n\t case 116:\n\t case 117:\n\t case 118:\n\t case 119:\n\t case 120:\n\t case 121:\n\t case 122:\n\t return readName(source, position, line, col, prev);\n\t // - 0-9\n\t case 45:\n\t case 48:\n\t case 49:\n\t case 50:\n\t case 51:\n\t case 52:\n\t case 53:\n\t case 54:\n\t case 55:\n\t case 56:\n\t case 57:\n\t return readNumber(source, position, code, line, col, prev);\n\t // \"\n\t case 34:\n\t if (charCodeAt.call(body, position + 1) === 34 && charCodeAt.call(body, position + 2) === 34) {\n\t return readBlockString(source, position, line, col, prev);\n\t }\n\t return readString(source, position, line, col, prev);\n\t }\n\n\t throw (0, _error.syntaxError)(source, position, unexpectedCharacterMessage(code));\n\t}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(_tokenKind.TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(_tokenKind.TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(_tokenKind.TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(_tokenKind.TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(_tokenKind.TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(_tokenKind.TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(_tokenKind.TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(scnr, context) {\r\n let token = { type: 14 /* EOF */ };\r\n if (context.braceNest > 0) {\r\n return readTokenInPlaceholder(scnr, context) || getEndToken(context);\r\n }\r\n if (context.inLinked) {\r\n return readTokenInLinked(scnr, context) || getEndToken(context);\r\n }\r\n const ch = scnr.currentChar();\r\n switch (ch) {\r\n case \"{\" /* BraceLeft */:\r\n return readTokenInPlaceholder(scnr, context) || getEndToken(context);\r\n case \"}\" /* BraceRight */:\r\n emitError(5 /* UNBALANCED_CLOSING_BRACE */, currentPosition(), 0);\r\n scnr.next();\r\n return getToken(context, 3 /* BraceRight */, \"}\" /* BraceRight */);\r\n case \"@\" /* LinkedAlias */:\r\n return readTokenInLinked(scnr, context) || getEndToken(context);\r\n default:\r\n if (isPluralStart(scnr)) {\r\n token = getToken(context, 1 /* Pipe */, readPlural(scnr));\r\n // reset\r\n context.braceNest = 0;\r\n context.inLinked = false;\r\n return token;\r\n }\r\n if (isTextStart(scnr)) {\r\n return getToken(context, 0 /* Text */, readText(scnr));\r\n }\r\n if (ch === \"%\" /* Modulo */) {\r\n scnr.next();\r\n return getToken(context, 4 /* Modulo */, \"%\" /* Modulo */);\r\n }\r\n break;\r\n }\r\n return token;\r\n }", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (charCodeAt.call(body, pos + 1) === 46 && charCodeAt.call(body, pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (charCodeAt.call(body, pos + 1) === 34 && charCodeAt.call(body, pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw Object(_error__WEBPACK_IMPORTED_MODULE_0__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (charCodeAt.call(body, pos + 1) === 46 && charCodeAt.call(body, pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (charCodeAt.call(body, pos + 1) === 34 && charCodeAt.call(body, pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function createMacro(macro, options = {}) {\n if (options.configName === \"options\") {\n throw new Error(\n `You cannot use the configName \"options\". It is reserved for babel-plugin-macros.`\n );\n }\n macroWrapper.isBabelMacro = true;\n macroWrapper.options = options;\n return macroWrapper;\n\n function macroWrapper(args) {\n const { source, isBabelMacrosCall } = args;\n if (!isBabelMacrosCall) {\n throw new Error(\n `The macro you imported from \"${source}\" is being executed outside the context of compilation with babel-plugin-macros. ` +\n `This indicates that you don't have the babel plugin \"babel-plugin-macros\" configured correctly. ` +\n `Please see the documentation for how to configure babel-plugin-macros properly: ` +\n \"https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/user.md\"\n );\n }\n return macro(args);\n }\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_3__[\"TokenKind\"].BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw Object(_error_syntaxError__WEBPACK_IMPORTED_MODULE_1__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n}", "function baseCompile(template, options) {\n\t//生成语法解析树\n\tconst ast = parse(template.trim(), options)\n\t\t// optimize(ast, options)\n\t\t// const code = generate(ast, options)\n\t\t// return {\n\t\t// ast,\n\t\t// render: code.render,\n\t\t// staticRenderFns: code.staticRenderFns\n\t\t// }\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(_tokenKind__WEBPACK_IMPORTED_MODULE_1__[\"TokenKind\"].BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw Object(_error_syntaxError__WEBPACK_IMPORTED_MODULE_2__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // <BOM>\n\n case 9: // \\t\n\n case 32: // <space>\n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw Object(_error_syntaxError_mjs__WEBPACK_IMPORTED_MODULE_0__[\"syntaxError\"])(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new _ast_mjs__WEBPACK_IMPORTED_MODULE_1__[\"Token\"](_tokenKind_mjs__WEBPACK_IMPORTED_MODULE_2__[\"TokenKind\"].EOF, bodyLength, bodyLength, line, col, prev);\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw syntaxError(source, pos, unexpectedCharacterMessage(code));\n }", "function compile() {\n return this.visit(compact(this.tree, this.options.commonmark));\n}", "function make_node(tok) {\n var node = {};\n if (tok.id === \"(string)\") {\n node.parse = function() { return tok.value };\n }\n else {\n node = Y.Node.create(tok.template);\n if (tok.id === \"(indent)\") {\n node.setData(\"indent\", tok.value);\n }\n node.parse = tok.parse;\n node.transition = tok.transition;\n }\n return node;\n}", "constructor( type, code_or_tree, embedded=false ){\n super(type)\n if(typeof code_or_tree == \"string\" ){\n var p = new GeneratorParser(false, embedded)\n this.tree = p.get(new Source(\"generator-lexeme\",code_or_tree))\n }else this.tree = code_or_tree\n }", "macro_subst(str) {\n let result = ''\n for (let i=0; i < str.length; i++) {\n let chr = str[i]\n // If we see a backslash\n if (chr == '\\\\' && str[i+1] >= '0' && str[i+1] <= '9') {\n let stack_pos = str[i+1] - '0'\n let param = this.peek(stack_pos)\n result += param.value // NOTE: We assume that we're interpolating a string value\n i++\n }\n else if (chr == \"'\") {\n result += '\"'\n }\n else {\n result += chr\n }\n }\n return result\n }", "enterMacro(ctx) {\n\t}", "expand(preventRecursion) {\n if (!this.isExpanded) {\n this.isExpanded = true\n\n this.expansionErrors = []\n\n // Types of nodes\n // -1: raw, needs parsing\n // 0: Plaintext\n // 1: Tag (\"#symbol.mod.mod2.mod3#\" or \"#[pushTarget:pushRule]symbol.mod\")\n // 2: Action (\"[pushTarget:pushRule], [pushTarget:POP]\", more in the future)\n\n switch (this.type) {\n // Raw rule\n case -1:\n\n this.expandChildren(this.raw, preventRecursion)\n break\n\n // Plaintext, do nothing but copy text into finsihed text\n case 0:\n this.finishedText = this.raw\n break\n\n // Tag\n case 1: {\n // Parse to find any actions, and figure out what the symbol is\n this.preactions = []\n this.postactions = []\n\n const parsed = Parser.parseTag(this.raw)\n\n // Break into symbol actions and modifiers\n this.symbol = parsed.symbol\n this.modifiers = parsed.modifiers\n\n // Create all the preactions from the raw syntax\n parsed.preactions.forEach((preaction, i) => {\n this.preactions[i] = new NodeAction(this, preaction.raw)\n })\n\n // Make undo actions for all preactions (pops for each push)\n this.preactions.forEach(pa => {\n if (pa.type === 0) {\n this.postactions.push(pa.createUndo())\n }\n })\n\n // Activate all the preactions\n this.preactions.forEach(pa => pa.activate())\n\n this.finishedText = this.raw\n\n // Expand (passing the node, this allows tracking of recursion depth)\n const selectedRule = this.grammar.selectRule(this.symbol, this, this.errors)\n\n this.expandChildren(selectedRule, preventRecursion)\n\n // Apply modifiers\n this.modifiers.forEach(modName => {\n let modParams = []\n if (modName.indexOf('(') > 0) {\n const regExp = /\\(([^)]+)\\)/\n\n const results = regExp.exec(modName)\n if (results && results.length >= 2) {\n modParams = results[1].split(',')\n modName = modName.substring(0, modName.indexOf('('))\n }\n }\n\n const mod = this.grammar.modifiers[modName]\n\n // Missing modifier?\n if (mod) {\n this.finishedText = mod(this.finishedText, modParams)\n } else {\n this.errors.push('Missing modifier ' + modName)\n this.finishedText += '((.' + modName + '))'\n }\n })\n\n // Perform post-actions\n this.postactions.forEach(pa => pa.activate())\n break\n }\n case 2:\n // Just a bare action? Expand it!\n this.action = new NodeAction(this, this.raw)\n this.action.activate()\n\n // No visible text for an action\n this.finishedText = ''\n break\n default:\n\n }\n }\n }", "jumpToMatching(select, expand) {\n var cursor = this.getCursorPosition();\n var iterator = new TokenIterator(this.session, cursor.row, cursor.column);\n var prevToken = iterator.getCurrentToken();\n var tokenCount = 0;\n if (prevToken && prevToken.type.indexOf('tag-name') !== -1) {\n prevToken = iterator.stepBackward();\n }\n var token = prevToken || iterator.stepForward();\n\n if (!token) return;\n\n //get next closing tag or bracket\n var matchType;\n var found = false;\n var depth = {};\n var i = cursor.column - token.start;\n var bracketType;\n var brackets = {\n \")\": \"(\",\n \"(\": \"(\",\n \"]\": \"[\",\n \"[\": \"[\",\n \"{\": \"{\",\n \"}\": \"{\"\n };\n\n do {\n if (token.value.match(/[{}()\\[\\]]/g)) {\n for (; i < token.value.length && !found; i++) {\n if (!brackets[token.value[i]]) {\n continue;\n }\n\n bracketType = brackets[token.value[i]] + '.' + token.type.replace(\"rparen\", \"lparen\");\n\n if (isNaN(depth[bracketType])) {\n depth[bracketType] = 0;\n }\n\n switch (token.value[i]) {\n case '(':\n case '[':\n case '{':\n depth[bracketType]++;\n break;\n case ')':\n case ']':\n case '}':\n depth[bracketType]--;\n\n if (depth[bracketType] === -1) {\n matchType = 'bracket';\n found = true;\n }\n break;\n }\n }\n }\n else if (token.type.indexOf('tag-name') !== -1) {\n if (isNaN(depth[token.value])) {\n depth[token.value] = 0;\n }\n\n if (prevToken.value === '<' && tokenCount > 1) {\n depth[token.value]++;\n }\n else if (prevToken.value === '</') {\n depth[token.value]--;\n }\n\n if (depth[token.value] === -1) {\n matchType = 'tag';\n found = true;\n }\n }\n\n if (!found) {\n prevToken = token;\n tokenCount++;\n token = iterator.stepForward();\n i = 0;\n }\n } while (token && !found);\n\n //no match found\n if (!matchType) return;\n\n var range, pos;\n if (matchType === 'bracket') {\n range = this.session.getBracketRange(cursor);\n if (!range) {\n range = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + i - 1,\n iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + i - 1\n );\n pos = range.start;\n if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column)\n < 2) range = this.session.getBracketRange(pos);\n }\n }\n else if (matchType === 'tag') {\n if (!token || token.type.indexOf('tag-name') === -1) return;\n range = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() - 2,\n iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() - 2\n );\n\n //find matching tag\n if (range.compare(cursor.row, cursor.column) === 0) {\n var tagsRanges = this.session.getMatchingTags(cursor);\n if (tagsRanges) {\n if (tagsRanges.openTag.contains(cursor.row, cursor.column)) {\n range = tagsRanges.closeTag;\n pos = range.start;\n }\n else {\n range = tagsRanges.openTag;\n if (tagsRanges.closeTag.start.row === cursor.row && tagsRanges.closeTag.start.column\n === cursor.column) pos = range.end; else pos = range.start;\n }\n }\n }\n\n //we found it\n pos = pos || range.start;\n }\n\n pos = range && range.cursor || pos;\n if (pos) {\n if (select) {\n if (range && expand) {\n this.selection.setRange(range);\n }\n else if (range && range.isEqual(this.getSelectionRange())) {\n this.clearSelection();\n }\n else {\n this.selection.selectTo(pos.row, pos.column);\n }\n }\n else {\n this.selection.moveTo(pos.row, pos.column);\n }\n }\n }", "function findInMacro() {\n if (arguments && arguments.length) {\n if(__.isStr(arguments[0])) {\n var macroUUID = getCurrentMacro().getUUID();\n //update the shared _currentSelector variable\n //then find the nodes\n _currentSelector = processSelectorForMacro(arguments[0]);\n //update selectedNodes\n _selectedNodes = getNodesWithSelector(_currentSelector);\n //strip out anything we found that's not part of this\n //container macro\n _selectedNodes.forEach(function (el, i, arr) {\n if (el && getNodeWithUUID(el).getMacroContainerUUID() !== macroUUID) {\n arr.splice(i, 1);\n }\n });\n } else if(__.isObj(arguments[0]) && arguments[0].constructor.name === \"AudioNode\") {\n _currentSelector = getCurrentMacroNamespace()+\" \"+arguments[0].getType();\n _selectedNodes = [arguments[0].getUUID()];\n }\n }\n}", "compileSingleTokenToRegister(opts, result) {\nlet program = this._program;\nresult.dataSize = 1;\nif (opts.identifier && opts.identifier.getType) {\nthis.setLastRecordType(opts.identifier.getType().type);\n}\nif (opts.expression.tokens[0].cls === t.TOKEN_NUMBER) {\nprogram.addCommand($.CMD_SET, $.T_NUM_L, this._scope.getStackOffset(), $.T_NUM_C, opts.expression.tokens[0].value);\nhelper.setReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK);\nhelper.addToReg(this._program, opts.reg, $.T_NUM_C, this._scope.getStackOffset());\n} else if (opts.identifier === null) {\nlet token = opts.expression.tokens[0];\nthrow errors.createError(err.UNDEFINED_IDENTIFIER, token, 'Undefined identifier \"' + token.lexeme + '\".');\n} else if (opts.identifier instanceof Proc) {\nthis._compiler.getUseInfo().setUseProc(opts.identifier.getName(), opts.identifier); // Set the proc as used...\nhelper.setReg(this._program, opts.reg, $.T_NUM_C, opts.identifier.getEntryPoint() - 1);\nresult.type = t.LEXEME_PROC;\n} else {\nif (opts.identifier.getWithOffset() !== null) {\nhelper.setReg(this._program, $.REG_PTR, $.T_NUM_L, opts.identifier.getWithOffset());\nif (opts.identifier.getType().type === t.LEXEME_PROC) {\nthis._lastProcField = opts.identifier.getProc();\nif (opts.selfPointerStackOffset !== false) {\n// It's a method to call then save the self pointer on the stack!\nhelper.saveSelfPointerToLocal(program, opts.selfPointerStackOffset, opts.reg);\n}\n}\nif (opts.reg === $.REG_PTR) {\nprogram.addCommand(\n$.CMD_ADD, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset()\n);\n} else {\nprogram.addCommand(\n$.CMD_ADD, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset(),\n$.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_G, $.REG_PTR\n);\n}\n} else if (opts.identifier.getPointer() && (opts.identifier.getType().type === t.LEXEME_STRING)) {\nhelper.setReg(this._program, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset());\n// If it's a \"with\" field then the offset is relative to the pointer on the stack not to the stack register itself!\nif (!opts.identifier.getGlobal() && (opts.identifier.getWithOffset() === null)) {\nhelper.addToReg(this._program, $.REG_PTR, $.T_NUM_G, $.REG_STACK);\n}\nprogram.addCommand($.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_P, 0);\n} else {\nresult.dataSize = opts.identifier.getTotalSize();\nhelper.setReg(this._program, opts.reg, $.T_NUM_C, opts.identifier.getOffset());\nif (opts.identifier.getWithOffset() === null) {\nif (opts.identifier.getPointer() && !opts.forWriting && (opts.identifier.getType().type !== t.LEXEME_NUMBER)) {\nif (!opts.identifier.getGlobal()) {\nhelper.addToReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK);\n}\nprogram.addCommand(\n$.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_G, opts.reg,\n$.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_P, 0\n);\n} else if (!opts.identifier.getGlobal()) {\nhelper.addToReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK);\n}\n}\n}\nresult.type = opts.identifier;\n}\nif (opts.identifier && opts.identifier.getArraySize && opts.identifier.getArraySize()) {\nresult.fullArrayAddress = false;\n}\nreturn result;\n}", "function compiler(input) {\n const tokens = tokenizer(input);\n const ast = parser(tokens);\n const newAst = transformer(ast);\n const output = codeGenerator(newAst);\n return output;\n}", "function parse(tokenStream) {\n\n let current = null;\n\n function* peek() {\n\n if (current === null)\n current = yield;\n\n return current;\n }\n\n function* eat(type = \"\") {\n\n let token = yield * peek();\n\n if (type && token.type !== type)\n throw new SyntaxError(\"Expected \" + type);\n\n current = null;\n return token;\n }\n\n function* parseAdd() {\n\n let node = yield * parseMultiply();\n\n while ((yield * peek()).type === \"+\") {\n\n yield * eat();\n let right = yield * parseMultiply()\n node = { type: \"+\", left: node, right, value: node.value + right.value };\n }\n\n return node;\n }\n\n function* parseMultiply() {\n\n let node = yield * eat(\"NUMBER\");\n\n while ((yield * peek()).type === \"*\") {\n\n yield * eat();\n let right = yield * eat(\"NUMBER\");\n node = { type: \"*\", left: node, right, value: node.value * right.value };\n }\n\n return node;\n }\n\n function* start() {\n\n let ast = yield * parseAdd();\n yield * eat(\"EOF\");\n return ast;\n };\n\n return new Observable(sink => {\n\n let generator = start();\n generator.next();\n\n return tokenStream.subscribe({\n\n next(x) {\n\n let result;\n\n try { result = generator.next(x) }\n catch (x) { return sink.error(x) }\n\n if (result.done)\n sink.complete(result.value);\n\n return result;\n },\n\n error(x) { return sink.error(x) },\n complete() { return this.next({ type: \"EOF\" }) },\n });\n });\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new ast[\"b\" /* Token */](TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new ast[\"b\" /* Token */](TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new ast[\"b\" /* Token */](TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new ast[\"b\" /* Token */](TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new ast[\"b\" /* Token */](TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new ast[\"b\" /* Token */](TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new ast[\"b\" /* Token */](TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new ast[\"b\" /* Token */](TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new ast[\"b\" /* Token */](TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new ast[\"b\" /* Token */](TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new ast[\"b\" /* Token */](TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new ast[\"b\" /* Token */](TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new ast[\"b\" /* Token */](TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new ast[\"b\" /* Token */](TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new ast[\"b\" /* Token */](TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw syntaxError(source, pos, unexpectedCharacterMessage(code));\n}", "function tokenBase(stream, state) {\n var ch = stream.next(),\n mightBeFunction = false,\n isEQName = isEQNameAhead(stream);\n\n // an XML tag (if not in some sub, chained tokenizer)\n if (ch == \"<\") {\n if(stream.match(\"!--\", true))\n return chain(stream, state, tokenXMLComment);\n\n if(stream.match(\"![CDATA\", false)) {\n state.tokenize = tokenCDATA;\n return \"tag\";\n }\n\n if(stream.match(\"?\", false)) {\n return chain(stream, state, tokenPreProcessing);\n }\n\n var isclose = stream.eat(\"/\");\n stream.eatSpace();\n var tagName = \"\", c;\n while ((c = stream.eat(/[^\\s\\u00a0=<>\\\"\\'\\/?]/))) tagName += c;\n\n return chain(stream, state, tokenTag(tagName, isclose));\n }\n // start code block\n else if(ch == \"{\") {\n pushStateStack(state,{ type: \"codeblock\"});\n return null;\n }\n // end code block\n else if(ch == \"}\") {\n popStateStack(state);\n return null;\n }\n // if we're in an XML block\n else if(isInXmlBlock(state)) {\n if(ch == \">\")\n return \"tag\";\n else if(ch == \"/\" && stream.eat(\">\")) {\n popStateStack(state);\n return \"tag\";\n }\n else\n return \"variable\";\n }\n // if a number\n else if (/\\d/.test(ch)) {\n stream.match(/^\\d*(?:\\.\\d*)?(?:E[+\\-]?\\d+)?/);\n return \"atom\";\n }\n // comment start\n else if (ch === \"(\" && stream.eat(\":\")) {\n pushStateStack(state, { type: \"comment\"});\n return chain(stream, state, tokenComment);\n }\n // quoted string\n else if ( !isEQName && (ch === '\"' || ch === \"'\"))\n return chain(stream, state, tokenString(ch));\n // variable\n else if(ch === \"$\") {\n return chain(stream, state, tokenVariable);\n }\n // assignment\n else if(ch ===\":\" && stream.eat(\"=\")) {\n return \"keyword\";\n }\n // open paren\n else if(ch === \"(\") {\n pushStateStack(state, { type: \"paren\"});\n return null;\n }\n // close paren\n else if(ch === \")\") {\n popStateStack(state);\n return null;\n }\n // open paren\n else if(ch === \"[\") {\n pushStateStack(state, { type: \"bracket\"});\n return null;\n }\n // close paren\n else if(ch === \"]\") {\n popStateStack(state);\n return null;\n }\n else {\n var known = keywords.propertyIsEnumerable(ch) && keywords[ch];\n\n // if there's a EQName ahead, consume the rest of the string portion, it's likely a function\n if(isEQName && ch === '\\\"') while(stream.next() !== '\"'){}\n if(isEQName && ch === '\\'') while(stream.next() !== '\\''){}\n\n // gobble up a word if the character is not known\n if(!known) stream.eatWhile(/[\\w\\$_-]/);\n\n // gobble a colon in the case that is a lib func type call fn:doc\n var foundColon = stream.eat(\":\");\n\n // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier\n // which should get matched as a keyword\n if(!stream.eat(\":\") && foundColon) {\n stream.eatWhile(/[\\w\\$_-]/);\n }\n // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)\n if(stream.match(/^[ \\t]*\\(/, false)) {\n mightBeFunction = true;\n }\n // is the word a keyword?\n var word = stream.current();\n known = keywords.propertyIsEnumerable(word) && keywords[word];\n\n // if we think it's a function call but not yet known,\n // set style to variable for now for lack of something better\n if(mightBeFunction && !known) known = {type: \"function_call\", style: \"variable def\"};\n\n // if the previous word was element, attribute, axis specifier, this word should be the name of that\n if(isInXmlConstructor(state)) {\n popStateStack(state);\n return \"variable\";\n }\n // as previously checked, if the word is element,attribute, axis specifier, call it an \"xmlconstructor\" and\n // push the stack so we know to look for it on the next word\n if(word == \"element\" || word == \"attribute\" || known.type == \"axis_specifier\") pushStateStack(state, {type: \"xmlconstructor\"});\n\n // if the word is known, return the details of that else just call this a generic 'word'\n return known ? known.style : \"variable\";\n }\n }", "function jsToken(inside, regexp, source, setInside) {\n function readHexNumber(){\n source.next(); // skip the 'x'\n source.nextWhileMatches(isHexDigit);\n return {type: \"number\", style: \"js-atom\"};\n }\n\n function readNumber() {\n source.nextWhileMatches(/[0-9]/);\n if (source.equals(\".\")){\n source.next();\n source.nextWhileMatches(/[0-9]/);\n }\n if (source.equals(\"e\") || source.equals(\"E\")){\n source.next();\n if (source.equals(\"-\"))\n source.next();\n source.nextWhileMatches(/[0-9]/);\n }\n return {type: \"number\", style: \"js-atom\"};\n }\n // Read a word, look it up in keywords. If not found, it is a\n // variable, otherwise it is a keyword of the type found.\n function readWord() {\n source.nextWhileMatches(isWordChar);\n var word = source.get();\n var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];\n return known ? {type: known.type, style: known.style, content: word} :\n {type: \"variable\", style: \"js-variable\", content: word};\n }\n function readRegexp() {\n nextUntilUnescaped(source, \"/\");\n source.nextWhileMatches(/[gi]/);\n return {type: \"regexp\", style: \"js-string\"};\n }\n // Mutli-line comments are tricky. We want to return the newlines\n // embedded in them as regular newline tokens, and then continue\n // returning a comment token for every line of the comment. So\n // some state has to be saved (inside) to indicate whether we are\n // inside a /* */ sequence.\n function readMultilineComment(start){\n var newInside = \"/*\";\n var maybeEnd = (start == \"*\");\n while (true) {\n if (source.endOfLine())\n break;\n var next = source.next();\n if (next == \"/\" && maybeEnd){\n newInside = null;\n break;\n }\n maybeEnd = (next == \"*\");\n }\n setInside(newInside);\n return {type: \"comment\", style: \"js-comment\"};\n }\n function readOperator() {\n source.nextWhileMatches(isOperatorChar);\n return {type: \"operator\", style: \"js-operator\"};\n }\n function readString(quote) {\n var endBackSlash = nextUntilUnescaped(source, quote);\n setInside(endBackSlash ? quote : null);\n return {type: \"string\", style: \"js-string\"};\n }\n\n // Fetch the next token. Dispatches on first character in the\n // stream, or first two characters when the first is a slash.\n if (inside == \"\\\"\" || inside == \"'\")\n return readString(inside);\n var ch = source.next();\n if (inside == \"/*\")\n return readMultilineComment(ch);\n else if (ch == \"\\\"\" || ch == \"'\")\n return readString(ch);\n // with punctuation, the type of the token is the symbol itself\n else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch))\n return {type: ch, style: \"js-punctuation\"};\n else if (ch == \"0\" && (source.equals(\"x\") || source.equals(\"X\")))\n return readHexNumber();\n else if (/[0-9]/.test(ch))\n return readNumber();\n else if (ch == \"/\"){\n if (source.equals(\"*\"))\n { source.next(); return readMultilineComment(ch); }\n else if (source.equals(\"/\"))\n { nextUntilUnescaped(source, null); return {type: \"comment\", style: \"js-comment\"};}\n else if (regexp)\n return readRegexp();\n else\n return readOperator();\n }\n else if (isOperatorChar.test(ch))\n return readOperator();\n else\n return readWord();\n }", "function PEGtoAST(node) {\n switch (type(node)) {\n case \"null\":\n return undefined;\n case \"string\":\n return new StringNode(node);\n case \"array\":\n return new ASTNodeList(...node.map(PEGtoAST));\n case \"object\":\n switch (node.TYPE) {\n case \"whitespace\":\n return new Whitespace();\n case \"parbreak\":\n return new Parbreak();\n case \"subscript\":\n return new Subscript(PEGtoAST(node.content));\n case \"superscript\":\n return new Superscript(PEGtoAST(node.content));\n case \"inlinemath\":\n return new InlineMath(PEGtoAST(node.content));\n case \"displaymath\":\n return new DisplayMath(PEGtoAST(node.content));\n case \"mathenv\":\n return new MathEnv(node.env, PEGtoAST(node.content));\n case \"group\":\n return new Group(PEGtoAST(node.content));\n case \"macro\":\n return new Macro(node.content, PEGtoAST(node.args));\n case \"environment\":\n return new Environment(\n PEGtoAST(node.env),\n PEGtoAST(node.args),\n PEGtoAST(node.content)\n );\n case \"verbatim\":\n return new Verbatim(PEGtoAST(node.content));\n case \"verb\":\n return new Verb(node[\"escape\"], PEGtoAST(node.content));\n case \"commentenv\":\n return new CommentEnv(PEGtoAST([node.content]));\n case \"comment\":\n return new CommentNode(\n node.sameline,\n PEGtoAST(node.content)\n );\n case \"arglist\":\n return new ArgList(PEGtoAST(node.content));\n }\n }\n}", "ast(code) {\n const tokens = splitIntoTokens(code)\n return buildAstFromTokens(tokens)\n }", "function parseTransform(spec, scope) {\n var def = definition(spec.type);\n if (!def) error('Unrecognized transform type: ' + $(spec.type));\n\n var t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope));\n if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t));\n t.metadata = def.metadata || {};\n\n return t;\n }", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, pos);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw (0, _error.syntaxError)(source, pos, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, pos + 1) === 46 && charCodeAt.call(body, pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n case 34:\n if (charCodeAt.call(body, pos + 1) === 34 && charCodeAt.call(body, pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev);\n }\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, pos);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw (0, _error.syntaxError)(source, pos, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, pos + 1) === 46 && charCodeAt.call(body, pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n case 34:\n if (charCodeAt.call(body, pos + 1) === 34 && charCodeAt.call(body, pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev);\n }\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, pos);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw (0, _error.syntaxError)(source, pos, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, pos + 1) === 46 && charCodeAt.call(body, pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n case 34:\n if (charCodeAt.call(body, pos + 1) === 34 && charCodeAt.call(body, pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev);\n }\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new Tok(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = charCodeAt.call(body, pos);\n\n // SourceCharacter\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw (0, _error.syntaxError)(source, pos, 'Cannot contain the invalid character ' + printCharCode(code) + '.');\n }\n\n switch (code) {\n // !\n case 33:\n return new Tok(TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n case 36:\n return new Tok(TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n case 38:\n return new Tok(TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n case 40:\n return new Tok(TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n case 41:\n return new Tok(TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n case 46:\n if (charCodeAt.call(body, pos + 1) === 46 && charCodeAt.call(body, pos + 2) === 46) {\n return new Tok(TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n break;\n // :\n case 58:\n return new Tok(TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n case 61:\n return new Tok(TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n case 64:\n return new Tok(TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n case 91:\n return new Tok(TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n case 93:\n return new Tok(TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n case 123:\n return new Tok(TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n case 124:\n return new Tok(TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n case 125:\n return new Tok(TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n case 34:\n if (charCodeAt.call(body, pos + 1) === 34 && charCodeAt.call(body, pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev);\n }\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _error.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = positionAfterWhitespace(body, prev.end, lexer);\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n\n if (pos >= bodyLength) {\n return new _ast.Token(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n }\n\n var code = body.charCodeAt(pos); // SourceCharacter\n\n switch (code) {\n // !\n case 33:\n return new _ast.Token(_tokenKind.TokenKind.BANG, pos, pos + 1, line, col, prev);\n // #\n\n case 35:\n return readComment(source, pos, line, col, prev);\n // $\n\n case 36:\n return new _ast.Token(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, line, col, prev);\n // &\n\n case 38:\n return new _ast.Token(_tokenKind.TokenKind.AMP, pos, pos + 1, line, col, prev);\n // (\n\n case 40:\n return new _ast.Token(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, line, col, prev);\n // )\n\n case 41:\n return new _ast.Token(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, line, col, prev);\n // .\n\n case 46:\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast.Token(_tokenKind.TokenKind.SPREAD, pos, pos + 3, line, col, prev);\n }\n\n break;\n // :\n\n case 58:\n return new _ast.Token(_tokenKind.TokenKind.COLON, pos, pos + 1, line, col, prev);\n // =\n\n case 61:\n return new _ast.Token(_tokenKind.TokenKind.EQUALS, pos, pos + 1, line, col, prev);\n // @\n\n case 64:\n return new _ast.Token(_tokenKind.TokenKind.AT, pos, pos + 1, line, col, prev);\n // [\n\n case 91:\n return new _ast.Token(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, line, col, prev);\n // ]\n\n case 93:\n return new _ast.Token(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, line, col, prev);\n // {\n\n case 123:\n return new _ast.Token(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, line, col, prev);\n // |\n\n case 124:\n return new _ast.Token(_tokenKind.TokenKind.PIPE, pos, pos + 1, line, col, prev);\n // }\n\n case 125:\n return new _ast.Token(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, line, col, prev);\n // A-Z _ a-z\n\n case 65:\n case 66:\n case 67:\n case 68:\n case 69:\n case 70:\n case 71:\n case 72:\n case 73:\n case 74:\n case 75:\n case 76:\n case 77:\n case 78:\n case 79:\n case 80:\n case 81:\n case 82:\n case 83:\n case 84:\n case 85:\n case 86:\n case 87:\n case 88:\n case 89:\n case 90:\n case 95:\n case 97:\n case 98:\n case 99:\n case 100:\n case 101:\n case 102:\n case 103:\n case 104:\n case 105:\n case 106:\n case 107:\n case 108:\n case 109:\n case 110:\n case 111:\n case 112:\n case 113:\n case 114:\n case 115:\n case 116:\n case 117:\n case 118:\n case 119:\n case 120:\n case 121:\n case 122:\n return readName(source, pos, line, col, prev);\n // - 0-9\n\n case 45:\n case 48:\n case 49:\n case 50:\n case 51:\n case 52:\n case 53:\n case 54:\n case 55:\n case 56:\n case 57:\n return readNumber(source, pos, code, line, col, prev);\n // \"\n\n case 34:\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, line, col, prev, lexer);\n }\n\n return readString(source, pos, line, col, prev);\n }\n\n throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n}", "function TokenStream(input) {\n var current = null;\n var keywords = ' true false let if else while func agent ';\n return {\n next : next,\n peek : peek,\n eof : eof,\n croak : input.croak\n };\n function is_keyword(x) {\n return keywords.indexOf(' ' + x + ' ') >= 0;\n }\n function is_digit(ch) {\n return /[0-9]/i.test(ch);\n }\n function is_id_start(ch) {\n return /[\\.\\/_A-Za-z]/i.test(ch);\n }\n function is_id(ch) {\n return is_id_start(ch) || '0123456789-+'.indexOf(ch) >= 0;\n }\n function is_op_char(ch) {\n return '+-*/^%=&|<>!:@$'.indexOf(ch) >= 0;\n }\n function is_punc(ch) {\n //return ',;(){}[]'.indexOf(ch) >= 0;\n return ',;(){}[]\\n'.indexOf(ch) >= 0;\n }\n function is_whitespace(ch) {\n //return ' \\t\\n'.indexOf(ch) >= 0;\n return ' \\t'.indexOf(ch) >= 0;\n }\n function read_while(predicate) {\n var str = '';\n while (!input.eof() && predicate(input.peek()))\n str += input.next();\n // console.log('Read ['+str+']');\n return str;\n }\n function read_number() {\n var has_dot = false;\n var number = read_while(function(ch){\n if (ch == '.') {\n if (has_dot) return false;\n has_dot = true;\n return true;\n }\n return is_digit(ch);\n });\n return { type: 'num', value: parseFloat(number) };\n }\n function read_ident() {\n var id = read_while(is_id);\n return {\n type : is_keyword(id) ? 'kw' : 'var',\n value : id\n };\n }\n function read_escaped(end) {\n var escaped = false, str = '';\n input.next();\n while (!input.eof()) {\n var ch = input.next();\n if (escaped) {\n str += ch;\n escaped = false;\n } else if (ch == '\\\\') {\n escaped = true;\n } else if (ch == end) {\n break;\n } else {\n str += ch;\n }\n }\n return str;\n }\n function read_string() {\n var ch = input.peek();\n return { type: 'str', value: read_escaped(ch) };\n }\n\n function read_line() {\n return { type: 'str', value: read_while(ch=>(ch != '\\n'))};\n }\n\n function skip_comment() {\n read_while(function(ch){ return ch != '\\n'; });\n input.next();\n }\n\n function read_next() {\n read_while(is_whitespace);\n if (input.eof()) return null;\n var ch = input.peek();\n // console.log('char: '+ch);\n if (ch == '#') {\n skip_comment();\n return read_next();\n }\n\n if (ch == '\"' || ch == \"'\") return read_string();\n if (is_digit(ch)) return read_number();\n if (is_id_start(ch)) return read_ident();\n // if (is_special_char(ch)) return read_special();\n \n if (is_punc(ch)) return {\n type : 'punc',\n value : input.next()\n };\n if (is_op_char(ch)) return {\n type : 'op',\n value : read_while(is_op_char)\n };\n\n input.croak('Can\\'t handle character: ' + ch);\n }\n\n function peek() {\n return current || (current = read_next());\n }\n\n function next() {\n var tok = current;\n current = null;\n return tok || read_next();\n }\n\n function eof() {\n return peek() == null;\n }\n}", "function sequence() {\n var parsers = [];\n for(var i = 0; i < arguments.length; ++i)\n parsers.push(toParser(arguments[i]));\n var pid = parser_id++;\n return function(state) {\n var savedState = state;\n var cached = savedState.getCached(pid);\n if(cached) {\n return cached;\n }\n\n var ast = [];\n var matched = \"\";\n var i;\n for(i=0; i< parsers.length; ++i) {\n var parser = parsers[i];\n var result = parser(state);\n if(result) {\n state = result.remaining;\n if(result.ast != undefined) {\n ast.push(result.ast);\n matched = matched + result.matched;\n }\n }\n else {\n break;\n }\n }\n if(i == parsers.length) {\n cached = make_result(state, matched, ast);\n }\n else\n cached = false;\n savedState.putCached(pid, cached);\n return cached;\n };\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // <BOM>\n\n case 9: // \\t\n\n case 32: // <space>\n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new _ast.Token(_tokenKind.TokenKind.BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new _ast.Token(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new _ast.Token(_tokenKind.TokenKind.AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new _ast.Token(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new _ast.Token(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast.Token(_tokenKind.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new _ast.Token(_tokenKind.TokenKind.COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new _ast.Token(_tokenKind.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new _ast.Token(_tokenKind.TokenKind.AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new _ast.Token(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new _ast.Token(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new _ast.Token(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new _ast.Token(_tokenKind.TokenKind.PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new _ast.Token(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new _ast.Token(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n}", "function readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // <BOM>\n\n case 9: // \\t\n\n case 32: // <space>\n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new _ast.Token(_tokenKind.TokenKind.BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new _ast.Token(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new _ast.Token(_tokenKind.TokenKind.AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new _ast.Token(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new _ast.Token(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new _ast.Token(_tokenKind.TokenKind.SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new _ast.Token(_tokenKind.TokenKind.COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new _ast.Token(_tokenKind.TokenKind.EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new _ast.Token(_tokenKind.TokenKind.AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new _ast.Token(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new _ast.Token(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new _ast.Token(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new _ast.Token(_tokenKind.TokenKind.PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new _ast.Token(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new _ast.Token(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n}", "function getToken(line) {\n line = line.replace(CommentsRegex, '') //remove the comments parts\n line = line.replace(/^\\s+|\\s+$/, '') // strip the spaces\n let match\n if (match = MemoryRegex.exec(line)) {\n return {\n type: 'memory',\n command: match[0],\n operator: match[1],\n segment: match[2],\n index: match[3]\n }\n } else if (match = ALRegex.exec(line)) {\n return {\n type: 'al',\n command: match[0],\n operator: match[1]\n }\n } else if (match = FunctionRegex.exec(line)) {\n return {\n type: 'function',\n command: match[0],\n action: match[1],\n functionName: match[2],\n count: match[3]\n }\n } else if (match = FlowRegex.exec(line)) {\n return {\n type: 'flow',\n command: match[0],\n operator: match[1],\n label: match[2]\n }\n } else if (/^\\s*$/.exec(line)) { // an empty line\n return null\n } else {\n throw SyntaxError('Unrecognizable Commmand.')\n }\n}", "latex_macros() {\n switch (this.render_method) {\n case null:\n return this.macros;\n\n case \"MathJax\":\n // This seems to be more effective than defining macros using `MathJax.Hub.Config`.\n return Array.from(this.macros).map(([name, { definition, arity }]) => {\n return `\\\\newcommand{${name}}[${arity}]{${definition}}`;\n }).join(\"\");\n\n case \"KaTeX\":\n const macros = {};\n for (const [name, { definition }] of this.macros) {\n // Arities are implicit in KaTeX.\n macros[name] = definition;\n }\n return macros;\n }\n }", "function create_macro (element) {\n return Drupal.media.filter.create_macro(element);\n}", "function compile(json) {\r\n if(!json || typeof (json) !== \"object\") {\r\n throw new Error(\"Monarch: expecting a language definition object\");\r\n }\r\n // Get names\r\n if(typeof (json.name) !== \"string\") {\r\n throw new Error(\"Monarch: a language definition must include a string 'name' attribute\");\r\n }\r\n // Create our lexer\r\n var lexer = {\r\n };\r\n lexer.name = json.name;\r\n lexer.displayName = string(json.displayName, lexer.name);\r\n lexer.logConsole = string(json.logConsole);\r\n lexer.noThrow = false// raise exceptions during compilation\r\n ;\r\n lexer.maxStack = 100;\r\n // Set standard fields: be defensive about types\r\n lexer.mimeTypes = stringArray(json.mimeTypes, undefined, function () {\r\n Common.throwError(lexer, \"the attribute 'mimeTypes' must be defined as an array of strings\");\r\n });\r\n lexer.start = string(json.start);\r\n lexer.fileExtensions = stringArray(json.fileExtensions);\r\n lexer.ignoreCase = bool(json.ignoreCase, false);\r\n lexer.lineComment = string(json.lineComment, \"//\");\r\n lexer.blockCommentStart = string(json.blockCommentStart, \"/*\");\r\n lexer.blockCommentEnd = string(json.blockCommentEnd, \"*/\");\r\n lexer.tokenPostfix = string(json.tokenPostfix, \".\" + lexer.name);\r\n lexer.defaultToken = string(json.defaultToken, \"source\", function () {\r\n Common.throwError(lexer, \"the 'defaultToken' must be a string\");\r\n });\r\n lexer.editorOptions = (!json.editorOptions ? null : json.editorOptions);\r\n lexer.workerScriptPath = string(json.workerScriptPath);\r\n lexer.usesEmbedded = false// becomes true if we find a nextEmbedded action\r\n ;\r\n // COMPAT: with earlier monarch versions\r\n if(!lexer.lineComment && (json).lineComments) {\r\n if(typeof ((json).lineComments) === \"string\") {\r\n lexer.lineComment = (json).lineComments;\r\n } else if(typeof ((json).lineComments[0]) === \"string\") {\r\n lexer.lineComment = (json).lineComments[0];\r\n }\r\n }\r\n // For calling compileAction later on\r\n var lexerMin = json;\r\n lexerMin.name = lexer.name;\r\n lexerMin.displayName = lexer.displayName;\r\n lexerMin.ignoreCase = lexer.ignoreCase , lexerMin.noThrow = lexer.noThrow , lexerMin.usesEmbedded = lexer.usesEmbedded , lexerMin.stateNames = json.tokenizer , lexerMin.logConsole = lexer.logConsole , lexerMin.defaultToken = lexer.defaultToken;\r\n // Compile an array of rules into newrules where RegExp objects are created.\r\n function addRules(state, newrules, rules) {\r\n var idx;\r\n for(idx in rules) {\r\n var rule = rules[idx];\r\n var include = rule.include;\r\n if(include) {\r\n if(typeof (include) !== \"string\") {\r\n Common.throwError(lexer, \"an 'include' attribute must be a string at: \" + state);\r\n }\r\n if(include[0] === \"@\") {\r\n include = include.substr(1);\r\n }// peel off starting @\r\n \r\n if(!json.tokenizer[include]) {\r\n Common.throwError(lexer, \"include target '\" + include + \"' is not defined at: \" + state);\r\n }\r\n addRules(state + \".\" + include, newrules, json.tokenizer[include]);\r\n } else {\r\n var newrule = new Rule(state);\r\n // Set up new rule attributes\r\n if(rule instanceof Array && rule.length >= 1 && rule.length <= 3) {\r\n newrule.setRegex(lexerMin, rule[0]);\r\n if(rule.length >= 3) {\r\n if(typeof (rule[1]) === \"string\") {\r\n newrule.setAction(lexerMin, {\r\n token: rule[1],\r\n next: rule[2]\r\n });\r\n } else if(typeof (rule[1]) === \"object\") {\r\n var rule1 = rule[1];\r\n rule1.next = rule[2];\r\n newrule.setAction(lexerMin, rule1);\r\n } else {\r\n Common.throwError(lexer, \"a next state as the last element of a rule can only be given if the action is either an object or a string, at: \" + state);\r\n }\r\n } else {\r\n newrule.setAction(lexerMin, rule[1]);\r\n }\r\n } else {\r\n if(!rule.regex) {\r\n Common.throwError(lexer, \"a rule must either be an array, or an object with a 'regex' or 'include' field at: \" + state);\r\n }\r\n if(rule.name) {\r\n newrule.name = string(rule.name);\r\n }\r\n if(rule.matchOnlyAtStart) {\r\n newrule.matchOnlyAtLineStart = bool(rule.matchOnlyAtLineStart);\r\n }\r\n newrule.setRegex(lexerMin, rule.regex);\r\n newrule.setAction(lexerMin, rule.action);\r\n }\r\n newrules.push(newrule);\r\n }\r\n }\r\n }\r\n // compile the tokenizer rules\r\n if(!json.tokenizer || typeof (json.tokenizer) !== \"object\") {\r\n Common.throwError(lexer, \"a language definition must define the 'tokenizer' attribute as an object\");\r\n }\r\n lexer.tokenizer = [];\r\n var key;\r\n for(key in json.tokenizer) {\r\n if(!lexer.start) {\r\n lexer.start = key;\r\n }\r\n var rules = json.tokenizer[key];\r\n lexer.tokenizer[key] = new Array();\r\n addRules(\"tokenizer.\" + key, lexer.tokenizer[key], rules);\r\n }\r\n lexer.usesEmbedded = lexerMin.usesEmbedded// can be set during compileAction\r\n ;\r\n // nonWordTokens\r\n lexer.nonWordTokens = stringArray(json.nonWordTokens, [\r\n \"delimiter\", \r\n \"delimiter.parenthesis\", \r\n \"delimiter.curly\", \r\n \"delimiter.square\", \r\n \"delimiter.angle\"\r\n ], function () {\r\n Common.throwError(lexer, \"the 'nonWordTokens' attribute must be an array of strings\");\r\n });\r\n var idx;\r\n for(idx in lexer.nonWordTokens) {\r\n lexer.nonWordTokens[idx] += lexer.tokenPostfix;\r\n }\r\n // Set brackets\r\n if(json.brackets) {\r\n if(!(json.brackets instanceof Array)) {\r\n Common.throwError(lexer, \"the 'brackets' attribute must be defined as an array\");\r\n }\r\n } else {\r\n json.brackets = [\r\n {\r\n open: \"{\",\r\n close: \"}\",\r\n token: \"delimiter.curly\"\r\n }, \r\n {\r\n open: \"[\",\r\n close: \"]\",\r\n token: \"delimiter.square\"\r\n }, \r\n {\r\n open: \"(\",\r\n close: \")\",\r\n token: \"delimiter.parenthesis\"\r\n }, \r\n {\r\n open: \"<\",\r\n close: \">\",\r\n token: \"delimiter.angle\"\r\n }\r\n ];\r\n }\r\n var brackets = [];\r\n for(var idx in json.brackets) {\r\n var desc = json.brackets[idx];\r\n if(desc && desc instanceof Array && desc.length === 3) {\r\n desc = {\r\n token: desc[2],\r\n open: desc[0],\r\n close: desc[1]\r\n };\r\n }\r\n if(desc.open === desc.close) {\r\n Common.throwError(lexer, \"open and close brackets in a 'brackets' attribute must be different: \" + desc.open + \"\\n hint: use the 'bracket' attribute if matching on equal brackets is required.\");\r\n }\r\n if(typeof (desc.open) === \"string\" && typeof (desc.token) === \"string\") {\r\n brackets.push({\r\n token: string(desc.token) + lexer.tokenPostfix,\r\n open: Common.fixCase(lexer, string(desc.open)),\r\n close: Common.fixCase(lexer, string(desc.close))\r\n });\r\n } else {\r\n Common.throwError(lexer, \"every element in the 'brackets' array must be a '{open,close,token}' object or array\");\r\n }\r\n }\r\n lexer.brackets = brackets;\r\n // Set default auto closing pairs\r\n var autoClosingPairs;\r\n if(json.autoClosingPairs) {\r\n if(!(json.autoClosingPairs instanceof Array)) {\r\n Common.throwError(lexer, \"the 'autoClosingPairs' attribute must be an array of string pairs (as arrays)\");\r\n }\r\n autoClosingPairs = json.autoClosingPairs.slice(0);\r\n } else {\r\n autoClosingPairs = [\r\n [\r\n \"\\\"\", \r\n \"\\\"\"\r\n ], \r\n [\r\n \"'\", \r\n \"'\"\r\n ], \r\n [\r\n \"@brackets\"\r\n ]\r\n ];\r\n }\r\n // set auto closing pairs\r\n lexer.autoClosingPairs = [];\r\n if(autoClosingPairs) {\r\n for(var idx in autoClosingPairs) {\r\n var pair = autoClosingPairs[idx];\r\n var openClose;\r\n if(pair === \"@brackets\" || pair[0] === \"@brackets\") {\r\n var bidx;\r\n for(bidx in brackets) {\r\n if(brackets[bidx].open && brackets[bidx].open.length === 1 && brackets[bidx].close && brackets[bidx].close.length === 1) {\r\n openClose = {\r\n open: brackets[bidx].open,\r\n close: brackets[bidx].close\r\n };\r\n lexer.autoClosingPairs.push(openClose);\r\n }\r\n }\r\n } else if(pair instanceof Array && pair.length === 2 && typeof (pair[0]) === \"string\" && pair[0].length === 1 && typeof (pair[1]) === \"string\" && pair[1].length === 1) {\r\n openClose = {\r\n open: Common.fixCase(lexer, pair[0]),\r\n close: Common.fixCase(lexer, pair[1])\r\n };\r\n lexer.autoClosingPairs.push(openClose);\r\n } else if(typeof (pair.open) === \"string\" && pair.open.length === 1 && typeof (pair.close) === \"string\" && pair.close.length === 1) {\r\n openClose = {\r\n open: Common.fixCase(lexer, pair.open[0]),\r\n close: Common.fixCase(lexer, pair.close[0])\r\n };\r\n lexer.autoClosingPairs.push(openClose);\r\n } else {\r\n Common.throwError(lexer, \"every element in an 'autoClosingPairs' array must be a pair of 1 character strings, or a '@brackets' directive\");\r\n }\r\n }\r\n }\r\n // custom auto indentation\r\n if(json.autoIndent) {\r\n var autoIndent = [];\r\n if(!(json.autoIndent instanceof Array)) {\r\n Common.throwError(lexer, \"an 'autoIndent' attribute must be an array of '{match,matchAfter}' objects\");\r\n }\r\n var i;\r\n for(i in json.autoIndent) {\r\n if(typeof (json.autoIndent[i].match) !== \"string\") {\r\n Common.throwError(lexer, \"each object in the 'autoIndent' array must define a 'match' attribute\");\r\n }\r\n autoIndent.push({\r\n match: compileRegExp(lexer, json.autoIndent[i].match),\r\n matchAfter: compileRegExp(lexer, string(json.autoIndent[i].matchAfter))\r\n });\r\n }\r\n lexer.autoIndent = autoIndent;\r\n }\r\n // custom auto completion\r\n if(json.autoComplete) {\r\n var autoComplete = [];\r\n if(!(json.autoComplete instanceof Array)) {\r\n Common.throwError(lexer, \"an 'autoComplete' attribute must be an array of '{trigger,match,complete}' objects\");\r\n }\r\n for(var i in json.autoComplete) {\r\n if(typeof (json.autoComplete[i].triggers) !== \"string\") {\r\n Common.throwError(lexer, \"each object in the 'autoComplete' array must define a 'triggers' attribute\");\r\n }\r\n if(typeof (json.autoComplete[i].match) !== \"string\") {\r\n Common.throwError(lexer, \"each object in the 'autoComplete' array must define a 'match' attribute as a regular expression string\");\r\n }\r\n if(typeof (json.autoComplete[i].complete) !== \"string\") {\r\n Common.throwError(lexer, \"each object in the 'autoComplete' array must define a 'complete' attribute\");\r\n }\r\n autoComplete.push({\r\n triggers: Common.fixCase(lexer, string(json.autoComplete[i].triggers)),\r\n match: compileRegExp(lexer, json.autoComplete[i].match),\r\n complete: string(json.autoComplete[i].complete)\r\n });\r\n }\r\n lexer.autoComplete = autoComplete;\r\n }\r\n // noindentBrackets: a regex that excludes certain brackets from doing indentation\r\n if(json.noindentBrackets) {\r\n var re = regExString(json.noindentBrackets, null, function () {\r\n Common.throwError(lexer, \"the 'noindentBrackets' must be a regular expression string\");\r\n });\r\n lexer.noindentBrackets = compileRegExp(lexer, re);\r\n }\r\n // Construct electric chars: ie. chars where onElectricChar is called when typed\r\n var electricChars = [];\r\n for(var i in lexer.brackets) {\r\n var close = lexer.brackets[i].close;\r\n if(close && close.length > 0) {\r\n if(!lexer.noindentBrackets || !lexer.noindentBrackets.test(close)) {\r\n electricChars.push(close.substr(close.length - 1))// take last character\r\n ;\r\n }\r\n }\r\n }\r\n for(var i in lexer.autoComplete) {\r\n electricChars.push(lexer.autoComplete[i].triggers);\r\n }\r\n lexer.electricChars = electricChars.join(\"\") + string(json.outdentTriggers, \"\");\r\n // Enable logging now (if not set already)\r\n if(!lexer.logConsole) {\r\n lexer.logConsole = \"monarchConsole\";\r\n }\r\n // Disable throw so the syntax highlighter goes, no matter what\r\n lexer.noThrow = true;\r\n return lexer;\r\n }", "_readObject(token) {\n switch (token.type) {\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._readDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else this._object = this._literal(token.value, this._namedNode(token.prefix));\n break;\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject, this._predicate, this._subject = this._blankNode());\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode) return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate, this._graph = this._blankNode());\n return this._readSubject;\n case '<<':\n if (!this._supportsRDFStar) return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, this._subject, this._predicate, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the object entity\n if ((this._object = this._readEntity(token)) === undefined) return;\n // In N3 mode, the object might be a path\n if (this._n3Mode) return this._getPathReader(this._getContextEndReader());\n }\n return this._getContextEndReader();\n }", "function FlatTree(root, comment) {\n var lines = [];\n function traverse(node, indent) {\n if(comment != null) {\n var s = \"\";\n for(var j = 0; j < indent; j++) {\n s += \" \";\n }\n s += comment + \" <<\" + node.Name + \">> ( \" + node.Filename + \":\" + node.Linenumber + \" )\";\n \n lines.push(s);\n }\n for(var i = 0; i < node.MacroContentArray.length; i++) {\n var c = node.MacroContentArray[i];\n if(c.IsMacroReference) {\n if(\"Ref\" in c && c.Ref != null) {\n traverse(c.Ref, indent + c.Indent);\n } else {\n lines.push(\"<<\" + c.Name + \">>\");\n }\n } else {\n // indent the line\n var s = \"\";\n for(var j = 0; j < indent + c.Indent; j++) {\n s += \" \";\n }\n lines.push(s + c.Code);\n }\n }\n }\n traverse(root, 0);\n return lines;\n}", "function RecognizeInstruction(node){\n switch(node.operation){\n case literal.operation.DECLARATION:\n if(node.childs.length > 0){\n return new Declaration(node.value, node.type, node.constant, node.dynamic, node.array, RecognizeOperation(node.childs[0]), node.row, node.column);\n }\n return new Declaration(node.value, node.type, node.constant, node.dynamic, node.array, undefined, node.row, node.column);\n case literal.operation.ASSIGNMENT:\n if(node.childs.length == 1){\n return new Assignment(node.value, RecognizeOperation(node.childs[0]), node.row, node.column);\n }\n return new Assignment(RecognizeOperation(node.childs[0]), RecognizeOperation(node.childs[1]), node.row, node.column);\n case literal.operation.TYPE_DECLARATION:\n return new TypeDeclaration(node.value, node.value, node.childs, node.row, node.column);\n case literal.operation.IF:\n const trueList = [];\n const falseList = [];\n switch(node.childs.length){\n case 1:\n return new If(RecognizeOperation(node.childs[0]), trueList, falseList, node.row, node.column);\n case 2:\n if(node.childs[1].operation == literal.operation.SENTENCES){\n node.childs[1].childs.forEach((node) => {\n trueList.push(RecognizeInstruction(node));\n });\n }else{\n node.childs[1].childs[0].childs.forEach((node) => {\n falseList.push(RecognizeInstruction(node));\n });\n }\n return new If(RecognizeOperation(node.childs[0]), trueList, falseList, node.row, node.column);\n case 3:\n if(node.childs[1].operation == literal.operation.SENTENCES){\n node.childs[1].childs.forEach((node) => {\n trueList.push(RecognizeInstruction(node));\n });\n node.childs[2].childs[0].childs.forEach((node) => {\n falseList.push(RecognizeInstruction(node));\n });\n }else{\n falseList.push(RecognizeInstruction(node.childs[2]));\n }\n return new If(RecognizeOperation(node.childs[0]), trueList, falseList, node.row, node.column);\n default:\n node.childs[1].childs.forEach((node) => {\n trueList.push(RecognizeInstruction(node));\n });\n falseList.push(RecognizeInstruction(node.childs[3]));\n return new If(RecognizeOperation(node.childs[0]), trueList, falseList, node.row, node.column);\n }\n case literal.operation.SWITCH:\n const casesList = [];\n if(node.childs.length > 1){\n node.childs[1].childs.forEach((node) => {\n casesList.push(RecognizeInstruction(node));\n });\n }\n return new Switch(RecognizeOperation(node.childs[0]), casesList, node.row, node.column);\n case literal.operation.CASE:\n const instructionsList = [];\n if(node.childs.length > 1){\n node.childs[1].childs.forEach((node) => {\n instructionsList.push(RecognizeInstruction(node));\n });\n }\n return new Case(RecognizeOperation(node.childs[0]), instructionsList, node.row, node.column);\n case literal.operation.DEFAULT:\n const instructionsListDefault = [];\n if(node.childs){\n node.childs[0].childs.forEach((node) => {\n instructionsListDefault.push(RecognizeInstruction(node));\n });\n }\n return new Case(null, instructionsListDefault, node.row, node.column);\n case literal.operation.WHILE:\n let instructions = [];\n if(node.childs.length > 1){\n node.childs[1].childs.forEach((node) => {\n instructions.push(RecognizeInstruction(node));\n });\n }\n return new While(RecognizeOperation(node.childs[0]), instructions, node.row, node.column);\n case literal.operation.DO_WHILE:\n const instructionsDoWhile = [];\n if(node.childs.length > 1){\n node.childs[0].childs.forEach((node) => {\n instructionsDoWhile.push(RecognizeInstruction(node));\n });\n return new DoWhile(instructionsDoWhile, RecognizeOperation(node.childs[1]), node.row, node.column);\n }\n return new DoWhile(instructionsDoWhile, RecognizeOperation(node.childs[0]), node.row, node.column);\n case literal.operation.FOR:\n const listInstructionsFor = [];\n if(node.childs.length > 3){\n node.childs[3].childs.forEach((node) => {\n listInstructionsFor.push(RecognizeInstruction(node));\n });\n }\n return new For(RecognizeInstruction(node.childs[0]), RecognizeOperation(node.childs[1]), RecognizeInstruction(node.childs[2]), listInstructionsFor, node.row, node.column);\n case literal.operation.INCREMENT:\n return RecognizeOperation(node);\n case literal.operation.DECREMENT:\n return RecognizeOperation(node);\n case literal.operation.FOR_IN:\n const listInstructionsForIn = [];\n if(node.childs.length > 2){\n node.childs[2].childs.forEach((node) => {\n listInstructionsForIn.push(RecognizeInstruction(node));\n });\n }\n if(node.childs[0].operation == literal.operation.DECLARATION){\n return new ForIn(RecognizeInstruction(node.childs[0]), RecognizeOperation(node.childs[1]), listInstructionsForIn, node.row, node.column);\n }\n return new ForIn(RecognizeOperation(node.childs[0]), RecognizeOperation(node.childs[1]), listInstructionsForIn, node.row, node.column);\n case literal.operation.FOR_OF:\n const listInstructionsForOf = [];\n if(node.childs.length > 2){\n node.childs[2].childs.forEach((node) => {\n listInstructionsForOf.push(RecognizeInstruction(node));\n });\n }\n if(node.childs[0].operation == literal.operation.DECLARATION){\n return new ForOf(RecognizeInstruction(node.childs[0]), RecognizeOperation(node.childs[1]), listInstructionsForOf, node.row, node.column);\n }\n return new ForOf(RecognizeOperation(node.childs[0]), RecognizeOperation(node.childs[1]), listInstructionsForOf, node.row, node.column);\n case literal.operation.FUNCTION_CALL:\n return RecognizeOperation(node);\n case literal.operation.PRINT:\n const listExpressions = [];\n if(node.childs.length){\n node.childs.forEach((node) => {\n listExpressions.push(RecognizeOperation(node));\n });\n return new Print(listExpressions, node.row, node.column);\n }\n return new Print(null, node.row, node.column);\n case literal.operation.GRAPH_TS:\n return new GraphTs(node.row, node.column);\n case literal.operation.BREAK:\n return new Break(node.row, node.column);\n case literal.operation.CONTINUE:\n return new Continue(node.row, node.column);\n case literal.operation.RETURN:\n if(node.childs.length){\n return new Return(RecognizeOperation(node.childs[0]), node.row, node.column);\n }\n return new Return(null, node.row, node.column);\n case literal.operation.PUSH:\n return RecognizeOperation(node);\n case literal.operation.POP:\n return RecognizeOperation(node);\n case literal.operation.LENGTH:\n return RecognizeOperation(node);\n case literal.operation.FUNCTION:\n let parametersListFunction = [];\n const instructionsListFunction = [];\n if(node.childs.length == 2){\n if(node.childs[1].operation == 'LPARAMETERS'){\n parametersListFunction = ExtractParameterList(node.childs[1], []); \n }else{\n node.childs[1].childs.forEach((node) => {\n instructionsListFunction.push(RecognizeInstruction(node));\n });\n }\n }else if(node.childs.length == 3){\n parametersListFunction = ExtractParameterList(node.childs[1], []);\n node.childs[2].childs.forEach((node) => {\n instructionsListFunction.push(RecognizeInstruction(node));\n });\n }\n return new Function(node.childs[0].value, parametersListFunction, node.type, node.array, instructionsListFunction, node.row, node.column);\n default:\n return null;\n }\n}", "async parse(options = {}) {\n if (!this.file.path) {\n throw new Error(`Missing underlying file component with a path.`)\n }\n\n const { code, ast, meta } = await require('@skypager/helpers-mdx')(this.content, {\n filePath: this.file.path,\n ...options,\n rehypePlugins: [\n () => tree => {\n this.state.set('rehypeAst', tree)\n return tree\n },\n ],\n babel: false,\n })\n\n this.state.set('parsed', true)\n this.state.set('parsedContent', code)\n\n return { ast, code, meta }\n }", "function parseToMFS(expr) {\n var rslt = [],\n parts;\n if (expr) {\n parts = splitSquareBrackets(expr);\n if (parts.inside) {\n rslt.push({ type: 'sub', value: [parseToMFS(parts.before),\n parseToMFS(parts.inside)]});\n if (parts.after) {\n rslt.push(parseToMFS(parts.after));\n }\n }\n else {\n rslt.push(formatText(parts.before));\n }\n }\n return rslt.length === 1\n ? rslt[0]\n // variadic call\n : GSP.mfs.makeHorizontalMFS.apply(this, rslt);\n }", "function walk_tree(ast) {\n var walker = {\n \"assign\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n assign_expr.left_expr = walk_tree(ast[2]);\n assign_expr.right_expr = walk_tree(ast[3]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr;\n },\n \n \"var\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n \n assign_expr.left_expr = new type_object();\n assign_expr.left_expr.name = ast[1][0][0];\n assign_expr.right_expr = walk_tree(ast[1][0][1]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr; \n },\n \n \"stat\" : function() {\n return walk_tree(ast[1]);\n },\n \n \"dot\" : function() {\n var dot_obj = walk_tree(ast[1]);\n dot_obj.child = new type_object();\n dot_obj.child.name = ast[2];\n dot_obj.child.parent = dot_obj;\n return dot_obj;\n },\n \n \"name\" : function() {\n var new_obj = new type_object();\n new_obj.type = \"name\";\n new_obj.name = ast[1];\n return new_obj;\n },\n \n \"new\" : function() {\n var expr = walk_tree(ast[1]);\n expr.type = \"composition\";\n return expr;\n },\n \n \"function\" : function() {\n var func = new type_function(\"function\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"defun\" : function() { \n var func = new type_function(\"defun\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"return\" : function() {\n var return_expr = new type_expression();\n return_expr.type = \"return_expr\";\n return_expr.expr = walk_tree(ast[1]);\n return return_expr;\n },\n \n \"string\" : function() {\n var obj = new type_object();\n obj.type = \"string\";\n obj.value = ast[1];\n return obj;\n },\n \n \"num\" : function() {\n var obj = new type_object();\n obj.type = \"num\";\n obj.value = ast[1];\n return obj;\n },\n \n \"binary\" : function() {\n var binary_expr = new binary_expression();\n binary_expr.type = \"binary_expr\";\n binary_expr.binary_lhs = walk_tree(ast[2]);\n binary_expr.binary_rhs = walk_tree(ast[3]);\n },\n }\n \n var parent = ast[0];\n \n var func = walker[parent];\n \n return func(ast);\n}", "function makeLexer() {\n const mooLexer = moo.compile(tokens);\n\n return {\n current: null,\n lines: [],\n get line() {\n return mooLexer.line;\n },\n get col() {\n return mooLexer.col;\n },\n save() {\n return mooLexer.save();\n },\n reset(chunk, info) {\n this.lines = chunk.split('\\n');\n return mooLexer.reset(chunk, info);\n },\n next() {\n // It's a cruel and unusual punishment to implement comments with nearly\n let token = mooLexer.next();\n // Drop all comment tokens found\n while (token && token.type === 'comment') {\n token = mooLexer.next();\n }\n this.current = token;\n return this.current;\n },\n formatError(token) {\n return mooLexer.formatError(token);\n },\n has(name) {\n return mooLexer.has(name);\n },\n };\n}", "function readToken(source, fromPosition) {\n\t var body = source.body;\n\t var bodyLength = body.length;\n\n\t var position = positionAfterWhitespace(body, fromPosition);\n\n\t if (position >= bodyLength) {\n\t return makeToken(TokenKind.EOF, position, position);\n\t }\n\n\t var code = charCodeAt.call(body, position);\n\n\t // SourceCharacter\n\t if (code < 0x0020 && code !== 0x0009 && code !== 0x000A && code !== 0x000D) {\n\t throw (0, _error.syntaxError)(source, position, 'Invalid character ' + printCharCode(code) + '.');\n\t }\n\n\t switch (code) {\n\t // !\n\t case 33:\n\t return makeToken(TokenKind.BANG, position, position + 1);\n\t // $\n\t case 36:\n\t return makeToken(TokenKind.DOLLAR, position, position + 1);\n\t // (\n\t case 40:\n\t return makeToken(TokenKind.PAREN_L, position, position + 1);\n\t // )\n\t case 41:\n\t return makeToken(TokenKind.PAREN_R, position, position + 1);\n\t // .\n\t case 46:\n\t if (charCodeAt.call(body, position + 1) === 46 && charCodeAt.call(body, position + 2) === 46) {\n\t return makeToken(TokenKind.SPREAD, position, position + 3);\n\t }\n\t break;\n\t // :\n\t case 58:\n\t return makeToken(TokenKind.COLON, position, position + 1);\n\t // =\n\t case 61:\n\t return makeToken(TokenKind.EQUALS, position, position + 1);\n\t // @\n\t case 64:\n\t return makeToken(TokenKind.AT, position, position + 1);\n\t // [\n\t case 91:\n\t return makeToken(TokenKind.BRACKET_L, position, position + 1);\n\t // ]\n\t case 93:\n\t return makeToken(TokenKind.BRACKET_R, position, position + 1);\n\t // {\n\t case 123:\n\t return makeToken(TokenKind.BRACE_L, position, position + 1);\n\t // |\n\t case 124:\n\t return makeToken(TokenKind.PIPE, position, position + 1);\n\t // }\n\t case 125:\n\t return makeToken(TokenKind.BRACE_R, position, position + 1);\n\t // A-Z\n\t case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:\n\t case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:\n\t case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:\n\t case 89:case 90:\n\t // _\n\t case 95:\n\t // a-z\n\t case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:\n\t case 105:case 106:case 107:case 108:case 109:case 110:case 111:\n\t case 112:case 113:case 114:case 115:case 116:case 117:case 118:\n\t case 119:case 120:case 121:case 122:\n\t return readName(source, position);\n\t // -\n\t case 45:\n\t // 0-9\n\t case 48:case 49:case 50:case 51:case 52:\n\t case 53:case 54:case 55:case 56:case 57:\n\t return readNumber(source, position, code);\n\t // \"\n\t case 34:\n\t return readString(source, position);\n\t }\n\n\t throw (0, _error.syntaxError)(source, position, 'Unexpected character ' + printCharCode(code) + '.');\n\t}", "function compile(spec) {\n return \"with (this) {\" +\n \" return [\" + spec + \"]\" +\n \"}\";\n }", "function church_tree_to_esprima_ast(church_tree) {\n\tvar heads_to_helpers = {\n\t\t\"lambda\": make_function_expression,\n\t\t\"if\": make_if_expression,\n\t\t\"quote\": make_quoted_expression\n\t}\n\n\tfunction make_declaration(church_tree) {\n\t\tvalidate_variable(church_tree.children[1]);\n\n\t\tvar name = church_tree.children[1].text;\n\t\tvar val = make_expression(church_tree.children[2]);\n\n\t\tvar node = deep_copy(declaration_node);\n\t\tnode[\"declarations\"][0][\"id\"][\"name\"] = name;\n\t\tnode[\"declarations\"][0][\"init\"] = val;\n\t\treturn node;\n\t}\n\n\tfunction make_marginalize(lambda_args, mh_query) {\n\t\t// TODO\n\t\tvar call_expression = deep_copy(call_expression_node);\n\t\tcall_expression[\"callee\"] = {\"type\": \"Identifier\", \"name\": \"marginalize\"};\n\n\t\tvar computation = make_query_computation(mh_query.slice(3, -1), mh_query[mh_query.length - 1], lambda_args);\n\n\t\tcall_expression[\"arguments\"] = [\n\t\t\tcomputation,\n\t\t\t{\"type\": \"Identifier\", \"name\": \"traceMH\"},\n\t\t\tmake_expression(mh_query[1]),\n\t\t\tmake_expression(mh_query[2])];\n\t\treturn call_expression;\n\t}\n\n\tfunction make_function_expression(church_tree) {\n\t\tvar lambda_args = church_tree.children[1];\n\t\tvar church_actions = church_tree.children.slice(2);\n\t\tif (church_actions.length == 1 && util.is_leaf(church_actions[0]) && church_actions[0].text == \"embedded-mh-query\") {\n\t\t\treturn make_marginalize(lambda_args, church_actions[0]);\n\t\t}\n\n\t\tvar func_expression = deep_copy(function_expression_node);\n\t\tfunc_expression[\"body\"][\"body\"] = make_expression_statement_list(church_actions.slice(0, -1));\n\t\tfunc_expression[\"body\"][\"body\"].push(make_return_statement(church_actions[church_actions.length-1]));\n\t\tif (!util.is_leaf(lambda_args)) {\n\t\t\tfor (var i = 0; i < lambda_args.children.length; i++) {\n\t\t\t\tvalidate_variable(lambda_args.children[i]);\n\t\t\t\tfunc_expression[\"params\"].push(make_leaf_expression(lambda_args.children[i]));\n\t\t\t}\n\t\t} else {\n\t\t\tvalidate_variable(lambda_args);\n\t\t\tvar variadic = deep_copy(variadic_header);\n\t\t\tvariadic[\"declarations\"][0][\"id\"][\"name\"] = lambda_args.text;\n\t\t\tfunc_expression[\"body\"][\"body\"].unshift(variadic);\n\t\t}\n\t\treturn func_expression;\n\t}\n\n\tfunction make_call_expression(church_tree) {\n\t\tvar call_expression = deep_copy(call_expression_node);\n\t\tvar callee = church_tree.children[0];\n\t\tvar args = church_tree.children.slice(1);\n\n\t\tcall_expression[\"callee\"] = make_expression(callee);\n\t\tcall_expression[\"arguments\"] = make_expression_list(args);\n\t\tcall_expression[\"loc\"] = make_location(church_tree);\n\t\treturn call_expression;\n\t}\n\n\tfunction make_return_statement(church_tree) {\n\t\tvar return_statement = deep_copy(return_statement_node);\n\t\treturn_statement[\"argument\"] = make_expression(church_tree);\n\t\treturn return_statement;\n\t}\n\n\n function make_if_expression(church_tree) {\n var conditional_expression = deep_copy(conditional_expression_node)\n conditional_expression.test = make_expression(church_tree.children[1])\n conditional_expression.consequent = make_expression(church_tree.children[2])\n if(church_tree.children[3]) {\n conditional_expression.alternate = make_expression(church_tree.children[3])\n } else {\n conditional_expression.alternate = {type: \"Identifier\", name: \"undefined\"}\n }\n \n\t\treturn conditional_expression;\n\t}\n\n\tfunction make_quoted_expression(church_tree) {\n\t\tfunction quote_helper(quoted) {\n\t\t\tif (!util.is_leaf(quoted)) {\n\t\t\t\tif (quoted.children.length == 0) {\n\t\t\t\t\treturn make_leaf_expression(quoted);\n\t\t\t\t} else {\n\t\t\t\t\tvar array = deep_copy(array_node);\n\t\t\t\t\tvar proper_list = true;\n\t\t\t\t\tfor (var i = 0; i < quoted.children.length; i++) {\n\t\t\t\t\t\tif (quoted.children[i].text == \".\") {\n\t\t\t\t\t\t\tif (i != quoted.children.length - 2) {\n\t\t\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", quoted.children[i].start, quoted.children[i].end, \"Invalid dot\");\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tproper_list = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tarray[\"elements\"].push(quote_helper(quoted.children[i]));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (proper_list) {\n\t\t\t\t\t\tarray[\"elements\"].push({\"type\": \"Literal\", \"name\": null, \"value\": null});\n\t\t\t\t\t}\n\t\t\t\t\treturn array;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (util.is_identifier(quoted.text)) {\n\t\t\t\t\tvar copy = deep_copy(quoted)\n\t\t\t\t\tcopy.text = '\"' + copy.text + '\"'\n\t\t\t\t\treturn make_leaf_expression(copy);\n\t\t\t\t} else {\n\t\t\t\t\treturn make_leaf_expression(quoted);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn quote_helper(church_tree.children[1]);\n\t}\n\n\tfunction make_expression(church_tree) {\n\t\tif (util.is_leaf(church_tree) || church_tree.children.length == 0) {\n\t\t\treturn make_leaf_expression(church_tree);\n\t\t} else {\n\t\t\tif (!util.is_leaf(church_tree) && church_tree.children.length > 0) {\n\t\t\t\tif (church_tree.children[0].text in heads_to_helpers) {\n\t\t\t\t\treturn heads_to_helpers[church_tree.children[0].text](church_tree);\n\t\t\t\t} else {\n\t\t\t\t\treturn make_call_expression(church_tree);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction make_leaf_expression(church_leaf) {\n\t\tvar expression = deep_copy(expression_node);\n\t\tif (!util.is_leaf(church_leaf) && church_leaf.children.length == 0) {\n\t\t\texpression = {\n\t\t\t\ttype: \"ArrayExpression\",\n\t\t\t\telements: [{\"type\": \"Literal\", \"name\": null, \"value\": null}]\n\t\t\t}\n\t\t} else if (church_leaf.text == \".\") {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", church_leaf.start, church_leaf.end, \"Invalid dot\");\n\t\t} else if (church_leaf.text == undefined) {\n\t\t\texpression[\"type\"] = \"Identifier\";\n\t\t\texpression[\"name\"] = \"undefined\";\n\t\t} else if (util.boolean_aliases[church_leaf.text] != undefined) {\n\t\t\texpression[\"type\"] = \"Literal\";\n\t\t\texpression[\"value\"] = util.boolean_aliases[church_leaf.text];\n\t\t} else if (util.is_identifier(church_leaf.text)) {\n\t\t\texpression = {type: 'Identifier', name: church_leaf.text}\n\t\t} else {\n\t\t\tvar value = get_value_of_string_or_number(church_leaf.text);\n\t\t\tif (typeof value == \"number\" && value < 0) {\n\t\t\t\texpression[\"type\"] = \"UnaryExpression\";\n\t\t\t\texpression[\"operator\"] = \"-\"\n\t\t\t\texpression[\"argument\"] = {\"type\": \"Literal\", \"value\": -value}\n\t\t\t} else {\n\t\t\t\texpression[\"type\"] = \"Literal\";\n\t\t\t\texpression[\"value\"] = value\n\t\t\t}\n\n\t\t}\n\t\texpression[\"loc\"] = make_location(church_leaf);\n\t\treturn expression;\n\t}\n\n\tfunction make_expression_list(church_trees) {\n\t\tvar body = []\n\t\tfor (var i = 0; i < church_trees.length; i++) {\n\t\t\tbody.push(make_expression(church_trees[i]));\n\t\t}\n\t\treturn body;\n\t}\n\n\tfunction make_expression_statement(church_tree) {\n\t\tif (!util.is_leaf(church_tree) && church_tree.children.length > 1 && church_tree.children[0].text == \"define\") {\n\t\t\treturn make_declaration(church_tree);\n\t\t} else {\n\t\t\tvar expr_statement = deep_copy(expression_statement_node);\n\t\t\texpr_statement[\"expression\"] = make_expression(church_tree);\n\t\t\treturn expr_statement;\n\t\t}\n\t}\n\n\tfunction make_expression_statement_list(church_trees) {\n\t\tvar body = []\n\t\tfor (var i = 0; i < church_trees.length; i++) {\n\t\t\tbody.push(make_expression_statement(church_trees[i]));\n\t\t}\n\t\treturn body;\n\t}\n\n\n\tvar ast = deep_copy(program_node);\n\tvar body = make_expression_statement_list(church_tree.children);\n\n \n\tast[\"body\"] = body;\n\tast = estraverse.replace(ast, renameIdentifiers)\n\treturn ast;\n}", "function parse(array,tree){\n\tvar currentToken = 0;\n\tvar parseString = \"\";\n var cstString = \"\";\n var astString = \"\";\n\tvar errors = false;\n var cstDepth = 0;\n var astDepth = 0;\n\n //Boolean assist\n var boolDepth = 0;\n\n //Add assist\n var addDepth = 0;\n\n //Tree Object Vars\n var asTree = new Tree();\n var scope = -1;\n var blockList = [];\n var string = \"\";\n\n //Symbol Table Helpers\n var symbolArray = []; //array of declared symbols\n\n var returnArr;\n \n parseString += \"PARSER: parse()\\n\";\n\n parseProgram();\n\n returnArr = [errors, parseString, cstString, astString, asTree, symbolArray];\n return returnArr;\n\n\tfunction treeMaker(e){\n\t\tvar treeBranch = \"\";\n\t\tif(e > 0){\n\t\t\tfor(l = 0; l < e; l++){\n\t\t\t\ttreeBranch+=\"-\";\n\t\t\t}\n\t\t}\n\t\treturn treeBranch;\n }\n\n\tfunction match(t){\n\t\tif(array[currentToken][0] != t && errors == false){\n\t\t\tparseString+= \"PARSER: ERROR: Expected \" + t + \" got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t} else if(array[currentToken][0] != t){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t} else {\n\t\t\tcstString+= treeMaker(cstDepth)+\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseProgram(){\n\t\tparseString+= \"PARSER: parseProgram()\\n\";\n\t\tcstString+= \"<Program>\\n\";\n\t\tparseBlock([0]);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_EOP\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBlock(arr){\n\t\tparseString+= \"PARSER: parseBlock()\\n\";\n \n //CST\n cstDepth++;\n\t\tcstString+= treeMaker(cstDepth)+\"<Block>\\n\";\n cstDepth++;\n //AST\n astString+= treeMaker(astDepth)+\"< BLOCK >\\n\";\n astDepth++;\n\n //Tree\n scope++;\n blockList.push([\"BLOCK\", array[currentToken][2], scope]); //add block to blocklist\n\n if (arr.length == 1){\n if (scope > 0){\n asTree.add(blockList[scope],blockList[scope-1]); //parent will be previous scope's block node\n } else {\n asTree.add(blockList[scope]);\n }\n } else {\n asTree.add(blockList[scope], arr); //parent will be if or while\n }\n\n\t\tmatch(\"T_LBRACE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n parseStatementList();\n \n scope--;\n\n\t\tmatch(\"T_RBRACE\");\n \n cstDepth--;\n astDepth--;\n \n if(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseStatementList(){\n parseString+= \"PARSER: parseStatementList()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement List>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\" || array[currentToken][0]==\"T_ID\" || \n\t\t array[currentToken][0]==\"T_VAR_TYPE_INT\" || array[currentToken][0]==\"T_VAR_TYPE_STRING\" ||\n\t\t array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\" || array[currentToken][0]==\"T_WHILE\" ||\n\t\t array[currentToken][0]==\"T_IF\" || array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tcstDepth++;\n\t\t\tparseStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tcstDepth-=2;\n\t\t\tparseStatementList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseStatement(){\n parseString+= \"PARSER: parseStatement()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\"){\n\t\t\tparsePrintStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseAssignmentStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_INT\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_STRING\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tparseVarDecl();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_WHILE\"){\n\t\t\tparseWhileStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_IF\"){\n\t\t\tparseIfStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tparseBlock([0]);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected print/id/int/string/boolean/while/if/lbrace got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parsePrintStatement(){\n parseString+= \"PARSER: parsePrintStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Print Statement>\\n\";\n //AST\n astString+= treeMaker(astDepth) + \"< Print Statement >\\n\";\n\n //Tree\n var printNode = [\"Print Statement\", array[currentToken][2], scope];\n asTree.add(printNode,blockList[scope]); //add [print node, parent block]\n \n\t\tmatch(\"T_PRINT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_LPAREN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n \n astDepth++;\n\n\t\tparseExpr(printNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n match(\"T_RPAREN\");\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseAssignmentStatement(){\n\t\tparseString+= \"PARSER: parseAssignmentStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Assignment Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Assignment Statement >\\n\";\n astDepth++;\n \n //Tree\n var assignmentNode = [\"Assignment Statement\", array[currentToken][2],scope];\n\n asTree.add(assignmentNode, blockList[scope]); //add [assignment node, parent block]\n\n parseId(assignmentNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_ASSIGN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseExpr(assignmentNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseVarDecl(){\n\t\tparseString+= \"PARSER: parseVarDecl()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Variable Declaration Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Variable Declaration >\\n\";\n astDepth++;\n\n //Tree\n var declarationNode = [\"Variable Declaration\", array[currentToken][2], scope];\n\n asTree.add(declarationNode, blockList[scope]); //add [variable decl node, parent block]\n\n //Symbol Table Helper\n\n symbolArray.push([array[currentToken + 1][1], array[currentToken][1], scope, array[currentToken][2]]);\n\n\t\tparseType(declarationNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseId(declarationNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseWhileStatement(){\n\t\tparseString+= \"PARSER: parseWhileStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<While Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< While Statement >\\n\";\n astDepth++;\n\n //Tree\n var whileNode = [\"While Statement\", array[currentToken][2], scope];\n\n asTree.add(whileNode, blockList[scope]); //add [while node, parent block]\n\n\t\tmatch(\"T_WHILE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(whileNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(whileNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseIfStatement(){\n\t\tparseString+= \"PARSER: parseIfStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<If Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< If Statement >\\n\";\n astDepth++;\n\n //Tree\n var ifNode = [\"If Statement\", array[currentToken][2], scope];\n\n asTree.add(ifNode, blockList[scope]); //add [if node, parent block]\n\n\t\tmatch(\"T_IF\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(ifNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(ifNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseExpr(arr){\n\t\tparseString+= \"PARSER: parseExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Expression>\\n\";\n\n\t\tif(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseIntExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_QUOTE\"){\n\t\t\tparseStringExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n else if (array[currentToken][0] == \"T_LPAREN\"){\n parseBooleanExpr(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if (array[currentToken][0] == \"T_FALSE\" ||\n array[currentToken][0] == \"T_TRUE\"){\n parseBoolVal(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseId(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT or T_QUOTE or T_LPAREN or T_ID or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n }\n\n\tfunction parseIntExpr(arr){\n parseString+= \"PARSER: parseIntExpr()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Integer Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_DIGIT\" && array[currentToken+1][0]==\"T_ADD\"){\n //AST\n astString += treeMaker(astDepth) + \"< Add >\\n\";\n astDepth++;\n addDepth++;\n\n //Tree\n var addNode = [\"Add\", array[currentToken][2], scope, addDepth];\n\n asTree.add(addNode, arr); //add [add node, parent]\n\n\t\t\tparseDigit(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseIntOp();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseDigit(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n }\n //astDepth--;\n\t}\n\n\tfunction parseStringExpr(arr){\n\t\tparseString+= \"PARSER: parseStringExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<String Expression>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \";\n\n string = \"\"; //reset variable\n var stringLine = array[currentToken][2];\n\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseCharList();\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n //AST\n astString += \" ]\\n\";\n //ADD THE RIGHT STRING NODE TO THE AST\n //Tree\n var stringNode = [\"T_STRING\", string, stringLine,scope];\n asTree.add(stringNode, arr); //add [string node, parent]\n string = \"\"; //reset variable\n\n\t}\n\n\tfunction parseBooleanExpr(arr){\n\t\tparseString+= \"PARSER: parseBooleanExpr()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Boolean Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_LPAREN\"){\n //AST\n astString += treeMaker(astDepth) + \"< Boolean Expression >\\n\";\n astDepth++;\n boolDepth++;\n //Tree\n var boolExpNode = [\"Boolean Expression\", array[currentToken][2], scope, boolDepth];\n asTree.add(boolExpNode, arr); //add [bool exp node, parent block]\n\t\t\tmatch(\"T_LPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseBoolOp(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n match(\"T_RPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n } else if (array[currentToken][0] == \"T_TRUE\" || array[currentToken][0] == \"T_FALSE\"){\n parseBoolVal(arr);\n if(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n } else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_LPAREN or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseId(arr){\n\t\tparseString+= \"PARSER: parseId()\\n\";\n cstString+= treeMaker(cstDepth)+\"<ID>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n \n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [id node, parent]\n \n match(\"T_ID\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\t\t\n\t}\n\n\tfunction parseCharList(){\n\t\tparseString+= \"PARSER: parseCharList()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Character List>\\n\";\n if (array[currentToken][0] == \"T_CHAR\" && array[currentToken][1] == \" \") {\n parseSpace();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n parseCharList();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if(array[currentToken][0]==\"T_CHAR\"){\n\t\t\tparseChar();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseCharList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseType(arr){\n\t\tparseString+= \"PARSER: parseType()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Type>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tif(array[currentToken][0]==\"T_VAR_TYPE_INT\"){\n\t\t\tmatch(\"T_VAR_TYPE_INT\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_STRING\"){\n\t\t\tmatch(\"T_VAR_TYPE_STRING\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tmatch(\"T_VAR_TYPE_BOOLEAN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_VAR_TYPE_INT/STRING/BOOLEAN got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseChar(){\n\t\tparseString+= \"PARSER: parseChar()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tmatch(\"T_CHAR\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n\t}\n\n\tfunction parseSpace(){\n\t\tparseString+= \"PARSER: parseSpace()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Space Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tif(array[currentToken][1] != \" \"){\n\t\t\tparseString+= \"PARSER: ERROR: Expected ' ' got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t} else {\n cstString += treeMaker(cstDepth) +\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseDigit(arr){\n\t\tparseString+= \"PARSER: parseDigit()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Digit>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tmatch(\"T_DIGIT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBoolOp(arr){\n\t\tparseString+= \"PARSER: parseBoolOp()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Operator>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool op node, parent]\n\t\tif(array[currentToken][0]==\"T_EQ\"){\n\t\t\tmatch(\"T_EQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_INEQ\"){\n\t\t\tmatch(\"T_INEQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_EQ or T_INEQ got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseBoolVal(arr){\n\t\tparseString+= \"PARSER: parseBoolVal()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Value>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool val node, parent]\n\t\tif(array[currentToken][0]==\"T_FALSE\"){\n\t\t\tmatch(\"T_FALSE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_TRUE\"){\n\t\t\tmatch(\"T_TRUE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseIntOp(){\n\t\tparseString+= \"PARSER: parseIntOp()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Addition>\\n\";\n\t\tmatch(\"T_ADD\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n}", "parse(tree, depth) {\n if (Array.isArray(tree)) {\n return tree.map(node => this.parse(node, depth + 1)).join('');\n\n } else if(isProperty(tree)) {\n return this.addComment(tree, depth) + this.parseProperty(tree, depth);\n\n } else if (isExprStatement(tree)) {\n return this.parseExpression(tree);\n\n } else if (isVarDeclarator(tree)) {\n if (isCallableExpr(tree) || isArrowFunctionExpr(tree)) {\n return this.parseExpression(tree, true);\n }\n return tree.init.properties.map(node => this.parse(node, depth + 1)).join('');\n\n } else if (isVarDeclaration(tree)) {\n return tree.declarations.map(n => this.parse(n, depth - 1)).join('');\n\n } else if (isLabelStatement(tree) || isBlockStatement(tree)) {\n throw new Error('Grid options should be wrapped inside: const gridOptions = { ... }');\n\n } else {\n throw new Error(`Unexpected node encountered:\\n\\n${JSON.stringify(tree)}`);\n }\n }" ]
[ "0.60955095", "0.5406199", "0.53547174", "0.53318083", "0.51143336", "0.5076067", "0.5049688", "0.5002471", "0.49963763", "0.4980343", "0.49352366", "0.49352366", "0.49352366", "0.49201155", "0.49112839", "0.4890799", "0.4852491", "0.4840356", "0.48382154", "0.48179978", "0.4816534", "0.47939703", "0.4720871", "0.47052357", "0.4703856", "0.4695386", "0.46828458", "0.4662642", "0.46467045", "0.463831", "0.46359548", "0.4627862", "0.46156532", "0.46155283", "0.46054488", "0.45946783", "0.45946783", "0.45941412", "0.4586926", "0.4586926", "0.4586926", "0.4586926", "0.4586926", "0.4586926", "0.45719972", "0.45719972", "0.45719972", "0.45490873", "0.45340934", "0.45295396", "0.45166185", "0.45166185", "0.45119047", "0.4500717", "0.4497801", "0.44971636", "0.44852424", "0.44848692", "0.44795337", "0.44634223", "0.44595236", "0.4454606", "0.44521233", "0.4445425", "0.44449323", "0.44398752", "0.44273412", "0.44211462", "0.4416949", "0.44099507", "0.44033363", "0.44024715", "0.4399764", "0.4383835", "0.43825477", "0.43777436", "0.43777436", "0.43777436", "0.43777436", "0.4371382", "0.43711314", "0.43400156", "0.43387952", "0.43387952", "0.43350685", "0.4326113", "0.43245807", "0.4315054", "0.4302654", "0.42968842", "0.4274458", "0.427144", "0.42709684", "0.42701334", "0.4267386", "0.42608404", "0.4256411", "0.42490947", "0.42447582", "0.42329988" ]
0.51713055
4
similar to `parse2` in the honu paper except here we don't generate an AST yet (TermTree, Map, Map) > TermTree
function expandTermTreeToFinal(term, context) { assert(context && context.env, 'environment map is required'); if (term.isArrayLiteral) { term.array.delim.token.inner = expand(term.array.delim.expose().token.inner, context); return term; } else if (term.isBlock) { term.body.delim.token.inner = expand(term.body.delim.expose().token.inner, context); return term; } else if (term.isParenExpression) { assert(term.expr.delim.token.inner.length === 1, 'Paren expressions always have a single term inside the delimiter'); term.expr.delim.token.inner = [expandTermTreeToFinal(term.expr.delim.token.inner[0], context)]; return term; } else if (term.isCall) { term.fun = expandTermTreeToFinal(term.fun, context); term.args = _.map(term.args, function (arg) { return expandTermTreeToFinal(arg, context); }); return term; } else if (term.isConst) { term.call = expandTermTreeToFinal(term.call, context); return term; } else if (term.isUnaryOp) { term.expr = expandTermTreeToFinal(term.expr, context); return term; } else if (term.isBinOp || term.isAssignmentExpression) { term.left = expandTermTreeToFinal(term.left, context); term.right = expandTermTreeToFinal(term.right, context); return term; } else if (term.isObjGet) { term.left = expandTermTreeToFinal(term.left, context); term.right.delim.token.inner = expand(term.right.delim.expose().token.inner, context); return term; } else if (term.isObjDotGet) { term.left = expandTermTreeToFinal(term.left, context); term.right = expandTermTreeToFinal(term.right, context); return term; } else if (term.isConditionalExpression) { term.cond = expandTermTreeToFinal(term.cond, context); term.tru = expandTermTreeToFinal(term.tru, context); term.fls = expandTermTreeToFinal(term.fls, context); return term; } else if (term.isVariableDeclaration) { if (term.init) { term.init = expandTermTreeToFinal(term.init, context); } return term; } else if (term.isVariableStatement) { term.decls = _.map(term.decls, function (decl) { return expandTermTreeToFinal(decl, context); }); return term; } else if (term.isDelimiter) { // expand inside the delimiter and then continue on term.delim.token.inner = expand(term.delim.expose().token.inner, context); return term; } else if (term.isNamedFun || term.isAnonFun || term.isCatchClause || term.isArrowFun || term.isModule) { // function definitions need a bunch of hygiene logic // push down a fresh definition context var newDef = []; var bodyContext = makeExpanderContext(_.defaults({ defscope: newDef }, context)); var paramSingleIdent = term.params && term.params.token.type === parser.Token.Identifier; var params; if (term.params && term.params.token.type === parser.Token.Delimiter) { params = term.params.expose(); } else if (paramSingleIdent) { params = term.params; } else { params = syn.makeDelim('()', [], null); } var bodies; if (Array.isArray(term.body)) { bodies = syn.makeDelim('{}', term.body, null); } else { bodies = term.body; } bodies = bodies.addDefCtx(newDef); var paramNames = _.map(getParamIdentifiers(params), function (param) { var freshName = fresh(); return { freshName: freshName, originalParam: param, renamedParam: param.rename(param, freshName) }; }); // rename the function body for each of the parameters var renamedBody = _.reduce(paramNames, function (accBody, p) { return accBody.rename(p.originalParam, p.freshName); }, bodies); renamedBody = renamedBody.expose(); var expandedResult = expandToTermTree(renamedBody.token.inner, bodyContext); var bodyTerms = expandedResult.terms; if (expandedResult.restStx) { // The expansion was halted prematurely. Just stop and // return what we have so far, along with the rest of the syntax renamedBody.token.inner = expandedResult.terms.concat(expandedResult.restStx); if (Array.isArray(term.body)) { term.body = renamedBody.token.inner; } else { term.body = renamedBody; } return term; } var renamedParams = _.map(paramNames, function (p) { return p.renamedParam; }); var flatArgs; if (paramSingleIdent) { flatArgs = renamedParams[0]; } else { flatArgs = syn.makeDelim('()', joinSyntax(renamedParams, ','), term.params || null); } var expandedArgs = expand([flatArgs], bodyContext); assert(expandedArgs.length === 1, 'should only get back one result'); // stitch up the function with all the renamings if (term.params) { term.params = expandedArgs[0]; } bodyTerms = _.map(bodyTerms, function (bodyTerm) { // add the definition context to the result of // expansion (this makes sure that syntax objects // introduced by expansion have the def context) if (bodyTerm.isBlock) { // we need to expand blocks before adding the defctx since // blocks defer macro expansion. var blockFinal = expandTermTreeToFinal(bodyTerm, expandedResult.context); return blockFinal.addDefCtx(newDef); } else { var termWithCtx = bodyTerm.addDefCtx(newDef); // finish expansion return expandTermTreeToFinal(termWithCtx, expandedResult.context); } }); if (term.isModule) { bodyTerms = _.filter(bodyTerms, function (bodyTerm) { if (bodyTerm.isExport) { term.exports.push(bodyTerm); return false; } else { return true; } }); } renamedBody.token.inner = bodyTerms; if (Array.isArray(term.body)) { term.body = renamedBody.token.inner; } else { term.body = renamedBody; } // and continue expand the rest return term; } // the term is fine as is return term; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TermTree() {\n }", "parseTerm() {\n const assertion = this.maybeParseAssertion();\n if (assertion) {\n return assertion;\n }\n return {\n type: 'Term',\n capturingParenthesesBefore: this.capturingGroups.length,\n Atom: this.parseAtom(),\n Quantifier: this.maybeParseQuantifier(),\n };\n }", "function walk_tree(ast) {\n var walker = {\n \"assign\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n assign_expr.left_expr = walk_tree(ast[2]);\n assign_expr.right_expr = walk_tree(ast[3]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr;\n },\n \n \"var\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n \n assign_expr.left_expr = new type_object();\n assign_expr.left_expr.name = ast[1][0][0];\n assign_expr.right_expr = walk_tree(ast[1][0][1]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr; \n },\n \n \"stat\" : function() {\n return walk_tree(ast[1]);\n },\n \n \"dot\" : function() {\n var dot_obj = walk_tree(ast[1]);\n dot_obj.child = new type_object();\n dot_obj.child.name = ast[2];\n dot_obj.child.parent = dot_obj;\n return dot_obj;\n },\n \n \"name\" : function() {\n var new_obj = new type_object();\n new_obj.type = \"name\";\n new_obj.name = ast[1];\n return new_obj;\n },\n \n \"new\" : function() {\n var expr = walk_tree(ast[1]);\n expr.type = \"composition\";\n return expr;\n },\n \n \"function\" : function() {\n var func = new type_function(\"function\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"defun\" : function() { \n var func = new type_function(\"defun\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"return\" : function() {\n var return_expr = new type_expression();\n return_expr.type = \"return_expr\";\n return_expr.expr = walk_tree(ast[1]);\n return return_expr;\n },\n \n \"string\" : function() {\n var obj = new type_object();\n obj.type = \"string\";\n obj.value = ast[1];\n return obj;\n },\n \n \"num\" : function() {\n var obj = new type_object();\n obj.type = \"num\";\n obj.value = ast[1];\n return obj;\n },\n \n \"binary\" : function() {\n var binary_expr = new binary_expression();\n binary_expr.type = \"binary_expr\";\n binary_expr.binary_lhs = walk_tree(ast[2]);\n binary_expr.binary_rhs = walk_tree(ast[3]);\n },\n }\n \n var parent = ast[0];\n \n var func = walker[parent];\n \n return func(ast);\n}", "function TreeParser() {\n var orderOfOperations,\n tokens,\n length,\n index,\n peekAtNextToken,\n parse,\n parseExpression,\n parseAdditive,\n parseMultiplicative,\n parsePrimary,\n isInLevel,\n parseBinary,\n calculate,\n mathOperations;\n\n orderOfOperations = [['+', '-'],['*', '/'], ['^']];\n\n mathOperations = {\n '+' : function(x, y) {\n return x + y;\n },\n\n '-' : function(x, y) {\n return x - y;\n },\n\n '*' : function(x, y) {\n return x * y;\n },\n\n '/' : function(x, y) {\n if (y === 0) {\n throw 'the right operand of a divide operator cannot be zero';\n }\n return x / y;\n },\n\n '^' : function(x, y) {\n return Math.pow(x, y);\n } \n }\n\n tokens = [];\n length = 0;\n index = 0;\n\n peekAtNextToken = function () {\n if (index === length) {\n return null;\n }\n return tokens[index];\n };\n\n /**\n * creates an abstract tree from a tokens array\n * this function does not validate the expression mathematically\n * @param {array} tokensArr an array that contains tokens\n * @return {object} the abstract expression tree root\n */\n parse = function (tokensArr) {\n tokens = tokensArr;\n length = tokens.length;\n if (length === 0) {\n return;\n }\n index = 0;\n\n //we want to parse the expression from left to right to avoid problems like 1-1-1=1\n tokens = tokens.reverse();\n return parseExpression();\n };\n\n /**\n * parses an assignment expression\n * @return {object} the abstract expression tree assignment node\n */\n parseExpression = function () {\n return parseBinary(0);\n };\n\n /**\n * parses an assignment expression\n * @return {object} the abstract expression tree assignment node\n */\n isInLevel = function (operator, order) {\n return orderOfOperations[order].indexOf(operator) > -1;\n };\n\n /**\n * recursivly parses a binary expression by order of operations\n * each recursion level represents the more immidiate operation\n * @param {Number} order the current order of operation\n * @return {object} the abstract expression tree node\n */\n parseBinary = function (order) {\n var right,\n token,\n node;\n\n right = order == orderOfOperations.length - 1\n ? parsePrimary()\n : parseBinary(order + 1);\n \n token = peekAtNextToken();\n if (token === null) {\n return right;\n }\n\n while (isInLevel(token.value, order)) {\n index += 1;\n node = {};\n node = token;\n node.right = right;\n node.left = parseBinary(order);\n right = node;\n \n token = peekAtNextToken();\n if (token === null) {\n return right;\n }\n }\n\n return right;\n };\n\n /**\n * parses a term expression i.e. a finite number, an varialbe or an expression in parens\n * @return {object} the abstract expression tree primary node\n */\n parsePrimary = function () {\n var token,\n node;\n\n if (index === length) {\n throw \"error: there are no more tokens to parse\";\n }\n\n token = tokens[index];\n if (token.type === tokenType.num || token.type === tokenType.id) {\n index += 1;\n node = {};\n node = token;\n return node;\n }\n\n if (token.value === ')') {\n index += 1;\n node = parseExpression();\n\n token = peekAtNextToken();\n if (token.value !== '(') {\n throw \"error: '(' was expected\";\n }\n\n index += 1;\n return node;\n }\n\n throw \"error: token '\" + token.value + \"' was not expected\";\n };\n\n /**\n * calculates the result from mathematical tree\n * @param {object} the ree/sub tree token node\n * @return {Number} the result of the calculation\n */\n calculate = function (node) {\n var left,\n right,\n operator,\n result;\n\n if (node === null) return;\n if (node.type === tokenType.id) {\n throw 'variables are not supported at this point';\n }\n \n if (node.type === tokenType.num) {\n return parseFloat(node.value);\n }\n\n left = node.left.type === tokenType.num\n ? parseFloat(node.left.value)\n : calculate(node.left);\n\n right = node.right.type === tokenType.num\n ? parseFloat(node.right.value)\n : calculate(node.right);\n\n if (node.type !== tokenType.op) {\n throw 'an operator was expected';\n }\n\n result = mathOperations[node.value](left, right);\n return result; \n }\n\n return {\n parse: parse,\n calculate: calculate\n };\n }", "function parseTerm() {\n var left = parseFactor();\n var op = tokens[position];\n while (op === '*' || op === '/') {\n ++position;\n var right = parseFactor();\n left = new BinaryOperation(left, op, right);\n op = tokens[position];\n }\n return left;\n }", "function parse(array,tree){\n\tvar currentToken = 0;\n\tvar parseString = \"\";\n var cstString = \"\";\n var astString = \"\";\n\tvar errors = false;\n var cstDepth = 0;\n var astDepth = 0;\n\n //Boolean assist\n var boolDepth = 0;\n\n //Add assist\n var addDepth = 0;\n\n //Tree Object Vars\n var asTree = new Tree();\n var scope = -1;\n var blockList = [];\n var string = \"\";\n\n //Symbol Table Helpers\n var symbolArray = []; //array of declared symbols\n\n var returnArr;\n \n parseString += \"PARSER: parse()\\n\";\n\n parseProgram();\n\n returnArr = [errors, parseString, cstString, astString, asTree, symbolArray];\n return returnArr;\n\n\tfunction treeMaker(e){\n\t\tvar treeBranch = \"\";\n\t\tif(e > 0){\n\t\t\tfor(l = 0; l < e; l++){\n\t\t\t\ttreeBranch+=\"-\";\n\t\t\t}\n\t\t}\n\t\treturn treeBranch;\n }\n\n\tfunction match(t){\n\t\tif(array[currentToken][0] != t && errors == false){\n\t\t\tparseString+= \"PARSER: ERROR: Expected \" + t + \" got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t} else if(array[currentToken][0] != t){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t} else {\n\t\t\tcstString+= treeMaker(cstDepth)+\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseProgram(){\n\t\tparseString+= \"PARSER: parseProgram()\\n\";\n\t\tcstString+= \"<Program>\\n\";\n\t\tparseBlock([0]);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_EOP\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBlock(arr){\n\t\tparseString+= \"PARSER: parseBlock()\\n\";\n \n //CST\n cstDepth++;\n\t\tcstString+= treeMaker(cstDepth)+\"<Block>\\n\";\n cstDepth++;\n //AST\n astString+= treeMaker(astDepth)+\"< BLOCK >\\n\";\n astDepth++;\n\n //Tree\n scope++;\n blockList.push([\"BLOCK\", array[currentToken][2], scope]); //add block to blocklist\n\n if (arr.length == 1){\n if (scope > 0){\n asTree.add(blockList[scope],blockList[scope-1]); //parent will be previous scope's block node\n } else {\n asTree.add(blockList[scope]);\n }\n } else {\n asTree.add(blockList[scope], arr); //parent will be if or while\n }\n\n\t\tmatch(\"T_LBRACE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n parseStatementList();\n \n scope--;\n\n\t\tmatch(\"T_RBRACE\");\n \n cstDepth--;\n astDepth--;\n \n if(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseStatementList(){\n parseString+= \"PARSER: parseStatementList()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement List>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\" || array[currentToken][0]==\"T_ID\" || \n\t\t array[currentToken][0]==\"T_VAR_TYPE_INT\" || array[currentToken][0]==\"T_VAR_TYPE_STRING\" ||\n\t\t array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\" || array[currentToken][0]==\"T_WHILE\" ||\n\t\t array[currentToken][0]==\"T_IF\" || array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tcstDepth++;\n\t\t\tparseStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tcstDepth-=2;\n\t\t\tparseStatementList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseStatement(){\n parseString+= \"PARSER: parseStatement()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\"){\n\t\t\tparsePrintStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseAssignmentStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_INT\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_STRING\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tparseVarDecl();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_WHILE\"){\n\t\t\tparseWhileStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_IF\"){\n\t\t\tparseIfStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tparseBlock([0]);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected print/id/int/string/boolean/while/if/lbrace got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parsePrintStatement(){\n parseString+= \"PARSER: parsePrintStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Print Statement>\\n\";\n //AST\n astString+= treeMaker(astDepth) + \"< Print Statement >\\n\";\n\n //Tree\n var printNode = [\"Print Statement\", array[currentToken][2], scope];\n asTree.add(printNode,blockList[scope]); //add [print node, parent block]\n \n\t\tmatch(\"T_PRINT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_LPAREN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n \n astDepth++;\n\n\t\tparseExpr(printNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n match(\"T_RPAREN\");\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseAssignmentStatement(){\n\t\tparseString+= \"PARSER: parseAssignmentStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Assignment Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Assignment Statement >\\n\";\n astDepth++;\n \n //Tree\n var assignmentNode = [\"Assignment Statement\", array[currentToken][2],scope];\n\n asTree.add(assignmentNode, blockList[scope]); //add [assignment node, parent block]\n\n parseId(assignmentNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_ASSIGN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseExpr(assignmentNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseVarDecl(){\n\t\tparseString+= \"PARSER: parseVarDecl()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Variable Declaration Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Variable Declaration >\\n\";\n astDepth++;\n\n //Tree\n var declarationNode = [\"Variable Declaration\", array[currentToken][2], scope];\n\n asTree.add(declarationNode, blockList[scope]); //add [variable decl node, parent block]\n\n //Symbol Table Helper\n\n symbolArray.push([array[currentToken + 1][1], array[currentToken][1], scope, array[currentToken][2]]);\n\n\t\tparseType(declarationNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseId(declarationNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseWhileStatement(){\n\t\tparseString+= \"PARSER: parseWhileStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<While Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< While Statement >\\n\";\n astDepth++;\n\n //Tree\n var whileNode = [\"While Statement\", array[currentToken][2], scope];\n\n asTree.add(whileNode, blockList[scope]); //add [while node, parent block]\n\n\t\tmatch(\"T_WHILE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(whileNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(whileNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseIfStatement(){\n\t\tparseString+= \"PARSER: parseIfStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<If Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< If Statement >\\n\";\n astDepth++;\n\n //Tree\n var ifNode = [\"If Statement\", array[currentToken][2], scope];\n\n asTree.add(ifNode, blockList[scope]); //add [if node, parent block]\n\n\t\tmatch(\"T_IF\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(ifNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(ifNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseExpr(arr){\n\t\tparseString+= \"PARSER: parseExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Expression>\\n\";\n\n\t\tif(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseIntExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_QUOTE\"){\n\t\t\tparseStringExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n else if (array[currentToken][0] == \"T_LPAREN\"){\n parseBooleanExpr(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if (array[currentToken][0] == \"T_FALSE\" ||\n array[currentToken][0] == \"T_TRUE\"){\n parseBoolVal(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseId(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT or T_QUOTE or T_LPAREN or T_ID or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n }\n\n\tfunction parseIntExpr(arr){\n parseString+= \"PARSER: parseIntExpr()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Integer Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_DIGIT\" && array[currentToken+1][0]==\"T_ADD\"){\n //AST\n astString += treeMaker(astDepth) + \"< Add >\\n\";\n astDepth++;\n addDepth++;\n\n //Tree\n var addNode = [\"Add\", array[currentToken][2], scope, addDepth];\n\n asTree.add(addNode, arr); //add [add node, parent]\n\n\t\t\tparseDigit(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseIntOp();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseDigit(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n }\n //astDepth--;\n\t}\n\n\tfunction parseStringExpr(arr){\n\t\tparseString+= \"PARSER: parseStringExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<String Expression>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \";\n\n string = \"\"; //reset variable\n var stringLine = array[currentToken][2];\n\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseCharList();\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n //AST\n astString += \" ]\\n\";\n //ADD THE RIGHT STRING NODE TO THE AST\n //Tree\n var stringNode = [\"T_STRING\", string, stringLine,scope];\n asTree.add(stringNode, arr); //add [string node, parent]\n string = \"\"; //reset variable\n\n\t}\n\n\tfunction parseBooleanExpr(arr){\n\t\tparseString+= \"PARSER: parseBooleanExpr()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Boolean Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_LPAREN\"){\n //AST\n astString += treeMaker(astDepth) + \"< Boolean Expression >\\n\";\n astDepth++;\n boolDepth++;\n //Tree\n var boolExpNode = [\"Boolean Expression\", array[currentToken][2], scope, boolDepth];\n asTree.add(boolExpNode, arr); //add [bool exp node, parent block]\n\t\t\tmatch(\"T_LPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseBoolOp(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n match(\"T_RPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n } else if (array[currentToken][0] == \"T_TRUE\" || array[currentToken][0] == \"T_FALSE\"){\n parseBoolVal(arr);\n if(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n } else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_LPAREN or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseId(arr){\n\t\tparseString+= \"PARSER: parseId()\\n\";\n cstString+= treeMaker(cstDepth)+\"<ID>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n \n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [id node, parent]\n \n match(\"T_ID\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\t\t\n\t}\n\n\tfunction parseCharList(){\n\t\tparseString+= \"PARSER: parseCharList()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Character List>\\n\";\n if (array[currentToken][0] == \"T_CHAR\" && array[currentToken][1] == \" \") {\n parseSpace();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n parseCharList();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if(array[currentToken][0]==\"T_CHAR\"){\n\t\t\tparseChar();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseCharList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseType(arr){\n\t\tparseString+= \"PARSER: parseType()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Type>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tif(array[currentToken][0]==\"T_VAR_TYPE_INT\"){\n\t\t\tmatch(\"T_VAR_TYPE_INT\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_STRING\"){\n\t\t\tmatch(\"T_VAR_TYPE_STRING\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tmatch(\"T_VAR_TYPE_BOOLEAN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_VAR_TYPE_INT/STRING/BOOLEAN got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseChar(){\n\t\tparseString+= \"PARSER: parseChar()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tmatch(\"T_CHAR\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n\t}\n\n\tfunction parseSpace(){\n\t\tparseString+= \"PARSER: parseSpace()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Space Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tif(array[currentToken][1] != \" \"){\n\t\t\tparseString+= \"PARSER: ERROR: Expected ' ' got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t} else {\n cstString += treeMaker(cstDepth) +\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseDigit(arr){\n\t\tparseString+= \"PARSER: parseDigit()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Digit>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tmatch(\"T_DIGIT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBoolOp(arr){\n\t\tparseString+= \"PARSER: parseBoolOp()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Operator>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool op node, parent]\n\t\tif(array[currentToken][0]==\"T_EQ\"){\n\t\t\tmatch(\"T_EQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_INEQ\"){\n\t\t\tmatch(\"T_INEQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_EQ or T_INEQ got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseBoolVal(arr){\n\t\tparseString+= \"PARSER: parseBoolVal()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Value>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool val node, parent]\n\t\tif(array[currentToken][0]==\"T_FALSE\"){\n\t\t\tmatch(\"T_FALSE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_TRUE\"){\n\t\t\tmatch(\"T_TRUE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseIntOp(){\n\t\tparseString+= \"PARSER: parseIntOp()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Addition>\\n\";\n\t\tmatch(\"T_ADD\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n}", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function parseTree(text, errors, options) {\n if (errors === void 0) { errors = []; }\n if (options === void 0) { options = ParseOptions.DEFAULT; }\n var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: void 0 }; // artificial root\n function ensurePropertyComplete(endOffset) {\n if (currentParent.type === 'property') {\n currentParent.length = endOffset - currentParent.offset;\n currentParent = currentParent.parent;\n }\n }\n function onValue(valueNode) {\n currentParent.children.push(valueNode);\n return valueNode;\n }\n var visitor = {\n onObjectBegin: function (offset) {\n currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onObjectProperty: function (name, offset, length) {\n currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });\n currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });\n },\n onObjectEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onArrayBegin: function (offset, length) {\n currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onArrayEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onLiteralValue: function (value, offset, length) {\n onValue({ type: getLiteralNodeType(value), offset: offset, length: length, parent: currentParent, value: value });\n ensurePropertyComplete(offset + length);\n },\n onSeparator: function (sep, offset, length) {\n if (currentParent.type === 'property') {\n if (sep === ':') {\n currentParent.colonOffset = offset;\n }\n else if (sep === ',') {\n ensurePropertyComplete(offset);\n }\n }\n },\n onError: function (error, offset, length) {\n errors.push({ error: error, offset: offset, length: length });\n }\n };\n visit(text, visitor, options);\n var result = currentParent.children[0];\n if (result) {\n delete result.parent;\n }\n return result;\n}", "function term_part(peg_parser, tree_obj){\n// \t\tconsole.log(tree_obj);\n\t\tvar non_empty = \"\";\n\t\tfor (var node_name in tree_obj){\n\t\t\tif (!tree_helpers.is_nil_node(tree_obj[node_name])){\n\t\t\t\tnon_empty = node_name;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar node = tree_obj[non_empty];\n\t\tswitch (non_empty){\n\t\t\tcase \"fork\":\n\t\t\t\treturn fork(peg_parser, node);\n\t\t\tcase \"call_rule\":\n\t\t\t\treturn peg_parser.rule(node.rule_name.value);\n\t\t\tcase \"string\":\n\t\t\t\treturn peg_parser.word(node.value);\n\t\t\tcase \"end\":\n\t\t\t\treturn peg_parser.end();\n\t\t\tcase \"ws\":\n\t\t\t\treturn peg_parser.ws();\n\t\t}\n\t\treturn peg_parser.word(\"\");\n\t}", "function dfs2(idx) {\n // cur is a \"TreeNode\" -- a node in the tree representation of the text\n var cur = {\n id: nodes[idx].id,\n text: nodes[idx].text,\n level: nodes[idx].level,\n expanded: nodes[idx].expanded,\n leaf: nodes[idx].leaf,\n };\n if (!nodes[idx].leaf) {\n cur.levels = nodes[idx].levels;\n // children: a list of TreeNodes -- computed by recursively calling dfs2 on the children\n cur.leftChildren = nodes[idx].children.filter(function(nidx) {\n return nodes[nidx].left;\n }).map(dfs2);\n cur.rightChildren = nodes[idx].children.filter(function(nidx) {\n return !nodes[nidx].left;\n }).map(dfs2);\n }\n return cur;\n }", "function astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}", "function PEGtoAST(node) {\n switch (type(node)) {\n case \"null\":\n return undefined;\n case \"string\":\n return new StringNode(node);\n case \"array\":\n return new ASTNodeList(...node.map(PEGtoAST));\n case \"object\":\n switch (node.TYPE) {\n case \"whitespace\":\n return new Whitespace();\n case \"parbreak\":\n return new Parbreak();\n case \"subscript\":\n return new Subscript(PEGtoAST(node.content));\n case \"superscript\":\n return new Superscript(PEGtoAST(node.content));\n case \"inlinemath\":\n return new InlineMath(PEGtoAST(node.content));\n case \"displaymath\":\n return new DisplayMath(PEGtoAST(node.content));\n case \"mathenv\":\n return new MathEnv(node.env, PEGtoAST(node.content));\n case \"group\":\n return new Group(PEGtoAST(node.content));\n case \"macro\":\n return new Macro(node.content, PEGtoAST(node.args));\n case \"environment\":\n return new Environment(\n PEGtoAST(node.env),\n PEGtoAST(node.args),\n PEGtoAST(node.content)\n );\n case \"verbatim\":\n return new Verbatim(PEGtoAST(node.content));\n case \"verb\":\n return new Verb(node[\"escape\"], PEGtoAST(node.content));\n case \"commentenv\":\n return new CommentEnv(PEGtoAST([node.content]));\n case \"comment\":\n return new CommentNode(\n node.sameline,\n PEGtoAST(node.content)\n );\n case \"arglist\":\n return new ArgList(PEGtoAST(node.content));\n }\n }\n}", "function parse() {\n var self = this\n var value = String(self.file)\n var start = {line: 1, column: 1, offset: 0}\n var content = xtend(start)\n var node\n\n // Clean non-unix newlines: `\\r\\n` and `\\r` are all changed to `\\n`.\n // This should not affect positional information.\n value = value.replace(lineBreaksExpression, lineFeed)\n\n // BOM.\n if (value.charCodeAt(0) === 0xfeff) {\n value = value.slice(1)\n\n content.column++\n content.offset++\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {start: start, end: self.eof || xtend(start)}\n }\n\n if (!self.options.position) {\n removePosition(node, true)\n }\n\n return node\n}", "function getParseTokens(){\n\treturn {\n\t\t'union' : \"+\",\n\t\t'intersection' : \"^^\"\n\t};\n}", "function parseTerm(tok) {\n\tvar startPosition = tok.position();\n\t\n\t// Parse groups and elements\n\tvar items = [];\n\twhile (true) {\n\t\tvar next = tok.peek();\n\t\tif (next == null)\n\t\t\tbreak;\n\t\telse if (next == \"(\")\n\t\t\titems.push(parseGroup(tok));\n\t\telse if (/^[A-Za-z][a-z]*$/.test(next))\n\t\t\titems.push(parseElement(tok));\n\t\telse\n\t\t\tbreak;\n\t}\n\t\n\t// Parse optional charge\n\tvar charge = 0;\n\tvar next = tok.peek();\n\tif (next != null && next == \"^\") {\n\t\ttok.consume(\"^\");\n\t\tnext = tok.peek();\n\t\tif (next == null)\n\t\t\tthrow {message: \"Number or sign expected\", start: tok.position()};\n\t\telse\n\t\t\tcharge = parseOptionalNumber(tok);\n\t\t\n\t\tnext = tok.peek();\n\t\tif (next == \"+\")\n\t\t\tcharge = +charge; // No-op\n\t\telse if (next == \"-\")\n\t\t\tcharge = -charge;\n\t\telse\n\t\t\tthrow {message: \"Sign expected\", start: tok.position()};\n\t\ttok.take(); // Consume the sign\n\t}\n\t\n\t// Check if term is valid\n\tvar elems = new Set();\n\tfor (var i = 0; i < items.length; i++)\n\t\titems[i].getElements(elems);\n\telems = elems.toArray(); // List of all elements used in this term, with no repeats\n\tif (items.length == 0) {\n\t\tthrow {message: \"Invalid term - empty\", start: startPosition, end: tok.position()};\n\t} else if (indexOf(elems, \"e\") != -1) { // If it's the special electron element\n\t\tif (items.length > 1)\n\t\t\tthrow {message: \"Invalid term - electron needs to stand alone\", start: startPosition, end: tok.position()};\n\t\telse if (charge != 0 && charge != -1)\n\t\t\tthrow {message: \"Invalid term - invalid charge for electron\", start: startPosition, end: tok.position()};\n\t\t// Tweak data\n\t\titems = [];\n\t\tcharge = -1;\n\t} else { // Otherwise, a term must not contain an element that starts with lowercase\n\t\tfor (var i = 0; i < elems.length; i++) {\n\t\t\tif (/^[a-z]+$/.test(elems[i]))\n\t\t\t\tthrow {message: 'Invalid element name \"' + elems[i] + '\"', start: startPosition, end: tok.position()};\n\t\t}\n\t}\n\t\n\treturn new Term(items, charge);\n}", "treefy(tokenArray) {\n // Parent tree\n let tree = new Node();\n\n let index = 0;\n let depth = 0;\n let subarray = [];\n\n while (index < tokenArray.length) {\n\n let token = tokenArray[index++];\n\n if (token.type == Token.SPACE || token.type == Token.COMMENT)\n continue;\n\n // Open\n if (token.type == Token.OPEN) {\n\n depth++;\n\n if (depth == 1) {\n subarray = [];\n continue;\n }\n }\n\n // Close\n else if (token.type == Token.CLOSE) {\n\n depth--;\n\n // Depth cannot be smaller than 0\n if (depth < 0)\n return new Error(Error.SYNTAX, \"Surplus ')' exists\", token.lineNumber);\n\n if (depth == 0) {\n\n // Create sub-tree\n let subtree = this.treefy(subarray);\n\n // If error, just pass beyond (no stack push)\n if (subtree instanceof Error)\n return subtree;\n\n tree.addChild(subtree);\n continue;\n }\n }\n\n // Direct (siblings) token\n if (depth == 0) {\n tree.addChild(new Node(token));\n }\n\n // Subarray (children) token\n else if (depth > 0) {\n subarray.push(token);\n }\n }\n\n // Depth must be 0 at the termination point\n if (depth > 0)\n return new Error(Error.SYNTAX, \"'(' not closed\", tokenArray[tokenArray.length - 1].lineNumber);\n\n return tree;\n }", "parse(tree, depth) {\n if (Array.isArray(tree)) {\n return tree.map(node => this.parse(node, depth + 1)).join('');\n\n } else if(isProperty(tree)) {\n return this.addComment(tree, depth) + this.parseProperty(tree, depth);\n\n } else if (isExprStatement(tree)) {\n return this.parseExpression(tree);\n\n } else if (isVarDeclarator(tree)) {\n if (isCallableExpr(tree) || isArrowFunctionExpr(tree)) {\n return this.parseExpression(tree, true);\n }\n return tree.init.properties.map(node => this.parse(node, depth + 1)).join('');\n\n } else if (isVarDeclaration(tree)) {\n return tree.declarations.map(n => this.parse(n, depth - 1)).join('');\n\n } else if (isLabelStatement(tree) || isBlockStatement(tree)) {\n throw new Error('Grid options should be wrapped inside: const gridOptions = { ... }');\n\n } else {\n throw new Error(`Unexpected node encountered:\\n\\n${JSON.stringify(tree)}`);\n }\n }", "function term(peg_parser, tree_obj){\n\t\tvar _term_part = term_part(peg_parser, tree_obj.term_part);\n\t\tvar possible_apps = [\"any\", \"some\", \"not\", \"without\"];\n\t\tfor (var i = 0; i < possible_apps.length; i++){\n\t\t\tvar app = possible_apps[i];\n\t\t\tif (tree_helpers.is_leaf(tree_obj[app])){\n\t\t\t\treturn peg_parser[app](_term_part);\n\t\t\t}\n\t\t}\n\t\tif (!tree_helpers.is_nil_node(tree_obj.time)){\n\t\t\tvar numbers = tree_obj.times.number;\n\t\t\treturn peg_parser.times_range(_term_part, numbers[0], numbers[1]);\n\t\t}\n\t\treturn _term_part;\n\t}", "function buildTree(node) {\n if (node.value.length == 1) {\n node.value = node.value[0];\n node.arrayIndex = node.arrayIndex[0];\n } else if (findHighestSymbol(node.value)) {\n let topNodeSymbol = findHighestSymbol(node.value);\n setNodeAndChildren(node, topNodeSymbol);\n node.children.forEach(child => buildTree(child));\n } else {\n removeBrackets(node);\n buildTree(node);\n }\n}", "function make_node(tok) {\n var node = {};\n if (tok.id === \"(string)\") {\n node.parse = function() { return tok.value };\n }\n else {\n node = Y.Node.create(tok.template);\n if (tok.id === \"(indent)\") {\n node.setData(\"indent\", tok.value);\n }\n node.parse = tok.parse;\n node.transition = tok.transition;\n }\n return node;\n}", "parseTopLevel() {\n const prog = [];\n while (!this.input.eof()) {\n const expr = this.parseExpression();\n this.currentNode = expr;\n if (expr) {\n prog.push(expr);\n }\n }\n\n return { type: \"prog\", prog: prog };\n }", "function Parse(text) {\n\tvar x = ParseShunting( Tokens(text) );\n\tfor (var i = 0; i < x.length; i++) {\n\t\tvar t = x[i];\n\t\tif (getPrecedence(t)) {\n\t\t\tvar a = getArity(t) || 2;\n\t\t\tif (i - a < 0) {\n\t\t\t\tthrow \"Could not parse near '\" + t + \"'; expected more\";\n\t\t\t}\n\t\t\tvar before = x.slice(0, i - a);\n\t\t\tvar args = x.slice(i - a, i);\n\t\t\tvar after = x.slice(i + 1);\n\t\t\tif (a === 1) {\n\t\t\t\tvar obj = new Un(t, args[0]);\n\t\t\t} else if (a === 2) {\n\t\t\t\tvar obj = new Bin(t, args[0], args[1]);\n\t\t\t} else {\n\t\t\t\tthrow \"invalid arity\";\n\t\t\t}\n\t\t\tx = before.concat([obj]).concat(after);\n\t\t\ti -= a;\n\t\t} else {\n\t\t\tif (t[0] == \"@\") { // Bare strings. Useful for patterns in `Match`\n\t\t\t\tx[i] = t.substr(1);\n\t\t\t} else {\n\t\t\t\tx[i] = new Atom(t);\n\t\t\t}\n\t\t}\n\t}\n\tif (x.length != 1) {\n\t\tthrow \"Could not parse near '\" + x[1] + \"'\";\n\t}\n\treturn x[0];\n}", "function parserCaller(molvi, stick) {\n\n var molV = molvi;\n var rootAdd = true;\n\n function parser(term) {\n var stack = term.content, current, termout = {}, iLeftAbs = 0, iRightAbs = 0, iMiddleAbs = 0;\n var rootAddCurrent;\n rootAddCurrent = rootAdd;\n current = stack[term.left];\n \n while (current !== op.eof) {\n if (isVar(current)) {\n iRightAbs = term.right + term.absolute;\n molV += \"FRIN \" + current + \" \" + iRightAbs + \"^\";\n term.right += 1;\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.bof || current == op.eof) {\n term.right += 1;\n term.left= term.right;\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.lparen) {\n term.middle = term.right;\n termout.left = 0;\n termout.middle = 0;\n termout.right = 0; \n termout.absolute = term.right + term.absolute;\n termout.content = [op.bof];\n term.right +=1;\n var parens = 1;\n while (parens > 0) {\n if (stack[term.right] == op.lparen) {\n parens +=1;\n } else if (stack[term.right] == op.rparen) {\n parens = parens - 1;\n }\n if (parens > 0) {\n termout.content.push(stack[term.right]);\n }\n term.right +=1;\n }\n termout.content.push(op.eof);\n parser(termout);\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.lambda) { \n term.middle = term.right + 1;\n var next = stack[term.middle];\n iMiddleAbs = term.middle + term.absolute;\n if (isVar(next)) {\n molV += \"FROUT \" + next + \" \" + iMiddleAbs + \"^\";\n term.left = term.middle + 1;\n if (stack[term.left] == op.dot) {\n iLeftAbs = term.left + term.absolute;\n iRightAbs = term.right + term.absolute;\n molV += \"L \" + iLeftAbs + \" \" + iMiddleAbs + \" \" + iRightAbs + \"^\";\n term.left = term.left - 2;\n term.right = term.right + 2;\n termout.left = 0;\n termout.middle = 0;\n termout.right = 0; \n termout.absolute = term.right + term.absolute;\n termout.content = [op.bof];\n term.right +=1;\n while (stack[term.right] !== op.eof) {\n termout.content.push(stack[term.right]);\n term.right +=1;\n }\n termout.content.push(op.eof);\n parser(termout);\n term.middle = term.right;\n current = stack[term.right];\n } else {\n errorsline = \"Not a variable in lambda: \\\"\\\\\" + next + \" \" + stack[term.middle] + stack[term.left] + \"\\\"\";\n document.getElementById(\"errors\").innerHTML += errorsline;\n throw \"Not a variable in lambda: \\\"\\\\\" + next + \" \" + stack[term.middle] + stack[term.left] + \"\\\"\";\n } \n } else {\n errorsline = \"Not a variable in lambda: \\\"\\\\\" + stack[term.middle] + \"\\\"\";\n document.getElementById(\"errors\").innerHTML += errorsline;\n throw \"Not a variable in lambda: \\\"\\\\\" + stack[term.middle] + \"\\\"\";\n }\n } else if (current == op.app) {\n term.middle = term.right;\n iLeftAbs = term.left+ term.absolute;\n term.middle +=1;\n if (stack[term.middle] == op.lambda) {\n var itempo = term.right + term.absolute;\n if (rootAdd) {\n molV += \"Arrow\" + \" \" + itempo + \" \" + term.absolute + \"^\";} \n rootAddCurrent = false;\n } \n iMiddleAbs = term.middle + term.absolute;\n iRightAbs = term.right + term.absolute;\n molV += \"A \" + iLeftAbs + \" \" + iMiddleAbs + \" \" + iRightAbs + \"^\";\n term.left = term.right;\n term.right = term.middle; \n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.eof) {\n iRightAbs = term.right + term.absolute;\n molV += \"Arrow\" + iRightAbs + \" \" + term.absolute + \"^\";\n current = stack[term.right];\n }\n }\n iLeftAbs = term.left + term.absolute;\n if (rootAddCurrent) {\n molV += \"Arrow\" + \" \" + iLeftAbs + \" \" + term.absolute + \"^\";}\n }\n\n parser(stick);\n return molV;\n}", "function buildAST(root) {\n //If not a leaf node...\n if (root !== null && root.children.length > 0) {\n //For each CST child...\n for (var i = 0; i < root.children.length; i++) {\n //If the CST node is useful to the AST...\n if (typeof ASTNodes[root.children[i].nodeName] !== \"undefined\") {\n //Rename from CST to AST nodeName\n //Block\n if (ASTNodes[root.children[i].nodeName] === \"Block\") {\n //Add a block AST node\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]); //with new name.\n //Recurse over Statements\n buildAST(root.children[i]);\n //Back up to Block when done - close this scope\n AST.backtrack();\n }\n else if (root.nodeName === \"IntegerExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"int\";\n }\n }\n else if (root.nodeName === \"StringExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"string\";\n activeValue.nodeVal = joinString(root, \"\"); //sets string value to full string\n }\n }\n else if (root.nodeName === \"BooleanExpression\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"boolean\";\n }\n }\n else if (root.nodeName === \"ID\") {\n if (activeValue !== null) {\n activeValue.nodeType = \"ID\";\n }\n }\n else if (ASTNodes[root.children[i].nodeName] === \"VariableDeclaration\") {\n //New VariableDeclaration node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //Left - the type\n AST.addLeafNode(\"LeftVal\", root.children[i].children[0].nodeVal, true, root.children[i].children[0].lineNumber);\n //Right - the variable name\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[0].nodeVal, true, root.children[i].children[1].children[0].lineNumber);\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Assignment\") {\n //New Assignment node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //LeftVal - a variable\n AST.addLeafNode(\"LeftVal\", root.children[i].children[0].children[0].nodeVal, true, root.children[i].children[0].children[0].lineNumber);\n //RightVal - an Expression\n if (root.children[i].children[2].children[0].nodeName === \"IntegerExpression\") {\n if (root.children[i].children[2].children[0].children.length > 2 && root.children[i].children[2].children[0].children[1].nodeName === \"T_intop\") {\n AST.addLeafNode(\"RightVal\", findIDInAdd(root.children[i].children[2].children[0]), true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"RightVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n }\n else {\n AST.addLeafNode(\"RightVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Output\") {\n //New Output node\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //If printing from a variable\n if (root.children[i].children[2].children[0].nodeName === \"ID\") {\n AST.addLeafNode(\"OutputVal\", root.children[i].children[2].children[0].children[0].nodeVal, true, root.children[i].children[2].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"OutputVal\", findIDInAdd(root.children[i].children[2].children[0]), true, root.children[i].lineNumber);\n }\n //Backtrack\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"If\" || ASTNodes[root.children[i].nodeName] === \"While\") {\n /*!= vs ==*/\n //New If or While node!\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //New CompareTest node!\n AST.addBranchNode(\"CompareTest\");\n //Add left and right of comparison\n if (root.children[i].children[1].children[1].children.length !== 0) {\n AST.addLeafNode(\"LeftVal\", root.children[i].children[1].children[1].children[0].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].children[0].lineNumber);\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[3].children[0].children[0].nodeVal, true, root.children[i].children[1].children[3].children[0].children[0].lineNumber);\n }\n else {\n AST.addLeafNode(\"LeftVal\", root.children[i].children[1].children[1].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].lineNumber);\n AST.addLeafNode(\"RightVal\", root.children[i].children[1].children[1].children[0].nodeVal, true, root.children[i].children[1].children[1].children[0].lineNumber);\n }\n //Backtrack up to If/While from Compare\n AST.backtrack();\n }\n else if (ASTNodes[root.children[i].nodeName] === \"Add\") {\n //New Add tree\n AST.addBranchNode(ASTNodes[root.children[i].nodeName]);\n //Backtrack\n AST.backtrack();\n }\n }\n //This subtree\n var saved = root.children[i];\n //Block handles own recursive call. Otherwise...\n if (ASTNodes[root.children[i].nodeName] !== \"Block\") {\n buildAST(saved); //recursively call until traversed whole CST\n }\n }\n }\n else {\n //return; //this is a value - no recursion needed\n if (ASTNodes[root.nodeName] === \"Add\") {\n }\n }\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parseTerm(list){\n // Must start with a factor\n var left=parseFactor(list)\n if(left===null)return null\n\n var position=list.getPosition()\n // Can be followed by * / or % and another term\n var tkn=list.next()\n if(tkn!=null && (tkn.data===\"*\" || tkn.data===\"/\" || tkn.data===\"%\")){\n // Must end with another term\n\t\tvar right=parseTerm(list)\n\t\tif(right==null)throw new ParseException(tkn,\"Parser\",\"Isolated operator found at the end\");\n\t\tvar expr=new Expression(ExpressionType.OPERATOR,tkn);\n\t\texpr.left=left\n expr.right=right\n\t\treturn expr\n\t}\n\n // This did not end with another term, reset and return initial factor\n list.setPosition(position)\n return left\n}", "function GetAxiomTree() {\n var Waxiom = rules.axiom;\n var newf = rules.mainRule;\n var newb = 'bb';\n var newx = rules.Rule2;\n var level = params.iterations;\n while (level > 0) {\n var m = Waxiom.length;\n var T = '';\n for (var j=0; j < m; j++) {\n var a = Waxiom[j];\n if (a == 'F'){T += newf;}\n else\n if (a == 'b'){T += newb;}\n else\n if (a == 'X'){T += newx;}\n else\n T += a;\n }\n Waxiom = T;\n level--;\n }\n return Waxiom;\n}", "function many(parser) {\n return function(input) {\n var value = {rest: input, parsed: '', ast: []};\n for(var i = 0; true; i++) {\n var result = parser(value.rest);\n if(result != false) {\n if(result.ast != null) {\n value.ast.push(result.ast);\n }\n value = {rest: result.rest,\n parsed: value.parsed + result.parsed,\n ast: value.ast};\n }\n else {\n if(value.parsed == '') {\n value = {rest: value.rest,\n parsed: '',\n ast: null};\n }\n break;\n }\n }\n return value;\n };\n}", "function testTripleParser() \n{\n\t// equiv. turtle expression - :a :b :c ; :d :e , :f\n\tvar expression1 = [ ':a', [ ':b', ':c', ':d', [ ':e', ':f' ] ] ];\n\tvar result1 = JSON.stringify( parse( expression1 ) );\n\tequal( \"test1\", result1, '[[\":a\",\":b\",\":c\"],[\":a\",\":d\",\":e\"],[\":a\",\":d\",\":f\"]]' );\n\t\n\t// equiv. turtle expression - :a :b , :c , :d , :e , :f\n\tvar expression2 = [ ':a', ':b', [ ':c', ':d', ':e', ':f' ] ];\t\t\n\tvar result2 = JSON.stringify( parse( expression2 ) );\n\tequal( \"test2\", result2, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":b\",\":e\"],[\":a\",\":b\",\":f\"]]' );\n\t\n\t// not valid turtle expression, but parses anyway, \n\t// TODO: should we make this should throw an exception?\n\tvar expression3 = [ ':a', [ ':b', [ ':c', ':d', ':e', ':f' ] ] ];\t\t\n\tvar result3 = JSON.stringify( parse( expression3 ) );\n\tequal( \"test3\", result3, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":b\",\":e\"],[\":a\",\":b\",\":f\"]]' );\n\t\n\t// should throw exception 'too many levels'\n\tvar expression4 = [ ':a', [ ':b', [ ':c', [ ':d', ':e', ':f' ] ] ] ];\t\t\n\tvar result4;\n\ttry {\n\t\tresult4 = parse( expression4 );\n\t}\n\tcatch( e ) {\n\t\tresult4 = e;\n\t}\n\tequal( \"test4\", result4, 'parse error - invalid nested array' );\n\t\n\t// equiv. turtle expression - :a :b :c , :d ; :e :f , :g .\n\tvar expression5 = [ ':a', [ ':b', [ ':c', ':d' ] ], ':e', [ ':f', ':g' ] ]; \n\tvar result5 = JSON.stringify( parse( expression5 ) );\n\tequal( \"test5\", result5, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":e\",\":f\"],[\":a\",\":e\",\":g\"]]' );\n\t\n}", "parse() {\n // We expect at least one tree selector\n var ts = this.parseTreeSelector(); // Now see what's next\n\n var token = this.nextToken(); // If there is no next token then we're done parsing and can return\n // the tree selector object we got above\n\n if (!token) {\n return ts;\n } // Otherwise, there is more go come and we're going to need a\n // list of tree selectors\n\n\n var treeSelectors = [ts];\n\n while (token) {\n // The only character we allow after a tree selector is a comma\n if (token === \",\") {\n this.consume();\n } else {\n throw new ParseError$2(\"Expected comma\");\n } // And if we saw a comma, then it must be followed by another\n // tree selector\n\n\n treeSelectors.push(this.parseTreeSelector());\n token = this.nextToken();\n } // If we parsed more than one tree selector, return them in a\n // SelectorList object.\n\n\n return new SelectorList(treeSelectors);\n }", "function syntaxTree(state) {\n let field = state.field(Language.state, false);\n return field ? field.tree : common.Tree.empty;\n}", "buildTree(tree) {\n alphabet = new Set();\n id_map = [];\n // Prepare initial node\n id = 0;\n followpos = [];\n this.type = CONCAT;\n this.c1 = new Node();\n this.c2 = new Node();\n this.c2.buildNodes({ type: \"Char\", value: \"#\" });\n this.c1.buildNodes(tree);\n this.nullable = this.c1.nullable && this.c2.nullable;\n\n // Set firstpos\n this.firstpos = new Set(this.c1.firstpos);\n if (this.c1.nullable) {\n for (let each of this.c2.firstpos) {\n this.firstpos.add(each);\n }\n }\n // Set lastpos\n this.lastpos = new Set(this.c2.lastpos);\n if (this.c2.nullable) {\n for (let each of this.c1.lastpos) {\n this.lastpos.add(each);\n }\n }\n // Set followpos\n for (let i of this.c1.lastpos) {\n for (let each of this.c2.firstpos) {\n followpos[i].add(each);\n }\n }\n\n alphabet.delete(\"#\");\n }", "function parse(js) {\n var ast = _parse(js);\n traverse(ast, { enter: function (node, parent) { node.parent = parent; } });\n return ast;\n}", "function parseWhere(root) {\n const operator = Object.keys(root)[0];\n\n // extract leaf binary expressions\n if (operator === 'AND') {\n const e1 = parseWhere(root[operator][0]);\n const e2 = parseWhere(root[operator][1]);\n\n // eslint-disable-next-line\n return { '$and' : [\n e1,\n e2,\n ] };\n } else if (operator === 'OR') {\n const e1 = parseWhere(root[operator][0]);\n const e2 = parseWhere(root[operator][1]);\n\n // eslint-disable-next-line\n return { '$or' : [\n e1,\n e2,\n ] };\n }\n const field = root[operator][0];\n const value = root[operator][1];\n const expr = exprMapper[operator];\n const obj = {};\n\n if (operator === 'LIKE') {\n obj[`value.${field}`] = parseLikeExpression(value);\n } else {\n obj[`value.${field}`] = { [expr]: value };\n }\n\n return obj;\n}", "function objectTree(obj) {\n var res;\n switch(obj.termType) {\n case 'symbol':\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', obj.uri)\n anchor.addEventListener('click', tabulator.panes.utils.openHrefInOutlineMode, true);\n anchor.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n return anchor;\n \n case 'literal':\n\n if (!obj.datatype || !obj.datatype.uri) {\n res = myDocument.createElement('div');\n res.setAttribute('style', 'white-space: pre-wrap;');\n res.textContent = obj.value;\n return res\n } else if (obj.datatype.uri == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {\n res = myDocument.createElement('div');\n res.setAttribute('class', 'embeddedXHTML');\n res.innerHTML = obj.value; // Try that @@@ beware embedded dangerous code\n return res;\n };\n return myDocument.createTextNode(obj.value); // placeholder - could be smarter, \n \n case 'bnode':\n if (obj.toNT() in doneBnodes) { // Break infinite recursion\n referencedBnodes[(obj.toNT())] = true;\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', '#'+obj.toNT().slice(2))\n anchor.setAttribute('class','bnodeRef')\n anchor.textContent = '*'+obj.toNT().slice(3);\n return anchor; \n }\n doneBnodes[obj.toNT()] = true; // Flag to prevent infinite recusruion in propertyTree\n var newTable = propertyTree(obj);\n doneBnodes[obj.toNT()] = newTable; // Track where we mentioned it first\n if (tabulator.Util.ancestor(newTable, 'TABLE') && tabulator.Util.ancestor(newTable, 'TABLE').style.backgroundColor=='white') {\n newTable.style.backgroundColor='#eee'\n } else {\n newTable.style.backgroundColor='white'\n }\n return newTable;\n \n case 'collection':\n var res = myDocument.createElement('table')\n res.setAttribute('class', 'collectionAsTables')\n for (var i=0; i<obj.elements.length; i++) {\n var tr = myDocument.createElement('tr');\n res.appendChild(tr);\n tr.appendChild(objectTree(obj.elements[i]));\n }\n return res;\n case 'formula':\n var res = tabulator.panes.dataContentPane.statementsAsTables(obj.statements, myDocument);\n res.setAttribute('class', 'nestedFormula')\n return res;\n case 'variable':\n var res = myDocument.createTextNode('?' + obj.uri);\n return res;\n \n }\n throw \"Unhandled node type: \"+obj.termType\n }", "getTreeInternal() {\n const op = this;\n return new class extends Tree {\n /**\n * @param {!Visitor<P, R>} visitor\n * @param {P} arg\n * @return {R}\n * @template P, R\n */\n visit(visitor, arg) {\n const handler = op[visitor.symbol];\n if (handler) {\n return handler.call(\n op, args.map(a => visitor.wrap(a, arg)), arg);\n }\n return visitor.default(args, arg);\n }\n };\n }", "function combine(peg_parser, tree_obj){\n\t\tvar child_funcs = [];\n\t\tfor (var i = 0; i < tree_obj.term.length; i++){\n\t\t\tchild_funcs.push(term(peg_parser, tree_obj.term[i]));\n\t\t}\n\t\treturn peg_parser.and.apply(peg_parser, child_funcs);\n\t}", "function newer_postprocessor(\n parse_tree,\n with_morphology,\n with_spaces,\n with_terminators,\n with_trimming,\n with_selmaho,\n with_nodes_labels,\n without_leaf_prefix,\n with_glossing\n) {\n if (!is_array(parse_tree)) return null;\n /* Building a map of node names to node value replacements */\n if (with_spaces)\n var value_substitution_map = {\"spaces\": \"_\", \"initial_spaces\": \"_\"};\n else var value_substitution_map = {};\n /* Building a map of node names to name replacements */\n var name_substitution_map = {\n \"cmene\": \"C\", \"cmevla\": \"C\", \"gismu\": \"G\", \"lujvo\": \"L\",\n \"fuhivla\": \"Z\", \"prenex\": \"PRENEX\", \"sentence\": \"BRIDI\",\n \"selbri\": \"SELBRI\", \"sumti\": \"SUMTI\"\n };\n if (!with_trimming) name_substitution_map = {};\n var special_selmaho = [\"cmevla\", \"gismu\", \"lujvo\", \"fuhivla\", \"ga_clause\",\n \"gu_clause\"];\n /** Building a node_action_for() function from the selected options **/\n if (with_morphology)\n var is_flattening_target = function (tree) { return false; };\n else var is_flattening_target = function (tree) {\n var targets = special_selmaho;\n return (among(tree[0], targets) || is_selmaho(tree[0]));\n };\n var is_branch_removal_target = function (tree) {\n if (!with_spaces && among(tree[0], [\"spaces\", \"initial_spaces\"]))\n return true;\n return (!with_terminators && is_selmaho(tree[0]) && tree.length == 1);\n };\n var whitelist = [];\n if (with_selmaho)\n whitelist = whitelist.concat(special_selmaho);\n if (with_nodes_labels)\n whitelist = whitelist.concat([\"prenex\", \"sentence\", \"selbri\", \"sumti\"]);\n var is_node_trimming_target = function (tree) {\n if (!with_trimming) return false;\n if (with_terminators && is_selmaho(tree[0]) && tree.length == 1)\n return false;\n if (with_selmaho && is_selmaho(tree[0])) return false;\n return !among(tree[0], whitelist);\n };\n var node_action_for = function (node) {\n if (is_branch_removal_target(node)) return 'DEL';\n var ft = is_flattening_target(node);\n var tt = is_node_trimming_target(node);\n if (ft && tt) return \"TRIMFLAT\";\n if (ft) return 'FLAT';\n if (tt) return 'TRIM';\n if (with_trimming && node.length == 1) return 'UNBOX';\n return 'PASS';\n };\n /* Calling process_parse_tree() with the arguments we've built for it */\n return process_parse_tree(\n parse_tree, value_substitution_map, name_substitution_map,\n node_action_for,\n (with_nodes_labels || with_selmaho) && !without_leaf_prefix,\n with_glossing\n );\n}", "function formatAST(node)\n\t\t{\n\t\t\tif(!Array.isArray(node))\n\t\t\t{\n\t\t\t\t// Flatten enum values (object singletons with capital first letter key)\n\t\t\t\tif(node && typeof node === 'object')\n\t\t\t\t{\n\t\t\t\t\tlet keys = Object.keys(node);\n\t\t\t\t\tfor(let key of keys)\n\t\t\t\t\t{\n\t\t\t\t\t\tnode[key] = formatAST(node[key]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// // TEMP : `Der` case\n\t\t\t\t\t// if(node.rule && node.ctx && node.dir && node.rule)\n\t\t\t\t\t// {\n\t\t\t\t\t// \tlet sub = formatAST(node.rule);\n\t\t\t\t\t// \tnode.rule = sub;\n\t\t\t\t\t// \tsub._type = node;\n\t\t\t\t\t// \treturn sub;\n\t\t\t\t\t// }\n\t\t\t\t\t\n\t\t\t\t\t// let key = keys[0];\n\t\t\t\t\t// if(keys.length === 1 && key.charAt(0) !== key.charAt(0).toLowerCase())\n\t\t\t\t\t// {\n\t\t\t\t\t// \treturn formatAST([key].concat(node[key]));\n\t\t\t\t\t// }\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\telse if(node[0] === 'DebugLabel')\n\t\t\t{\n\t\t\t\tlet sub = formatAST(node[3]);\n\t\t\t\tnode[3] = sub;\n\t\t\t\tsub._debug = node;\n\t\t\t\treturn sub;\n\t\t\t}\n\t\t\telse if(node[0] === 'Der')\n\t\t\t{\n\t\t\t\tlet sub = formatAST(node[1].rule);\n\t\t\t\tnode[1].rule = sub;\n\t\t\t\tsub._type = node[1];\n\t\t\t\treturn sub;\n\t\t\t}\n\t\t\t\n\t\t\tfor(var i = 0; i < node.length; i++)\n\t\t\t{\n\t\t\t\tlet s = formatAST(node[i]);\n\t\t\t\tif(Array.isArray(s))\n\t\t\t\t{\n\t\t\t\t\ts._parent = node;\n\t\t\t\t}\n\t\t\t\tnode[i] = s;\n\t\t\t}\n\t\t\treturn node;\n\t\t}", "function many1(parser) {\n return function(input) {\n var value = {rest: input, parsed: '', ast: []};\n for(var i = 0; true; i++) {\n var result = parser(value.rest);\n if(result != false) {\n if(result.ast != null) {\n value.ast.push(result.ast);\n }\n value = {rest: result.rest,\n parsed: value.parsed + result.parsed,\n ast: value.ast};\n }\n else {\n if(value.parsed == '') {\n return false;\n }\n else {\n break;\n }\n }\n }\n return value;\n };\n}", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function T(str) {\r\n return NodeFactory.term(str)\r\n}", "function T(str) {\n return NodeFactory.term(str)\n}", "function parse(source) {\n var ast = parser.parse(source);\n return ast;\n}", "function parser(tokens) {\n let current = 0\n \n function walk() {\n let token = tokens[current]\n\n if(token.token === 'number') {\n current++\n\n return {\n type: 'NumberLiteral',\n value: token.value\n }\n }\n\n if(token.token === 'string') {\n current++\n\n return {\n type: 'StringLiteral',\n value: token.value\n }\n }\n\n if(token.token === 'parentheses' &&\n token.value === '(') {\n token = tokens[++current]\n\n const value = {\n type: 'CallExpression',\n name: token.value,\n params: []\n }\n\n token = tokens[++current]\n\n while(\n (token.token !== 'parentheses') ||\n (token.token === 'parentheses' && token.value !== ')')\n ) {\n value.params.push(walk())\n token = tokens[current]\n }\n\n current++\n return value\n }\n\n throw new TypeError('dont know type appear')\n }\n\n const program = {\n type: 'Program',\n body: []\n }\n\n while(current < tokens.length) {\n program.body.push(walk())\n }\n\n return program\n}", "function nestTokens (tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "function testTree1() {\n var treeBefore =\n 'project()\\n' +\n '-order_by(Employee.salary DESC)\\n' +\n '--select(value_pred(Employee.id gt 100))\\n' +\n '---table_access(Employee)\\n';\n\n var treeAfter =\n 'project()\\n' +\n '-select(value_pred(Employee.id gt 100))\\n' +\n '--table_access_by_row_id(Employee)\\n' +\n '---index_range_scan(Employee.idx_salary, [unbound, unbound], natural)\\n';\n\n var rootNodeBefore = constructTree1(e.salary, lf.Order.DESC);\n assertEquals(treeBefore, lf.tree.toString(rootNodeBefore));\n\n var pass = new lf.proc.OrderByIndexPass(hr.db.getGlobal());\n var rootNodeAfter = pass.rewrite(rootNodeBefore);\n assertEquals(treeAfter, lf.tree.toString(rootNodeAfter));\n}", "function _buildFilterTree(expr) {\n var c;\n var child;\n var clean = false;\n var endParen;\n var esc = false;\n var i = 0;\n var obj;\n var tree = {};\n var split;\n var val = '';\n\n if (expr.length === 0)\n return tree;\n\n // Chop the parens (the call to matchParens below gets rid of the trailer)\n if (expr.charAt(0) == '(')\n expr = expr.substring(1, expr.length - 1);\n\n //store prefix operator\n if (expr.charAt(0) === '&') {\n tree.op = 'and';\n expr = expr.substring(1);\n } else if (expr.charAt(0) === '|') {\n tree.op = 'or';\n expr = expr.substring(1);\n } else if (expr.charAt(0) === '!') {\n tree.op = 'not';\n expr = expr.substring(1);\n } else {\n tree.op = 'expr';\n }\n\n if (tree.op != 'expr') {\n tree.children = [];\n\n // logical operators are k-ary, so we go until our expression string runs\n // out (at least for this recursion level)\n while (expr.length !== 0) {\n endParen = matchParens(expr);\n\n if (endParen == expr.length - 1) {\n tree.children[i] = _buildFilterTree(expr);\n expr = '';\n } else {\n child = expr.slice(0, endParen + 1);\n expr = expr.substring(endParen + 1);\n tree.children[i] = _buildFilterTree(child);\n }\n i++;\n }\n } else {\n //else its some sort of non-logical expression, parse and return as such\n var operatorStr = '';\n tree.name = '';\n tree.value = '';\n\n\n // This parses and enforces filter syntax, which is an AttributeDescription\n // plus a filter operator, followed by (for ldapjs), anything. Note\n // that ldapjs additionally allows the '_' character in the AD, as many\n // users rely on it, even though it's non-standard\n //\n // From 4.1.5 of RFC251\n //\n // AttributeDescription ::= LDAPString\n //\n // A value of AttributeDescription is based on the following BNF:\n //\n // <AttributeDescription> ::= <AttributeType> [ \";\" <options> ]\n //\n // <options> ::= <option> | <option> \";\" <options>\n //\n // <option> ::= <opt-char> <opt-char>*\n //\n // <opt-char> ::= ASCII-equivalent letters, numbers and hyphen\n //\n // Examples of valid AttributeDescription:\n //\n // cn\n // userCertificate;binary\n\n /* JSSTYLED */\n if (!/[a-zA-Z0-9;_\\-]+[~><:]?=.+/.test(expr))\n throw new Error(expr + ' is invalid');\n\n if (expr.indexOf('~=') !== -1) {\n operatorStr = '~=';\n tree.tag = 'approxMatch';\n } else if (expr.indexOf('>=') !== -1) {\n operatorStr = '>=';\n tree.tag = 'greaterOrEqual';\n } else if (expr.indexOf('<=') !== -1) {\n operatorStr = '<=';\n tree.tag = 'lessOrEqual';\n } else if (expr.indexOf(':=') !== -1) {\n operatorStr = ':=';\n tree.tag = 'extensibleMatch';\n } else if (expr.indexOf('=') !== -1) {\n operatorStr = '=';\n tree.tag = 'equalityMatch';\n } else {\n // tree.tag = 'present';\n throw new Error('invalid filter syntax');\n }\n\n if (operatorStr === '') {\n tree.name = expr;\n } else {\n // pull out lhs and rhs of equality operator\n var splitAry = expr.split(operatorStr);\n tree.name = splitAry.shift();\n tree.value = splitAry.join(operatorStr);\n\n // substrings fall into the equality bin in the\n // switch above so we need more processing here\n if (tree.tag === 'equalityMatch') {\n if (tree.value === '*') {\n tree.tag = 'present';\n } else {\n obj = parse_substr(tree);\n tree.initial = obj.initial;\n tree.any = obj.any;\n tree['final'] = obj['final'];\n tree.tag = obj.tag || tree.tag;\n tree.value = obj.value;\n esc = obj.esc;\n clean = obj.clean;\n }\n } else if (tree.tag == 'extensibleMatch') {\n split = tree.name.split(':');\n tree.extensible = {\n matchType: split[0],\n value: tree.value\n };\n\n switch (split.length) {\n case 1:\n break;\n case 2:\n if (split[1].toLowerCase() === 'dn') {\n tree.extensible.dnAttributes = true;\n } else {\n tree.extensible.rule = split[1];\n }\n break;\n case 3:\n tree.extensible.dnAttributes = true;\n tree.extensible.rule = split[2];\n break;\n default:\n throw new Error('Invalid extensible filter');\n }\n\n switch (tree.extensible.rule) {\n case '2.5.13.4':\n case 'caseIgnoreSubstringsMatch':\n tree.extensible.attribute = tree.extensible.matchType;\n obj = parse_substr(tree);\n tree.extensible.initial = obj.initial;\n tree.extensible.any = obj.any;\n tree.extensible['final'] = obj['final'];\n tree.value = obj.value;\n esc = obj.esc;\n clean = obj.clean;\n break;\n\n case '2.5.13.2':\n case 'caseIgnoreMatch':\n tree.extensible.attribute = tree.extensible.matchType;\n break;\n default:\n // noop\n break;\n }\n }\n }\n\n // Cleanup any escape sequences\n if (!clean) {\n\n for (i = 0; i < tree.value.length; i++) {\n c = tree.value[i];\n if (esc) {\n val += c;\n esc = false;\n } else if (c === '\\\\') {\n esc = true;\n } else {\n val += c;\n }\n }\n tree.value = val;\n }\n }\n\n return tree;\n}", "function toParser(p) {\n return (typeof(p) == \"string\") ? token(p) : p;\n}", "function PredictiveParsing(text, M) {\n let cursor = 0,\n root = {'rule': 'Expr', 'production': []},\n // a node and its rule name are kept in alternating sequence inside stack\n // in order to construct a concrete syntax tree\n // source: https://stackoverflow.com/a/27206881/1374078\n stack = ['$', root, 'Expr'];\n\n text += '$';\n\n while(topOf(stack) !== '$') {\n if(topOf(stack) === text[cursor]) {\n let value = stack.pop();\n let node = stack.pop();\n cursor += 1;\n while(cursor < text.length && isDigit(node.rule) && isDigit(text[cursor])) {\n value += text[cursor];\n cursor += 1;\n }\n node.production.push(value);\n } else {\n let production = [].concat(M[topOf(stack)][text[cursor]]);\n let node_name = stack.pop();\n let node = stack.pop();\n\n production.forEach(term => {\n node.production.push({'rule': term, 'production': []});\n });\n\n if(production[0] !== 'Epsilon') {\n node.production.slice().reverse().forEach(node => {\n stack.push(node);\n stack.push(node.rule);\n });\n }\n }\n }\n\n return root;\n}", "function nestTokens(tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, len = tokens.length; i < len; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function tokens(parsers){\r\n return function(scope, state, k){\r\n var i = 0,\r\n ast = [],\r\n length = parsers.length;\r\n \r\n function next(parser){\r\n return function(scope, state, k){\r\n return function(){ return parser(scope, state, function(result){\r\n i++;\r\n if(!result.success)\r\n return k(result);\r\n if(result.ast !== undef)\r\n ast.push(result.ast);\r\n return i < length ? next(parsers[i])(scope, state, k) : k(result);\r\n })};\r\n };\r\n }\r\n\r\n return function(){ return next(parsers[i])(scope, state, function(result){\r\n var success = result.success;\r\n return k({ast: ast, success: success, expecting: success ? undef : result.expecting });\r\n })};\r\n };\r\n}", "function church_astify(tokens) {\n\t// astify changes the opening bracket tokens so the end site is the matching closing bracket\n\tfunction astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction traverse(ast, fn, stopfn) {\n\t\tif (!util.is_leaf(ast) && ast.children.length > 0 && (!stopfn || !stopfn(ast))) {\n\t\t\tast = fn(ast);\n\t\t\tfor (var i = 0; i < ast.children.length; i++) {\n\t\t\t\tast.children[i] = traverse(ast.children[i], fn, stopfn);\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction is_special_form(text) {\n\t\treturn [\"define\", \"lambda\", \"case\", \"cond\", \"if\", \"let\"].indexOf(text) != -1;\n\t}\n\n\tfunction assert_not_special_form(node) {\n\t\tif (is_special_form(node.text)) {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", node.start, node.end, \"Special form \" + node.text + \" cannot be used as an atom\");\n\t\t}\n\t}\n\n\tfunction validate_leaves(ast) {\n\t\tfor (var i = 1; i < ast.children.length; i++) {\n\t\t\tassert_not_special_form(ast.children[i]);\n\t\t}\n\t\treturn ast;\n\t}\n\n\t// NOTE: Many of the desugar functions don't add range information.\n\t// For now, it seems unlikely they'll be needed.\n\n\tfunction dsgr_define(ast) {\n\t\tif (ast.children[0].text==\"define\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"Invalid define\");\n\t\t\t}\n\t\t\t// Function define sugar\n\t\t\tif (!util.is_leaf(ast.children[1])) {\n\t\t\t\tvar lambda_args;\n\t\t\t\t// Variadic sugar\n\t\t\t\tif (ast.children[1].children.length == 3 && ast.children[1].children[1].text == \".\") {\n\t\t\t\t\tlambda_args = ast.children[1].children[2];\n\t\t\t\t} else {\n\t\t\t\t\tlambda_args = {children: ast.children[1].children.slice(1)};\n\t\t\t\t}\n\t\t\t\tvar lambda = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\tlambda_args\n\t\t\t\t\t].concat(ast.children.slice(2))\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\tchildren: [ast.children[0], ast.children[1].children[0], lambda],\n\t\t\t\t\tstart: ast.start,\n\t\t\t\t\tend: ast.end\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_lambda(ast) {\n\t\tif (ast.children[0].text==\"lambda\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"lambda has no body\");\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_let(ast) {\n\t\tvar let_varieties = [\"let\", \"let*\"];\n\n\t\tif (let_varieties.indexOf(ast.children[0].text)!=-1) {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has no body\");\n\t\t\t}\n\t\t\tvar bindings = ast.children[1];\n\t\t\tvar valid_bindings = true;\n\t\t\tif (util.is_leaf(bindings)) {\n\t\t\t\tvalid_bindings = false;\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < bindings.children.length; i++) {\n\t\t\t\t\tif (util.is_leaf(bindings.children[i]) || bindings.children[i].children.length != 2) {\n\t\t\t\t\t\tvalid_bindings = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!valid_bindings) {\n\t\t\t\tthrow util.make_church_error_range(\"SyntaxError\", bindings.start, bindings.end, ast.children[0].text + \" has invalid bindings\");\n\t\t\t}\n\n\t\t\tswitch (ast.children[0].text) {\n\t\t\t\tcase \"let\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t{children: bindings.children.map(function(x) {return x.children[0]})},\n\t\t\t\t\t\t\t\t\tast.children[2]\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t].concat(bindings.children.map(function(x) {return x.children[1]}))\n\t\t\t\t\t};\n\t\t\t\tcase \"let*\":\n\t\t\t\t\tvar new_ast = {\n\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t{children: []},\n\t\t\t\t\t\t\t\t\tast.children[2]\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tfor (var i = bindings.children.length-1; i >= 0; i--) {\n\t\t\t\t\t\t// console.log(JSON.stringify(bindings.children[i].children[0],undefined,2))\n\t\t\t\t\t\tnew_ast = {\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\t\t\t\t\t\t{children: [bindings.children[i].children[0]]},\n\t\t\t\t\t\t\t\t\t\tnew_ast\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbindings.children[i].children[1]\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn new_ast;\n\t\t\t}\n\n\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n\tfunction dsgr_quote(ast) {\n\t\tvar last = ast.children[ast.children.length-1];\n\t\tif (last.text==\"'\") {\n\t\t\tthrow util.make_church_error(\"SyntaxError\", last.start, last.end, \"Invalid single quote\");\n\t\t}\n\t\tfor (var i = ast.children.length - 2; i >= 0; i--) {\n\t\t\tif (ast.children[i].text == \"'\") {\n\t\t\t\tast.children.splice(i, 2, {\n\t\t\t\t\tchildren: [{text: \"quote\", start: ast.children[i].start, end: ast.children[i].end}, ast.children[i+1]],\n\t\t\t\t\tstart: ast.children[i].start,\n\t\t\t\t\tend: ast.children[i+1].end\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction dsgr_case(ast) {\n\t\tfunction case_helper(key, clauses) {\n\t\t\tif (clauses.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tvar clause = clauses[0];\n\t\t\tif (util.is_leaf(clause) || clause.children.length != 2 ||\n\t\t\t\t(util.is_leaf(clause.children[0]) && clause.children[0].text!=\"else\")) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad clause for case\");\n\t\t\t}\n\n\t\t\tif (clause.children[0].text==\"else\") {\n\t\t\t\tif (clauses.length > 1) {\n\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad placement of else clause in case\");\n\t\t\t\t} else {\n\t\t\t\t\treturn clause.children[1];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (var i = 0; i < clause.children[0]; i++) {\n\t\t\t\t\tvar datum = clause.children[0].children[i];\n\t\t\t\t\tif (util.is_leaf(datum)) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", datum.start, datum.end, \" for case\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar next = case_helper(key, clauses.slice(1));\n\t\t\t\tvar new_ast = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"if\"},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchildren: [\n\t\t\t\t\t\t\t\t{text: \"member\"},\n\t\t\t\t\t\t\t\tkey,\n {children: [{text: \"list\"}].concat(clause.children[0].children)}\n\t\t\t\t\t\t\t\t// {children: [{text: \"list\"}].concat(clause.children[0])}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclause.children[1]\n\t\t\t\t\t]\n\t\t\t\t};\n\t\t\t\tif (next) {\n\t\t\t\t\tnew_ast.children.push(next);\n\t\t\t\t}\n\t\t\t\treturn new_ast;\n\t\t\t}\n\t\t}\n\n\t\tif (ast.children[0].text==\"case\") {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"case is missing clauses\");\n\t\t\t}\n\t\t\treturn case_helper(ast.children[1], ast.children.slice(2));\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n\tfunction dsgr_cond(ast) {\n\t\tfunction cond_helper(clauses) {\n\t\t\tif (clauses.length == 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tvar clause = clauses[0];\n\t\t\tif (util.is_leaf(clause) || clause.children.length != 2) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad clause for cond\");\n\t\t\t}\n\t\t\tif (clause.children[0].text==\"else\") {\n\t\t\t\tif (clauses.length > 1) {\n\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", clause.start, clause.end, \"Bad placement of else clause in cond\");\n\t\t\t\t} else {\n\t\t\t\t\treturn clause.children[1];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar next = cond_helper(\n\t\t\t\t\tclauses.slice(1));\n\t\t\t\tvar new_ast = {\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{text: \"if\"},\n\t\t\t\t\t\tclause.children[0],\n\t\t\t\t\t\tclause.children[1]\n\t\t\t\t\t]\n\t\t\t\t};\n\t\t\t\tif (next) {\n\t\t\t\t\tnew_ast.children.push(next);\n\t\t\t\t}\n\t\t\t\treturn new_ast;\n\t\t\t}\n\t\t}\n\n\t\tif (ast.children[0].text==\"cond\") {\n\t\t\tif (ast.children.length < 2) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"cond is missing clauses\");\n\t\t\t}\n\t\t\treturn cond_helper(ast.children.slice(1));\n\t\t} else {\n\t\t\treturn ast;\n\t\t}\n\t}\n\n function dsgr_eval(ast) {\n if (ast.children[0].text == \"eval\") {\n return {\n\t\t\t\tchildren: [\n\t\t\t\t\t{text: \"eval\"},\n\t\t\t\t\t{\n children: [\n // churchToBareJs: for use in eval only\n {text: \"churchToBareJs\"},\n {\n children: [\n {text: \"formatResult\"},\n ast.children[1]\n ]\n }\n ]\n } \n ]\n }\n\t\t\n\t}\n return ast;\n };\n\n\tfunction dsgr_query(ast) {\n\t\t// Makes the lambda that's passed to the query function\n\t\tfunction query_helper(statements, condition, args) {\n\t\t\tif (util.is_leaf(condition) ||\n (condition.children[0].text != \"condition\" && condition.children[0].text != \"factor\")) {\n\t\t\t\tcondition = {\n\t\t\t\t\tchildren: [{text: \"condition\"}, condition],\n\t\t\t\t\tstart: condition.start,\n\t\t\t\t\tend: condition.end\n\t\t\t\t};\n\t\t\t}\n\t\t\targs = args || {children: []};\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\t{text: \"lambda\"},\n\t\t\t\t\targs\n\t\t\t\t].concat(statements.slice(0, -1)).concat(condition).concat(statements[statements.length-1])\n\t\t\t};\n\t\t}\n\t\t\n\t\tif ([\"rejection-query\", \"enumeration-query\"].indexOf(ast.children[0].text) != -1) {\n\t\t\tif (ast.children.length < 3) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has the wrong number of arguments\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\tast.children[0],\n\t\t\t\t\tquery_helper(ast.children.slice(1, -1), ast.children[ast.children.length-1])\n\t\t\t\t],\n\t\t\t\tstart: ast.start,\n\t\t\t\tend: ast.end\n\t\t\t};\n\t\t}\n\t\tif ([\"mh-query\"].indexOf(ast.children[0].text) != -1) {\n\t\t\tif (ast.children.length < 6) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, ast.children[0].text + \" has the wrong number of arguments\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchildren: [\n\t\t\t\t\tast.children[0],\n\t\t\t\t\tquery_helper(ast.children.slice(3, -1), ast.children[ast.children.length-1])\n\t\t\t\t].concat(ast.children.slice(1, 3)),\n\t\t\t\tstart: ast.start,\n\t\t\t\tend: ast.end\n\t\t\t};\n\t\t}\n\t\treturn ast;\n\t}\n\n\tfunction validate_if(ast) {\n\t\tif (ast.children[0].text==\"if\") {\n\t\t\tif (ast.children.length < 3 || ast.children.length > 4) {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", ast.start, ast.end, \"if has the wrong number of arguments\");\n\t\t\t}\n\t\t}\n\t\treturn ast;\n\t}\n \n\tfunction transform_equals_condition(ast) {\n\t\tfunction is_equals_conditionable(ast) {\n\t\t\tif (util.is_leaf(ast)) return false;\n\t\t\tvar fn = church_builtins.__annotations__[rename_map[ast.children[0].text]];\n\t\t\treturn fn && fn.erp && ast.children[fn.numArgs[fn.numArgs.length-1]] == undefined;\n\t\t}\n\n\t\tfunction transform_erp(erp, conditioned_value) {\n\t\t\terp.children.push(conditioned_value);\n\t\t}\n\n\t\tfunction try_transform(left, right) {\n\t\t\tif (left == undefined) return false;\n\t\t\tif (is_equals_conditionable(left)) {\n\t\t\t\ttransform_erp(left, right);\n\t\t\t\tstatements.splice(i, 1, left);\n\t\t\t\treturn true;\n\t\t\t} else if (util.is_leaf(left) && define_table[left.text]) {\n\t\t\t\tvar left_entry = define_table[left.text];\n\t\t\t\tif (!util.is_identifier(right.text) || (\n\t\t\t\t\t\tdefine_table[right.text] && left_entry.index > define_table[right.text].index)) {\n\t\t\t\t\ttransform_erp(left_entry.def, right);\n\t\t\t\t\tstatements.splice(i, 1);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tvar transformed;\n\t\tif ([\"rejection-query\", \"enumeration-query\", \"mh-query\"].indexOf(ast.children[0].text) != -1) {\t\t\t\n\t\t\tvar define_table = {};\n\t\t\t// Assumes preprocessing through dsgr_query\n\t\t\tvar statements = ast.children[1].children.slice(2);\n\t\t\tvar i = 0;\n\t\t\t// Iterate through each lambda statement\n\t\t\tfor (var i = 0; i < statements.length; i++) {\n\t\t\t\tif (!util.is_leaf(statements[i])) {\n\t\t\t\t\t// If statement is a define and an ERP without an existing condition, put it in a table\n\t\t\t\t\tif (statements[i].children[0].text == \"define\" && is_equals_conditionable(statements[i].children[2])) {\n\t\t\t\t\t\tdefine_table[statements[i].children[1].text] = {\n\t\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\t\tdef: statements[i].children[2]\n\t\t\t\t\t\t};\n\t\t\t\t\t// If statement is a condition, check if it's an equality and attempt to transform\n\t\t\t\t\t} else if (statements[i].children[0].text == \"condition\") {\n\t\t\t\t\t\tvar condition = statements[i].children[1];\n\t\t\t\t\t\tif (!util.is_leaf(condition) && [\"=\", \"equal?\"].indexOf(condition.children[0].text) != -1 && condition.children.length == 3) {\n\t\t\t\t\t\t\tvar left = condition.children[1];\n\t\t\t\t\t\t\tvar right = condition.children[2];\n\t\t\t\t\t\t\tif (!try_transform(left, right)) try_transform(right, left);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\treturn ast;\n\t}\n\n\t// Order is important, particularly desugaring quotes before anything else.\n\tvar desugar_fns = [validate_leaves, dsgr_define, dsgr_lambda, dsgr_let, dsgr_case, dsgr_cond, dsgr_eval, dsgr_query, validate_if, transform_equals_condition];\n\n\tvar ast = astify(tokens);\n\t// Special top-level check\n\tfor (var i = 0; i < ast.children.length; i++) {\n\t\tassert_not_special_form(ast.children[i]);\n\t}\n ast = traverse(ast, dsgr_quote);\n\tfor (var i = 0; i < desugar_fns.length; i++) {\n\t\tast = traverse(ast, desugar_fns[i], isquote);\n\t}\n\n\treturn ast;\n}", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function parser(tokens) {\n let ast = {\n type: 'Program',\n body: []\n };\n\n function walk(tokensToUse) {\n let node = {\n type: 'CallExpression',\n name: '',\n params: [],\n }\n\n for (let i = 0; i < tokensToUse.length; i++) {\n let currentToken = tokensToUse[i];\n if (currentToken.type === 'paren' && currentToken.value === '(') {\n if (node.name !== '') {\n let updatedTokens = tokensToUse.slice(i + 1);\n let result = { ...walk(updatedTokens) }\n node.params.push(result.x);\n i = tokensToUse[result.i + i]\n continue\n } else {\n continue\n }\n }\n\n if (currentToken.type === 'name') {\n node.name = currentToken.value;\n continue\n }\n\n if (currentToken.type === 'number') {\n node.params.push({\n type: 'NumberLiteral',\n value: currentToken.value\n });\n continue;\n }\n\n if (currentToken.type === 'string') {\n node.params.push({\n type: 'StringLiteral',\n value: currentToken.value\n });\n continue;\n }\n\n if (currentToken.type === 'paren' && currentToken.value === ')') {\n let x = { ...node }\n return { x, i };\n }\n }\n\n }\n\n let mainResult = walk(tokens)\n ast.body.push(mainResult.x);\n return ast\n}", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function expandTree(tree) {\n\t\ttraverseTree(tree, function(tree, char, i) {\n\t\t\ttree[i] = expandChar(char);\n\t\t});\n\t\treturn tree;\n\t}", "function tokenPrimP1(fn){\r\n return function(p1, arg2){\r\n var pid = parser_id++;\r\n var combinator = function(scope, state, k){\r\n var startIndex = state.index;\r\n var result = state.getCached(pid);\r\n if(result !== undef)\r\n return k(result);\r\n \r\n return function(){ return p1(scope, state, function(result){\r\n \r\n result = fn(arg2, result, state, startIndex);\r\n \r\n state.putCached(pid, startIndex, result);\r\n return k(result);\r\n })};\r\n \r\n };\r\n combinator.constructor = Parser;\r\n return combinator;\r\n };\r\n}", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function parseExprNode(node) {\n switch (node.type) {\n case \"ArrayExpression\":\n return node.elements.map(parseExprNode);\n case \"Literal\":\n return node.value;\n case \"ObjectExpression\":\n var obj = {};\n node.properties.forEach(function(prop) {\n var key = prop.key.name || prop.key.value;\n obj[key] = parseExprNode(prop.value);\n });\n return obj;\n }\n }", "function tokenToAction(token) {\n var word = token.value;\n var definition = context.dictionary.lookup(word);\n\n if (token.isStringLiteral) {\n return namedFunction(\"String: \" + word, function (context) {\n return word;\n });\n }\n // TODO: contributed part on StringPushLiteral s\" (TODO make PR)\n else if (token.isStringPushLiteral) {\n return namedFunction(\"PushString: \" + word, function (context) {\n context.stack.push(word);\n });\n }\n // TODO: contributed part on NeoSyscallLiteral syscall\" (TODO: do not make PR, think on something better...)\n else if (token.isNeoSyscallLiteral) {\n\n if(word == \"Neo.Learn.Call\") { // special syscall \n var execAction = context.stack.pop();\n var definedAction = context.dictionary.lookup(execAction);\n return definedAction; // TODO\n }\n else \n return namedFunction(\"NeoSyscallString: \" + word, function (context) {\n invokeNeoSyscall(word);\n /*\n if(sname == \"Neo.Learn.Execute\") // special syscall \n {\n // invoke tokenizer on read string\n // ????????? TODO\n var str = context.stack.pop();\n next(str);\n }*/\n // TODO: Neo Syscall!!\n\n });\n } \n else if (definition !== null) {\n return definition;\n } else if (isFinite(word)) {\n return namedFunction(\"Number: \" + word, function (context) {\n context.stack.push(+word);\n });\n } else {\n throw new MissingWordError(word);\n }\n\n return function () {\n return \"\";\n };\n }", "parseTreeSelector() {\n this.skipSpace(); // Ignore space after a comma, for example\n // A tree selector must begin with a node selector\n\n var ns = this.parseNodeSelector();\n\n for (;;) {\n // Now check the next token. If there is none, or if it is a\n // comma, then we're done with the treeSelector. Otherwise\n // we expect a combinator followed by another node selector.\n // If we don't see a combinator, we throw an error. If we\n // do see a combinator and another node selector then we\n // combine the current node selector with the new node selector\n // using a Selector subclass that depends on the combinator.\n var token = this.nextToken();\n\n if (!token || token === \",\") {\n break;\n } else if (token === \" \") {\n this.consume();\n ns = new AncestorCombinator(ns, this.parseNodeSelector());\n } else if (token === \">\") {\n this.consume();\n ns = new ParentCombinator(ns, this.parseNodeSelector());\n } else if (token === \"+\") {\n this.consume();\n ns = new PreviousCombinator(ns, this.parseNodeSelector());\n } else if (token === \"~\") {\n this.consume();\n ns = new SiblingCombinator(ns, this.parseNodeSelector());\n } else {\n throw new ParseError$2(\"Unexpected token: \" + token);\n }\n }\n\n return ns;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function extractTextFromMFSParseTree(node) {\n var visitMap = {},\n currSuperscript = 0, maxSuperscript = 0,\n currSubscript = 0, maxSubscript = 0,\n renderText = \"\";\n\n function visit(node) {\n var fn;\n fn = visitMap[node.type];\n if (fn)\n fn(node);\n }\n \n visitMap.horizontal = function(node) {\n for (var ix = 0; ix < node.value.length; ++ix) {\n visit(node.value[ix]);\n }\n }; \n visitMap.style = function(node) {\n for (var ix = 0; ix < node.value.length; ix += 1) {\n if (!node.value[ix].code && node.value[ix].type) {\n visit(node.value[ix]);\n }\n }\n };\n visitMap.sub = function(node) {\n if( maxSubscript < ++currSubscript)\n maxSubscript = currSubscript;\n visit(node.value[0]);\n visit(node.value[1]);\n --currSubscript;\n };\n visitMap['super'] = function(node) {\n if( maxSuperscript < ++currSuperscript)\n maxSuperscript = currSuperscript;\n visit(node.value[0]);\n visit(node.value[1]);\n --currSuperscript;\n };\n visitMap.text = function(node) {\n renderText += getNodeText(node);\n };\n // symbol nodes can be rendered like text nodes\n visitMap.symbol = visitMap.text;\n \n visit(node);\n \n // return the parameters of the text\n return {\n maxSubscript: maxSubscript,\n maxSuperscript: maxSuperscript,\n text: renderText\n };\n }", "function pathToTree(path$$1, numStemmed) {\n\t var root;\n\t var leaf;\n\t for (var i = numStemmed, len = path$$1.length; i < len; i++) {\n\t var node = path$$1[i];\n\t var currentLeaf = [node.id, node.opts, []];\n\t if (leaf) {\n\t leaf[2].push(currentLeaf);\n\t leaf = currentLeaf;\n\t } else {\n\t root = leaf = currentLeaf;\n\t }\n\t }\n\t return root;\n\t}", "function tree_p(tree) {\n return node_p(tree, '')\n}", "parseAtom() {\n return this.maybeCall(() => {\n if (this.isPunc(\"(\")) {\n this.input.next();\n const expr = this.parseExpression.apply(this);\n this.skipPunc(\")\");\n return expr;\n }\n\n if (this.isPunc(\"[\")) {\n const expr = this.parseSquareBracket();\n return expr;\n }\n\n if (this.isPunc(\";\")) return this.skipPunc(\";\");\n if (this.isPunc(\"{\")) return this.parseProg();\n if (this.isKw(\"for\")) return this.parseFor();\n if (this.isKw(\"if\")) return this.parseIf();\n if (this.isKw(\"end\")) return this.skipKw(\"end\");\n if (this.isKw(\"true\") || this.isKw(\"false\")) return this.parseBool();\n if (this.isKw(\"function\")) {\n this.input.next();\n return parseFunc();\n }\n // get the token for the current character\n const tok = this.input.next();\n\n // logger(tok);\n // return the appropriate token to the parser\n if ([\"var\", \"num\", \"str\", \"special\"].includes(tok.type)) {\n return tok;\n } else {\n // if encounter an unexpected token, throw error\n this.unexpected(tok);\n }\n });\n }", "function t(e,n,r){switch(e.type){case\"VariableDeclaration\":e.declarations.forEach(function(e,n){t(e.init,n,r)});break;case\"BinaryExpression\":case\"LogicalExpression\":e.operator&&i[e.operator]?(e.type=\"CallExpression\",e.callee={type:\"MemberExpression\",computed:!1,object:e.right,property:{type:\"Identifier\",name:i[e.operator]}},t(e.left,n,r),t(e.right,n,r),e.arguments=[e.left]):(t(e.left,n,r),t(e.right,n,r));break;case\"ExpressionStatement\":t(e.expression,n,r);break;case\"CallExpression\":e.arguments.forEach(function(e,n){t(e,n,r)});break;case\"AssignmentExpression\":if(e.operator&&i[e.operator]){var o=e.right;e.right={type:\"BinaryExpression\",operator:e.operator.replace(/=/,\"\").trim(),left:e.left,right:o},e.operator=\"=\",t(e.left,n,r),t(e.right,n,r)}else t(e.right,n,r);break;case\"UnaryExpression\":e.operator&&i[e.operator]?(e.type=\"CallExpression\",e.callee={type:\"MemberExpression\",computed:!1,object:e.argument,property:{type:\"Identifier\",name:\"+\"===e.operator||\"-\"===e.operator?i[\"u\"+e.operator]:i[e.operator]}},t(e.argument,n,r),e.arguments=[]):t(e.argument,n,r);break;case\"UpdateExpression\":e.operator&&i[e.operator]&&(e.type=\"CallExpression\",e.callee={type:\"MemberExpression\",computed:!1,object:e.argument,property:{type:\"Identifier\",name:i[e.operator]}},t(e.argument,n,r),e.arguments=[]);break;//We don't ned to transform following nodes! Phew!\ncase\"Literal\":case\"Identifier\":case\"BlockStatement\":case\"FunctionExpression\":}}", "function ast_walker(){function e(e){return[this[0],MAP(e,function(e){var t=[e[0]\n];return e.length>1&&(t[1]=s(e[1])),t})]}function t(e){var t=[this[0]];return e!=\nnull&&t.push(MAP(e,s)),t}function s(e){if(e==null)return null;try{i.push(e);var t=\ne[0],s=r[t];if(s){var o=s.apply(e,e.slice(1));if(o!=null)return o}return s=n[t],\ns.apply(e,e.slice(1))}finally{i.pop()}}function o(e){if(e==null)return null;try{\nreturn i.push(e),n[e[0]].apply(e,e.slice(1))}finally{i.pop()}}function u(e,t){var n=\n{},i;for(i in e)HOP(e,i)&&(n[i]=r[i],r[i]=e[i]);var s=t();for(i in n)HOP(n,i)&&(\nn[i]?r[i]=n[i]:delete r[i]);return s}var n={string:function(e){return[this[0],e]\n},num:function(e){return[this[0],e]},name:function(e){return[this[0],e]},toplevel\n:function(e){return[this[0],MAP(e,s)]},block:t,splice:t,\"var\":e,\"const\":e,\"try\":\nfunction(e,t,n){return[this[0],MAP(e,s),t!=null?[t[0],MAP(t[1],s)]:null,n!=null?\nMAP(n,s):null]},\"throw\":function(e){return[this[0],s(e)]},\"new\":function(e,t){return[\nthis[0],s(e),MAP(t,s)]},\"switch\":function(e,t){return[this[0],s(e),MAP(t,function(\ne){return[e[0]?s(e[0]):null,MAP(e[1],s)]})]},\"break\":function(e){return[this[0],\ne]},\"continue\":function(e){return[this[0],e]},conditional:function(e,t,n){return[\nthis[0],s(e),s(t),s(n)]},assign:function(e,t,n){return[this[0],e,s(t),s(n)]},dot\n:function(e){return[this[0],s(e)].concat(slice(arguments,1))},call:function(e,t)\n{return[this[0],s(e),MAP(t,s)]},\"function\":function(e,t,n){return[this[0],e,t.slice\n(),MAP(n,s)]},\"debugger\":function(){return[this[0]]},defun:function(e,t,n){return[\nthis[0],e,t.slice(),MAP(n,s)]},\"if\":function(e,t,n){return[this[0],s(e),s(t),s(n\n)]},\"for\":function(e,t,n,r){return[this[0],s(e),s(t),s(n),s(r)]},\"for-in\":function(\ne,t,n,r){return[this[0],s(e),s(t),s(n),s(r)]},\"while\":function(e,t){return[this[0\n],s(e),s(t)]},\"do\":function(e,t){return[this[0],s(e),s(t)]},\"return\":function(e)\n{return[this[0],s(e)]},binary:function(e,t,n){return[this[0],e,s(t),s(n)]},\"unary-prefix\"\n:function(e,t){return[this[0],e,s(t)]},\"unary-postfix\":function(e,t){return[this\n[0],e,s(t)]},sub:function(e,t){return[this[0],s(e),s(t)]},object:function(e){return[\nthis[0],MAP(e,function(e){return e.length==2?[e[0],s(e[1])]:[e[0],s(e[1]),e[2]]}\n)]},regexp:function(e,t){return[this[0],e,t]},array:function(e){return[this[0],MAP\n(e,s)]},stat:function(e){return[this[0],s(e)]},seq:function(){return[this[0]].concat\n(MAP(slice(arguments),s))},label:function(e,t){return[this[0],e,s(t)]},\"with\":function(\ne,t){return[this[0],s(e),s(t)]},atom:function(e){return[this[0],e]},directive:function(\ne){return[this[0],e]}},r={},i=[];return{walk:s,dive:o,with_walkers:u,parent:function(\n){return i[i.length-2]},stack:function(){return i}}}" ]
[ "0.6481999", "0.62800974", "0.6020416", "0.56803274", "0.5636488", "0.5622504", "0.53980356", "0.53980356", "0.53980356", "0.53980356", "0.5350911", "0.52682894", "0.52641803", "0.52227634", "0.5216205", "0.521228", "0.519589", "0.51795083", "0.51542884", "0.513525", "0.5100614", "0.5098454", "0.5086495", "0.50814885", "0.50712746", "0.5052666", "0.50511235", "0.50508606", "0.50508606", "0.50508606", "0.50508606", "0.50508606", "0.50508606", "0.5043081", "0.50238985", "0.5007019", "0.4994321", "0.49919158", "0.49899536", "0.49842986", "0.49827614", "0.49682045", "0.49585342", "0.4942964", "0.4935314", "0.4931194", "0.49295512", "0.4921462", "0.49180806", "0.49180806", "0.49151558", "0.49131677", "0.49004164", "0.48908278", "0.48833558", "0.4882914", "0.48814598", "0.48809126", "0.48747915", "0.48740828", "0.48406327", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4833178", "0.4828415", "0.48281285", "0.48228782", "0.48228782", "0.48228782", "0.48223588", "0.48198", "0.48198", "0.48198", "0.48198", "0.4818877", "0.48183024", "0.48170504", "0.48152497", "0.481428", "0.48049507", "0.48031995", "0.47998032", "0.4791721", "0.47876593", "0.47859538", "0.47830766", "0.47825453" ]
0.6080196
2
similar to `parse` in the honu paper ([Syntax], Map, Map) > [TermTree]
function expand(stx, context) { assert(context, 'must provide an expander context'); var trees = expandToTermTree(stx, context); var terms = _.map(trees.terms, function (term) { return expandTermTreeToFinal(term, trees.context); }); if (trees.restStx) { terms.push.apply(terms, trees.restStx); } return terms; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TermTree() {\n }", "parseTerm() {\n const assertion = this.maybeParseAssertion();\n if (assertion) {\n return assertion;\n }\n return {\n type: 'Term',\n capturingParenthesesBefore: this.capturingGroups.length,\n Atom: this.parseAtom(),\n Quantifier: this.maybeParseQuantifier(),\n };\n }", "function parseTerm() {\n var left = parseFactor();\n var op = tokens[position];\n while (op === '*' || op === '/') {\n ++position;\n var right = parseFactor();\n left = new BinaryOperation(left, op, right);\n op = tokens[position];\n }\n return left;\n }", "function term_part(peg_parser, tree_obj){\n// \t\tconsole.log(tree_obj);\n\t\tvar non_empty = \"\";\n\t\tfor (var node_name in tree_obj){\n\t\t\tif (!tree_helpers.is_nil_node(tree_obj[node_name])){\n\t\t\t\tnon_empty = node_name;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar node = tree_obj[non_empty];\n\t\tswitch (non_empty){\n\t\t\tcase \"fork\":\n\t\t\t\treturn fork(peg_parser, node);\n\t\t\tcase \"call_rule\":\n\t\t\t\treturn peg_parser.rule(node.rule_name.value);\n\t\t\tcase \"string\":\n\t\t\t\treturn peg_parser.word(node.value);\n\t\t\tcase \"end\":\n\t\t\t\treturn peg_parser.end();\n\t\t\tcase \"ws\":\n\t\t\t\treturn peg_parser.ws();\n\t\t}\n\t\treturn peg_parser.word(\"\");\n\t}", "function expandTermTreeToFinal(term, context) {\n assert(context && context.env, 'environment map is required');\n if (term.isArrayLiteral) {\n term.array.delim.token.inner = expand(term.array.delim.expose().token.inner, context);\n return term;\n } else if (term.isBlock) {\n term.body.delim.token.inner = expand(term.body.delim.expose().token.inner, context);\n return term;\n } else if (term.isParenExpression) {\n assert(term.expr.delim.token.inner.length === 1, 'Paren expressions always have a single term inside the delimiter');\n term.expr.delim.token.inner = [expandTermTreeToFinal(term.expr.delim.token.inner[0], context)];\n return term;\n } else if (term.isCall) {\n term.fun = expandTermTreeToFinal(term.fun, context);\n term.args = _.map(term.args, function (arg) {\n return expandTermTreeToFinal(arg, context);\n });\n return term;\n } else if (term.isConst) {\n term.call = expandTermTreeToFinal(term.call, context);\n return term;\n } else if (term.isUnaryOp) {\n term.expr = expandTermTreeToFinal(term.expr, context);\n return term;\n } else if (term.isBinOp || term.isAssignmentExpression) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right = expandTermTreeToFinal(term.right, context);\n return term;\n } else if (term.isObjGet) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right.delim.token.inner = expand(term.right.delim.expose().token.inner, context);\n return term;\n } else if (term.isObjDotGet) {\n term.left = expandTermTreeToFinal(term.left, context);\n term.right = expandTermTreeToFinal(term.right, context);\n return term;\n } else if (term.isConditionalExpression) {\n term.cond = expandTermTreeToFinal(term.cond, context);\n term.tru = expandTermTreeToFinal(term.tru, context);\n term.fls = expandTermTreeToFinal(term.fls, context);\n return term;\n } else if (term.isVariableDeclaration) {\n if (term.init) {\n term.init = expandTermTreeToFinal(term.init, context);\n }\n return term;\n } else if (term.isVariableStatement) {\n term.decls = _.map(term.decls, function (decl) {\n return expandTermTreeToFinal(decl, context);\n });\n return term;\n } else if (term.isDelimiter) {\n // expand inside the delimiter and then continue on\n term.delim.token.inner = expand(term.delim.expose().token.inner, context);\n return term;\n } else if (term.isNamedFun || term.isAnonFun || term.isCatchClause || term.isArrowFun || term.isModule) {\n // function definitions need a bunch of hygiene logic\n // push down a fresh definition context\n var newDef = [];\n var bodyContext = makeExpanderContext(_.defaults({ defscope: newDef }, context));\n var paramSingleIdent = term.params && term.params.token.type === parser.Token.Identifier;\n var params;\n if (term.params && term.params.token.type === parser.Token.Delimiter) {\n params = term.params.expose();\n } else if (paramSingleIdent) {\n params = term.params;\n } else {\n params = syn.makeDelim('()', [], null);\n }\n var bodies;\n if (Array.isArray(term.body)) {\n bodies = syn.makeDelim('{}', term.body, null);\n } else {\n bodies = term.body;\n }\n bodies = bodies.addDefCtx(newDef);\n var paramNames = _.map(getParamIdentifiers(params), function (param) {\n var freshName = fresh();\n return {\n freshName: freshName,\n originalParam: param,\n renamedParam: param.rename(param, freshName)\n };\n });\n // rename the function body for each of the parameters\n var renamedBody = _.reduce(paramNames, function (accBody, p) {\n return accBody.rename(p.originalParam, p.freshName);\n }, bodies);\n renamedBody = renamedBody.expose();\n var expandedResult = expandToTermTree(renamedBody.token.inner, bodyContext);\n var bodyTerms = expandedResult.terms;\n if (expandedResult.restStx) {\n // The expansion was halted prematurely. Just stop and\n // return what we have so far, along with the rest of the syntax\n renamedBody.token.inner = expandedResult.terms.concat(expandedResult.restStx);\n if (Array.isArray(term.body)) {\n term.body = renamedBody.token.inner;\n } else {\n term.body = renamedBody;\n }\n return term;\n }\n var renamedParams = _.map(paramNames, function (p) {\n return p.renamedParam;\n });\n var flatArgs;\n if (paramSingleIdent) {\n flatArgs = renamedParams[0];\n } else {\n flatArgs = syn.makeDelim('()', joinSyntax(renamedParams, ','), term.params || null);\n }\n var expandedArgs = expand([flatArgs], bodyContext);\n assert(expandedArgs.length === 1, 'should only get back one result');\n // stitch up the function with all the renamings\n if (term.params) {\n term.params = expandedArgs[0];\n }\n bodyTerms = _.map(bodyTerms, function (bodyTerm) {\n // add the definition context to the result of\n // expansion (this makes sure that syntax objects\n // introduced by expansion have the def context)\n if (bodyTerm.isBlock) {\n // we need to expand blocks before adding the defctx since\n // blocks defer macro expansion.\n var blockFinal = expandTermTreeToFinal(bodyTerm, expandedResult.context);\n return blockFinal.addDefCtx(newDef);\n } else {\n var termWithCtx = bodyTerm.addDefCtx(newDef);\n // finish expansion\n return expandTermTreeToFinal(termWithCtx, expandedResult.context);\n }\n });\n if (term.isModule) {\n bodyTerms = _.filter(bodyTerms, function (bodyTerm) {\n if (bodyTerm.isExport) {\n term.exports.push(bodyTerm);\n return false;\n } else {\n return true;\n }\n });\n }\n renamedBody.token.inner = bodyTerms;\n if (Array.isArray(term.body)) {\n term.body = renamedBody.token.inner;\n } else {\n term.body = renamedBody;\n }\n // and continue expand the rest\n return term;\n }\n // the term is fine as is\n return term;\n }", "function parseTerm(tok) {\n\tvar startPosition = tok.position();\n\t\n\t// Parse groups and elements\n\tvar items = [];\n\twhile (true) {\n\t\tvar next = tok.peek();\n\t\tif (next == null)\n\t\t\tbreak;\n\t\telse if (next == \"(\")\n\t\t\titems.push(parseGroup(tok));\n\t\telse if (/^[A-Za-z][a-z]*$/.test(next))\n\t\t\titems.push(parseElement(tok));\n\t\telse\n\t\t\tbreak;\n\t}\n\t\n\t// Parse optional charge\n\tvar charge = 0;\n\tvar next = tok.peek();\n\tif (next != null && next == \"^\") {\n\t\ttok.consume(\"^\");\n\t\tnext = tok.peek();\n\t\tif (next == null)\n\t\t\tthrow {message: \"Number or sign expected\", start: tok.position()};\n\t\telse\n\t\t\tcharge = parseOptionalNumber(tok);\n\t\t\n\t\tnext = tok.peek();\n\t\tif (next == \"+\")\n\t\t\tcharge = +charge; // No-op\n\t\telse if (next == \"-\")\n\t\t\tcharge = -charge;\n\t\telse\n\t\t\tthrow {message: \"Sign expected\", start: tok.position()};\n\t\ttok.take(); // Consume the sign\n\t}\n\t\n\t// Check if term is valid\n\tvar elems = new Set();\n\tfor (var i = 0; i < items.length; i++)\n\t\titems[i].getElements(elems);\n\telems = elems.toArray(); // List of all elements used in this term, with no repeats\n\tif (items.length == 0) {\n\t\tthrow {message: \"Invalid term - empty\", start: startPosition, end: tok.position()};\n\t} else if (indexOf(elems, \"e\") != -1) { // If it's the special electron element\n\t\tif (items.length > 1)\n\t\t\tthrow {message: \"Invalid term - electron needs to stand alone\", start: startPosition, end: tok.position()};\n\t\telse if (charge != 0 && charge != -1)\n\t\t\tthrow {message: \"Invalid term - invalid charge for electron\", start: startPosition, end: tok.position()};\n\t\t// Tweak data\n\t\titems = [];\n\t\tcharge = -1;\n\t} else { // Otherwise, a term must not contain an element that starts with lowercase\n\t\tfor (var i = 0; i < elems.length; i++) {\n\t\t\tif (/^[a-z]+$/.test(elems[i]))\n\t\t\t\tthrow {message: 'Invalid element name \"' + elems[i] + '\"', start: startPosition, end: tok.position()};\n\t\t}\n\t}\n\t\n\treturn new Term(items, charge);\n}", "function term(peg_parser, tree_obj){\n\t\tvar _term_part = term_part(peg_parser, tree_obj.term_part);\n\t\tvar possible_apps = [\"any\", \"some\", \"not\", \"without\"];\n\t\tfor (var i = 0; i < possible_apps.length; i++){\n\t\t\tvar app = possible_apps[i];\n\t\t\tif (tree_helpers.is_leaf(tree_obj[app])){\n\t\t\t\treturn peg_parser[app](_term_part);\n\t\t\t}\n\t\t}\n\t\tif (!tree_helpers.is_nil_node(tree_obj.time)){\n\t\t\tvar numbers = tree_obj.times.number;\n\t\t\treturn peg_parser.times_range(_term_part, numbers[0], numbers[1]);\n\t\t}\n\t\treturn _term_part;\n\t}", "function parseTree(text, errors, options) {\n if (errors === void 0) { errors = []; }\n if (options === void 0) { options = ParseOptions.DEFAULT; }\n var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: void 0 }; // artificial root\n function ensurePropertyComplete(endOffset) {\n if (currentParent.type === 'property') {\n currentParent.length = endOffset - currentParent.offset;\n currentParent = currentParent.parent;\n }\n }\n function onValue(valueNode) {\n currentParent.children.push(valueNode);\n return valueNode;\n }\n var visitor = {\n onObjectBegin: function (offset) {\n currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onObjectProperty: function (name, offset, length) {\n currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });\n currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });\n },\n onObjectEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onArrayBegin: function (offset, length) {\n currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onArrayEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onLiteralValue: function (value, offset, length) {\n onValue({ type: getLiteralNodeType(value), offset: offset, length: length, parent: currentParent, value: value });\n ensurePropertyComplete(offset + length);\n },\n onSeparator: function (sep, offset, length) {\n if (currentParent.type === 'property') {\n if (sep === ':') {\n currentParent.colonOffset = offset;\n }\n else if (sep === ',') {\n ensurePropertyComplete(offset);\n }\n }\n },\n onError: function (error, offset, length) {\n errors.push({ error: error, offset: offset, length: length });\n }\n };\n visit(text, visitor, options);\n var result = currentParent.children[0];\n if (result) {\n delete result.parent;\n }\n return result;\n}", "function getParseTokens(){\n\treturn {\n\t\t'union' : \"+\",\n\t\t'intersection' : \"^^\"\n\t};\n}", "function parseTerm(list){\n // Must start with a factor\n var left=parseFactor(list)\n if(left===null)return null\n\n var position=list.getPosition()\n // Can be followed by * / or % and another term\n var tkn=list.next()\n if(tkn!=null && (tkn.data===\"*\" || tkn.data===\"/\" || tkn.data===\"%\")){\n // Must end with another term\n\t\tvar right=parseTerm(list)\n\t\tif(right==null)throw new ParseException(tkn,\"Parser\",\"Isolated operator found at the end\");\n\t\tvar expr=new Expression(ExpressionType.OPERATOR,tkn);\n\t\texpr.left=left\n expr.right=right\n\t\treturn expr\n\t}\n\n // This did not end with another term, reset and return initial factor\n list.setPosition(position)\n return left\n}", "function T(str) {\r\n return NodeFactory.term(str)\r\n}", "function T(str) {\n return NodeFactory.term(str)\n}", "function parse(array,tree){\n\tvar currentToken = 0;\n\tvar parseString = \"\";\n var cstString = \"\";\n var astString = \"\";\n\tvar errors = false;\n var cstDepth = 0;\n var astDepth = 0;\n\n //Boolean assist\n var boolDepth = 0;\n\n //Add assist\n var addDepth = 0;\n\n //Tree Object Vars\n var asTree = new Tree();\n var scope = -1;\n var blockList = [];\n var string = \"\";\n\n //Symbol Table Helpers\n var symbolArray = []; //array of declared symbols\n\n var returnArr;\n \n parseString += \"PARSER: parse()\\n\";\n\n parseProgram();\n\n returnArr = [errors, parseString, cstString, astString, asTree, symbolArray];\n return returnArr;\n\n\tfunction treeMaker(e){\n\t\tvar treeBranch = \"\";\n\t\tif(e > 0){\n\t\t\tfor(l = 0; l < e; l++){\n\t\t\t\ttreeBranch+=\"-\";\n\t\t\t}\n\t\t}\n\t\treturn treeBranch;\n }\n\n\tfunction match(t){\n\t\tif(array[currentToken][0] != t && errors == false){\n\t\t\tparseString+= \"PARSER: ERROR: Expected \" + t + \" got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t} else if(array[currentToken][0] != t){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t} else {\n\t\t\tcstString+= treeMaker(cstDepth)+\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseProgram(){\n\t\tparseString+= \"PARSER: parseProgram()\\n\";\n\t\tcstString+= \"<Program>\\n\";\n\t\tparseBlock([0]);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_EOP\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBlock(arr){\n\t\tparseString+= \"PARSER: parseBlock()\\n\";\n \n //CST\n cstDepth++;\n\t\tcstString+= treeMaker(cstDepth)+\"<Block>\\n\";\n cstDepth++;\n //AST\n astString+= treeMaker(astDepth)+\"< BLOCK >\\n\";\n astDepth++;\n\n //Tree\n scope++;\n blockList.push([\"BLOCK\", array[currentToken][2], scope]); //add block to blocklist\n\n if (arr.length == 1){\n if (scope > 0){\n asTree.add(blockList[scope],blockList[scope-1]); //parent will be previous scope's block node\n } else {\n asTree.add(blockList[scope]);\n }\n } else {\n asTree.add(blockList[scope], arr); //parent will be if or while\n }\n\n\t\tmatch(\"T_LBRACE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n parseStatementList();\n \n scope--;\n\n\t\tmatch(\"T_RBRACE\");\n \n cstDepth--;\n astDepth--;\n \n if(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseStatementList(){\n parseString+= \"PARSER: parseStatementList()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement List>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\" || array[currentToken][0]==\"T_ID\" || \n\t\t array[currentToken][0]==\"T_VAR_TYPE_INT\" || array[currentToken][0]==\"T_VAR_TYPE_STRING\" ||\n\t\t array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\" || array[currentToken][0]==\"T_WHILE\" ||\n\t\t array[currentToken][0]==\"T_IF\" || array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tcstDepth++;\n\t\t\tparseStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tcstDepth-=2;\n\t\t\tparseStatementList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseStatement(){\n parseString+= \"PARSER: parseStatement()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\"){\n\t\t\tparsePrintStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseAssignmentStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_INT\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_STRING\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tparseVarDecl();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_WHILE\"){\n\t\t\tparseWhileStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_IF\"){\n\t\t\tparseIfStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tparseBlock([0]);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected print/id/int/string/boolean/while/if/lbrace got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parsePrintStatement(){\n parseString+= \"PARSER: parsePrintStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Print Statement>\\n\";\n //AST\n astString+= treeMaker(astDepth) + \"< Print Statement >\\n\";\n\n //Tree\n var printNode = [\"Print Statement\", array[currentToken][2], scope];\n asTree.add(printNode,blockList[scope]); //add [print node, parent block]\n \n\t\tmatch(\"T_PRINT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_LPAREN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n \n astDepth++;\n\n\t\tparseExpr(printNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n match(\"T_RPAREN\");\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseAssignmentStatement(){\n\t\tparseString+= \"PARSER: parseAssignmentStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Assignment Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Assignment Statement >\\n\";\n astDepth++;\n \n //Tree\n var assignmentNode = [\"Assignment Statement\", array[currentToken][2],scope];\n\n asTree.add(assignmentNode, blockList[scope]); //add [assignment node, parent block]\n\n parseId(assignmentNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_ASSIGN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseExpr(assignmentNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseVarDecl(){\n\t\tparseString+= \"PARSER: parseVarDecl()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Variable Declaration Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Variable Declaration >\\n\";\n astDepth++;\n\n //Tree\n var declarationNode = [\"Variable Declaration\", array[currentToken][2], scope];\n\n asTree.add(declarationNode, blockList[scope]); //add [variable decl node, parent block]\n\n //Symbol Table Helper\n\n symbolArray.push([array[currentToken + 1][1], array[currentToken][1], scope, array[currentToken][2]]);\n\n\t\tparseType(declarationNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseId(declarationNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseWhileStatement(){\n\t\tparseString+= \"PARSER: parseWhileStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<While Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< While Statement >\\n\";\n astDepth++;\n\n //Tree\n var whileNode = [\"While Statement\", array[currentToken][2], scope];\n\n asTree.add(whileNode, blockList[scope]); //add [while node, parent block]\n\n\t\tmatch(\"T_WHILE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(whileNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(whileNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseIfStatement(){\n\t\tparseString+= \"PARSER: parseIfStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<If Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< If Statement >\\n\";\n astDepth++;\n\n //Tree\n var ifNode = [\"If Statement\", array[currentToken][2], scope];\n\n asTree.add(ifNode, blockList[scope]); //add [if node, parent block]\n\n\t\tmatch(\"T_IF\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(ifNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(ifNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseExpr(arr){\n\t\tparseString+= \"PARSER: parseExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Expression>\\n\";\n\n\t\tif(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseIntExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_QUOTE\"){\n\t\t\tparseStringExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n else if (array[currentToken][0] == \"T_LPAREN\"){\n parseBooleanExpr(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if (array[currentToken][0] == \"T_FALSE\" ||\n array[currentToken][0] == \"T_TRUE\"){\n parseBoolVal(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseId(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT or T_QUOTE or T_LPAREN or T_ID or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n }\n\n\tfunction parseIntExpr(arr){\n parseString+= \"PARSER: parseIntExpr()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Integer Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_DIGIT\" && array[currentToken+1][0]==\"T_ADD\"){\n //AST\n astString += treeMaker(astDepth) + \"< Add >\\n\";\n astDepth++;\n addDepth++;\n\n //Tree\n var addNode = [\"Add\", array[currentToken][2], scope, addDepth];\n\n asTree.add(addNode, arr); //add [add node, parent]\n\n\t\t\tparseDigit(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseIntOp();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseDigit(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n }\n //astDepth--;\n\t}\n\n\tfunction parseStringExpr(arr){\n\t\tparseString+= \"PARSER: parseStringExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<String Expression>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \";\n\n string = \"\"; //reset variable\n var stringLine = array[currentToken][2];\n\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseCharList();\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n //AST\n astString += \" ]\\n\";\n //ADD THE RIGHT STRING NODE TO THE AST\n //Tree\n var stringNode = [\"T_STRING\", string, stringLine,scope];\n asTree.add(stringNode, arr); //add [string node, parent]\n string = \"\"; //reset variable\n\n\t}\n\n\tfunction parseBooleanExpr(arr){\n\t\tparseString+= \"PARSER: parseBooleanExpr()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Boolean Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_LPAREN\"){\n //AST\n astString += treeMaker(astDepth) + \"< Boolean Expression >\\n\";\n astDepth++;\n boolDepth++;\n //Tree\n var boolExpNode = [\"Boolean Expression\", array[currentToken][2], scope, boolDepth];\n asTree.add(boolExpNode, arr); //add [bool exp node, parent block]\n\t\t\tmatch(\"T_LPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseBoolOp(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n match(\"T_RPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n } else if (array[currentToken][0] == \"T_TRUE\" || array[currentToken][0] == \"T_FALSE\"){\n parseBoolVal(arr);\n if(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n } else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_LPAREN or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseId(arr){\n\t\tparseString+= \"PARSER: parseId()\\n\";\n cstString+= treeMaker(cstDepth)+\"<ID>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n \n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [id node, parent]\n \n match(\"T_ID\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\t\t\n\t}\n\n\tfunction parseCharList(){\n\t\tparseString+= \"PARSER: parseCharList()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Character List>\\n\";\n if (array[currentToken][0] == \"T_CHAR\" && array[currentToken][1] == \" \") {\n parseSpace();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n parseCharList();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if(array[currentToken][0]==\"T_CHAR\"){\n\t\t\tparseChar();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseCharList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseType(arr){\n\t\tparseString+= \"PARSER: parseType()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Type>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tif(array[currentToken][0]==\"T_VAR_TYPE_INT\"){\n\t\t\tmatch(\"T_VAR_TYPE_INT\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_STRING\"){\n\t\t\tmatch(\"T_VAR_TYPE_STRING\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tmatch(\"T_VAR_TYPE_BOOLEAN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_VAR_TYPE_INT/STRING/BOOLEAN got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseChar(){\n\t\tparseString+= \"PARSER: parseChar()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tmatch(\"T_CHAR\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n\t}\n\n\tfunction parseSpace(){\n\t\tparseString+= \"PARSER: parseSpace()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Space Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tif(array[currentToken][1] != \" \"){\n\t\t\tparseString+= \"PARSER: ERROR: Expected ' ' got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t} else {\n cstString += treeMaker(cstDepth) +\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseDigit(arr){\n\t\tparseString+= \"PARSER: parseDigit()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Digit>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tmatch(\"T_DIGIT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBoolOp(arr){\n\t\tparseString+= \"PARSER: parseBoolOp()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Operator>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool op node, parent]\n\t\tif(array[currentToken][0]==\"T_EQ\"){\n\t\t\tmatch(\"T_EQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_INEQ\"){\n\t\t\tmatch(\"T_INEQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_EQ or T_INEQ got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseBoolVal(arr){\n\t\tparseString+= \"PARSER: parseBoolVal()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Value>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool val node, parent]\n\t\tif(array[currentToken][0]==\"T_FALSE\"){\n\t\t\tmatch(\"T_FALSE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_TRUE\"){\n\t\t\tmatch(\"T_TRUE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseIntOp(){\n\t\tparseString+= \"PARSER: parseIntOp()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Addition>\\n\";\n\t\tmatch(\"T_ADD\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n}", "function walk_tree(ast) {\n var walker = {\n \"assign\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n assign_expr.left_expr = walk_tree(ast[2]);\n assign_expr.right_expr = walk_tree(ast[3]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr;\n },\n \n \"var\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n \n assign_expr.left_expr = new type_object();\n assign_expr.left_expr.name = ast[1][0][0];\n assign_expr.right_expr = walk_tree(ast[1][0][1]);\n assign_expr.name = assign_expr.left_expr.name;\n \n return assign_expr; \n },\n \n \"stat\" : function() {\n return walk_tree(ast[1]);\n },\n \n \"dot\" : function() {\n var dot_obj = walk_tree(ast[1]);\n dot_obj.child = new type_object();\n dot_obj.child.name = ast[2];\n dot_obj.child.parent = dot_obj;\n return dot_obj;\n },\n \n \"name\" : function() {\n var new_obj = new type_object();\n new_obj.type = \"name\";\n new_obj.name = ast[1];\n return new_obj;\n },\n \n \"new\" : function() {\n var expr = walk_tree(ast[1]);\n expr.type = \"composition\";\n return expr;\n },\n \n \"function\" : function() {\n var func = new type_function(\"function\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"defun\" : function() { \n var func = new type_function(\"defun\", ast[1], [\"toplevel\", [ast]], ast[2]);\n return func;\n },\n \n \"return\" : function() {\n var return_expr = new type_expression();\n return_expr.type = \"return_expr\";\n return_expr.expr = walk_tree(ast[1]);\n return return_expr;\n },\n \n \"string\" : function() {\n var obj = new type_object();\n obj.type = \"string\";\n obj.value = ast[1];\n return obj;\n },\n \n \"num\" : function() {\n var obj = new type_object();\n obj.type = \"num\";\n obj.value = ast[1];\n return obj;\n },\n \n \"binary\" : function() {\n var binary_expr = new binary_expression();\n binary_expr.type = \"binary_expr\";\n binary_expr.binary_lhs = walk_tree(ast[2]);\n binary_expr.binary_rhs = walk_tree(ast[3]);\n },\n }\n \n var parent = ast[0];\n \n var func = walker[parent];\n \n return func(ast);\n}", "function TreeParser() {\n var orderOfOperations,\n tokens,\n length,\n index,\n peekAtNextToken,\n parse,\n parseExpression,\n parseAdditive,\n parseMultiplicative,\n parsePrimary,\n isInLevel,\n parseBinary,\n calculate,\n mathOperations;\n\n orderOfOperations = [['+', '-'],['*', '/'], ['^']];\n\n mathOperations = {\n '+' : function(x, y) {\n return x + y;\n },\n\n '-' : function(x, y) {\n return x - y;\n },\n\n '*' : function(x, y) {\n return x * y;\n },\n\n '/' : function(x, y) {\n if (y === 0) {\n throw 'the right operand of a divide operator cannot be zero';\n }\n return x / y;\n },\n\n '^' : function(x, y) {\n return Math.pow(x, y);\n } \n }\n\n tokens = [];\n length = 0;\n index = 0;\n\n peekAtNextToken = function () {\n if (index === length) {\n return null;\n }\n return tokens[index];\n };\n\n /**\n * creates an abstract tree from a tokens array\n * this function does not validate the expression mathematically\n * @param {array} tokensArr an array that contains tokens\n * @return {object} the abstract expression tree root\n */\n parse = function (tokensArr) {\n tokens = tokensArr;\n length = tokens.length;\n if (length === 0) {\n return;\n }\n index = 0;\n\n //we want to parse the expression from left to right to avoid problems like 1-1-1=1\n tokens = tokens.reverse();\n return parseExpression();\n };\n\n /**\n * parses an assignment expression\n * @return {object} the abstract expression tree assignment node\n */\n parseExpression = function () {\n return parseBinary(0);\n };\n\n /**\n * parses an assignment expression\n * @return {object} the abstract expression tree assignment node\n */\n isInLevel = function (operator, order) {\n return orderOfOperations[order].indexOf(operator) > -1;\n };\n\n /**\n * recursivly parses a binary expression by order of operations\n * each recursion level represents the more immidiate operation\n * @param {Number} order the current order of operation\n * @return {object} the abstract expression tree node\n */\n parseBinary = function (order) {\n var right,\n token,\n node;\n\n right = order == orderOfOperations.length - 1\n ? parsePrimary()\n : parseBinary(order + 1);\n \n token = peekAtNextToken();\n if (token === null) {\n return right;\n }\n\n while (isInLevel(token.value, order)) {\n index += 1;\n node = {};\n node = token;\n node.right = right;\n node.left = parseBinary(order);\n right = node;\n \n token = peekAtNextToken();\n if (token === null) {\n return right;\n }\n }\n\n return right;\n };\n\n /**\n * parses a term expression i.e. a finite number, an varialbe or an expression in parens\n * @return {object} the abstract expression tree primary node\n */\n parsePrimary = function () {\n var token,\n node;\n\n if (index === length) {\n throw \"error: there are no more tokens to parse\";\n }\n\n token = tokens[index];\n if (token.type === tokenType.num || token.type === tokenType.id) {\n index += 1;\n node = {};\n node = token;\n return node;\n }\n\n if (token.value === ')') {\n index += 1;\n node = parseExpression();\n\n token = peekAtNextToken();\n if (token.value !== '(') {\n throw \"error: '(' was expected\";\n }\n\n index += 1;\n return node;\n }\n\n throw \"error: token '\" + token.value + \"' was not expected\";\n };\n\n /**\n * calculates the result from mathematical tree\n * @param {object} the ree/sub tree token node\n * @return {Number} the result of the calculation\n */\n calculate = function (node) {\n var left,\n right,\n operator,\n result;\n\n if (node === null) return;\n if (node.type === tokenType.id) {\n throw 'variables are not supported at this point';\n }\n \n if (node.type === tokenType.num) {\n return parseFloat(node.value);\n }\n\n left = node.left.type === tokenType.num\n ? parseFloat(node.left.value)\n : calculate(node.left);\n\n right = node.right.type === tokenType.num\n ? parseFloat(node.right.value)\n : calculate(node.right);\n\n if (node.type !== tokenType.op) {\n throw 'an operator was expected';\n }\n\n result = mathOperations[node.value](left, right);\n return result; \n }\n\n return {\n parse: parse,\n calculate: calculate\n };\n }", "function extractTextFromMFSParseTree(node) {\n var visitMap = {},\n currSuperscript = 0, maxSuperscript = 0,\n currSubscript = 0, maxSubscript = 0,\n renderText = \"\";\n\n function visit(node) {\n var fn;\n fn = visitMap[node.type];\n if (fn)\n fn(node);\n }\n \n visitMap.horizontal = function(node) {\n for (var ix = 0; ix < node.value.length; ++ix) {\n visit(node.value[ix]);\n }\n }; \n visitMap.style = function(node) {\n for (var ix = 0; ix < node.value.length; ix += 1) {\n if (!node.value[ix].code && node.value[ix].type) {\n visit(node.value[ix]);\n }\n }\n };\n visitMap.sub = function(node) {\n if( maxSubscript < ++currSubscript)\n maxSubscript = currSubscript;\n visit(node.value[0]);\n visit(node.value[1]);\n --currSubscript;\n };\n visitMap['super'] = function(node) {\n if( maxSuperscript < ++currSuperscript)\n maxSuperscript = currSuperscript;\n visit(node.value[0]);\n visit(node.value[1]);\n --currSuperscript;\n };\n visitMap.text = function(node) {\n renderText += getNodeText(node);\n };\n // symbol nodes can be rendered like text nodes\n visitMap.symbol = visitMap.text;\n \n visit(node);\n \n // return the parameters of the text\n return {\n maxSubscript: maxSubscript,\n maxSuperscript: maxSuperscript,\n text: renderText\n };\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "parse(tree, depth) {\n if (Array.isArray(tree)) {\n return tree.map(node => this.parse(node, depth + 1)).join('');\n\n } else if(isProperty(tree)) {\n return this.addComment(tree, depth) + this.parseProperty(tree, depth);\n\n } else if (isExprStatement(tree)) {\n return this.parseExpression(tree);\n\n } else if (isVarDeclarator(tree)) {\n if (isCallableExpr(tree) || isArrowFunctionExpr(tree)) {\n return this.parseExpression(tree, true);\n }\n return tree.init.properties.map(node => this.parse(node, depth + 1)).join('');\n\n } else if (isVarDeclaration(tree)) {\n return tree.declarations.map(n => this.parse(n, depth - 1)).join('');\n\n } else if (isLabelStatement(tree) || isBlockStatement(tree)) {\n throw new Error('Grid options should be wrapped inside: const gridOptions = { ... }');\n\n } else {\n throw new Error(`Unexpected node encountered:\\n\\n${JSON.stringify(tree)}`);\n }\n }", "function combine(peg_parser, tree_obj){\n\t\tvar child_funcs = [];\n\t\tfor (var i = 0; i < tree_obj.term.length; i++){\n\t\t\tchild_funcs.push(term(peg_parser, tree_obj.term[i]));\n\t\t}\n\t\treturn peg_parser.and.apply(peg_parser, child_funcs);\n\t}", "parse() {\n // We expect at least one tree selector\n var ts = this.parseTreeSelector(); // Now see what's next\n\n var token = this.nextToken(); // If there is no next token then we're done parsing and can return\n // the tree selector object we got above\n\n if (!token) {\n return ts;\n } // Otherwise, there is more go come and we're going to need a\n // list of tree selectors\n\n\n var treeSelectors = [ts];\n\n while (token) {\n // The only character we allow after a tree selector is a comma\n if (token === \",\") {\n this.consume();\n } else {\n throw new ParseError$2(\"Expected comma\");\n } // And if we saw a comma, then it must be followed by another\n // tree selector\n\n\n treeSelectors.push(this.parseTreeSelector());\n token = this.nextToken();\n } // If we parsed more than one tree selector, return them in a\n // SelectorList object.\n\n\n return new SelectorList(treeSelectors);\n }", "function Parse(text) {\n\tvar x = ParseShunting( Tokens(text) );\n\tfor (var i = 0; i < x.length; i++) {\n\t\tvar t = x[i];\n\t\tif (getPrecedence(t)) {\n\t\t\tvar a = getArity(t) || 2;\n\t\t\tif (i - a < 0) {\n\t\t\t\tthrow \"Could not parse near '\" + t + \"'; expected more\";\n\t\t\t}\n\t\t\tvar before = x.slice(0, i - a);\n\t\t\tvar args = x.slice(i - a, i);\n\t\t\tvar after = x.slice(i + 1);\n\t\t\tif (a === 1) {\n\t\t\t\tvar obj = new Un(t, args[0]);\n\t\t\t} else if (a === 2) {\n\t\t\t\tvar obj = new Bin(t, args[0], args[1]);\n\t\t\t} else {\n\t\t\t\tthrow \"invalid arity\";\n\t\t\t}\n\t\t\tx = before.concat([obj]).concat(after);\n\t\t\ti -= a;\n\t\t} else {\n\t\t\tif (t[0] == \"@\") { // Bare strings. Useful for patterns in `Match`\n\t\t\t\tx[i] = t.substr(1);\n\t\t\t} else {\n\t\t\t\tx[i] = new Atom(t);\n\t\t\t}\n\t\t}\n\t}\n\tif (x.length != 1) {\n\t\tthrow \"Could not parse near '\" + x[1] + \"'\";\n\t}\n\treturn x[0];\n}", "function testTripleParser() \n{\n\t// equiv. turtle expression - :a :b :c ; :d :e , :f\n\tvar expression1 = [ ':a', [ ':b', ':c', ':d', [ ':e', ':f' ] ] ];\n\tvar result1 = JSON.stringify( parse( expression1 ) );\n\tequal( \"test1\", result1, '[[\":a\",\":b\",\":c\"],[\":a\",\":d\",\":e\"],[\":a\",\":d\",\":f\"]]' );\n\t\n\t// equiv. turtle expression - :a :b , :c , :d , :e , :f\n\tvar expression2 = [ ':a', ':b', [ ':c', ':d', ':e', ':f' ] ];\t\t\n\tvar result2 = JSON.stringify( parse( expression2 ) );\n\tequal( \"test2\", result2, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":b\",\":e\"],[\":a\",\":b\",\":f\"]]' );\n\t\n\t// not valid turtle expression, but parses anyway, \n\t// TODO: should we make this should throw an exception?\n\tvar expression3 = [ ':a', [ ':b', [ ':c', ':d', ':e', ':f' ] ] ];\t\t\n\tvar result3 = JSON.stringify( parse( expression3 ) );\n\tequal( \"test3\", result3, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":b\",\":e\"],[\":a\",\":b\",\":f\"]]' );\n\t\n\t// should throw exception 'too many levels'\n\tvar expression4 = [ ':a', [ ':b', [ ':c', [ ':d', ':e', ':f' ] ] ] ];\t\t\n\tvar result4;\n\ttry {\n\t\tresult4 = parse( expression4 );\n\t}\n\tcatch( e ) {\n\t\tresult4 = e;\n\t}\n\tequal( \"test4\", result4, 'parse error - invalid nested array' );\n\t\n\t// equiv. turtle expression - :a :b :c , :d ; :e :f , :g .\n\tvar expression5 = [ ':a', [ ':b', [ ':c', ':d' ] ], ':e', [ ':f', ':g' ] ]; \n\tvar result5 = JSON.stringify( parse( expression5 ) );\n\tequal( \"test5\", result5, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":e\",\":f\"],[\":a\",\":e\",\":g\"]]' );\n\t\n}", "function Term(hiragana, kanji, definition) {\n this.hiragana_ = hiragana;\n this.kanji_ = kanji;\n this.definition_ = definition;\n}", "function parse(words){\n\n\n\n}", "function parserCaller(molvi, stick) {\n\n var molV = molvi;\n var rootAdd = true;\n\n function parser(term) {\n var stack = term.content, current, termout = {}, iLeftAbs = 0, iRightAbs = 0, iMiddleAbs = 0;\n var rootAddCurrent;\n rootAddCurrent = rootAdd;\n current = stack[term.left];\n \n while (current !== op.eof) {\n if (isVar(current)) {\n iRightAbs = term.right + term.absolute;\n molV += \"FRIN \" + current + \" \" + iRightAbs + \"^\";\n term.right += 1;\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.bof || current == op.eof) {\n term.right += 1;\n term.left= term.right;\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.lparen) {\n term.middle = term.right;\n termout.left = 0;\n termout.middle = 0;\n termout.right = 0; \n termout.absolute = term.right + term.absolute;\n termout.content = [op.bof];\n term.right +=1;\n var parens = 1;\n while (parens > 0) {\n if (stack[term.right] == op.lparen) {\n parens +=1;\n } else if (stack[term.right] == op.rparen) {\n parens = parens - 1;\n }\n if (parens > 0) {\n termout.content.push(stack[term.right]);\n }\n term.right +=1;\n }\n termout.content.push(op.eof);\n parser(termout);\n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.lambda) { \n term.middle = term.right + 1;\n var next = stack[term.middle];\n iMiddleAbs = term.middle + term.absolute;\n if (isVar(next)) {\n molV += \"FROUT \" + next + \" \" + iMiddleAbs + \"^\";\n term.left = term.middle + 1;\n if (stack[term.left] == op.dot) {\n iLeftAbs = term.left + term.absolute;\n iRightAbs = term.right + term.absolute;\n molV += \"L \" + iLeftAbs + \" \" + iMiddleAbs + \" \" + iRightAbs + \"^\";\n term.left = term.left - 2;\n term.right = term.right + 2;\n termout.left = 0;\n termout.middle = 0;\n termout.right = 0; \n termout.absolute = term.right + term.absolute;\n termout.content = [op.bof];\n term.right +=1;\n while (stack[term.right] !== op.eof) {\n termout.content.push(stack[term.right]);\n term.right +=1;\n }\n termout.content.push(op.eof);\n parser(termout);\n term.middle = term.right;\n current = stack[term.right];\n } else {\n errorsline = \"Not a variable in lambda: \\\"\\\\\" + next + \" \" + stack[term.middle] + stack[term.left] + \"\\\"\";\n document.getElementById(\"errors\").innerHTML += errorsline;\n throw \"Not a variable in lambda: \\\"\\\\\" + next + \" \" + stack[term.middle] + stack[term.left] + \"\\\"\";\n } \n } else {\n errorsline = \"Not a variable in lambda: \\\"\\\\\" + stack[term.middle] + \"\\\"\";\n document.getElementById(\"errors\").innerHTML += errorsline;\n throw \"Not a variable in lambda: \\\"\\\\\" + stack[term.middle] + \"\\\"\";\n }\n } else if (current == op.app) {\n term.middle = term.right;\n iLeftAbs = term.left+ term.absolute;\n term.middle +=1;\n if (stack[term.middle] == op.lambda) {\n var itempo = term.right + term.absolute;\n if (rootAdd) {\n molV += \"Arrow\" + \" \" + itempo + \" \" + term.absolute + \"^\";} \n rootAddCurrent = false;\n } \n iMiddleAbs = term.middle + term.absolute;\n iRightAbs = term.right + term.absolute;\n molV += \"A \" + iLeftAbs + \" \" + iMiddleAbs + \" \" + iRightAbs + \"^\";\n term.left = term.right;\n term.right = term.middle; \n term.middle = term.right;\n current = stack[term.right];\n } else if (current == op.eof) {\n iRightAbs = term.right + term.absolute;\n molV += \"Arrow\" + iRightAbs + \" \" + term.absolute + \"^\";\n current = stack[term.right];\n }\n }\n iLeftAbs = term.left + term.absolute;\n if (rootAddCurrent) {\n molV += \"Arrow\" + \" \" + iLeftAbs + \" \" + term.absolute + \"^\";}\n }\n\n parser(stick);\n return molV;\n}", "function parse(doc) {\n var state, result = {\n types: {},\n properties: {}\n };\n\n function waitForTypesOrProperties(line) {\n if (line.match(/^ Type/)) {\n var type = parseType(line);\n result.types[type.name] = type;\n } else if (line.match(/^ Properties of|^Properties of World/)) {\n state = parseProperties;\n }\n }\n\n function parseProperties(line) {\n var property;\n\n if (line.trim().length === 0) {\n state = waitForTypesOrProperties;\n return;\n }\n\n property = parsePropertyOrOperator(line);\n result.properties[property.key] = property;\n }\n\n state = waitForTypesOrProperties;\n doc.toString().split('\\n').forEach(function(line, i) {\n try {\n state(line);\n } catch (err) {\n console.error('On line ' + (i + 1) + ': ' + err.toString());\n throw err;\n }\n });\n\n return result;\n}", "parseTopLevel() {\n const prog = [];\n while (!this.input.eof()) {\n const expr = this.parseExpression();\n this.currentNode = expr;\n if (expr) {\n prog.push(expr);\n }\n }\n\n return { type: \"prog\", prog: prog };\n }", "function parseWhere(root) {\n const operator = Object.keys(root)[0];\n\n // extract leaf binary expressions\n if (operator === 'AND') {\n const e1 = parseWhere(root[operator][0]);\n const e2 = parseWhere(root[operator][1]);\n\n // eslint-disable-next-line\n return { '$and' : [\n e1,\n e2,\n ] };\n } else if (operator === 'OR') {\n const e1 = parseWhere(root[operator][0]);\n const e2 = parseWhere(root[operator][1]);\n\n // eslint-disable-next-line\n return { '$or' : [\n e1,\n e2,\n ] };\n }\n const field = root[operator][0];\n const value = root[operator][1];\n const expr = exprMapper[operator];\n const obj = {};\n\n if (operator === 'LIKE') {\n obj[`value.${field}`] = parseLikeExpression(value);\n } else {\n obj[`value.${field}`] = { [expr]: value };\n }\n\n return obj;\n}", "function parse() {\n var self = this\n var value = String(self.file)\n var start = {line: 1, column: 1, offset: 0}\n var content = xtend(start)\n var node\n\n // Clean non-unix newlines: `\\r\\n` and `\\r` are all changed to `\\n`.\n // This should not affect positional information.\n value = value.replace(lineBreaksExpression, lineFeed)\n\n // BOM.\n if (value.charCodeAt(0) === 0xfeff) {\n value = value.slice(1)\n\n content.column++\n content.offset++\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {start: start, end: self.eof || xtend(start)}\n }\n\n if (!self.options.position) {\n removePosition(node, true)\n }\n\n return node\n}", "function parseTokens(pf, ar) {\r\n\t// What the next argument is expected to be.\r\n\tvar v, i, mode=-1, par = (pf != 'ol_');\t\r\n\tvar fnMark = (par && !ar.length ? 1 : 0);\r\n\r\n\tfor (i = 0; i < ar.length; i++) {\r\n\t\tif (mode < 0) {\r\n\t\t\t// Arg is maintext,unless its a number between pmStart and pmUpper\r\n\t\t\t// then its a command.\r\n\t\t\tif (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {\r\n\t\t\t\tfnMark = (par ? 1 : 0);\r\n\t\t\t\ti--; // backup one so that the next block can parse it\r\n\t\t\t} else {\r\n\t\t\t\tswitch(pf) {\r\n\t\t\t\t\tcase 'ol_':\r\n\t\t\t\t\t\tol_text = ar[i].toString();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\to3_text=ar[i].toString(); \r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tmode = 0;\r\n\t\t} else {\r\n\t\t\t// Note: NS4 doesn't like switch cases with vars.\r\n\t\t\tif (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }\r\n\t\t\tif (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }\r\n\t\t\tif (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }\r\n\t\t\tif (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }\r\n\t\t\tif (ar[i]==BACKGROUND) { eval(pf+'background=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }\r\n\t\t\tif (ar[i]==CAPTION) { eval(pf+\"cap='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; }\r\n\t\t\tif (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==FGCOLOR) { eval(pf+'fgcolor=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==BGCOLOR) { eval(pf+'bgcolor=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==TEXTCOLOR) { eval(pf+'textcolor=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==CAPCOLOR) { eval(pf+'capcolor=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==CLOSECOLOR) { eval(pf+'closecolor=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }\r\n\t\t\tif (ar[i]==STATUS) { eval(pf+\"status='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }\r\n\t\t\tif (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }\r\n\t\t\tif (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.\r\n\t\t\tif (ar[i]==CLOSETEXT) { eval(pf+\"close='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }\r\n\t\t\tif (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; }\r\n\t\t\tif (ar[i]==CAPICON) { eval(pf+'capicon=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==TEXTFONT) { eval(pf+\"textfont='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==CAPTIONFONT) { eval(pf+\"captionfont='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==CLOSEFONT) { eval(pf+\"closefont='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==TEXTSIZE) { eval(pf+'textsize=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==CLOSESIZE) { eval(pf+'closesize=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i]; opt_FUNCTION(v); } continue; }\r\n\t\t\tif (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }\r\n\t\t\tif (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }\r\n\t\t\tif (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }\r\n\t\t\tif (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }\r\n\t\t\tif (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }\r\n\t\t\tif (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }\r\n\t\t\tif (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; }\r\n\t\t\tif (ar[i]==CLOSETITLE) { eval(pf+\"closetitle='\"+escSglQuote(ar[++i])+\"'\"); continue; }\r\n\t\t\tif (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }\r\n\t\t\tif (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; }\r\n\t\t\tif (ar[i]==FGCLASS) { eval(pf+'fgclass=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==BGCLASS) { eval(pf+'bgclass=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\tif (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass=\"'+ar[++i]+'\"'); continue; }\r\n\t\t\ti = parseCmdLine(pf, i, ar);\r\n\t\t}\r\n\t}\r\n\r\n\tif (fnMark && o3_function) o3_text = o3_function();\r\n\t\r\n\tif ((pf == 'o3_') && o3_wrap) {\r\n\t\to3_width = 0;\r\n\t\t\r\n\t\tvar tReg=/<.*\\n*>/ig;\r\n\t\tif (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, '&nbsp;');\r\n\t\tif (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, '&nbsp;');\r\n\t}\r\n\tif ((pf == 'o3_') && o3_sticky) {\r\n\t\tif (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;\r\n\t\tif (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' ');\r\n\t}\r\n}", "function parseExprNode(node) {\n switch (node.type) {\n case \"ArrayExpression\":\n return node.elements.map(parseExprNode);\n case \"Literal\":\n return node.value;\n case \"ObjectExpression\":\n var obj = {};\n node.properties.forEach(function(prop) {\n var key = prop.key.name || prop.key.value;\n obj[key] = parseExprNode(prop.value);\n });\n return obj;\n }\n }", "function parser(template) {\n var tokens = [];\n /**\n * We iterate through each character in the template string, and track\n * the index of the character we're processing with `position`. We start\n * at 0, the first character.\n */\n var position = 0;\n /**\n * `text` is used to accumulate what we call \"UserText\", or simply text that\n * is not a subsitution. For example, in the template:\n * \n * \"The day is {day}.\"\n * \n * There are two instances of `UserText`, \"The day is \" and \".\", which is the text\n * befor eand after the subsitution. With this template our tokens would look something like:\n * \n * [\n * { type: UserText, value: \"The day is \"},\n * { type : DaySub },\n * { type: UserText, value: \".\" }\n * ]\n * \n */\n var text = '';\n while (position < template.length) {\n var char = template[position++];\n /**\n * A bracket indicates we're starting a subsitution. Any characters after this,\n * and before the next '}' will be considered part of the subsitution name.\n */\n if (char === '{') {\n // Push any `UserText` we've accumulated and reset the `text` variable.\n if (text) {\n tokens.push({\n t: UserText,\n v: text\n });\n }\n text = '';\n var sub = '';\n char = template[position++];\n while (char !== '}') {\n sub += char;\n char = template[position++];\n }\n tokens.push({\n t: SubToTypeIdentifierMap[sub]\n });\n }\n // Anything not inside brackets is just plain text.\n else {\n text += char;\n }\n }\n /**\n * We might have some text after we're done iterating through the template if\n * the template ends with some `UserText`.\n */\n if (text) {\n tokens.push({\n t: UserText,\n v: text\n });\n }\n return tokens;\n}", "function syntaxTree(state) {\n let field = state.field(Language.state, false);\n return field ? field.tree : common.Tree.empty;\n}", "constructor(value){\n this.value = value;\n this.children = {};\n this.isWord = false;\n }", "function Paren(terms) {\n\tTerm.call(this, terms);\n}", "function parseNaturalLanguage(str, firstOrder) {\n if (str[0] == '(') {\n if (str[str.length-1] == '?')\n return ['Ask', parseLispTree(str.slice(0, str.length-1))];\n return ['Tell', parseLispTree(str)];\n }\n\n str = str.toLowerCase();\n str = str.replace(/^\\s+/, '').replace(/\\s+$/, '');\n var ask = false;\n if (str[str.length-1] == '?') ask = true;\n str = str.replace(/[,\\.\\?]/g, '');\n str = str.replace(/ +/g, ' ');\n\n function canonicalizeNoun(s) {\n if (s.slice(s.length-3) == 'ies') return s.slice(0, s.length-3) + 'y';\n if (s[s.length-1] == 's') return s.slice(0, s.length-1);\n return s;\n }\n function canonicalizeVerb(s) {\n if (s[s.length-1] == 's') return s.slice(0, s.length-1);\n return s;\n }\n\n function agree(noun, verb) {\n if (noun == 'i' || noun == 'you' || noun == 'we') return noun + ' ' + verb;\n else return noun + ' ' + verb + 's';\n }\n\n function recurse(str) {\n var m;\n\n if (!firstOrder) {\n // Propositional logic\n if (m = str.match(/^did (\\w+) (\\w+)(.*)$/)) return recurse(agree(m[1], m[2]) + m[3]);\n if (m = str.match(/^does (\\w+) (\\w+)(.*)$/)) return recurse(agree(m[1], m[2]) + m[3]);\n if (m = str.match(/^is the (\\w+) (.+)$/)) return recurse('the ' + m[1] + ' is ' + m[2]);\n if (m = str.match(/^is (\\w+) (.+)$/)) return recurse(m[1] + ' is ' + m[2]);\n\n if (m = str.match(/^if (.+) then (.+)$/)) return ['implies', recurse(m[1]), recurse(m[2])];\n if (m = str.match(/^(.+) if and only if (.+)$/)) return ['bicond', recurse(m[1]), recurse(m[2])];\n if (m = str.match(/^(.+) only if (.+)$/)) return ['implies', recurse(m[1]), recurse(m[2])];\n if (m = str.match(/^(.+) if (.+)$/)) return ['implies', recurse(m[2]), recurse(m[1])];\n if (m = str.match(/^(.+) and (.+)$/)) return ['and', recurse(m[1]), recurse(m[2])];\n if (m = str.match(/^(.+) or (.+)$/)) return ['or', recurse(m[1]), recurse(m[2])];\n\n if (m = str.match(/^(.+) do not (\\w+)(.*)$/)) return ['not', recurse(agree(m[1], m[2]) + m[3])];\n if (m = str.match(/^(.+) don't (\\w+)(.*)$/)) return ['not', recurse(agree(m[1], m[2]) + m[3])];\n if (m = str.match(/^(.+) did not (\\w+)(.*)$/)) return ['not', recurse(agree(m[1], m[2]) + m[3])];\n if (m = str.match(/^(.+) didn't (\\w+)(.*)$/)) return ['not', recurse(agree(m[1], m[2]) + m[3])];\n if (m = str.match(/^(.+) does not (\\w+)(.*)$/)) return ['not', recurse(agree(m[1], m[2]) + m[3])];\n if (m = str.match(/^(.+) doesn't (\\w+)(.*)$/)) return ['not', recurse(agree(m[1], m[2]) + m[3])];\n\n if (m = str.match(/^(.+) not (.+)$/)) return ['not', recurse(m[1] + ' ' + m[2])];\n return str.replace(/ /g, '-');\n } else {\n // First-order logic (only support Horn)\n if (m = str.match(/^(\\w+) is an? (\\w+)$/)) return [m[2], m[1]]; // John is a student\n if (m = str.match(/^(\\w+) is (\\w+)$/)) return [m[2], m[1]]; // John is happy\n if (m = str.match(/^(\\w+) is (\\w+)'s (\\w+)$/)) return [m[3], m[2], m[1]]; // John is Tom's father\n if (m = str.match(/^(\\w+) (\\w+) (\\w+)$/)) return [canonicalizeVerb(m[2]), m[1], m[3]]; // John likes Mary\n if (m = str.match(/^all (\\w+) are (\\w+)/)) return [m[2], canonicalizeNoun(m[1])]; // all people are tall\n if (m = str.match(/^all (\\w+) (\\w+)/)) return [m[2], canonicalizeNoun(m[1])]; // all birds fly\n if (m = str.match(/^all (\\w+) (\\w+) (\\w+)/)) return [m[2], canonicalizeNoun(m[1])]; // all birds fly\n }\n\n return null;\n }\n\n var result = recurse(str);\n if (!result) {\n sfig.L(str);\n return ['Error', 'Sorry, I don\\'t understand.'];\n }\n return [ask ? 'Ask' : 'Tell', result];\n}", "function GenTokenParser(){}", "function f_three(str) {\n return ntrprt(parse(str))\n\n function ntrprt(program, stack, dict) {\n stack = stack || []\n \n if(!dict) { \n dict = {}\n dict['dup'] = function(stack) {stack.push(stack[stack.length-1]); return stack}\n dict['drop'] = function(stack) {stack.pop(); return stack}\n dict['swap'] = function(stack) {stack.push(stack.pop(), stack.pop()); return stack}\n\n var ops = ['+', '*', '-', '/', '%', '^', '|', '&', '||', '&&', '<', '>', '<<', '>>', '==']\n ops.forEach(function(op) {\n dict[op] = function(stack) {\n var top=stack.pop(); stack.push(eval(stack.pop() + op + top)); return stack } })\n }\n \n function addword(dict, program, pc) {\n var stop = program.indexOf(';', pc)\n var name = program[pc+1]\n var sub = program.slice(pc+2, stop)\n dict[name] = function(stack) {return ntrprt(sub, stack, dict)}\n pc = stop\n return [dict, program, pc]\n }\n \n var pc = 0, max = program.length\n while(pc < max) {\n var word = program[pc]\n if(word == ':') {\n out = addword(dict, program, pc) // use ES6 destructuring\n dict = out[0]\n program = out[1]\n pc = out[2]\n }\n else if(+word == word) \n stack.push(word) // numbers go on the stack\n else \n stack = dict[word](stack) // funs can be any arity\n pc++\n }\n return stack\n }\n\n function parse(str) {\n return str.split(/\\s+/)\n }\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}", "function PredictiveParsing(text, M) {\n let cursor = 0,\n root = {'rule': 'Expr', 'production': []},\n // a node and its rule name are kept in alternating sequence inside stack\n // in order to construct a concrete syntax tree\n // source: https://stackoverflow.com/a/27206881/1374078\n stack = ['$', root, 'Expr'];\n\n text += '$';\n\n while(topOf(stack) !== '$') {\n if(topOf(stack) === text[cursor]) {\n let value = stack.pop();\n let node = stack.pop();\n cursor += 1;\n while(cursor < text.length && isDigit(node.rule) && isDigit(text[cursor])) {\n value += text[cursor];\n cursor += 1;\n }\n node.production.push(value);\n } else {\n let production = [].concat(M[topOf(stack)][text[cursor]]);\n let node_name = stack.pop();\n let node = stack.pop();\n\n production.forEach(term => {\n node.production.push({'rule': term, 'production': []});\n });\n\n if(production[0] !== 'Epsilon') {\n node.production.slice().reverse().forEach(node => {\n stack.push(node);\n stack.push(node.rule);\n });\n }\n }\n }\n\n return root;\n}", "function wordTrie (p) {\n if (typeof p === 'string') {\n this.addPhrase(p);\n } else if ( Object.prototype.toString.call(p) === '[object Array]' ) {\n this.addPhraseByArray(p, 0);\n }\n}", "function parseLatex(latex){\n console.log(\"Parse Latex\");\n //semantic prototype: [\"value\",\"type\",\"discription for user\"]\n var semantic = [];\n var i = 0;\n while(i<latex.length){\n if(latex.charAt(i)==\"\\\\\"){\n console.log(\" found a slash, reading word\");\n\n i++;\n //brian's way of getting the function name breaks the script if it finds no matches\n //consider going back to the way we were doing things before,\n //or possibly matching across a widening substring\n //couls also use the left right optimizations\n //\n //could go foreward with removing any instances of \\left and \\right as a preperation move on the string which would fix these proplems\n //provided i include \\{ and \\} as parentheses\n\n var curWord = \"\";\n if(latex.substring(i).match(/^left[\\(\\[\\|]|^left\\\\\\{|^right\\\\\\}|^right[\\)\\]\\|]|^[a-zA-Z]+/g)){\n curWord = latex.substring(i).match(/^left[\\(\\[\\|]|^left\\\\\\{|^right\\\\\\}|^right[\\)\\]\\|]|^[a-zA-Z]+/g)[0];\n console.log(\"word length: \"+curWord.length);\n i += curWord.length;\n }\n\n var instruct = matchWord(curWord);\n if(instruct.length == 0){\n semantic.push([curWord,\"func\",\"unknown func: \"+curWord]);\n errors.push(\"Invalid or Unknown Syntax: \"+curWord+\".\");\n console.log(\" Invalid or Unknown Syntax: \"+curWord);\n }\n else{\n console.log(\" Function Word Instruct: \"+curWord);\n switch(instruct[0][2]){\n case-1: //the future case\n //for functions we plan on supporting in the future\n console.error(\" unknown parse type:\"+instruct[0][1]+\" for word: \"+instruct[0][0]);\n if(instruct[0][0].length !== 0) errors.push(\"Fastfig doesn't solve \"+instruct[0][0]+\" yet.\");\n break;\n\n case 0: //no op\n //just pushes the info from the table through\n semantic.push([instruct[0][1],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n console.log(\" pushed a symbol\");\n break;\n\n case 1: //delimiters\n //you detected a delimiter, now go back and let matchParen handle it\n //should probably include some stuff that lets matchParen determine the paren in the event it's not specified\n //lol wut\n //that wouldn't accomplish anything because you would need a way of making up the corresponding close paren\n //plus it probably wouldn't parse right anyway\n i-=(instruct[0][0].length+1);\n var inner = matchParen(latex.substring(i),\"\\\\\"+instruct[0][0])\n semantic.push([inner[0],instruct[0][3],instruct[0][2]+instruct[0][0]]);\n i+=inner[1];\n break;\n\n case 2: //functions\n //for things that need to be followed by parentheses\n var inner = matchParen(latex.substring(i),\"\\\\left(\");\n semantic.push([instruct[0][1]+inner[0],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n i+=inner[1];\n break;\n\n case 3: //curly functions\n //for things that in latex are followed by sets of curly braces containing the values\n var inner = curlyFunc(curWord, latex.substring(i),instruct[0][4],instruct[0][1]);\n semantic.push([inner[0],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n i+=inner[1];\n break;\n\n case 4: //bounded functions\n //for functions with upper and lower bounds\n //usually a function name followed by either ^{} or _{}\n var inner = boundedFunc(latex.substring(i),instruct[0][1]);\n semantic.push([inner[0],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n i+=inner[1];\n break;\n\n case 5: //summation functions\n var inner = sumFunc(latex.substring(i),instruct[0][1]);\n semantic.push([inner[0],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n i+=inner[1];\n break;\n\n case 6: //square and nth root\n //for the special root function which is the only thing with optional arguments like this\n //yaaaaay for conventions!\n var pattern = instruct[0][1];\n var power = 2;\n if(latex.charAt(i) == \"[\"){\n console.log(\" apparently it's nthroot\");\n inner = matchParen(latex.substring(i, latex.length),\"[\",1);\n console.log(\"power: \"+inner[0]);\n i+= inner[1];\n pattern = \"((\\\\0)^(1/\\\\1))\";\n power = inner[0];\n }\n inner = curlyFunc(curWord, latex.substring(i),instruct[0][4],pattern,power);\n semantic.push([inner[0],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n i+=inner[1];\n break;\n\n case 7: //trigonometric functions\n //they've been broken out here to handle one of the stranger notations(by my reckoning)\n //with trigonometric functions you are allowed to do this: sin^2(x)^5\n //which is equivalent to this: sin(x)^((2)*(5))\n //which resolves to this: sin(x)^(10)\n //\n //however they should never have subscripts(as far as i can tell)\n //\n //i don't think this applies to most other functions\n //yaaaaay for conventions!\n var sageCode = instruct[0][1];\n if(latex.charAt(i) == \"^\"){\n console.log(\" apparently this trig function has a power\");\n i++;\n\n //get the power on the function\n var leftPow;\n if(latex.charAt(i) == \"{\"){\n inner = matchParen(latex.substring(i),\"{\",1);\n i+=inner[1];\n leftPow = inner[0];\n }\n else{\n leftPow = latex.charAt(i);\n i++;\n }\n console.log(\" function power: \"+leftPow);\n\n //get the parentheses contents\n inner = matchParen(latex.substring(i),\"\\\\left(\");\n i+= inner[1];\n\n //check if the power is -1 to make it inverse\n if(leftPow == -1){\n if(instruct[0][0].substring(0,3) == 'arc') sageCode = instruct[0][0].substring(3)+inner[0];\n else sageCode = 'arc'+instruct[0][0]+inner[0];\n }\n else{\n sageCode += inner[0]+\"^((\"+leftPow+\")\";\n\n //check if there's a power on the right\n if(latex.charAt(i) == \"^\"){\n i++;\n var rightPow;\n if(latex.charAt(i) == \"{\"){\n inner = matchParen(latex.substring(i),\"{\",1);\n i+=inner[1];\n rightPow = inner[0];\n }\n else{\n rightPow = latex.charAt(i);\n i++;\n }\n console.log(\" right power: \"+rightPow);\n sageCode += \"*(\"+rightPow+\")\";\n }\n sageCode+=\")\";\n }\n }\n else{\n inner = matchParen(latex.substring(i),\"\\\\left(\");\n i+=inner[1];\n sageCode += inner[0];\n }\n semantic.push([sageCode,instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n\n case 8: //log functions\n //log functions can have subscripts but usually have default values\n //\n //i'm pretty sure they don't have superscripts tho\n //\n //yaaaaay for conventions!\n var List = [];\n for(var j=4,len=instruct[0].length;j<len;j++)List[j-4]=instruct[0][j];\n var bounds = getBounds(latex.substring(i),1);\n i+= bounds[2];\n if(bounds[0].length>0)List[1]=bounds[0];\n if(bounds[1].length>0)List[0]=bounds[1];\n inner = matchParen(latex.substring(i),\"\\\\left(\",1);\n i+=inner[1];\n List[2] = inner[0];\n semantic.push([parsePattern(instruct[0][1],List),instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n\n case 9: //limit functions\n //i'm pretty sure limits shouldn't have superscripts\n var List = [];\n var bounds = getBounds(latex.substring(i),1);\n i+= bounds[2];\n var lower = bounds[1];\n if(lower.indexOf(\"rar\")!=-1){\n console.log(\" found the right arrow\");\n List[0] = lower.substring(0,lower.indexOf(\"rar\"));\n if(lower.substring(lower.length-1).match(/^\\+$|^\\-$/)){\n List[1] = lower.substring(lower.indexOf(\"rar\")+3,lower.length-1);\n List[2] = \", dir====\\'\"+lower.substring(lower.length-1)+\"\\'\";\n }\n else{\n console.log(\"didn't find a direction for the limit. omitting...\");\n List[1] = lower.substring(lower.indexOf(\"rar\")+3);\n List[2] = \"\";\n }\n }\n if(bounds[0] != \"\"){\n console.log(\"getBounds returned: \"+bounds[1]+\"as the upper limit\");\n console.error(\"limits shouldn't have superscripts. ignoring\");\n //warnings.push(\"Limits shouldn't have superscripts. (Ignored)\");\n }\n inner = matchParen(latex.substring(i),\"\\\\left(\",1);\n i+=inner[1];\n List[3] = inner[0];\n semantic.push([parsePattern(instruct[0][1],List),instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n\n case 10: //removal\n //simply doesn't push anything onto the semantic array\n console.log(\"found a \"+instruct[0][0]+\" in need of removal\");\n break;\n\n case 11: //d/dx\n //checks to see if the first char is a d or \\partial\n //if it's d checks to see if the remainder or the whole string are in the var list\n var out = \"\";\n for(var l=0;l<semantic.length;l++)out+=semantic[l][0];\n console.log(\"semantic: \"+out);\n\n var fracs = curlyFunc(curWord, latex.substring(i), instruct[0][4]);\n var upper = fracs[0][0], lower=fracs[0][1];\n if(upper == '') errors.push('Empty Numnerator');\n if(lower == '') errors.push('Empty Denominator');\n var list = [];\n i+=fracs[1];\n var derU = derCheck(upper),derL = derCheck(lower);\n list[0]=derU[1];\n list[1]=derL[1];\n if(derL[0][0] == 0 && derU[0][0] == 0){\n console.log(\"just a regular fraction\");\n semantic.push([parsePattern(instruct[0][1],list),instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n }\n for(var l=0;l<semantic.length;l++)out+=semantic[l][0];\n console.log(\"semantic: \"+out);\n\n console.log(\"upper: \"+derU[0][0]+\" lower: \"+derL[0][0]);\n if(derL[0][0] == 1 && derU[0][0] == 1){\n console.log(\"d in both top and bottom\");\n if(derL[0][1] == 1){\n console.log(\"lower has a variable\");\n if(derU[0][1] == 1){\n console.log(\"vars in both top and bottom\");\n //should check to see if lower var appears in upper var?\n semantic.push([parsePattern(\"derivative(\\\\0,\\\\1)\",list),\"func\",\"dy/dx derivative\"]);\n break;\n }\n else{\n console.log(\"var only in bottom\");\n var inner = parseLatex(latex.substring(i));\n i=latex.length;\n list[0] = inner;\n semantic.push([parsePattern(\"derivative(\\\\0,\\\\1)\",list),\"func\",\"d/dx derivative\"]);\n break;\n }\n }\n else if(derU[0][1] == 1){\n console.error(\"derivative variable is missing in bottom of fraction\");\n errors.push(\"Differentiation variable is missing in bottom of fraction.\");\n list[0]=fracs[0][0];\n list[1]=fracs[0][1];\n semantic.push([parsePattern(instruct[0][1],list),instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n }\n //d on the top and the bottom but nothing else\n console.log(\"nothin but the d\");\n list[0]=fracs[0][0];\n list[1]=fracs[0][1];\n semantic.push([parsePattern(instruct[0][1],list),instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n }\n //no or only one derivative\n console.log(\"no or only one derivative found\");\n list[0]=fracs[0][0];\n list[1]=fracs[0][1];\n semantic.push([parsePattern(instruct[0][1],list),instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n\n default: //the default case\n //shouldn't be needed or called but in the interest of stability\n //just pushes the info from the table through\n console.error(\" unknown parse type:\"+instruct[0][1]+\" for word: \"+instruct[0][0]);\n //warnings.push(\"Unknown parse type:\"+instruct[0][1]+\" for word: \"+instruct[0][0]+\".\");\n semantic.push([instruct[0][1],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n break;\n }\n }\n }\n else if(latex.charAt(i).match(/[a-zA-Z]/)){\n curWord = \"\";\n console.log(\" Found potential variable \");\n while(latex.charAt(i).match(/[a-zA-Z]/)){\n curWord += latex.charAt(i);\n i++;\n console.log(\" current letter: \"+latex.charAt(i-1)+\" current word: \"+curWord);\n }\n console.log(\" pushing variable: \"+curWord)\n semantic.push([curWord,\"var\",\"variable \"+curWord]);\n }\n // /^\\d+\\.?\\d*$|^\\.\\d+$/ makes for a great regex for this\n // /^\\d+$|^\\.\\d+$|^\\d+\\.\\d+$|^\\d+\\.$/ works too but is a little unwieldly\n // /^[0-9\\.][0-9]*|[0-9]+\\.[0-9]*$/ brian's regex\n // /^[0-9\\.][0-9]*$|^[0-9]+\\.[0-9]*$/ needed a little fix\n else if(latex.charAt(i).match(/^\\d$|^\\.$/)){\n curWord = \"\";\n\n //FIX AND PUT BACK\n /*\n var j=i;\n console.log(\" Found a number: \"+latex.charAt(i))\n\n //this is the method using brian's regex\n //i have to test if its faster than my method\n //or just more compact\n i++;\n console.log(\"i:\"+i+\" latex.length:\"+latex.length);\n while(latex.substring(j,i).match(/^\\d+\\.?\\d*|$^\\.\\d+$/)){\n console.log(latex.substring(j,i));\n i++;\n if(i >= latex.length-1)break;\n }\n curWord = latex.substring(j,i);\n while(curWord.length >1 && curWord.charAt(0)==\"0\" && curWord.charAt(1) != \".\"){\n curWord = curWord.substring(1);\n errors.push(\"Numbers should never have leading zeros. They've been removed... this time.\");\n console.error(\"Numbers should never have leading zeros. They've been removed... this time.\");\n }\n\n */\n //this is a really stupid way of doing this but i'm tired\n //just write a regex that matches exactly one period\n //match the current word + char at i\n //if it matches then go ahead and add it to the word and increment\n //otherwise break out and enter the next loop\n //\n\n var dotCount = 0;\n while(latex.charAt(i).match(/^\\d$|^\\.$/)){\n if(latex.charAt(i) == \".\"){\n if(dotCount <1){\n dotCount++;\n curWord += \".\";\n i++;\n console.log(\"current digit: . current number: \"+curWord);\n }\n else break;\n }\n else if(latex.charAt(i).match(/^\\d$/)){\n curWord += latex.charAt(i);\n console.log(\"current digit: \"+latex.charAt(i)+\" current number: \"+curWord);\n i++;\n }\n }\n while(curWord.length >1 && curWord.charAt(0)==\"0\" && curWord.charAt(1) != \".\"){\n curWord = curWord.substring(1);\n //warnings.push(\"Numbers shouldn't have leading zeros. They've been removed... this time.\");\n console.error(\"Numbers should never have leading zeros. They've been removed... this time.\");\n }\n console.log(\" pushing whole number: \"+curWord);\n semantic.push([curWord,\"num\",\"number \"+curWord]);\n }\n /*\n *for if theres a blank space\n *happens when variables follow latex words\n *should be eliminated by the semantic parser\n *this code is meaningless\n *\n *REMOVE\n *\n */\n else if(latex.charAt(i)== \" \"){\n if(latex.length == 1){\n console.log(\"empty field\");\n //warnings.push(\"Empty field.\");\n }\n i++;\n }\n else{\n //single character switch goes here\n console.log(\" Single Char instruct: \"+latex.charAt(i));\n var instruct = charMatch(latex.charAt(i));\n switch(instruct[1]){\n case 0://regular character\n console.log(\" Standard char\");\n semantic.push([instruct[0],instruct[2],instruct[2]+instruct[0]]);\n i++;\n break;\n case 1://a delimiter\n console.log(\" Delimiter\");\n var inner = matchParen(latex.substring(i, latex.length),instruct[0]);\n semantic.push([inner[0],instruct[2],instruct[2]+instruct[0]]);\n i+= (inner[1]);\n break;\n case 2:\n console.log(\" Function char\");\n i++;\n if(latex.charAt(i) == \"{\"){\n var inner = matchParen(latex.substring(i, latex.length),\"{\",1);\n semantic.push([instruct[0]+\"(\"+inner[0]+\")\",instruct[2],instruct[2]+instruct[0]]);\n i+=inner[1];\n break;\n }\n else{\n semantic.push([instruct[0]+\"(\"+parseLatex(latex.charAt(i))+\")\",instruct[2],instruct[2]+instruct[0]]);\n i++;\n break;\n }\n break;\n case 3:\n console.log(instruct[2]+\" function char\");\n i++;\n if(latex.charAt(i) == \"{\"){\n var inner = matchParen(latex.substring(i, latex.length),\"{\",1);\n semantic.push([instruct[0]+inner[0],instruct[2],instruct[2]+instruct[0]]);\n i+=inner[1];\n break;\n }\n else{\n semantic.push([instruct[0]+parseLatex(latex.charAt(i)),instruct[2],instruct[2]+instruct[0]]);\n i++;\n break;\n }\n break;\n default:\n //the default case\n //shouldn't be needed or called but in the interest of stability\n //just pushes the info from the table through\n errors.push(\"Unknown charactor type: '\"+instruct[0][0]+\"'.\");\n semantic.push([instruct[0][1],instruct[0][3],instruct[0][3]+instruct[0][0]]);\n i++;\n break;\n }\n //this isn't nesseceary anymore since it's handled properly by each portion of the program\n //i++;\n }\n }\n var sageCode = \"\";\n if(semantic.length >1)semantic = parseSemantic(semantic);\n for(var i=0, len = semantic.length;i<len;i++){\n //if there is a var push it into the var list\n\n //MOVE THIS CODE INTO PARSE SEMANTIC ANYWAY DUHH\n //its going to be used there for lookups and setting the equivalence and if its in the table there anyway.\n if(semantic[i][1] == \"var\"){\n console.log(\"checking if \"+semantic[i][0]+\" is in the variable list\");\n //check if the var exists already in the varlist\n if(varList.length == 0){\n console.log(\"adding \"+semantic[i][0]+\" to the variable list\");\n varList.push(semantic[i][0]);\n }\n else{\n for(var j=0,len2=varList.length;j<len2;j++){\n console.log(varList[j]);\n if(varList[j] == semantic[i][0])break;\n if(j == varList.length-1){\n console.log(\"adding \"+semantic[i][0]+\" to the variable list\");\n varList.push([semantic[i][0],\"var\"]);\n }\n }\n }\n }\n sageCode+=semantic[i][0];\n }\n colored = semantic;\n console.log(\"finished sage code: \"+sageCode);\n console.log(\"\");\n return sageCode;\n}", "function parseNewick(txt)\n {\n var ancestors = [];\n var tree = {};\n try {\n var tokens = txt.split(/\\s*(;|\\(|\\)|,|:)\\s*/);\n for (var i=0; i<tokens.length; i++) {\n var token = tokens[i];\n switch (token) {\n case '(': // new children\n var subtree = {};\n tree.children = [subtree];\n ancestors.push(tree);\n tree = subtree;\n break;\n case ',': // another branch\n var subtree = {};\n ancestors[ancestors.length-1].children.push(subtree);\n tree = subtree;\n break;\n case ')': // optional name next\n tree = ancestors.pop();\n break;\n case ':': // optional length next\n break;\n default:\n var x = tokens[i-1];\n if (x == ')' || x == '(' || x == ',') {\n tree.name = token;\n } else if (x == ':') {\n tree.length = parseFloat(token);\n }\n }\n }\n }\n catch(err) {\n moduleData.parseError = err;\n return false;\n }\n\n return tree;\n }", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function parse() {\n var self = this;\n var value = String(self.file);\n var start = {line: 1, column: 1, offset: 0};\n var content = xtend(start);\n var node;\n\n /* Clean non-unix newlines: `\\r\\n` and `\\r` are all\n * changed to `\\n`. This should not affect positional\n * information. */\n value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE);\n\n if (value.charCodeAt(0) === 0xFEFF) {\n value = value.slice(1);\n\n content.column++;\n content.offset++;\n }\n\n node = {\n type: 'root',\n children: self.tokenizeBlock(value, content),\n position: {\n start: start,\n end: self.eof || xtend(start)\n }\n };\n\n if (!self.options.position) {\n removePosition(node, true);\n }\n\n return node;\n}", "function objectTree(obj) {\n var res;\n switch(obj.termType) {\n case 'symbol':\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', obj.uri)\n anchor.addEventListener('click', tabulator.panes.utils.openHrefInOutlineMode, true);\n anchor.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n return anchor;\n \n case 'literal':\n\n if (!obj.datatype || !obj.datatype.uri) {\n res = myDocument.createElement('div');\n res.setAttribute('style', 'white-space: pre-wrap;');\n res.textContent = obj.value;\n return res\n } else if (obj.datatype.uri == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {\n res = myDocument.createElement('div');\n res.setAttribute('class', 'embeddedXHTML');\n res.innerHTML = obj.value; // Try that @@@ beware embedded dangerous code\n return res;\n };\n return myDocument.createTextNode(obj.value); // placeholder - could be smarter, \n \n case 'bnode':\n if (obj.toNT() in doneBnodes) { // Break infinite recursion\n referencedBnodes[(obj.toNT())] = true;\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', '#'+obj.toNT().slice(2))\n anchor.setAttribute('class','bnodeRef')\n anchor.textContent = '*'+obj.toNT().slice(3);\n return anchor; \n }\n doneBnodes[obj.toNT()] = true; // Flag to prevent infinite recusruion in propertyTree\n var newTable = propertyTree(obj);\n doneBnodes[obj.toNT()] = newTable; // Track where we mentioned it first\n if (tabulator.Util.ancestor(newTable, 'TABLE') && tabulator.Util.ancestor(newTable, 'TABLE').style.backgroundColor=='white') {\n newTable.style.backgroundColor='#eee'\n } else {\n newTable.style.backgroundColor='white'\n }\n return newTable;\n \n case 'collection':\n var res = myDocument.createElement('table')\n res.setAttribute('class', 'collectionAsTables')\n for (var i=0; i<obj.elements.length; i++) {\n var tr = myDocument.createElement('tr');\n res.appendChild(tr);\n tr.appendChild(objectTree(obj.elements[i]));\n }\n return res;\n case 'formula':\n var res = tabulator.panes.dataContentPane.statementsAsTables(obj.statements, myDocument);\n res.setAttribute('class', 'nestedFormula')\n return res;\n case 'variable':\n var res = myDocument.createTextNode('?' + obj.uri);\n return res;\n \n }\n throw \"Unhandled node type: \"+obj.termType\n }", "function parse(query,options,{auto=true}={}){const next=query=>{let keys=Object.keys(query);const isQueryPath=isPath(query);if(!isQueryPath&&keys.length>1&&!isExpression(query)){return next(convertToExplicit(query));}if(isLeaf(query)){const key=isQueryPath?query[KeyType.PATH]:keys[0];const pattern=isQueryPath?query[KeyType.PATTERN]:query[key];if(!isString(pattern)){throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));}const obj={keyId:createKeyId(key),pattern};if(auto){obj.searcher=createSearcher(pattern,options);}return obj;}let node={children:[],operator:keys[0]};keys.forEach(key=>{const value=query[key];if(isArray(value)){value.forEach(item=>{node.children.push(next(item));});}});return node;};if(!isExpression(query)){query=convertToExplicit(query);}return next(query);}// Practical scoring function", "function termFromId(id, factory) {\n factory = factory || DataFactory;\n\n // Falsy value or empty string indicate the default graph\n if (!id) return factory.defaultGraph();\n\n // Identify the term type based on the first character\n switch (id[0]) {\n case '?':\n return factory.variable(id.substr(1));\n case '_':\n return factory.blankNode(id.substr(2));\n case '\"':\n // Shortcut for internal literals\n if (factory === DataFactory) return new Literal(id);\n // Literal without datatype or language\n if (id[id.length - 1] === '\"') return factory.literal(id.substr(1, id.length - 2));\n // Literal with datatype or language\n const endPos = id.lastIndexOf('\"', id.length - 1);\n return factory.literal(id.substr(1, endPos - 1), id[endPos + 1] === '@' ? id.substr(endPos + 2) : factory.namedNode(id.substr(endPos + 3)));\n case '<':\n const components = quadId.exec(id);\n return factory.quad(termFromId(unescapeQuotes(components[1]), factory), termFromId(unescapeQuotes(components[2]), factory), termFromId(unescapeQuotes(components[3]), factory), components[4] && termFromId(unescapeQuotes(components[4]), factory));\n default:\n return factory.namedNode(id);\n }\n}", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function deepParse(val) {\n if (typeof val !== 'object') return parse(val);\n if (Array.isArray(val)) return val.map(deepParse);\n return Object.keys(val).reduce(function(acc, key) {\n acc[key] = deepParse(val[key])\n return acc;\n }, {});\n}", "function parse(doc){\n\t\t\n\t\tvar sl = doc.split('\\n');\n\t\tvar objName = sl[0].split(':')[0];\n\t\t\n\t\tvar objMap = {}\n\t\t\n\t\tsl.slice(1).forEach(function(line){\n\t\t\tline = line.trim();\n\t\t\tindex = line.indexOf(\"#\");\n\t\t\tif(index!=-1){\n\t\t\t\tline = line.slice(0,index);\n\t\t\t}\n\t\t\tvar index = line.indexOf(\":\");\n\t\t\tif(index==-1){\n\t\t\t\treturn;//continue;\n\t\t\t}\n\t\t\tvar key = line.slice(0,index);\n\t\t\tvar value = line.slice(index+1);\n\t\t\tindex = value.indexOf(\" \");\n\t\t\tvar num = Number(value.slice(0,index));\n\t\t\tvar content = value.slice(index+1);\n\t\t\tcontent = content.slice(1,content.length-1); // remove quote\n\t\t\t\n\t\t\tobjMap[key] = [num,content];\n\t\t\t\n\t\t});\n\t\t\n\t\tvar res = {};\n\t\tres[objName] = objMap;\n\t\treturn res\n\t}", "function nestTokens (tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "parse() {\n // We expect at least one tree selector\n const ts = this.parseTreeSelector();\n\n // Now see what's next\n let token = this.nextToken();\n\n // If there is no next token then we're done parsing and can return\n // the tree selector object we got above\n if (!token) {\n return ts;\n }\n\n // Otherwise, there is more go come and we're going to need a\n // list of tree selectors\n const treeSelectors = [ts];\n while (token) {\n // The only character we allow after a tree selector is a comma\n if (token === \",\") {\n this.consume();\n } else {\n throw new ParseError(\"Expected comma\");\n }\n\n // And if we saw a comma, then it must be followed by another\n // tree selector\n treeSelectors.push(this.parseTreeSelector());\n token = this.nextToken();\n }\n\n // If we parsed more than one tree selector, return them in a\n // SelectorList object.\n return new SelectorList(treeSelectors);\n }", "function tokenToAction(token) {\n var word = token.value;\n var definition = context.dictionary.lookup(word);\n\n if (token.isStringLiteral) {\n return namedFunction(\"String: \" + word, function (context) {\n return word;\n });\n }\n // TODO: contributed part on StringPushLiteral s\" (TODO make PR)\n else if (token.isStringPushLiteral) {\n return namedFunction(\"PushString: \" + word, function (context) {\n context.stack.push(word);\n });\n }\n // TODO: contributed part on NeoSyscallLiteral syscall\" (TODO: do not make PR, think on something better...)\n else if (token.isNeoSyscallLiteral) {\n\n if(word == \"Neo.Learn.Call\") { // special syscall \n var execAction = context.stack.pop();\n var definedAction = context.dictionary.lookup(execAction);\n return definedAction; // TODO\n }\n else \n return namedFunction(\"NeoSyscallString: \" + word, function (context) {\n invokeNeoSyscall(word);\n /*\n if(sname == \"Neo.Learn.Execute\") // special syscall \n {\n // invoke tokenizer on read string\n // ????????? TODO\n var str = context.stack.pop();\n next(str);\n }*/\n // TODO: Neo Syscall!!\n\n });\n } \n else if (definition !== null) {\n return definition;\n } else if (isFinite(word)) {\n return namedFunction(\"Number: \" + word, function (context) {\n context.stack.push(+word);\n });\n } else {\n throw new MissingWordError(word);\n }\n\n return function () {\n return \"\";\n };\n }", "function printParsedTerms(parsedTerms, key, container, x, y) {\n\n let i;\n for (i = 0; i < parsedTerms.length; i++) {\n\n let term = parsedTerms[i];\n\n if (term[\"subscript\"]) {\n\n } else {\n\n }\n\n /*\n const temp = container.append('text')\n .attr('x', x)\n .attr('y', y + h)\n .style('font-family', '\"Open Sans\", sans-serif')\n .style('fill', color)\n .text(t);\n\n temp.append('tspan')\n .text(subscript)\n .style('font-size', 12)\n .attr('dx', 5)\n .attr('dy', 5);\n*/\n }\n}", "function nestTokens(tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, len = tokens.length; i < len; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "function parser(tokens) {\n let current = 0\n \n function walk() {\n let token = tokens[current]\n\n if(token.token === 'number') {\n current++\n\n return {\n type: 'NumberLiteral',\n value: token.value\n }\n }\n\n if(token.token === 'string') {\n current++\n\n return {\n type: 'StringLiteral',\n value: token.value\n }\n }\n\n if(token.token === 'parentheses' &&\n token.value === '(') {\n token = tokens[++current]\n\n const value = {\n type: 'CallExpression',\n name: token.value,\n params: []\n }\n\n token = tokens[++current]\n\n while(\n (token.token !== 'parentheses') ||\n (token.token === 'parentheses' && token.value !== ')')\n ) {\n value.params.push(walk())\n token = tokens[current]\n }\n\n current++\n return value\n }\n\n throw new TypeError('dont know type appear')\n }\n\n const program = {\n type: 'Program',\n body: []\n }\n\n while(current < tokens.length) {\n program.body.push(walk())\n }\n\n return program\n}", "function newer_postprocessor(\n parse_tree,\n with_morphology,\n with_spaces,\n with_terminators,\n with_trimming,\n with_selmaho,\n with_nodes_labels,\n without_leaf_prefix,\n with_glossing\n) {\n if (!is_array(parse_tree)) return null;\n /* Building a map of node names to node value replacements */\n if (with_spaces)\n var value_substitution_map = {\"spaces\": \"_\", \"initial_spaces\": \"_\"};\n else var value_substitution_map = {};\n /* Building a map of node names to name replacements */\n var name_substitution_map = {\n \"cmene\": \"C\", \"cmevla\": \"C\", \"gismu\": \"G\", \"lujvo\": \"L\",\n \"fuhivla\": \"Z\", \"prenex\": \"PRENEX\", \"sentence\": \"BRIDI\",\n \"selbri\": \"SELBRI\", \"sumti\": \"SUMTI\"\n };\n if (!with_trimming) name_substitution_map = {};\n var special_selmaho = [\"cmevla\", \"gismu\", \"lujvo\", \"fuhivla\", \"ga_clause\",\n \"gu_clause\"];\n /** Building a node_action_for() function from the selected options **/\n if (with_morphology)\n var is_flattening_target = function (tree) { return false; };\n else var is_flattening_target = function (tree) {\n var targets = special_selmaho;\n return (among(tree[0], targets) || is_selmaho(tree[0]));\n };\n var is_branch_removal_target = function (tree) {\n if (!with_spaces && among(tree[0], [\"spaces\", \"initial_spaces\"]))\n return true;\n return (!with_terminators && is_selmaho(tree[0]) && tree.length == 1);\n };\n var whitelist = [];\n if (with_selmaho)\n whitelist = whitelist.concat(special_selmaho);\n if (with_nodes_labels)\n whitelist = whitelist.concat([\"prenex\", \"sentence\", \"selbri\", \"sumti\"]);\n var is_node_trimming_target = function (tree) {\n if (!with_trimming) return false;\n if (with_terminators && is_selmaho(tree[0]) && tree.length == 1)\n return false;\n if (with_selmaho && is_selmaho(tree[0])) return false;\n return !among(tree[0], whitelist);\n };\n var node_action_for = function (node) {\n if (is_branch_removal_target(node)) return 'DEL';\n var ft = is_flattening_target(node);\n var tt = is_node_trimming_target(node);\n if (ft && tt) return \"TRIMFLAT\";\n if (ft) return 'FLAT';\n if (tt) return 'TRIM';\n if (with_trimming && node.length == 1) return 'UNBOX';\n return 'PASS';\n };\n /* Calling process_parse_tree() with the arguments we've built for it */\n return process_parse_tree(\n parse_tree, value_substitution_map, name_substitution_map,\n node_action_for,\n (with_nodes_labels || with_selmaho) && !without_leaf_prefix,\n with_glossing\n );\n}", "function processKeywords() {\n var nodes = [];\n var lastIndex;\n var keyword;\n var node;\n var submatch;\n\n if (!top.keywords) {\n return addText(modeBuffer, nodes);\n }\n\n lastIndex = 0;\n\n top.lexemesRe.lastIndex = 0;\n\n keyword = top.lexemesRe.exec(modeBuffer);\n\n while (keyword) {\n addText(modeBuffer.substr(lastIndex, keyword.index - lastIndex), nodes);\n\n submatch = keywordMatch(top, keyword);\n\n if (submatch) {\n relevance += submatch[1];\n\n node = build(submatch[0], []);\n\n nodes.push(node);\n\n addText(keyword[0], node.children);\n } else {\n addText(keyword[0], nodes);\n }\n\n lastIndex = top.lexemesRe.lastIndex;\n keyword = top.lexemesRe.exec(modeBuffer);\n }\n\n addText(modeBuffer.substr(lastIndex), nodes);\n\n return nodes;\n }", "treefy(tokenArray) {\n // Parent tree\n let tree = new Node();\n\n let index = 0;\n let depth = 0;\n let subarray = [];\n\n while (index < tokenArray.length) {\n\n let token = tokenArray[index++];\n\n if (token.type == Token.SPACE || token.type == Token.COMMENT)\n continue;\n\n // Open\n if (token.type == Token.OPEN) {\n\n depth++;\n\n if (depth == 1) {\n subarray = [];\n continue;\n }\n }\n\n // Close\n else if (token.type == Token.CLOSE) {\n\n depth--;\n\n // Depth cannot be smaller than 0\n if (depth < 0)\n return new Error(Error.SYNTAX, \"Surplus ')' exists\", token.lineNumber);\n\n if (depth == 0) {\n\n // Create sub-tree\n let subtree = this.treefy(subarray);\n\n // If error, just pass beyond (no stack push)\n if (subtree instanceof Error)\n return subtree;\n\n tree.addChild(subtree);\n continue;\n }\n }\n\n // Direct (siblings) token\n if (depth == 0) {\n tree.addChild(new Node(token));\n }\n\n // Subarray (children) token\n else if (depth > 0) {\n subarray.push(token);\n }\n }\n\n // Depth must be 0 at the termination point\n if (depth > 0)\n return new Error(Error.SYNTAX, \"'(' not closed\", tokenArray[tokenArray.length - 1].lineNumber);\n\n return tree;\n }", "function createParseTreeView (node) {\n let text = node.token.text.replace(HTMLCharsToEscape, (match) => HTMLEscapeReplacements[match]);\n let nodeInfo = `<div class=\"node-info ${node.ASType.category}\">${text}</div>`;\n let nodeChildren = `<div class=\"node-children\">${node.children.map(createParseTreeView).join(\"\")}</div>`;\n return `<div class=\"ast-node\">${nodeInfo}${nodeChildren}</div>`;\n}", "function parse(text, errors, options) {\n if (errors === void 0) { errors = []; }\n if (options === void 0) { options = ParseOptions.DEFAULT; }\n var currentProperty = null;\n var currentParent = [];\n var previousParents = [];\n function onValue(value) {\n if (Array.isArray(currentParent)) {\n currentParent.push(value);\n }\n else if (currentProperty) {\n currentParent[currentProperty] = value;\n }\n }\n var visitor = {\n onObjectBegin: function () {\n var object = {};\n onValue(object);\n previousParents.push(currentParent);\n currentParent = object;\n currentProperty = null;\n },\n onObjectProperty: function (name) {\n currentProperty = name;\n },\n onObjectEnd: function () {\n currentParent = previousParents.pop();\n },\n onArrayBegin: function () {\n var array = [];\n onValue(array);\n previousParents.push(currentParent);\n currentParent = array;\n currentProperty = null;\n },\n onArrayEnd: function () {\n currentParent = previousParents.pop();\n },\n onLiteralValue: onValue,\n onError: function (error, offset, length) {\n errors.push({ error: error, offset: offset, length: length });\n }\n };\n visit(text, visitor, options);\n return currentParent[0];\n}", "function make_node(tok) {\n var node = {};\n if (tok.id === \"(string)\") {\n node.parse = function() { return tok.value };\n }\n else {\n node = Y.Node.create(tok.template);\n if (tok.id === \"(indent)\") {\n node.setData(\"indent\", tok.value);\n }\n node.parse = tok.parse;\n node.transition = tok.transition;\n }\n return node;\n}", "function many(parser) {\n return function(input) {\n var value = {rest: input, parsed: '', ast: []};\n for(var i = 0; true; i++) {\n var result = parser(value.rest);\n if(result != false) {\n if(result.ast != null) {\n value.ast.push(result.ast);\n }\n value = {rest: result.rest,\n parsed: value.parsed + result.parsed,\n ast: value.ast};\n }\n else {\n if(value.parsed == '') {\n value = {rest: value.rest,\n parsed: '',\n ast: null};\n }\n break;\n }\n }\n return value;\n };\n}", "parseAtom() {\n return this.maybeCall(() => {\n if (this.isPunc(\"(\")) {\n this.input.next();\n const expr = this.parseExpression.apply(this);\n this.skipPunc(\")\");\n return expr;\n }\n\n if (this.isPunc(\"[\")) {\n const expr = this.parseSquareBracket();\n return expr;\n }\n\n if (this.isPunc(\";\")) return this.skipPunc(\";\");\n if (this.isPunc(\"{\")) return this.parseProg();\n if (this.isKw(\"for\")) return this.parseFor();\n if (this.isKw(\"if\")) return this.parseIf();\n if (this.isKw(\"end\")) return this.skipKw(\"end\");\n if (this.isKw(\"true\") || this.isKw(\"false\")) return this.parseBool();\n if (this.isKw(\"function\")) {\n this.input.next();\n return parseFunc();\n }\n // get the token for the current character\n const tok = this.input.next();\n\n // logger(tok);\n // return the appropriate token to the parser\n if ([\"var\", \"num\", \"str\", \"special\"].includes(tok.type)) {\n return tok;\n } else {\n // if encounter an unexpected token, throw error\n this.unexpected(tok);\n }\n });\n }", "function matchWord(curWord, table){\n\n //table for elements that combine with those arround them in a distinct way\n //[element, pattern, type after parse, relative location of elements, expected element type]\n //going to hold of on the expected type for now\n var combTable = [\n [\"!\",\"factorial(\\\\0)\",\"func\",[-1],[[\"var\",\"num\",\"func\",\"paren\"]],[0]],\n [\"\\'\",\"derivative(\\\\0(\\\\1),\\\\1,\\\\2)\",\"func\",[-1,1],[[\"var\"],[\"paren\"]],[0,1]],\n [\"int\",\"integrate\\\\2,\\\\3,\\\\0,\\\\1)\",\"func\",[1,2,3,4],[[\"sup\",\"sub\"],[\"sup\",\"sub\"],[\"paren\"],\"var\"],[0,0,1,1]],\n ]\n\n //for symbols and functions longer than one character\n //\n //parseTable = [\"LATEX after \\\",\"SAGE pattern\",switch flag,semantic val,number of vars(i'll probably get rid of this)]\n //\n //switches \n //0 - binary operators, +-/* and symbols\n //1 - parentheses\n //2 - functions that require paren following them\n //3 - functions with values in curly braces\n //4 - bounded functions\n //5 - sum function, should be replaced with bounded func\n //\n //patterns\n //variables denoted by two backslashes \\\\ and a number like \\\\2\n var funcTable = [\n //trigonometric functions\n //sine\n [\"sin\",\"sin\",7,\"func\"],\n [\"arcsin\",\"arcsin\",7,\"func\"],\n [\"sinh\",\"sinh\",7,\"func\"],\n [\"arcsinh\",\"arcsinh\",7,\"func\"],\n\n //cosine\n [\"cos\",\"cos\",7,\"func\"],\n [\"arccos\",\"arccos\",7,\"func\"],\n [\"cosh\",\"cosh\",7,\"func\"],\n [\"arccosh\",\"arccosh\",7,\"func\"],\n\n //tangent\n [\"tan\",\"tan\",7,\"func\"],\n [\"arctan\",\"arctan\",7,\"func\"],\n [\"tanh\",\"tanh\",7,\"func\"],\n [\"arctanh\",\"arctanh\",7,\"func\"],\n\n //cotangent\n [\"cot\",\"cot\",7,\"func\"],\n [\"arccot\",\"arccot\",7,\"func\"],\n [\"coth\",\"coth\",7,\"func\"],\n [\"arccoth\",\"arccoth\",7,\"func\"],\n\n //cosecant\n [\"csc\",\"csc\",7,\"func\"],\n [\"arccsc\",\"arccsc\",7,\"func\"],\n [\"csch\",\"csch\",7,\"func\"],\n [\"arccsch\",\"arccsch\",7,\"func\"],\n\n //secant\n [\"sec\",\"sec\",7,\"func\"],\n [\"arcsec\",\"arcsec\",7,\"func\"],\n [\"sech\",\"sech\",7,\"func\"],\n [\"arcsech\",\"arcsech\",7,\"func\"],\n\n //log functions\n //soon to be functions with default values\n [\"lg\",\"log(\\\\2,\\\\0)\",8,\"func\",\"10\"],\n [\"ln\",\"log(\\\\2,\\\\0)\",8,\"func\",\"e\"],\n [\"log\",\"log(\\\\2,\\\\0)\",8,\"func\",\"10\"],\n [\"lb\",\"log(\\\\2,\\\\0)\",8,\"func\",\"2\"],\n\n\n //misc functions\n //\n //greatest common denominator\n [\"gcd\",\"gcd\",2,\"func\"],\n\n //kernel. used on matricies\n [\"ker\",\"ker\",2,\"func\"],\n\n //determinant. used on matrices\n [\"det\",\"det\",2,\"func\"],\n\n //limit. gotta get this one done\n [\"lim\",\"limit(\\\\3, \\\\0====\\\\1 \\\\2)\",9,\"func\"],\n\n //argument. used in discrete\n [\"arg\",\"arg\",2,\"func\"],\n\n [\"frac\",\"((\\\\0)/(\\\\1))\",11,\"paren\",2],\n\n //square root and nth root\n [\"sqrt\",\"sqrt(\\\\0)\",6,\"func\",1],\n\n //height matched parens\n [\"left(\",\"(\",1,\"paren\"],\n [\"right)\",\"(\",1,\"paren\"],\n\n [\"left[\",\"[\",1,\"paren\"],\n [\"right]\",\"]\",1,\"paren\"],\n\n [\"left\\\\{\",\"{\",1,\"paren\"],\n [\"right\\\\}\",\"}\",1,\"paren\"],\n\n [\"left|\",\"abs(\",1,\"paren\"],\n [\"right|\",\")\",1,\"paren\"],\n\n [\"left\\\\langle\",\"<\",1,\"paren\"],\n [\"right\\\\rangle\",\">\",1,\"paren\"],\n\n [\"left\\\\lceil\",\"ceil(\",1,\"func\"],\n [\"right\\\\rciel\",\")\",1,\"func\"],\n\n [\"left\\\\lfloor\",\"floor(\",1,\"func\"],\n [\"right\\\\rfloor\",\")\",1,\"func\"],\n\n [\"left\\\\lvert\",\"|\",1,\"paren\"],\n [\"right\\\\rvert\",\"(\",1,\"paren\"],\n\n [\"left\\\\Lvert\",\"|\",1,\"paren\"],\n [\"right\\\\Rvert\",\"(\",1,\"paren\"],\n\n //binary operators\n [\"cdot\",\"*\",0,\"binOp\"],\n [\",\",\"*\",0,\"binOp\"],\n [\"ast\",\"*\",0,\"binOp\"],\n [\"star\",\"*\",0,\"binOp\"],\n [\"times\",\"*\",0,\"binOp\"],\n [\"div\",\"/\",0,\"binOp\"],\n [\"mod\",\"%\",0,\"binOp\"],\n\n //text fields\n [\"textbf\",\"\\\\0\",3,\"func\",1],\n [\"textit\",\"\\\\0\",3,\"func\",1],\n [\"text\",\"\\\\0\",3,\"var\",1],\n\n //big greek notations\n //\n //temporary integrate fix:\n [\"int\",\"integrate\",2,\"func\"],\n //[\"int\",\"integrate(\\\\0,\\\\1,\\\\2,\\\\3)\",4,\"func\"],\n //[\"int\",\"integrate(\\\\0,\\\\1,\\\\2,\\\\3)\",0,\"comb\"],\n\n [\"sum\",\"sum(\\\\3,\\\\2,\\\\1,\\\\0)\",5,\"func\"],\n [\"prod\",\"product(\\\\3,\\\\2,\\\\1,\\\\0)\",5,\"func\"],\n\n //equivalence operators\n [\"leq\",\"<=\", 0, \"equiv\"],\n [\"le\",\"<=\", 0, \"equiv\"],\n [\"geq\",\">=\", 0, \"equiv\"],\n [\"ge\",\">=\", 0, \"equiv\"],\n [\"neq\",\"!=\", 0, \"equiv\"],\n [\"ne\",\"!=\", 0, \"equiv\"],\n\n //Logic connectives\n\n //AND : the conjunction\n [\"and\",\" and \", 0, \"bool\"],\n [\"land\",\" and \", 0, \"bool\"],\n [\"wedge\",\" and \", 0, \"bool\"],\n\n //OR : the disjunction\n [\"or\",\" or \", 0, \"bool\"],\n [\"lor\",\" or \", 0, \"bool\"],\n [\"vee\",\" or \", 0, \"bool\"],\n\n //NOT : the negation\n [\"not\",\" not \", 0, \"bool\"],\n [\"lnot\",\" not \", 0, \"bool\"],\n [\"neg\",\" not \", 0, \"bool\"],\n\n //IFF : if and only if\n [\"iff\",\" iff \", 0, \"bool\"],\n [\"iff\",\" iff \", 0, \"bool\"],\n\n //XOR : exclusive or\n [\"oplus\",\"\",-1,\"binOp\"],\n\n /*THEN : if then \n [\"leftarrow\",\"lar\",,\"sym\"],\n [\"Leftarrow\",\"lar\",,\"sym\"],\n\n */\n //symbols\n [\"backslash\",\"//\", -2, \"sym\"],\n [\"infty\",\"oo\",0,\"sym\"],\n [\"partial\",\"d \",0,\"der\"],\n\n //arrows\n [\"from\",\"lar\",0,\"arr\"],\n [\"leftarrow\",\"lar\",0,\"arr\"],\n [\"Leftarrow\",\"Lar\",0,\"arr\"],\n\n [\"to\",\"rar\",0,\"arr\"],\n [\"rightarrow\",\"rar\",0,\"arr\"],\n [\"Rightarrow\",\"Rar\",0,\"arr\"],\n\n [\"mapsto\",\"map to\",0,\"arr\"],\n\n //symbols i need to find the sage equivalent of\n //i think these are just other forms of bin ops\n\n [\"ominus\",\"\",-1,\"binOp\"],\n [\"odot\",\"\",-1,\"binOp\"],\n [\"otimes\",\"\",-1,\"binOp\"],\n\n [\"oslash\",\"\",-1,\"sym\"],\n\n //these are set operators for discrete\n [\"cup\",\"\",-1,\"binOp\"],\n [\"union\",\"\",-1,\"binOp\"],\n [\"bigcup\",\"\",-1,\"binOp\"],\n\n [\"cap\",\"\",-1,\"binOp\"],\n [\"inter\",\"\",-1,\"binOp\"],\n\n [\"bigcap\",\"\",-1,\"binOp\"],\n [\"biguplus\",\"\",-1,\"binOp\"],\n\n //an upside down delta?\n [\"nabla\",\"grad\",2,\"func\"],\n\n //big function letters\n [\"coprod\",\"\",-1,\"func\"],\n [\"intO\",\"\",-1,\"func\"],\n [\"intOe\",\"\",-1,\"func\"],\n [\"intG\",\"\",-1,\"func\"],\n [\"intGh\",\"\",-1,\"func\"],\n [\"intGhe\",\"\",-1,\"func\"],\n [\"oint\",\"\",-1,\"func\"],\n [\"iint\",\"\",-1,\"func\"],\n [\"iiint\",\"\",-1,\"func\"],\n [\"idotsint\",\"\",-1,\"func\"],\n\n //common dirivative letters\n [\"dx\",\"\",-1,\"sym\"],\n [\"dy\",\"\",-1,\"sym\"],\n [\"dz\",\"\",-1,\"sym\"],\n [\"dr\",\"\",-1,\"sym\"],\n [\"dt\",\"\",-1,\"sym\"],\n [\"dO\",\"\",-1,\"sym\"],\n [\"dG\",\"\",-1,\"sym\"],\n [\"dT\",\"\",-1,\"sym\"],\n\n //delta with letters\n [\"del f\",\"\",-1,\"sym\"],\n [\"grad f\",\"\",-1,\"sym\"],\n [\"divr f\",\"\",-1,\"sym\"],\n [\"curl f\",\"\",-1,\"sym\"],\n [\"p f\",\"\",-1,\"sym\"],\n\n //greek letters\n [\"pi\",\"pi\", 0, \"sym\"],\n [\"varpi\",\"pi\", 0, \"sym\"],\n [\"alpha\",\"alpha\", 0, \"sym\"],\n [\"beta\",\"beta\", 0, \"sym\"],\n [\"chi\",\"chi\", 0, \"sym\"],\n [\"delta\",\"delta\", 0, \"sym\"],\n [\"Delta\",\"Delta\", 0, \"sym\"],\n [\"epsilon\",\"epsilon\", 0, \"sym\"],\n [\"Epsilon\",\"Epsilon\", 0, \"sym\"],\n [\"varepsilon\",\"epsilon\", 0, \"sym\"],\n [\"eta\",\"eta\", 0, \"sym\"],\n [\"gamma\",\"gamma\", 0, \"sym\"],\n [\"Gamma\",\"Gamma\", 2, \"func\"],\n [\"digamma\",\"digamma\", 0, \"sym\"],\n [\"iota\",\"iota\", 0, \"sym\"],\n [\"kappa\",\"kappa\", 0, \"sym\"],\n [\"lambda\",\"varlambda\", 0, \"sym\"],\n [\"Lambda\",\"Lambda\", 0, \"sym\"],\n [\"mu\",\"mu\", 0, \"sym\"],\n [\"nu\",\"nu\", 0, \"sym\"],\n [\"omega\",\"omega\", 0, \"sym\"],\n [\"Omega\",\"Omega\", 0, \"sym\"],\n [\"phi\",\"phi\", 0, \"sym\"],\n [\"Phi\",\"Phi\", 0, \"sym\"],\n [\"varphi\",\"phi\", 0, \"sym\"],\n [\"psi\",\"psi\", 2, \"func\"],\n [\"Psi\",\"Psi\", 0, \"sym\"],\n [\"rho\",\"rho\", 0, \"sym\"],\n [\"varrho\",\"rho\", 0, \"sym\"],\n [\"sigma\",\"sigma\", 2, \"func\"],\n [\"Sigma\",\"Sigma\", 0, \"sym\"],\n [\"tau\",\"tau\", 0, \"sym\"],\n [\"theta\",\"theta\", 0, \"sym\"],\n [\"Theta\",\"Theta\", 0, \"sym\"],\n [\"vartheta\",\"theta\", 0, \"sym\"],\n [\"upsilon\",\"upsilon\", 0, \"sym\"],\n [\"Upsilon\",\"Upsilon\", 0, \"sym\"],\n [\"xi\",\"xi\", 0, \"sym\"],\n [\"Xi\",\"Xi\", 0, \"sym\"],\n\n //hebrew symbols\n [\"zeta\",\"zeta\", 0, \"sym\"],\n [\"aleph\",\"aleph\", 0, \"sym\"],\n [\"beth\",\"beth\", 0, \"sym\"],\n [\"gimel\",\"gimel\", 0, \"sym\"],\n [\"daleth\",\"daleth\", 0, \"sym\"],\n\n //empty set and none symbols\n [\"varnone\",\"None\", 0, \"sym\"],\n [\"varnothing\",\"None\", 0, \"sym\"],\n\n //space characters\n [\"s\",\"\", 10, \"\"],\n ];\n\n console.log(\"matchWord\");\n var curDict = new Array;\n var dispDict = new Array;\n var parseTable = [];\n\n //i should find a better way of doing this\n //this is copying a huge list which is a waste of memory,\n //but it allows for one lookup code to be used\n //fuck javascript for not allowing reference pointers\n //reference pointers would have been awesome for most of this program \n //\n switch(table){\n case 0:\n parseTable = funcTable;\n break;\n case 1:\n parseTable = combTable;\n break;\n default:\n parseTable = funcTable;\n break;\n }\n //get any commands of the same length\n for(var j=0,len=parseTable.length; j<len; j++){\n if(parseTable[j][0].length == curWord.length){\n curDict.push(parseTable[j]);\n dispDict.push(parseTable[j][0]);\n } \n }\n if(curDict.length == 0){\n console.error(\"unknown function word: \"+curWord);\n if(curWord.length !== 0) errors.push(\"Unknown function: '\"+curWord+\"'.\");\n return([[curWord,curWord,-1,\"err\"]]);\n }\n console.log(\" Length matches: \"+dispDict);\n\n //narrow the list each letter\n var k = 0;\n while(curDict.length > 1 && curWord.length > k){\n var newDict = new Array;\n dispDict.length = 0;\n //make a new array of the valid commands because i don't feel like splicing or popping.\n //i'll probably do that in the future cause speed/memory\n for(var l=0,len=curDict.length; l<len;l++){\n if(curDict[l][0].charAt(k) === curWord.charAt(k)){\n newDict.push(curDict[l]);\n dispDict.push(curDict[l][0]);\n }\n }\n curDict = newDict;\n console.log(\" Letter matches: \"+dispDict);\n k++;\n }\n if(curDict.length != 0){\n if(curDict[0][0] == curWord){\n console.log(\"word instructions: \"+curDict[0]);\n return curDict;\n }\n else{\n console.error(\"unknown function word: \"+curWord);\n errors.push(\"Unknown function: '\"+curWord+\"'.\");\n return([[curWord,curWord,\"-1\",\"err\"]]);\n }\n }\n else{\n console.error(\"unknown function word: \"+curWord);\n errors.push(\"Unknown function: '\"+curWord+\"'.\");\n return([[curWord,curWord,\"-1\",\"err\"]]);\n }\n}", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nodeParser(node){\n if(node.indexOf('=') >= 0) {\n var splitNode = node.split('=');\n\n\n var returnNode = new Object();\n returnNode.node = splitNode[0];\n returnNode.value = splitNode[1];\n\n return returnNode;\n }\n else{\n console.error(\"Improperly formatted node!\")\n console.error(\"should be: 'node=value'\")\n process.exit(1);\n }\n}", "static fromString(str) {\n let stack = [];\n let nameArray = [];\n let seperators = ['(', ')', ','];\n for (let char of str) {\n if (seperators.indexOf(char) != -1) {\n let name = nameArray.join('').trim();\n if (name != \"\") {\n stack.push(new NodeTree_1.default(name));\n }\n nameArray = [];\n if (char == '(') {\n stack.push(char);\n }\n else if (char == ')') {\n let childs = [];\n let item;\n item = stack.pop();\n while (item != '(') {\n childs.push(item);\n item = stack.pop();\n }\n let parent = stack[stack.length - 1];\n parent.childs = childs.reverse();\n for (let child of childs) {\n child.parent = parent;\n }\n }\n }\n else {\n nameArray.push(char);\n }\n }\n let tree = new Tree();\n tree.root = stack.pop();\n return tree;\n }", "function astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}", "function tokens(parsers){\r\n return function(scope, state, k){\r\n var i = 0,\r\n ast = [],\r\n length = parsers.length;\r\n \r\n function next(parser){\r\n return function(scope, state, k){\r\n return function(){ return parser(scope, state, function(result){\r\n i++;\r\n if(!result.success)\r\n return k(result);\r\n if(result.ast !== undef)\r\n ast.push(result.ast);\r\n return i < length ? next(parsers[i])(scope, state, k) : k(result);\r\n })};\r\n };\r\n }\r\n\r\n return function(){ return next(parsers[i])(scope, state, function(result){\r\n var success = result.success;\r\n return k({ast: ast, success: success, expecting: success ? undef : result.expecting });\r\n })};\r\n };\r\n}", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }" ]
[ "0.66163296", "0.6509015", "0.5855849", "0.57619786", "0.57346493", "0.5703886", "0.5515664", "0.5485622", "0.54301363", "0.53547525", "0.52678543", "0.52534336", "0.52269846", "0.5222215", "0.5187693", "0.51669896", "0.5139939", "0.5139939", "0.5139939", "0.5139939", "0.506626", "0.50399053", "0.5032918", "0.5032373", "0.49904576", "0.4988632", "0.4968862", "0.49264324", "0.49230123", "0.49131456", "0.48980224", "0.48820543", "0.48736677", "0.4861822", "0.4850289", "0.48441643", "0.48389903", "0.4835081", "0.4833452", "0.48281613", "0.48232153", "0.4797763", "0.4797763", "0.4797763", "0.4797763", "0.4795577", "0.47910938", "0.4788383", "0.47856653", "0.477785", "0.477785", "0.477785", "0.477785", "0.477785", "0.477785", "0.47767425", "0.47689188", "0.4761977", "0.47564366", "0.47564366", "0.4742987", "0.4742792", "0.47406706", "0.4739619", "0.4735269", "0.47308302", "0.47300166", "0.47222546", "0.47213814", "0.47130328", "0.4709854", "0.47031078", "0.46997932", "0.46918616", "0.46917054", "0.4682498", "0.46724194", "0.46718043", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46647796", "0.46631753", "0.46629053", "0.46555355", "0.465527", "0.46420667", "0.46420667", "0.46420667" ]
0.0
-1
a hack to make the top level hygiene work out
function expandTopLevel(stx, moduleContexts, options) { moduleContexts = moduleContexts || []; maxExpands = (_.isNumber(options) ? options : options && options._maxExpands) || Infinity; expandCount = 0; var context = makeTopLevelExpanderContext(options); var modBody = syn.makeDelim('{}', stx, null); modBody = _.reduce(moduleContexts, function (acc, mod) { context.env.extend(mod.env); context.env.names.extend(mod.env.names); return loadModuleExports(acc, context.env, mod.exports, mod.env); }, modBody); var res = expand([ syn.makeIdent('module', null), modBody ], context); res = res[0].destruct(); return flatten(res[0].token.inner); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "enterPrefixedname(ctx) {\n\t}", "enterDotted_as_name(ctx) {\n\t}", "function l(e,t){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");\n// XXX: It is possible to remove this block, and the tests still pass!\nvar n=o(e);return\"/\"==t.charAt(0)&&n&&\"/\"==n.path?t.slice(1):0===t.indexOf(e+\"/\")?t.substr(e.length+1):t}", "function nameMinusTree() {\n return containsTree() ? name.split('.')[1] : name.split('.')[0];\n }", "function stripContext(ctx) {\n\tif (ctx.startsWith('------')) return ctx.substr(6);\n\tif (ctx.startsWith('----')) return ctx.substr(4);\n\tif (ctx.startsWith('--')) return ctx.substr(2);\n\treturn ctx;\n}", "function check_hypen(str) {\n let pos = str.indexOf('-');\n if(pos<0)\n {\n return -1;\n }\n else\n {\n return pos;\n }\n}", "function UnquoteSplicing() {\r\n}", "static extension(url) {\n var name = this.name(url)\n if (!name.match(/\\./)) return undefined\n return name.toLowerCase().replace(/.*\\./,\"\") \n }", "function s(e,t){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");// XXX: It is possible to remove this block, and the tests still pass!\nvar n=r(e);return\"/\"==t.charAt(0)&&n&&\"/\"==n.path?t.slice(1):0===t.indexOf(e+\"/\")?t.substr(e.length+1):t}", "function process_page_path(page){\n\tvar str = page.slice(href_initial_length);\n\tstr = str.split('/').join('=>');\n\tif(str === '')\n\t\treturn 'root';\n\telse\n\t\treturn str;\n}", "function sc_prefix(s) {\n var i = s.lastIndexOf(\".\");\n return i ? s.substring(0, i) : s;\n}", "exitPrefixedname(ctx) {\n\t}", "function DocNameExtract()\n{\n var currentPage;\n wholeurl = window.location.href;\n x = wholeurl.length;\n while((wholeurl.substring(x,x-1)) != \".\"){ x--; } clipend = x;\n while((wholeurl.substring(x,x-1)) != \"/\"){ x--; } clipstart = x;\n return wholeurl.substring(clipend-1,clipstart);\n \n}", "static include() {\n return /\\.*$/i;\n }", "enterDotted_name(ctx) {\n\t}", "function HEPreferences(){}", "function hasSuperSubScript(text){\r\n\treturn text.match(/_{.*?[^\\\\]}/g) || text.match(/\\^{.*?[^\\\\]}/g);\r\n}", "function initMediaCardTitleHyphens() {\n $('.media-card__title').hyphenate('ru');\n }", "function r(e){return e.replace(/([\\:\\-\\_]+(.))/g,(function(e,t,n,r){return r?n.toUpperCase():n}))}", "function parentUrl(url){\n\treturn url.substring(0, url.lastIndexOf('/'));\n }", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "function hyphenateStyleName(name){return name.replace(uppercasePattern,'-$1').toLowerCase().replace(msPattern,'-ms-');}", "match (originalTag, { kebabTag, camelTag }) {\n if (kebabTag.startsWith('core-')) {\n return [camelTag, `import ${camelTag} from '@/components/core/${camelTag.substring(4)}.vue'`]\n }\n }", "function normalizeRouter(m) {\n if (m.indexOf('.') !== -1) {\n m = m.split('.');\n if (angular.isArray(m)) return m[0] + m[1].charAt(0).toUpperCase() + m[1].slice(1);\n return m + m.charAt(0).toUpperCase() + m.slice(1);\n }\n return m;\n }", "function getTidyName(name) {\n return name.split(\"(\")[0];\n }", "function hyphenate(prop) {\n return prop.replace(\n /([A-Z])/g,\n function (a, b) {\n return '-' + b.toLowerCase();\n }\n );\n }", "function testDirectHyphenBeginsBlock() {\n \tvar input = fs.readFileSync(\"../TestCases/gitHub#31-direct-hyphenBeginsBlock.js\", { encoding:\"utf8\"});\n\tvar options = {\n\t\t\twithMath : false,\n\t\t\thash2DContext : false,\n\t\t\thashWebGLContext : false,\n\t\t\thashAudioContext : false,\n\t\t\tcontextVariableName : false,\n\t\t\tcontextType : parseInt(0),\n\t\t\treassignVars : false,\n\t\t\tvarsNotReassigned : [],\n\t\t\tcrushGainFactor : parseFloat(2),\n\t\t\tcrushLengthFactor : parseFloat(1),\n\t\t\tcrushCopiesFactor : parseFloat(0),\n\t\t\tcrushTiebreakerFactor : parseInt(1),\n\t\t\twrapInSetInterval : false,\n\t\t\ttimeVariableName : \"\"\n\t\t};\n\t\t\n\tvar result = RegPack.packer.runPacker(input, options);\n\t\n\t// Expected result : the regular expression decodes correctly\n\tassert.notEqual(result[0].result[1][2].indexOf(\"Final check : passed\"), -1);\n\t\n}", "function sc_basename(p) {\n var i = p.lastIndexOf('/');\n\n if(i >= 0)\n return p.substring(i + 1, p.length);\n else\n return p;\n}", "static get PROPERTY_PREFIX () { return \"--web-\"; }", "function fcamelCase(all,letter){return letter.toUpperCase();}// Convert dashed to camelCase; used by the css and data modules", "function tree() {\n return containsTree() ? name.split('.')[0] : 'standards';\n }", "function normalizeResource(resource) {\n if (!resource) {\n return resource;\n }\n var i = resource.indexOf('/');\n if (i === -1) {\n return resource.toLowerCase();\n }\n return resource.substring(0, i).toLowerCase() + resource.substring(i);\n }", "normalize(prop) {\n return prop.replace('-start', '')\n }", "function urlSlug(title) {\n let arr1 = []; \n arr1 = title.split(/[ ]+/gi);\n title = arr1.join(\"-\");\n if(title[0] === \"-\"){\n title = title.substring(1);\n console.log(\"if running...\");\n console.log(title);\n }\n \n return title.toLowerCase();\n}", "function what(){\r\n var url = window.location.pathname;\r\n var reg = url.match(/\\/([s])\\/([0-9a-zA-Z]+)/g);\r\n var reg_entries = url.match(/\\/wpisy/);\r\n var reg_comments = url.match(/\\/komentarze/);\r\n console.log ( url );\r\n if( url == '/' ) \r\n\t\treturn \"contents\";\r\n if( reg )\r\n \treturn \"contents\"; \r\n if( reg_entries) \r\n\t\treturn \"entries\";\r\n\tif( reg_comments)\r\n\t\treturn \"content_comments\";\r\n \r\n return false;\r\n}", "getSpaghetti() {\n return this.getSpaghettiAt(\".\");\n }", "function updateDotHierarchy() {\n var hash = window.location.hash;\n var hash_split = hash.split(\"/\");\n var hierarchy = \"\";\n if (view == VIEWS.DOT) {\n for (var i = 1; i < hash_split.length; i++) {\n hierarchy += \"|\" + hash_split[i].replace(/\\d+_/, '');\n }\n }\n $(\"#dot_hierarchy_text\").html(hierarchy);\n}", "static name(url) {\n return url.toString().replace(/.*\\//,\"\")\n }", "function generateNavTitle(string) {\n var startIndex = string.indexOf(\".\") + 1;\n var title = string.substring(startIndex);\n return title.substr(0, 1).toUpperCase() + title.substr(1);\n }", "function unescapeIdentifier(identifier){return identifier.startsWith('___')?identifier.substr(1):identifier;}", "function noExt (s) { return s.replace(/\\.[^*]+$/, \"\")}", "function normalizeGlob(glob, _a) {\n var _b = (_a === void 0 ? {} : _a).globstar, globstar = _b === void 0 ? false : _b;\n if (glob.match(/\\0/g)) {\n throw new Error(\"Glob contains invalid characters: \\\"\" + glob + \"\\\"\");\n }\n if (!globstar) {\n return normalize$2(glob);\n }\n var s = SEP_PATTERN.source;\n var badParentPattern = new RegExp(\"(?<=(\" + s + \"|^)\\\\*\\\\*\" + s + \")\\\\.\\\\.(?=\" + s + \"|$)\", \"g\");\n return normalize$2(glob.replace(badParentPattern, \"\\0\")).replace(/\\0/g, \"..\");\n }", "function normalizeName(name) {\n if(options.paths) {\n var possibilities = []\n for (var path in paths) {\n if(name.startsWith(path)) {\n possibilities.push(path);\n }\n }\n\n var longestMatchingIndex = Math.max.apply(Math, possibilities.map(function(x) {return x.length}));\n var longestMatching = possibilities[longestMatchingIndex];\n name = longestMatching + name.slice(longestMatchingPath);\n }\n if(options.baseURL) {\n name = options.baseURL + '/' + name + '.js';\n }\n\n return name;\n}", "function testDirectSingleHyphen() {\n\tvar input = fs.readFileSync(\"../TestCases/gitHub#31-direct-singleHyphen.js\", { encoding:\"utf8\"});\n\tvar options = {\n\t\t\twithMath : false,\n\t\t\thash2DContext : false,\n\t\t\thashWebGLContext : false,\n\t\t\thashAudioContext : false,\n\t\t\tcontextVariableName : false,\n\t\t\tcontextType : parseInt(0),\n\t\t\treassignVars : false,\n\t\t\tvarsNotReassigned : [],\n\t\t\tcrushGainFactor : parseFloat(2),\n\t\t\tcrushLengthFactor : parseFloat(1),\n\t\t\tcrushCopiesFactor : parseFloat(0),\n\t\t\tcrushTiebreakerFactor : parseInt(1),\n\t\t\twrapInSetInterval : false,\n\t\t\ttimeVariableName : \"\"\n\t\t};\n\t\t\n\tvar result = RegPack.packer.runPacker(input, options);\n\t\n\t// Expected result : the regular expression decodes correctly\n\tassert.notEqual(result[0].result[1][2].indexOf(\"Final check : passed\"), -1);\n\n\t\n}", "function Guidewire_SafeTopicName(theTitle) {\ntheTitle = theTitle.replace(/ /g, \"_\"); // converts space char\ntheTitle = theTitle.replace(/\\u00a0/g, \"_\"); // converts nbsp char\n// censor (remove) characters that mess up epublisher in URLs: forward slash, backslash, question mark, &amp;\ntheTitle= theTitle.replace(/[\\\\\\/\\?]/g, \"\");\ntheTitle = theTitle.replace(/&/g, \"\");\ntheTitle = theTitle.replace(/\\u201c/g, \"\"); // double quote smart L\ntheTitle = theTitle.replace(/\\u201d/g, \"\");// double quote smart R\ntheTitle = theTitle.replace(/\\u2018/g, \"\");// single quote smart L\ntheTitle = theTitle.replace(/\\u2019/g, \"\");// single quote smart R\ntheTitle = theTitle.replace(/\\u2022/g, \"\");// trademark\ntheTitle = theTitle.replace(/'/g, \"\");// apparently a dumb single quote gets stripped by webworks\ntheTitle = theTitle.replace(/\"/g, \"\");// to be safe let us strip double quotes too\ntheTitle = theTitle.replace(/\\</g, \"(\"); // open bracket\ntheTitle = theTitle.replace(/\\>/g, \")\"); // close bracket\ntheTitle = theTitle.replace(/:/g, \"_\"); // colon\ntheTitle = theTitle.replace(/&/g, \"\");\nreturn (theTitle); }", "function Guidewire_SafeTopicName(theTitle) {\ntheTitle = theTitle.replace(/ /g, \"_\"); // converts space char\ntheTitle = theTitle.replace(/\\u00a0/g, \"_\"); // converts nbsp char\n// censor (remove) characters that mess up epublisher in URLs: forward slash, backslash, question mark, &amp;\ntheTitle= theTitle.replace(/[\\\\\\/\\?]/g, \"\");\ntheTitle = theTitle.replace(/&/g, \"\");\ntheTitle = theTitle.replace(/\\u201c/g, \"\"); // double quote smart L\ntheTitle = theTitle.replace(/\\u201d/g, \"\");// double quote smart R\ntheTitle = theTitle.replace(/\\u2018/g, \"\");// single quote smart L\ntheTitle = theTitle.replace(/\\u2019/g, \"\");// single quote smart R\ntheTitle = theTitle.replace(/\\u2022/g, \"\");// trademark\ntheTitle = theTitle.replace(/'/g, \"\");// apparently a dumb single quote gets stripped by webworks\ntheTitle = theTitle.replace(/\"/g, \"\");// to be safe let us strip double quotes too\ntheTitle = theTitle.replace(/\\</g, \"(\"); // open bracket\ntheTitle = theTitle.replace(/\\>/g, \")\"); // close bracket\ntheTitle = theTitle.replace(/:/g, \"_\"); // colon\ntheTitle = theTitle.replace(/&/g, \"\");\nreturn (theTitle); }", "function Guidewire_SafeTopicName(theTitle) {\ntheTitle = theTitle.replace(/ /g, \"_\"); // converts space char\ntheTitle = theTitle.replace(/\\u00a0/g, \"_\"); // converts nbsp char\n// censor (remove) characters that mess up epublisher in URLs: forward slash, backslash, question mark, &amp;\ntheTitle= theTitle.replace(/[\\\\\\/\\?]/g, \"\");\ntheTitle = theTitle.replace(/&/g, \"\");\ntheTitle = theTitle.replace(/\\u201c/g, \"\"); // double quote smart L\ntheTitle = theTitle.replace(/\\u201d/g, \"\");// double quote smart R\ntheTitle = theTitle.replace(/\\u2018/g, \"\");// single quote smart L\ntheTitle = theTitle.replace(/\\u2019/g, \"\");// single quote smart R\ntheTitle = theTitle.replace(/\\u2022/g, \"\");// trademark\ntheTitle = theTitle.replace(/'/g, \"\");// apparently a dumb single quote gets stripped by webworks\ntheTitle = theTitle.replace(/\"/g, \"\");// to be safe let us strip double quotes too\ntheTitle = theTitle.replace(/\\</g, \"(\"); // open bracket\ntheTitle = theTitle.replace(/\\>/g, \")\"); // close bracket\ntheTitle = theTitle.replace(/:/g, \"_\"); // colon\ntheTitle = theTitle.replace(/&/g, \"\");\nreturn (theTitle); }", "function Guidewire_SafeTopicName(theTitle) {\ntheTitle = theTitle.replace(/ /g, \"_\"); // converts space char\ntheTitle = theTitle.replace(/\\u00a0/g, \"_\"); // converts nbsp char\n// censor (remove) characters that mess up epublisher in URLs: forward slash, backslash, question mark, &amp;\ntheTitle= theTitle.replace(/[\\\\\\/\\?]/g, \"\");\ntheTitle = theTitle.replace(/&/g, \"\");\ntheTitle = theTitle.replace(/\\u201c/g, \"\"); // double quote smart L\ntheTitle = theTitle.replace(/\\u201d/g, \"\");// double quote smart R\ntheTitle = theTitle.replace(/\\u2018/g, \"\");// single quote smart L\ntheTitle = theTitle.replace(/\\u2019/g, \"\");// single quote smart R\ntheTitle = theTitle.replace(/\\u2022/g, \"\");// trademark\ntheTitle = theTitle.replace(/'/g, \"\");// apparently a dumb single quote gets stripped by webworks\ntheTitle = theTitle.replace(/\"/g, \"\");// to be safe let us strip double quotes too\ntheTitle = theTitle.replace(/\\</g, \"(\"); // open bracket\ntheTitle = theTitle.replace(/\\>/g, \")\"); // close bracket\ntheTitle = theTitle.replace(/:/g, \"_\"); // colon\ntheTitle = theTitle.replace(/&/g, \"\");\nreturn (theTitle); }", "function Guidewire_SafeTopicName(theTitle) {\ntheTitle = theTitle.replace(/ /g, \"_\"); // converts space char\ntheTitle = theTitle.replace(/\\u00a0/g, \"_\"); // converts nbsp char\n// censor (remove) characters that mess up epublisher in URLs: forward slash, backslash, question mark, &amp;\ntheTitle= theTitle.replace(/[\\\\\\/\\?]/g, \"\");\ntheTitle = theTitle.replace(/&/g, \"\");\ntheTitle = theTitle.replace(/\\u201c/g, \"\"); // double quote smart L\ntheTitle = theTitle.replace(/\\u201d/g, \"\");// double quote smart R\ntheTitle = theTitle.replace(/\\u2018/g, \"\");// single quote smart L\ntheTitle = theTitle.replace(/\\u2019/g, \"\");// single quote smart R\ntheTitle = theTitle.replace(/\\u2022/g, \"\");// trademark\ntheTitle = theTitle.replace(/'/g, \"\");// apparently a dumb single quote gets stripped by webworks\ntheTitle = theTitle.replace(/\"/g, \"\");// to be safe let us strip double quotes too\ntheTitle = theTitle.replace(/\\</g, \"(\"); // open bracket\ntheTitle = theTitle.replace(/\\>/g, \")\"); // close bracket\ntheTitle = theTitle.replace(/:/g, \"_\"); // colon\ntheTitle = theTitle.replace(/&/g, \"\");\nreturn (theTitle); }", "function regExpPrefix(re) {\n\t var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n\t return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n\t }", "function regExpPrefix(re) {\n\t var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n\t return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n\t }", "static get tag(){return\"site-active-title\"}", "function fixTitle() {\r\n window.document.title = window.document.title.replace(/[^-]* - [^-]* - /, \"\") + \" - Safari Online\";\r\n}", "function subtypeName() {\n return containsSuffix() ? name.split('+')[0] : name;\n }", "getDefaultCollapsedSubMenus(props) {\n const { location: { pathname } = {} } = props || this.props;\n // eg. /list/search/articles = > ['','list','search','articles']\n let snippets = (pathname || '').split('/');\n // Delete the end\n // eg. delete 'articles'\n snippets.pop();\n // Delete the head\n // eg. delete ''\n snippets.shift();\n // eg. After the operation is completed, the array should be ['list','search']\n // eg. Forward the array as ['list','list/search']\n snippets = snippets.map((item, index) => {\n // If the array length > 1\n if (index > 0) {\n // eg. search => ['list','search'].join('/')\n return snippets.slice(0, index + 1).join('/');\n }\n // index 0 to not do anything\n return item;\n });\n snippets = snippets.map((item) => {\n const keys = this.getSelectedMenuKeys(`/${item}`);\n return keys[keys.length - 1];\n });\n // eg. ['list','list/search']\n return snippets;\n }", "enterDotted_as_names(ctx) {\n\t}", "getBreadcrumbNameForCurrentPath() {\n return false;\n }", "function localize(e,t){return t?e.replace(/(\"|')~\\//g,\"$1\"+options.root):e.replace(/^~\\//,options.root)}", "function hyphenate(propertyName) {\n\t return propertyName\n\t .replace(/([A-Z])/g, '-$1')\n\t .replace(/^ms-/, '-ms-') // Internet Explorer vendor prefix.\n\t .toLowerCase();\n\t}", "function removeLangPrefix(path) {\r\n if (!path) {\r\n return path;\r\n }\r\n if (path.match(\"^/ru\") || path.match(\"^/en\")) {\r\n return path.slice(3);\r\n } else {\r\n return path;\r\n }\r\n }", "_resolveNameFallback(relativeName, parentName) {\n var name, name_array;\n name = parentName ? `${parentName}.${relativeName}` : relativeName;\n while (!(this.recognizer.hasRoute(name) || !(name_array = name.split('.').slice(0, -1)).length)) {\n name = name_array.slice(0, -1).concat([relativeName]).join('.');\n }\n return name;\n }", "function sanitizeTagName(name) {\n\treturn name.toLowerCase().replace(/[^0-9a-z]+/g, \"-\");\n}", "tryGetBundleName(entry, index) {\n let name = index.toString();\n name = entry.substring(entry.lastIndexOf('/') + 1, entry.length);\n name = name.replace('.js', '');\n name = name.replace(/([a-z](?=[A-Z]))/g, '$1-');\n name = name.toLowerCase();\n return name;\n }", "function base_css_prefix(ast) {\n return ast.computed === false && ast.object.type == \"Identifier\" && \n ast.object.name == \"Ext\" && ast.property.type == \"Identifier\" && \n ast.property.name == \"baseCSSPrefix\";\n}", "removeLeadingSlash(text) {\n if (text.startsWith('/') || text.startsWith('\\\\')) {\n return text.substring(1);\n }\n else {\n return text;\n }\n }", "function regExpPrefix(re) {\n\t\t\tvar prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n\t\t\treturn (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n\t\t}", "function trimPageName(page) {\n var name = page.name || chrome.i18n.getMessage('untitled', page.url);\n if (name.length > 50) {\n name = name.replace(/([^]{20,50})(\\w)\\b.*$/, '$1$2...');\n }\n if (name.length > 40 && page.folder_name != null && page.folder_name != \"\")\n {\n name = name.replace(/([^]{20,40})(\\w)\\b.*$/, '$1$2...');\n }\n return name;\n}", "function getParentUri(string, level){\n var i = (!level)?1:level;\n var p = new RegExp(\"(\\/[^/]+){\"+i+\"}$\",\"i\");\n return string.replace(p,\"\");\n}", "function isUnhyphenatedJsxName(name) {\n // - is the only character supported in JSX attribute names that isn't valid in JavaScript identifiers\n return name.indexOf(\"-\") < 0;\n }", "function fixStart(word) {\n var firstLetter = word.charAt(0);\n console.log(firstLetter + word.slice(1).replace(new RegExp(firstLetter, 'g'), '*'));\n return fixStart;\n}", "getPrefix () {\n return ''\n }", "function getPageSlug() {\n var slug = window.location.href.replace(/^.*?\\/([\\w-]*)(\\/|\\/[\\w-]*\\.[\\w]+)?(\\?.*|#.*)?$/i, '$1');\n return slug !== window.location.href && slug;\n }", "function dashCase() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utInTransform,\n sp: utilitymanager_1.um.TIXSelPolicy.Word,\n pat: /\\b(\\w+)\\b/g,\n repl: function (_match, p1) { return p1\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .toLowerCase()\n .replace(/_/g, '-'); },\n });\n }", "function testNegatedHyphenBeginsBlock() {\n \tvar input = fs.readFileSync(\"../TestCases/gitHub#31-negated-hyphenBeginsBlock.js\", { encoding:\"utf8\"});\n\tvar options = {\n\t\t\twithMath : false,\n\t\t\thash2DContext : false,\n\t\t\thashWebGLContext : false,\n\t\t\thashAudioContext : false,\n\t\t\tcontextVariableName : false,\n\t\t\tcontextType : parseInt(0),\n\t\t\treassignVars : false,\n\t\t\tvarsNotReassigned : [],\n\t\t\tcrushGainFactor : parseFloat(2),\n\t\t\tcrushLengthFactor : parseFloat(1),\n\t\t\tcrushCopiesFactor : parseFloat(0),\n\t\t\tcrushTiebreakerFactor : parseInt(1),\n\t\t\twrapInSetInterval : false,\n\t\t\ttimeVariableName : \"\"\n\t\t};\n\t\t\n\tvar result = RegPack.packer.runPacker(input, options);\n\t\n\t// Expected result : the regular expression decodes correctly\n\tassert.notEqual(result[0].result[2][2].indexOf(\"Final check : passed\"), -1);\n\t\n}", "function whittle(safePaths) {\n var trashEls = [];\n\n $('*').each(function (i, el) {\n var path = $(el).getPath();\n if ((path.indexOf(\"head\") > -1 && path.indexOf(\"head\") !== path.indexOf(\"header\")) || path.indexOf(\"script\") > -1 || path.indexOf(\"style\") > -1) {\n return;\n }\n\n if (safePaths.indexOf(path) < 0) {\n trashEls.push(el);\n }\n });\n\n trashEls.forEach(function (el, index, array) {\n $(el).remove();\n });\n}", "function notAtRoot (ascent) {\n return headKey(ascent) !== __WEBPACK_IMPORTED_MODULE_4__incrementalContentBuilder__[\"a\" /* ROOT_PATH */]\n }", "function normalizeTitle(title)\n {\n return title.replace(/^_+/, \"\").replace(/_+$/, \"\").replace(/[\\s_]+/g, \"_\")\n }", "function normalizeTitle(title)\n {\n return title.replace(/^_+/, \"\").replace(/_+$/, \"\").replace(/[\\s_]+/g, \"_\")\n }", "function fixTag(tag) {\n var temp = '<';\n for (var i = 1; i < tag.length; ++i) {\n if (tag.charAt(i).match(/[a-z\\-]/i)) {\n temp += tag.charAt(i);\n } else {\n break;\n }\n }\n return temp;\n\n}", "function normalizeUrlToKey(url)\n {\n /* remove empty anchor tag */\n var anchorIndex = url.indexOf('#');\n if ((anchorIndex != -1) && (anchorIndex == url.length - 1))\n {\n return url.substr(0, anchorIndex);\n }\n else\n {\n return url;\n }\n }", "function cleanAnalyticsName(name) {\n name = \"\" + (name || \"\");\n return name.replace(/\\./g, \"-\");\n }", "slugify(text) {\n return text\n .toString()\n .toLowerCase()\n .replace(/\\s+/g, \"-\")\n .replace(/[^\\w\\-]+/g, \"\")\n .replace(/--+/g, \"-\");\n }", "function formatComponentName(s) {\n let upperPathItems = s.split('/').map(item => item.replace(/\\w\\S*/g,\n (t) => t.charAt(0).toUpperCase() + t.substr(1).toLowerCase()\n ));\n return upperPathItems.join('/');\n}", "function sanitizePath(path) {\n var path = path.charAt(0) == '/' ? path : \"/\" + path;\n return path.replace(/\\#.*|\\?.*/, '');\n }", "function fixTitle(title) {\r\n\r\n\t\t// replace dots with spaces\r\n\t\ttitle = title.replace(/\\./g, \" \");\r\n\t\t\r\n\t\t// remove R5 or R6 tags\r\n\t\ttitle = title.replace(/R(5|6)/, \"\");\r\n\t\t\r\n\t\t// remove unwanted characters\r\n\t\ttitle = title.replace(/[\\(\\)\\[\\]]/g, \"\");\r\n\t\t\r\n\t\t// trim\r\n\t\ttitle = title.replace(/^[^a-z0-9]+|[^a-z0-9]+$/gi, '');\r\n\t\t\r\n\t\treturn title;\r\n\t}", "startsWith(c) { return c=='\\\\' || c=='.' }", "get extension()\t{ return this.match[10] || \"\" }", "function formatPathname(urlobj)\n{\n\tvar pathname = joinDirs(urlobj.extra.directory, urlobj.extra.directoryLeadingSlash);\n\t\n\tif (urlobj.extra.filename !== null)\n\t{\n\t\tpathname += urlobj.extra.filename;\n\t}\n\t\n\treturn pathname;\n}", "function fixStart(s) {\n var c = s.charAt(0);\n return c + s.slice(1).replace(new RegExp(c, 'g'), '*');\n }", "function regExpPrefix(re) {\n var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n }", "function Unquote() {\r\n}", "function whisper(str){\n return \"...\" + str.toLowerCase() + \"...\"\n}", "static _getRouteFromMethode(str) {\n return str.replace(/([A-Z])/g, (str, letter, index) => {\n return index === 0 ? `${letter.toLowerCase()}` : `-${letter.toLowerCase()}`;\n });\n }", "specialEncode (str) {\n\t\treturn str.replace(/:/g, '***(_colon_)').replace(/\\//g, '***(_slash_)');\n\t}", "function onenterclosingslash() {\n if (elementStack.length === 0) {\n crash('before name', 'an opening tag first as there are no open elements')\n }\n }" ]
[ "0.54198885", "0.5295679", "0.5266057", "0.5253597", "0.52387434", "0.51907146", "0.5184963", "0.51506007", "0.5141844", "0.5089169", "0.50848925", "0.5082414", "0.50673586", "0.5066328", "0.50571984", "0.5050616", "0.5037815", "0.4937327", "0.49357924", "0.49275586", "0.49262008", "0.49262008", "0.49262008", "0.49262008", "0.49262008", "0.49262008", "0.49262008", "0.49262008", "0.49082115", "0.48982528", "0.48892462", "0.48858568", "0.48751637", "0.4875074", "0.4866289", "0.48627582", "0.48507592", "0.4845148", "0.48401538", "0.4829463", "0.48180765", "0.48177436", "0.48135003", "0.48122948", "0.48079658", "0.48004717", "0.48002702", "0.47892922", "0.47747827", "0.47692746", "0.47668222", "0.47668222", "0.47668222", "0.47668222", "0.47668222", "0.47642693", "0.47642693", "0.47554496", "0.47468022", "0.474673", "0.4741634", "0.4727423", "0.47221288", "0.47170535", "0.4713011", "0.47122478", "0.4711512", "0.4711391", "0.47081834", "0.47043332", "0.470313", "0.4701243", "0.4699514", "0.4696407", "0.4693972", "0.46929863", "0.46916077", "0.46894324", "0.4689029", "0.46876225", "0.46852106", "0.46801308", "0.4677809", "0.4677809", "0.4675974", "0.46721402", "0.4670982", "0.46677604", "0.4666293", "0.46649328", "0.4664114", "0.46616805", "0.46565592", "0.46556285", "0.46548352", "0.46528265", "0.46492127", "0.4645918", "0.46408984", "0.4636969", "0.4635436" ]
0.0
-1
break delimiter tree structure down to flat array of syntax objects
function flatten(stx) { return _.reduce(stx, function (acc, stx$2) { if (stx$2.token.type === parser.Token.Delimiter) { var exposed = stx$2.expose(); var openParen = syntaxFromToken({ type: parser.Token.Punctuator, value: stx$2.token.value[0], range: stx$2.token.startRange, sm_range: typeof stx$2.token.sm_startRange == 'undefined' ? stx$2.token.startRange : stx$2.token.sm_startRange, lineNumber: stx$2.token.startLineNumber, sm_lineNumber: typeof stx$2.token.sm_startLineNumber == 'undefined' ? stx$2.token.startLineNumber : stx$2.token.sm_startLineNumber, lineStart: stx$2.token.startLineStart, sm_lineStart: typeof stx$2.token.sm_startLineStart == 'undefined' ? stx$2.token.startLineStart : stx$2.token.sm_startLineStart }, exposed); var closeParen = syntaxFromToken({ type: parser.Token.Punctuator, value: stx$2.token.value[1], range: stx$2.token.endRange, sm_range: typeof stx$2.token.sm_endRange == 'undefined' ? stx$2.token.endRange : stx$2.token.sm_endRange, lineNumber: stx$2.token.endLineNumber, sm_lineNumber: typeof stx$2.token.sm_endLineNumber == 'undefined' ? stx$2.token.endLineNumber : stx$2.token.sm_endLineNumber, lineStart: stx$2.token.endLineStart, sm_lineStart: typeof stx$2.token.sm_endLineStart == 'undefined' ? stx$2.token.endLineStart : stx$2.token.sm_endLineStart }, exposed); if (stx$2.token.leadingComments) { openParen.token.leadingComments = stx$2.token.leadingComments; } if (stx$2.token.trailingComments) { openParen.token.trailingComments = stx$2.token.trailingComments; } acc.push(openParen); push.apply(acc, flatten(exposed.token.inner)); acc.push(closeParen); return acc; } stx$2.token.sm_lineNumber = stx$2.token.sm_lineNumber ? stx$2.token.sm_lineNumber : stx$2.token.lineNumber; stx$2.token.sm_lineStart = stx$2.token.sm_lineStart ? stx$2.token.sm_lineStart : stx$2.token.lineStart; stx$2.token.sm_range = stx$2.token.sm_range ? stx$2.token.sm_range : stx$2.token.range; acc.push(stx$2); return acc; }, []); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "parse(tree, depth) {\n if (Array.isArray(tree)) {\n return tree.map(node => this.parse(node, depth + 1)).join('');\n\n } else if(isProperty(tree)) {\n return this.addComment(tree, depth) + this.parseProperty(tree, depth);\n\n } else if (isExprStatement(tree)) {\n return this.parseExpression(tree);\n\n } else if (isVarDeclarator(tree)) {\n if (isCallableExpr(tree) || isArrowFunctionExpr(tree)) {\n return this.parseExpression(tree, true);\n }\n return tree.init.properties.map(node => this.parse(node, depth + 1)).join('');\n\n } else if (isVarDeclaration(tree)) {\n return tree.declarations.map(n => this.parse(n, depth - 1)).join('');\n\n } else if (isLabelStatement(tree) || isBlockStatement(tree)) {\n throw new Error('Grid options should be wrapped inside: const gridOptions = { ... }');\n\n } else {\n throw new Error(`Unexpected node encountered:\\n\\n${JSON.stringify(tree)}`);\n }\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "function nestTokens(tokens) {\n var tree = [];\n var collector = tree;\n var sections = [];\n\n var token;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n switch (token[0]) {\n case '#':\n case '^':\n sections.push(token);\n collector.push(token);\n collector = token[4] = [];\n break;\n case '/':\n var section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : tree;\n break;\n default:\n collector.push(token);\n }\n }\n\n return tree;\n }", "treefy(tokenArray) {\n // Parent tree\n let tree = new Node();\n\n let index = 0;\n let depth = 0;\n let subarray = [];\n\n while (index < tokenArray.length) {\n\n let token = tokenArray[index++];\n\n if (token.type == Token.SPACE || token.type == Token.COMMENT)\n continue;\n\n // Open\n if (token.type == Token.OPEN) {\n\n depth++;\n\n if (depth == 1) {\n subarray = [];\n continue;\n }\n }\n\n // Close\n else if (token.type == Token.CLOSE) {\n\n depth--;\n\n // Depth cannot be smaller than 0\n if (depth < 0)\n return new Error(Error.SYNTAX, \"Surplus ')' exists\", token.lineNumber);\n\n if (depth == 0) {\n\n // Create sub-tree\n let subtree = this.treefy(subarray);\n\n // If error, just pass beyond (no stack push)\n if (subtree instanceof Error)\n return subtree;\n\n tree.addChild(subtree);\n continue;\n }\n }\n\n // Direct (siblings) token\n if (depth == 0) {\n tree.addChild(new Node(token));\n }\n\n // Subarray (children) token\n else if (depth > 0) {\n subarray.push(token);\n }\n }\n\n // Depth must be 0 at the termination point\n if (depth > 0)\n return new Error(Error.SYNTAX, \"'(' not closed\", tokenArray[tokenArray.length - 1].lineNumber);\n\n return tree;\n }", "splitTokens(scope, tokens) {\n const items = []\n let current = []\n for (let i = 0, token; (token = tokens[i]); i++) {\n // handle alternate marker\n if (this.delimiter.testAtStart(scope, tokens, i)) {\n items.push(current)\n current = []\n // eslint-disable-next-line no-continue\n continue\n }\n // handle nested start/emd\n if (this.start.testAtStart(scope, tokens, i)) {\n const end = this.findNestedEnd(scope, tokens, i)\n if (end) {\n current = current.concat(tokens.slice(i, end + 1))\n i = end\n // eslint-disable-next-line no-continue\n continue\n }\n }\n current.push(token)\n }\n // Pick up the last list ONLY if it's not empty\n // This ensures we don't pick up an empty list for a delimiter at the end.\n if (current.length) items.push(current)\n\n if (!items.length) return undefined\n return items\n }", "buildHierarchy(obj) {\n var that = this;\n var csv = obj;\n // obj = _.clone(obj);\n csv = _.filter(obj, (obje) => {\n return obje[0].split(\">\").length < 13;\n });\n var root = {\"name\": \"root\", \"children\": []};\n for (var i = 1; i < csv.length - 1; i++) {\n var sequence = csv[i][0];\n var size = +csv[i][1];\n var conType = csv[i][2];\n //console.log(csv[i])\n if (isNaN(size)) {\n break;\n }\n var parts = sequence.split(\">\");\n parts = _.map(parts, _.trim);\n parts = _.map(parts, function (a) {\n return that.resolveStepName(a);\n });\n var currentNode = root;\n for (var j = 0; j < parts.length; j++) {\n var children = currentNode[\"children\"];\n var nodeName = parts[j];\n var childNode;\n if (j + 1 < parts.length) {\n // Not yet at the end of the sequence; move down the tree.\n var foundChild = false;\n for (var k = 0; k < children.length; k++) {\n if (children[k][\"name\"] == nodeName) {\n childNode = children[k];\n foundChild = true;\n break;\n }\n }\n // If we don't already have a child node for this branch, create it.\n if (!foundChild) {\n childNode = {\"name\": nodeName, \"children\": []};\n children.push(childNode);\n }\n currentNode = childNode;\n }\n else {\n // Reached the end of the sequence; create a leaf node.\n childNode = {\"name\": nodeName, \"children\": [], \"size\": size, conversion_type: conType};\n children.push(childNode);\n }\n }\n }\n\n\n return root;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "genStructure(type) {\n let children = [];\n type = type || this.type || '';\n const bone = this.rootTypes[type] || ''; // End of recursion, do nothing\n\n /* eslint-disable-next-line no-empty, brace-style */\n\n if (type === bone) {} // Array of values - e.g. 'heading, paragraph, text@2'\n else if (type.indexOf(',') > -1) return this.mapBones(type); // Array of values - e.g. 'paragraph@4'\n else if (type.indexOf('@') > -1) return this.genBones(type); // Array of values - e.g. 'card@2'\n else if (bone.indexOf(',') > -1) children = this.mapBones(bone); // Array of values - e.g. 'list-item@2'\n else if (bone.indexOf('@') > -1) children = this.genBones(bone); // Single value - e.g. 'card-heading'\n else if (bone) children.push(this.genStructure(bone));\n\n return [this.genBone(type, children)];\n }", "genStructure(type) {\n let children = [];\n type = type || this.type || '';\n const bone = this.rootTypes[type] || ''; // End of recursion, do nothing\n\n /* eslint-disable-next-line no-empty, brace-style */\n\n if (type === bone) {} // Array of values - e.g. 'heading, paragraph, text@2'\n else if (type.indexOf(',') > -1) return this.mapBones(type); // Array of values - e.g. 'paragraph@4'\n else if (type.indexOf('@') > -1) return this.genBones(type); // Array of values - e.g. 'card@2'\n else if (bone.indexOf(',') > -1) children = this.mapBones(bone); // Array of values - e.g. 'list-item@2'\n else if (bone.indexOf('@') > -1) children = this.genBones(bone); // Single value - e.g. 'card-heading'\n else if (bone) children.push(this.genStructure(bone));\n\n return [this.genBone(type, children)];\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, len = tokens.length; i < len; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens(tokens) {\r\n var nestedTokens = [];\r\n var collector = nestedTokens;\r\n var sections = [];\r\n\r\n var token, section;\r\n for (var i = 0, len = tokens.length; i < len; ++i) {\r\n token = tokens[i];\r\n\r\n switch (token[0]) {\r\n case '#':\r\n case '^':\r\n collector.push(token);\r\n sections.push(token);\r\n collector = token[4] = [];\r\n break;\r\n case '/':\r\n section = sections.pop();\r\n section[5] = token[2];\r\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\r\n break;\r\n default:\r\n collector.push(token);\r\n }\r\n }\r\n\r\n return nestedTokens;\r\n }", "function structure(lines) {\n const stack = [{ children: [] }];\n let currentLevel = stack[0], lastLine = null;\n\n for(let rawLine of lines) {\n const indent = rawLine.search(/[^ ]/);\n\n if(indent === -1)\n continue;\n\n const line = { value: rawLine.substr(indent), children: undefined };\n\n if(indent > stack.length - 1) {\n if(indent !== stack.length)\n throw new Error('Malformed input');\n\n // Last line was a header, move it up\n stack.push(currentLevel);\n currentLevel = lastLine;\n currentLevel.children = [];\n }\n\n while(indent < stack.length - 1) {\n // Coming out\n currentLevel = stack.pop();\n }\n\n currentLevel.children.push(line);\n lastLine = line;\n }\n\n return stack[0].children;\n}", "function nestTokens(tokens) {\n var nestedTokens = [];\n var collector = nestedTokens;\n var sections = [];\n\n var token, section;\n for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n token = tokens[i];\n\n switch (token[0]) {\n case '#':\n case '^':\n collector.push(token);\n sections.push(token);\n collector = token[4] = [];\n break;\n case '/':\n section = sections.pop();\n section[5] = token[2];\n collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n break;\n default:\n collector.push(token);\n }\n }\n\n return nestedTokens;\n }", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "function nestTokens (tokens) {\n\t var nestedTokens = [];\n\t var collector = nestedTokens;\n\t var sections = [];\n\n\t var token, section;\n\t for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n\t token = tokens[i];\n\n\t switch (token[0]) {\n\t case '#':\n\t case '^':\n\t collector.push(token);\n\t sections.push(token);\n\t collector = token[4] = [];\n\t break;\n\t case '/':\n\t section = sections.pop();\n\t section[5] = token[2];\n\t collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n\t break;\n\t default:\n\t collector.push(token);\n\t }\n\t }\n\n\t return nestedTokens;\n\t }", "delimitedMany(delimiterKind, parseFn) {\n this.expectOptionalToken(delimiterKind);\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (this.expectOptionalToken(delimiterKind));\n\n return nodes;\n }", "getAst() {\n\n return {\n type: 'array',\n elements: this.elements.map(elem => elem.getAst())\n };\n }", "walkTokens(tokens, callback) {\n let values = [];\n for (const token of tokens) {\n values = values.concat(callback.call(this, token));\n switch (token.type) {\n case \"table\": {\n for (const cell of token.header) {\n values = values.concat(this.walkTokens(cell.tokens, callback));\n }\n for (const row of token.rows) {\n for (const cell of row) {\n values = values.concat(this.walkTokens(cell.tokens, callback));\n }\n }\n break;\n }\n case \"list\": {\n values = values.concat(this.walkTokens(token.items, callback));\n break;\n }\n default: {\n if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) {\n this.defaults.extensions.childTokens[token.type].forEach((childTokens) => {\n values = values.concat(this.walkTokens(token[childTokens], callback));\n });\n } else if (token.tokens) {\n values = values.concat(this.walkTokens(token.tokens, callback));\n }\n }\n }\n }\n return values;\n }", "function tokenify (typedItems) {\n\n // Cluster tokens by Dividers and Ors\n let clusters = [[[]]];\n typedItems.forEach(item => {\n if (item.type === \"divider\") {\n clusters.push([[]]);\n\n } else {\n let dividerCluster = clusters[clusters.length - 1];\n\n if (item.type === \"or\") {\n dividerCluster.push([]);\n\n } else {\n let orCluster = dividerCluster[dividerCluster.length - 1];\n orCluster.push(item);\n }\n }\n });\n\n // Construct Tokens - Reduce and turn clusters into sequences/groups\n return clusters.map(dividerCluster => {\n\n let orTokens = dividerCluster.map(orCluster => {\n\n let sequenceTokens = orCluster.map(item => {\n\n if (item.type == \"group\") { // Recurse group items\n let tokens = tokenify(item.items);\n\n // If the only child of a group is another group - combine\n if (tokens.length === 1 && tokens[0] instanceof Group) {\n let min = item.min;\n let max = item.max;\n if (min === null || (tokens[0].min !== null && min > tokens[0].min)) min = tokens[0].min;\n if (max === null || (tokens[0].max !== null && max < tokens[0].max)) max = tokens[0].max;\n return tokens[0];\n\n } else if (tokens.length) {\n return new Group({tokens, min: item.min, max: item.max});\n }\n\n } else { // Basic Tokens\n switch (item.type) {\n case \"space\": return new Space();\n case \"constant\": return new Constant({name: item.value});\n case \"variable\": return new Variable({name: item.name, type: item.dataType, remainder: !!item.remainder});\n case \"delimiter\": return new Delimiter({value: item.value});\n }\n }\n\n }).filter(t => !!t);\n\n if (sequenceTokens.length > 1) {\n return new Sequence({tokens: sequenceTokens});\n\n } else if (sequenceTokens.length === 1) {\n return sequenceTokens[0];\n }\n\n }).filter(t => !!t);\n\n if (orTokens.length > 1) {\n return new Group({tokens: orTokens, min: 0, max: 1}); // Choose 1\n\n } else if (orTokens.length === 1) {\n return orTokens[0];\n }\n\n }).filter(t => !!t);\n}", "function split(startI, endI, type, innerOffset, length) {\n let i = startI;\n while (b[i + 2] + off <= node.from)\n i = b[i + 3];\n let children = [], positions = [];\n sliceBuf(buf, startI, i, children, positions, innerOffset);\n let from = b[i + 1], to = b[i + 2];\n let isTarget = from + off == node.from && to + off == node.to && b[i] == node.type.id;\n children.push(isTarget ? node.toTree() : split(i + 4, b[i + 3], buf.set.types[b[i]], from, to - from));\n positions.push(from - innerOffset);\n sliceBuf(buf, b[i + 3], endI, children, positions, innerOffset);\n return new Tree(type, children, positions, length);\n }", "getTree() {\n\n return ['array'].concat(this.elements.map(elem => elem.getTree()));\n }", "function deepFlatten(strList, array) {\n for (const item of array) {\n if (Array.isArray(item)) {\n deepFlatten(strList, item);\n } // else if (item instanceof Declaration) {\n // strList.push(item.toString());\n // }\n else {\n strList.push(item);\n }\n }\n }", "_getTokenCompletionPath (token, cur, cm) {\n let currentToken = token\n let line = cur.line\n const tokenContext = []\n\n while (line >= 0 && !this._isTopLevelProperty(currentToken)) {\n currentToken = this._getYamlToken(cm, CodeMirror.Pos(line, 0))\n if (this._isCurrentTokenParentOfToken(currentToken, token) &&\n this._isCurrentTokenIndentSmallerThanContextRoot(currentToken, tokenContext)) {\n if (currentToken.type === 'property') {\n tokenContext.unshift(currentToken)\n } else if (currentToken.type === 'firstArrayItem') {\n tokenContext.unshift(currentToken)\n }\n }\n line--\n }\n\n // token context contains all parent tokens of `token, except for the token itself\n const tokenPath = flatMap(tokenContext, (pathToken, index, tokenContext) => {\n const isLeafContextToken = pathToken === last(tokenContext)\n switch (pathToken.type) {\n case 'property': {\n const nextToken = nth(tokenContext, index + 1)\n if (nextToken && nextToken.type === 'firstArrayItem') {\n // next item is array, so don't append 'properties' to path\n return pathToken.propertyName\n }\n if (isLeafContextToken && token.type === 'firstArrayItem') {\n // leaf context token is array, so list properties of its items\n return [pathToken.propertyName, 'items', 'properties']\n }\n // regular property token\n return [pathToken.propertyName, 'properties']\n }\n case 'firstArrayItem': {\n const isTokenIndentIndicatingObjectStart = token.start === pathToken.indent + this.indentUnit + this.arrayBulletIndent\n if (pathToken.propertyName !== undefined && isLeafContextToken && isTokenIndentIndicatingObjectStart) {\n // firstArrayItem line can also start new object, so list properties of item object\n return ['items', 'properties', pathToken.propertyName, 'properties']\n }\n // path token is array, so list properties of its items\n return ['items', 'properties']\n }\n }\n return []\n })\n\n return tokenPath\n }", "function flattenPipeline(jq) {\n var result = [];\n (function recur(jq) {\n if (jq.type === 'Pipe') {\n recur(jq.left);\n recur(jq.right);\n } else {\n result.push(jq);\n }\n })(jq);\n return result;\n}", "NodeArray(st) {\n const len = st.length;\n let multipleStatementsEncountered = false;\n for (let i = 0; i < len; i++) {\n const s = st[i];\n const newS = this[s.type](s);\n if (newS === undefined) {\n console.log(\"Got undefined processing the following:\");\n console.log(s);\n }\n st[i] = newS;\n if (st[i].type === \"MultipleStatements\") {\n multipleStatementsEncountered = true;\n }\n }\n if (multipleStatementsEncountered) {\n let n = new Array();\n for (let i = 0; i < len; i++) {\n const s = st[i];\n if (s.type === \"MultipleStatements\") {\n n.push(...s.body);\n }\n else {\n n.push(s);\n }\n }\n return n;\n }\n return st;\n }", "getTree() {\n\n return [\n 'procedure',\n this.params,\n this.body ? this.body.getTree() : null,\n this.isService\n ];\n }", "function astGenH (depth) {\n\t\tif (depth == 0) {\n\t\t for (var leaf of leaves) \n\t\t\tyield leaf;\n\t\t} else {\n\t\t for (var op of binops) //try non-concatenation operators *last* \n\t\t\tfor (var left of astGenH(depth - 1)) {\n\t\t\t for (var right of astGenH(depth - 1))\n\t\t\t\tyield \"\" + left + op + right;\n\t\t\t if (left != \"\") {\n\t\t\t //hasParens = true;\n\t\t\t \tyield \"(\" + left + \")\";\n\t\t\t \t//hasParens = false;\n\t\t\t }\n\t\t\t}\n\t\t}\n\t}", "function extractInternalsFromBrackets(parts, token, indexOffset = 0){\n var depth = -1;\n var args = [];\n for( var i = indexOffset; i < parts.length; i++){\n var inversToken = getInversToken(token);\n var startingIndex;\n var intermediateIndex;\n switch(parts[i]){\n\n case token:\n if(depth < 0)\n intermediateIndex = startingIndex = i + 1;\n depth++;\n break;\n\n case inversToken:\n if(depth == 0){\n args.push(parts.slice(intermediateIndex,i))\n return { endingIndex: i, startingIndex, args };\n }\n depth--;\n break;\n\n case \",\":\n if(depth == 0 && token === \"(\"){\n args.push(parts.slice(intermediateIndex,i));\n intermediateIndex = i + 1;\n }\n break;\n\n default:\n if(token === \"(\" && parts[i].match(/\\($/)){\n if(depth < 0)\n intermediateIndex = startingIndex = i + 1;\n depth++;\n break;\n }\n }\n }\n err(`Missing ${inversToken}`);\n return;\n }", "parse() {\n // We expect at least one tree selector\n const ts = this.parseTreeSelector();\n\n // Now see what's next\n let token = this.nextToken();\n\n // If there is no next token then we're done parsing and can return\n // the tree selector object we got above\n if (!token) {\n return ts;\n }\n\n // Otherwise, there is more go come and we're going to need a\n // list of tree selectors\n const treeSelectors = [ts];\n while (token) {\n // The only character we allow after a tree selector is a comma\n if (token === \",\") {\n this.consume();\n } else {\n throw new ParseError(\"Expected comma\");\n }\n\n // And if we saw a comma, then it must be followed by another\n // tree selector\n treeSelectors.push(this.parseTreeSelector());\n token = this.nextToken();\n }\n\n // If we parsed more than one tree selector, return them in a\n // SelectorList object.\n return new SelectorList(treeSelectors);\n }", "function splitSequences(ast) {\n // BEFORE: (a = 1, b = 2)\n // AFTER: a = 1; b = 2;\n query(ast, 'SequenceExpression').forEach(function (node) {\n var prop = \"body\";\n var container = node.parent;\n var self = node;\n if (container.type === \"ExpressionStatement\") {\n self = container;\n container = container.parent;\n }\n if (container.type === \"SwitchCase\") {\n prop = \"consequent\";\n }\n if (!container[prop]) return;\n var index = container[prop].indexOf(self);\n var splitted = [];\n node.expressions.forEach(function (expression) {\n var statement = {\n type: \"ExpressionStatement\",\n expression: expression\n };\n statement.parent = container;\n expression.parent = statement;\n splitted.push(statement);\n });\n container[prop].splice.apply(container[prop], [index, 1].concat(splitted));\n });\n}", "function parse(lexemes) {\n var componentTree = [];\n for (var i = 0; i < lexemes.length;) {\n var cucc = parseContent(i, lexemes);\n componentTree.push(cucc.content);\n i = cucc.i;\n }\n return componentTree;\n}", "function postProcess(state) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== delimiter.charCodeAt(0)) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = `${ruleName}_open` \n token.tag = 'span';\n token.attrs = [['class', ruleName]];\n token.nesting = 1;\n token.markup = delimiter;\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = `${ruleName}_close` \n token.tag = 'span';\n token.nesting = -1;\n token.markup = delimiter;\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === delimiter.charAt(0)) {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === `${ruleName}_close`) {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n }", "function tokenize(code){\n\t// split\n\tcode = code.match(/\\^.|./g);\n\t// depth\n\tvar depth = [0,0];\n\tvar open = \"[{\";\n\tvar close = \"]}\";\n\tfor(var i=0;i<code.length;i++){\n\t\tvar ind1 = open.indexOf(code[i]);\n\t\tvar ind2 = close.indexOf(code[i]);\n\t\tif(ind1+1){\n\t\t\tcode[i]+=depth[ind1]++;\n\t\t} else if(ind2+1){\n\t\t\tcode[i]+=--depth[ind2];\n\t\t}\n\t}\n\treturn code;\n}", "getTree() {\n\n return [\n 'apply',\n this.address.getTree(),\n this.args.map(arg => arg.getTree()),\n this.block\n ];\n }", "parse() {\n // We expect at least one tree selector\n var ts = this.parseTreeSelector(); // Now see what's next\n\n var token = this.nextToken(); // If there is no next token then we're done parsing and can return\n // the tree selector object we got above\n\n if (!token) {\n return ts;\n } // Otherwise, there is more go come and we're going to need a\n // list of tree selectors\n\n\n var treeSelectors = [ts];\n\n while (token) {\n // The only character we allow after a tree selector is a comma\n if (token === \",\") {\n this.consume();\n } else {\n throw new ParseError$2(\"Expected comma\");\n } // And if we saw a comma, then it must be followed by another\n // tree selector\n\n\n treeSelectors.push(this.parseTreeSelector());\n token = this.nextToken();\n } // If we parsed more than one tree selector, return them in a\n // SelectorList object.\n\n\n return new SelectorList(treeSelectors);\n }", "function getModelTree(objectsArray, filePath) {\n const tree = {};\n const treeCommand = part => `mged -c ${filePath} tree -a -i 2 ${part} 2>&1`;\n for (const obj of objectsArray) {\n const currentObject = (tree[\n obj[obj.length - 1] === \"/\" ? obj.substring(0, obj.length - 1) : obj\n ] = {});\n if (obj[obj.length - 1] === \"/\") {\n let lines = execSync(treeCommand(obj.substring(0, obj.length - 1)), {\n encoding: \"UTF-8\"\n });\n lines = lines.split(\"\\n\");\n let prevIndent = 0;\n let road = [currentObject]; // eslint-disable-line\n for (const line of lines) {\n const args = line.split(/ +/);\n if (args[1] === \"@\") {\n road[road.length - 1][args[2]] = args[3];\n }\n if (args[1] === \"u\" && trimR(args[2]) !== args[2]) {\n const indent = /^ +/.exec(line);\n let indentLength = 0;\n if (indent) {\n indentLength = indent[0].length;\n }\n const indentChange = indentLength - prevIndent;\n if (indentChange < 0) {\n road.pop();\n if (road[road.length - 1] === {}) {\n delete road[road.length - 1];\n }\n for (let i = indentChange; i < 0; i += 2) {\n road.pop();\n }\n road.push((road[road.length - 1][trimR(args[2])] = {}));\n } else if (indentChange > 0) {\n road.push((road[road.length - 1][trimR(args[2])] = {}));\n } else if (indentChange === 0) {\n road.pop();\n road.push((road[road.length - 1][trimR(args[2])] = {}));\n }\n prevIndent = indentLength;\n }\n }\n }\n }\n return tree;\n}", "function parseNewick(txt)\n {\n var ancestors = [];\n var tree = {};\n try {\n var tokens = txt.split(/\\s*(;|\\(|\\)|,|:)\\s*/);\n for (var i=0; i<tokens.length; i++) {\n var token = tokens[i];\n switch (token) {\n case '(': // new children\n var subtree = {};\n tree.children = [subtree];\n ancestors.push(tree);\n tree = subtree;\n break;\n case ',': // another branch\n var subtree = {};\n ancestors[ancestors.length-1].children.push(subtree);\n tree = subtree;\n break;\n case ')': // optional name next\n tree = ancestors.pop();\n break;\n case ':': // optional length next\n break;\n default:\n var x = tokens[i-1];\n if (x == ')' || x == '(' || x == ',') {\n tree.name = token;\n } else if (x == ':') {\n tree.length = parseFloat(token);\n }\n }\n }\n }\n catch(err) {\n moduleData.parseError = err;\n return false;\n }\n\n return tree;\n }", "constructor(data) {\n let temp = data.split('\\n').map(item => {\n return item.split(',')\n })\n let label = temp.shift()\n\n let result = []\n\n for (var node of temp) {\n let json = {}\n for (var variable in node) {\n json[label[variable]] = node[variable]\n }\n result.push(json)\n }\n\n this.nodes = result\n }", "function getSplits(node, context) {\n var res = [];\n var right, rightArgs;\n var makeNode = createMakeNodeFunction(node);\n if (isCommutative(node, context)) {\n for (var i=0; i<node.args.length; i++) {\n rightArgs = node.args.slice(0);\n rightArgs.splice(i, 1);\n right = (rightArgs.length === 1) ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[i], right]));\n }\n }\n else {\n rightArgs = node.args.slice(1);\n right = (rightArgs.length === 1) ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[0], right]));\n }\n return res;\n }", "function getSplits(node, context) {\n var res = [];\n var right, rightArgs;\n var makeNode = createMakeNodeFunction(node);\n if (isCommutative(node, context)) {\n for (var i=0; i<node.args.length; i++) {\n rightArgs = node.args.slice(0);\n rightArgs.splice(i, 1);\n right = (rightArgs.length === 1) ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[i], right]));\n }\n }\n else {\n rightArgs = node.args.slice(1);\n right = (rightArgs.length === 1) ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[0], right]));\n }\n return res;\n }", "function postProcess(state) {\n var i, j,\n startDelim,\n endDelim,\n token,\n loneMarkers = [],\n delimiters = state.delimiters,\n max = state.delimiters.length;\n\n for (i = 0; i < max; i++) {\n startDelim = delimiters[i];\n\n if (startDelim.marker !== 0x2B/* + */) {\n continue;\n }\n\n if (startDelim.end === -1) {\n continue;\n }\n\n endDelim = delimiters[startDelim.end];\n\n token = state.tokens[startDelim.token];\n token.type = 'ins_open';\n token.tag = 'ins';\n token.nesting = 1;\n token.markup = '++';\n token.content = '';\n\n token = state.tokens[endDelim.token];\n token.type = 'ins_close';\n token.tag = 'ins';\n token.nesting = -1;\n token.markup = '++';\n token.content = '';\n\n if (state.tokens[endDelim.token - 1].type === 'text' &&\n state.tokens[endDelim.token - 1].content === '+') {\n\n loneMarkers.push(endDelim.token - 1);\n }\n }\n\n // If a marker sequence has an odd number of characters, it's splitted\n // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the\n // start of the sequence.\n //\n // So, we have to move all those markers after subsequent s_close tags.\n //\n while (loneMarkers.length) {\n i = loneMarkers.pop();\n j = i + 1;\n\n while (j < state.tokens.length && state.tokens[j].type === 'ins_close') {\n j++;\n }\n\n j--;\n\n if (i !== j) {\n token = state.tokens[j];\n state.tokens[j] = state.tokens[i];\n state.tokens[i] = token;\n }\n }\n }", "function getSplits(node, context) {\n var res = [];\n var right, rightArgs;\n var makeNode = createMakeNodeFunction(node);\n\n if (isCommutative(node, context)) {\n for (var i = 0; i < node.args.length; i++) {\n rightArgs = node.args.slice(0);\n rightArgs.splice(i, 1);\n right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[i], right]));\n }\n } else {\n rightArgs = node.args.slice(1);\n right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[0], right]));\n }\n\n return res;\n }", "function getSplits(node, context) {\n var res = [];\n var right, rightArgs;\n var makeNode = createMakeNodeFunction(node);\n\n if (isCommutative(node, context)) {\n for (var i = 0; i < node.args.length; i++) {\n rightArgs = node.args.slice(0);\n rightArgs.splice(i, 1);\n right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[i], right]));\n }\n } else {\n rightArgs = node.args.slice(1);\n right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[0], right]));\n }\n\n return res;\n }", "function getSplits(node, context) {\n var res = [];\n var right, rightArgs;\n var makeNode = createMakeNodeFunction(node);\n\n if (isCommutative(node, context)) {\n for (var i = 0; i < node.args.length; i++) {\n rightArgs = node.args.slice(0);\n rightArgs.splice(i, 1);\n right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[i], right]));\n }\n } else {\n rightArgs = node.args.slice(1);\n right = rightArgs.length === 1 ? rightArgs[0] : makeNode(rightArgs);\n res.push(makeNode([node.args[0], right]));\n }\n\n return res;\n }", "static tag_lines(raw)\r\n {\r\n let lines = [];\r\n let next_is_def = false;\r\n let in_code_block = false;\r\n let in_quote_block = false;\r\n for (const [index, value] of raw.entries())\r\n {\r\n let trimmed = value.trim();\r\n if (in_code_block)\r\n {\r\n lines.push(new Line(value, 'code'))\r\n }\r\n else if (in_quote_block)\r\n {\r\n lines.push(new Line(value, 'quote'))\r\n }\r\n else if (trimmed.length === 0)\r\n {\r\n lines.push(new Line('', 'empty'));\r\n }\r\n // Titles :\r\n else if (trimmed[0] === '#')\r\n {\r\n lines.push(new Line(trimmed, 'title'));\r\n }\r\n // HR :\r\n else if ((trimmed.match(/-/g)||[]).length === trimmed.length)\r\n {\r\n lines.push(new Line('', 'separator'));\r\n }\r\n // Lists, line with the first non empty character is \"* \" or \"+ \" or \"- \" :\r\n else if (trimmed.substring(0, 2) === '* ')\r\n {\r\n lines.push(new Line(value, 'unordered_list'));\r\n }\r\n else if (trimmed.substring(0, 2) === '+ ')\r\n {\r\n lines.push(new Line(value, 'ordered_list'));\r\n }\r\n else if (trimmed.substring(0, 2) === '- ')\r\n {\r\n lines.push(new Line(value, 'reverse_list'));\r\n }\r\n // Keywords, line with the first non empty character is \"!\" :\r\n // var, const, include, require, css, html, comment\r\n else if (trimmed.startsWith('!var '))\r\n {\r\n lines.push(new Line(trimmed, 'var'));\r\n }\r\n else if (trimmed.startsWith('!const '))\r\n {\r\n lines.push(new Line(trimmed, 'const'));\r\n }\r\n else if (trimmed.startsWith('!include '))\r\n {\r\n lines.push(new Line(trimmed, 'include'));\r\n }\r\n else if (trimmed.startsWith('!require '))\r\n {\r\n lines.push(new Line(trimmed, 'require'));\r\n }\r\n else if (trimmed.startsWith('!css '))\r\n {\r\n lines.push(new Line(trimmed, 'css'));\r\n }\r\n else if (trimmed.startsWith('!html'))\r\n {\r\n lines.push(new Line(trimmed, 'html'));\r\n }\r\n else if (trimmed.substring(0, 2) === '//')\r\n {\r\n lines.push(new Line(trimmed, 'comment'));\r\n }\r\n // Block of code\r\n else if (trimmed.substring(0, 2) === '@@@')\r\n {\r\n in_code_block = !in_code_block;\r\n lines.push(new Line(value, 'code'))\r\n }\r\n else if (trimmed.substring(0, 2) === '@@' && trimmed.substring(trimmed.length-2, trimmed.length) !== '@@') // :TODO: Escaping @@ in code for Ruby. @@code@@ should be a <p> not a <pre>!\r\n {\r\n lines.push(new Line(value, 'code'));\r\n }\r\n // Block of quote\r\n else if (trimmed.substring(0, 2) === '>>>')\r\n {\r\n in_quote_block = !in_quote_block;\r\n lines.push(new Line(value, 'quote'))\r\n }\r\n else if (trimmed.substring(0, 2) === '>>')\r\n {\r\n lines.push(new Line(value, 'quote'));\r\n }\r\n // Labels\r\n else if (trimmed.substring(0, 2) === '::')\r\n {\r\n lines.push(new Line(trimmed, 'label'));\r\n }\r\n // Div (Si la ligne entière est {{ }}, c'est une div. On ne fait pas de span d'une ligne)\r\n else if (trimmed.substring(0, 2) === '{{' && trimmed.substring(trimmed.length - 2) === '}}')\r\n {\r\n lines.push(new Line(trimmed, 'div'));\r\n }\r\n // Tables\r\n else if (trimmed[0] === '|' && trimmed[trimmed.length - 1] === '|')\r\n {\r\n lines.push(new Line(trimmed, 'row'));\r\n }\r\n // Definition lists\r\n else if (trimmed.substring(0, 2) === '$ ')\r\n {\r\n lines.push(new Line(trimmed.substring(2), 'definition-header'));\r\n next_is_def = true;\r\n }\r\n else\r\n {\r\n if (!next_is_def)\r\n {\r\n lines.push(new Line(trimmed, 'text'));\r\n }\r\n else\r\n {\r\n lines.push(new Line(trimmed, 'definition-content'));\r\n next_is_def = false;\r\n }\r\n }\r\n }\r\n return lines;\r\n }", "toIndexedTree() {\r\n let builderIndex = -1;\r\n let lastOpId = -1;\r\n const idIndexMap = [];\r\n return this.toArray().map((op, index, arr) => {\r\n const opId = ++builderIndex;\r\n // track the array index => opId relationship\r\n idIndexMap.push(opId);\r\n // do path replacements\r\n op.path = opSetPathParamId(idIndexMap, opSetId(opId.toString(), op.path));\r\n if (lastOpId >= 0) {\r\n // if we have a parent do the replace\r\n op.path = opSetParentId(lastOpId.toString(), op.path);\r\n }\r\n // rewrite actions with placeholders replaced\r\n op.actions = op.actions.map(a => {\r\n const actionId = ++builderIndex;\r\n return opSetId(actionId.toString(), opSetPathId(opId.toString(), a));\r\n });\r\n // handle any specific child relationships\r\n this.getChildRelationship(index).forEach(childIndex => {\r\n // set the parent id for our non-immediate children, thus removing the token so it isn't overwritten\r\n arr[childIndex].path = opSetParentId(opId.toString(), arr[childIndex].path);\r\n });\r\n // and remember our last object path id for the parent replace above\r\n lastOpId = opId;\r\n return op;\r\n });\r\n }", "function parseTree(text, errors, options) {\n if (errors === void 0) { errors = []; }\n if (options === void 0) { options = ParseOptions.DEFAULT; }\n var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: void 0 }; // artificial root\n function ensurePropertyComplete(endOffset) {\n if (currentParent.type === 'property') {\n currentParent.length = endOffset - currentParent.offset;\n currentParent = currentParent.parent;\n }\n }\n function onValue(valueNode) {\n currentParent.children.push(valueNode);\n return valueNode;\n }\n var visitor = {\n onObjectBegin: function (offset) {\n currentParent = onValue({ type: 'object', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onObjectProperty: function (name, offset, length) {\n currentParent = onValue({ type: 'property', offset: offset, length: -1, parent: currentParent, children: [] });\n currentParent.children.push({ type: 'string', value: name, offset: offset, length: length, parent: currentParent });\n },\n onObjectEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onArrayBegin: function (offset, length) {\n currentParent = onValue({ type: 'array', offset: offset, length: -1, parent: currentParent, children: [] });\n },\n onArrayEnd: function (offset, length) {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onLiteralValue: function (value, offset, length) {\n onValue({ type: getLiteralNodeType(value), offset: offset, length: length, parent: currentParent, value: value });\n ensurePropertyComplete(offset + length);\n },\n onSeparator: function (sep, offset, length) {\n if (currentParent.type === 'property') {\n if (sep === ':') {\n currentParent.colonOffset = offset;\n }\n else if (sep === ',') {\n ensurePropertyComplete(offset);\n }\n }\n },\n onError: function (error, offset, length) {\n errors.push({ error: error, offset: offset, length: length });\n }\n };\n visit(text, visitor, options);\n var result = currentParent.children[0];\n if (result) {\n delete result.parent;\n }\n return result;\n}", "function parse(array,tree){\n\tvar currentToken = 0;\n\tvar parseString = \"\";\n var cstString = \"\";\n var astString = \"\";\n\tvar errors = false;\n var cstDepth = 0;\n var astDepth = 0;\n\n //Boolean assist\n var boolDepth = 0;\n\n //Add assist\n var addDepth = 0;\n\n //Tree Object Vars\n var asTree = new Tree();\n var scope = -1;\n var blockList = [];\n var string = \"\";\n\n //Symbol Table Helpers\n var symbolArray = []; //array of declared symbols\n\n var returnArr;\n \n parseString += \"PARSER: parse()\\n\";\n\n parseProgram();\n\n returnArr = [errors, parseString, cstString, astString, asTree, symbolArray];\n return returnArr;\n\n\tfunction treeMaker(e){\n\t\tvar treeBranch = \"\";\n\t\tif(e > 0){\n\t\t\tfor(l = 0; l < e; l++){\n\t\t\t\ttreeBranch+=\"-\";\n\t\t\t}\n\t\t}\n\t\treturn treeBranch;\n }\n\n\tfunction match(t){\n\t\tif(array[currentToken][0] != t && errors == false){\n\t\t\tparseString+= \"PARSER: ERROR: Expected \" + t + \" got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t} else if(array[currentToken][0] != t){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t} else {\n\t\t\tcstString+= treeMaker(cstDepth)+\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseProgram(){\n\t\tparseString+= \"PARSER: parseProgram()\\n\";\n\t\tcstString+= \"<Program>\\n\";\n\t\tparseBlock([0]);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_EOP\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBlock(arr){\n\t\tparseString+= \"PARSER: parseBlock()\\n\";\n \n //CST\n cstDepth++;\n\t\tcstString+= treeMaker(cstDepth)+\"<Block>\\n\";\n cstDepth++;\n //AST\n astString+= treeMaker(astDepth)+\"< BLOCK >\\n\";\n astDepth++;\n\n //Tree\n scope++;\n blockList.push([\"BLOCK\", array[currentToken][2], scope]); //add block to blocklist\n\n if (arr.length == 1){\n if (scope > 0){\n asTree.add(blockList[scope],blockList[scope-1]); //parent will be previous scope's block node\n } else {\n asTree.add(blockList[scope]);\n }\n } else {\n asTree.add(blockList[scope], arr); //parent will be if or while\n }\n\n\t\tmatch(\"T_LBRACE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n parseStatementList();\n \n scope--;\n\n\t\tmatch(\"T_RBRACE\");\n \n cstDepth--;\n astDepth--;\n \n if(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseStatementList(){\n parseString+= \"PARSER: parseStatementList()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement List>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\" || array[currentToken][0]==\"T_ID\" || \n\t\t array[currentToken][0]==\"T_VAR_TYPE_INT\" || array[currentToken][0]==\"T_VAR_TYPE_STRING\" ||\n\t\t array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\" || array[currentToken][0]==\"T_WHILE\" ||\n\t\t array[currentToken][0]==\"T_IF\" || array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tcstDepth++;\n\t\t\tparseStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tcstDepth-=2;\n\t\t\tparseStatementList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseStatement(){\n parseString+= \"PARSER: parseStatement()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Statement>\\n\";\n \n\t\tif(array[currentToken][0]==\"T_PRINT\"){\n\t\t\tparsePrintStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseAssignmentStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_INT\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_STRING\" || \n\t\t\t\tarray[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tparseVarDecl();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_WHILE\"){\n\t\t\tparseWhileStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_IF\"){\n\t\t\tparseIfStatement();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_LBRACE\"){\n\t\t\tparseBlock([0]);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected print/id/int/string/boolean/while/if/lbrace got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parsePrintStatement(){\n parseString+= \"PARSER: parsePrintStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Print Statement>\\n\";\n //AST\n astString+= treeMaker(astDepth) + \"< Print Statement >\\n\";\n\n //Tree\n var printNode = [\"Print Statement\", array[currentToken][2], scope];\n asTree.add(printNode,blockList[scope]); //add [print node, parent block]\n \n\t\tmatch(\"T_PRINT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_LPAREN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n \n astDepth++;\n\n\t\tparseExpr(printNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n match(\"T_RPAREN\");\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseAssignmentStatement(){\n\t\tparseString+= \"PARSER: parseAssignmentStatement()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Assignment Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Assignment Statement >\\n\";\n astDepth++;\n \n //Tree\n var assignmentNode = [\"Assignment Statement\", array[currentToken][2],scope];\n\n asTree.add(assignmentNode, blockList[scope]); //add [assignment node, parent block]\n\n parseId(assignmentNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_ASSIGN\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseExpr(assignmentNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseVarDecl(){\n\t\tparseString+= \"PARSER: parseVarDecl()\\n\";\n \n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<Variable Declaration Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< Variable Declaration >\\n\";\n astDepth++;\n\n //Tree\n var declarationNode = [\"Variable Declaration\", array[currentToken][2], scope];\n\n asTree.add(declarationNode, blockList[scope]); //add [variable decl node, parent block]\n\n //Symbol Table Helper\n\n symbolArray.push([array[currentToken + 1][1], array[currentToken][1], scope, array[currentToken][2]]);\n\n\t\tparseType(declarationNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseId(declarationNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseWhileStatement(){\n\t\tparseString+= \"PARSER: parseWhileStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<While Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< While Statement >\\n\";\n astDepth++;\n\n //Tree\n var whileNode = [\"While Statement\", array[currentToken][2], scope];\n\n asTree.add(whileNode, blockList[scope]); //add [while node, parent block]\n\n\t\tmatch(\"T_WHILE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(whileNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(whileNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseIfStatement(){\n\t\tparseString+= \"PARSER: parseIfStatement()\\n\";\n //CST\n cstDepth++;\n cstString+= treeMaker(cstDepth)+\"<If Statement>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"< If Statement >\\n\";\n astDepth++;\n\n //Tree\n var ifNode = [\"If Statement\", array[currentToken][2], scope];\n\n asTree.add(ifNode, blockList[scope]); //add [if node, parent block]\n\n\t\tmatch(\"T_IF\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseBooleanExpr(ifNode);\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n parseBlock(ifNode);\n \n astDepth--;\n\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseExpr(arr){\n\t\tparseString+= \"PARSER: parseExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Expression>\\n\";\n\n\t\tif(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseIntExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_QUOTE\"){\n\t\t\tparseStringExpr(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n else if (array[currentToken][0] == \"T_LPAREN\"){\n parseBooleanExpr(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if (array[currentToken][0] == \"T_FALSE\" ||\n array[currentToken][0] == \"T_TRUE\"){\n parseBoolVal(arr);\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_ID\"){\n\t\t\tparseId(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT or T_QUOTE or T_LPAREN or T_ID or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n }\n\n\tfunction parseIntExpr(arr){\n parseString+= \"PARSER: parseIntExpr()\\n\";\n //CST\n cstString+= treeMaker(cstDepth)+\"<Integer Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_DIGIT\" && array[currentToken+1][0]==\"T_ADD\"){\n //AST\n astString += treeMaker(astDepth) + \"< Add >\\n\";\n astDepth++;\n addDepth++;\n\n //Tree\n var addNode = [\"Add\", array[currentToken][2], scope, addDepth];\n\n asTree.add(addNode, arr); //add [add node, parent]\n\n\t\t\tparseDigit(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseIntOp();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(addNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_DIGIT\"){\n\t\t\tparseDigit(arr);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_DIGIT got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n }\n //astDepth--;\n\t}\n\n\tfunction parseStringExpr(arr){\n\t\tparseString+= \"PARSER: parseStringExpr()\\n\";\n cstString+= treeMaker(cstDepth)+\"<String Expression>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \";\n\n string = \"\"; //reset variable\n var stringLine = array[currentToken][2];\n\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tparseCharList();\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t\tmatch(\"T_QUOTE\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n //AST\n astString += \" ]\\n\";\n //ADD THE RIGHT STRING NODE TO THE AST\n //Tree\n var stringNode = [\"T_STRING\", string, stringLine,scope];\n asTree.add(stringNode, arr); //add [string node, parent]\n string = \"\"; //reset variable\n\n\t}\n\n\tfunction parseBooleanExpr(arr){\n\t\tparseString+= \"PARSER: parseBooleanExpr()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Boolean Expression>\\n\";\n\t\tif(array[currentToken][0]==\"T_LPAREN\"){\n //AST\n astString += treeMaker(astDepth) + \"< Boolean Expression >\\n\";\n astDepth++;\n boolDepth++;\n //Tree\n var boolExpNode = [\"Boolean Expression\", array[currentToken][2], scope, boolDepth];\n asTree.add(boolExpNode, arr); //add [bool exp node, parent block]\n\t\t\tmatch(\"T_LPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseBoolOp(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseExpr(boolExpNode);\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n match(\"T_RPAREN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n }\n astDepth--;\n } else if (array[currentToken][0] == \"T_TRUE\" || array[currentToken][0] == \"T_FALSE\"){\n parseBoolVal(arr);\n if(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n } else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_LPAREN or T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseId(arr){\n\t\tparseString+= \"PARSER: parseId()\\n\";\n cstString+= treeMaker(cstDepth)+\"<ID>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n \n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [id node, parent]\n \n match(\"T_ID\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\t\t\n\t}\n\n\tfunction parseCharList(){\n\t\tparseString+= \"PARSER: parseCharList()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Character List>\\n\";\n if (array[currentToken][0] == \"T_CHAR\" && array[currentToken][1] == \" \") {\n parseSpace();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n parseCharList();\n if (errors) {\n returnArr = [errors, parseString, cstString];\n return returnArr;\n }\n }\n else if(array[currentToken][0]==\"T_CHAR\"){\n\t\t\tparseChar();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t\tparseCharList();\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\t//empty set\n\t\t}\n\t}\n\n\tfunction parseType(arr){\n\t\tparseString+= \"PARSER: parseType()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Type>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tif(array[currentToken][0]==\"T_VAR_TYPE_INT\"){\n\t\t\tmatch(\"T_VAR_TYPE_INT\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_STRING\"){\n\t\t\tmatch(\"T_VAR_TYPE_STRING\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_VAR_TYPE_BOOLEAN\"){\n\t\t\tmatch(\"T_VAR_TYPE_BOOLEAN\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_VAR_TYPE_INT/STRING/BOOLEAN got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseChar(){\n\t\tparseString+= \"PARSER: parseChar()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tmatch(\"T_CHAR\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n }\n\t}\n\n\tfunction parseSpace(){\n\t\tparseString+= \"PARSER: parseSpace()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Space Character>\\n\";\n //AST\n astString += array[currentToken][1];\n string += array[currentToken][1];\n\t\tif(array[currentToken][1] != \" \"){\n\t\t\tparseString+= \"PARSER: ERROR: Expected ' ' got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t} else {\n cstString += treeMaker(cstDepth) +\"[\" + array[currentToken][1] + \"]\\n\";\n\t\t\tcurrentToken++;\n\t\t}\n\t}\n\n\tfunction parseDigit(arr){\n\t\tparseString+= \"PARSER: parseDigit()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Digit>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [type node, parent]\n\t\tmatch(\"T_DIGIT\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n\n\tfunction parseBoolOp(arr){\n\t\tparseString+= \"PARSER: parseBoolOp()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Operator>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool op node, parent]\n\t\tif(array[currentToken][0]==\"T_EQ\"){\n\t\t\tmatch(\"T_EQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_INEQ\"){\n\t\t\tmatch(\"T_INEQ\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_EQ or T_INEQ got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors=true;\n\t\t}\n\t}\n\n\tfunction parseBoolVal(arr){\n\t\tparseString+= \"PARSER: parseBoolVal()\\n\";\n cstString+= treeMaker(cstDepth)+\"<Boolean Value>\\n\";\n //AST\n astString += treeMaker(astDepth) + \"[ \" + array[currentToken][1] + \" ]\\n\";\n //Tree\n array[currentToken].push(scope);\n asTree.add(array[currentToken], arr); //add [bool val node, parent]\n\t\tif(array[currentToken][0]==\"T_FALSE\"){\n\t\t\tmatch(\"T_FALSE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t}\n\t\telse if(array[currentToken][0]==\"T_TRUE\"){\n\t\t\tmatch(\"T_TRUE\");\n\t\t\tif(errors){\n\t\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\t\treturn returnArr;\n\t\t\t}\n\t\t} else {\n\t\t\tparseString+= \"PARSER: ERROR: Expected T_TRUE or T_FALSE got \" + \n\t\t\tarray[currentToken][0] + \" with value '\" + \n\t\t\tarray[currentToken][1] + \"' on line \" + array[currentToken][2] + \"\\n\";\n\t\t\terrors = true;\n\t\t}\n\t}\n\n\tfunction parseIntOp(){\n\t\tparseString+= \"PARSER: parseIntOp()\\n\";\n\t\tcstString+= treeMaker(cstDepth)+\"<Addition>\\n\";\n\t\tmatch(\"T_ADD\");\n\t\tif(errors){\n\t\t\treturnArr = [errors,parseString,cstString];\n\t\t\treturn returnArr;\n\t\t}\n\t}\n}", "function convertType(text, start, end) {\n var s = ''\n if (start == end) {\n s = 'Cannot start and end with the same type! (' + start + ' -> ' + end + ')'\n }\n else if (start == 'CSV' && end == 'JSON') {\n //CSV to JSON\n //The names of each variable is defined in the first line\n var lines = text.split('\\n')\n var names = lines[0].split(',')\n var data = []\n for(var line in lines) {\n if (line == 0) continue\n var dataline = lines[line].split(',')\n var entry = {}\n for(var i in names) {\n if (names[i].includes('.')) {\n //Nested objects, use recursion to fix it!\n entry = recursiveObject(entry, names[i].split('.'), dataline[i])\n }\n else {\n entry[names[i]] = dataline[i]\n }\n }\n data.push(entry)\n }\n s = JSON.stringify(data, null, 2)\n // lines.forEach((line, index) => {\n // if (index != 1) {\n // continue\n // }\n // console.log(i+\": \"+v)\n // var entry = {}\n // for(var i in names) {\n // console.log(i)\n // }\n // })\n }\n else if (start == 'JSON' && end == 'CSV') {\n //JSON to CSV\n var data = JSON.parse(text)\n if(Array.isArray(data)) {\n //Each table is given in each object\n const first = data[0]\n //Get the names of each in first\n for(const i in first) {\n // s += recursiveTitle(i, first[i]) + ','\n if (typeof first[i] == 'object') {\n //Instead of having nested objects, make each variable from within its own entry (in the form parent.child.nextChild.keepGoing.more.maybeMore.name)\n s += recursiveTitle(i, first[i]) + ','\n }\n else {\n s += i + ','\n }\n }\n s = s.substring(0, s.length-1) + '\\n'\n //Go through each data point now\n for(const x in data) {\n // console.log(x)\n var currentPoint = data[x]\n for(const i in currentPoint) {\n if (typeof currentPoint[i] == 'object') {\n s += recursiveValue(i, currentPoint[i]) + ','\n }\n else {\n s += currentPoint[i] + ','\n }\n }\n s = s.substring(0, s.length-1) + '\\n'\n }\n }\n else {\n s = 'JSON was not an array!'\n }\n }\n else {\n s = 'Unkown types: ' + start + ' -> ' + end + '.'\n }\n usedText = s\n document.getElementById('types-output').innerHTML = s\n}", "function match_block(node) {\n if (node.name === \"end\") {\n if (node.parent.name === \"IfStatement\") {\n // Try moving to the \"if\" part because\n // the rest of the code is looking for that\n node = node.parent?.firstChild?.firstChild\n } else {\n node = node.parent.firstChild\n }\n }\n\n if (node == null) {\n return []\n }\n\n // if (node.name === \"StructDefinition\") node = node.firstChild\n if (node.name === \"mutable\" || node.name === \"struct\") {\n if (node.name === \"struct\") node = node.parent.firstChild\n\n let struct_node = node.parent.getChild(\"struct\")\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match || !struct_node) return null\n\n return [\n { from: node.from, to: struct_node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n if (node.name === \"struct\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"quote\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"begin\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"do\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"for\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"let\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"macro\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"function\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"while\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n return [\n { from: node.from, to: node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"type\") node = node.parent.firstChild\n if (node.name === \"abstract\" || node.name === \"primitive\") {\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n let struct_node = node.parent.getChild(\"type\")\n if (!did_match || !struct_node) return null\n\n return [\n { from: node.from, to: struct_node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ]\n }\n\n if (node.name === \"try\" || node.name === \"catch\" || node.name === \"finally\") {\n if (node.name === \"catch\") node = node.parent\n if (node.name === \"finally\") node = node.parent\n\n let try_node = node.parent.firstChild\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n let catch_node = node.parent.getChild(\"CatchClause\")?.firstChild\n let finally_node = node.parent.getChild(\"FinallyClause\")?.firstChild\n\n return [\n { from: try_node.from, to: try_node.to },\n catch_node && { from: catch_node.from, to: catch_node.to },\n finally_node && { from: finally_node.from, to: finally_node.to },\n { from: possibly_end.from, to: possibly_end.to },\n ].filter((x) => x != null)\n }\n\n if (node.name === \"if\" || node.name === \"else\" || node.name === \"elseif\") {\n if (node.name === \"if\") node = node.parent\n if (node.name === \"else\") node = node.parent\n if (node.name === \"elseif\") node = node.parent.parent\n\n let try_node = node.parent.firstChild\n let possibly_end = node.parent.lastChild\n let did_match = possibly_end.name === \"end\"\n if (!did_match) return null\n\n let decorations = []\n decorations.push({ from: try_node.from, to: try_node.to })\n for (let elseif_clause_node of node.parent.getChildren(\"ElseifClause\")) {\n let elseif_node = elseif_clause_node.firstChild\n decorations.push({ from: elseif_node.from, to: elseif_node.to })\n }\n for (let else_clause_node of node.parent.getChildren(\"ElseClause\")) {\n let else_node = else_clause_node.firstChild\n decorations.push({ from: else_node.from, to: else_node.to })\n }\n decorations.push({ from: possibly_end.from, to: possibly_end.to })\n\n return decorations\n }\n\n return null\n}", "function astify(tokens) {\n\n\t\tfunction helper(opening_bracket) {\n\t\t\t// Tree nodes have keys [children, start, end]\n\t\t\tvar result = {children: [], start: opening_bracket ? opening_bracket.start : \"1:1\"};\n\t\t\twhile (tokens.length > 0) {\n\t\t\t\tif (tokens[0].text == \"(\" || tokens[0].text == \"[\") {\n\t\t\t\t\tvar bracket = tokens[0];\n\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\tresult.children.push(helper(bracket));\n\t\t\t\t} else if (tokens[0].text == \")\" || tokens[0].text == \"]\") {\n\t\t\t\t\tif (!opening_bracket || tokens[0].text != brackets_map[opening_bracket.text]) {\n\t\t\t\t\t\tthrow util.make_church_error(\"SyntaxError\", tokens[0].start, tokens[0].end, \"Unexpected close parens\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult[\"end\"] = tokens[0].start;\n\t\t\t\t\t\topening_bracket.end = tokens[0].start;\n\t\t\t\t\t\tstorage.push(tokens.shift());\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar token = tokens.shift();\n\t\t\t\t\tstorage.push(token);\n\t\t\t\t\tresult.children.push(token);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!opening_bracket) {\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\tthrow util.make_church_error(\"SyntaxError\", opening_bracket.start, opening_bracket.end, \"Unclosed parens\");\n\t\t\t}\n\t\t}\n\t\tvar storage = [];\n\t\tvar ast = helper();\n\t\tfor (var i = 0; i < storage.length; i++) {\n\t\t\ttokens.push(storage[i]);\n\t\t}\n\t\treturn ast;\n\t}", "buildTree(tree) {\n alphabet = new Set();\n id_map = [];\n // Prepare initial node\n id = 0;\n followpos = [];\n this.type = CONCAT;\n this.c1 = new Node();\n this.c2 = new Node();\n this.c2.buildNodes({ type: \"Char\", value: \"#\" });\n this.c1.buildNodes(tree);\n this.nullable = this.c1.nullable && this.c2.nullable;\n\n // Set firstpos\n this.firstpos = new Set(this.c1.firstpos);\n if (this.c1.nullable) {\n for (let each of this.c2.firstpos) {\n this.firstpos.add(each);\n }\n }\n // Set lastpos\n this.lastpos = new Set(this.c2.lastpos);\n if (this.c2.nullable) {\n for (let each of this.c1.lastpos) {\n this.lastpos.add(each);\n }\n }\n // Set followpos\n for (let i of this.c1.lastpos) {\n for (let each of this.c2.firstpos) {\n followpos[i].add(each);\n }\n }\n\n alphabet.delete(\"#\");\n }", "function parse(){\n\n var lines = $(\"#code\").val().split(\"\\n\");\n\n var out = \"\";\n\n for(var i=0; i<lines.length; i++){\n\n var line = lines[i];\n console.log(lines[i]);\n\n\n\n // figure out what to do with line contents \n\n\n //1. if it's not an IF or a REPEAT UNTIL then parentheses\n // need to be turned into pipes\n if(line.indexOf(\"IF\") < 0 && line.indexOf(\"UNTIL\") < 0){\n line = line.replace(/[\\(\\)]/g,\"|\");\n }\n\n\n //2. preserve indentation?\n var firstCharPos = line.search(\"[^ ]\");\n var indent = line.substring(0, firstCharPos ); //anything from 0 up to first non-space is indent\n line = line.substring(firstCharPos);\n\n \n // 3. figure out tokens\n\n var beginToken = \"[\"; //defaults\n var endToken = \"]\\n\";\n\n // if it's a block statement it cannot end with a bracket\n if( isBlockStatement(line)){\n endToken = \"\\n\";\n }\n\n //line = line.replace(/[\\}]/g,\"]\");\n //line = line.replace(/[\\{}]/g,\"[\");\n\n if(line.indexOf(\"}\") >= 0){\n out+=\"]]\\n\";\n }\n else if(line.indexOf(\"{\") >= 0){\n out+=\"\"\n }\n else if(line.search(\"[^ \\\\n]\")<0){\n out += \"\\n\";\n }\n else{\n if(i>0 && lines[i-1].indexOf(\"{\")>=0){\n beginToken = \"[[\";\n }\n out+=indent+ beginToken + line + endToken;\n }\n\n }\n\n //$(\"#dump\").val(out);\n //console.debug(out);\n return out;\n}", "function populateChildren(out, content, val, index) {\n if ('children' in val) {\n // convert boolean false to '' and anything else to a string\n content === false && (content = '');\n typeof content !== 'string' && (content = String(content));\n\n var _s = content.split(val.delimiter);\n if ('parent' in val) {\n out[index][val.parent][val.value] = val.children[0] === '*' ? [] : {};\n } else {\n out[index][val.value] = val.children[0] === '*' ? [] : {};\n }\n\n if (val.children[0] === '*') {\n for (var s in _s) {\n if ('parent' in val) {\n out[index][val.parent][val.value].push(_s[s].trim());\n } else {\n out[index][val.value].push(_s[s].trim());\n }\n }\n } else {\n for (var k in val.children) {\n if (k < _s.length) {\n if ('parent' in val) {\n out[index][val.parent][val.value][val.children[k]] = _s[k].trim();\n } else {\n out[index][val.value][val.children[k]] = _s[k].trim();\n }\n }\n }\n }\n } else {\n if ('parent' in val) {\n out[index][val.parent][val.value] = content;\n } else {\n out[index][val.value] = content;\n }\n }\n return out;\n}", "function reformGroups(arr) {\r\n\t\t\r\n\t\tvar extraParenthesis = 0;\r\n\t\tfor (var section = 0; section<arr.length; section++){\r\n\t\t\tif ((arr[section].indexOf('(') !== -1 && arr[section].indexOf(')') === -1) || extraParenthesis > 0) {\r\n\t\t\t\tarr[section] += \",\"+arr[section+1];\r\n\t\t\t\tarr.splice((section+1),1);\r\n\t\t\t\textraParenthesis = (arr[section].split('(').length-1) - (arr[section].split(')').length-1);\r\n\t\t\t\tsection--;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\treturn arr;\r\n\t}", "function getTrees() {\n let trees = [];\n for (let i = 1; i <= 5; i++) {\n let trunkElm = $(`#trunk-${i}`);\n let leavesElm = $(`#leaves-${i}`);\n let startPathTrunk = trunkElm.getAttribute(\"d\");\n let startPathLeaves = leavesElm.getAttribute(\"d\");\n let endPathTrunk = _getEndPath(startPathTrunk);\n let endPathLeaves = _getEndPath(startPathLeaves);\n let obj = {\n leaves: { elm: leavesElm, paths: [startPathLeaves, ...endPathLeaves] },\n trunk: { elm: trunkElm, paths: [startPathTrunk, ...endPathTrunk] },\n tilt: i <= 3 ? \"right\" : \"left\"\n };\n trees.push(obj);\n }\n return trees;\n}", "_toArray(grammar) {\n if (Array.isArray(grammar)) {\n return grammar;\n }\n\n return grammar\n .split('\\n')\n .filter(production => !!production.trim());\n }", "tokenBefore(types) {\n let token = language.syntaxTree(this.state).resolveInner(this.pos, -1);\n while (token && types.indexOf(token.name) < 0)\n token = token.parent;\n return token ? { from: token.from, to: this.pos,\n text: this.state.sliceDoc(token.from, this.pos),\n type: token.type } : null;\n }", "function assembleTree(data) {\n var t = [];\n var list = data.map(function (i) {\n return {\n id: i.id,\n icon: i.icon,\n label: i.name,\n action: i.url,\n parentId: i.parentId\n };\n });\n\n function findChild(i) {\n var c = list.filter(function (c) {\n return c.parentId == i.id;\n });\n if (c && c.length) {\n i.terminal = false;\n var f = false;\n c.forEach(function (ci) {\n var cf = findChild(ci);\n if (cf) f = true;\n });\n i.children = c;\n i.ismenu = f;\n return true;\n }\n i.terminal = true;\n return false;\n }\n\n list.forEach(function (i) {\n if (!i.parentId) {\n findChild(i);\n t.push(i);\n }\n });\n return t;\n }", "function parseOuter(s){\n\n\n\n\tvar tset = {OUTERTEXT:true , TSTART: true , DSTART: true } // Contains the first TOKENS possible in the <outer>\n\tvar object = {name:\"outer\", OUTERTEXT: null, templateinvocation: null, templatedef: null, next: null}\n\n\tvar tk = scaner(s.substr(counter),tset) // we want the parseOuter to start at the counter after the incrementations\n\tconsole.log(\"token in Parsouter: \")\n\tconsole.log(tk); \n\n\tif (tk.token == \"OUTERTEXT\"){\n\t\t\n\n\t\tcounter+= tk.value.length; // increment the counter with the length of the match\n\n\t\tobject.OUTERTEXT= tk.value.trim(); // set the value of outerText and trim() to get rid of white spaces\n\n\t\tif(counter<s.length)\n\t\tobject.next= parseOuter(s); // ITERATION PART TO\n\t\t\n\t\t// add getting rid of the white space// with trim function\n\n\t\t\t\n\t}\n\n\tif(tk.token == \"TSTART\"){\n\n\t\tcounter+= 2; // Increment the counter by 2 for \"{{\"\n\t\tobject.templateinvocation = parseTemplateInvocation(s)\n\t\t\n\t\tif(counter<s.length)\n\t\t\tobject.next = parseOuter(s) // to continue the recursion\n\t}\n\tif(tk.token == \"DSTART\"){\n\n\t\tcounter+=2; // Increment the counter by 2 for \"{:\"\n\t\tobject.templatedef = parseTemplateDef(s);\n\t//\tcounter+=2 // When we come back from DSTART we have increment by 2 for :} DEND <<<<<<<<<<DOUBLE CHECK\n\n\t\tif(counter<s.length)\n\t\t\tobject.next = parseOuter(s) // To continue the recursion\n\n\t\t//object.templateinvocation= parseTemplateDef(s.substr(tk.value.length))\n\t}\n\n\t//while(counter<s.length) // To get rid of while spaces\n\t//\tobject.next= parseOuter(s)\n\tcounter =0 ; // Reset the counter for question 4\n\treturn object;\n\n}", "function testTripleParser() \n{\n\t// equiv. turtle expression - :a :b :c ; :d :e , :f\n\tvar expression1 = [ ':a', [ ':b', ':c', ':d', [ ':e', ':f' ] ] ];\n\tvar result1 = JSON.stringify( parse( expression1 ) );\n\tequal( \"test1\", result1, '[[\":a\",\":b\",\":c\"],[\":a\",\":d\",\":e\"],[\":a\",\":d\",\":f\"]]' );\n\t\n\t// equiv. turtle expression - :a :b , :c , :d , :e , :f\n\tvar expression2 = [ ':a', ':b', [ ':c', ':d', ':e', ':f' ] ];\t\t\n\tvar result2 = JSON.stringify( parse( expression2 ) );\n\tequal( \"test2\", result2, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":b\",\":e\"],[\":a\",\":b\",\":f\"]]' );\n\t\n\t// not valid turtle expression, but parses anyway, \n\t// TODO: should we make this should throw an exception?\n\tvar expression3 = [ ':a', [ ':b', [ ':c', ':d', ':e', ':f' ] ] ];\t\t\n\tvar result3 = JSON.stringify( parse( expression3 ) );\n\tequal( \"test3\", result3, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":b\",\":e\"],[\":a\",\":b\",\":f\"]]' );\n\t\n\t// should throw exception 'too many levels'\n\tvar expression4 = [ ':a', [ ':b', [ ':c', [ ':d', ':e', ':f' ] ] ] ];\t\t\n\tvar result4;\n\ttry {\n\t\tresult4 = parse( expression4 );\n\t}\n\tcatch( e ) {\n\t\tresult4 = e;\n\t}\n\tequal( \"test4\", result4, 'parse error - invalid nested array' );\n\t\n\t// equiv. turtle expression - :a :b :c , :d ; :e :f , :g .\n\tvar expression5 = [ ':a', [ ':b', [ ':c', ':d' ] ], ':e', [ ':f', ':g' ] ]; \n\tvar result5 = JSON.stringify( parse( expression5 ) );\n\tequal( \"test5\", result5, '[[\":a\",\":b\",\":c\"],[\":a\",\":b\",\":d\"],[\":a\",\":e\",\":f\"],[\":a\",\":e\",\":g\"]]' );\n\t\n}", "getTree() {\n\n var result = ['cond',\n this.predicate.getTree(),\n this.consequent.getTree(),\n ];\n\n if (this.alternate) {\n result.push(this.alternate.getTree());\n }\n\n return result;\n }", "function splitLines(nodes) {\n var lines = [];\n var currentLine = [];\n var openingTags = [];\n\n var traverse = function (currentNodes) {\n var lastOpenTag;\n var tagPrefix = [];\n var tagSuffix = [];\n openingTags.forEach(function (tag) {\n tagPrefix.push(tagOpen(tag));\n tagSuffix.push(tagClose(tag));\n });\n tagPrefix = tagPrefix.join('');\n tagSuffix = tagSuffix.join('');\n if (openingTags.length) {\n lastOpenTag = openingTags[openingTags.length - 1];\n currentLine.push(tagOpen(lastOpenTag));\n }\n var processLine = function (line) {\n // we see a newline, flush current line\n if (line.endsWith('\\n')) {\n currentLine.push(line.slice(0, line.length - 1));\n // wrap current line with open tags\n lines.push(currentLine.join('') + tagSuffix);\n currentLine = [tagPrefix];\n // this line has no newline, just buffer it\n } else {\n currentLine.push(line);\n }\n };\n for (var i = 0; i < currentNodes.length; i++) {\n var node = currentNodes[i];\n // text node\n if (node.nodeType === Node.TEXT_NODE) {\n var lineParts = node.textContent.match(/([^\\n]*?)(\\n|$)/g);\n lineParts.forEach(processLine);\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n openingTags.push(node);\n traverse(node.childNodes, openingTags);\n } else {\n throw new Error('Not supported node %@'.fmt(node));\n }\n }\n if (openingTags.length) {\n currentLine.push(tagClose(lastOpenTag));\n openingTags.pop();\n }\n };\n traverse(nodes);\n if (currentLine.length) {\n lines.push(currentLine.join(''));\n }\n return lines;\n}", "getPaths(regex, point = new Coordinate(0,0)){\n // Paths will be a multi-dimension array that basically \n // substitutes the parenthesis in the regex\n // We can traverse down any path this way\n let paths = [[0]];\n let i = 0;\n let j = 0;\n let char = -1;\n\n // Keeps track of where we are\n let location = new Coordinate(point.x, point.y);\n this.visited[location] = true;\n\n // Navigate through the regex\n while(++char < regex.length){\n // New path\n if(regex[char] == '|'){\n paths[++i] = [0];\n j = 0;\n location = new Coordinate(point.x, point.y);\n }\n // Another layer found, recurse down\n else if(regex[char] == '('){\n let inner = this.getPaths(regex.substring(char + 1), location);\n // Offset what character we are looking at to avoid infinite recursion\n char += inner.end;\n // Group the inner paths with the outer path\n paths[i][++j] = inner.paths;\n // True if the path doesn't need to traverse down into deeper layers\n // Example: EESS(WNSE|)SSS\n if(regex[char + 1] && regex[char + 1] != '|' && regex[char + 1] != ')'){ \n paths[i][++j] = 0;\n }\n }\n // Layer ends\n else if(regex[char] == ')'){\n break;\n }\n // Add to the path\n else{\n // Move our location\n switch(regex[char]){\n case 'N': location.north(); break;\n case 'S': location.south(); break;\n case 'E': location.east(); break;\n case 'W': location.west(); break;\n }\n // We have not been here before, count it\n if(!this.visited[location]){\n this.visited[location] = true;\n paths[i][j]++;\n }\n }\n }\n // Return where we ended and the paths created\n return {\n end: char + 1,\n paths: paths\n }\n }", "function getDestructuredComponents(node, state) {\n var tmpIndex = state.localScope.tempVarIndex;\n var components = [];\n var patternItems = getPatternItems(node);\n\n for (var idx = 0; idx < patternItems.length; idx++) {\n var item = patternItems[idx];\n if (!item) {\n continue;\n }\n\n if (item.type === Syntax.SpreadElement) {\n // Spread/rest of an array.\n // TODO(dmitrys): support spread in the middle of a pattern\n // and also for function param patterns: [x, ...xs, y]\n components.push(item.argument.name +\n '=Array.prototype.slice.call(' +\n getTmpVar(tmpIndex) + ',' + idx + ')'\n );\n continue;\n }\n\n if (item.type === Syntax.SpreadProperty) {\n var restExpression = restPropertyHelpers.renderRestExpression(\n getTmpVar(tmpIndex),\n patternItems\n );\n components.push(item.argument.name + '=' + restExpression);\n continue;\n }\n\n // Depending on pattern type (Array or Object), we get\n // corresponding pattern item parts.\n var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);\n var value = getPatternItemValue(node, item);\n\n // TODO(dmitrys): implement default values: {x, y=5}\n if (value.type === Syntax.Identifier) {\n // Simple pattern item.\n components.push(value.name + '=' + accessor);\n } else {\n // Complex sub-structure.\n components.push(\n getInitialValue(++state.localScope.tempVarIndex, accessor) + ',' +\n getDestructuredComponents(value, state)\n );\n }\n }\n\n return components.join(',');\n}", "function parse(x){\n var isp = function(x){\n return [\"(\",\")\"].includes(x)\n }\n var ins = function(x,L,fun){\n if (L.length > 0 && typeof L[0] == \"object\"){\n return [ins(x,L[0],fun)].concat(L.slice(1))\n }else{\n return fun(x,L)\n }\n }\n var jump = function(x,L){\n if (L.length > 0 && typeof L[0] == \"object\"){\n if (L[0].length > 0 && typeof L[0][0] != \"object\"){\n return [x].concat(L)\n }\n }\n return [jump(x,L[0])].concat(L.slice(1))\n }\n var listify = function(x){\n if (x.length == 0){\n return []\n }\n var car = x[0]\n var cdr = x.slice(1)\n\n var res = listify(cdr)\n if (car == \")\"){\n res = ins([],res,(x,L)=>[x].concat(L))\n }else if (car == \"(\"){\n res = jump(\"$\",res)\n }else if (isop(car)){\n res = ins(car,res,(x,L)=>[x].concat(L))\n }else{\n res = ins(car,res,(x,L)=>\n (L.length==0 || isop(L[0]))? [x].concat(L) : [x+L[0]].concat(L.slice(1))\n )\n }\n return res\n }\n var clean = function(x,L){\n return L.filter((y)=>typeof y==\"object\"?true:x!=y)\n .map((y)=>typeof y==\"object\"?clean(x,y):y)\n }\n var pfxop = function(L){\n if (typeof L != \"object\"){\n return L\n }\n if (L.length == 1){\n return pfxop(L[0])\n }\n return [L.filter(x=>isop(x)).join(\"\")].concat(L.filter(x=>!isop(x)).map(pfxop))\n\n }\n return pfxop(clean(\"$\",listify(x)))\n}", "function getDestructuredComponents(node, state) {\n var tmpIndex = state.localScope.tempVarIndex;\n var components = [];\n var patternItems = getPatternItems(node);\n\n for (var idx = 0; idx < patternItems.length; idx++) {\n var item = patternItems[idx];\n if (!item) {\n continue;\n }\n\n if (item.type === Syntax.SpreadElement) {\n // Spread/rest of an array.\n // TODO(dmitrys): support spread in the middle of a pattern\n // and also for function param patterns: [x, ...xs, y]\n components.push(item.argument.name +\n '=Array.prototype.slice.call(' +\n utils.getTempVar(tmpIndex) + ',' + idx + ')'\n );\n continue;\n }\n\n if (item.type === Syntax.SpreadProperty) {\n var restExpression = restPropertyHelpers.renderRestExpression(\n utils.getTempVar(tmpIndex),\n patternItems\n );\n components.push(item.argument.name + '=' + restExpression);\n continue;\n }\n\n // Depending on pattern type (Array or Object), we get\n // corresponding pattern item parts.\n var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);\n var value = getPatternItemValue(node, item);\n\n // TODO(dmitrys): implement default values: {x, y=5}\n if (value.type === Syntax.Identifier) {\n // Simple pattern item.\n components.push(value.name + '=' + accessor);\n } else {\n // Complex sub-structure.\n components.push(\n utils.getTempVar(++state.localScope.tempVarIndex) + '=' + accessor +\n ',' + getDestructuredComponents(value, state)\n );\n }\n }\n\n return components.join(',');\n}", "function getDestructuredComponents(node, state) {\n var tmpIndex = state.localScope.tempVarIndex;\n var components = [];\n var patternItems = getPatternItems(node);\n\n for (var idx = 0; idx < patternItems.length; idx++) {\n var item = patternItems[idx];\n if (!item) {\n continue;\n }\n\n if (item.type === Syntax.SpreadElement) {\n // Spread/rest of an array.\n // TODO(dmitrys): support spread in the middle of a pattern\n // and also for function param patterns: [x, ...xs, y]\n components.push(item.argument.name +\n '=Array.prototype.slice.call(' +\n utils.getTempVar(tmpIndex) + ',' + idx + ')'\n );\n continue;\n }\n\n if (item.type === Syntax.SpreadProperty) {\n var restExpression = restPropertyHelpers.renderRestExpression(\n utils.getTempVar(tmpIndex),\n patternItems\n );\n components.push(item.argument.name + '=' + restExpression);\n continue;\n }\n\n // Depending on pattern type (Array or Object), we get\n // corresponding pattern item parts.\n var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);\n var value = getPatternItemValue(node, item);\n\n // TODO(dmitrys): implement default values: {x, y=5}\n if (value.type === Syntax.Identifier) {\n // Simple pattern item.\n components.push(value.name + '=' + accessor);\n } else {\n // Complex sub-structure.\n components.push(\n utils.getTempVar(++state.localScope.tempVarIndex) + '=' + accessor +\n ',' + getDestructuredComponents(value, state)\n );\n }\n }\n\n return components.join(',');\n}", "function getDestructuredComponents(node, state) {\n var tmpIndex = state.localScope.tempVarIndex;\n var components = [];\n var patternItems = getPatternItems(node);\n\n for (var idx = 0; idx < patternItems.length; idx++) {\n var item = patternItems[idx];\n if (!item) {\n continue;\n }\n\n if (item.type === Syntax.SpreadElement) {\n // Spread/rest of an array.\n // TODO(dmitrys): support spread in the middle of a pattern\n // and also for function param patterns: [x, ...xs, y]\n components.push(item.argument.name +\n '=Array.prototype.slice.call(' +\n utils.getTempVar(tmpIndex) + ',' + idx + ')'\n );\n continue;\n }\n\n if (item.type === Syntax.SpreadProperty) {\n var restExpression = restPropertyHelpers.renderRestExpression(\n utils.getTempVar(tmpIndex),\n patternItems\n );\n components.push(item.argument.name + '=' + restExpression);\n continue;\n }\n\n // Depending on pattern type (Array or Object), we get\n // corresponding pattern item parts.\n var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);\n var value = getPatternItemValue(node, item);\n\n // TODO(dmitrys): implement default values: {x, y=5}\n if (value.type === Syntax.Identifier) {\n // Simple pattern item.\n components.push(value.name + '=' + accessor);\n } else {\n // Complex sub-structure.\n components.push(\n utils.getTempVarWithValue(++state.localScope.tempVarIndex, accessor) +\n ',' + getDestructuredComponents(value, state)\n );\n }\n }\n\n return components.join(',');\n}", "split() {\n // bottom four octants\n // -x-y-z\n this.nodes[0] = new Octree(this.bounds.x, this.bounds.y, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x-y-z\n this.nodes[1] = new Octree(this.bounds.frontX, this.bounds.y, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // -x+y-z\n this.nodes[2] = new Octree(this.bounds.x, this.bounds.frontY, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x+y-z\n this.nodes[3] = new Octree(this.bounds.frontX, this.bounds.frontY, this.bounds.z, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n\n // top four octants\n // -x-y+z\n this.nodes[4] = new Octree(this.bounds.x, this.bounds.y, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x-y+z\n this.nodes[5] = new Octree(this.bounds.frontX, this.bounds.y, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // -x+y+z\n this.nodes[6] = new Octree(this.bounds.x, this.bounds.frontY, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n // +x+y+z\n this.nodes[7] = new Octree(this.bounds.frontX, this.bounds.frontY, this.bounds.top, this.bounds.subWidthX, this.bounds.subWidthY, this.bounds.subHeight, this.maxLevels, (this.level + 1));\n }", "function split(text) {\n\t\t\t\tvar len = text.length;\n\t\t\t\tvar arr = [];\n\t\t\t\tvar i = 0;\n\t\t\t\tvar brk = 0;\n\t\t\t\tvar level = 0;\n\n\t\t\t\twhile (i + 2 <= len) {\n\t\t\t\t\tif (text.slice(i, i + 2) === '[[') {\n\t\t\t\t\t\tlevel += 1;\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t} else if (text.slice(i, i + 2) === ']]') {\n\t\t\t\t\t\tlevel -= 1;\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t} else if (level === 0 && text[i] === ',' && text[i - 1] !== '\\\\') {\n\t\t\t\t\t\tarr.push(text.slice(brk, i).trim());\n\t\t\t\t\t\ti += 1;\n\t\t\t\t\t\tbrk = i;\n\t\t\t\t\t}\n\t\t\t\t\ti += 1;\n\t\t\t\t}\n\t\t\t\tarr.push(text.slice(brk, i + 1).trim());\n\t\t\t\treturn arr;\n\t\t\t}", "splitNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match,\n at = editor.selection,\n height = 0,\n always = false\n } = options;\n\n if (match == null) {\n match = n => Editor.isBlock(editor, n);\n }\n\n if (Range.isRange(at)) {\n at = deleteRange(editor, at);\n } // If the target is a path, the default height-skipping and position\n // counters need to account for us potentially splitting at a non-leaf.\n\n\n if (Path.isPath(at)) {\n var path = at;\n var point = Editor.point(editor, path);\n var [parent] = Editor.parent(editor, path);\n\n match = n => n === parent;\n\n height = point.path.length - path.length + 1;\n at = point;\n always = true;\n }\n\n if (!at) {\n return;\n }\n\n var beforeRef = Editor.pointRef(editor, at, {\n affinity: 'backward'\n });\n var [highest] = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n\n if (!highest) {\n return;\n }\n\n var voidMatch = Editor.void(editor, {\n at,\n mode: 'highest'\n });\n var nudge = 0;\n\n if (!voids && voidMatch) {\n var [voidNode, voidPath] = voidMatch;\n\n if (Element.isElement(voidNode) && editor.isInline(voidNode)) {\n var after = Editor.after(editor, voidPath);\n\n if (!after) {\n var text = {\n text: ''\n };\n var afterPath = Path.next(voidPath);\n Transforms.insertNodes(editor, text, {\n at: afterPath,\n voids\n });\n after = Editor.point(editor, afterPath);\n }\n\n at = after;\n always = true;\n }\n\n var siblingHeight = at.path.length - voidPath.length;\n height = siblingHeight + 1;\n always = true;\n }\n\n var afterRef = Editor.pointRef(editor, at);\n var depth = at.path.length - height;\n var [, highestPath] = highest;\n var lowestPath = at.path.slice(0, depth);\n var position = height === 0 ? at.offset : at.path[depth] + nudge;\n\n for (var [node, _path2] of Editor.levels(editor, {\n at: lowestPath,\n reverse: true,\n voids\n })) {\n var split = false;\n\n if (_path2.length < highestPath.length || _path2.length === 0 || !voids && Editor.isVoid(editor, node)) {\n break;\n }\n\n var _point = beforeRef.current;\n var isEnd = Editor.isEnd(editor, _point, _path2);\n\n if (always || !beforeRef || !Editor.isEdge(editor, _point, _path2)) {\n split = true;\n var properties = Node.extractProps(node);\n editor.apply({\n type: 'split_node',\n path: _path2,\n position,\n properties\n });\n }\n\n position = _path2[_path2.length - 1] + (split || isEnd ? 1 : 0);\n }\n\n if (options.at == null) {\n var _point2 = afterRef.current || Editor.end(editor, []);\n\n Transforms.select(editor, _point2);\n }\n\n beforeRef.unref();\n afterRef.unref();\n });\n }", "splitNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n mode = 'lowest',\n voids = false\n } = options;\n var {\n match,\n at = editor.selection,\n height = 0,\n always = false\n } = options;\n\n if (match == null) {\n match = n => Editor.isBlock(editor, n);\n }\n\n if (Range.isRange(at)) {\n at = deleteRange(editor, at);\n } // If the target is a path, the default height-skipping and position\n // counters need to account for us potentially splitting at a non-leaf.\n\n\n if (Path.isPath(at)) {\n var path = at;\n var point = Editor.point(editor, path);\n var [parent] = Editor.parent(editor, path);\n\n match = n => n === parent;\n\n height = point.path.length - path.length + 1;\n at = point;\n always = true;\n }\n\n if (!at) {\n return;\n }\n\n var beforeRef = Editor.pointRef(editor, at, {\n affinity: 'backward'\n });\n var [highest] = Editor.nodes(editor, {\n at,\n match,\n mode,\n voids\n });\n\n if (!highest) {\n return;\n }\n\n var voidMatch = Editor.void(editor, {\n at,\n mode: 'highest'\n });\n var nudge = 0;\n\n if (!voids && voidMatch) {\n var [voidNode, voidPath] = voidMatch;\n\n if (Element.isElement(voidNode) && editor.isInline(voidNode)) {\n var after = Editor.after(editor, voidPath);\n\n if (!after) {\n var text = {\n text: ''\n };\n var afterPath = Path.next(voidPath);\n Transforms.insertNodes(editor, text, {\n at: afterPath,\n voids\n });\n after = Editor.point(editor, afterPath);\n }\n\n at = after;\n always = true;\n }\n\n var siblingHeight = at.path.length - voidPath.length;\n height = siblingHeight + 1;\n always = true;\n }\n\n var afterRef = Editor.pointRef(editor, at);\n var depth = at.path.length - height;\n var [, highestPath] = highest;\n var lowestPath = at.path.slice(0, depth);\n var position = height === 0 ? at.offset : at.path[depth] + nudge;\n\n for (var [node, _path2] of Editor.levels(editor, {\n at: lowestPath,\n reverse: true,\n voids\n })) {\n var split = false;\n\n if (_path2.length < highestPath.length || _path2.length === 0 || !voids && Editor.isVoid(editor, node)) {\n break;\n }\n\n var _point = beforeRef.current;\n var isEnd = Editor.isEnd(editor, _point, _path2);\n\n if (always || !beforeRef || !Editor.isEdge(editor, _point, _path2)) {\n split = true;\n\n var properties = _objectWithoutProperties(node, [\"text\", \"children\"]);\n\n editor.apply({\n type: 'split_node',\n path: _path2,\n position,\n properties\n });\n }\n\n position = _path2[_path2.length - 1] + (split || isEnd ? 1 : 0);\n }\n\n if (options.at == null) {\n var _point2 = afterRef.current || Editor.end(editor, []);\n\n Transforms.select(editor, _point2);\n }\n\n beforeRef.unref();\n afterRef.unref();\n });\n }", "function print_list(ast) {\n const peek = ast[1];\n indent++;\n\n const tabs = tab.repeat(indent);\n const ifBr = indent ? br : '';\n const ifTabs = indent ? tabs : '';\n \n let list = `${ifBr}${ifTabs}(${ast.map(print_form).join(\" \")}`;\n \n indent--;\n \n console.log(peek);\n console.log(list);\n \n if (peek && !(peek instanceof Array)) {\n list = `${list})${br}${tabs}`;\n } else if (peek) {\n list = `${list}${tabs})`;\n } else {\n list = `${list})`;\n }\n\n return list;\n}" ]
[ "0.59107566", "0.5872243", "0.5872243", "0.5872243", "0.5872243", "0.58146274", "0.57734203", "0.57732946", "0.57018226", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.5692031", "0.56849456", "0.5683779", "0.5683779", "0.5683779", "0.5683779", "0.56766033", "0.56541914", "0.56541914", "0.5649871", "0.5649871", "0.5649871", "0.56372374", "0.56366146", "0.56163454", "0.5616054", "0.5616054", "0.557449", "0.5547984", "0.55476207", "0.549072", "0.5465814", "0.54635036", "0.54344773", "0.542059", "0.5382623", "0.53740615", "0.5354502", "0.5352423", "0.5338948", "0.5331984", "0.52891123", "0.5275605", "0.5272426", "0.52711856", "0.525904", "0.5252319", "0.52176523", "0.5211459", "0.5211121", "0.5203109", "0.5203109", "0.51972234", "0.5179636", "0.5179636", "0.5179636", "0.5165223", "0.5145982", "0.514381", "0.5132496", "0.51227516", "0.5119151", "0.50805", "0.5067617", "0.5065837", "0.50653815", "0.5062232", "0.5055642", "0.50462", "0.5037973", "0.50345486", "0.5031858", "0.50314856", "0.5028543", "0.502062", "0.5019881", "0.50194126", "0.50183", "0.5016963", "0.5016963", "0.50153303", "0.5004034", "0.49796504", "0.4977962", "0.4977962", "0.49738124" ]
0.5716143
8
Create sorting function for companies.
function compare(a,b) { if (a.name < b.name) return -1; if (a.name > b.name) return 1; return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortByFunc() {\n switch (sortBy.field) {\n case 'name':\n case 'ticker':\n if (sortBy.desc === 0) {\n return (a, b) => a[sortBy.field].localeCompare(b[sortBy.field])\n }\n return (a, b) => b[sortBy.field].localeCompare(a[sortBy.field])\n case 'price':\n case 'changes':\n case 'marketCapitalization':\n default:\n if (sortBy.desc === 0) {\n return (a, b) => (a[sortBy.field] - b[sortBy.field])\n }\n return (a, b) => (b[sortBy.field] - a[sortBy.field])\n }\n }", "function sortFruitMarketTableByFruitNameAndPrice() {\n\n}", "function Sort() {}", "genSortAscendingByField(field) {\n return (a, b) => {\n const valA = a[field].toUpperCase()\n const valB = b[field].toUpperCase()\n let order = 0\n if (valA < valB) order = -1\n if (valA > valB) order = 1\n return order\n }\n }", "sortDataByName(data) {\r\n data.sort((a,b) => {\r\n if (a.companyName.toLowerCase() < b.companyName.toLowerCase()) return -1;\r\n if (a.companyName.toLowerCase() > b.companyName.toLowerCase()) return 1;\r\n return 0;\r\n });\r\n return data;\r\n }", "function pr_asc(){\n console.log('Sort by Price Asc');\n myLibrary.sortByPriceAsc();\n}", "function sort(typeOfSort, brands) {\n if(typeOfSort=='price-asc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(price_asc);\n });}\n else if (typeOfSort=='price-desc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(price_desc);\n });}\n else if (typeOfSort=='date-asc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(date_asc);\n });}\n else if (typeOfSort=='date-desc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(date_desc);\n });}\n return brands;\n}", "sortFunctionAsc(field) {\n const compare = (a, b) => {\n var aField = a[field]\n var bField = b[field]\n if (typeof a[field] === 'string') {\n aField = a[field].toLowerCase()\n }\n if (typeof b[field] === 'string') {\n bField = b[field].toLowerCase()\n }\n\n if (aField < bField) { return -1 }\n if (aField > bField) { return 1 }\n return 0\n }\n return compare\n }", "Sort() {\n\n }", "sortBy() {\n // YOUR CODE HERE\n }", "sort(comparator) {\n }", "sortProducts() {}", "function twpro_sortJobs(){\r\n\t\tif (TWPro.twpro_failure) return;\r\n\t\tvar sortby = TWPro.twpro_jobsort, twpro_jobValues = TWPro.twpro_jobValues;\r\n\t\tvar sortfunc = function(twpro_a, twpro_b){\r\n\t\t\tvar twpro_a_str = twpro_a.name,\r\n\t\t\t\ttwpro_b_str = twpro_b.name;\r\n\t\t\tif(sortby == 'name'){\r\n\t\t\t\treturn twpro_a_str.localeCompare(twpro_b_str);\r\n\t\t\t}\r\n\t\t\tif(sortby == 'comb'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].jobrank == twpro_jobValues[twpro_b.shortName].jobrank) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].jobrank - twpro_jobValues[twpro_a.shortName].jobrank);\r\n\t\t\t}\r\n\t\t\tif(sortby == 'erfahrung'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].experience == twpro_jobValues[twpro_b.shortName].experience) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].experience - twpro_jobValues[twpro_a.shortName].experience);\r\n\t\t\t} if(sortby == 'lohn'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].wages == twpro_jobValues[twpro_b.shortName].wages) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].wages - twpro_jobValues[twpro_a.shortName].wages);\r\n\t\t\t} if(sortby == 'glueck'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].luckvaluemax == twpro_jobValues[twpro_b.shortName].luckvaluemax) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].luckvaluemax - twpro_jobValues[twpro_a.shortName].luckvaluemax);\r\n\t\t\t} if(sortby == 'gefahr'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].danger == twpro_jobValues[twpro_b.shortName].danger) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_a.shortName].danger - twpro_jobValues[twpro_b.shortName].danger);\r\n\t\t\t} else {\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName][sortby] == twpro_jobValues[twpro_b.shortName][sortby]) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName][sortby] - twpro_jobValues[twpro_a.shortName][sortby]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tTWPro.twpro_jobs.sort(sortfunc);\r\n\t\t//if(sortby == 'danger') TWPro.twpro_jobs.reverse();\r\n\t}", "sort() {\n\t}", "sort() {\n\t}", "genSortDescendingByField(field) {\n return (a, b) => {\n const valA = a[field].toUpperCase()\n const valB = b[field].toUpperCase()\n let order = 0\n if (valA < valB) order = 1\n if (valA > valB) order = -1\n return order\n }\n }", "function sortData (data) {\n ...\n}", "getOrderBy() {}", "sort(){\n\n }", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortArrayAscByItem(){\r\n return function(obj1, obj2){\r\n if (obj1.itemText > obj2.itemText) return 1;\r\n if (obj1.itemText < obj2.itemText) return -1;\r\n return 0;\r\n }\r\n}", "function getDefaultSorter(colName) {\n\t\treturn function(a, b, dir){\n\n\t\t\tvar \n\t\t\t\tfirstRec = dir == 'asc' ? a : b,\n\t\t\t\tsecondRec = dir == 'asc' ? b : a,\n\n\t\t\t\tfA = firstRec[colName].toLowerCase(),\n\t\t\t\tfB = secondRec[colName].toLowerCase();\n\n\t\t\t// Handle numbers\n\t\t\tif (fA<fB) return -1\n\t\t\tif (fA>fB) return +1\n\t\t\treturn 0\n\t\t};\n\t}", "function createComparer(idx, asc) {\n\t\treturn function(a, b) {\n\t\t\t// get values to compare at column idx\n\t\t\t// if order is ascending, compare 1st row to 2nd , otherwise 2nd to 1st\n\t\t\tvar v1 = getCellValue(asc ? a : b, idx),\n\t\t\t\tv2 = getCellValue(asc ? b : a, idx);\n\t\t\t// If non numeric value\n\t\t\tif (v1 === '' || v2 === '' || isNaN(v1) || isNaN(v2)) {\n\t\t\t\t//sort for grades\n\t\t\t\tif (idx === 5) {\n\t\t\t\t\tlet ord1 = getGradeOrder(v1.toString());\n\t\t\t\t\tlet ord2 = getGradeOrder(v2.toString());\n\t\t\t\t\treturn ord1 - ord2;\n\t\t\t\t}\n\t\t\t\t//sort for states\n\t\t\t\tif (idx === 6) {\n\t\t\t\t\tlet ord1 = getStateOrder(v1.toString());\n\t\t\t\t\tlet ord2 = getStateOrder(v2.toString());\n\t\t\t\t\treturn ord1 - ord2;\n\t\t\t\t}\n\t\t\t\t//sort for other lexical fields\n\t\t\t\treturn v1.toString().localeCompare(v2); // lexical comparison\n\t\t\t}\n\t\t\t// If numeric value\n\t\t\treturn v1 - v2; // v1 greater than v2 --> true\n\t\t};\n\t}", "function updateSortFunction() {\n switch(sortBy.value) {\n case '0': // receiverId increasing\n sortFunction = function(tr1, tr2) {\n if(tr1.getElementsByTagName('td')[0].textContent <\n tr2.getElementsByTagName('td')[0].textContent) {\n return -1;\n };\n return 1;\n }\n break;\n case '1': // receiverId decreasing\n sortFunction = function(tr1, tr2) {\n if(tr1.getElementsByTagName('td')[0].textContent >\n tr2.getElementsByTagName('td')[0].textContent) {\n return -1;\n };\n return 1;\n }\n break;\n }\n sortReceiversAndHighlight();\n}", "function funSortByName(a, b) {\n return (a.employee_name.toLowerCase() > b.employee_name.toLowerCase()) ? 1 : -1;\n}", "get overrideSorting() {}", "function orderAlphabetically() {}", "sortBy(field, reverse, primer) \n {\n const key = primer\n ? function(x) {\n return primer(x[field]);\n }\n : function(x) {\n return x[field];\n };\n\n return function(a, b) {\n a = key(a);\n b = key(b);\n return reverse * ((a > b) - (b > a));\n };\n }", "function sorte ( i ){\n return function(){\n if(scope.sorting.obj){\n //var index = _.findIndex(scope.viewer, scope.sorting.obj);\n }\n var key = scope.headers[i].field;\n if(scope.sorting.field === key){\n scope.sorting.direction = scope.sorting.direction * -1;\n }else{\n scope.sorting.field = key;\n scope.sorting.direction = 1;\n }\n sorter(key,scope.sorting.direction);\n scope.sorting.obj = scope.headers[i];\n scope.buildTable();\n\n };\n }", "function sorte ( i ){\n return function(){\n if(scope.sorting.obj){\n //var index = _.findIndex(scope.viewer, scope.sorting.obj);\n }\n var key = scope.headers[i].field;\n if(scope.sorting.field === key){\n scope.sorting.direction = scope.sorting.direction * -1;\n }else{\n scope.sorting.field = key;\n scope.sorting.direction = 1;\n }\n sorter(key,scope.sorting.direction);\n scope.sorting.obj = scope.headers[i];\n scope.buildTable();\n\n };\n }", "sort() {\r\n\t\treturn this.data.sort((a,b) => {\r\n\t\t\tfor(var i=0; i < this.definition.length; i++) {\r\n\t\t\t\tconst [code, key] = this.definition[i];\r\n\t\t\t\tswitch(code) {\r\n\t\t\t\t\tcase 'asc':\r\n\t\t\t\t\tcase 'desc':\r\n\t\t\t\t\t\tif (a[key] > b[key])\r\n\t\t\t\t\t\t\treturn code == 'asc' ? 1 : -1;\r\n\t\t\t\t\t\tif (a[key] < b[key])\r\n\t\t\t\t\t\t\treturn code == 'asc' ? -1 : 1;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'fn':\r\n\t\t\t\t\t\tlet result = key(a, b);\r\n\t\t\t\t\t\tif (result != 0) // If it's zero the sort wasn't decided.\r\n\t\t\t\t\t\t\treturn result;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t});\r\n\t}", "dynamicSort(property) {\n var sortOrder = 1;\n //check for \"-\" operator and sort asc/desc depending on that\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a, b) {\n var result =\n a[property] < b[property] ? -1 : a[property] > b[property] ? 1 : 0;\n return result * sortOrder;\n };\n }", "function alphabetique(){\n entrepreneurs.sort.year\n }", "_dynamicSort(property) {\n let sortOrder = 1;\n\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a,b) {\n let result = (a['attributes'][property] < b['attributes'][property]) ? -1 :\n (a['attributes'][property] > b['attributes'][property]) ? 1 : 0;\n return result * sortOrder;\n };\n }", "function yearComparator( auto1, auto2) {\n //put auto2 as arg1 and auto1 as arg2 to sort the cars in \"reverse\"\n //this produces the desired \"newest cars on top\" sorting effect\n return exComparator(auto2.year, auto1.year);\n}", "filterAndSortDataByYear () {\n }", "sortBy({ value }) {\n\n }", "function pr_desc(){\n console.log('Sort by Price Desc: ');\n myLibrary.sortByPriceDesc();\n}", "sortBy(collection, functionOrKey) {\n return collection.sort((a, b) => {\n if (typeof functionOrKey === \"function\") {\n return functionOrKey(a) < functionOrKey(b) ? -1 : 1;\n }\n return a[functionOrKey] < b[functionOrKey] ? -1 : 1;\n });\n }", "function sortMethod(a, b) {\n var x = a.name.toLowerCase();\n var y = b.name.toLowerCase();\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n }", "function sortByPriceAsc(a,b)\n{\n console.log(a.price - b.price);\n return a.price - b.price\n}", "sortFunctionDesc(field) {\n const compare = (a, b) => {\n var aField = a[field]\n var bField = b[field]\n if (typeof a[field] === 'string') {\n aField = a[field].toLowerCase()\n }\n if (typeof b[field] === 'string') {\n bField = b[field].toLowerCase()\n }\n if (aField < bField) { return 1 }\n if (aField > bField) { return -1 }\n return 0\n }\n return compare\n }", "get sortingOrder() {}", "function sortData(data) {\n displayComic(data.comics);\n //displayManga(data.manga);\n //displayGNovel(data.graphicNovels);\n readyComicFunctions();\n}", "function sortByProcName(a, b) {//sort by name(display_as) ascending only\n\t\tif (a.DISPLAY_AS.toUpperCase() > b.DISPLAY_AS.toUpperCase()) {\n\t\t\treturn 1;\n\t\t}\n\t\tif (a.DISPLAY_AS.toUpperCase() < b.DISPLAY_AS.toUpperCase()) {\n\t\t\treturn -1;\n\t\t}\n\t\treturn 0;\n\t}", "sortBy(field, reverse, primer) {\n\t\tconst key = primer\n\t\t\t? function (x) {\n\t\t\t\treturn primer(x[field]);\n\t\t\t}\n\t\t\t: function (x) {\n\t\t\t\treturn x[field];\n\t\t\t};\n\t\n\t\treturn function (a, b) {\n\t\t\ta = key(a);\n\t\t\tb = key(b);\n\t\t\treturn reverse * ((a > b) - (b > a));\n\t\t};\n\t}", "function sortBy(field, reverse, primer) {\r\n reverse = (reverse) ? -1 : 1;\r\n return function(a,b) {\r\n a = a[field];\r\n b = b[field];\r\n if (typeof(primer) != 'undefined'){\r\n a = primer(a);\r\n b = primer(b);\r\n }\r\n if (a<b) return reverse * -1;\r\n if (a>b) return reverse * 1;\r\n return 0;\r\n }\r\n}", "function customizedSortFunction(a, b) {\n\t\t\tif (a > 10000)\n\t\t\t\treturn true;\n\t\t}", "async function TopologicalSort(){}", "function sortFunction(val){\n return val.sort();\n}", "function sorter(a,b) {\n return a - b;\n}", "function sortTableAlphabeticallyAscending(){\n sortAlphabeticallyAscending();\n}", "asc(field) {\r\n\t\treturn this.push('asc', [...arguments]);\r\n\t}", "function sortBy(categories) {\n    var sortIt = $(this).attr(\"data-sortby\"); \n    sortObjArray(Employees.entries, sortIt); \n    \n    $(\".btn.active\").removeClass(\"active\");\n    $(this).addClass(\"active\");\n}", "function hmSortFn(arrayList, comparefn) {\n\n if (!arrayList || (arrayList instanceof java.util.ArrayList) === false) {\n return false;\n }\n\n var ComparatorInstance = new java.util.Comparator({\n compare: comparefn\n });\n\n java.util.Collections.sort(arrayList, ComparatorInstance);\n}", "orderBy(fn){\n let sorts = this.sorts\n let orderBy = []\n\n sorts.forEach((sortOpts,key)=>{\n \n let desc = sortOpts.desc && sortOpts.desc != 'false' ? 'DESC' : 'ASC'\n\n let sort = fn && fn(key, sortOpts)\n\n if( !sort && sort !== false )\n sort = `${this.db.escapeId(key)} ${desc}`\n \n if( sort )\n orderBy.push(sort)\n })\n\n return orderBy.length > 0 ? 'ORDER BY '+orderBy.join(', ') : ''\n }", "priceBasedSort(a, b) {\n if (this.state.sortOrder === \"Descending\") {\n return (\n b.price - a.price\n );\n } else {\n return (\n a.price - b.price\n );\n }\n }", "function getSortMethod(){\n var _args = Array.prototype.slice.call(arguments);\n return function(a, b){\n for(var x in _args){\n var ax = a[_args[x].substring(1)];\n var bx = b[_args[x].substring(1)];\n var cx;\n\n ax = typeof ax == \"string\" ? ax.toLowerCase() : ax / 1;\n bx = typeof bx == \"string\" ? bx.toLowerCase() : bx / 1;\n\n if(_args[x].substring(0,1) == \"-\"){cx = ax; ax = bx; bx = cx;}\n if(ax != bx){return ax < bx ? -1 : 1;}\n }\n }\n}", "function sortResults(){\n return sort.sortCustomerRecords(result);\n}", "function compareNameAsc(a, b)\n{\n\tvar result = 0;\t\n\tif(a.CompanyName < b.CompanyName)\n\t{\n\t\tresult = -1;\t// positive goes 77-1, negative goes 1-77\n\t}\n\telse if(a.CompanyName > b.CompanyName)\n\t{\n\t\tresult = 1;\t\t// positive goes 1-77, negative goes 77-1\n\t}\n\telse\n\t{\n\t\tresult = 0;\n\t}\n\t\n\treturn result;\n}", "_sortBy(array, selectors) {\n return array.concat().sort((a, b) => {\n for (let selector of selectors) {\n let reverse = selector.order ? -1 : 1;\n\n a = selector.value ? JP.query(a, selector.value)[0] : JP.query(a,selector)[0];\n b = selector.value ? JP.query(b, selector.value)[0] : JP.query(b,selector)[0];\n\n if (a.toUpperCase() > b.toUpperCase()) {\n return reverse;\n }\n if (a.toUpperCase() < b.toUpperCase()) {\n return -1 * reverse;\n }\n }\n return 0;\n });\n }", "function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n\n return function(a, b) {\n if (sortOrder == -1) {\n return b[property].localeCompare(a[property]);\n } else {\n return a[property].localeCompare(b[property]);\n }\n }\n}", "function dynamicSort(property) {\r\n var sortOrder = 1;\r\n if (property[0] === \"-\") {\r\n sortOrder = -1;\r\n property = property.substr(1);\r\n }\r\n\r\n return function(a, b) {\r\n if (sortOrder == -1) {\r\n return b[property].localeCompare(a[property]);\r\n } else {\r\n return a[property].localeCompare(b[property]);\r\n }\r\n }\r\n}", "function sortHeader(colName,sortDir,sortType){\r\n\r\n//\talert(\"In sortHeader \" + \" col \" + colName + \" dir \" + sortDir + \" type \" + sortType);\r\n\t//check for column with no data\r\n\tif (!colName )\treturn false;\r\n\tif (colName.value)\treturn false;\r\n\t\r\n\t//alert(\"post\")\r\n\r\n\tvar obj = MM_findObj(sortDir,document);\r\n\r\n\tif(obj.value==\"ASCENDING\"){\r\n\t\tascending=true;\r\n\t\tobj.value=\"DESCENDING\";\r\n\r\n//\t\talert(obj.value)\r\n\t}\t\r\n\telse{\r\n\t\tascending=false;\r\n\t\tobj.value=\"ASCENDING\";\r\n\r\n\t//\talert(obj.value)\r\n\t}\r\n\r\n\t//copy column data into temp array\r\n\tvar arrTemp = new Array();\r\n\tfor(i=0;i<colName.length;i++){\r\n\t\tarrTemp[arrTemp.length] = [colName[i].value,i];\r\n\t}\r\n\t\r\n//\talert('b4 callingsortFunction ')\r\n//\talert(arrTemp);\r\n\r\n\tsortFunction(arrTemp,ascending,sortType);\r\n\r\n//\talert('after callingsortFunction ')\r\n\t//\t\talert(arrTemp);\r\n\tchmPrintColumn(arrTemp);\r\n\r\n\t\t\r\n\treturn false;\r\n}", "sort () {\r\n this._data.sort((a, b) => a.sortOrder !== b.sortOrder ? b.sortOrder - a.sortOrder : a.value.localeCompare(b.value))\r\n }", "function price_asc(a,b){\nif (a.price<b.price){\n return -1;}\nif (a.price>b.price){\n return 1;}\nreturn 0\n}", "nameSort() {\n orders.sort( \n function(a,b) {\n return (a[0] < b[0]) ? -1 : (a[0] > b[0]) ? 1 : 0; \n }\n ); \n }", "sortData(data){\n\t\tif(!this.dtInstance)\n\t\t\treturn;\n\n\t\tlet _self = this;\n\t\tlet order = this.dtInstance.order()[0];\n\t\tlet col = order[0], dir = order[1];\n\t\tif(this.sortFns[col]) {\n\t\t\tlet sortFn = this.sortFns[col];\n\t\t\tdata.sort(function(a, b){\n\t\t\t\tlet aa = sortFn(a, col),\n\t\t\t\t\tbb = sortFn(b, col);\n\n\t\t\t\tif(dir == \"asc\")\n\t\t\t\t\treturn ((aa < bb) ? -1 : ((aa > bb) ? 1 : 0));\n\t\t\t\tif(dir == \"desc\")\n\t\t\t\t\treturn ((bb < aa) ? -1 : ((bb > aa) ? 1 : 0));\n\t\t\t});\n\t\t}\n\n\t\treturn data;\n\t}", "function defaultOrderFn (a, b) {\n return a - b; // asc order\n}", "function sort_by_price_asc (a, b) { // as a user I want to see cheapest holidays\n return (a.paxPrice < b.paxPrice)\n ? 1 : ((b.paxPrice < a.paxPrice) ? -1 : 0);\n}", "function resort(){\n if(scope.sorting && scope.sorting.obj){\n var sortKey = scope.sorting.obj.field;\n sorter(sortKey,scope.sorting.direction);\n }\n }", "function resort(){\n if(scope.sorting && scope.sorting.obj){\n var sortKey = scope.sorting.obj.field;\n sorter(sortKey,scope.sorting.direction);\n }\n }", "function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function(a, b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n }", "function sortByName() {\n addressBook.sort(function (contact1,contact2){\n let a = contact1.firstName.toUpperCase()\n let b = contact2.firstName.toUpperCase()\n return a == b ? 0 : a > b ? 1: -1;\n })\n console.log(addressBook.toString());\n}", "repeaterOnSort() {\n }", "function dynamicSort(property) {\n var sortOrder = 1;\n if (property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n return function (a, b) {\n var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;\n return result * sortOrder;\n }\n }", "function sortAsc(a, b) {\n return a - b;\n }", "sortComparator(contactA, contactB) {\n if (contactA.statusType != contactB.statusType) {\n return contactB.statusType - contactA.statusType;\n }\n let a = contactA.displayName.toLowerCase();\n let b = contactB.displayName.toLowerCase();\n return a.localeCompare(b);\n }", "function sortByNameHandler() {\n let sorted = sortByName(myData);\n showData(sorted, document.getElementById(\"display\"));\n}", "function GetSortOrder(prop) { \n return function(a, b) { \n if (a[prop] > b[prop]) { \n return 1; \n } else if (a[prop] < b[prop]) { \n return -1; \n } \n return 0; \n } \n }", "function sortTable() {\n const col = this.dataset.colname;\n const order = this.dataset.order;\n const nameCapi = col.charAt(0).toUpperCase() + col.slice(1);\n\n if (col == 'birthdate') {\n // for date sorting\n\n if (order == 'desc') {\n this.dataset.order = 'asc';\n this.innerHTML = `${nameCapi} &#9660`;\n tableData = tableData.sort((a, b) =>\n new Date(a[col]) > new Date(b[col]) ? 1 : -1\n );\n } else {\n this.dataset.order = 'desc';\n this.innerHTML = `${nameCapi} &#9650`;\n tableData = tableData.sort((a, b) =>\n new Date(a[col]) < new Date(b[col]) ? 1 : -1\n );\n }\n }\n // string & number sorting\n else if (order == 'desc') {\n this.dataset.order = 'asc';\n this.innerHTML = `${nameCapi} &#9660`;\n tableData = tableData.sort((a, b) => (a[col] > b[col] ? 1 : -1));\n } else {\n this.dataset.order = 'desc';\n this.innerHTML = `${nameCapi} &#9650`;\n tableData = tableData.sort((a, b) => (a[col] < b[col] ? 1 : -1));\n }\n\n buildTable(tableData);\n}", "function makeSortby(attribute) {\n\treturn function(a, b) {\n\t\tif (a[attribute] != undefined && b[attribute] != undefined) {\n\t\t\ta = a[attribute].toLowerCase();\n\t\t\tb = b[attribute].toLowerCase();\n\t\t\tif (a < b) return -1;\n\t\t\tif (a > b) return 1;\n\t\t\treturn 0;\n\t\t}\n\t}\n}", "function makeSortby(attribute) {\n\treturn function(a, b) {\n\t\tif (a[attribute] != undefined && b[attribute] != undefined) {\n\t\t\ta = a[attribute].toLowerCase();\n\t\t\tb = b[attribute].toLowerCase();\n\t\t\tif (a < b) return -1;\n\t\t\tif (a > b) return 1;\n\t\t\treturn 0;\n\t\t}\n\t}\n}", "function makeSortby(attribute) {\n\treturn function(a, b) {\n\t\tif (a[attribute] != undefined && b[attribute] != undefined) {\n\t\t\ta = a[attribute].toLowerCase();\n\t\t\tb = b[attribute].toLowerCase();\n\t\t\tif (a < b) return -1;\n\t\t\tif (a > b) return 1;\n\t\t\treturn 0;\n\t\t}\n\t}\n}", "function sortByName(c1,c2) {\n var c1Label = data.maps.columnIdToLabel[c1],\n c2Label = data.maps.columnIdToLabel[c2];\n\n return d3.ascending(c1Label, c2Label);\n //return d3.ascending(data.labels.columns[c1],data.labels.columns[c2]);\n }", "function alphabeticalOrder(arr) {\n // Add your code below this line\n return arr.sort()\n\n // Add your code above this line\n}", "function makeSortby(attribute) {\n return function(a, b) {\n if (a[attribute] != undefined && b[attribute] != undefined) {\n a = a[attribute].toLowerCase();\n b = b[attribute].toLowerCase();\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n }\n }\n}", "function sortAnwsersByDomains() {\n}", "function msortBy(cmp, l){\r\n return mergesort(cmp, l);\r\n}", "function createSortingListeners() {\n var SortByAlphaTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_alpha_nam\");\n if (SortByAlphaTempItem != null) {\n SortByAlphaTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForAlphaSort();\n }, false);\n }\n\n var SortByRateTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_rate\");\n if (SortByRateTempItem != null) {\n SortByRateTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForRateSort();\n }, false);\n }\n\n var SortByDateTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_date\");\n if (SortByDateTempItem != null) {\n SortByDateTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForDateSort();\n }, false);\n }\n\n var SortByDealTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_deals\");\n if (SortByDealTempItem != null) {\n SortByDealTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForDealSort();\n }, false);\n }\n\n var SortByCycleTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_cycle\");\n if (SortByCycleTempItem != null) {\n SortByCycleTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForCycleSort();\n }, false);\n }\n\n var SortByOutBlaTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_out_balance\");\n if (SortByOutBlaTempItem != null) {\n SortByOutBlaTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForBlanceSort();\n }, false);\n }\n\n var SortByPaidTempItem = document.getElementById(\"js-evolution-divtable-trigger_sort_by_paid_amount\");\n if (SortByPaidTempItem != null) {\n SortByPaidTempItem.addEventListener(\"click\", function () {\n clickEventHandlerForAmountSort();\n }, false);\n }\n }", "sortingFunction() {\n let records = this.get('content');\n if (isArray(records) && records.length > 1) {\n let sorting = this.get('sorting') || [];\n if (sorting.length === 0) {\n sorting = [{ propName: 'id', direction: 'asc' }];\n }\n\n for (let i = 0; i < sorting.length; i++) {\n let sort = sorting[i];\n if (i === 0) {\n records = this.sortRecords(records, sort, 0, records.length - 1);\n } else {\n let index = 0;\n for (let j = 1; j < records.length; j++) {\n for (let sortIndex = 0; sortIndex < i; sortIndex++) {\n if (records.objectAt(j).get(sorting[sortIndex].propName) !== records.objectAt(j - 1).get(sorting[sortIndex].propName)) {\n records = this.sortRecords(records, sort, index, j - 1);\n index = j;\n break;\n }\n }\n }\n\n records = this.sortRecords(records, sort, index, records.length - 1);\n }\n }\n\n this.set('content', records);\n }\n\n let componentName = this.get('componentName');\n this.get('_groupEditEventsService').geSortApplyTrigger(componentName, this.get('sorting'));\n }", "function handleSort(category) {\n if (category === 'name') {\n // Syntax 1\n setContacts([...contacts].sort((a,b) => a.name > b.name ? 1 : -1))\n }\n if (category === 'popularity') {\n // Syntax 2\n let copyContacts = [...contacts]\n copyContacts.sort((a,b) => a.popularity < b.popularity ? 1 : -1)\n setContacts(copyContacts)\n }\n }", "sortData() {\n this.data.sort(($val1, $val2 ) => {\n const a = JSON.stringify($val1[this.sortBy]);\n const b = JSON.stringify($val2[this.sortBy]);\n if ( a < b ){\n return -this.sortDir;\n }\n if ( a > b ){\n return this.sortDir;\n }\n return 0;\n });\n }", "function sortAlpha(a, b){\r\n\t if(a < b) return -1;\r\n\t if(a > b) return 1;\r\n\t return 0;\r\n}//sortAlpha", "static byPrice() {\n // how to sort in descending order\n // var points = [40, 100, 1, 5, 25, 10];\n // points.sort(function(a, b){return b-a});\n return store.meals.sort(function(a, b) {return b.price - a.price});\n }", "function sortRepos(wantAsc) {\n // if we don't have an existing filter in place, use jsondata as our list of elements\n if (filteredRepoList.length == 0) {\n for (var m = 0; m < jsondata.length; m++) {\n filteredRepoList[m] = jsondata[m];\n }\n }\n\n // we'll need to do different things based on which sort has been selected.\n var sortBy = document.getElementById(\"sortBy\").value;\n\n /*\n I think the code from here might do the trick: http://www.levihackwith.com/code-snippet-how-to-sort-an-array-of-json-objects-by-property/\n The three elements all are conveniently sortable by their naive data type.\n I kept the function name, so see below for the appropriated code.\n */\n if (wantAsc) {\n filteredRepoList.sort(sortAscByProperty(sortBy));\n } else {\n filteredRepoList.sort(sortDescByProperty(sortBy));\n }\n // then rebuild the projects list\n document.getElementById(\"projects\").innerHTML = parseData(filteredRepoList);\n}", "_resort() {\n // Ensure there's something to do.\n if (!this.orderComponents) return;\n\n // Define the comparator for the sort.\n /**\n * Return a comparison result for the two given models, honouring each\n * comparitor in order of their inclusion in the component list. \n */\n const compareModels = (a, b) => {\n for (let i = 0; i < this.orderComponents.length; i++) {\n // Comprehend this order component.\n const {\n identity: {attribute, type}, value: direction\n } = this.orderComponents[i];\n\n // Use the type comparator to retrieve and integer result of\n // the comparison.\n let value = type.compareValues(a[attribute], b[attribute]);\n // Modify based on order.\n if (direction == 'desc') value *= -1;\n // If this comparator found a difference between the two,\n // return it. Note that if it didn't, the next gets a chance\n // to.\n if (value > 0 || value < 0) return value;\n }\n\n return 0;\n };\n\n // Perform the sort.\n this._value.sort(compareModels);\n }", "function createFieldSorter(sort) {\n\n function getFieldValuesAsArray(doc) {\n return sort.map(function (sorting) {\n var fieldName = getKey(sorting);\n var parsedField = parseField(fieldName);\n var docFieldValue = getFieldFromDoc(doc, parsedField);\n return docFieldValue;\n });\n }\n\n return function (aRow, bRow) {\n var aFieldValues = getFieldValuesAsArray(aRow.doc);\n var bFieldValues = getFieldValuesAsArray(bRow.doc);\n var collation = Object(__WEBPACK_IMPORTED_MODULE_1_pouchdb_collate__[\"a\" /* collate */])(aFieldValues, bFieldValues);\n if (collation !== 0) {\n return collation;\n }\n // this is what mango seems to do\n return compare(aRow.doc._id, bRow.doc._id);\n };\n}" ]
[ "0.7149059", "0.6557632", "0.6550187", "0.6485365", "0.6314142", "0.6288456", "0.61877185", "0.6148073", "0.6117516", "0.6109166", "0.6103078", "0.6088733", "0.6086583", "0.6071376", "0.6071376", "0.6070496", "0.6063526", "0.6044142", "0.6018052", "0.59916425", "0.59916425", "0.59916425", "0.59916425", "0.5980131", "0.59737414", "0.5973405", "0.595755", "0.5955546", "0.59250265", "0.59048283", "0.5889372", "0.58889353", "0.58889353", "0.5879403", "0.5859881", "0.5828187", "0.580704", "0.57975924", "0.579613", "0.5789676", "0.578947", "0.5788208", "0.5753818", "0.5752398", "0.5741383", "0.5736738", "0.5730758", "0.5729233", "0.57289237", "0.5704702", "0.5699337", "0.56991386", "0.5692879", "0.56875753", "0.56829464", "0.5681751", "0.5668052", "0.5656136", "0.565112", "0.564942", "0.5648418", "0.5644628", "0.56423664", "0.5637133", "0.5620565", "0.5620455", "0.5603288", "0.5585752", "0.5584486", "0.55751634", "0.5566135", "0.55658704", "0.5564683", "0.5558072", "0.5558072", "0.55573493", "0.5555307", "0.55468446", "0.55411804", "0.55393064", "0.5535755", "0.55316377", "0.55313694", "0.55299747", "0.55229115", "0.55229115", "0.55229115", "0.5522475", "0.551962", "0.5515328", "0.551257", "0.550724", "0.5506908", "0.55053437", "0.5497815", "0.54938555", "0.5492808", "0.54862064", "0.54860103", "0.54846567", "0.54686433" ]
0.0
-1
Returns the chosen companies on the form saved in the database
function chosenCompaniesDBFormat() { var dbFormatted = []; for(var i = 0; i < vm.chosenCompanies.length; i++) { dbFormatted.push({ name: vm.chosenCompanies[i].name, order: i + 1 }); } return dbFormatted; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadCompanies (companiesArray) {\n var companyForm = $(\"#company-selector\");\n \n for (company in companiesArray) {\n var currentCompany = companiesArray[company];\n companyForm.append(\"<g id=\\\"\" + currentCompany + \"-input\\\"><input type=\\\"checkbox\\\" id=\\\"\" +\n currentCompany + \n \"\\\"><label for=\\\"\" + currentCompany + \"\\\">\" + \n currentCompany + \"</label><br></g>\");\n }\n }", "function retrieveCompanies() {\r\n return JSON.parse(localStorage.getItem('companyListInternal')) || [];\r\n }", "function populateList(companies) {\n //Empty any visible options first\n document.getElementById(\"companies\").innerHTML = \"\";\n for (company of companies) {\n let option = document.createElement('option');\n let symbol = document.createAttribute(\"id\");\n symbol.value = `${company.symbol}`;\n option.setAttributeNode(symbol);\n option.text = `${company.name}`;\n document.getElementById(\"companies\").add(option);\n //Attribute is company symbol to be used in search function later\n }\n //Options available after the list has been loaded\n eventListenerOptions();\n }", "GetSelectedCompany() {\n console.debug(`ContaplusModel::GetSelectedCompany`)\n return this.config.get(\"company\")\n }", "function getCurrentCompany(){\n return $(\"#companies option:selected\").jjro().bound();\n}", "function GetCompanyByBossId(boos_id, comp_id) {\n let data = {\n boss_id: boos_id,\n __RequestVerificationToken: $('input[name=\"__RequestVerificationToken\"]').val()\n };\n\n $.ajax({\n type: \"POST\",\n url: \"/Department/GetCompany\",\n data: data,\n success: function (response) {\n let option = '<option value=\"0\">-- All Companies -- </option>';\n for (let i = 0; i < response.length; i++) {\n option += '<option value=\"' + response[i].PK_Comp_Id + '\">' + response[i].Comp_Name + '</option>';\n }\n $('#ddlEditCompany').html(option);\n $('#ddlEditCompany').val(comp_id);\n },\n error: function () {\n $('#ddlEditCompany').html('<option value=\"0\">-- All Companies --</option>');\n //$('#ddlLocation').html('<option value=\"0\">-- All Locations --</option>');\n }\n });\n }", "function handleCompanySelection () {\n var currentCompany = $(this).closest(\"g\").find(\"label\");\n var currentCompanyName = currentCompany.attr(\"for\").toString();\n \n if(currentCompany.hasClass(\"selected\")) {\n var index = selectedCompanies.indexOf(currentCompanyName);\n currentCompany.removeClass(\"selected\");\n if (selectedCompanies.length <= 1) {\n $(\"#please\").fadeIn(650); \n }\n selectedCompanies.splice(index, 1); \n removeCompany(currentCompanyName, index);\n $(this).closest(\"g\").prependTo(\"#unselected-container\");\n } else {\n selectedCompanies.push(currentCompany.attr(\"for\").toString());\n var index = selectedCompanies.indexOf(currentCompanyName);\n addCompany(currentCompanyName, index);\n \n currentCompany.addClass(\"selected\");\n $(this).closest(\"g\").prependTo(\"#selected-container\");\n }\n \n console.log(selectedCompanies);\n }", "function getCompany()\n{\n if(!preferences.get())return;\n var preferencesAux = eval(\"(\" + preferences.get() + ')');\n var tagsAux = preferencesAux.enterprise;\n var t = \"\";\n for (var k = 0; k < tagsAux.length; k++) \n\tt += tagsAux[k];\n getQuoteEnterprise([companyNameSlot.get()], [t]);\n}", "function getCompanyQuery() {\n getData(getCompanyParams);\n}", "function getCompanies() {\n axios\n .get(process.env.REACT_APP_API_URL + \"/companies\")\n .then((res) => {\n setCompanies(res.data);\n // console.log(res.data);\n })\n .catch((err) => {\n console.log(\"Error listing the companies\");\n });\n }", "function saveBusinessInfo() {\n const { company } = settings.data;\n\n const companyEntries = Object.entries(company);\n companyEntries.forEach(([key, value]) => {\n if (key === 'ids') {\n const idEntries = Object.keys(value);\n idEntries.forEach((k) => {\n settings.data.company.ids[k].name = document.getElementById(`business-${k}`).value;\n settings.data.company.ids[k].number = document.getElementById(`business-${k}-number`).value;\n });\n } else {\n settings.data.company[key] = document.getElementById(`business-${key}`).value;\n }\n });\n}", "function getCompanyParams() {\n\n // adds value specification to array\n var identities = [];\n identities.push('empmin');\n identities.push('empmax');\n identities.push('valuemin');\n identities.push('valuemax');\n identities.push('street');\n identities.push('zipCode');\n\n // adds value to array\n var params = [];\n params.push(document.getElementById('qp-min-emps').value);\n params.push(document.getElementById('qp-max-emps').value);\n params.push(document.getElementById('qp-min-market').value);\n params.push(document.getElementById('qp-max-market').value);\n params.push(document.getElementById('qp-street').value);\n params.push(document.getElementById('qp-zip-code').value);\n\n // adds value specification and value to array if value exist\n var queryParams = [];\n for (var index in params) {\n if (params[index] != '' && params[index] != null) {\n queryParams.push(identities[index] + \"=\" + params[index]);\n }\n }\n $('#company-params-modal').modal('hide');\n\n // returns a joined string with '&' seperation\n return \"company?\" + queryParams.join(\"&\");\n}", "function askCompany(session, args, next) {\n // First check to see if we either got a company from LUIS or have a an existing company\n // that we can multi-turn over.\n var company;\n var entity = builder.EntityRecognizer.findEntity(args.entities, 'CompanyName');\n if (entity) {\n // The user specified a company so lets look it up to make sure its valid.\n // * This calls the underlying function Prompts.choice() uses to match a users response\n // to a list of choices. When you pass it an object it will use the field names as the\n // list of choices to match against. \n company = builder.EntityRecognizer.findBestMatch(data, entity.entity);\n } else if (session.dialogData.company) {\n // Just multi-turn over the existing company\n company = session.dialogData.company;\n }\n \n // Prompt the user to pick a ocmpany if they didn't specify a valid one.\n if (!company) {\n // Lets see if the user just asked for a company we don't know about.\n var txt = entity ? session.gettext(prompts.companyUnknown, { company: entity.entity }) : prompts.companyMissing;\n \n // Prompt the user to pick a company from the list. They can also ask to cancel the operation.\n builder.Prompts.choice(session, txt, data);\n } else {\n // Great! pass the company to the next step in the waterfall which will answer the question.\n // * This will match the format of the response returned from Prompts.choice().\n next({ response: company })\n }\n}", "static async getAllCompanies(data={}) {\n let res = await this.request('companies/', data);\n return res.companies;\n }", "function storeCompanies(companies) {\n for (let company of companies) {\n loadedCompanies.push(company);\n addStorage(company);\n }\n document.querySelector(\"#companyLoader\").style.display = \"none\";\n populateList(loadedCompanies);\n }", "function showNewModal(companies) {\n\n let companySelect = \"\"\n\n companies.forEach(company => {\n companySelect += `<option value=\"${company._id}\">${company.name}</option>`\n })\n\n // reset the modal content\n modalBody.html('')\n\n // render modal create form\n modalBody.html(`\n <form class=\"needs-validation\">\n <label class=\" mb-1\" for=\"id\">id:</label>\n <input class=\"form-control\" type=\"text\" name=\"id\", value=\"\" placeholder = \"id\" required>\n \n <label class=\"mt-2 mb-1\" for=\"first-name\">first name:</label>\n <input class=\"form-control\" type=\"text\" name=\"first-name\", value=\"\" placeholder = \"first name\" required>\n \n <label class=\"mt-2 mb-1\" for=\"last-name\">last name:</label>\n <input class=\"form-control\" type=\"text\" name=\"last-name\", value=\"\" placeholder = \"last name\" required>\n \n <label class=\"mt-2 mb-1\" for=\"gender\">gender:</label>\n <select name=\"gender\" class=\"form-select\" aria-label=\"gender\" required>\n <option === \"male\" ? \"selected\": \"\"} value=\"male\">male</option>\n <option === \"female\" ? \"selected\": \"\"} value=\"female\">female</option>\n </select>\n \n <label class=\"mt-2 mb-1\" for=\"position\">position:</label>\n <select name=\"manager\" class=\"form-select\" aria-label=\"manager\" required>\n <option === true ? \"selected\": \"\"} value=\"true\">manager</option>\n <option === false ? \"selected\": \"\"} value=\"false\">employee</option>\n </select>\n \n <label class=\"mt-2 mb-1\" for=\"birthday\">birthday:</label>\n <input class=\"form-control form-control-date\" type=\"date\" name=\"birthday\", value=\"\" placeholder = \"birthday\" required>\n \n <label class=\"mt-2 mb-1\" for=\"company\">company:</label>\n\n <select name=\"company\" class=\"form-select\" aria-label=\"manager\" placeholder=\"company\" required>\n ${companySelect}\n </select>\n \n <div card-id=\"\" id=\"create-employee\" class=\"d-flex justify-content-end \">\n <button class=\"btn btn-primary w-auto mt-3 mb-0 justify-self-end\">create</button>\n </div>\n\n </form>\n `)\n}", "function getCompany() {\n $.post(\"/JobOrder/getCustomerCompany\",\n {\n id: $(\"#ac-custId option:selected\").val()\n },\n function (data, status) {\n console.log(data);\n $('#CompanyId').val(data);\n $('#company-textfield').val($(\"#CompanyId option:selected\").text());\n });\n}", "static async getCompanies(search) {\n const res = await this.request(`companies`, { search });\n return res.companies;\n }", "getAll() {\n return Resource.get(this).resource('SupplierCompany:getAll')\n .then((res) => {\n this.companies = res;\n });\n }", "function setEditValuesCompany(index) {\n\n // generic list/ object initializer\n var jsonObject = (!Array.isArray(fetchData)) ? fetchData : fetchData[index];\n\n // general setters\n document.getElementById('edit-company-title').innerText = jsonObject['name'] + \" (cvr: \" + jsonObject['cvr'] + \")\";\n document.getElementById('edit-company-email').value = jsonObject['email'];\n\n // phones setters\n document.getElementById('company-phone-container').innerHTML = \"<h5><b>phones</b></h5>\";\n for (var phone in jsonObject['phones']) {\n document.getElementById('company-phone-container').innerHTML += \"<input type='text' class='form-control' value='\" + jsonObject['phones'][phone] + \"'>\";\n }\n\n // address setters\n if(jsonObject['address'] != undefined) document.getElementById('edit-company-street').value = jsonObject['address'];\n if(jsonObject['city'] != undefined) document.getElementById('edit-company-city').value = jsonObject['city'];\n if(jsonObject['zipCode'] != undefined) document.getElementById('edit-company-zipcode').value = jsonObject['zipCode'];\n\n // company info setters\n document.getElementById('edit-company-value').value = jsonObject['marketValue'];\n document.getElementById('edit-company-employees').value = jsonObject['numEmployees'];\n}", "function posicionarCombos() { \n\t\t//combo tipoSolicitud\n\t\tvar iSeleccionadoTipoSol = new Array(); \n\t\tiSeleccionadoTipoSol[0] = get('frmFormulario.hOidTipoSolicitud'); \n\t\tset('frmFormulario.cbTipoSolicitud',iSeleccionadoTipoSol); \n\n\t\t//combo periodos\n\t\tvar iSeleccionadoPeriodo = new Array(); \n\t\tiSeleccionadoPeriodo[0] = get('frmFormulario.hPeriodo'); \n\t\tset('frmFormulario.cbPeriodo',iSeleccionadoPeriodo); \n\t}", "function companySelectHandler(event) {\n var companyID;\n // Declare a local variable to store the ID of the current company\n companyID = $(\"#formCompanyList\").find('option:selected').val();\n // orgID = $(\"#orgList\").find('option:selected').val();\n localCompany = getCurrentCompany(companyID);\n\n loadForm(localCompany);\n\n // Load the master roles to use when defining the current org roles\n loadMasterRolesByCompany(localCompany.CompanyID,populateMasterRoles, errorHandler);\n\n // Set the current company\n// setCompany(companyID);\n }", "function displayCompanyPage(req, res, next) {\n // Find all of the current companies\n const mysql = req.app.get('mysql');\n let sql_query = `SELECT * FROM Companies`;\n let context = {};\n\n mysql.pool.query(sql_query, (err, rows) => {\n if (err) {\n next(err);\n return;\n }\n\n // Put the mysql data into an array for rendering\n let companyDbData = [];\n for (let i in rows) {\n companyDbData.push({\n companyId: rows[i].companyId,\n companyName: rows[i].companyName,\n dateJoined: rows[i].dateJoined,\n });\n }\n context.companies = companyDbData;\n res.render('add-company', context);\n });\n}", "function saveForm() {\n return saveCompanySite()\n .then(saveInternalNumbers);\n }", "function listarCompanies() {\n\n EmpresasService.listar().then(function correcto(resp) {\n\n for (var i = 0; i < resp.length; i++) {\n\n $scope.companies = resp;\n }\n\n }, function error(error) {\n\n console.log(error);\n\n })\n\n }", "function addCompany() {\n var company = {};\n company.name = document.getElementById('c-name').value;\n company.email = document.getElementById('c-email').value;\n company.description = document.getElementById('c-desc').value;\n company.cvr = document.getElementById('c-cvr').value;\n company.numEmployees = document.getElementById('c-emps').value;\n company.marketValue = document.getElementById('c-value').value;\n var data = JSON.stringify(company);\n setData(data, \"company\");\n}", "static async getCompany(handle) {\n const res = await this.request(`companies/${handle}`);\n return res.company;\n }", "static async getCompany(handle) {\n const res = await this.request(`companies/${handle}`);\n return res.company;\n }", "function Companies() {\n const [companies, setCompanies] = useState();\n\n //gather all companies. set companies state to result.\n useEffect(function () {\n async function getComps() {\n let comps = await JoblyApi.getCompanies();\n setCompanies(comps);\n }\n getComps();\n }, []);\n\n //search for a company, set companies state to result.\n async function search(name) {\n let comps = await JoblyApi.getCompanies(name);\n setCompanies(comps);\n }\n\n if (companies) {\n return (\n <div className=\"container\">\n <SearchForm searchFor={search}/>\n <CardGroup className=\"companies\">\n {companies.map((c) => {\n return <CompanyCard c={c} key={c.handle} />;\n })}\n </CardGroup>\n </div>\n );\n } else {\n return <Spinner color=\"dark\" />;\n }\n}", "function onCompanyChange(e) {\n setCompany({\n ...company,\n [e.target.name]: e.target.value\n })\n }", "async function getCompanies() {\n try {\n let companies = await companySchema.find({}, {__v:0}).populate(\n {\n path: 'city',\n select: 'name'\n } \n );\n return companies;\n } catch (error) {\n console.log(\"[ERROR] While trying to run the getCompanies() function, error msg: \" + error);\n }\n}", "static async getCompany(handle) {\n let res = await this.request(`companies/${handle}`);\n return res.company;\n }", "function company_query(frm, cdt, cdn) {\n\tconst row = frm.selected_doc || locals[cdt][cdn];\n\treturn {\n\t\tfilters: {\n\t\t\t\"company\": row.company,\n\t\t\t\"is_group\": 0\n\t\t}\n\t};\n}", "function getClientsByCompanyName(entity, callback) {\n doAjaxCall('GET', encodeURI('/api/v1/clients?company_name=' + entity), null, function(jsonData) {\n callback(jsonData.clients.length > 0 && jsonData.clients[0].hasOwnProperty('client_id') ? jsonData.clients[0].client_id : 0);\n });\n}", "function renderCompanies() {\n return companies.map(company =>\n <CompanyCard \n key={company.handle} \n handle={company.handle}\n name={company.name}\n description={company.description}\n numEmployees={company.numEmployees}\n />);\n }", "getAllCompaniesWithIndustry() {\n return this.industries[0].industries;\n }", "function getEnergyCompanys(res, mysql, context, complete){\n mysql.pool.query(\"SELECT energy_company_id, energy_company_name, net_worth FROM energy_company\", function(error, results, fields){\n if(error){\n res.write(JSON.stringify(error));\n res.end();\n }\n context.energy_companys = results;\n complete();\n });\n }", "function populateForm() {\n \n //TODO: Add an <option> tag inside the form's select for each product\n \n var selectElement1 = document.getElementById('items');\n for (var i=0;i<assets.length;i++) {\n var options = document.createElement('option');\n selectElement1.appendChild(options);\n options.textContent= assets[i].split('.')[0];\n\n }\n \n \n\n}", "function formPreRequisits(){\n $.get({\n async: false,\n url: '\\getbus',\n dataType: 'JSON'\n }).done((response)=>{\n let checkBoxHtml = '';\n const checkBoxes = response.bus;\n $.each(checkBoxes, (checkBox, key)=>{\n checkBoxHtml += '<input type=\"checkbox\" class=\"chk-col-blue checkall\" name=\"buid[]\" id=\"' + key + '\" value=\"'+ key +'\" /><label for=\"' + key + '\">' + checkBox + '</label>';\n });\n $('.bus').html(checkBoxHtml);\n });\n \n $.get({\n async: false,\n url: '\\getusers',\n dataType: 'JSON'\n }).done((response)=>{\n var selectOpts = response.users;\n var optionsCount, pointer;\n optionsCount = pointer = response.users.length;\n if (users.children().length > 1) {\n users.children().first().siblings().remove();\n }\n while (pointer > 0) {\n var index = optionsCount - pointer;\n users.append('<option value=\"' + selectOpts[index] + '\">' + selectOpts[index] + '</option>');\n pointer--;\n }\n }).then(()=>{\n users.chosen('destroy');\n users.chosen({no_results_text: \"Oops, nothing found!\"});\n });\n}", "function onChangeComp (value){\n setCompanyName(value);\n for (var i in basedata){\n var name = basedata[i].name;\n if(name === value){\n // console.log(\"enter?\")\n setInspect(basedata[i]);\n getRadial();\n \n setInfoCountry(basedata[i].country_code);\n setInfocity(basedata[i].city);\n setInfoRegion(basedata[i].region);\n setInfoaddress(basedata[i].address);\n setInfodescription(basedata[i].short_description);\n \n setInfofundround(basedata[i].num_funding_rounds.toString());\n setInfofundamt(basedata[i].total_funding_usd.toString());\n setInfoemployeeSize(basedata[i].employee_count);\n \n setInfostatus(basedata[i].status);\n setInfoFundstatus(basedata[i].funding_status)\n setInforank(basedata[i].rank);\n setInfoCate(basedata[i].category_groups_list);\n setInfocrubLink(basedata[i].cb_url);\n setInfoweblink(basedata[i].homepage_url);\n idex = i;\n }\n }\n }", "getCompanies(){\n return new Promise( (resolve, reject)=>{\n Company.find((err, companies)=>{\n if(err){\n reject({err: err.message});\n }\n else{\n let companyNames = [];\n for(let company of companies){\n companyNames.push(company.name);\n }\n resolve(companyNames);\n }\n });\n });\n }", "function fetchCompanies() {\n fetch(companiesAPI)\n .then(response => response.json())\n .then(data => {\n storeDataIntoList(data);\n outputCompanyList(data);\n })\n .catch((error) => {\n console.log(error);\n });\n }", "function getProducts(company){\n var productList = Company.findOne({\"_id\": company});\n return productList;\n}", "function companySelectHandler(event) {\n var companyID;\n // Declare a local variable to store the ID of the current company\n companyID = $(\"#formCompanyList\").find('option:selected').val();\n // orgID = $(\"#orgList\").find('option:selected').val();\n if (companyID > 0) {\n localCompany = getCurrentCompany(companyID);\n\n // Load the master roles to use when defining the current org roles\n loadMasterRolesByCompany(companyID, populateMasterRoles, errorHandler);\n\n loadForm(localCompany);\n }\n else {\n clearDetailContent();\n }\n }", "function SaveCompany() {\n AsyncStorageLibrary.SaveCompany(props.symbol, props.companyName, props.lastSalePrice, props.lastUpdated, props.tradeData.trades[props.tradeData.trades.length - 1].price);\n setState((prevState) => {\n return ({\n ...prevState,\n favorited: true\n });\n });\n }", "function FillFormSelect() {\n //Categories\n let cat = [];\n for (let el of Categories.values()) {\n cat.push(el);\n }\n $(\"#formCategoryId\").empty();\n $(\"#formCategoryId\").append($('<option>', { value: -1, text: \"New Category\" }));\n cat.sort((a, b) => a.Name < b.Name);\n for (let category of cat) {\n $('<option>', { value: category.Id, text: category.Name }).appendTo(\"#formCategoryId\");\n }\n\n //Publishers\n let pub = [];\n for (let el of Publishers.values()) {\n pub.push(el);\n }\n pub.sort((a, b) => a.Name < b.Name);\n $(\"#formPublisherId\").empty();\n $(\"#formPublisherId\").append($('<option>', { value: -1, text: \"New Publisher\" }));\n for (let publisher of pub) {\n $('<option>', { value: publisher.Id, text: publisher.Name }).appendTo(\"#formPublisherId\");\n }\n\n //Languages\n let lan = [];\n for (let el of Languages.values()) {\n lan.push(el);\n }\n lan.sort((a, b) => a.Name < b.Name);\n $(\"#formLanguageId\").empty();\n $(\"#formLanguageId\").append($('<option>', { value: -1, text: \"New Language\" }));\n for (let language of lan) {\n $('<option>', { value: language.Id, text: language.Name }).appendTo(\"#formLanguageId\");\n }\n\n //Authors\n let auth = [];\n for (let el of Authors.values()) {\n auth.push(el);\n }\n auth.sort((a, b) => `${a.FirstName}${a.LastName}` < `${b.FirstName}${b.LastName}`);\n $(\"#formAuthorId\").empty();\n $(\"#formAuthorId\").append($('<option>', { value: -1, text: \"New Author\" }));\n for (let author of auth) {\n $('<option>', { value: author.Id, text: `${author.FirstName} ${author.LastName}` }).appendTo(\"#formAuthorId\");\n }\n }", "function getEnergyCompanys(res, mysql, context, complete){\n mysql.pool.query(\"SELECT energy_company_id, energy_company_name, net_worth FROM energy_company\", function(error, results, fields){\n if(error){\n res.write(JSON.stringify(error));\n res.end();\n }\n context.energy_companys = results;\n complete();\n });\n }", "function addExperience(company, url){\n let newCompany = {\n companyName: company[0].value,\n title: company[1].value,\n city: company[2].value,\n state: company[3].value,\n startDate: company[4].value,\n endDate: company[5].value,\n url: company[6].value, \n logo: company[7].value,\n hideOnPrint: company[8].checked ? true : false\n }\n \n if(newCompany.companyName && newCompany.title && newCompany.city && newCompany.state && newCompany.startDate){\n $.post(url, { newCompany: newCompany })\n .then(function(addedCompany){\n // reset the form\n resetForm(company);\n // REFACTOR THIS SO IT DOESNT REBUILD THE ENTIRE LIST EVERY TIME\n // append new company to list \n // appendExperience(addedCompany, addedCompany);\n rebuildExperienceList(url); \n \n // append to company to dropdown\n $('#company-dd').append('<option>' + addedCompany.companyName + '</option>')\n })\n .catch(function(err){\n throwErr(err);\n });\n }\n}", "function getLicences() {\n\n //these are the licenses provided from the spec that the user can select in a dropdown format\n const licenses = [\"CC BY\", \"CC BY-NC\", \"CC BY-NC-ND\", \"CC BY-NC-SA\", \"CC BY-SA\", \"EMUCL\", \"GFDL\", \"GGPL\", \"OPL\", \"PD\"]\n const licenseList = document.getElementById('license-select');\n\n for(let i = 0; i < licenses.length; i++) {\n const licenseListItem = document.createElement(\"option\");\n licenseListItem.textContent = licenses[i];\n licenseListItem.value = licenses[i];\n licenseList.appendChild(licenseListItem);\n }\n\n $('#license-select').multiselect({\n includeSelectAllOption: true,\n buttonText: function(options, select) {\n return 'Select one or more';\n },\n onChange: function(option, checked, select) {\n $(option).each(function(index, id) {\n let i = licenseArr.indexOf(id.value);\n if (i === -1) {\n licenseArr.push(id.value); \n } else {\n licenseArr.splice(i, 1);\n if (licenseArr.length === 0) {\n licenseArr.push(0);\n }\n }\n });\n searchBooksObj.licenseCodes = licenseArr;\n },\n onSelectAll: function() {\n searchBooksObj.licenseCodes = $('#license-select').val();\n }\n });\n}", "getCompany(companyId) {\n return Resource.get(this).resource('Admin:getCompany', {companyId})\n .then((res) => {\n this.displayData.company = res;\n });\n }", "static async getAll() {\n const results = await db.query(`\n SELECT * FROM companies\n `)\n return results.rows\n }", "function getCompanies() {\n const query = {\n name: \"get-companies\",\n text: \"select name from companies\"\n }\n\n return new Promise((resolve, reject) => {\n postgres.query(query, (error, results) => {\n if (typeof results !== 'undefined') {\n const rows = results.rows;\n\n if (rows.length > 0) {\n // The result data will be a list of json objects, parse through each and just return an array of symbols to the client\n let data = [];\n rows.forEach(d => {\n data.push(d.name);\n });\n data.sort();\n\n resolve(data);\n }\n }\n\n reject(error);\n });\n })\n}", "function create_entity_list_form() {\n var str_array = [];\n str_array.push(\"<form name='entities'>\");\n str_array.push(\"<select name='entity' onchange='update_entity_select(this.options[this.selectedIndex].value);'>\");\n for(var ent in Domain.entities) {\n var sel = \"\";\n if(ent == \"User\") {\n sel = \"selected\";\n }\n str_array.push(\"<option value='\" + ent + \"' \" + sel + \">\" + ent + \"</option>\");\n }\n str_array.push(\"</select>\");\n str_array.push(\"</form>\");\n return str_array.join(\"\\n\");\n}", "onChangeCompany(e) {\n this.setState({\n company: e.target.value,\n });\n }", "async getCompanyInfo() {\n //change to calling the company contract created by the owner\n //need a way to call company ID using the owner's connected address\n //should likely be added as a method to the registry\n // let coId = await payrollContract.methods.getCompanyId(this.state.account).call({from: this.state.account});\n this.getEmployeeArray(); \n this.getCompanyBalances();\n }", "async getCompany () {\n\t\tif ((!this.forInboundEmail && !this.forCommentEngine && !this.forSlack) || !this.team) {\n\t\t\t// only needed for inbound email, for tracking\n\t\t\t// or if no team, which can happen for replies to teamless code errors\n\t\t\treturn;\n\t\t}\n\t\tthis.company = await this.data.companies.getById(this.team.get('companyId'));\n\t}", "function loadCompanyOptions(rowId) {\n if (companies.length > 0) {\n //Do not make ajax request, but fetch it from locally stored value\n for (var i = 0; i < companies.length; i++)\n\t\t{\n $('#company' + rowId + '').append($(\"<option value='\" + companies[i].id + \"'>\" + companies[i].name + \"</option>\"));\n }\n } else {\n //Companies not avalable locally so Make an ajax request\n $.ajax({\n type: \"GET\",\n url: \"manualentry/companies\",\n dataType: \"json\",\n success: function(companiesJson) {\n\t\t\t\tsortByName(companiesJson,\"name\");\n for (var i = 0; i < companiesJson.length; i++) {\n var companyid = companiesJson[i].id;\n var companyname = companiesJson[i].name;\n var company = {\n id: companyid,\n name: companyname\n };\n companies.push(company);\n $('#company' + rowId + '').append($(\"<option value='\" + companyid + \"'>\" + companyname + \"</option>\"));\n }\n }\n });\n }\n}", "function refreshCompanyComboData(data) {\n // Delete the current data\n $(\"#formCompanyList\").empty();\n\n var index = 0;\n\n $(\"<option value='0'></option>\").appendTo($('#formCompanyList'));\n while (index < data.length) {\n var item = new Company();\n item.CompanyID = data[index].CompanyID;\n item.Name = data[index].Name;\n item.ContactName = data[index].ContactName;\n item.ContactAlias = data[index].ContactAlias;\n item.DomainName = data[index].DomainName;\n item.OrganizationRestricted = data[index].OrganizationRestricted;\n item.ProjectRestricted = data[index].ProjectRestricted;\n item.isActive = data[index].isActive;\n Companies.push(item);\n // Add a list item for the organization.\n $(\"<option value='\" + data[index].CompanyID + \"'></option>\").text(data[index].Name).appendTo($('#formCompanyList'));\n index++;\n }\n // $(\"<option value='-1'></option>\").text(\"[Add New Company ...]\").appendTo($('#formCompanyList'));\n $(\"#formCompanyList\").change(companySelectHandler);\n\n// loadForm();\n\n }", "function addName() {\n $('#company').val(companyInfo['name']);\n}", "static async getCompany({ handle }) {\n let apiResponse = await JoblyApi.request(`companies/${handle}`);\n return apiResponse.company;\n }", "function refreshCompanyComboData(data) {\n // Delete the current data\n $(\"#formCompanyList\").empty();\n\n var index = 0;\n\n $(\"<option value='0'></option>\").appendTo($('#formCompanyList'));\n while (index < data.length) {\n var item = new Company();\n item.CompanyID = data[index].CompanyID;\n item.Name = data[index].Name;\n item.ContactName = data[index].ContactName;\n item.ContactAlias = data[index].ContactAlias;\n item.DomainName = data[index].DomainName;\n item.OrganizationRestricted = data[index].OrganizationRestricted;\n item.ProjectRestricted = data[index].ProjectRestricted;\n item.isActive = data[index].isActive;\n Companies.push(item);\n // Add a list item for the organization.\n $(\"<option value='\" + data[index].CompanyID + \"'></option>\").text(data[index].Name).appendTo($('#formCompanyList'));\n index++;\n }\n $(\"#formCompanyList\").change(companySelectHandler);\n\n\n }", "function ReadCompanyFields () {\n\t\t\t\t\n\t\t\t//alert(\"(DEBUG)ReadCompanyFields()- starting\");\t\n\t\t\t\n\t\t\tif (typeof $scope.CompanyID2_Input_Model !== 'undefined' && $scope.CompanyID2_Input_Model !== null && $scope.CompanyID2_Input_Model !== \"\") {\n\t\t\t\tCompanyData.CompanyID2_FieldValue = $scope.CompanyID2_Input_Model; \n\t\t\t}else{\n\t\t\t\tCompanyData.CompanyID2_FieldValue = \"NONE\";\n\t\t\t}\n\t\t\t\n\t\t\tif (typeof $scope.CompanyEmail_Input_Model !== 'undefined' && $scope.CompanyEmail_Input_Model !== null && $scope.CompanyEmail_Input_Model !== \"\") {\n\t\t\t\tCompanyData.CompanyEmail_FieldValue = $scope.CompanyEmail_Input_Model; \n\t\t\t}else{\n\t\t\t\tCompanyData.CompanyEmail_FieldValue = \"NONE\";\n\t\t\t}\n\n\t\t\tif (typeof $scope.CompanyPhone_Input_Model !== 'undefined' && $scope.CompanyPhone_Input_Model !== null && $scope.CompanyPhone_Input_Model !== \"\") {\n\t\t\t\tCompanyData.CompanyPhone_FieldValue = $scope.CompanyPhone_Input_Model; \n\t\t\t}else{\n\t\t\t\tCompanyData.CompanyPhone_FieldValue = \"NONE\";\n\t\t\t}\n\t\t\t\n\t\t\tif (typeof $scope.CompanyAddress_Input_Model !== 'undefined' && $scope.CompanyAddress_Input_Model !== null && $scope.CompanyAddress_Input_Model !== \"\") {\n\t\t\t\tCompanyData.Address_FieldValue = $scope.CompanyAddress_Input_Model; \n\t\t\t}else{\n\t\t\t\tCompanyData.Address_FieldValue = \"NONE\";\n\t\t\t}\t\t\t\n\t\t\t\t\t\t\n\t\t\t$debug_string = \"\\nCompanyID2_FieldValue=\"+CompanyData.CompanyID2_FieldValue;\n\t\t\t$debug_string +=\"\\nCompanyEmail_FieldValue=\"+CompanyData.CompanyEmail_FieldValue;\n\t\t\t$debug_string +=\"\\nCompanyPhone_FieldValue=\"+CompanyData.CompanyPhone_FieldValue;\n\t\t\t$debug_string +=\"\\nCompanyAddress_FieldValue=\"+CompanyData.Address_FieldValue;\n\t\t\t//alert(\"(DEBUG)ReadCompanyFields()-data=\"+$debug_string);\n\t\t\t\n\t\t}", "function getCompanyInfo(current_id){\n\n // Declaring variables that hold the elements\n \n modal_company_name_element = document.getElementById(\"modal-company-name\");\n modal_company_desc_element = document.getElementById(\"modal-company-desc\");\n modal_company_address_element = document.getElementById(\"modal-company-address\");\n modal_company_tel_element = document.getElementById(\"modal-company-tel\");\n modal_company_email_element = document.getElementById(\"modal-company-email\");\n\n // Convert string id to number for iterative purposes\n current_id = current_id.replace(\"card-comp\", '');\n\n for (company in company_list){\n if (current_id === company_list[company]['id']){\n \n // Declaring variables that hold company information\n modal_company_name = company_list[company]['name'];\n modal_company_desc = company_list[company]['description'];\n modal_company_address = company_list[company]['address'];\n modal_company_tel = company_list[company]['tel'];\n modal_company_email = company_list[company]['email'];\n \n \n }\n } \n\n // Changing the contents of the element within the modal\n modal_company_name_element.innerHTML = modal_company_name;\n modal_company_desc_element.innerHTML = modal_company_desc;\n modal_company_address_element.innerHTML = modal_company_address;\n modal_company_tel_element.innerHTML = modal_company_tel;\n modal_company_email_element.innerHTML = modal_company_email;\n }", "function submitCompany(req, res, next) {\n const mysql = req.app.get('mysql');\n let sql_query = `INSERT INTO Companies (companyName, dateJoined) VALUES (?, ?)`;\n let context = {};\n\n mysql.pool.query(sql_query, [req.body.companyName, req.body.dateJoined], (err, result) => {\n if (err) {\n next(err);\n return;\n }\n \n context.companies = result.insertId;\n res.send(JSON.stringify(context));\n });\n}", "function getClientes() {\n apiService.post('GetClientesCampaigns', {}, function(resp) {\n var options = ['<option value=\"\">Seleccione...</option>'];\n if(typeof resp == 'object' && resp.length > 0) {\n resp.forEach(function(data, index) {\n options.push(configuraOption(data));\n if(appendReady(index, resp)) {\n $('#selectReporteCampanas').empty();\n $('#selectReporteCampanas').append(options.join(''));\n }\n });\n }\n });\n }", "function getCityVendorForReg(listOfMandal) {\n\tgetCity(listOfMandal);\n\tvar selectfirst = \"<option value='0'>Please Select City</option>\";\n\t$('#cityid').append(selectfirst);\n\t;\n\t$.each(city, function(i, resData) {\n\t\tconsole.log(\"restData----->\" + resData)\n\t\tvar city = \"<option value=\" + resData.cityId + \">\" + resData.cityName\n\t\t\t\t+ \"</option>\";\n\t\t$(city).appendTo('#cityid');\n\t});\n\t$('#cityid').trigger(\"chosen:updated\");\n\t$('#cityid').chosen();\n}", "function getFormValuesAndDisplayResults() {\n}", "function getListings(companyName) {\n return database.ref('/companies/' + companyName).once(\"value\");\n}", "function crmShowCuVeForEdit( crmData ){\n $( '#billaddr-greetings' ).html( '' );\n $( '#billaddr-greetings' ).append( '<option value=\"\">' + kivi.t8( \"Salutation as below\" ) + '</option>' );\n if( isIterable( crmData.greetings ) ){\n for( let description of crmData.greetings ) $( '#billaddr-greetings' ).append( '<option value=\"' + description.description + '\">' + description.description + '</option>' );\n }\n\n $( '#billaddr-business_id' ).html( '' );\n for( let business of crmData.business ) $( '#billaddr-business_id' ).append( '<option value=\"' + business.id + '\">' + business.name + '</option>' );\n\n if( exists( crmData.cv ) ){\n $.each( crmData.cv, function( key, value ){\n if( value ){\n $( '#billaddr-' + key ).val( value );\n }\n else{\n $( '#billaddr-' + key ).val( '' );\n }\n });\n $( '#billaddr-direct_debit' ).prop( 'checked', crmData.cv.direct_debit );\n }\n\n if( isIterable( crmData.deladdr ) ){\n $('#deladdr-list').html( '' );\n $('#deladdr-list').append( '<option value=\"\"></option>' );\n for (let i = 0; i < crmData.deladdr.length; i++){\n $( '#deladdr-list' ).append( '<option value=\"' + i + '\">' + ( ( crmData.deladdr[i].shiptoname )? crmData.deladdr[i].shiptoname : '' ) + '</option>' );\n }\n $( '#deladdr-list' ).change( function(){\n if( !$( this ).val() ){\n for( let e of deladdrFormModel ){\n if( e.name.startsWith( 'deladdr-shipto' ) ) $( '#' + e.name ).val( '' );\n }\n $( '#deladdr-shiptocountry' ).change();\n }\n else{\n $.each( crmData.deladdr[$( this ).val()], function( key, value ){\n if( value ){\n $( '#deladdr-' + key ).val( value );\n }\n else{\n $( '#deladdr-' + key ).val( '' );\n }\n });\n $( '#deladdr-shiptocountry' ).change();\n $( '#deladdr-shiptobland' ).val( crmData.deladdr[$( this ).val()].shiptobland );\n }\n });\n\n $( '#deladdr-list' ).change();\n }\n\n if( exists( crmData.branches ) ){\n for( let branche of crmData.branches ){\n $( '#billaddr-branches' ).append( '<option value=\"' + branche.name + '\">' + branche.name + '</option>' );\n }\n if( exists( crmData.cv ) && exists( crmData.cv.branche ) ) $( '#billaddr-branches' ).val( crmData.cv.branche );\n $( '#billaddr-branche' ).val( '' );\n }\n\n if( exists( crmData.employees ) ){\n for( let employee of crmData.employees ){\n $( '#billaddr-salesman_id' ).append( '<option value=\"' + employee.id + '\">' + employee.name + '</option>' );\n }\n if( exists( crmData.cv ) && exists( crmData.cv.employee ) ) $( '#billaddr-salesman_id' ).val( crmData.cv.employee );\n }\n\n if( exists( crmData.payment_terms ) ){\n for( let payment_term of crmData.payment_terms ){\n $( '#billaddr-payment_id' ).append( '<option value=\"' + payment_term.id + '\">' + payment_term.description + '</option>' );\n }\n if( exists( crmData.cv ) && exists( crmData.cv.payment_id ) ) $( '#billaddr-payment_id' ).val( crmData.cv.payment_id );\n }\n\n if( exists( crmData.tax_zones ) ){\n for( let tax_zone of crmData.tax_zones ){\n $( '#billaddr-taxzone_id' ).append( '<option value=\"' + tax_zone.id + '\">' + tax_zone.description + '</option>' );\n }\n if( exists( crmData.cv ) && exists( crmData.cv.taxzone_id ) ) $( '#billaddr-taxzone_id' ).val( crmData.cv.taxzone_id );\n }\n\n if( exists( crmData.languages ) ){\n for( let lang of crmData.languages ){\n $( '#billaddr-languages' ).append( '<option value=\"' + lang.id + '\">' + lang.description + '</option>' );\n }\n if( exists( crmData.cv ) && exists( crmData.cv.language_id ) ) $( '#billaddr-language' ).val( crmData.cv.language_id );\n }\n\n if( exists( crmData.leads ) ){\n for( let lead of crmData.leads ){\n $( '#billaddr-leads' ).append( '<option value=\"' + lead.id + '\">' + lead.lead + '</option>' );\n }\n if( exists( crmData.cv ) && exists( crmData.cv.lead ) ) $( '#billaddr-leads' ).val( crmData.cv.lead );\n }\n\n if( exists( crmData.vars_conf ) ){\n for( let var_conf of crmData.vars_conf ){\n if( var_conf.type ) {\n switch( var_conf.type ){\n case 'select':\n if( var_conf.data ) {\n var_conf.data = var_conf.data.split( '##' );\n var_conf.data.unshift('');\n }\n break;\n case 'text':\n var_conf.type = 'input';\n break;\n case 'textfield':\n var_conf.type = 'textarea';\n }\n }\n }\n crmInitFormEx( crmData.vars_conf, '#vars-form' );\n }\n\n if( exists( crmData.cv ) ){\n $( '#billaddr-business_id' ).val( crmData.cv.business_id );\n $( '#billaddr-country' ).change();\n $( '#billaddr-bland' ).val( crmData.cv.bland );\n $( '#deladdr-shiptocountry' ).change();\n }\n}", "async function onStorageCompanyEdit() {\n event.preventDefault();\n if (!$(\"#modalWindowBlock .modal #addForm\").valid()) {\n return;\n }\n\n let form = document.querySelector(\"#addForm\");\n let formData = new FormData(form);\n let parameters = new URLSearchParams(formData);\n\n await sendRequest(\"/storageCompanys\", \"put\", parameters);\n\n onModalClose();\n getItemsList(\"storageCompanys\");\n}", "function loadFormValues() {\n let industryId = $('#industryId').val();\n let formValues = getFormValuesObject();\n \n // combine any values that may exist for the industry or globally\n let industryValues = formValues[industryId] || {};\n let globalValues = formValues[\"global\"] || {};\n let combinedValues = mergeObjects(industryValues, globalValues);\n \n for (let inputId in combinedValues) {\n $(inputId).val(bigNum(combinedValues[inputId]));\n }\n}", "function companyChanged() {\n var _clientId = $(\"#companyBase\").val();\n if (userType == \"SYSADMIN\") {\n $(\".ccFields\").show();\n $(\"#merchAcctField\").show();\n $(\"#amountField\").show();\n $(\"#invoiceField\").show();\n $(\"#nameField\").show();\n $(\"#emailField\").show();\n $(\"#authCode\").show();\n $(\"#terminalField\").show();\n }\n\n loadMerchAccts(_clientId);\n}", "function add_brand_in_project(){\n //get selected items in selector\n let brands_selected = brands_selector.val();\n \n //add brand to list\n for(let i in brands_selected){\n let option_selected = brands_selector.find(\"option[value='\" + brands_selected[i] + \"']\");\n brands_added.append(template({\n id: brands_selected[i],\n title: option_selected.text()\n }));\n \n //remove option in selector\n option_selected.remove();\n }\n }", "getValues() {\n return {\n description: Form.description.value, \n amount: Form.amount.value,\n date: Form.date.value\n }\n }", "Options() {\n console.debug(`ContaplusCompany::Options`)\n let options = new Array()\n for (let i = 0; i < this.years.length; i++) {\n // Create a single-code Contaplus Company\n let value = new ContaplusCompany({\n name: this.name,\n }).Push(this.years[i], this.codes[i])\n // Label is year plus code\n let label = value.years[0] + \" (Cód.\" + value.codes[0] + \")\"\n // Add the option\n options.push([value, false, label])\n }\n // sort by year, descending\n function cmp(a, b) {\n let yearA = a[0].years[0]\n let yearB = b[0].years[0]\n return (yearB > yearA) ? 1 : ((yearB < yearA) ? -1 : 0)\n }\n options.sort(cmp)\n return options\n }", "fetchCompany() {\n fetch('http://localhost:8000/API/forms/company/' + this.props.params, {\n method: \"GET\"\n })\n .then(res => res.json())\n .then(res => {\n\n //Store response json to this state\n this.setState({\n currentCompany: res.companyForm\n })\n console.log(res.companyForm)\n })\n\n }", "function CreateCompanySearchString(){\n\t\t\t\n\t\t\t//alert(\"(DEBUG)CreateCompanySearchString()- starting\");\n\t\t\tvar URL = \"../engine/dBInterface.php?ActionDBToken=SelectCompany\";\n\n\t\t\tif(CompanyData.CompanyID2_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&CompanyID_Token=\"+CompanyData.CompanyID2_FieldValue;\n\t\t\t}\n\n\t\t\tif(CompanyData.CompanyEmail_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&Email_Token=\"+CompanyData.CompanyEmail_FieldValue;\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\tif(CompanyData.CompanyPhone_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&Phone_Token=\"+CompanyData.CompanyPhone_FieldValue;\n\t\t\t}\t\n\t\n\t\t\tif(CompanyData.Address_FieldValue!==\"NONE\"){\n\t\t\t\tURL += \"&Address_Token=\"+CompanyData.Address_FieldValue;\n\t\t\t}\n\t\t\t\n\t\t\t//alert(\"(DEBUG)CreateCompanySearchString()-ending.URL=\"+URL);\n\t\t\treturn URL;\n\t\t\n\t\t}", "function populateForm() {\n\n //TODO: Add an <option> tag inside the form's select for each product\n var selectElement = document.getElementById('items');\n for (var i in Product.allProducts) {\n var optionEl = document.createElement('option');\n optionEl.textContent = Product.allProducts[i].name;\n selectElement.appendChild(optionEl);\n }\n}", "function customerChoices() {\n var query = \"SELECT * FROM products\";\n connection.query(query, function (err, res) {\n if (err) throw err;\n for (i = 0; i < res.length; i++) {\n console.log(clc.cyanBright(\"Product ID: \" + res[i].item_id + \" | Item: \" + res[i].product_name + \" | Today's Price: $\" + res[i].price +'\\n'));\n }\n runSearch();\n });\n}", "function letsGo() {\r\n\r\n const inputVal = document.querySelector(\"#searchbar\").value;\r\n\r\n for (let i = 0; i < companies.length; i++) {\r\n if (companies[i].symbol === inputVal) {\r\n infoFill(companies[i]);\r\n }\r\n }\r\n\r\n }", "function LoadCompanyFields(data) {\n console.log(data);\n\n //parse data response to json object\n var temp = jQuery.parseJSON(data[\"responseText\"]);\n\n $(\"[name='AgentCompany']\").val(temp[\"Company\"]);\n $(\"[name='AgentPosition']\").val(temp[\"Position\"]);\n //$('#ac-position').val(temp[\"Position\"]);\n}", "function populateForm() {\n //TODO: Add an <option> tag inside the form's select for each product\n Product.allProducts.forEach((prod) => {\n createTheElement('option', prod.name, selectElement);\n });\n\n}", "function DisplayInvisibleCompanies(){\n\t\t\tif(logrequest.readyState == 4){\n\t\t\t\tif(logrequest.status == 200){\n\t\t\t\t\tvar response = JSON.parse(logrequest.responseText);\n\t\t\t\t\tif (response.length == 0){\n\t\t\t\t\t\talert(\"there is no other stocks to add\");\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tvar specStockContent = document.getElementById(\"specStockContent\");\n\t\t\t\t\t\tvar contents = \"<h3>Select Stocks to Add</h3>\";\n\t\t\t\t\t\t//stocks html contents for intialisation\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor(var i = 0; i < response.length; i++){\n\t\t\t\t\t\t\tcontents += \"<div class='item'>\";\n\t\t\t\t\t\t\tcontents += \"<input type='radio' value='\"+response[i].id+\"' name='InvisibleCompany'>\";\n\t\t\t\t\t\t\tcontents += \"<label>\"+response[i].companyname+\"</label>\";\n\t\t\t\t\t\t\tcontents += \"</div>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontents += \"<button onclick='JavaScript:validateCheckbox()' class='btn'>Add</button>\";\n\t\t\t\t\t\t//this button is the add button. if the user wants to selected any stocks to add, this is the buttont that user will click after that\n\t\t\t\t\t\tspecStockContent.innerHTML = contents;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\talert(logrequest.responseText);\n\t\t\t\t\tclearSpecStockpannel();\n\t\t\t\t}\n\t\t\t}\n\t\t}", "getAllChoices() {\n this.choices[0] = this.fixedChoice;\n return this.choices;\n }", "function renderCompany(name, data, parameters={}, options={}) {\n\n var html = select2Thumbnail(data.image);\n\n html += `<span><b>${data.name}</b></span> - <i>${trim(data.description)}</i>`;\n\n html += renderId('{% trans \"Company ID\" %}', data.pk, parameters);\n\n return html;\n}", "listByCompany(companyId) {\n const reqId = shortid.generate();\n return new Branch()\n .where({ company_id: companyId })\n .fetchAll()\n .then((branches) => {\n logger.info(\n `Request ID: ${reqId} - Branches for company with ID ${companyId} gotten`,\n );\n return branches;\n })\n .catch((error) => {\n logger.error(\n `Request ID: ${reqId} - Error getting branches for company with id ${companyId}: ${error}`,\n );\n throw error;\n });\n }", "function populateForm() {\n\n //TODO: Add an <option> tag inside the form's select for each product\n const selectElement = document.getElementById('items');\n for (let i in Product.allProducts) {\n let optionsEle = document.createElement('option');\n optionsEle.textContent = Product.allProducts[i].name;\n selectElement.appendChild(optionsEle); \n\n }\n\n}", "function searchCompany() {\r\n\tif (searchReq.readyState == 4 || searchReq.readyState == 0) {\r\n\t\tvar str = escape(document.getElementById('company').value);\r\n\t\tsearchReq.open(\"GET\", 'autocomplete/getcompany.php?search=' + str, true);\r\n\t\tsearchReq.onreadystatechange = handleSearchCompany; \r\n\t\tsearchReq.send(null);\r\n\t}\r\n}", "function getSubcontractors() {\n\t$.ajax({\n\t\ttype: 'POST',\n\t\turl: 'Project',\n\t\tdata: {\n\t\t\t'domain': 'project',\n\t\t\t'action': 'getSubcontractors',\n\t\t}, complete: function (data) {\n\t\t\tconsole.log(\"RESPONSE JSON FOR getSubcontractors() = \",data.responseJSON);\n\t\t\tif (data.responseJSON) {\n\t\t\t\tsubcontractors = data.responseJSON;\n\t\t\t\tfillSubcontractorDropdown();\n\t\t\t\tconsole.log(\"SUBCONTRACTOR NAMES = \", subcontractors);\n\t\t\t}\n\t\t}\n\t\t\n\t});\t\n}", "function createSearchForm() {\n \n // Add advanced mode criteria to simple form - start\n var advancedCriteria = [];\n var services = catalogue.services;\n// var orgNameField = new GeoNetwork.form.OpenSearchSuggestionTextField({\n// hideLabel: false,\n// minChars: 0,\n// hideTrigger: false,\n// url: services.opensearchSuggest,\n// field: 'orgName', \n// name: 'E_orgName', \n// fieldLabel: OpenLayers.i18n('org')\n// });\n // Multi select organisation field \n var orgNameStore = new GeoNetwork.data.OpenSearchSuggestionStore({\n url: services.opensearchSuggest,\n rootId: 1,\n baseParams: {\n field: 'orgName',\n sortBy: 'ALPHA'\n }\n });\n var orgNameField = new Ext.ux.form.SuperBoxSelect({\n hideLabel: false,\n minChars: 0,\n queryParam: 'q',\n hideTrigger: false,\n id: 'E_orgName',\n name: 'E_orgName',\n store: orgNameStore,\n valueField: 'value',\n displayField: 'value',\n valueDelimiter: ' or ',\n listWidth: 'width:auto',\n// tpl: tpl,\n fieldLabel: OpenLayers.i18n('org')\n });\n \n \n \n \n // Multi select keyword\n var themekeyStore = new GeoNetwork.data.OpenSearchSuggestionStore({\n url: services.opensearchSuggest,\n rootId: 1,\n baseParams: {\n field: 'keyword',\n sortBy: 'ALPHA'\n }\n });\n// FIXME : could not underline current search criteria in tpl\n// var tpl = '<tpl for=\".\"><div class=\"x-combo-list-item\">' + \n// '{[values.value.replace(Ext.getDom(\\'E_themekey\\').value, \\'<span>\\' + Ext.getDom(\\'E_themekey\\').value + \\'</span>\\')]}' + \n// '</div></tpl>';\n var themekeyField = new Ext.ux.form.SuperBoxSelect({\n hideLabel: false,\n minChars: 0,\n queryParam: 'q',\n hideTrigger: false,\n id: 'E_keyword',\n name: 'E_keyword',\n store: themekeyStore,\n valueField: 'value',\n displayField: 'value',\n valueDelimiter: ' or ',\n// tpl: tpl,\n fieldLabel: OpenLayers.i18n('keyword')\n// FIXME : Allow new data is not that easy\n// allowAddNewData: true,\n// addNewDataOnBlur: true,\n// listeners: {\n// newitem: function(bs,v, f){\n// var newObj = {\n// value: v\n// };\n// bs.addItem(newObj, true);\n// }\n// }\n });\n \n \n var when = new Ext.form.FieldSet({\n title: OpenLayers.i18n('when'),\n autoWidth: true,\n //layout: 'row',\n defaultType: 'datefield',\n collapsible: true,\n collapsed: true,\n items: GeoNetwork.util.SearchFormTools.getWhen()\n });\n \n \n var catalogueField = GeoNetwork.util.SearchFormTools.getCatalogueField(services.getSources, services.logoUrl, true);\n var groupField = GeoNetwork.util.SearchFormTools.getGroupField(services.getGroups, true);\n var metadataTypeField = GeoNetwork.util.SearchFormTools.getMetadataTypeField(true);\n var categoryField = GeoNetwork.util.SearchFormTools.getCategoryField(services.getCategories, '../../apps/images/default/category/', true);\n var validField = GeoNetwork.util.SearchFormTools.getValidField(true);\n var spatialTypes = GeoNetwork.util.SearchFormTools.getSpatialRepresentationTypeField(null, true);\n var denominatorField = GeoNetwork.util.SearchFormTools.getScaleDenominatorField(true);\n var statusField = GeoNetwork.util.SearchFormTools.getStatusField(services.getStatus, true);\n \n advancedCriteria.push(themekeyField, orgNameField, categoryField, \n when, spatialTypes, denominatorField, \n catalogueField, groupField, \n metadataTypeField, validField, statusField);\n \n // Create INSPIRE fields if enabled in administration\n var inspirePanel = catalogue.getInspireInfo().enableSearchPanel === \"true\";\n if (inspirePanel) {\n var inspire = new Ext.form.FieldSet({\n title: OpenLayers.i18n('inspireSearchOptions'),\n collapsible: true,\n collapsed: true,\n items: GeoNetwork.util.INSPIRESearchFormTools.getINSPIREFields(catalogue.services, true)\n });\n advancedCriteria.push(inspire);\n }\n \n var adv = new Ext.form.FieldSet({\n title: OpenLayers.i18n('advancedSearchOptions'),\n autoHeight: true,\n collapsible: true,\n collapsed: urlParameters.advanced !== undefined ? false : true,\n defaultType: 'checkbox',\n defaults: {\n anchor: '100%'\n },\n items: advancedCriteria\n });\n \n // Check good map options if we load map config from WMC or OWS\n var mapOptions;\n if(GeoNetwork.map.CONTEXT || GeoNetwork.map.OWS) {\n mapOptions = GeoNetwork.map.CONTEXT_MAP_OPTIONS;\n } else {\n mapOptions = GeoNetwork.map.MAP_OPTIONS;\n }\n \n \n var formItems = [];\n formItems.push(\n new GeoNetwork.form.OpenSearchSuggestionTextField({\n hideLabel: true,\n minChars: 2,\n suggestionField: 'anylight',\n loadingText: '...',\n hideTrigger: true,\n url: catalogue.services.opensearchSuggest\n }),\n GeoNetwork.util.SearchFormTools.getTypesFieldWithAutocompletion(catalogue.services),\n GeoNetwork.util.SearchFormTools.getSimpleMap(GeoNetwork.map.BACKGROUND_LAYERS, mapOptions, \n GeoNetwork.searchDefault.activeMapControlExtent, {width: 290}),\n adv, \n GeoNetwork.util.SearchFormTools.getOptions(catalogue.services, undefined)\n );\n // Add advanced mode criteria to simple form - end\n \n \n // Hide or show extra fields after login event\n var adminFields = [groupField, metadataTypeField, validField, statusField];\n Ext.each(adminFields, function (item) {\n item.setVisible(false);\n });\n \n catalogue.on('afterLogin', function () {\n Ext.each(adminFields, function (item) {\n item.setVisible(true);\n });\n groupField.getStore().reload();\n });\n catalogue.on('afterLogout', function () {\n Ext.each(adminFields, function (item) {\n item.setVisible(false);\n });\n groupField.getStore().reload();\n });\n \n \n return new GeoNetwork.SearchFormPanel({\n id: 'searchForm',\n stateId: 's',\n border: false,\n searchCb: function () {\n if (metadataResultsView && Ext.getCmp('geometryMap')) {\n metadataResultsView.addMap(Ext.getCmp('geometryMap').map, true);\n }\n var any = Ext.get('E_any');\n if (any) {\n if (any.getValue() === OpenLayers.i18n('fullTextSearch')) {\n any.setValue('');\n }\n }\n \n catalogue.startRecord = 1; // Reset start record\n search();\n },\n padding: 5,\n defaults: {\n anchor: '100%'\n },\n listeners: {\n onreset: function (args) {\n facetsPanel.reset();\n \n // Remove field added by URL or quick search\n this.cascade(function(cur){\n if (cur.extraCriteria) {\n this.remove(cur);\n }\n }, this);\n \n if (!args.nosearch) {\n this.fireEvent('search');\n }\n }\n },\n items: formItems\n });\n }", "function companies(state = INITIAL_STATE, action) {\n switch (action.type) {\n case LOAD_ALL_COMPANIES:\n return {\n ...state,\n companies: action.payload\n }\n\n case RESET_ALL:\n return { ...INITIAL_STATE };\n\n default:\n return state;\n }\n}", "function BindInsuranceCompaniesData(selector) {\n $.getJSON(\"/Insurance/GetInsuranceCompaniesDropdownData\", {}, function (data) {\n BindInsuranceDropdownData(data, selector, \"\");\n });\n}", "function getCustomersOwner() {\n var pagina = 'ProjectPlans/listCustomersOwn';\n var par = `[{\"cusId\":\"\", \"cutId\":\"\"}]`;\n var tipo = 'json';\n var selector = putCustomersOwner;\n fillField(pagina, par, tipo, selector);\n}", "renderPage() {\n const cardPadding = { padding: '30px 0px 0px 0px' };\n const contentStyle = { marginBottom: '50px' };\n\n this.createOptions();\n\n return (\n <div style={contentStyle}>\n <Container>\n <Header as=\"h2\" dividing textAlign=\"center\" inverted>Company Directory</Header>\n <Menu>\n <Dropdown selection defaultValue='companyName' options={this.searchBy}\n onChange={(e, data) => this.setSearchBy(e, data)}/>\n\n <Dropdown placeholder={`Search By ${this.state.searchBy}`} deburr fluid search selection\n options={this[this.state.searchBy]} icon='search' allowAdditions additionLabel=''\n onChange={(event, data) => this.handleGeneralChange(event, data, this.state.searchBy)}\n onAddItem={(e, data) => this.handleAddition(e, data, this.state.searchBy)}\n />\n <Button basic onClick={this.onClickClear}>Clear</Button>\n </Menu>\n\n <Card.Group centered style={cardPadding}>\n {this.state.companies.length === 0 ? (\n this.props.companies.map((company, index) => <CompanyCard key={index} company={company}/>)\n ) : (\n this.state.companies.map((company, index) => <CompanyCard\n key={index} company={this.returnCompany(company._id)}/>))\n }\n </Card.Group>\n </Container>\n </div>\n );\n }", "function initTellCompany(){\t\t\t\n//\t$(\"#country\").change( onCountrySelect );\n\t\n\tvar ftype_ = $(\"#ftype\").val();\n\tif(stdSmartFormUsrReg == ftype_){\n\t\tvar fieldMap= {\"industries\":\"#sel_industry\"};\n\t\t//alert(\"initializing dropdowns as the page loading is done !!\");\n\t\tloadDropdowns(fieldMap,\"#getAllStaticDataUrl\");\n\t}\n\tif( evalProductForm == ftype_ ){\n\t\tvar fieldMap= {\"industries\":\"#sel_industry\",\"globalEmployees\":\"#sel_employees_globally\",\"nationalEmployees\":\"#sel_employees_country\"};\n\t\tloadDropdowns(fieldMap,\"#getAllStaticDataUrl\");\n\t}\n\t\n\t\n//\tvar fieldMap= {\"industries\":\"#sel_industry\",\"globalEmployees\":\"#sel_employees_globally\",\"nationalEmployees\":\"#sel_employees_country\"};\n//\t//alert(\"initializing dropdowns as the page loading is done !!\");\n//\tloadDropdowns(fieldMap,\"#getAllStaticDataUrl\");\n\t\n}", "function filterCompanyNames(input){\n\t\tFilteredSearch.filterCompanyNames(input, function(data){\n\t\t\t$scope.filteredListOfCompanies = data;\n\t\t})\n\t}", "async getEligibleJoinCompanies () {\n\t\tconst domain = EmailUtilities.parseEmail(this.user.get('email')).domain.toLowerCase();\n\t\tthis.isWebmail = WebmailCompanies.includes(domain);\n\n\t\t// ignore webmail domains\n\t\tif (this.isWebmail) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.notTrueLogin) { return; }\n\t\tthis.responseData.eligibleJoinCompanies = [];\n\n\t\t// look for any companies with domain-based joining that match the domain of the user's email\n\t\tconst companies = await this.request.data.companies.getByQuery(\n\t\t\t{\n\t\t\t\tdomainJoining: domain,\n\t\t\t\tdeactivated: false\n\t\t\t},\n\t\t\t{\n\t\t\t\thint: CompanyIndexes.byDomainJoining \n\t\t\t}\n\t\t);\n\n\t\t// return information about those companies (but not full company objects, \n\t\t// since the user is not actually a member (yet))\n\t\tfor (const company of companies) {\n\t\t\tconst memberCount = await company.getCompanyMemberCount(this.request.data);\n\t\t\tthis.responseData.eligibleJoinCompanies.push({\n\t\t\t\tid: company.id,\n\t\t\t\tname: company.get('name'),\n\t\t\t\tbyDomain: domain.toLowerCase(),\n\t\t\t\tdomainJoining: company.get('domainJoining') || [],\n\t\t\t\tcodeHostJoining: company.get('codeHostJoining') || [],\n\t\t\t\tmemberCount\n\t\t\t});\n\t\t}\n\t}", "function getCurrentCompany(ID) {\n var selectedCompany = new Company();\n var index = 0;\n\n while (index < Companies.length) {\n if (ID == Companies[index].CompanyID) {\n selectedCompany = Companies[index];\n break;\n }\n index++;\n }\n return (selectedCompany);\n }", "async function search(name) {\n let comps = await JoblyApi.getCompanies(name);\n setCompanies(comps);\n }", "function populateForm() {\n var selectElement = document.getElementById('items');\n for (var i in Product.allProducts) {\n var optionEl = document.createElement('option');\n optionEl.textContent = Product.allProducts[i].name;\n selectElement.appendChild(optionEl);\n }\n}" ]
[ "0.66696525", "0.6437553", "0.6254415", "0.6245486", "0.619275", "0.6122468", "0.6101526", "0.5973255", "0.59573966", "0.5943225", "0.59382606", "0.5924111", "0.58607835", "0.5823227", "0.580402", "0.5785306", "0.576226", "0.5759443", "0.57576954", "0.57321566", "0.5704849", "0.56677914", "0.56564564", "0.5643823", "0.5619605", "0.5612812", "0.5601808", "0.5601808", "0.5594901", "0.5586215", "0.5582478", "0.5566385", "0.5566049", "0.55491483", "0.5541255", "0.5513302", "0.5506271", "0.5504957", "0.5498596", "0.54886675", "0.5479851", "0.54779655", "0.54597443", "0.5452561", "0.5425664", "0.54241407", "0.54221946", "0.54159117", "0.5411658", "0.5405718", "0.5403791", "0.54028136", "0.5400319", "0.5399346", "0.5393739", "0.5378094", "0.53772086", "0.53714216", "0.53585213", "0.53469455", "0.53425777", "0.53220505", "0.5303619", "0.5295798", "0.5294362", "0.52938324", "0.5292521", "0.528256", "0.5268466", "0.52635", "0.5251768", "0.5235487", "0.5222793", "0.52223104", "0.5216586", "0.51958865", "0.519408", "0.5190996", "0.51813996", "0.5178428", "0.51768446", "0.5172515", "0.51666164", "0.5163228", "0.51629406", "0.5161425", "0.5160677", "0.51605207", "0.5150224", "0.5148605", "0.5139158", "0.51389384", "0.51381266", "0.513602", "0.5135111", "0.5133515", "0.512916", "0.5127076", "0.5116549", "0.51148397" ]
0.6045522
7
Update user with saved applicationinformation
function updateUserProfile(){ if(vm.user){ // Update user data. vm.user.firstName = vm.firstname; vm.user.lastName = vm.lastname; vm.user.displayName = vm.firstname + ' ' + vm.lastname; vm.user.program = vm.taskapplication.program; vm.user.email = vm.taskapplication.email; vm.user.phone = vm.taskapplication.phone; vm.user.foodpref = vm.taskapplication.foodpref; var myUser = new Users(vm.user); myUser.$update(successCallbackUser, errorCallback); } else { successCallbackUser(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pageUpdateAccount(){\n $(\"#update-name\").val(appUser.get('name'));\n $(\"#update-email\").val(appUser.get('email'));\n $(\"#update-username\").val(appUser.get('username'));\n }", "function setAppboyUser() {\n // get email and create user ids and such\n var emailAddress = document.getElementById('email-address').value\n var hashedAddress = emailAddress.hashCode()\n var abUser = appboy.getUser().getUserId()\n\n appboy.changeUser(hashedAddress)\n appboy.getUser().setEmail(emailAddress)\n\n // set user attributes in profile\n var firstName = document.getElementById('first-name').value\n var lastName = document.getElementById('last-name').value\n var phoneNumber = document.getElementById('phone-number').value\n\n if (firstName) appboy.getUser().setFirstName(firstName);\n if (lastName) appboy.getUser().setLastName(lastName);\n if (phoneNumber) appboy.getUser().setPhoneNumber(phoneNumber);\n\n // change id button to Identified!\n document.getElementById('login-button').value = \"Identified!\"\n}", "updateUserDetails() {\n if (!activeUser()) return;\n $(conversations_area).find(`[data-user-id=\"${activeUser().id}\"] .sb-name,.sb-top > a`).html(activeUser().get('full_name'));\n $(conversations_area).find('.sb-user-details .sb-profile').setProfile();\n SBProfile.populate(activeUser(), $(conversations_area).find('.sb-profile-list'));\n }", "_updateUser() {\n\t\tconst user = UserStore.activeUser();\n\t\tconst authInfo = UserStore.activeAuthInfo();\n\t\tconst emails = user && user.UID ? UserStore.emails.get(user.UID) : null;\n\t\tconst primaryEmail = emails && !emails.Error ? emails.filter(e => e.Primary).map(e => e.Email)[0] : null;\n\n\t\tif (this._authInfo !== authInfo) {\n\t\t\tif (this._authInfo && this._authInfo.UID && (!authInfo || this._authInfo.UID !== authInfo.UID)) {\n\t\t\t\t// The user logged out or another user logged in on the same browser.\n\n\t\t\t\t// Distinguish between 2 users who log in from the same browser; see\n\t\t\t\t// https://github.com/amplitude/Amplitude-Javascript#logging-out-and-anonymous-users.\n\t\t\t\tif (this._amplitude) this._amplitude.regenerateDeviceId();\n\n\t\t\t\t// Prevent the next user who logs in (e.g., on a public terminal) from\n\t\t\t\t// seeing the previous user's Intercom messages.\n\t\t\t\tif (this._intercom) this._intercom(\"shutdown\");\n\n\t\t\t\tif (this._fullStory) this._fullStory.clearUserCookie();\n\t\t\t}\n\n\t\t\tif (authInfo) {\n\t\t\t\tif (this._amplitude && authInfo.Login) this._amplitude.setUserId(authInfo.Login || null);\n\t\t\t\tif (window.ga && authInfo.Login) window.ga(\"set\", \"userId\", authInfo.Login);\n\n\t\t\t\tif (this._telligent && authInfo.Login) this._telligent(\"setUserId\", authInfo.Login);\n\n\t\t\t\tif (authInfo.UID) this.setIntercomProperty(\"user_id\", authInfo.UID.toString());\n\t\t\t\tif (authInfo.IntercomHash) this.setIntercomProperty(\"user_hash\", authInfo.IntercomHash);\n\t\t\t\tif (this._fullStory && authInfo.Login) {\n\t\t\t\t\tthis._fullStory.identify(authInfo.Login);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._intercom) this._intercom(\"boot\", this._intercomSettings);\n\t\t}\n\t\tif (this._user !== user && user) {\n\t\t\tif (user.Name) this.setIntercomProperty(\"name\", user.Name);\n\t\t\tif (this._fullStory) this._fullStory.setUserVars({displayName: user.Name});\n\t\t\tif (user.RegisteredAt) {\n\t\t\t\tthis.setUserProperty(\"registered_at\", new Date(user.RegisteredAt).toDateString());\n\t\t\t\tthis.setIntercomProperty(\"created_at\", new Date(user.RegisteredAt).getTime() / 1000);\n\t\t\t}\n\t\t}\n\t\tif (this._primaryEmail !== primaryEmail) {\n\t\t\tif (primaryEmail) {\n\t\t\t\tthis.setUserProperty(\"email\", primaryEmail);\n\t\t\t\tthis.setIntercomProperty(\"email\", primaryEmail);\n\t\t\t\tif (this._fullStory) this._fullStory.setUserVars({email: primaryEmail});\n\t\t\t}\n\t\t}\n\n\t\tthis._user = user;\n\t\tthis._authInfo = authInfo;\n\t\tthis._primaryEmail = primaryEmail;\n\t}", "update() {\n localStorage.setItem('user', JSON.stringify(user))\n\n dataStore.set('config', user.config)\n dataStore.set('palette', user.palette)\n dataStore.set('projectPalette', user.projectPalette)\n dataStore.set('log', user.log)\n\n Log.refresh()\n }", "function updateApplications(application){\n let user = auth['user'];\n user.applications.push(application);\n auth['removeUser']('user');\n auth['setUser']('user',user);\n }", "function updateUserInformation(){\n\tconsole.log('function: updateUserInformation');\n\t$().SPServices({\n\t\toperation: \"UpdateListItems\",\n\t\twebURL: siteUrl,\n\t\taync: false,\n\t\tbatchCmd: \"Update\",\n\t\tlistName: \"ccUsers\",\n\t\tID: userId,\n\t\tvaluepairs:[\n\t\t\t\t\t\t[\"Title\", personInformation().pseudoName ], \n\t\t\t\t\t\t[\"PERSON_EMAIL\", personInformation().personEmail], \n\t\t\t\t\t\t[\"P_LAST_NAME\", personInformation().personLastName],\t\n\t\t\t\t\t\t[\"P_FIRST_NAME\", personInformation().personFirstName], \n\t\t\t\t\t\t[\"PERSON_ROLE\", personInformation().personRole], \n\t\t\t\t\t\t[\"PERSON_RANK\", personInformation().personRank], \n\t\t\t\t\t\t[\"PERSON_DIRECTORATE\", personInformation().personDirectorate],\n\t\t\t\t\t\t[\"PERSON_ACTIVE\", personInformation().personActive], \n\t\t\t\t\t\t[\"PERSON_ATTRIBUTES\", personAttributes()],\n\t\t\t\t\t\t[\"PERSON_TRAINING\", personTraining()]\n\t\t\t\t\t],\n\t\tcompletefunc: function(xData, Status){\n\t\t\tconsole.log('update user account succesfully');\n\t\t}\n\t});\n\tsetTimeout(function(){\n\t\tsetUserInformationRedirect(userId);\n\t}, 2000);\n}", "static async update(username, data) {\n if (data.password) {\n data.password = await bcrypt.hash(data.password, BCRYPT_WORK_FACTOR);\n }\n\n let {query, values} = partialUpdate(\n \"users\",\n data,\n \"username\",\n username\n );\n\n const result = await db.query(query, values);\n const user = result.rows[0];\n\n if (!user) {\n let notFound = new Error(`There exists no user '${username}`);\n notFound.status = 404;\n throw notFound;\n }\n const applications = await db.query(\n `SELECT * FROM applications\n WHERE username = $1`,\n [user.username]\n );\n delete user.password;\n delete user.is_admin;\n \n return {...user,applications:applications.rows};\n\n }", "function updateUser() {\n try {\n selectedUser.username = $usernameFld.val();\n selectedUser.password = $passwordFld.val();\n selectedUser.firstName = $firstNameFld.val();\n selectedUser.lastName = $lastNameFld.val();\n selectedUser.role = $roleFld.val();\n userService.updateUser(selectedUserId, selectedUser)\n .then(function (userServerInfo) {\n users[editIndex] = selectedUser;\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n // In future could catch null error or could grey out checkmark icon.\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "async function update(data) {\n console.debug(\"Update\");\n const user = await JoblyApi.updateUserInfo(currentUser.username, data);\n setCurrentUser(user);\n }", "function _update_user_from_login(data) {\n user.app = data.app;\n user.uuid = data.uuid;\n user.icon = data.user_icon;\n user.name = data.user_name;\n user.email = data.user_email;\n user.fullname = data.user_fullname;\n user.signature = data.user_signature;\n user.updatetime = data.updatetime;\n user.is_online = true;\n user.status = data.service_user_status || yvConstants.USER_STATUS.READY;\n \n if (yvSys.in_mobile_app()) {\n user.device_uuid = data.mobile_device_uuid;\n } else {\n user.device_uuid = data.browser_device_uuid;\n }\n \n user.show_badge = !!data.user_show_badge;\n user.is_distributor_user = !!data.is_distributor_user;\n user.mute_notification = !!data.user_mute_notification;\n user.silence_notification = !!data.user_silence_notification;\n user.mute_other_mobile_device = !!data.user_mute_other_mobile_device;\n \n return user;\n }", "function updateInformation (user, newInfo) {\n if (newInfo) {\n user.updateProfile(newInfo).catch(function(error) {\n // Handle Errors here.\n var errorCode = error.code;\n var errorMessage = error.message;\n showError(errorCode, errorMessage);\n });\n }\n}", "function updateUserInfo(id, user) {\n}", "updateUserData(userId, email, secretCode) {\n this.userId = userId;\n this.email = email;\n this.secretCode = secretCode;\n }", "updateUser(h, p){\n\t\tlet oldInfo = this.props.user;\n\t\tlet updatedInfo = { happiness: oldInfo.happiness + h,\n\t\t pollution: oldInfo.pollution + p};\n\t\tlet userUrl = `/api${this.props.match.url}`;\n\t\tthis.props.actions.updateUser(userUrl, updatedInfo);\n\t}", "updateUser(h, p){\n\t\tlet oldInfo = this.props.user;\n\t\tlet updatedInfo = { happiness: oldInfo.happiness + h,\n\t\t pollution: oldInfo.pollution + p};\n\t\tlet userUrl = `/api${this.props.match.url}`;\n\n\t\tthis.props.actions.updateUser(userUrl, updatedInfo);\n\t}", "function _update_user_from_api(data) {\n user.uuid = data.uuid;\n user.icon = data.user_icon;\n user.name = data.user_name;\n user.email = data.user_email;\n user.fullname = data.user_fullname;\n user.signature = data.user_signature;\n user.updatetime = data.updatetime;\n user.is_online = true;\n \n if (yvSys.in_mobile_app()) {\n user.device_uuid = data.mobile_device_uuid;\n } else {\n user.device_uuid = data.browser_device_uuid;\n }\n \n return user;\n }", "function updateUser(){\n // use save instead of update to trigger 'save' event for password hashing\n\t\nconsole.log('REQUEST IS ', req.body)\n\tif (!user.termsAccepted_v1) user.termsAccepted_v1 = false;\n user.set(req.body);\n user.save(function(err, user){\n \n // Uniqueness and Save Validations\n \n if (err && err.code == 11001){\n var duplicatedAttribute = err.err.split(\"$\")[1].split(\"_\")[0];\n req.flash('error', \"That \" + duplicatedAttribute + \" is already in use.\");\n return res.redirect('/account');\n }\n if(err) return next(err);\n \n // User updated successfully, redirecting\n \n req.flash('success', \"Account updated successfully.\");\n return res.redirect('/account');\n });\n }", "edit({ email, name, password, image }) {\n let details = { email, name, password, image };\n for (const key in details)\n if (details[key]) {\n currentUser[key] = details[key];\n }\n callFuture(updateUserListeners);\n }", "function updateUser(){\n\tuser.age++;\n\tuser.name = user.name.toUpperCase();\n}", "function updateUser(){\n\tuser.age++;\n\tuser.name = user.name.toUpperCase();\n}", "update() {\n let scopes = this.stores.essentials.getAllScopes(),\n application = this.stores.kio.getApplication(this.props.applicationId);\n this.data = {\n application: application,\n applicationId: this.props.applicationId,\n isOwnApplication: this.stores.user\n .getUserTeams()\n .map(team => team.id)\n .some(id => id === application.team_id),\n ownerScopes: scopes.filter(s => s.is_resource_owner_scope),\n appScopes: scopes.filter(s => !s.is_resource_owner_scope),\n oauth: this.stores.mint.getOAuthConfig(this.props.applicationId)\n };\n }", "function updateMe(data) {\n UserModel.me = data.id;\n UserModel.updateUser(data);\n }", "function updateInfo() {\n let newVals = grabFormValues();\n $.ajax({\n dataType: 'json',\n type: 'PUT',\n data: newVals,\n async: false,\n url: 'api/employees/' + curUser._id,\n success: function(response) {\n console.log(response);\n localStorage.setItem('currentUser', JSON.stringify(response));\n curUser = JSON.parse(localStorage.getItem('currentUser'));\n showInfo();\n },\n });\n }", "function update(username,password,firstName, lastName, emailId){\n var userLoggedIn=$rootScope.currentUser;\n var LoggedInUserId=userLoggedIn._id;\n console.log(\"User Logged in ID: \");\n console.log(userLoggedIn);\n\n var user={\n \"username\":username,\n \"password\":password,\n \"firstName\":firstName,\n \"lastName\":lastName,\n \"emailId\":emailId\n };\n\n\n UserService.updateUser(LoggedInUserId,user, function (response) {\n\n\n UserService.setCurrentUser(response);\n console.log(\"Response From Service: Updated the User\");\n console.log(response);\n\n });\n\n }", "function load_update_user_data() {\n $('#email').val(userObj.email);\n $('#name').val(userObj.name);\n}", "updateProfile() {}", "function updateProfile() {\n\tif (setUpdateErrors()) {\n\t\tvar values = setUpdateValues()\n\t\t$.ajax({\n\t\t\tmethod: \"PUT\",\n\t\t\turl: \"/api/update/user/\" + sessionStorage.getItem(\"globalUsername\"),\n\t\t\tdata: {\n\t\t\t\tpass: values[\"newPass\"],\n\t\t\t\temail: values[\"newEmail\"],\n\t\t\t\tbirthday: values[\"newBirthday\"],\n\t\t\t\tfavColor: values[\"newFavColor\"],\n\t\t\t\tyear: values[\"newYear\"],\n\t\t\t\tlecture: values[\"newLecture\"],\n\t\t\t},\n\t\t})\n\t\t\t.done(function (data, text_status, jqXHR) {\n\t\t\t\tconsole.log(JSON.stringify(data))\n\t\t\t\tconsole.log(text_status)\n\t\t\t\tconsole.log(jqXHR.status)\n\t\t\t\tunsetUpdateErrors()\n\t\t\t\tupdateToProfile()\n\t\t\t})\n\t\t\t.fail(function (err) {\n\t\t\t\tconsole.log(err.status)\n\t\t\t\tconsole.log(JSON.stringify(err.responseJSON))\n\t\t\t})\n\t}\n}", "function update() {\n // PREPARE\n let uid = $rootScope.account.authData.uid;\n let profile = $rootScope.account.profile;\n\n // NEW USER ACTION\n if (profile.newUser) {\n instance.addAchievement(profile, ACHIEVEMENTS.PROFILE_COMPLETED);\n profile.newUser = false;\n }\n\n // UPDATE\n $rootScope.db.users.child(uid).update(profile);\n\n // NOTIFY\n BroadcastService.send(EVENTS.PROFILE_UPDATED, profile);\n }", "updateUser (callback) {\n\t\tthis.doApiRequest(\n\t\t\t{\n\t\t\t\tmethod: 'put',\n\t\t\t\tpath: '/users/me',\n\t\t\t\tdata: this.data,\n\t\t\t\ttoken: this.token\n\t\t\t},\n\t\t\t(error, response) => {\n\t\t\t\tif (error) { return callback(error); }\n\t\t\t\tObject.assign(this.expectedUser, response.user.$set, this.data, {\n\t\t\t\t\tlastReads: {},\n\t\t\t\t\tpreferences: {\n\t\t\t\t\t\tacceptedTOS: true\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tdelete this.data;\t// don't need this anymore\n\t\t\t\tcallback();\n\t\t\t}\n\t\t);\n\t}", "static handleProfileUpdate(newUserData) {\n let data = this.currentUserValue;\n\n if (newUserData.name) {\n data.user.name = newUserData.name;\n }\n\n if (newUserData.email) {\n data.user.email = newUserData.email;\n }\n\n _currentUserSubject.next(data);\n }", "async doUserUpdate () {\n\t\tconst now = Date.now();\n\t\tconst op = {\n\t\t\t$set: {\n\t\t\t\tisRegistered: true,\n\t\t\t\tmodifiedAt: now,\n\t\t\t\tregisteredAt: now,\n\t\t\t\t\"preferences.acceptedTOS\": true\n\t\t\t}, \n\t\t\t$unset: {\n\t\t\t\tconfirmationCode: true,\n\t\t\t\tconfirmationAttempts: true,\n\t\t\t\tconfirmationCodeExpiresAt: true,\n\t\t\t\t'accessTokens.conf': true,\n\t\t\t\tinviteCode: true,\n\t\t\t\tneedsAutoReinvites: true,\n\t\t\t\tautoReinviteInfo: true\n\t\t\t}\n\t\t};\n\n\t\tif (this.passwordHash) {\n\t\t\top.$set.passwordHash = this.passwordHash;\n\t\t}\n\n\t\t['email', 'username', 'fullName', 'timeZone'].forEach(attribute => {\n\t\t\tif (this.data[attribute]) {\n\t\t\t\top.$set[attribute] = this.data[attribute];\n\t\t\t}\n\t\t});\n\t\tif (this.data.email) {\n\t\t\top.$set.searchableEmail = this.data.email.toLowerCase();\n\t\t}\n\n\t\tif ((this.user.get('teamIds') || []).length > 0) {\n\t\t\tif (!this.user.get('joinMethod')) {\n\t\t\t\top.$set.joinMethod = 'Added to Team';\t// for tracking\n\t\t\t}\n\t\t\tif (!this.user.get('primaryReferral')) {\n\t\t\t\top.$set.primaryReferral = 'internal';\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!this.user.get('originTeamId') &&\n\t\t\t\tthis.teamCreator && \n\t\t\t\tthis.teamCreator.get('originTeamId')\n\t\t\t) {\n\t\t\t\top.$set.originTeamId = this.teamCreator.get('originTeamId');\n\t\t\t}\n\t\t}\n\n\t\tthis.request.transforms.userUpdate = await new ModelSaver({\n\t\t\trequest: this.request,\n\t\t\tcollection: this.request.data.users,\n\t\t\tid: this.user.id\n\t\t}).save(op);\n\t}", "updateUserData() {\n console.log(\"Creating profile\");\n var formData = $('#user-form').serializeArray();\n var firstName = formData[0].value;\n var lastName = formData[1].value;\n var email = formData[2].value;\n var country = formData[3].value;\n var state = formData[4].value;\n var city = formData[5].value;\n var dob = formData[6].value;\n\n var newUserInfo = {firstName: firstName, lastName: lastName, email: email, country: country, state: state, city: city, dob: dob};\n\n }", "function updateUser(){\n helpers.rl.question('\\nEnter user name to update: ', dealWithUserUpdate);\n}", "function update(req, res){\n console.log(req.body.local.firstName);\n User.findById(req.params._id, function(err,user){\n user.local.firstName = req.body.local.firstName\n user.local.lastName = req.body.local.lastName\n user.local.email = req.body.local.email\n user.local.password = req.body.local.password\n user.save(function(err){\n if(err) console.log(err)\n res.json({success: true, message: \"User has been updated!\"});\n });\n });\n}", "function updateUserData(){\n var new_name = document.getElementById('name_change').value;\n if (new_name == \"\"){\n new_name = name;\n }\n var new_jobs = document.getElementById('jobs_change').value;\n if (new_jobs == \"\"){\n new_jobs = jobs;\n }\n var new_contact = document.getElementById('contact_change').value;\n if (new_contact == \"\"){\n new_contact = contact;\n }\n var new_tjm = document.getElementById('tjm_change').value;\n if (new_tjm == \"\"){\n new_tjm = tjm;\n }\n writeUserData(userId, new_name, new_jobs, new_contact, new_tjm);\n}", "function updateUserDetails(e){\n e.preventDefault();\n\n var userFormData = JSON.parse(queryStringToJsonString($(\"#admin-view-user\").serialize()));\n var userObj = {};\n for(var key in userFormData){\n if(key==\"projectName\")\n continue;\n userObj[key] = decodeURIComponent(userFormData[key]);\n }\n\n updateDetails(\"PUT\", baseURL + \"User\", JSON.stringify(userObj), \"Resource\", \"userViewForm\");\n}", "function editUsers(){\n\tvar position=JSON.parse(localStorage.getItem('CurrentUser')).Position;\n\tvar users= JSON.parse(localStorage.getItem('Users'));\n\tvar user =users[position];\n\tif(document.getElementById('widget_password').value !== document.getElementById('widget_password_confirmation').value){\n\t\talert(\"The password doesn't match\");\n\t\treturn;\n\t}\n\tuser.FirstName=document.getElementById('widget_first_name').value;\n\tuser.LastName=document.getElementById('widget_last_name').value;\n\tuser.UserName=document.getElementById('widget_userName').value;\n\tuser.Email=document.getElementById('widget_email').value;\n\tuser.Password=document.getElementById('widget_password').value;\n\tuser.Admin=document.getElementById('box').checked;\n\tdocument.getElementById('welcomeUser').innerHTML='Welcome '+ user.FirstName + ' ' + user.LastName;\n\tlocalStorage.setItem('Users',JSON.stringify(users));\n\tlocalStorage.setItem(\"CurrentUser\",JSON.stringify(user));\n\t$('.overlay-bg, .overlay-content').hide();\n\talert(\"The user has been edited successfully\");\n}", "function updateUser() {\n if (model.addAdmin) {\n model.user.roles.push(\"ADMIN\");\n }\n if (model.addMember) {\n model.user.roles.push(\"MEMBER\");\n }\n userService\n .updateUser(model.userId, model.user)\n .then(function() {\n model.message = \"User updated successfully.\";\n });\n }", "async updateUser(parent, {\n updateUserInput: {\n id,\n name,\n email,\n password\n }\n }, context, info) {\n try {\n const updateUser = await context.prisma.user.update({\n where: {\n id\n },\n data: {\n name,\n email,\n password\n }\n });\n return \"user update sucessfully\";\n } catch (error) {\n return error;\n }\n }", "function dataUpdate(UserName){\n usermanage.updateUserData(UserName,Ipconfig.myIpAddress());\n}", "function updateCurrentUserProfile() {\n\n\n Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.platformRoles.indexOf(data.Role) //<-- use PLATFORM roles, NOT ACCOUNT roles! Role will indicate what editing capabilites are available.\n\n Debug.trace(\"Profile refreshed!\");\n Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "UPDATE_USER_INFO(state, payload) {\n\t\t// Get Data localStorage\n\t\tlet userInfo = JSON.parse(localStorage.getItem('userInfo')) || state.AppActiveUser;\n\n\t\tfor (const property of Object.keys(payload)) {\n\t\t\tif (payload[property] != null) {\n\t\t\t\t// If some of user property is null - user default property defined in state.AppActiveUser\n\t\t\t\tstate.AppActiveUser[property] = payload[property];\n\n\t\t\t\t// Update key in localStorage\n\t\t\t\tuserInfo[property] = payload[property];\n\t\t\t}\n\t\t}\n\t\t// Store data in localStorage\n\t\tlocalStorage.setItem('userInfo', JSON.stringify(userInfo));\n\t}", "function handleUpdateUser(userInfo) {\n api.setUserInfo(userInfo, token)\n .then(res => { setCurrentUser({ name: res.data.name, about: res.data.about, avatar: res.data.avatar }) })\n .then(() => { closeAllPopups() })\n .catch(err => console.log(err))\n }", "function updateProfile() {\n\t\n\tif(validateInputFields(\"#hotel-profile-table\") === false) {\n\t\ttoast(\"Empty fields detected\");\n\t\treturn;\n\t}\n\t\n\taxios.post(controllerPath + \"/updateProfile\", getHotelJson())\n\t\t.then(response => {\n\t\t\t\n\t\t\tif(response.data === null || response.data === \"\") {\n\t\t\t\ttoast(\"Hotel name already exists\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tadminHotel = response.data; //update the global hotel variable\n\t\t\tfillHotelProfileInputs(response.data);\n\t\t\ttoast(\"Updated\");\n\t\t});\n\t\n\t\t\n}", "function saveSettings() {\n \n const curUser = getCurrentUser();\n const editedUser = curUser;\n \n editedUser.firstName = document.getElementById('first2').value;\n editedUser.lastName = document.getElementById('last2').value;\n editedUser.email = document.getElementById('email3').value;\n editedUser.password = document.getElementById('pass3').value;\n \n const index = (editedUser.userId-1);\n let allUsers = getAllUsers();\n allUsers[index] = editedUser;\n setAllUsers(allUsers);\n }", "function updateUser(){\n let user = firebase.auth().currentUser;\n user.updateProfile({\n displayName: \"Jane Q. User\",\n photoURL: \"https://example.com/jane-q-user/profile.jpg\"\n }).then(function() {\n // Update successful.\n }).catch(function(error) {\n // An error happened.\n });\n }", "updateUser(userId, data) {\n return this.userStore.updateUser(userId, data)\n }", "updateUser (context, user) {\n context.commit('updateUser', user)\n }", "async update({ request, params, response }) {\n /*** get the user update inputs */\n let { status } = request.only([\"status\"]);\n\n /** get the target user */\n try {\n const user = await User.query().where(\"id\", params.id).first();\n if (!user) {\n return response.status(404).send({\n message: \"not found\",\n });\n }\n\n /** update the user details */\n\n user.active = status;\n await user.save();\n return response.status(200).send({\n message: \"info updated\",\n });\n } catch (error) {\n return response.status(404).send({\n message: \"fail\",\n error: error,\n });\n }\n }", "function updateUserInfoInEditForm(user) {\n $('#ename').val(user.fullName);\n //$('#eid').val(user.id);\n $('#egender').val(user.gender);\n $('#ebirthyear').val(user.birthYear);\n $('#eemail').val(user.email);\n $('#epassword').val(user.password);\n $('#estreet').val(user.street);\n $('#ecity').val(user.city);\n $('#estate').val(user.state);\n $('#ezip').val(user.zipCode);\n}", "function editInfo() {\n io.emit('usernames', userNameList);\n socket.emit('updateUser', currentUsers[socket.id]);\n }", "function updateUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n userService\n .updateUser(currentUserID,user)\n .then(findAllUsers)\n .then(emptyUserForm);\n\n }", "function userUpdated(response) {\n\tif (response.type != \"error\") {\t// type is \"User ___ updated\" on success\n\t\tlocation.reload(true);\n\t} else if (response.type == \"error\") {\n\t\talert(\"Failed to edit user:\\n\" + response.payload[0].msg);\n\t}\n}", "function updateCurrentUserProfile() {\n\n Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.platformRoles.indexOf(data.Role) //<-- use PLATFORM roles, NOT ACCOUNT roles!\n\n Debug.trace(\"Profile refreshed!\");\n Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "function handleUpdateUser(name, about) {\n api.changeUserInfo({ name, about })\n .then((userData) => {\n setCurrentUser(userData.data)\n })\n .then(closeAllPopups)\n .catch(err => console.log(\"Error: \" + err));\n }", "function saveUserData() {\n var saveData = readValuesFromPage();\n\n EcwidApp.setAppStorage(saveData.private, function (savedData) {\n console.log('Private preferences saved!');\n });\n\n EcwidApp.setAppPublicConfig(saveData.public, function (savedData) {\n console.log('Public preferences saved!');\n })\n}", "function update(req, res) {\n\tUser.findById(req.params.user_id, function(err, user) {\n\t\tif (err) return res.send(err);\n\n\t\tif (req.body.name) user.name = req.body.name;\n\t\tif (req.body.password) user.password = req.body.password;\n\n\t\tuser.blocked\t= req.body.blocked;\n\t\tuser.image \t\t= req.body.image;\n\n\t\tuser.save(function(err, user) {\n\t\t\tif (err) return res.send(err);\n\n\t\t\tres.json({ message : \"User Updated\" });\n\t\t})\n\t})\n}", "function api_updateuser(ctx, newuser) {\n newuser.a = 'up';\n res = api_req(newuser, ctx);\n}", "function updateProfile() {\n\t\tif (newName.value!=\"\") {\n\t\t\tname.innerHTML = newName.value;\n\t\t}\n\t\tif (newEmail.value!=\"\") {\n\t\t\temail.innerHTML = newEmail.value;\n\t\t}\n\t\tif (newPhone.value!=\"\") {\n\t\t\tphone.innerHTML = newPhone.value;\n\t\t}\n\t\tif (newZipcode.value!=\"\") {\n\t\t\tzipcode.innerHTML = newZipcode.value;\n\t\t}\n\t\tif (newPassword.value!=\"\") {\n\t\t\tpassword.innerHTML = newPassword.value;\n\t\t}\n\t\tif (newPwconfirm.value!=\"\") {\n\t\t\tpwconfirm.innerHTML = newPwconfirm.value;\n\t\t}\n\n\t\tnewName.value = \"\";\n\t\tnewEmail.value = \"\";\n\t\tnewPhone.value = \"\";\n\t\tnewZipcode.value = \"\";\n\t\tnewPassword.value = \"\";\n\t\tnewPwconfirm.value = \"\";\n\t}", "function updateUser(user) {\n UserService.updateUser(model.userId, user)\n .then(function (response) {\n // var updatedUser = response.data;\n // $rootScope.currentUser = updatedUser;\n // console.log(updatedUser);\n model.successMessage = \"Profile Updated Successfully!\";\n }, function (rejection) {\n model.errorMessage = \"Sorry an error was encountered and your profile was not updated. Please try again\";\n });\n }", "function update(OID_USUARIO,USUARIO){\n\t\n\t/*INSERCION DE DATOS*/\n\t\n\t$(\"#txt_usuario\").val(USUARIO);\n\t\n\t$(\"#txt_usuario\").attr(\"USER\",OID_USUARIO);\n\t\n\t$(\"#btn_enviar_usuario\").text(\"Actualizar\")\n\t\t\n\t\n}//FINAL DE LA ACTUALIZACION DE UN REGISTRO", "function updateUserInterface(){\n\n\t$(\"#loginForm\").hide();\n\t$(\"#username\").text(user.alias);\n\t$(\"#userDetails\").show();\n}", "function updateUser(userName, userEmail){\nvar user = firebase.auth().currentUser;\n\t// Prompt the user to re-provide their sign-in credentials\n\tuser.updateProfile({\n\t displayName: userName,\n\t}).then(function() {\n\t // Update successful.\n\t alert(user.displayName);\n\t}).catch(function(error) {\n\t // An error happened.\n\t alert(\"did not set user name\");\n\t});\n\tuser = firebase.auth().currentUser;\n\tuser.updateEmail(userEmail).then(function() {\n\t // Update successful.\n\t \t alert(user.email);\n\t}).catch(function(error) {\n\t // An error happened.\n\t alert(\"DID not set email\");\n\t});\n\n\t\t\tsetTimeout(function() { window.location.href = 'Main1.html';}, 1000);\t\n}", "updateUserData() {\n if (this.form.subscribe == true) {\n this.form.subscribe = 1;\n } else {\n this.form.subscribe = 0;\n }\n this.form\n .post(\"/api/user-update\", {\n headers: { Authorization: `Bearer ${localStorage.token}` },\n })\n .then((response) => {\n this.$swal.fire({ icon: \"success\", title: \"Profile updated!!\" });\n })\n .catch((error) => {\n this.handleError(error);\n });\n }", "function updateProfile()\r\n{\r\n // obtaining the data\r\n let name = document.getElementById(\"name\").value;\r\n let surname = document.getElementById(\"surname\").value;\r\n let dob = document.getElementById(\"dob\").value;\r\n let gender = document.getElementById(\"gender\").value;\r\n let city = document.getElementById(\"city\").value;\r\n let country = document.getElementById(\"country\").value;\r\n let educLevel = document.getElementById(\"educLevel\").value;\r\n let studyArea = document.getElementById(\"studyArea\").value;\r\n let science = document.getElementById(\"science\");\r\n let medicine = document.getElementById(\"medicine\");\r\n let travel = document.getElementById(\"travel\");\r\n let education = document.getElementById(\"education\");\r\n let sports = document.getElementById(\"sports\");\r\n let nutrition = document.getElementById(\"nutrition\");\r\n let economy = document.getElementById(\"economy\");\r\n let environment = document.getElementById(\"environment\");\r\n let interests = \"\";\r\n let password = document.getElementById(\"password\").value;\r\n\r\n // checking which interests did the user select\r\n if (science.checked == true)\r\n {\r\n interests += \"science||\";\r\n }\r\n if (medicine.checked == true)\r\n {\r\n interests += \"medicine||\";\r\n }\r\n if (travel.checked == true)\r\n {\r\n interests += \"travel||\";\r\n }\r\n if (education.checked == true)\r\n {\r\n interests += \"education||\";\r\n }\r\n if (sports.checked == true)\r\n {\r\n interests += \"sports||\";\r\n }\r\n if (nutrition.checked == true)\r\n {\r\n interests += \"nutrition||\";\r\n }\r\n if (economy.checked == true)\r\n {\r\n interests += \"economy||\";\r\n }\r\n if (environment.checked == true)\r\n {\r\n interests += \"environment||\";\r\n }\r\n\r\n // if user entered all the required data - update user to the database and update the view\r\n if ( name && surname && dob && gender && city && country && educLevel && password)\r\n {\r\n let userId = sessionStorage.getItem(\"userId\");\r\n\r\n // add user to the database\r\n // create object with user data to send to the server\r\n let editObject = {\r\n _id: userId,\r\n _name: name,\r\n _surname: surname,\r\n _dob: dob,\r\n _gender: gender,\r\n _city: city,\r\n _country: country,\r\n _studyLevel: educLevel,\r\n _studyArea: studyArea,\r\n _interests: interests,\r\n _password: password\r\n };\r\n\r\n // sending xml request\r\n let xml = new XMLHttpRequest;\r\n\r\n // function that is called when reply received from server\r\n xml.onreadystatechange = () =>\r\n {\r\n if ((xml.readyState == 4) && (xml.status == 200))\r\n {\r\n let updateResult = xml.responseText;\r\n\r\n // update the view\r\n messageOne.innerHTML = \"Successfully Updated \" + updateResult + \" User\";\r\n messageOne.style.display = \"block\";\r\n\r\n viewTitle.style.display = \"none\";\r\n textboxOne.style.display = \"none\";\r\n textboxTwo.style.display = \"none\";\r\n rightContainer.style.display = \"none\";\r\n mainContainer.style.display = \"none\";\r\n // updating the text on the button and its functionality\r\n buttonOne.innerText = \"Log Out\";\r\n buttonOne.onclick = logout; \r\n // updating the text on the link and its functionality\r\n linkOne.innerText = \"Edit My Profile\";\r\n linkOne.onclick = editProfile;\r\n\r\n //clearing the local storage\r\n localStorage.clear();\r\n }\r\n };\r\n\r\n //Send new user data to server\r\n xml.open(\"POST\", \"/amendUser\", true);\r\n xml.setRequestHeader(\"Content-type\", \"application/json\");\r\n xml.send(JSON.stringify(editObject)); \r\n }\r\n \r\n // if user did not fill in all the entries\r\n else\r\n {\r\n document.getElementById(\"editFormMsg\").innerHTML = \"Enter all fields.\";\r\n return;\r\n } \r\n}", "function updateUserController(request, response) {\n const userId = request.params.userId;\n const newValues = request.body;\n\n model.updateById(userId, newValues)\n\n response.status(httpStatus.NO_CONTENT).send();\n}", "function updateUser() {\n user.age++;\n user.name = user.name.toUpperCase();\n console.log(user);\n}", "function updateCurrentUser(){\n console.log(\"update\");\n firebase.database().ref(\"/users\").child(thisUserId).update({\n sessions: thisSession,\n ipAddresses: ips\n });\n}", "function updateUserProfile(isValid) {\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new UsersService(vm.user);\n user.approve = false;\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n Notification.success({ message: '<i class=\"glyphicon glyphicon-ok\"></i> Edit profile successful!' });\n Authentication.user = response;\n }, function (response) {\n Notification.error({ message: response.data.message, title: '<i class=\"glyphicon glyphicon-remove\"></i> Edit profile failed!' });\n });\n }", "function updateUser(ev) {\n\t\t// TODO: add admin functionality and functions in authServise or adminServise\n\t\tev.preventDefault();\n\t\tlet updateUserForm = $('#updateUserForm');\n\t\tlet usernameInput = updateUserForm.find('input[name=\"usernameNew\"]');\n\t\tlet passInput = updateUserForm.find('input[name=\"passwordNew\"]');\n\t\tlet repeatPassInput = updateUserForm.find('input[name=\"repeatPassNew\"]');\n\t\tlet usernameVal = usernameInput.val();\n\t\tlet passVal = passInput.val();\n\t\tlet repeatPassVal = repeatPassInput.val();\n\t\tlet allIsValid = validateRegisterFields(usernameVal, passVal, repeatPassVal);\n\t\tif (allIsValid) {\n\t\t\tlet userData = {\n\t\t\t\tusername: usernameVal,\n\t\t\t\tpassword: passVal\n\t\t\t};\n\t\t\tauth.update(userData)\n\t\t\t\t.then((userInfo) => {\n\t\t\t\t\tusernameInput.val('');\n\t\t\t\t\tpassInput.val('');\n\t\t\t\t\trepeatPassInput.val('');\n\t\t\t\t});\n\t\t}\n\t}", "function updateProfile(req, res) {\n\n UsersModel.findById(req.params.userId, (err, user) => {\n user.name = req.body.name || user.name,\n user.email = req.body.email || user.email,\n user.phoneNumber = req.body.phoneNumber || user.phoneNumber,\n // user.password = bcrypt.hashSync(req.body.password) || user.password \n user.accountNumber = req.body.accountNumber || user.accountNumber,\n user.bankName = req.body.bankName || user.bankName\n\n if (err) {\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n\n user.save((err, saved) => {\n if (err) {\n\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n return res.status(200).send({\n 'status': true,\n 'message': 'Successfully updated',\n 'user': saved\n });\n })\n\n\n })\n}", "async setUserData() {\n\t\tvar userinfo;\n\t\tawait AppX.fetch('User', 'self').then(async result => {\n\t\t\tvar info = result.data;\n\t\t\tglobal.userLogin = info.login;\n\n\t\t\tawait AppX.fetch('OrganizationDetail', info.organizationUid).then(result => {\n\t\t\t\tglobal.userOrgName = result.data.name;\n\t\t\t});\n\n\t\t});\n\t}", "function updateUserProfile() {\n // $('#profile-name)\n $(\"#show-name\").html(` ${currentUser.name}`);\n $(\"#show-username\").html(` ${currentUser.username}`);\n $(\"#show-date\").html(` ${currentUser.createdAt.slice(0, 10)}`);\n }", "function update(req, res) {\n // find one user by id, update it based on request body,\n // and send it back as JSON\n\n db.User.findById(req.params.id, function(err, foundUser) {\n if (err) { console.log('userController.update error', err); }\n foundUser.username = req.body.username;\n foundUser.password = req.body.password;\n foundUser.location = req.body.location;\n foundUser.contact = req.body.contact;\n foundUser.picture = req.body.picture;\n foundUser.posts = req.body.posts;\n foundUser.save(function(err, savedUser) {\n console.log(savedUser)\n if (err) { console.log('saving altered user failed'); }\n res.json(savedUser);\n });\n });\n}", "function updateUser(user) {\n return {\n type: 'UPDATE_USER',\n user\n }\n}", "function updateFacebookInformation(user, profile, access_token, done) {\n var anythingChanged = false;\n\n if (user.facebook.id != profile.id) {\n user.facebook.id = profile.id;\n anythingChanged = true;\n }\n\n if (user.facebook.access_token != access_token) {\n user.facebook.access_token = access_token; // we will save the token that facebook provides to the user \n anythingChanged = true;\n }\n\n if (user.facebook.name != profile.displayName) {\n user.facebook.name = profile.displayName;\n anythingChanged = true;\n }\n\n var description = capitalizeFirstLetter(profile._json.gender);\n var country = country_language.getCountry(profile._json.locale.slice(3)).name;\n if (country) {\n if (description)\n description += \", from \";\n else\n description += \"From \";\n description += country;\n }\n if (user.facebook.description != description) {\n user.facebook.description = description;\n anythingChanged = true;\n }\n\n if (anythingChanged) {\n user.save(function(err) {\n if (err)\n return done(err);\n return done(null, user);\n });\n }\n}", "function upsertUser(userData) {\n $.post(\"/api/users\", userData).then(getUsers);\n }", "function editProfile() {\n setErrorsVisible(true);\n setCurrentPasswordServerError(\"\");\n setUsernameServerError(\"\");\n setEmailServerError(\"\");\n console.log(getProfileUsernameError(true, true, fieldsStateUser.username, currentUser.username, usernameServerError));\n if (!hasErrors(true, \"\", \"\", \"\")) {\n const newUser = createUserForUpdate(currentUser, fieldsStateUser, enableNotifications);\n updateUser(newUser)\n .then(result => {\n props.showStatusAlert(\"Данные успешно обновлены\", \"success\");\n console.log(result);\n\n //save success so current user is equal to new user\n setCurrentUser(newUser);\n props.updatePopoverUser(newUser);\n\n //slackcredentials saved, other values are \"\" by default\n //reset fields\n const newFieldStateUser = getDefaultFieldsStateUser();\n newFieldStateUser.slackCredentials = fieldsStateUser.slackCredentials;\n setFieldsStateUser(newFieldStateUser);\n setErrorsVisible(false);\n setShouldChangeLogin(false);\n setShouldChangeEmail(false);\n setShouldChangePassword(false);\n })\n .catch(err => {\n props.updateIsTokenExpired(err.message);\n if (err.message.length > HttpStatusCodeLength || err.message === ErrorInternalServerErr)\n props.showStatusAlert(\"Не удалось обновить данные\", \"error\");\n console.log(err.message);\n setCurrentPasswordServerError(parseCurrentPasswordServerError(err.message));\n setUsernameServerError(parseUsernameServerError(err.message));\n setEmailServerError(parseEmailServerError(err.message));\n });\n }\n }", "function bush(fn, ln, un, cpa) {\n var user = Parse.User.current();\n user.set(\"firstName\", fn);\n user.set(\"lastName\", ln);\n user.setUsername(un);\n user.setEmail(un);\n user.setPassword(cpa);\n user.save(null, {\n success: function (user) {\n console.log(\"Success changing account information...\");\n //This is so that the new information is displayed as a confirmation that it has happened\n window.location.reload();\n },\n error: function (user, error) {\n console.log(\"ERROR occured in bush()\");\n }\n });\n }", "function updateCurrentUserProfile() {\n\n //Debug.trace(\"Refreshing user profile...\");\n\n sharedServices.getCurrentUserProfile()\n .success(function (data, status, headers, config) {\n\n vm.currentUserProfile = data; //Used to determine what is shown in the view based on user Role.\n currentUserRoleIndex = vm.accountRoles.indexOf(data.Role) //<-- use PLATFORM roles, NOT platform roles!\n\n if (vm.currentUserProfile.Id == \"\" || vm.currentUserProfile == null)\n {\n //Log user out if empty\n window.location.replace(\"/login\");\n }\n\n //Debug.trace(\"Profile refreshed!\");\n //Debug.trace(\"Role index = \" + currentUserRoleIndex);\n\n })\n .error(function (data, status, headers, config) {\n\n\n })\n\n }", "static async update(req, res) {\n const info = await UserModel.findByIdAndUpdate(req.params.id, req.body);\n return res.send(info);\n }", "function updateUserProfileAuth(name, email, address) {\n firebase.auth().onAuthStateChanged(function (user) {\n console.log(\"user is signed in: \" + user.uid);\n console.log(\"old display name: \" + user.displayName);\n user.updateProfile({\n displayName: name\n }).then(function () {\n console.log(\"updated authenticated user profile\");\n console.log(\"new display name: \" + user.displayName);\n }).catch(function (error) {\n console.log(\"authenticated user profile update failed\");\n })\n })\n}", "function doUpdate(projectId, appId, name, value, cb) {\n common.readApp(projectId, appId, function(err, app){\n if (err) return cb(err);\n app[name] = value;\n fhreq.PUT(fhreq.getFeedHenryUrl(), \"box/api/projects/\" + projectId + \"/apps/\" + appId, app, function (err, remoteData, raw, response) {\n if (err) return cb(err);\n if (response.statusCode !== 200) return cb(raw);\n\n if(ini.get('table') === true && remoteData) {\n\t\t apps.table = common.createTableForAppProps(remoteData);\n }\n return cb(undefined, remoteData);\n });\n });\n}", "function user_info_submit_handler(e){\n // Check the user input. Helper function defined in index.js\n if (check_user_personal_information(e) === 0){\n return; // Input failed test so do not continue\n }\n\n // Make the changes to the databse by making a request to server\n // Prepear to make the server call\n let data = {\n first_name: e.data.first_name.val(),\n last_name: e.data.last_name.val(),\n username: e.data.username.val(),\n password: e.data.password1.val(),\n email: e.data.email.val(),\n user_id: login_account.user_id\n }\n const request = new Request(\"/editUserInfo\", {\n method: \"post\",\n body: JSON.stringify(data),\n headers: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': 'application/json'\n }\n });\n\n // Now we make the request, the server will take care of this\n fetch(request).then((res) => {\n // We handle the response given back from the server\n if (res.status === 200){\n // Make the changes locally\n login_account.first_name = e.data.first_name.val();\n login_account.last_name = e.data.last_name.val();\n login_account.username = e.data.username.val();\n login_account.password = e.data.password1.val();\n login_account.email = e.data.email.val();\n alert(\"Your personal information has been saved.\");\n return;\n }else {\n alert(\"Something went wrong try again. There may be a problem with the server at this time.\");\n }\n })\n}", "async onLoad(options) {\n console.log('profile-update', options)\n this.setData(options)\n this.initValidate()\n const user = wx.getStorageSync('current_user')\n console.log('id', user.user.id)\n this.setData({\n user: await getUserDetails(user.user.id)\n })\n }", "function updateUserProfile(isValid) {\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new UsersService(vm.user);\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n Notification.success({ message: '<i class=\"glyphicon glyphicon-ok\"></i> Edit profile successful!' });\n Authentication.user = response;\n }, function (response) {\n Notification.error({ message: response.data.message, title: '<i class=\"glyphicon glyphicon-remove\"></i> Edit profile failed!' });\n });\n }", "function setUserData() {\n //TODO: for non-social logins - userService is handling this - not a current issue b/c there is no data for these right after reg, but needs to be consistent!\n authService.setUserCUGDetails();\n authService.setUserLocation();\n authService.setUserPreferences();\n authService.setUserBio();\n authService.setUserBookings();\n authService.setUserFavorites();\n authService.setUserReviews();\n authService.setSentryUserContext();\n authService.setSessionStackUserContext();\n\n //was a noop copied from register controller: vm.syncProfile();\n }", "async function editUsername() {\n try {\n // get Userinfo to fill out the missing variables in put requests\n const current = await api.get(`/users/${sessionStorage.getItem('id')}`);\n\n const requestBody = JSON.stringify({\n name: current.data.name,\n username: username,\n matrikelNr: current.data.matrikelNr\n });\n\n // Edit is sent to backend\n await api.put(`/users/${sessionStorage.getItem('id')}`, requestBody);\n\n } catch (error) {\n alert(`Something went wrong while editing the user: \\n${handleError(error)}`);\n }\n }", "function upsertUser(userData) {\n $.post(\"/api/user/create\", userData)\n .then(function(){\n localStorage.setItem(\"currentUser\", JSON.stringify(userData));\n localStorage.setItem(\"loggedIn\", true);\n window.location = \"/\"\n });\n }", "setUser (user) {\n AppStorage.setUserData(user)\n AppDispatcher.handleAction({\n actionType: 'USER_SET',\n data: user\n })\n }", "async put(data, cb) {\n\t\tconst phone = normalizePhone(data.payload.phone) || false\n\t\tif (!phone) {\n\t\t\treturn cb(400, {'Error': 'Missing required field'})\n\t\t}\n\n\t\tconst userData = await _data.read('users', phone) || false\n\t\tif (!userData) {\n\t\t\treturn cb(400, {'Error': 'No user with this phone number'})\n\t\t}\n\n\t\tconst firstName = normalizeString(data.payload.firstName) || userData.firstName\n\t\tconst lastName = normalizeString(data.payload.lastName) || userData.lastName\n\t\tconst password = normalizeString(data.payload.password)\n\n\t\tif (firstName || lastName || password) {\n\t\t\tlet hashedPassword = userData.hashedPassword\n\t\t\tif (password) {\n\t\t\t\thashedPassword = helpers.hash(password)\n\t\t\t\tif (!hashedPassword) {\n\t\t\t\t\treturn cb(500, {'Error': 'Could not hash password'})\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst newData = {\n\t\t\t\t\t...userData,\n\t\t\t\t\tfirstName,\n\t\t\t\t\tlastName,\n\t\t\t\t\thashedPassword\n\t\t\t\t}\n\t\t\t\tawait _data.update('users', phone, newData)\n\n\t\t\t\tdelete newData.hashedPassword\n\t\t\t\tcb(200, newData)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(error)\n\t\t\t\tcb(500, {'Error': 'Could not update user'})\n\t\t\t}\n\t\t}\n\n\t}", "function dealWithUserUpdate(answer){\n //if there are no users...\n if (Users.length === 0){\n console.info('\\nThere appears to be no users here... Nothing to update!\\n');\n return;\n }\n //if the user name is not in use, it must mean it's not in the db\n if (!user_Names[answer]) {\n console.error('Sorry, no such user found!');\n helpers.menuCallback();\n return;\n }\n //find the user in the array using the user_name provided\n helpers.chosenUser = Users.find(o => o.user_name === answer);\n helpers.rl.question('\\nOk, please enter new user password: ', updateUserPassword);\n}", "update() {\n Spark.put('/settings/timezone', this.form)\n .then(() => {\n Bus.$emit('updateUser');\n });\n }", "function SaveUserData() {\n fs.writeFileSync(usersfile, JSON.stringify(signUpUser));\n Log(\"Saved user data\");\n}", "function updateUserProfile(req, res) {\n if(req.body.userID === undefined){\n return res.send(\"Error: no user specified\");\n }\n User.findById(req.body.userID, function (err, user) {\n if (err) throw err;\n if(user === null) {\n return res.send(\"Error: No such User exists\");\n }\n\n user.name = req.body.name;\n user.email = req.body.email;\n user.phone = req.body.phone;\n user.address = req.body.address;\n user.password = req.body.password;\n \n user.save(function(err) {\n if (err) throw err;\n return res.send('Success');\n });\n \n });\n \n}", "function updateUserProfile(isValid) {\n\n if (!isValid) {\n $scope.$broadcast('show-errors-check-validity', 'vm.userForm');\n\n return false;\n }\n\n var user = new UsersService(vm.user);\n\n //getting users selected skills\n\n var arrSkills = [];\n if(vm.user.roles[0]=='technician') {\n for (var i in $scope.userSkills.selected) {\n if ($scope.userSkills.selected[i] == 'Y') {\n arrSkills.push(i);\n\n }\n }\n\n user.skills = arrSkills;\n }\n\n user.$update(function (response) {\n $scope.$broadcast('show-errors-reset', 'vm.userForm');\n\n Notification.success({message: '<i class=\"glyphicon glyphicon-ok\"></i> Edit profile successful!'});\n Authentication.user = response;\n }, function (response) {\n Notification.error({\n message: response.data.message,\n title: '<i class=\"glyphicon glyphicon-remove\"></i> Edit profile failed!'\n });\n });\n }", "function updateProfile(info) {\n setProfile(info);\n }", "static async updateUser({ username, password, first_name, last_name, email }) {\n try {\n const res = await this.request(`users/${username}`, { password, first_name, last_name, email }, 'patch')\n return res;\n } catch (err) {\n return { errors: err };\n }\n }", "update(id, user) {\n return 1;\n }" ]
[ "0.69442725", "0.6867636", "0.6736739", "0.6719616", "0.66935664", "0.6674543", "0.6638821", "0.65680075", "0.6558019", "0.6550844", "0.65458006", "0.6530127", "0.6527179", "0.65117365", "0.65002155", "0.6477286", "0.64739716", "0.6472656", "0.6425882", "0.6357921", "0.6357921", "0.63301843", "0.62905496", "0.62878144", "0.6271989", "0.62494487", "0.62482285", "0.62395155", "0.6221423", "0.6217099", "0.62064725", "0.61934566", "0.61915123", "0.61803114", "0.6179165", "0.6159514", "0.6158578", "0.61342394", "0.61287856", "0.612256", "0.61087424", "0.6104483", "0.61019003", "0.6100204", "0.60788596", "0.6068903", "0.6063193", "0.60489666", "0.6025245", "0.60234386", "0.6023355", "0.6001534", "0.60013527", "0.5999184", "0.59971124", "0.59969324", "0.5969009", "0.5968051", "0.5958271", "0.5956114", "0.5955775", "0.5951542", "0.5937748", "0.5919557", "0.5903211", "0.58946544", "0.58810824", "0.5873646", "0.5873373", "0.58687073", "0.5862797", "0.5861715", "0.5838149", "0.5834656", "0.5833051", "0.5824746", "0.5815974", "0.5805686", "0.58026326", "0.58021545", "0.57972157", "0.5791414", "0.5791323", "0.5783765", "0.57821256", "0.57810634", "0.57779485", "0.5777581", "0.5775227", "0.5774692", "0.5772385", "0.5764426", "0.5763502", "0.57622594", "0.5756673", "0.57563066", "0.5754491", "0.57528234", "0.57499254", "0.5736629" ]
0.6583185
7
a boolean and be case insensitive. The string can contains any char.
function XO(str) { const totalX = str.toLowerCase().split('').reduce((acc, value) => (value === 'x' ? acc + 1 : acc), 0); const totalO = str.toLowerCase().split('').reduce((acc, value) => (value === 'o' ? acc + 1 : acc), 0); return totalX === totalO; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isCaseInsensitive() {\n return !!this._options['case-insensitive'];\n }", "function containsLowerCase(s) {\n return s != s.toUpperCase();\n}", "function isLowerCase(str) {\n return str == str.toLowerCase() && str != str.toUpperCase();\n}", "function stringToBoolean(s) {\n return [\"true\", \"yes\", \"t\", \"y\"].includes(s && s.toLowerCase());\n}", "function isLower(c){\r\n return c.toLowerCase() == c;\r\n}", "function startsWithLowercase (str)\n {\n return str.charAt(0).toUpperCase() !== str.charAt(0);\n }", "function sameCase(str) {\n if (str === str.toLowerCase() || str === str.toUpperCase()) {\n console.log(\"#11: \" + true);\n }else{\n console.log(\"#11: \" + false);\n }\n}", "function lowerCase (str) {\n\t return isString(str) &&\n\t str.toLowerCase() === str\n\t}", "function String_StartsWith(str, bCaseInsensitive)\n{\n\t//case insensitive?\n\tif (bCaseInsensitive)\n\t{\n\t\t//use substring method to avoid lowercasing everything\n\t\treturn this.substring(0, str.length).toLowerCase() == str.toLowerCase();\n\t}\n\telse\n\t{\n\t\t//search for the last index of the string starting at 0 (ie: starts with!)\n\t\treturn this.lastIndexOf(str, 0) == 0;\n\t}\n}", "function pasreString2Boolean(value){\n return /^true$/i.test( value);\n }", "get caseSensitive() {\n\t\treturn this.__caseSensitive;\n\t}", "function containsEnglish(str){\n str.toLowerCase();\n console.log(\"#2: \" + str.includes(\"english\"));\n}", "function containsUpperCase(s) {\n return s != s.toLowerCase();\n}", "'~=' ({ attr, value, insensitive }) {\n return (attr.match(/\\w+/g) || []).includes(value)\n }", "function hasOnlyLowerCaseChars(word = '') {\n return new RegExp('^[a-z]+$', 'g').test(word);\n}", "function sc_string_downcase(s) {\n return s.toLowerCase();\n}", "function whisper(string){\n\tlet res=string.toLowerCase();\n\treturn(res)\n}", "function check() {\n var string = \"DIJANA\";\n return string === string.toUpperCase();\n}", "function isAllLower(x) {\n return x === x.toLowerCase();\n }", "function equalsIgnoreCase(str1, str2){\n\tif(str1 == undefined || str2 == undefined){\n\t\treturn false;\n\t}\n\treturn (str1.toString().toUpperCase() == str2.toString().toUpperCase());\n}", "function strToBool(s){\n regex=/^\\s*(true|1|on)\\s*$/i\n return regex.test(s);\n}", "function whisper(string){ return string.toLowerCase() }", "function isLowercase(c) {\r\n return 97 <= c && c <= 122; \r\n }", "function firstUpperChar(str) {\n let regex = /^[A-Z]/;\n if (regex.test(str)) {\n console.log(true);\n } else {\n console.log(false);\n }\n}", "function getBoolean(str, defaultValue) {\r\n\t\t\tif (str === undefined) {\r\n\t\t\t\treturn defaultValue;\r\n\t\t\t}\r\n\t\t\tif (typeof str === \"boolean\") {\r\n\t\t\t\treturn str;\r\n\t\t\t}\r\n\t\t\tstr = str.trim().toLowerCase();\r\n\t\t\treturn str.startsWith(\"t\") || str.startsWith(\"y\") || str == 1;\r\n\t\t}", "checkLetter(letter) { \n const phrase = this.phrase.toLowerCase();\n return phrase.includes(letter) ? true : false;\n }", "useLowercase(use) {\n\t\tthis.options.lowercase = use ? true : false;\n\t}", "function isLowercase(value) {\n return typeof value === 'string' && validator_lib_isLowercase__WEBPACK_IMPORTED_MODULE_1___default()(value);\n}", "caseSensitiveMatching() {\n // Set a default setting\n let caseSensitive = true;\n \n let global = nova.config.get(\"todo.global-case-sensitive-tag-matching\");\n let workspace = nova.workspace.config.get(\"todo.workspace-case-sensitive-tag-matching\")\n \n // Override default with a global preference if it exists\n if (global == true || global == false) {\n caseSensitive = global;\n }\n \n // Override global setting with a workspace preference if in a workspace and non-global setting is selected.\n if (FUNCTIONS.isWorkspace() && (workspace !== 'Use Global Preference')) {\n if (workspace == 'Upper Case Only') {\n caseSensitive = true;\n } else if (workspace == 'Upper and Lower Case') {\n caseSensitive = false;\n }\n }\n \n return caseSensitive;\n }", "function allCaps(input) {\n\tfor (var i = 0; i < input.length; i++) {\n\t\tif (input[i] > 'Z' || input[i] < 'A')\n\t\t\treturn false\n\t}\n\treturn true;\n}", "function lower_case(str){\n return str.toLowerCase();\n}", "function lower_case(str){\n return str.toLowerCase();\n}", "checkLetter(e){\n const phraseJoin = this.phrase.join('');\n return phraseJoin.includes(e.toLowerCase()) ? true : false;\n }", "function bs_isTrue(value) {\n var trueVals = new Array('true','on','y','yes',1,'1','ja','oui');\n if (value == '') return false;\n \n if (typeof(value) == 'string') value = value.toLowerCase();\n \n if (value == true) return true;\n\tfor (var i=0; i<trueVals.length; i++) {\n\t\tif (value == trueVals[i].toLowerCase()) return true;\n\t}\n\t\n return false;\n}", "function passCase(pw) {\n\treturn pw.toUpperCase() !== pw && pw.toLowerCase() !== pw;\n}", "'^=' ({ attr, value, insensitive }) {\n return attr.startsWith(value)\n }", "static caselessStringMatch(a, b) {\n const compare = a.localeCompare(b, 'en', {\n sensitivity: 'base',\n });\n return compare === 0 ? true : false;\n }", "function toBool(str){\n\t\tif(str === true){\n\t\t\treturn true;\n\t\t}\n\t\telse if(str){\n\t\t\treturn (str.toUpperCase() === 'TRUE');\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "function slowercase(s) {\n return s.toLowerCase()\n}", "function CheckCapitalLetter(str)\n{\n 'use strict';\n\n let flag = 0;\n\n for (let i = 0; i < str.length; ++i)\n {\n if ((str.charCodeAt(i) >= 65) && (str.charCodeAt(i) <= 90))\n {\n flag = 1;\n return (flag);\n }\n }\n \n return (flag); \n}", "function gimmiTrue(inputString, letter) {\n var x = false;\n inputString.split('').forEach(function (e) {\n if (e === letter) {\n x = true;\n }\n });\n return x;\n}", "function testInLowerCaseAlphabet(){\n\t\tvar StringUtils = LanguageModule.StringUtils;\n\t\tvar stringUtils = new StringUtils();\n\t\tvar encodings = stringUtils.stringEncodings;\n\t\tvar lencodings = stringUtils.languageEncodings;\n\t\tvar isLowerCaseInAlphabet1 = stringUtils.isLowerCaseInAlphabet(\"abcdef\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet2 = stringUtils.isLowerCaseInAlphabet(\"ABCDEF\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet3 = stringUtils.isLowerCaseInAlphabet(\"0123456789\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet4 = stringUtils.isLowerCaseInAlphabet(\"g\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet5 = stringUtils.isLowerCaseInAlphabet(\"->?\", encodings.ASCII, lencodings.ENGLISH);\n\t\texpect(isLowerCaseInAlphabet1).to.eql(true);\n\t\texpect(isLowerCaseInAlphabet2).to.eql(false);\n\t\texpect(isLowerCaseInAlphabet3).to.eql(false);\n\t\texpect(isLowerCaseInAlphabet4).to.eql(true);\n\t\texpect(isLowerCaseInAlphabet5).to.eql(false);\n\t}", "checkLetter(letter) {\n if ( this.phrase.includes(letter.toLowerCase()) ) {\n return true;\n } else {\n return false;\n }\n }", "function sc_isStringCIEqual(s1, s2) {\n return s1.toLowerCase() === s2.toLowerCase();\n}", "function isAllCapital(string) {\n for (var i = 0; i < string.length; i++) {\n if (string.charCodeAt(i) < 65 || string.charCodeAt(i) > 90) {\n return false;\n }\n }\n return true;\n}", "function stringToBool(string) {\n switch(string.toLowerCase().trim())\n {\n case true:\n case \"true\":\n case \"yes\":\n case 1:\n return true;\n case false:\n case \"false\":\n case \"no\":\n case 0:\n case null:\n return false;\n default:\n return false;\n }\n}", "function hasLowerCase(str) {\n let temp = [];\n let tempUpperCase = [];\n let strArr = str.split('');\n let isLowerCase;\n \n temp = strArr;\n \n for (var i = 0; i < strArr.length; i++) {\n if (strArr[i] === strArr[i].toLowerCase()){\n isLowerCase = true;\n } else {\n isLowerCase = false\n }\n }\n \n return isLowerCase;\n }", "checkLetter(letter) {\r\n return this.phrase.toLowerCase().includes(letter);\r\n }", "'=' ({ attr, value, insensitive }) {\n return attr === value\n }", "function StringToBoolean(string) {\n if (isEmptyOrWhiteSpace(string)) return false;\n\n switch (string.toLowerCase().trim()) {\n case \"true\": case \"yes\": case \"1\": case \"Y\": return true;\n case \"false\": case \"no\": case \"0\": case \"\": case null: return false;\n default: return Boolean(string);\n }\n}", "function caseInsensitiveStringCompare(str1, str2) {\r\n // your code here\r\n if (str1.toLowerCase() == str2.toLowerCase()) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "function useLowerCase()\n{\n var flag = document.getElementById(\"lowercase\").checked;\n\n return flag;\n}", "function caseInsensitiveCompare(str1, str2) {\n // code here\n}", "function antiSpam(input){\n let string = input\n console.log(string)\n if(string.toLowerCase().includes(\"spam\") || string.toLowerCase().includes(\"scam\")){\n return true\n }else{\n return false\n }\n}", "function match(s1, s2) {\n if (s1.toLowerCase() == s2.toLowerCase()) {\n return true;\n }\n return false;\n}", "function checkCase(txt) {\n\t\tif (txt.length === 1) {\n\t\t\tif (txt.lcase() === txt)\n\t\t\t\treturn \"l\";\n\t\t\telse if (txt.ucase() === txt)\n\t\t\t\treturn \"u\";\n\t\t} return false;\n\t}", "function isUperCase({word}, alphabet){\r\n\tstr = word[0]\r\n\tfor(i in alphabet){\r\n\t\tif(alphabet[i]===str){\t\r\n\t\t return true\t\t\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}", "function stringToBoolean(string){\n switch(string.toLowerCase().trim()){\n case \"true\": case \"yes\": case \"1\": return true;\n case \"false\": case \"no\": case \"0\": case null: return false;\n default: return Boolean(string);\n }\n}", "checkLetter(letter) {\r\n const phrase = this.phrase;\r\n if (phrase.includes(letter)) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "function lowercase(input) {}", "'|=' ({ attr, value, insensitive }) {\n return attr.startsWith(`${value}-`)\n }", "caseSensitive() {\n this._flags = this._flags.replace(/i/g, \"\");\n return this;\n }", "function isAlpha(string) {\n\tvar filter = /^[A-Za-z]+$/;\n\tif (filter.test(string)) {\n\t\treturn true;\n\t}\n\telse {\n\t\treturn false;\n\t}\n}", "function toBoolean(string) {\n if (typeof string === 'boolean') {\n return string;\n }\n else if (string === null || string === undefined) {\n return false;\n }\n string = String(string).toLowerCase();\n switch (string) {\n case '0':\n case false.toString():\n return false;\n case true.toString():\n return true;\n default:\n return true;\n }\n }", "checkLetter(letter){\r\n if(this.phrase.includes(letter)){\r\n return true;\r\n }else {\r\n return false;\r\n }\r\n\r\n }", "function isLowerCased(word) {\n var lowerCase;\n for (var i = 0; i < word.length; i++) {\n if (word[i] === word[i].toLowerCase()) {\n lowerCase = true;\n } else {\n lowerCase = false;\n break;\n }\n }\n return lowerCase;\n}", "function whisper(string) {\n return string.toLowerCase();\n}", "function iEqual(str1, str2) {\n return str1.toLocaleLowerCase() === str2.toLocaleLowerCase();\n}", "function iEqual(str1, str2) {\n return str1.toLocaleLowerCase() === str2.toLocaleLowerCase();\n}", "function isPalindrome(str, isCaseSensitive)\n{\n return isCaseSensitive ? (reverseString(str).toLowerCase() === str.toLowerCase()) : (reverseString(str) === str);\n}", "function InString() {\r\n}", "function startsWithVowel(str) {\n if (typeof str !== 'string') return;\n var init = str[0].toLowerCase();\n return (init=='a' || init=='e' || init=='i' || init=='o' || init=='u' || init=='y');\n //OR:\n switch (init) {\n case a:\n case e:\n case i:\n case o:\n case u: return true;\n default: return false;\n }\n}", "function allLetter(parameter){ \n\tvar letters = /^[A-Za-z]+$/.test(parameter);\n\tif(letters == true){ \n\t\treturn true; \n\t}else{ \n\t\treturn false; \n\t} \n}", "function isLowerCased(word) {\n for (var i = 0; i < word.length; i++) {\n if (word[i] !== word[i].toLowerCase()) {\n return false;\n }\n }\n return true;\n}", "function isLowerCased(word) {\n for (var i = 0; i < word.length; i++) {\n if (word[i] !== word[i].toLowerCase()) {\n return false;\n }\n }\n return true;\n}", "function isAlphabetic(string) {\n\treturn isAlphabetic1(string, true);\n}", "function whisper(string) {\n return string.toLowerCase()\n}", "function whisper(string) {\n return string.toLowerCase()\n}", "function whisper(string) {\n return string.toLowerCase()\n}", "function isAllCaps(x) {\n return x === x.toUpperCase();\n }", "function isCapital(letter) {\n\n}", "function isLetter(c) {\n return (c.toUpperCase() != c.toLowerCase());\n}", "function matchBool() {\n\t\tvar pattern = /^(true|false)/;\n\t\tvar x = lexString.match(pattern);\n\t\tif(x !== null){\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}", "checkLetter(letter) { \n if (this.phrase.includes(letter)) {\n return true; \n }\n }", "function startsWithIgnoringCase(string, value, start) {\n for (var i = 0, n = value.length; i < n; i++) {\n var ch1 = toLowerCase(string.charCodeAt(i + start));\n var ch2 = value.charCodeAt(i);\n if (ch1 !== ch2) {\n return false;\n }\n }\n return true;\n }", "'*=' ({ attr, value, insensitive }) {\n return attr.includes(value)\n }", "function containsAny (myStr, mySearchWords) {\r myStr = myStr.toLowerCase();\r var i;\r for (i=0; i < mySearchWords.length; i++) {\r if (myStr.search(mySearchWords[i].toLowerCase()) != -1) {\r return true;\r }\r }\r return false;\r }", "function validarCaracter(caracter){\n\tvar conf;\n\tr=caracter;\n\tif (/^([A-Za-z\\s])*$/.test(r)){\n\t\tconf=true;\n\t}\n\telse{\n\t\tconf=false;\n\t}\n\treturn conf;\n\t\t\n}", "checkLetter(letter) {\n if ( this.phrase.includes(letter) ) {\n return true;\n }\n else {\n return false;\n }\n }", "checkLetter(letter) {\r\n // return true/false if passed letter, matches letter in phrase\r\n return this.phrase.includes(letter) ? true : false;\r\n }", "function startsWithS(str) { return str[0].toLowerCase() === 's'; }", "testSync(string) {\r\n if ((typeof this.source === 'boolean' || typeof string === 'boolean')) {\r\n return this.source === string;\r\n }\r\n return this.searchSync(string) != null;\r\n }", "function equalsCaseInsensitive(a, b) {\r\n if (a && b) {\r\n return a.toUpperCase() === b.toUpperCase();\r\n }\r\n return a === b;\r\n}", "function equalsCaseInsensitive(a, b) {\r\n if (a && b) {\r\n return a.toUpperCase() === b.toUpperCase();\r\n }\r\n return a === b;\r\n}", "testSync(string) {\n if ((typeof this.source === 'boolean' || typeof string === 'boolean')) {\n return this.source === string;\n }\n return this.searchSync(string) != null;\n }", "testSync(string) {\n if ((typeof this.source === 'boolean' || typeof string === 'boolean')) {\n return this.source === string;\n }\n return this.searchSync(string) != null;\n }", "function convertToActualBool(string) {\n return string === 'true' || string === true;\n}", "function lowerCase(str) {\n return str.toLowerCase();\n}", "function lowerCase(str) {\n return str.toLowerCase();\n}", "checkLetter(letter) {\n let status = false;\n for (let i = 0; i < this.phrase.length; i++) {\n if (letter === this.phrase[i].toLowerCase()) {\n status = true;\n }\n }\n return status;\n }", "checkLetter(letter) {\n console.log(this.phrase);\n if (this.phrase.includes(letter)) {\n return true;\n } else {\n return false;\n }\n }" ]
[ "0.76494443", "0.6941879", "0.65839875", "0.6555828", "0.65389866", "0.64995146", "0.6443363", "0.6411372", "0.6316925", "0.6304686", "0.6303066", "0.6291031", "0.62662494", "0.6250397", "0.6243185", "0.62136304", "0.6212543", "0.6156964", "0.61505324", "0.61498666", "0.6140647", "0.6125173", "0.61133283", "0.6106817", "0.6106302", "0.60982156", "0.60939103", "0.6087705", "0.6081883", "0.6081759", "0.60655165", "0.60655165", "0.60504645", "0.60323876", "0.601039", "0.600916", "0.60066265", "0.6001024", "0.59916407", "0.59827965", "0.59762096", "0.59728956", "0.5968161", "0.59471965", "0.5943753", "0.59433407", "0.59283954", "0.5907087", "0.5906229", "0.58874667", "0.5884366", "0.58824706", "0.58745885", "0.5873625", "0.58735013", "0.5859343", "0.5858552", "0.58579546", "0.58501804", "0.583799", "0.5834043", "0.5830662", "0.58277667", "0.58275497", "0.5814237", "0.5804254", "0.5789638", "0.57779914", "0.57779914", "0.5772631", "0.57677275", "0.57628816", "0.57563585", "0.5753225", "0.5753225", "0.5750837", "0.5745532", "0.5745532", "0.5745532", "0.573987", "0.57205266", "0.5717192", "0.5712497", "0.5700868", "0.5700305", "0.5695745", "0.5694238", "0.56856", "0.56832784", "0.56741863", "0.56741166", "0.5664111", "0.5661278", "0.5661278", "0.5661157", "0.5661157", "0.56606436", "0.5658824", "0.5658824", "0.5656413", "0.56519634" ]
0.0
-1
validate entry, allow only numbers
function validate (current) { if (!(current.value < 48 || current.value > 57)) current.value = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onlyNumbers(field) {\n if (/^\\d+$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.name} must contain only numbers`);\n return false;\n }\n}", "function allowNumbersOnly(e) {\n var code = (e.which) ? e.which : e.keyCode;\n if (code > 31 && (code < 48 || code > 57)) {\n e.preventDefault();\n }\n }", "function Numbervalidate(evt) {\r\n var theEvent = evt || window.event;\r\n\r\n // Handle paste\r\n if (theEvent.type === 'paste') {\r\n key = event.clipboardData.getData('text/plain');\r\n } else {\r\n // Handle key press\r\n var key = theEvent.keyCode || theEvent.which;\r\n key = String.fromCharCode(key);\r\n }\r\n var regex = /[0-9]|\\./;\r\n if( !regex.test(key) ) {\r\n theEvent.returnValue = false;\r\n if(theEvent.preventDefault) theEvent.preventDefault();\r\n }\r\n}", "function Numbervalidate(evt) {\r\n var theEvent = evt || window.event;\r\n\r\n // Handle paste\r\n if (theEvent.type === 'paste') {\r\n key = event.clipboardData.getData('text/plain');\r\n } else {\r\n // Handle key press\r\n var key = theEvent.keyCode || theEvent.which;\r\n key = String.fromCharCode(key);\r\n }\r\n var regex = /[0-9]|\\./;\r\n if( !regex.test(key) ) {\r\n theEvent.returnValue = false;\r\n if(theEvent.preventDefault) theEvent.preventDefault();\r\n }\r\n}", "function numeric_validation(e){\n\tvar unicode=e.charCode? e.charCode : e.keyCode;\n\t//alert(unicode);\n\tif (unicode!=8 //backspace\n\t\t&& (unicode != 45) //dash key and subtract in number pad, why?\n\t\t&& (unicode != 46) //delete key\n\t\t&& (unicode != 109) //subtract number pad \n\t\t&& (unicode != 189) //dash as subtract\n\t\t&& (unicode != 188) //period, not comma\n\t){\n\t\tif (unicode<48||unicode>57) //if not a number\n\t\t\treturn false; //disable key press\n\t}\n}", "function validateNum(){\n\tvar getNumber = $(\"#altitudeid\").val();\n\tnumbers = /^[0-9]+$/;\n\tif(!getNumber.match(numbers)){\n\t\tnewVal = getNumber.replace(/[a-zA-Z<>`{}~,./?;:'\"!@#$%^&*()_+=\\-\\[\\]]+$/, \"\");\n\t\t$(\"#altitudeid\").val(newVal);\n\t}\n}", "function checkIfOnlyLettersNumbers(field) {\n if (/^[A-Za-z0-9\\s]*$/.test(field.value)) {\n setValid(field);\n return true;\n } else {\n setInvalid(field, `${field.name} must contain only letters and numbers`);\n return false;\n }\n}", "function soloNumeros(evt){\n\tevt = (evt) ? evt : window.event\n var charCode = (evt.which) ? evt.which : evt.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57)) {\n status = \"This field accepts numbers only.\"\n return false\n }\n status = \"\"\n return true\n}", "function ValidNum() {\n\t\t if (event.keyCode < 48 || event.keyCode > 57) {\n\t\t event.returnValue = false;\n\t\t }\n\t\t return true;\n\t\t}", "function ValidNum() {\n\t\t if (event.keyCode < 48 || event.keyCode > 57) {\n\t\t event.returnValue = false;\n\t\t }\n\t\t return true;\n\t\t}", "function numbersOnly(oToCheckField, oKeyEvent) {\n return (\n oKeyEvent.charCode === 0 ||\n /\\d|\\./.test(String.fromCharCode(oKeyEvent.charCode))\n );\n}", "function allowNum(fieldName){\n\tif((event.keyCode < 48)||(event.keyCode > 57)){\n\t\talert(\"Please enter only number for \"+fieldName);\n\t\tevent.returnValue = false;\n\t} //end-if\n}", "function allowNumbersOnly(e) {\n\t\t\n\t var charCode = (e.which) ? e.which : e.keyCode;\n\t if (charCode > 31 && (charCode < 48 || charCode > 57)) {\n\t\te.preventDefault();\n\t }\n\t}", "function CHMisNumber(theInputField)\r\n{\r\n\r\n theInput = theInputField.value;\r\n theLength = theInput.length ;\r\n for (var i = 0 ; i < theLength ; i++)\r\n {\r\n\t//check if number field contains alphabets or spaces\r\n if (theInput.charAt(i) < '0' || theInput.charAt(i) > '9')\r\n {\r\n\t return false;\r\n\t}\r\n }// for ends\r\n return true;\r\n}// function isNumber ends", "function ValidateNumericField(evt) {\r\n var charCode = (evt.which) ? evt.which : event.keyCode;\r\n \r\n if (charCode != 46 && charCode != 32 && charCode != 95 && charCode != 08 && (charCode < 97 || charCode > 122) && (charCode < 65 || charCode > 90) && (charCode < 44 || charCode > 57) || charCode == 190) {\r\n alert(\"Please enter valid data\");\r\n return false; \r\n }\r\n}", "function validateNum(){\r\n\tvar num = document.survey_form.informative.value; //get the value\r\n\t//make sure the entry is a number\r\n\tvar numPattern = /^[0-9]+$/;\r\n\tif(!numPattern.test(num)){alert(\"Please enter a numerical value.\" )}\r\n\t//if the value is less than 0 or greater than 10, it is not valid.\r\n\tif (num < 0 || num > 10)\t\t\t\r\n\t\t{alert(\"Please enter a number between 0 and 10\" )}\t\r\n\t}", "function validateNumbers(event) {\n if (event.keyCode == 46){\n return false;\n }\n var key = window.event ? event.keyCode : event.which;\n if (event.keyCode == 9 || event.keyCode == 8 || event.keyCode == 46) {\n return true; //allow only number key and period key\n }\n else if ( (key < 48 || key > 57) && key != 190 ) {\n return false;\n }\n else return true;\n}", "function ValidNum() {\n\t if (event.keyCode < 48 || event.keyCode > 57) {\n\t event.returnValue = false;\n\t }\n\t return true;\n\t}", "function isNumericInput(event) {\n const key = event.keyCode;\n return ((key >= 48 && key <= 57) || // Allow number line\n (key >= 96 && key <= 105) // Allow number pad\n );\n}", "function allnumeric(inputtxt){\n var numbers = /^[0-9]/\n if(inputtxt.match(numbers)){\n return true;\n }\n else{\n alert('Please input numeric characters above zero only');\n rawcode.value = \"\"\n return false;\n }\n }", "function validateDigitos(myfield, e)\r\n{\r\n\treturn restrictCharacters(myfield, e, digitsOnly); \r\n}", "function isNumber(elem)\n {\n // saves entry text\n var str = elem.value;\n\n // initially set to false\n var decimalDetected = false;\n\n // variable used for character comparison\n var oneCharacter = 0; \n\n // casting to string to compare with ASCII table\n str = str.toString();\n\n // cycles trougth all input text\n for(var i = 0; i < str.length; i++)\n {\n // getting the first char unicode\n var oneCharacter = str.charAt(i).charCod\n // allowing first char to be a minus sign\n if(oneCharacter == 45) \n {\n if(i == 0)\n {\n continue;\n }\n else\n {\n //alert(\"minus sign must be the first character\");\n return false;\n }\n }\n\n // allowing one decimal point only (can be either ',' or '.')\n if(oneCharacter == 46 || oneCharacter == 44)\n {\n // if we still didn't have any decimal character we accept it\n if(!decimalDetected)\n {\n decimalDetected = true;\n continue;\n }\n else\n {\n //alert(\"only one decimal placeholder is allowed\");\n return false;\n }\n }\n\n // allowing 0-9 range only\n if(oneCharacter < 48 || oneCharacter > 57)\n {\n //alert(\"insert numbers only!\");\n return false;\n }\n }\n return true;\n}", "function onlyNum(obj,event){\n\tvar num_regx=/^[0-9]*$/;\n\tif( !num_regx.test(obj.value) ) {\n\t\talert('숫자만 입력하실 수 있습니다.');\n\t\tobj.value = obj.value.substring(0, obj.value.length-1 );\n\t}\n}", "function isInputNumber(evt){\n var ch =String.fromCharCode(evt.which);\n if(!(/[0-9]/.test(ch))){\n evt.preventDefault();\n }\n }", "function onlyNumbers(evt) {\r\n var charCode = (evt.which) ? evt.which : event.keyCode\r\n if (charCode > 31 && (charCode < 48 || charCode > 57))\r\n return false;\r\n return true;\r\n}", "function onlyNumeric() {\n //Get element id\n const idName = this.id;\n // Regex that checks if input has somethong that is not a digit\n const current_value = $(`#${idName}`).val();\n const re = new RegExp(/(\\D+)/gi);\n const match = re.exec(current_value);\n // Check match\n if (match != null) {\n // remove user input\n $(`#${idName}`).val(\"\");\n // Put error message\n $(`#${idName}_wi`).text(\"¡Sólo se admiten valores numéricos!\");\n $(`#${idName}_wi`).show();\n } else {\n // Hide error message\n $(`#${idName}_wi`).text(\"\");\n $(`#${idName}_wi`).hide();\n }\n}", "function checkAllowNumber(e) {\r\n var code = (e.which) ? e.which : e.keyCode; \r\n if ((code < 48 || code > 57) && code != 8 && code != 13 && code != 27 && code != 0 && code != 46 && (code < 37 || code > 40)) {\r\n return false;\r\n }\r\n return true;\r\n}", "function numberOnlyAllowed(evt){\n\t\n\tvar charCode=(evt.which?evt.which:evt.keyCode);\n\t\n\tif(charCode>=48 && charCode<=57 || charCode == 8 ||charCode==46|| charCode == 32 ||charCode == 37 ||charCode == 38 ||charCode == 38 || charCode == 9)\n\t{\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\talert(\"Enter only Number\");\n\t\treturn false;\n\t}\n}", "function checkAllowNumber(e) {\n var code = (e.which) ? e.which : e.keyCode;\n if ((code < 48 || code > 57) && code != 8 && code != 13 && code != 27 && code != 0 && code != 46 && (code < 37 || code > 40)) {\n return false;\n }\n return true;\n}", "function CheckNumbers(field, rules, i, options) {\n ///Assign Reguler experassion in a variable\n var regex = /^[0-9]+$/;\n //Match Reguler expression with user input data\n if (!regex.test(field.val())) {\n ///Show Message if Invalid Information\n return \"Please Enter Numbers Only.\"\n }\n}", "function onlyNumber(evt) {\n var charCode = (evt.which) ? evt.which : evt.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n}", "function ValidaSoloNumeros() \n\t{\n \t\tif ((event.keyCode < 48) || (event.keyCode > 57)) \n \t\tevent.returnValue = false;\n\t}", "function ValidNum() {\n if (event.keyCode < 48 || event.keyCode > 57) {\n event.returnValue = false;\n }\n}", "function ageValidator() {\n //create patterns\n var findNonDigitPattern = /(\\D|\\s)/g;\n if (this.value) { //if has value\n var str = this.value.match(findNonDigitPattern); //find non-digit symbol and spacing\n if (str) {\n //delete wrong symbols and put only correct symbol (has effect if u paste string in input area)\n alert(\"You put invalid age data\");\n this.value = this.value.replace(findNonDigitPattern, \"\");\n }\n } else {\n alert(\"Age field is empty\");\n }\n return true;\n }", "function validateEntry(e){\n if (e.key.length === 1) { // make sure it's evaluating only one character\n if (!isNaN(parseFloat(e.key))) {\n return true;\n }else{\n return false;\n }\n }\n}", "function validate_number(evt) {\n\tvar theEvent = evt || window.event;\n\tvar key = theEvent.keyCode || theEvent.which;\n\tkey = String.fromCharCode( key );\n\tvar regex = /[0-9]/;\n\tif( !regex.test(key) ) {\n\t\ttheEvent.returnValue = false;\n\t\tif(theEvent.preventDefault) theEvent.preventDefault();\n\t}\n}", "function validatenumber(xxxxx) {\r\n \r\n \tvar maintainplus = '';\r\n \tvar numval = xxxxx.value\r\n \tif ( numval.charAt(0)=='+' ){ var maintainplus = '+';}\r\n \tcurnumbervar = numval.replace(/[\\\\A-Za-z!\"£$%^&*+_={};:'@#~,¦\\/<>?|`¬\\]\\[]/g,'');\r\n \txxxxx.value = maintainplus + curnumbervar;\r\n \tvar maintainplus = '';\r\n // alert(\"enter integers only\");\r\n \txxxxx.focus;\r\n}", "function numberOnly(event) {\t\r\n\t var c = event.which || event.keyCode;\r\n\t if ( (c >= 48 && c <= 57) || c == 43) \r\n\t return true;\r\n\t return false;\t \r\n}", "function allnumeric(tele) {\n var numbers = /^[0-9]+$/;\n if (tele.value.match(numbers)) {\n return true;\n } else {\n alert(\"Telephone code must be numeric\");\n return false;\n }\n}", "function numValidate(evt) {\n\n var theEvent = evt || window.event;\n var key = theEvent.keyCode || theEvent.which;\n key = String.fromCharCode( key );\n var regex = /[0-9]/;\n if( !regex.test(key) ) {\n theEvent.returnValue = false;\n if(theEvent.preventDefault) theEvent.preventDefault();\n }\n}", "function onlyNumbers(evt) {\r\n\tvar charCode = (evt.which) ? evt.which : event.keyCode\r\n\tif (charCode > 31 && (charCode < 48 || charCode > 57))\r\n\t return false;\r\n\r\n\treturn true;\r\n}", "isNumeric(value) {\n return /^-{0,1}\\d+$/.test(value);\n }", "function onlyNumberKey(evt) { \r\n \r\n\t// Only ASCII charactar in that range allowed \r\n\tvar ASCIICode = (evt.which) ? evt.which : evt.keyCode \r\n\tif (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57)) \r\n\t\treturn false; \r\n\treturn true; \r\n}", "validate(value){\n value = parseInt(value)\n if(!isNaN(value)){\n throw new Error (\"Tidak boleh angka\")\n }\n }", "function validate_isNum(evt) {\n var theEvent = evt || window.event;\n var key = theEvent.keyCode || theEvent.which;\n key = String.fromCharCode( key );\n var regex = /[0-9]|\\./;\n if( !regex.test(key) ) {\n theEvent.returnValue = false;\n if(theEvent.preventDefault) theEvent.preventDefault();\n }\n}", "function isNumberKey(evt,id){\r\n\r\n let numericConfirm = (evt.which) ? evt.which : evt.keycode;\r\nif(numericConfirm == 46){\r\n var txt=document.getElementById(id).value;\r\n if(!(txt.indexOf(\".\") > -1)){\r\n return true;\r\n }\r\n}\r\n\r\n if(numericConfirm > 31 && (numericConfirm < 48 || numericConfirm > 57)){\r\n return false;\r\n return true;\r\n }\r\n }", "function validateInputNumber(input) {\n\tinput.value = formatNumber(input.value);\n\tif (!isNumber(input.value)) {\n\t\tinput.value = '';\n\t}\n}", "function allowNumeric()\n{\n\tif (!SignUp.mobilenumber.value.match(/^[0-9]+$/) && SignUp.mobilenumber.value !=\"\")\n\t{\n\t\tSignUp.mobilenumber.value=\"\";\n\t\tSignUp.mobilenumber.focus();\n\t\talert(\"Proszę używać tylko liczb\");\n\t}\n}", "function onlyNumbers(enteredkey, location)\r\n{\r\n\t$(\"#\"+enteredkey).keypress(function (e){\r\n\t var charCode = (e.which) ? e.which : e.keyCode;\r\n\t if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 43 && charCode != 8 && charCode != 46 && charCode != 110 && charCode != 190) {\r\n\t\t$(\"#\"+location).html(\"<font color = 'red'>Only numeric values are allowed</font> <img src='../images/no.gif' name = 'img1' align = 'absmiddle' width='18' height = '18' alt='image'>\");\r\n\t\treturn false;\r\n\t }\r\n\t else\r\n\t {\r\n\t\t$(\"#\"+location).html(\"\");\r\n\t }\r\n\t});\r\n}", "function numCheck(entry) {\n\tlet regex = /^[0-9]+$/i;\n\tif (entry != null && entry.match(regex)) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function numeric(campo){\r\n if (isNaN(parseInt(campo.value))) {\r\n alert('Este campo debe ser un número');\r\n return false;\r\n }else{\r\n \treturn true;\r\n }\r\n\r\n}", "function isNumber(evt) {\n evt = (evt) ? evt : window.event;\n var charCode = (evt.which) ? evt.which : evt.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57) || (charCode == 44)) {\n \t// alert(\"Please enter a number (no comma or dash)\");\n return false;\n }\n return true;\n }", "function validNumber(obj){\n\tvar formObj = document.getElementById(obj.id);\n var filter = /^([0-9\\.])+$/;\n if (!filter.test(formObj.value)) {\n// \talert(\"Please input number !\");\n \tComShowCodeMessage('COM12178');\n \tformObj.value=\"\";\n }\n return true;\n}", "function isNumberKey(evt)\n {\n var charCode = (evt.which) ? evt.which : event.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57)){\n return false;\n }\n return true;\n }", "function numberOnly(event) {\n var key = event.keyCode;\n return ((key >= 48 && key <= 57) || (key >= 96 && key <= 105) || key == 8 || key == 9);\n}", "function only_digit(e) {\n // Allow: backspace, delete, tab, escape, enter, . and ,\n if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190, 188]) !== -1 ||\n // Allow: Ctrl+A\n (e.keyCode == 65 && e.ctrlKey === true) ||\n // Allow: Ctrl+R\n (e.keyCode == 82 && e.ctrlKey === true) ||\n // Allow: home, end, left, right, down, up\n (e.keyCode >= 35 && e.keyCode <= 40)) {\n // let it happen, don't do anything\n return;\n }\n // Ensure that it is a number and stop the keypress\n if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {\n e.preventDefault();\n }\n}", "function isNumberKey(evt) {\n var charCode = evt.which ? evt.which : evt.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n alert(\"Enter a positive number for meme id\");\n}", "function esNumeroEnteroValido(strNumeroEntero) {\n\treturn(/^[\\-]*[0-9]+$/.test(strNumeroEntero));\n}", "function validateNumeric(value){\n if(value){ //if value isn't null\n if(/^[0-9]+$/.test(value)){ //use regex to see if all the characters are between 0 to 9\n return {isValid: true, error: null, details: null};\n }\n return {isValid: false, error: 'Must be numeric', details: '\"'+value+'\" contains other characters than numbers.'};\n }\n return {isValid: false, error:'Empty Field', details: 'Please fill out this field to resolve this issue.'};\n}", "function isNumeric(obj)\r\n {\r\n\tobj.value=trim(obj.value);\r\n\tvar val=obj.value;\r\n\tinputStr = val.toString()\r\n\tfor (var i = 0; i < inputStr.length; i++)\r\n\t{\r\n\t\tvar oneChar = inputStr.charAt(i)\t\t\t\r\n\t\tif ((oneChar < \"0\" || oneChar > \"9\") && oneChar != \"/\")\r\n\t\t{\r\n\t\t\talert(\"Enter Numeric Only \");\r\n\t\t\tobj.value='';\r\n\t\t \tobj.focus();\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n}", "function isNumberKey(evt){\r\n var charCode = (evt.which) ? evt.which : event.keyCode\r\n if (charCode > 31 && (charCode < 48 || charCode > 57))\r\n return false;\r\n return true;\r\n}", "validateInput(value) {\n if (value.search(/^[0-9]{11}$/) !== -1 && this.enableCheckSum) {\n this.value += this.checkSumData(this.value);\n }\n if (this.value.search(/^[0-9]{12}$/) !== -1 && (Number(this.value[11]) === this.checkSumData(this.value))) {\n return undefined;\n }\n else {\n return 'Accepts 11 numeric characters.';\n }\n }", "function isValidNumber(input) {\n // var num = Number.parseInt(input);\n // var numText = num + \"\";\n if (isNaN(input)) {\n return false;\n }\n return true;\n}", "function isNumberKey(evt){\n var charCode = (evt.which) ? evt.which : event.keyCode\n if (charCode > 31 && (charCode != 46 &&(charCode < 48 || charCode > 57)))\n return false;\n return true;\n }", "function onlyNum(evt) {\n evt = (evt) ? evt : window.event;\n var charCode = (evt.which) ? evt.which : evt.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57)) {\n return false;\n }\n return true;\n}", "function isNumber(evt, element) {\n\n var charCode = (evt.which) ? evt.which : event.keyCode;//alert(charCode);\n\n if ((charCode != 45) && // “-” CHECK MINUS.\n (charCode != 46) && // “.” CHECK DOT.\n (charCode != 32) && // “.” CHECK SPACE.\t\t\t\n (charCode != 48)) // “0” CHECK SPACE.\t\t\t\n \n return false;\n\n return true;\n }", "function isNumberKey(evt){\n var charCode = (evt.which) ? evt.which : evt.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n }", "function onlyDigits(event)\r\n\t{\r\n\t\tvar key = event.charCode;\r\n if (key < 48 || key > 57)\r\n \r\n\t\t\treturn false;\r\n\t\telse\r\n return true;\r\n\t}", "function isNumberKey(evt)\n{\n var charCode = evt.keyCode;\n\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n\n return true;\n}", "function isNumberKey(evt)\r\n {\r\n var charCode = (evt.which) ? evt.which : event.keyCode\r\n if (charCode > 31 && (charCode < 48 || charCode > 57))\r\n return false;\r\n\r\n return true;\r\n }", "function digitsOnly(e) {\n if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {\n return false;\n }\n }", "function isNumberKey(evt){\n var charCode = (evt.which) ? evt.which : evt.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n}", "function isNumberKey(evt){\n var charCode = (evt.which) ? evt.which : evt.keyCode;\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n}", "function isNumberKey(evt) {\n var charCode = (evt.which) ? evt.which : event.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n}", "function isNumberKey(evt){\n var charCode = (evt.which) ? evt.which : event.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n return true;\n\t}", "function validarNumeros(parametro) {\r\n\tif (!/^([0-9])*$/.test(parametro)) {\r\n\t\treturn false;\r\n\t}else {\r\n\t\treturn true;\r\n\t}\r\n}", "function numbersonly(e){\n var unicode=e.charCode? e.charCode : e.keyCode\n //if the key isn't the backspace key and period for decimal point(which we should allow)\n if ((unicode!=8) & (unicode !=46)) { \n if (unicode<48||unicode>57) //if not a number\n return false //disable key press\n }\n}", "function validate(inputText) {\n var reg = new RegExp(\"^[0-9]*$\");\n\n if (!reg.test(inputText)) {\n // alert(\"Please input a number!\"+inputText);\n return false;\n }else{\n // alert(inputText);\n return true;\n }\n}", "validateInput(value) {\n if (value.search(/^[0-9]{13}$/) !== -1 && Number(value[12]) === this.checkSumData(value)) {\n return undefined;\n }\n else if (value.search(/^[0-9]{12}$/) !== -1) {\n value += this.checkSumData(value);\n this.value = value;\n return undefined;\n }\n else {\n return 'Accepts 12 numeric characters.';\n }\n }", "isNumber(e) {\r\n if (e.which !== 8 && e.which !== 0 && (e.which < 48 || e.which > 57)) {\r\n e.preventDefault();\r\n }\r\n }", "function allnumeric_aadharno(aadharno, msgBox) {\n var num1 = /^\\d{4}\\s\\d{4}\\s\\d{4}$/;\n\n if (aadharno.value.match(num1)) {\n document.getElementById(msgBox).innerHTML = '';\n return true;\n } else {\n document.getElementById(msgBox).innerHTML = '<font style=\"color: red;\">Must have 12 digit aadhaar number.It should be in this \"2558 5552 5586\" format </font><br>';\n aadharno.focus();\n return false;\n }\n}", "function isinputvalid() {\r\n let inputstr = field.value;\r\n let patt = /^[0-9]{1,3}$/g; //1-999\r\n let cond = patt.test(inputstr);\r\n\r\n if (!cond) {\r\n field.value = \"\";\r\n updateImg(data.default.bev);\r\n }\r\n return cond;\r\n}", "function is_number(e) {\n\tvar c = e.which ? e.which : e.keyCode;\n\treturn (c <= 32 || (c >= 48 && c <= 57) || c == 40 || c == 41 || c == 45 || c == 46)\n}", "function isNumberKey(evt) {\n var charCode = (evt.which) ? evt.which : event.keyCode\n if (charCode > 31 && (charCode < 48 || charCode > 57))\n return false;\n\n return true;\n}", "function validarNum(te){\n var num=/^([0-9]+){9}$/;\n if(!num.test(te)){\n window.alert(\"El teléfono sólo debe contener números.\");\n return false;\n }\n}", "function isNumberKey(evt){\n\n\t\t\t var charCode = (evt.which) ? evt.which : event.keyCode\n\n\t\t\t if (charCode > 31 && (charCode < 48 || charCode > 57))\n\n\t\t\t return false;\n\n\t\t\t \n\n\t\t\t return true;\n\n\t\t\t}", "function numbersonly(e){\n\tvar unicode=e.charCode? e.charCode : e.keyCode\n\tif (unicode!=8 && unicode!=9 && unicode!=16 && unicode!=17 && unicode!=35 && unicode!=36 && unicode!=37 && unicode!=39 && unicode!=46 && unicode!=114 && unicode!=116 && unicode!=190 && unicode!=63232 && unicode!=63233 && unicode!=63234 && unicode!=63235 && unicode!=46 && unicode!=63272) { //allow all these keys: 8=backspace; 9=tab; 16=shift; 17=ctrl; 35=end; 36=home; 37=left; 39=right; 190=period; 63232+=safari-arrowkeys;\n\t\tif (unicode<48||unicode>57) //if not a number\n\t\t\treturn false //disable key press\n\t}\n}", "function allnumeric(unummer) {\n var numbers = /^[0-9]+$/;\n if (unummer.value.match(numbers)) {\n return true;\n } else {\n alert(\"Vul alle velden in. Sommige velden (gewicht, grootte) moeten ALLEEN numerieke tekens bevatten\");\n unummer.focus();\n return false;\n }\n}", "function AlfaNumberic(evt){\n\tvar charCode = (evt.which) ? evt.which : event.keyCode\n //alert(charCode);\n\tif (charCode >= 48 && charCode <= 57){\n\t\treturn false;\n\t}else{\n\t\treturn true;\n\t}\n}", "function onlyNumberKey(evt) {\n \n // Only ASCII character in that range allowed\n var ASCIICode = (evt.which) ? evt.which : evt.keyCode ;\n if (ASCIICode >=48 && ASCIICode <=57 ){\n return true ; \n }\n else{\n return false;\n }\n }", "function checkNum(objText){\r\n\tvar newNum = parseInt(objText.val());\r\n\tif(isNaN(newNum)){\r\n\t\treturn false;\r\n\t}else{return true;}\r\n}", "function numberOnly(evt, input){\r\n var charCode = (evt.which) ? evt.which : event.keyCode;\r\n if (charCode > 31 && (charCode < 46 || charCode == 47 || charCode > 57)){\r\n return false;\r\n }\r\n if (charCode == 46 && input.value.indexOf('.') >= 0){\r\n return false;\r\n }\r\n return true;\r\n}", "function valida_numeros(e){\n tecla = (document.all) ? e.keyCode : e.which;\n //Tecla de retroceso para borrar, siempre la permite\n if (tecla == 8 ){ return true; }\n if (tecla == 9 ){ return true; }\n if (tecla == 0 ){ return true; }\n if (tecla == 13 ){ return true; }\n \n // Patron de entrada, en este caso solo acepta numeros\n patron =/[0-9-.]/;\n tecla_final = String.fromCharCode(tecla);\n return patron.test(tecla_final);\n }", "function isNumberKey(evt) {\n\tvar charCode = (evt.which) ? evt.which : event.keyCode;\n\tif (charCode > 31 && (charCode < 48 || charCode > 57))\n\t\treturn false;\n\treturn true;\n}", "function bind_number_only_fields() {\n\t $(\".numeric\").keypress(function (e) {\n //if the letter is not digit then display error and don't type anything\n if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {\n //display error message\n var error_message = $(\"<span> Digits Only </span>\").css(\"color\",\"red\");\n $(this).parent().append(error_message);\n error_message.show().fadeOut(\"slow\");\n// $(\"#errmsg\").html(\"Digits Only\").show().fadeOut(\"slow\");\n return false;\n }\n });\n}", "function isNumber(evt) {\n evt = (evt) ? evt : window.event;\n var charCode = (evt.which) ? evt.which : evt.keyCode;\n //If the char code doesnt represent a number\n if (charCode >= 48 && charCode <= 57 || charCode == 8 || charCode == 190) {\n return true;\n } else {\n return false;\n }\n}", "function checkContact( text ) {\n\tvar str= text.value.toString();\n\tvar len=str.length;\n\tvar check = true;\n\tvar err=\"\";\n\tfor(var i=0; i<len; i++)\n\t{\n\t\tif( ! (str.charAt(i)>=0 && str.charAt(i)<=9) )\n\t\t{\n\t\t\tcheck = false;\n\t\t}\n\t}\n\tif( check == false) {\n\t\terr=\"Only number Allowed\";\n\t}\n\telse if (len >=1 && len < 10) {\n\t\terr = \"Looks like you missed some digits.\"\n\t}\n\treturn err;\n}", "function allnumeric()\n{ \n\tvar uzip = document.registration.zip;\n\tvar numbers = /^[0-9]+$/;\n\tif(uzip.value.match(numbers))\n\t{\n\t\t// Focus goes to next field i.e. email.\n\t\tdocument.registration.email.focus();\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\talert('ZIP code must have numeric characters only');\n\t\tuzip.focus();\n\t\treturn false;\n\t}\n}", "function validate(event) {\n const numbers = /^\\d+$/;\n // console.log(event.key + ' was pressed!');\n if ((!numbers.test(event.key) && event.key.length === 1)\n || (numbers.test(event.key) && String(event.target.value).length == 2)) {\n event.preventDefault();\n }\n}", "function isNumber(evt) {\n\t\t\t\t evt = (evt) ? evt : window.event;\n\t\t\t\t var charCode = (evt.which) ? evt.which : evt.keyCode;\n\t\t\t\t if ( (charCode > 31 && charCode < 48) || charCode > 57) {\n\t\t\t\t return false;\n\t\t\t\t }\n\t\t\t\t return true;\n\t\t\t\t }" ]
[ "0.7542367", "0.748257", "0.7359254", "0.7359254", "0.732935", "0.73116314", "0.7302182", "0.7287616", "0.7269143", "0.7269143", "0.72665465", "0.7264134", "0.72529995", "0.72380006", "0.7234974", "0.7233162", "0.72225624", "0.7216284", "0.71797556", "0.71522415", "0.7141693", "0.71400356", "0.71210635", "0.71030754", "0.7092331", "0.7088098", "0.7072174", "0.70630985", "0.7058107", "0.7054391", "0.70407534", "0.70291734", "0.7024846", "0.7006539", "0.70038545", "0.69881654", "0.69862247", "0.69842416", "0.6984065", "0.69759846", "0.6975316", "0.6949179", "0.694496", "0.69441336", "0.69333065", "0.6928942", "0.69202673", "0.6909405", "0.69078934", "0.69057196", "0.69035125", "0.6895915", "0.6891051", "0.6885202", "0.68829155", "0.6881479", "0.68746597", "0.687413", "0.6861239", "0.6854282", "0.6849698", "0.6849253", "0.6848786", "0.6841849", "0.6836287", "0.6829911", "0.68262106", "0.68257713", "0.6824877", "0.68032944", "0.67985904", "0.6796751", "0.6796751", "0.67957693", "0.6788565", "0.6785916", "0.67858446", "0.6779574", "0.67789906", "0.6776155", "0.6774556", "0.67639613", "0.67616075", "0.6757295", "0.6757166", "0.67557204", "0.6746869", "0.67378354", "0.67363137", "0.6735157", "0.6730912", "0.6725815", "0.67152536", "0.6714841", "0.67142", "0.6712133", "0.67103434", "0.67102164", "0.6698126", "0.6694287" ]
0.6794155
74
go to next input automatically
function autoTab (current, to) { if (current.getAttribute && current.value.length == current.getAttribute("maxlength")) to.focus(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextFormElement() {\n var fields = $('body').find('button,input,textarea,select'),\n index = fields.index($input);\n if (index > -1 && (index + 1) < fields.length) {\n fields.eq(index + 1).focus();\n }\n return false;\n }", "function goNext( event ){\n event.preventDefault();\n go( revOffset - 1 );\n return false;\n }", "function next($event) {\n $event.preventDefault();\n angular.element('#input-1').val('');\n count++;\n if(count === 4){\n $scope.questionLabel= questionData.questionLabel[1].text;\n } else {\n if (count === 8){\n count= 0;\n $scope.questionLabel= questionData.questionLabel[0].text;\n }\n }\n init();\n return false;\n }", "function moveToNextInput(current) {\n var inputs = $(current).parents(\"#annotationFeatureForm\").eq(0).find(\":input\");\n var idx = inputs.index(current);\n if (idx == inputs.length - 1) {\n inputs[idx].blur();\n } else {\n inputs[idx + 1].focus(); // handles submit buttons\n inputs[idx + 1].select();\n }\n }", "function next($event) {\n $event.preventDefault();\n angular.element('#input-1').val('');\n init();\n\n return false;\n }", "focusNextOption() {\n this.focused_option = this.getNextValue(this.focused_option);\n this.behave('focusCurrentOption');\n }", "function nextInput()\r\n{\r\n var res = inputCurrent;\r\n if(res == null)\r\n return null;\r\n inputCurrent = inputCurrent.next;\r\n return res;\r\n}", "focusNextField(id){\n this.inputs[id].focus();\n }", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "function goToNext() {\n var nextId = getNextLocationIndex();\n if (nextId != null) {\n setCurrentLocation(nextId);\n }\n }", "function next() {\n\t\tvar nextStep = steps.next();\n\t\tsetSteps(steps);\n\t\tsetCurrent(nextStep);\n\t}", "function nextQuestion(){\n global_index++;\n askQuestion(global_index);\n uncheck();\n }", "function goto_next_form() {\n context.current++;\n if (context.current >= context.workflow.length) {\n return finish_survey(); //todo: verify that when going Back and clicking Next this doesn't break the flow\n }\n //Store the incremented value of 'current'\n Survana.Storage.Set('current', context.current, function () {\n //load the next form\n window.location.href = context.workflow[context.current];\n }, on_storage_error);\n }", "function goToNextInput(e) {\n var key = e.which;\n var t = $(e.target);\n var type = t.data('type');\n var num = parseInt(t.data('num'));\n var search = \"input[data-type=\" + type + \"][data-num=\" + (num + 1) + \"]\";\n var sib = $(search);\n\n if (type === 'newuniq' && (num === 2 || num === 3)) {\n if (key >= 48 && key <= 57) {\n // Skip numbers\n key == 8;\n }\n\n // Uppercase\n t.val(t.val().toUpperCase());\n }\n\n // Delete\n if (key == 8) {\n if (t.val() !== '') {\n // Clear the current value if present\n t.val('');\n } else {\n // Goto the previous input and clear it\n if (num === 1) {\n if (type === 'zipcode') {\n // Go back to last from previous section\n $('input[data-type=\"newuniq\"]').last().select().focus();\n } else {\n // Can't go back\n }\n } else {\n $('input[data-type=\"' + type + '\"][data-num=\"' + (num - 1) + '\"]').select().focus();\n }\n }\n e.preventDefault();\n return false;\n }\n\n // Let tabs work like normal...\n if (key === 9) {\n return true;\n }\n\n // if it is empty, don't move forward\n if (t.val() === '') {\n e.preventDefault();\n return false;\n }\n\n if ((key >= 48 && key <= 57) || // normal numbers\n (key >= 96 && key <= 105) || // keypad\n (key >= 65 && key <= 90) // ascii chars\n // removed (key >= 97 && key <= 122)\n ) {\n // Find the next input if no siblings\n if (!sib || !sib.length) {\n var tabindex = t.attr('tabindex');\n tabindex++; //increment tabindex\n sib = $('[tabindex=' + tabindex + ']'); //.focus();\n\n // if (type === 'newuniq' && num === 8) {\n // sib = $('input[data-type=\"zipcode\"][data-num=\"1\"]');\n // }\n }\n sib.select().focus();\n } else {\n e.preventDefault();\n return false;\n }\n }", "function nextField(e) {\n\tvar data = JSON.stringify(e.source),\n\t nextField = JSON.parse(data).nextTextBox;\n\tswitch(nextField) {\n\tcase \"txtUserName\":\n\t\t$.txtUserName.focus();\n\t\tbreak;\n\tcase \"txtPassword\":\n\t\t$.txtPassword.focus();\n\t\tbreak;\n\t}\n}", "next() {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);\n }", "function nextEntry() {\n selectEntry(g_cur_entry + 1, true);\n}", "__nextStep() {\n this.openNextStep();\n }", "function goToNextStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId+=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "goToNext () {\n\t\t\tif (this.canGoToNext) {\n\t\t\t\tthis.goTo(this.currentSlide + 1)\n\t\t\t}\n\t\t}", "function focus_inupt(input_idx){\r\n\t\tif($('#steps li input').length != 0){\r\n\t\t\t$('#steps li input').eq(input_idx).focus();\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "goToNextTime () {\n const currentStart = moment(this.startDateInput.value, 'YYYY-MM-DD').startOf('day')\n const currentEnd = moment(this.endDateInput.value, 'YYYY-MM-DD').startOf('day')\n const duration = currentEnd - currentStart\n const daysDuration = moment.duration(duration).asDays() \n const start = currentStart.add(daysDuration + 1, 'days')\n const end = currentEnd.add(daysDuration + 1, 'days')\n this.startDateInput.value = start.format('YYYY-MM-DD')\n this.endDateInput.value = end.format('YYYY-MM-DD')\n this.fetchViaInputs()\n }", "function next() {\n state.index += 1;\n if (state.index >= state.quiz.questions.length) {\n state.stage = stages.FINISHED;\n }\n}", "function next($event) {\n $event.preventDefault();\n init();\n return false;\n }", "function next($event) {\n $event.preventDefault();\n init();\n return false;\n }", "function nextQuestion() {\n if (currentQuestion + 1 < questions.length) {\n setCurrentQuestion(prevCurrent => prevCurrent+1);\n }\n }", "function moveInput(direction) {\n\n if ($('input[name=userId]').val() === '') {\n return;\n }\n\n if (currentInput == null) {\n currentInput = 0;\n } else {\n target = currentInput + direction;\n if (target >= 0 && target < inputs.length) {\n currentInput = target;\n }\n }\n\n $(inputs[currentInput]).focus();\n\n}", "resetOnNextInput() {\n this._reset = true;\n }", "function goNext() {\n \t$('.chat__input__text').off('click', $scope.activeConversation.question.action);\n \t$('.chat__input__icon').off('click', $scope.activeConversation.question.action);\n \tupdateNext();\n }", "function next_step() {\n\t//just to prevent submission\n\tevent.preventDefault();\n\t//true means it comes as next step\n\tpopup(true);\n}", "function focusNext(from) {\n var focusIndex = focusOn('next', from);\n if ( focusIndex != list.indexOf(selected)) {\n\n // Announce focus change\n $scope.$broadcast(EVENT.FOCUS_CHANGED, focusIndex);\n }\n return focusIndex;\n }", "function intGoNext(){\n goNext(0);\n }", "function goToNextQuestion(){\n\n\t// Display question page.\n\tshowSection(questionPage);\n\n\t// Empties out existing answers from previous question.\n\t$( \".answer-choices\" ).empty();\n\n\t// Displays question and possible answers.\n\tdisplayQuestion();\n\n\t// Resets question timer.\n\tresetTimer();\n\n}", "function nextAction() {\n\tinquirer.prompt({\n\t\tmessage: \"What would you like to do next?\",\n\t\ttype: \"list\",\n\t\tname: \"nextAction\",\n\t\tchoices: [\"Add More Items\", \"Remove Items\", \"Alter Item Order Amount\", \"Survey Cart\", \"Checkout\"]\n\t})\n\t\t.then(function (actionAnswer) {\n\t\t\tswitch (actionAnswer.nextAction) {\n\t\t\t\tcase \"Add More Items\":\n\t\t\t\t\t// go to the start function\n\t\t\t\t\tstart();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Remove Items\":\n\t\t\t\t\t// go to the removal function\n\t\t\t\t\tremoveItem();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Checkout\":\n\t\t\t\t\t// go to the checkout tree;\n\t\t\t\t\tverifyCheckout();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Alter Item Order Amount\":\n\t\t\t\t\t// go to the function that alters the shopping cart qty\n\t\t\t\t\talterItem();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Survey Cart\":\n\t\t\t\t\t// look at the cart\n\t\t\t\t\tcheckoutFunction();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: console.log(\"how did you get here?\")\n\t\t\t}\n\t\t})\n}", "function next() {\n if ($scope.options.index < pageCount - 1) {\n $scope.options.index++;\n }\n }", "next() {\n const newIndex = this.index + 1;\n\n if (this.isOutRange(newIndex)) {\n return;\n }\n\n this.doSwitch(newIndex);\n }", "function nextQuestion() {\n // checks to see if there is a next q and a in the quiz\n if (currentQuestion < quiz.length - 1) {\n // increment the question index\n currentQuestion++;\n loadQuestion();\n // displays the new question and answers\n }\n if (currentQuestion >= quiz.length) {\n clearTimeout(count);\n endQuiz();\n };\n }", "function continue_next_question() {\n\t// Pressed continue, now get the next question ready\n\tupdate_progress_section()\n\t//display_format = choose_next_display_format()\n\tdebug(\"The display format has been updated:\")\n\tdebug(display_format)\n\thide_or_show_display_format_titles()\n\thide_or_show_hint_button()\n\tprepare_hint_button()\n\treset_temp_score_array()\n\tquestion = generate_formatted_array(display_format)\n\tshow_question_if_scaffold()\n\tarray_to_hidden_divs('content_area_body', question)\n\tshow_latest_question('content_area_body')\n\tprepare_check_button()\n}", "next() {\n // $(this.parentElement).data(\"obj\").select_fwd();\n $(this.parentElement).data(\"obj\").update_idx(1);\n return false;\n }", "function inputKeyUp(e)\n {\n $(this).change();\n if(e.keyCode == 13) // Return Key\n {\n var newNum = parseInt($(this).data('num')) + 1;\n $('.game-cell-input[data-num=\"' + newNum + '\"]').first().focus();\n }\n }", "function goToNextStep() {\n\tnextSteps();\n\tupdateStepsText();\n\tconsole.log(\"hi\");\n}", "function next() {\n\t\t\treturn go(current+1);\n\t\t}", "function nextQuestion() {\n currentQuestion++;\n \n if (currentQuestion < quiz.length) {\n displayQuestion();\n } else {\n showResult();\n }\n }", "function next() {\n slide(false, true);\n }", "function nextTelNumber() {\r\n\tvar telFragment = document.activeElement.value.length;\r\n\tif (telFragment == 3) {\r\n\t\tdocument.activeElement.nextElementSibling.focus();\r\n\t}\r\n}", "openNextStep() {\n if (this.activeStep._nestedValidate() && this.activeStep.validate()) {\n this.activeStep.saveStep();\n // set the value to and from the the transition effect.\n this.__fromStep = this.activeStep;\n this.__toStep = this.nextStep;\n // toggle the step\n this.activeStep.toggleStep();\n this.removeActiveStep();\n if (this.nextStep !== null) this.nextStep.toggleStep();\n } else {\n this.activeStep.fireInvalidStep();\n }\n }", "function goToNextPage() {\n updateCurrentPage((page) => page + 1);\n }", "function checkNext(e) {\n if (e.keyCode == 13) {\n $('#password').focus();\n }\n}", "function inputFocus(x){\n x.previousElementSibling.focus();\n}", "function goToNextSlide()\n\t{\n\t\tif($currentSlide.next().length)\n\t\t{\n\t\t\tgoToSlide($currentSlide.next());\n\t\t}\n\t}", "nextStep() {\n\n if (this.slides[this.currSlide].steps.length - 1 > this.currStep) {\n\n this.goTo(this.currSlide, this.currStep + 1);\n\n }\n\n }", "function onNext() {\n\n\t\tif (step < 3) {\n\t\t\tdispatch(INCREMENT_STEP());\n\t\t}\n\n\t\t// update button state\n\t\tsetBackButtonDisabled(false);\n\t}", "function findTheNextOne() {\n do {\n var currentelem = allelements[currentelem_index];\n currentelem_index++;\n\n if(currentelem_index>100) {\n break;\n }\n } while(!doesItSpeak(currentelem));\n\n speakMe(currentelem); \n}", "next(){\n let next = this.currentId + 1;\n if(next >= this.list.length){\n next = this.list.length;\n }\n this.goto(next);\n }", "function nextQuestion() {\n const isQuestionOver = (triviaQuestions.length - 1) === currentQuestion;\n if (isQuestionOver) {\n displayResult();\n }else{\n currentQuestion++;\n loadQuestion();\n }\n\n }", "function goToNextSlide()\n {\n if($currentSlide.next().length)\n {\n goToSlide($currentSlide.next());\n }\n }", "function goToNextPage() {\n\t\tif ( canNextPage() ) {\n\t\t\tgoToPage( currentPage() + 1 );\n\t\t}\n\t}", "function nextStep() {\n\n target.hide().addClass(\"done\").removeClass(\"open\").delay(100).show('slide', 200);\n target.find(\"#calculate\").hide();\n target.find(input).attr('contenteditable', 'false');\n targetnext.find(input).attr('contenteditable', 'true');\n targetnext.hide().removeClass(\"done not-started\").addClass(\"open visited\").delay(100).show('fade', 200);\n showNext();\n step.find(\".h3\").removeClass(\"active edit-progress\");\n stnext.find(\".h3\").addClass(\"active\");\n\n\n\n //specific pages\n if (target.hasClass(\"cust-info\")) {\n $(\".taxed\").show();\n }\n if (target.hasClass(\"cust-payment\")) {\n $(\".editable-subscribe\").addClass(\"review\");\n $(\"#step-buy\").show();\n $(\".next\").hide();\n }\n\n\n }", "function nextSlide() {\n var data = 'down';\n console.log(data);\n if (data && keys && keys.includes(data)) {\n try {\n keySender.sendKey(data);\n slide++;\n } catch (error) {\n console.log(error);\n }\n }\n}", "function next() {\n $ctrl.index++;\n\n // Move on if all players have been shown\n if ($ctrl.index === $ctrl.players.length) {\n $state.go('play');\n }\n // Otherwise show next role\n else {\n showRole();\n }\n }", "next() {\n if (this.hasNext()) {\n this.setState({\n offset: Math.max(0, this.state.offset - 1),\n });\n }\n }", "runOneStepForwards() {\n this.stateHistory.nextState();\n }", "function focusNextOption(index, dir) {\n if ((index === 0 && dir < 0) || (index >= options.length - 1 && dir > 0)) {\n // Bail out if going past either end of the list\n return;\n }\n var i = index + dir;\n var elOpt = rootElement.childNodes[1].childNodes[0].childNodes[i];\n // Must delay a frame before focusing\n requestAnimationFrame(function () {\n elOpt.focus();\n });\n }", "next() {\n const { index, showTooltip } = this.state;\n const { steps } = this.props;\n const nextIndex = index + 1;\n\n const shouldDisplay = Boolean(steps[nextIndex]) && showTooltip;\n\n this.logger('joyride:next', ['new index:', nextIndex]);\n this.toggleTooltip(shouldDisplay, nextIndex, 'next');\n }", "moveNext() {\n const nextStep = this.steps[this.currentStep + 1];\n if (!nextStep) {\n this.reset();\n return;\n }\n\n this.overlay.highlight(nextStep);\n this.currentStep += 1;\n }", "function updateCurrentNextToGoCandidate(item) {\n item.nextToGo = true;\n}", "function _nextQuestion() {\n var nextQuestion = vm.questionSelected.Id;\n nextQuestion++;\n console.log(nextQuestion);\n // run function to get question \n _getQuestion(nextQuestion);\n }", "function moveToNext(isAuto) {\n if (isAuto && !auto) return;\n currentItem = (currentItem + 1) % slideNum;\n\n slideDisplay();\n}", "next() {\n this.selectNonDisabled(this.activeTabIndex, 1);\n }", "function nextQuestion() {\n resetState();\n showQuestion();\n}", "function change () {\n setAnswer(this.value)\n // If the appearance is 'quick', then also progress to the next field\n if (fieldProperties.APPEARANCE.includes('quick') === true) {\n goToNextField()\n }\n}", "function gotoNext() {\n\tif(typeof nextInventory !== 'undefined') {\n\t\tpreviousInventory = currentInventory;\n\t\tcurrentInventory = nextInventory;\n\t\tnextInventory = undefined;\n\t}\n}", "selectNextResult() {\n this.selectedResultIndex += 1;\n // Wrap around as needed\n if (this.selectedResultIndex === this.results.length) {\n this.selectedResultIndex = 0;\n }\n }", "function prepareForNextContainer(){\r\n $containerNumber.val('');\r\n $containerNumber.focus();\r\n }", "function next(){\n\n // if in the last page, then go to the new page needs http request\n if(scope.model.currentIndex === (scope.model.results.length - 1))\n {\n angular.element('button.searchbtnbox').toggleClass('changed');\n angular.element('div.section-refresh-overlay').css('visibility','visible');\n var promise = scope.model.next();\n promise.then(function(response){\n\n scope.model.currentStart += scope.model.results[scope.model.currentIndex - 1].length;\n angular.element('button.searchbtnbox').toggleClass('changed');\n angular.element('div.section-refresh-overlay').css('visibility','hidden');\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n\n },function(error){\n console.log(error);\n });\n }\n else {\n scope.model.currentIndex++;\n scope.model.data = scope.model.results[scope.model.currentIndex];\n scope.model.currentStart += scope.model.results[scope.model.currentIndex - 1].length;\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n }\n }", "function nextItem() {\n\t\tstopSlideshow();\n\t\tchangeItem(current + 1);\n\t}", "gotoNextHit() {\n let me = this,\n grid = me.grid,\n // start from focused cell, or if focus has left grid use lastFocusedCell\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n nextHit = me.found.find((hit) => hit.index > currentIndex);\n\n if (nextHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: nextHit.id\n });\n } else {\n me.gotoFirstHit();\n }\n }", "searchNext(){\n this.searchIndex++;\n this.searchMovie();\n this.$nextTick(function(){\n scrollLeft(\"search_display\");\n });\n }", "function onKeyDown() {\n ctrl.selectedIndex = (ctrl.selectedIndex + 1) % ctrl.items.length;\n updateView();\n }", "function nextQuestion() {\n showQuestion();\n //*********************************** */\n // this logic is implemented because unable to check whether event listener for first round exists with button\n if (startButton.textContent !== \"Retake Quiz\") {\n addEventListenerToButtons(questionIndex);\n }\n //*********************************** */\n}", "function doFocusNext(field,form,iteration) {\r\n\tif (!isNumeric(iteration)) iteration = 1;\r\n\tvar nexttabindex = $('form#'+form+' input[name=\"'+field+'\"]').attr('tabindex') + iteration;\r\n\tvar nextfield = $('form#'+form+' input[tabindex=\"'+nexttabindex+'\"]:enabled:visible:first, form#'+form+' select[tabindex=\"'+nexttabindex+'\"], form#'+form+' textarea[tabindex=\"'+nexttabindex+'\"]');\r\n\tvar nextradiofield = $('form#'+form+' input[name=\"'+nextfield.attr('name')+'___radio\"]:enabled:visible:first');\r\n\tif (nextradiofield.length && (nextradiofield.css('visibility') == 'visible' || nextradiofield.css('visibility') == 'inherit')) {\r\n\t\t// Next input is a radio, so put focus on it\r\n\t\tnextradiofield.trigger('focus');\r\n\t} else if (nextfield.length && (nextfield.css('visibility') == 'visible' || nextfield.css('visibility') == 'inherit')\r\n\t\t&& !nextfield.prop('readonly')) {\r\n\t\t// Put focus on next input, select, or textarea\r\n\t\tnextfield.trigger('focus');\r\n\t} else if (iteration <= 20) {\r\n\t\t// Don't do more than 20 recursions if field not found\r\n\t\tdoFocusNext(field,form,iteration+1);\r\n\t} else {\r\n\t\t// Give up! Couldn't find the next field.\r\n\t}\r\n}", "function waitBeforeGoingNextAutomatically() {\n setTimeout(goToNextQuestion, 1000 * 5);\n}", "Next() {\n if (this.CanNext()) {\n this.Position = this.fPosition + 1;\n }\n }", "function people_increment() {\n document.getElementById(\"people-input\").stepUp();\n amount_handler();\n}", "nextItem() {\n\t\tif (this.cursor < this.menuData.length - 1) {\n\t\t\tthis.cursor++;\n\t\t}\n\n\t\tthis.menuData[this.cursor].focus();\n\t}", "_nextButtonClickHandler() {\n const that = this;\n\n that.next();\n }", "function nextQuestion(){\n\t\t$(\"#question\").show();\n\t\t$(\".choice\").show();\n\t\t$(\"#solutionDiv\").hide();\n\t\tstopwatch.reset();\n\t\tquizGo(i++);\n\t}", "function focusNextField( obj )\r\n{\r\n for( var i = 0; i < obj.form.elements.length; i++ )\r\n {\r\n if( obj.form.elements[ i ].name == obj.name )\r\n {\r\n if( obj.form.elements[ i + 1 ] )\r\n {\r\n obj.form.elements[ i ].blur( );\r\n obj.form.elements[ i + 1 ].focus( );\r\n }\r\n\r\n break;\r\n }\r\n }\r\n\r\n return false;\r\n}", "_setEvent_next(){\n $(this._controlSelectors.next).click(()=>{\n this.next();\n });\n }", "function nextQuestion() {\r\n if (STORE.questionNumber < STORE.questions.length - 1) {\r\n STORE.submittedAnswer = false;\r\n STORE.view = 'question';\r\n STORE.questionNumber++;\r\n }\r\n else {\r\n STORE.view = 'score';\r\n finalScore();\r\n }\r\n}", "function next(){\n player2=new user(document.user2.name.value);\n player2.setGrid();\n fadeForm(\"user2\");\n showForm(\"boats\");\n turnInfo(player2.name);\n \n turn++;\n unlockMap(turn);\n bindGrid(turn);\n}", "function nextQuestion() {\n // Clear the timeout that was set by displayAnswer. Clear the interval as well just in case.\n clearTimeout(game.timeoutID);\n clearInterval(game.intervalId);\n // Go to the next question\n game.questionIndex++;\n // If we're on the last question, the game is over. \n if (game.questionIndex >= questions.length) {\n endGame();\n } else { // Otherwise display the next question\n displayQuestion();\n }\n}", "function Next(i) {\n var active_number = $('#nomor_soal').val();\n var next = (active_number*1)+(1*1);\n if(active_number!=i){\n $('.soal > .data').hide();\n $('#Soal_'+next).show();\n $('.tombol > a').removeClass(' in-active');\n $('#daftar'+next).addClass(' in-active');\n $('#nomor_soal').val(next);\n }\n}", "function setNextQuestion() {\n resetQuestion();\n showQuestion(shuffleQuestions[currentQuestionIndex]);\n}", "function next() {\n setCurrentPage((currentPage) => Math.min(currentPage + 1, maxPage));\n }", "function nextEdit() {\n var path = '/summaryMSA-IRS',\n currentIdx = $scope.siblingEdits.indexOf(editId);\n if (currentIdx !== ($scope.siblingEdits.length - 1)) {\n path = '/detail/' + editType + '/' + $scope.siblingEdits[currentIdx + 1];\n }\n $location.path(path);\n }", "function next(){\n\tpdx = idx;\n\tidx++;\n\tif(idx >= 4){\n\t\tidx = 0;\n\t}\n\tchangeSlide();\n}", "gotoNextHit() {\n let me = this,\n grid = me.grid,\n // start from focused cell, or if focus has left grid use lastFocusedCell\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n nextHit = me.found.find(hit => hit.index > currentIndex);\n\n if (nextHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: nextHit.id\n });\n } else {\n me.gotoFirstHit();\n }\n }", "next() {\n\n if (this.currStep < this.slides[this.currSlide].steps.length - 1) {\n\n this.nextStep();\n\n } else {\n\n this.nextSlide();\n\n }\n\n }", "function navigate() {\n // Advance to next question by increasing the questionIndex value\n questionIndex++;\n // Verify condition of next question and\n if (questionIndex !== questionArray.length) {\n game();\n } else {\n endGame();\n }\n}", "function nextQuestion(){\t\n\t\thideAnswerBox();\n\t\tremovePosters();\n\t\tstopAudio();\n\t\tquestionCount++;\n\t\t\n\t\tif (questionCount > 9) {\n\t\t\tendGame();\n\t\t\tshowOverlay($('.endGame'));\n\t\t}\n\t\telse if (questionCount > 4 && gameCount < 1) {\n\t\t\tendRound();\n\t\t\tshowOverlay($('.end_round'));\n\t\t}\n\t\telse {\n\t\t\tupdateQuestion();\n\t\t\tplayAudio();\n\t\t}\n\t}" ]
[ "0.7158232", "0.6924998", "0.6916781", "0.6840955", "0.67943424", "0.6739984", "0.6660193", "0.66356444", "0.6630864", "0.65571374", "0.6490272", "0.64664644", "0.6455121", "0.6360299", "0.6325571", "0.63036615", "0.6299922", "0.62558025", "0.6210101", "0.62033707", "0.6191877", "0.6159582", "0.61240715", "0.61231685", "0.61231685", "0.61221504", "0.6077495", "0.6070029", "0.60671896", "0.6046653", "0.604542", "0.6036621", "0.6035948", "0.60239184", "0.6019277", "0.60097784", "0.60082054", "0.599386", "0.59802556", "0.59709245", "0.5967876", "0.59639835", "0.59522504", "0.59485185", "0.5947684", "0.5947573", "0.59315974", "0.59298086", "0.5924556", "0.59230316", "0.5890525", "0.5888075", "0.5884911", "0.58802044", "0.58771527", "0.58735704", "0.5869301", "0.58676124", "0.5864542", "0.5862821", "0.58611274", "0.5859706", "0.5854544", "0.5852963", "0.58514935", "0.5849094", "0.5842764", "0.5841439", "0.58300495", "0.5826124", "0.58043003", "0.5798714", "0.57968956", "0.5796", "0.578769", "0.57836986", "0.5777944", "0.5776322", "0.57762265", "0.5774871", "0.57661957", "0.5766177", "0.5765469", "0.576334", "0.5756179", "0.5748365", "0.57468605", "0.57439137", "0.5742873", "0.5742787", "0.5738631", "0.5735442", "0.5732493", "0.5730687", "0.572288", "0.571513", "0.5713211", "0.5712909", "0.5709268", "0.57083255", "0.5704875" ]
0.0
-1
get CEP from input
function getCep() { let cep = ""; for (let i=1; i<=8; i++) cep += document.getElementById(`cep-input${i}`).value; return cep; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CPF(CPF) {\n const result = formatCPF(CPF);\n if (result === '') {\n errors.invalidCPF(CPF);\n }\n\n return result;\n}", "function enq_get_pc(){\r\n\treturn enq_rc('enqp');\r\n}", "function Pc() {\n this.make = \"Dell\",\n this.model = \"Latitude 7640\"\n}", "Ec(){\r\n return 57*Math.pow(this.fc,0.5)\r\n }", "function input () {\n alpha01 = inputNumber(ip1,1,true,-10,10)*DEG; // Anfangsposition von Pendel 1 (Bogenmaß)\n alpha02 = inputNumber(ip2,1,true,-10,10)*DEG; // Anfangsposition von Pendel 2 (Bogenmaß)\n }", "function ReadC() {\r\n}", "function checa_cpf(CPF) {\r\n\tvar mensagem = \"informe corretamente o número do CPF\"\r\n\tvar msg = \"\";\r\n\tif (CPF.length != 11 || CPF == \"00000000000\" || CPF == \"11111111111\" || CPF == \"22222222222\" || CPF == \"33333333333\" || CPF == \"44444444444\" || CPF == \"55555555555\" || CPF == \"66666666666\" || CPF == \"77777777777\" || CPF == \"88888888888\" || CPF == \"99999999999\") msg = mensagem;\r\n\tsoma = 0;\r\n\tfor (y = 0; y < 9; y++)\r\n\tsoma += parseInt(CPF.charAt(y)) * (10 - y);\r\n\tresto = 11 - (soma % 11);\r\n\tif (resto == 10 || resto == 11) resto = 0;\r\n\tif (resto != parseInt(CPF.charAt(9))) msg = mensagem;\r\n\tsoma = 0;\r\n\tfor (y = 0; y < 10; y++)\r\n\tsoma += parseInt(CPF.charAt(y)) * (11 - y);\r\n\tresto = 11 - (soma % 11);\r\n\tif (resto == 10 || resto == 11) resto = 0;\r\n\tif (resto != parseInt(CPF.charAt(10))) msg = mensagem;\r\n\treturn msg;\r\n}", "function getCHP () {\n if (chp == \"-\") {\n return \" \";\n } else {\n return '</p><p><span class=\"label-title\">Combined heat and power? </span>' + chp;\n }\n }", "function getInput() {\n\tinTemp = Number(input.value);\n\tcelsCheck = celsRadio.checked;\n\tif (celsCheck) {\n\t\toutScale = 'C';\n\t} else {\n\t\toutScale = 'F';\n\t}\n}", "function getC(name,un_name) //get capcitor value in F, (name, name-unit)\n{\n\tvar x=getVar(name);\n\tvar unit=getVtext(un_name);\n\tif(\"pF\"==unit) return x/=1e12;\n\tif(\"nF\"==unit) return x/=1e9;\n\tif(\"uF\"==unit) return x/=1e6;\n\treturn x;\n}", "function getPolishForm(c) {\n if (c === 1) {\n return 0;\n } else if (Math.floor(c) !== c) {\n return 1;\n } else if (2 <= c % 10 && c % 10 <= 4 && !(10 < c % 100 && c % 100 < 20)) {\n return 2;\n } else {\n return 3;\n }\n }", "function CEPNumbers3(str)\n {\n return str.toString().replace(/\\D/g, '').substr(0,8);\n }", "cpfIBytes(c) {\n var hex = c.charCodeAt(0);\n if (hex < 0x20 || hex > 0x2F) {\n this.charProcFunc = this.cpfDefault;\n }\n }", "function peek() {\n return input.charAt(pos);\n }", "function peek() {\n return input.charAt(pos);\n }", "function getPolishForm(c) {\n if (c === 1) {\n return 0;\n } else if (Math.floor(c) !== c) {\n return 1;\n } else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) {\n return 2;\n } else {\n return 3;\n }\n }", "get protocolInput() {\n return this._protocol;\n }", "function CPForCNPJ(CPForCNPJ) {\n const result = formatCPForCNPJ(CPForCNPJ);\n if (result === '') {\n errors.invalidCPForCNPJ(CPForCNPJ);\n }\n\n return result;\n}", "function getPolishForm (c) {\n if (c === 1) {\n return 0\n } else if (Math.floor(c) !== c) {\n return 1\n } else if (c % 10 >= 2 && c % 10 <= 4 && !(c % 100 > 10 && c % 100 < 20)) {\n return 2\n } else {\n return 3\n }\n }", "peek() {\n return this.input.charAt(this.pos);\n }", "function checa_cnpj(s) {\r\n\tvar mensagem = \"informe corretamente o número do CNPJ\"\r\n\tvar msg = \"\";\r\n\tvar y;\r\n\tvar c = s.substr(0, 12);\r\n\tvar dv = s.substr(12, 2);\r\n\tvar d1 = 0;\r\n\tfor (y = 0; y < 12; y++) {\r\n\t\td1 += c.charAt(11 - y) * (2 + (y % 8));\r\n\t}\r\n\tif (d1 == 0) msg = mensagem;\r\n\td1 = 11 - (d1 % 11);\r\n\tif (d1 > 9) d1 = 0;\r\n\tif (dv.charAt(0) != d1) msg = mensagem;\r\n\td1 *= 2;\r\n\tfor (y = 0; y < 12; y++) {\r\n\t\td1 += c.charAt(11 - y) * (2 + ((y + 1) % 8));\r\n\t}\r\n\td1 = 11 - (d1 % 11);\r\n\tif (d1 > 9) d1 = 0;\r\n\tif (dv.charAt(1) != d1) msg = mensagem;\r\n\treturn msg;\r\n}", "Ec(){\n return 1.35*Math.pow(145,1.5)*Math.pow(this.Fc,0.5)\n }", "get composing() {\n return this.input.composing;\n }", "compute(input) {\n if (typeof input !== \"string\" || input === \"\")\n return null;\n\n if (!this.patt_a.test(input))\n return undefined;\n\n if (!this.cs) input = input.toUpperCase();\n let appLen = input.length;\n let chkLen = 1 + this.dblchk;\n let wLen = this.w.length;\n let S = 0;\n let i = appLen;\n while (i > 0) {\n let a = this.acsEnum[input.charAt(i - 1)];\n if (wLen + i > appLen + chkLen) //if character position is within preset weight array, then use preset\n S += a * this.w[appLen + chkLen - i];\n else //if character position is beyond preset weight array, then calculate its weight\n S += a * Math.pow(this.r, appLen + chkLen - i);\n i--;\n }\n\n if (this.dblchk) {\n let V = this.M + this.R - S % this.M;\n let quotient = ~~(V / this.r);\n let remainder = V - quotient * this.r;\n return this.ccs.charAt(quotient) + this.ccs.charAt(remainder);\n } else {\n return this.ccs.charAt((this.M + this.R - S % this.M) % this.M);\n }\n }", "function input () {\n ny = inputNumber(ipNy,3,false,0.1,100); // Frequenz (Hz)\n u0 = inputNumber(ipU0,3,false,0.1,100); // Maximale Spannung (V)\n if (dPhi == 0) r = inputNumber(ipRCL,3,false,10,1000); // Falls Widerstand, Eingabe in Ohm\n else if (dPhi > 0) // Falls Kondensator ...\n c = 1e-6*inputNumber(ipRCL,3,false,1,100); // ... Eingabe der Kapazität in Mikrofarad, Umrechnung in Farad\n else l = inputNumber(ipRCL,3,false,10,1000); // Falls Spule, Eingabe der Induktivität in Henry \n } // ---!", "readCodePoint() {\n let ch = this.input.charCodeAt(this.state.pos);\n let code;\n\n if (ch === 123) {\n let codePos = ++this.state.pos;\n code = this.readHexChar(this.input.indexOf('}', this.state.pos) - this.state.pos);\n ++this.state.pos;\n if (code > 0x10FFFF) this.raise(codePos, \"Code point out of bounds\");\n } else {\n code = this.readHexChar(4);\n }\n return code;\n }", "rawC () {\n return parseInt(this.C, 16);\n }", "function inferCubicControlPoint(p0, p2, p3) {\n // Extend p1 away from p0 by 50%. This is the equivalent quadratic point that\n // would give the same slope as catmull rom at p0.\n var p2e0 = -0.5 * p3[0] + 1.5 * p2[0];\n var p2e1 = -0.5 * p3[1] + 1.5 * p2[1];\n\n return [\n (2 * p2e0 + p0[0]) / 3,\n (2 * p2e1 + p0[1]) / 3,\n ];\n}", "get certificateInput() {\n return this._certificate;\n }", "function input() {\n const inp = ifmt.selectedOptions[0].label\n const txt = itxt.value\n switch (inp) {\n case 'JSON':\n return cbor.encodeOne(JSON.parse(txt), {canonical: true})\n case 'hex':\n case 'base64':\n return Buffer.from(txt, inp)\n default:\n throw new Error(`Unknown input: \"${inp}\"`)\n }\n}", "function search_cep(value){\n\t//New var only digits\n\tvar cep = value.replace(/\\D/g, '');\n\t//Verifies if the cep have anything\n\tif(cep!=\"\")\n\t{\n\t\t// regular expression for validate CEP\n\t\tvar validacep = /^[0-9]{8}$/;\n\t\tif(validacep.test(cep)){\n\t\t\t//FILL IT ELEMENTS WHILE YOU CONSULT THE WEB SERVICE\n\t\t\tdocument.getElementById(\"rua\").value=\"...\";\n\t\t\tdocument.getElementById(\"bairro\").value=\"...\";\n\t\t\tdocument.getElementById(\"cidade\").value=\"...\";\n\t\t\t//CREATE A ELEMENT AND SYNC ViaCEP WITH THE CALLBACK \n\t\t\tvar script = document.createElement(\"script\");\n\t\t\tscript.src= \"https://viacep.com.br/ws/\"+cep+\"/json/?callback=my_callback\";\n\t\t\tdocument.body.appendChild(script);\n\t\t}else{\n\t\t\t//INVALID CEP\n\t\t\tclear_data();\n\t\t\t\n\t\t}\n\t}else{\n\t\thabilitar('cepI');\n\t}\n}", "function cc_change() {\r\n if(ci.value.length >0) {\r\n\tif(ci.value[0] == '.') {\r\n\t getASIN(decodePart(ci.value.split('.')[3]),decodePart(ci.value.split('.')[2]));\r\n\t} else {\r\n\t getASIN(ci.value,'UPC');\r\n\t}\r\n }\r\n}", "function search_cep(value){\n\t//New var only digits\n\tvar cep = value.replace(/\\D/g, '');\n\t//Verifies if the cep have anything\n\tif(cep!=\"\")\n\t{\n\t\t// regular expression for validate CEP\n\t\tvar validacep = /^[0-9]{8}$/;\n\t\tif(validacep.test(cep)){\n\t\t\t//FILL IT ELEMENTS WHILE YOU CONSULT THE WEB SERVICE\n\t\t\tdocument.getElementById(\"rua\").value=\"...\";\n\t\t\tdocument.getElementById(\"bairro\").value=\"...\";\n\t\t\tdocument.getElementById(\"cidade\").value=\"...\";\n\t\t\t//CREATE A ELEMENT AND SYNC ViaCEP WITH THE CALLBACK \n\t\t\tvar script = document.createElement(\"script\");\n\t\t\tscript.src= \"https://viacep.com.br/ws/\"+cep+\"/json/?callback=my_callback\";\n\t\t\tdocument.body.appendChild(script);\n\t\t\t\n\t\t}else{\n\t\t\t//INVALID CEP\n\t\t\t\n\t\t\t\n\t\t\tclear_data();\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n}", "function validCepFormat ( value ) {\n var out = false;\n var reRawCepFormat = /^[0-9]{8}$/;\n var reCompCepFormat = /^[0-9]{5}\\-[0-9]{3}$/; \n\n if ( \n value && ( \n reRawCepFormat.test( value ) || ( \n reCompCepFormat.test( value ) \n )\n ) \n ) out = true;\n\n return out;\n}", "function GetCelebrityRecognitionCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "function GetEPS() {\n var inpv = parseFloat(document.getElementById('power').value);\n if(inpv <= 0) {\n inpv = 1\n document.getElementById('power').value = '1'\n }\n if(powerUnit == 'Power')\n return inpv / (Ebeam * 1.602e-10);\n else\n return inpv * 1.e-3 / 1.602e-19;\n}", "function getChar(c) {\n let char = String.fromCharCode(c);\n // console.log(char);\n return char\n}", "cpfEscape(c) {\n var hex = c.charCodeAt(0);\n\n // delegate control to another character processing function depending\n // on the character received\n if (hex >= 0x40 && hex <= 0x5F) { // type Fe escape codes\n switch (hex) {\n case 0x5B: // csi detected\n this.charProcFunc = this.cpfCSI;\n break;\n \n case 0x4D: // reverse line feed\n this.outputRLF();\n this.charProcFunc = this.cpfDefault;\n break;\n\n /* string initiators */\n case 0x50: // device control string\n case 0x5D: // os command\n case 0x58: // start of string\n case 0x5E: // privacy message\n case 0x5F: // application program command\n this.charProcFunc = this.cpfString;\n break;\n default:\n this.charProcFunc = this.cpfDefault;\n console.log(\"Unhandled C1 Control Code\", hex)\n }\n }\n else if (hex >= 0x20 && hex <= 0x2F) { // any escape code with I bytes\n this.charProcFunc = this.cpfIBytes;\n }\n else { // other escape codes; not parsed of handled\n this.charProcFunc = this.cpfDefault;\n console.log(\"Unhandled Escape Code\", hex)\n }\n }", "function getComputerChoice() {\r\n\t\tconst choices = [\"p\", \"f\", \"c\"];\r\n\t\tconst randomNumber = Math.floor(Math.random() * choices.length);\r\n\t\treturn choices[randomNumber];\r\n\t}", "function FPC() {\nvar F = parseInt(prompt(\"digite a temperatura em fahrenheit para celsius\"))\n\nvar C = (F - 32) * 5/9\n\nalert(\"a temperatura em é \"+ C +\" graus Celsius\") \n\nconsole.log(\"Fahrenheit \" + F,\"celsius \"+C)\n}", "get portInput() {\n return this._port;\n }", "get portInput() {\n return this._port;\n }", "function printEPCL() {\n\t\tif (notReady()) { return; }\n\t\t\n\t\tappendEPCL('+RIB 4'); // Monochrome ribbon\n\t\tappendEPCL('F'); // Clear monochrome print buffer\n\t\tappendEPCL('+C 8'); // Adjust monichrome intensity\n\t\tappendEPCL('&R'); // Reset magnetic encoder\n\t\tappendEPCL('&CDEW 0 0'); // Set R/W encoder to ISO default\n\t\tappendEPCL('&CDER 0 0'); // Set R/W encoder to ISO default\n\t\tappendEPCL('&SVM 0'); // Disable magnetic encoding verifications\n\t\tappendEPCL('T 80 600 0 1 0 45 1 QZ INDUSTRIES');\t// Write text buffer\n\t\tappendEPCL('&B 1 123456^INDUSTRIES/QZ^789012');\t// Write mag strip buffer\n\t\tappendEPCL('&E*'); // Encode magnetic data\n\t\tappendEPCL('I 10'); // Print card (10 returns to print ready pos.)\n\t\tappendEPCL('MO'); // Move card to output hopper\n\t\t\n\t\tqz.printToFile(\"C:\\\\Users\\\\Tres\\\\Desktop\\\\EPCL_Proper.txt\");\n\t\t//qz.print();\n\t}", "get cockpit() {\n\t\treturn this.tool.cockpit\n\t}", "function MascaraCep(cep) {\n if (mascaraInteiro(cep) === false) {\n event.returnValue = false;\n }\n return formataCampo(cep, '00.000-000', event);\n}", "getArgITC(argName) {\n const tc = this.getArgTC(argName);\n\n if (!(tc instanceof InputTypeComposer)) {\n throw new Error(`Resolver(${this.name}).getArgITC('${argName}') must be InputTypeComposer, but recieved ${tc.constructor.name}. Maybe you need to use 'getArgTC()' method which returns any type composer?`);\n }\n\n return tc;\n }", "function getCommandInput() {\n prompt.get(['command'], function (err, input) {\n if (err) {\n console.log(err);\n return 1;\n }\n\n console.log();\n processCmd(input.command);\n });\n }", "c() {\n if (this._c === undefined) {\n this._c = (this.eof ? \"\" : this._chars[this._pointer]);\n }\n return this._c;\n }", "function getCharCode(e) {\n return (typeof e.which === \"number\") ? e.which : e.keyCode;\n }", "get epfd() : number {\n return this._bitField.getInt(249,4,true);\n }", "function MascaraCep(cep){\n\t\tif(mascaraInteiro(cep)==false){\n\t\tevent.returnValue = false;\n\t}\t\n\treturn formataCampo(cep, '00.000-000', event);\n}", "function inPrec(input) \n { \n switch (input) { \n case '+': \n case '-': \n return 2; \n case '*': \n case '%': \n case '/': \n return 4; \n case '(': \n return 0; \n } \n }", "constructor (cf, voice, mode) {\n this.cf = cf\n if (voice != ABOVE && voice != BELOW) {\n throw `Counterpoint voice argument must be ABOVE ${ABOVE} or BELOW ${BELOW}, got ${voice}`\n }\n this.voice = voice\n this.mode = mode\n this.length = cf.length\n this.ult = this.length - 1\n this.penult = this.length - 2\n this.cp = new Array(this.length) // [None for _ in range(this.length)] // was (None,None)\n this.cp.fill(null)\n\n // the first note to compose is the penult\n // M6 if cf is the voice above, m3 if below\n\n this.index = 0 // was this.penult\n this.count_perfect = 0\n this.count_imperfect = 0\n }", "function sc_cadr(p) { return p.cdr.car; }", "function CEP(application)\n{\n EventEmitter.call(this);\n\n Object.defineProperties(this, {\n\n application: { value: application, enumerable: true },\n\n logger: { value: application.logManager.createLogger('CEP', LogLevels.DEBUG), enumerable: true },\n\n });\n\n // We use an event for extension unloading\n this.cep.util.registerExtensionUnloadCallback(function ()\n {\n this.emit('unload');\n\n }.bind(this));\n\n this.cep.util._registerExtensionUnloadCallback = this.cep.util.registerExtensionUnloadCallback;\n this.cep.util.registerExtensionUnloadCallback = function ()\n {\n this.logger.warn('Please use the \"unload\" event, fired by \"Core.application.cep\" instead of calling \"registerExtensionUnloadCallback\" directly.');\n\n }.bind(this);\n}", "function outPrec(input) \n { \n switch (input) { \n case '+': \n case '-': \n return 1; \n case '*': \n case '%': \n case '/': \n return 3; \n case '(': \n return 100; \n } \n }", "function getExpression(callback) {\n rl.question('Enter an expression: ', (answer) => {\n callback(answer);\n });\n}", "getOtp() {\n\n let otp = \"\";\n let elements = this.getInputElements();\n for(let i = 0; i < elements.length; i++) {\n otp += elements[i].value;\n }\n\n return otp;\n }", "function ce(t, e) {\n return st(e) ? ae(e) : ue(t, e);\n}", "function valCPF(e,campo){\n \n var tecla=(window.event)?event.keyCode:e.which;\n if((tecla > 47 && tecla < 58 )){\n mascara(campo, '###.###.###-##');\n return true;\n }\n else{\n if (tecla != 8 ) return false;\n else return true;\n }\n}", "get input() {\n\t\treturn this.__input;\n\t}", "function readc() {\r\n const vm = this;\r\n readline(function (line) {\r\n if (!line[0]) throw \"I/O Error: expecting a character.\";\r\n\r\n vm.stack.push(line.charCodeAt(0));\r\n interpret.call(vm);\r\n });\r\n vm.pc++;\r\n}", "function ECB(input, output) {\n var outputBuffer;\n if (encrypt) {\n outputBuffer = algo.Encrypt(algo.Key, input, System.Security.Cryptography.CipherMode.ECB);\n //var outputBuffer = input;\n System.Buffer.BlockCopy(outputBuffer, 0, output, 0, blockSizeByte);\n } else {\n outputBuffer = algo.Decrypt(algo.Key, input, System.Security.Cryptography.CipherMode.ECB);\n System.Buffer.BlockCopy(outputBuffer, 0, output, 0, blockSizeByte);\n }\n //Trace.Write(\"call ECB(input[\"+input.length+\"] = \"+System.BitConverter.ToString(input)+\", output[\"+output.length+\"] = \"+System.BitConverter.ToString(output)+\")\");\n }", "peek(): string {\n return this.input[this.position];\n }", "get Mode7point1() {}", "function sc_currentInputPort() {\n return SC_DEFAULT_IN;\n}", "nextChar(input, index) {\n const node = this.selectNode\n if (this.diff(node) >= this.activePoint.length) {\n return input[this.activePoint.node.children[input[this.activePoint.edge]].startIndex + this.activePoint.length]\n }\n if (this.diff(node) + 1 == this.activePoint.length) {\n if (node.children[input[index]] != null) {\n return input[index]\n }\n } else {\n this.activePoint.node = node\n this.activePoint.length = this.activePoint.length - this.diff(node) - 1\n this.activePoint.edge = this.activePoint.edge + this.diff(node) + 1\n return this.nextChar(input, index)\n }\n throw new EndOfPathException('End of Path Occured.')\n }", "getInput() {\n return this.input;\n }", "function MascaraCep(cep) {\n if (mascaraInteiro(cep) == false) {\n event.returnValue = false;\n }\n return formataCampo(cep, '00000-000', event);\n}", "function getInputVelocity() {\n\treturn document.getElementById('inputVelocity').value;\n}", "function getComputer(intcodeProg) {\n const engine = createIntCodeComputerV3(intcodeProg);\n return {\n reset: () => engine.reset(),\n run: (initInput) => {\n let completed = false;\n let output;\n let loops = 0;\n while (!completed && loops < 20) {\n const result = engine.runSegment(loops === 0 ? initInput : [])\n completed = result.isCompleted;\n output = result.output;\n loops++\n }\n return output;\n }\n }\n}", "current() { return this.valid(this.pos)?this.input.charAt(this.pos):Source.EOI }", "function convertToEpic(input) {\n\tswitch (input) {\n\t\tcase 0:\n\t\toutput = 0;\n\t\tbreak;\n\t\tcase 1:\n\t\toutput = 1;\n\t\tbreak;\n\t\tcase 2:\n\t\toutput = 2;\n\t\tbreak;\n\t\tcase 3:\n\t\toutput = 4;\n\t\tbreak;\n\t\tcase 4:\n\t\toutput = 7;\n\t\tbreak;\n\t\tcase 5:\n\t\toutput = 11;\n\t\tbreak;\n\t\tcase 6:\n\t\toutput = 16;\n\t\tbreak;\n\t\tcase 7:\n\t\toutput = 22;\n\t\tbreak;\n\t\tcase 8:\n\t\toutput = 29;\n\t\tbreak;\n\t\tcase 9:\n\t\toutput = 37;\n\t\tbreak;\n\t\tcase 10:\n\t\toutput = 46;\n\t\tbreak;\n\t}\n\treturn output;\n}", "function custGetMode(inputmode) {\n var mode = 'SPCH';\n if(inputmode == 'dtmf') {\n mode = 'DTMF';\n }\n return mode;\n}", "get BC7() {}", "function decode_digit(cp) {\n\t\treturn cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base;\n\t}", "function sc_caadr(p) { return p.cdr.car.car; }", "function onlyDecimalCP(e){ \n// note: backspace = 8, enter = 13, '0' = 48, '9' = 57 \n\tif(!e) e = window.event;\n\tvar key; key = !e.keyCode ? e.which : e.keyCode;\n\tvar punto = 0;\n\tvar decimals = 0;\n\tvar _this;\n\tif (e.target) _this = e.target;\n\telse if (e.srcElement) _this = e.srcElement;\n\tif (_this.nodeType == 3) // defeat Safari bug\n\t _this = targ.parentNode;\n\n\tif ((key >= 48 && key <= 57) || key == 45 || key == 46 || keySpecial(key)) {\n\t __hiddenInfo(e);\n\t if (key == 46) {\n cadena = _this.value\n\t if (cadena.indexOf(\".\") != -1) {\n\t punto = 1;\n\t }\n\t punto++;\n\t if (punto > 1) { stopEvent(e); cancelEvent(e); __showInfo(e, 3); }\n\t } else {\n try{\n //cadena = _this.value.substring(0, _this.selectionStart);\n cadena = _this.value.substring(0, getCaret(_this));\n }catch(e){\n cadena = _this.value;\n }\n if (cadena.indexOf(\".\") != -1) {\n //decimals = cadena.substring(cadena.indexOf(\".\")).length;\n decimals = _this.value.substring(_this.value.indexOf(\".\")).length;\n }\n if (decimals > 2) { stopEvent(e); cancelEvent(e); __showInfo(e, 3); }\n\t\t}\n\t}\n\telse { stopEvent(e); cancelEvent(e); __showInfo(e, 3); }\n}", "function readInp(){\n\tvar inp = document.getElementById(\"cfg\").value;\n\tvar without = interpret(inp);\n\tvar SymSet = new SymbolSet(without);\n\tvar startSym = SymSet.findSym(\"S\");\n\tvar sentence = SymSet.writeSymbol(startSym);\n\t//console.log(sentence);\n\tdocument.getElementById(\"output\").innerHTML += \"<li>\" + sentence + \"</li>\";\n}", "getPct(ref, anchor) {\n var component = this.bfs(ref);\n return component.getPct(anchor);\n }", "function getCompressionInput() {\n let response = prompt(\"Enter a string to compress:\")\n return response;\n}", "input() {\n return this.input;\n }", "getPcElement(){return this.__pcElement}", "function parseCandyFromInput(){\n\tvar val = dom.input.value;\n\tif (val.length < 2){\n\t\tvar row = parseInt(val.charAt(1))-1;\n\t}\n\telse { //10\n\t\tvar row = parseInt(val.substring(1,3))-1;\n\t}\n\tvar alphaCol = val.charAt(0);\n\tvar col = alphaCol.toLowerCase().charCodeAt(0) - 97; //convert letter to number\n\tvar candy = board.getCandyAt(row, col);\n\treturn candy;\n\n}", "function decode_digit(cp) {\n return cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : base;\n }", "getInputVal(inp) {\r\n return inp.value;\r\n }", "function sc_readChar(port) {\n if (port === undefined) // we assume the port hasn't been given.\n\tport = SC_DEFAULT_IN; // THREAD: shared var...\n var t = port.readChar();\n return t === SC_EOF_OBJECT? t: new sc_Char(t);\n}", "function getFallbackBeforeInputChars(domEventName,nativeEvent){// If we are currently composing (IME) and using a fallback to do so,\n// try to extract the composed characters from the fallback object.\n// If composition event is available, we extract a string only at\n// compositionevent, otherwise extract it at fallback events.\nif(isComposing){if(domEventName==='compositionend'||!canUseCompositionEvent&&isFallbackCompositionEnd(domEventName,nativeEvent)){var chars=getData();reset();isComposing=false;return chars;}return null;}switch(domEventName){case'paste':// If a paste event occurs after a keypress, throw out the input\n// chars. Paste events should not lead to BeforeInput events.\nreturn null;case'keypress':/**\n * As of v27, Firefox may fire keypress events even when no character\n * will be inserted. A few possibilities:\n *\n * - `which` is `0`. Arrow keys, Esc key, etc.\n *\n * - `which` is the pressed key code, but no char is available.\n * Ex: 'AltGr + d` in Polish. There is no modified character for\n * this key combination and no character is inserted into the\n * document, but FF fires the keypress for char code `100` anyway.\n * No `input` event will occur.\n *\n * - `which` is the pressed key code, but a command combination is\n * being used. Ex: `Cmd+C`. No character is inserted, and no\n * `input` event will occur.\n */if(!isKeypressCommand(nativeEvent)){// IE fires the `keypress` event when a user types an emoji via\n// Touch keyboard of Windows. In such a case, the `char` property\n// holds an emoji character like `\\uD83D\\uDE0A`. Because its length\n// is 2, the property `which` does not represent an emoji correctly.\n// In such a case, we directly return the `char` property instead of\n// using `which`.\nif(nativeEvent.char&&nativeEvent.char.length>1){return nativeEvent.char;}else if(nativeEvent.which){return String.fromCharCode(nativeEvent.which);}}return null;case'compositionend':return useFallbackCompositionData&&!isUsingKoreanIME(nativeEvent)?null:nativeEvent.data;default:return null;}}", "function getFallbackBeforeInputChars(domEventName,nativeEvent){// If we are currently composing (IME) and using a fallback to do so,\n// try to extract the composed characters from the fallback object.\n// If composition event is available, we extract a string only at\n// compositionevent, otherwise extract it at fallback events.\nif(isComposing){if(domEventName==='compositionend'||!canUseCompositionEvent&&isFallbackCompositionEnd(domEventName,nativeEvent)){var chars=getData();reset();isComposing=false;return chars;}return null;}switch(domEventName){case'paste':// If a paste event occurs after a keypress, throw out the input\n// chars. Paste events should not lead to BeforeInput events.\nreturn null;case'keypress':/**\n * As of v27, Firefox may fire keypress events even when no character\n * will be inserted. A few possibilities:\n *\n * - `which` is `0`. Arrow keys, Esc key, etc.\n *\n * - `which` is the pressed key code, but no char is available.\n * Ex: 'AltGr + d` in Polish. There is no modified character for\n * this key combination and no character is inserted into the\n * document, but FF fires the keypress for char code `100` anyway.\n * No `input` event will occur.\n *\n * - `which` is the pressed key code, but a command combination is\n * being used. Ex: `Cmd+C`. No character is inserted, and no\n * `input` event will occur.\n */if(!isKeypressCommand(nativeEvent)){// IE fires the `keypress` event when a user types an emoji via\n// Touch keyboard of Windows. In such a case, the `char` property\n// holds an emoji character like `\\uD83D\\uDE0A`. Because its length\n// is 2, the property `which` does not represent an emoji correctly.\n// In such a case, we directly return the `char` property instead of\n// using `which`.\nif(nativeEvent.char&&nativeEvent.char.length>1){return nativeEvent.char;}else if(nativeEvent.which){return String.fromCharCode(nativeEvent.which);}}return null;case'compositionend':return useFallbackCompositionData&&!isUsingKoreanIME(nativeEvent)?null:nativeEvent.data;default:return null;}}", "function sc_cadadr(p) { return p.cdr.car.cdr.car; }", "function getInput() {\n let inArg = process.argv.slice(2);\n if (inArg.length != 1) {\n console.log(\"invalid number of arguments passed\");\n process.exit(2);\n }\n console.log(\"initial: \" + inArg[0]);\n charArr = inArg[0].split('');\n return charArr;\n \n}", "function getChar(c){\n return String.fromCharCode(c)\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}", "function getSECCurveByName(name) {\n if(name == \"secp128r1\") return secp128r1();\n if(name == \"secp160k1\") return secp160k1();\n if(name == \"secp160r1\") return secp160r1();\n if(name == \"secp192k1\") return secp192k1();\n if(name == \"secp192r1\") return secp192r1();\n if(name == \"secp224r1\") return secp224r1();\n if(name == \"secp256r1\") return secp256r1();\n return null;\n}" ]
[ "0.5502982", "0.5222779", "0.511648", "0.5097086", "0.50962514", "0.50859517", "0.5083474", "0.5047004", "0.50427216", "0.5002002", "0.49791813", "0.49726874", "0.4941351", "0.49171612", "0.49171612", "0.48958528", "0.48808542", "0.48585698", "0.48398226", "0.48071763", "0.47982672", "0.47898963", "0.47799906", "0.4778698", "0.47635615", "0.47544", "0.47465798", "0.47443008", "0.4741111", "0.47311813", "0.47172698", "0.47139183", "0.4709475", "0.46935034", "0.46873957", "0.46824738", "0.4661716", "0.4659893", "0.46573958", "0.46523702", "0.46417806", "0.46417806", "0.46409163", "0.4637929", "0.46324655", "0.46294272", "0.46286872", "0.46273458", "0.46191794", "0.46129096", "0.4573413", "0.4565882", "0.45572206", "0.4556847", "0.45563012", "0.4551156", "0.45455012", "0.454468", "0.45426702", "0.45395726", "0.45286155", "0.45065084", "0.4502568", "0.44996452", "0.44976586", "0.44920692", "0.44786432", "0.44769898", "0.44662744", "0.4461536", "0.44593468", "0.44589862", "0.44574872", "0.4457217", "0.44493052", "0.4447401", "0.44467145", "0.44440895", "0.44439209", "0.44390577", "0.4438552", "0.4438451", "0.4433393", "0.4428609", "0.44263953", "0.4423091", "0.44192553", "0.44115078", "0.44115078", "0.44113708", "0.44072515", "0.44011778", "0.44004458", "0.44004458", "0.44004458", "0.44004458", "0.44004458", "0.44004458", "0.44004458", "0.44004458" ]
0.61347467
0
End of document ready //////////// Helper functions Check to see if current url in tab is supported against list of supported sites. Then render status as accordingly. Each site will be treated individually until it has been shown otherwise.
function renderStatus(url, tabs) { var host = url.match(/^(.*?:\/{2,3})?(.+?)(\/|$)/)[2]; var result = $.grep(supported_sites, function (elem) { return elem.url === host; }); if (result.length == 0) { $("#siteStatus") .text("Current site not supported") .addClass("notSupported"); } else if (result.length == 1) { var siteObj = result[0]; // Get specific siteObject from supported_sites switch (siteObj.name) { case "Office Ally": case "Office Ally Demo": case "United Health Care Dev": case "United Health Care": enableForm(); showOAOptions(tabs[0].id); $("#siteStatus") .text(siteObj.name + " is supported!") .addClass("supported"); $("#fillForm").on("click", function () { fillFormHandler(siteObj, tabs[0].id); }); // Submit form after hitting enter $("#datesForm").keydown(function (event) { if (event.which == 13) { event.preventDefault(); fillFormHandler(siteObj, tabs[0].id); } }); $("#undoForm") .prop("disabled", false) .on("click", function () { chrome.tabs.sendMessage( tabs[0].id, { message: "undoForm", siteObj: JSON.stringify(siteObj), }, function (response) { ResponseHandler(response); } ); }); chrome.tabs.sendMessage( tabs[0].id, { message: "getDiagnoses", siteName: siteObj.name }, function (diagObj) { if (diagObj) { if (diagObj.length > 4) { $("#statusBarMsg") .text( "More than 4 diagnoses detected. Column 24.E will not be filled due to site limitations." ) .addClass("warning"); return; } $("#statusBarMsg") .text( diagObj.length + " diagnosis code(s) detected, Enter CPT Codes." ) .addClass("supported"); } else { $("#statusBarMsg").text( "No diagnosis detected in section 21. You will enter diagnosis pointers manually for each row." ); } } ); break; default: $("#siteStatus") .text(siteObj.name + " is not yet supported") .addClass("notSupported"); break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function siteIsSupported() {\n // Check if the site is supported then set top bar\n return !!supportedSites.find(function (s) { return !!location.host.match(s.host); });\n}", "function checkCurrentUrlAdded(){\n\t\n\tgetCurrentUrl(function(currentUrl){\n\t\t\n\t\tif(domains.indexOf(currentUrl)==-1){\n\t\t\tdocument.getElementById(\"add_url_btn\").classList.remove(\"disabled\");\n\t\t}\n\t\telse{\n\t\t\tdocument.getElementById(\"add_url_btn\").classList.add(\"disabled\");\n\t\t}\n\t\t\n\t\t\n\t});\n}", "function checkUrlInList(tabs, result) {\n try {\n var url = tabs[0].url; // pulled url\n site = formatUrl(url); // removed https://\n var urlList = result.urlList; // list = saved list\n updateSeconds(site, urlList);\n\n }catch{}\n}", "function checkForValidUrl(tabId, changeInfo, tab) { \n var url = tab.url;\n // Prevent twice loading, check SO thread: http://goo.gl/fF0iS\n if (url !== undefined && changeInfo.status == \"complete\") { \n if (in_array(tab.url, siteList, tab)) {\n injection(tabId); \n //console.log(\"CheatSheet for this URL are available in DB\");\n }\n }\n}", "function checkCurrentTab() {\n\tchrome.tabs.query({\"active\": true, \"currentWindow\": true, \"windowType\": \"normal\"}, tabs => {\n\t\tvar tab = tabs[0];\n\n\t\t// popup/devTools windows ran result in null tab variable\n\t\tif (!tab) { return; }\n\n\t\t// get current URL\n\t\tvar currentURL = tab.url; \n\t\tconsole.log('Updating state from URL: ' + currentURL);\n\t\tchrome.storage.local.set({'url': currentURL});\n\n\t\t// check if URL matches a refugee need\n\t\tvar match = isMatch(currentURL);\n\t\t// update chrome.storage.local.isMatch\n\t\tchrome.storage.local.set({'isMatch': match});\n\t\t// update notification badge\n\t\tchrome.browserAction.setBadgeText({ text: match ? '1' : ''});\n\t});\n}", "function getSupportedSitesInfo() {\n var sites = {\n\n // Example URLs:\n // http://www.refinery29.com/2016/12/133127/how-to-wrap-presents\n \"refinery29.com\": {\n loadAll: function (thisInfo, fullArticleContainer, url) {\n addClassToDOMElements('.opener', 'isVisible active', function (unused) {\n addClassToDOMElements('.slide', 'isVisible active', function (msg) {\n displayResult('Loaded ' + (msg.numLoaded ? msg.numLoaded : 'all') + ' slides');\n });\n });\n }\n },\n\n \"knowable.com\": {\n // Example URLs:\n // http://www.knowable.com/a/23-people-were-asked-what-is-the-most-messed-up-family-secret-you-know/p-1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(knowable\\.com\\/a\\/[^\\/]+)((\\/p-)([0-9]+))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // knowable.com/a/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/p-{0}') // /p-X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.article-body',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '/t/end-gallery',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('.article-body .btn-next-xl');\n return (!nextLink.length || nextLink.attr('href') == '/t/end-gallery');\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n if (pageNum > 1) { // hide article title after page 1\n articleMeat.find('.article-header').addClass('hidden');\n }\n articleMeat.find('.article-footer-v2').addClass('hidden');\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n fullArticleContainer.addClass(thisInfo.articleMeatSelector);\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements(thisInfo.articleMeatSelector, fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"suggest.com\": { // also applies to minq.com\n // Example URLs:\n // http://www.suggest.com/lifestyle/1600362/how-did-they-even-get-hired-employees-share-their-17-most-insane-crazy-employee-stories?story_page=1\n // http://www.minq.com/lifestyle/1599990/21-people-share-awesome-stories-about-how-they-became-friends-with-their-bffs?story_page=1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(.+\\.com\\/[^\\/]+\\/[^\\/]+\\/[^\\/]+)((\\/\\?story_page=)([0-9]+))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // suggest.com/section/1234/article-title-here OR minq.com/...\n + (matches[4] ? matches[5] + '{0}' : '/?story_page={0}') // /?story_page=X\n + (matches[7] && matches[7] != '/' ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.slide',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '#',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('.next-story');\n return (!nextLink.length || nextLink.attr('href').indexOf('story_page') == -1); // next page is a new article\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n fullArticleContainer.addClass(thisInfo.articleMeatSelector + ' partial content_story_pages_slide primary');\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements('.slot[data-slot=\"center\"]', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"emgn.com\": {\n // Example URL:\n // http://emgn.com/s2/19-extreme-body-transformations-thatll-leave-jaw-aching/1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(emgn\\.com\\/[^\\/]+\\/[^\\/]+)((\\/)([0-9]*))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // emgn.com/something/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/{0}') // /X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.content > *:not(aside):not(.pagination):not(.rrssb-holder)',\n isPastLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one with text 'Next Article',\n // we've past the last page\n var html = $.parseHTML(responseText);\n var nextDiv = $(html).find('.pagination .next');\n return (nextDiv.length && (nextDiv[0].innerText).indexOf('Article') >= 0); // this is the junky page before next article\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Function to execute after retrieving all of the article content\n var afterLastPage = function (pageNum) {\n fullArticleContainer.addClass('content');\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements('article.content', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n if (thisInfo.isPastLastPage(responseText)) {\n afterLastPage(pageNum);\n }\n else {\n if (pageNum > 1) {\n thisInfo.articleMeatSelector += ':not(h1)'; // don't show the title more than once\n }\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n fullArticleContainer.append(articleMeat);\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"lifebuzz.com\": {\n // Example URL:\n // http://www.lifebuzz.com/princess-diana/1/\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(lifebuzz\\.com\\/[^\\/]+)((\\/)([0-9]*))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // lifebuzz.com/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/{0}') // /X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.single > *:not(#desktop-below-post-trending)',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '/t/end-gallery',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('a.next-post');\n return (nextLink.length);\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {;\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n articleMeat.find('img.lazy').each(function (index, listItem) {\n $(listItem).attr('src', $(listItem).attr('data-original'));\n });\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n fullArticleContainer.addClass('single');\n fullArticleContainer.find('.post-pagination').addClass('hidden');\n fullArticleContainer.find('.share-bar').addClass('hidden');\n replaceDOMElements('.single', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"forbes.com\": {\n buttonNote: '(will open in new window)',\n // Example URL:\n // http://www.forbes.com/sites/michaelbobelian/2016/12/16/democrats-best-hope-to-defeat-trumps-cabinet-picks-lies-in-glare-of-confirmation-process/\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Click the 'print' button\n triggerEventOnDOMElement('.print a', 'click', function (msg) {\n if (msg && msg.success) {\n displayResult('Opened full article');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n },\n }\n\n // minq.com has the same format as suggest.com (wat)\n sites['minq.com'] = sites['suggest.com'];\n\n return sites;\n}", "function displaySelectedCUHybridCompTab(){\n var url = parent.location.href;\n s=url.indexOf(\"summary\");\n if (s!=-1){\n obj= document.getElementById('summary-li');\n if(obj){\n document.getElementById('summary').style.display=\"\";\n }\n }\n if (url.indexOf(\"basiccontrol\")!=-1){\n obj= document.getElementById('basiccontrol-li');\n if(obj){\n document.getElementById('basiccontrol').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"cprating\")!=-1){\n obj= document.getElementById('cprating-li');\n if(obj){\n document.getElementById('cprating').style.display=\"\";\n }\n }\n if (url.indexOf(\"auditreadyasmt\")!=-1){\n obj= document.getElementById('auditreadyasmt-li');\n if(obj){\n document.getElementById('auditreadyasmt').style.display=\"\";\n }\n }\n if (url.indexOf(\"riskmsdcommit\")!=-1){\n obj= document.getElementById('riskmsdcommit-li');\n if(obj){\n document.getElementById('riskmsdcommit').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"auditreview\")!=-1){\n obj= document.getElementById('auditreview-li');\n if(obj){\n document.getElementById('auditreview').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"kctest\")!=-1){\n obj= document.getElementById('kctest-li');\n if(obj){\n document.getElementById('kctest').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"opmetric\")!=-1){\n obj= document.getElementById('opmetric-li');\n if(obj){\n document.getElementById('opmetric').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"other\")!=-1){\n obj= document.getElementById('other-li');\n if(obj){\n document.getElementById('other').style.display=\"\";\n }\n }\n}", "function hideButtons(url,domain) {\n\n var count = 0;\n\n //switch statement for sites\n switch(true)\n {\n \n case url.indexOf(\"sites.html\") > -1 :\n document.getElementById('admin').className += ' hidden';\n count++;\n break;\n \n case url.indexOf(\"editor.html\") > -1 && url.indexOf(\"language-masters\") > -1 : \n document.getElementById('languagemaster').className += ' hidden';\n count++;\n break; \n \n case url.indexOf(\"editor.html\") > -1 && url.indexOf(\"language-masters\") <= -1 : \n document.getElementById('author').className += ' hidden';\n count++;\n break;\n \n case url.indexOf(authorURL) > -1 && url.split(authorURL)[1].substring(0,4) ==\"/con\" :\n document.getElementById('aspublished').className += ' hidden';\n count++;\n break;\n\n case url.indexOf(stageAuthorURL) > -1 && url.split(stageAuthorURL)[1].substring(0,4) ==\"/con\" :\n document.getElementById('aspublished').className += ' hidden';\n count++;\n break; \n \n case url.indexOf(publishURL) > -1 : document.getElementById('publish').className += ' hidden';\n count++;\n break;\n\n case url.indexOf(stagePublishURL) > -1 : document.getElementById('publish').className += ' hidden';\n count++;\n break;\n \n case url.indexOf(liveURL) > -1 : document.getElementById('live').className += ' hidden';\n count++;\n break;\n\n case url.indexOf(stageLiveURL) > -1 : document.getElementById('live').className += ' hidden';\n count++;\n break; \n \n }\n \n if(count<1) {\n document.getElementById('main').className += ' hidden';\n document.getElementById('error').className = ' ttt';\n }\n \n}", "function checkForSupportedURL(tabID, changeInfo, tab) {\n\n\tif ((typeof tab.url === 'string') && (tab.url.indexOf('https://www.twitch.tv') === 0)) {\n\n\t\tchrome.pageAction.show(tabID);\n\t}\n}", "function show_work_panel(){\n chrome.tabs.query({'active': true}, function (tabs) {\n var page_url = tabs[0].url;\n var exist_url = $('#work_panel').data('exist-url');\n var user_token = localStorage['user_token'];\n\n $('#add_link, #keep_link, #unkeep_link').hide();\n $.ajax({\n url: exist_url,\n type: 'GET',\n dataType: 'json',\n data: {user_token: user_token, url: page_url},\n success: function(resp){\n if(resp.status != null && resp.status.code == 200){\n if(resp.link.state == 0) return $('#keep_link').show(); \n if(resp.link.state == 5) return $('#unkeep_link').show(); \n }\n $('#add_link').show();\n },\n error: function(xhr, status, err){\n $('#add_link').show(); \n }\n });\n $('#work_panel').fadeIn(300);\n });\n }", "function internal_link() {\n var urlArray = window.location.href.split('#');\n if (urlArray.length == 2 && urlArray[1] != \"\") {\n switch (urlArray[1]) {\n case \"intro\": $('#tab-1-content').show(); break;\n case \"grants\": $('#tab-2-content').show(); break;\n case \"selectedpubs\": $('#tab-3-content').show(); break;\n case \"courses\": $('#tab-4-content').show(); break;\n case \"advising\": $('#tab-5-content').show(); break;\n case \"service\": $('#tab-6-content').show(); break;\n default: break;\n }\n }\n}", "function checkForValidUrl(tabId, changeInfo, tab) {\n// If the tabs url starts with \"http://specificsite.com\"...\nif (tab.url.indexOf(\"https://timetable.iit.artsci.utoronto.ca/\") == 0) {\n// ... show the page action.\nchrome.pageAction.show(tabId);\n}\n}", "function internal_link() {\n var urlArray = window.location.href.split('#');\n if (urlArray.length == 2 && urlArray[1] != \"\") {\n switch (urlArray[1]) {\n case \"intro\": $('#tab-intro-content').show(); break;\n case \"news\": $('#tab-news-content').show(); break;\n case \"publications\": $('#tab-publications-content').show(); break;\n case \"awards\": $('#tab-awards-content').show(); break;\n case \"courses\": $('#tab-courses-content').show(); break;\n case \"systems\": $('#tab-systems-content').show(); break;\n case \"links\": $('#tab-links-content').show(); break;\n case \"service\": $('#tab-service-content').show(); break;\n case \"advising\": $('#tab-advising-content').show(); break;\n case \"contact\": $('#tab-contact-content').show(); break;\n default: break;\n }\n }\n}", "function displaySelectedCUHybridPortfolioCompTab(){\n var url = parent.location.href;\n s=url.indexOf(\"summary\");\n if (s!=-1){\n obj= document.getElementById('summary-li');\n if(obj){\n document.getElementById('summary').style.display=\"\";\n }\n }\n if (url.indexOf(\"basiccontrol\")!=-1){\n obj= document.getElementById('basiccontrol-li');\n if(obj){\n document.getElementById('basiccontrol').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"cprating\")!=-1){\n obj= document.getElementById('cprating-li');\n if(obj){\n document.getElementById('cprating').style.display=\"\";\n }\n }\n if (url.indexOf(\"auditreadyasmt\")!=-1){\n obj= document.getElementById('auditreadyasmt-li');\n if(obj){\n document.getElementById('auditreadyasmt').style.display=\"\";\n }\n }\n if (url.indexOf(\"riskmsdcommit\")!=-1){\n obj= document.getElementById('riskmsdcommit-li');\n if(obj){\n document.getElementById('riskmsdcommit').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"auditreview\")!=-1){\n obj= document.getElementById('auditreview-li');\n if(obj){\n document.getElementById('auditreview').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"kctest\")!=-1){\n obj= document.getElementById('kctest-li');\n if(obj){\n document.getElementById('kctest').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"opmetric\")!=-1){\n obj= document.getElementById('opmetric-li');\n if(obj){\n document.getElementById('opmetric').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"accountrating\")!=-1){\n obj= document.getElementById('accountrating-li');\n if(obj){\n document.getElementById('accountrating').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"other\")!=-1){\n obj= document.getElementById('other-li');\n if(obj){\n document.getElementById('other').style.display=\"\";\n }\n }\n}", "function pageSupportedInit() {\n let found = false; \n // Two templates for gofundme \n if (/^https:\\/\\/(.*\\.)?gofundme.com/.test(location.href)) {\n // Old main domain template\n // New main domain template\n // charity subdomain template\n $appendToButton =\n document.querySelector(\".js-xl-donate-button\") ||\n document.querySelector('[data-element-id=\"btn_share\"]') ||\n document.querySelector('.js-sm-up-container .js-donate-now');\n found = true;\n } else if (/^https:\\/\\/(www\\.)?patreon.com/.test(location.href)) {\n $appendToButton = document.querySelector(\".sc-fzoLsD.etpOIT\");\n found = true;\n } else if (/^https:\\/\\/(www\\.)?linkedin.com/.test(location.href)) {\n linkedInButton(document.querySelector(\".pv-s-profile-actions__overflow\"));\n } else if (/^https:\\/\\/github.com/.test(location.href)) {\n $appendToButton = document.querySelector('[aria-label=\"Select assignees\"]');\n found = true;\n } else if (/^https:\\/\\/(www\\.)?kickstarter.com/.test(location.href)) {\n // kickStarters\n $appendToButton = document.querySelector(\".NS_projects__rewards_list ol\");\n found = true;\n } else if (/^https:\\/\\/(www\\.)?stackoverflow.com/.test(location.href)) {\n // stackoverflow\n bountyButton(document.querySelector(\".question .comments-link\"));\n } else if (document.querySelector(\".ProfileSidebar .PhotoRail\")) {\n $appendToButton = document.querySelector( \".ProfileSidebar .PhotoRail\");\n found = true;\n } else if(/^https:\\/\\/(www\\.)?twitter.com/.test(location.href) && document.querySelector('header > div > div > div > div > div + div + div')) {\n $appendToButton = document.querySelector('header > div > div > div > div > div + div + div');\n found = true; \n } else if (/^https:\\/\\/(www\\.)?facebook.com.*/.test(location.href)) {\n // facebook \n // pagerefresh doesn't work due to how the site was made, we have to monitor it when we land on this page\n // we will give it about 20s to find the right element, or when it's found, remove the monitoring.\n slowPageTimer('#profile_timeline_tiles_unit_pagelets');\n } else if (/^https:\\/\\/(www\\.)?ebay.com/.test(location.href) && document.getElementById(\"RightSummaryPanel\")) {\n // ebay\n $appendToButton = document.querySelector(\"#RightSummaryPanel\").lastChild;\n found = true;\n } else if (/^https:\\/\\/(www\\.)?youtube.com/.test(location.href)) {\n // youtube pledge allowed, don't inject box yet\n found = true;\n } else if ( /^https:\\/\\/(www\\.)?fiverr.com/.test(location.href) ){\n // fiverr\n $appendToButton = document.querySelector( \".contact-seller.display-contact-seller\");\n document.querySelector('.sidebar.poly-sticky').style.position = \"static\";\n found = true;\n } else if (/^https:\\/\\/(www\\.)?t.me/.test(location.href)) {\n $appendToButton = document.querySelector(\".tgme_page\").lastChild;\n found = true;\n } else if(/^https:\\/\\/(www\\.)?blockchain.com\\/(btc|eth)\\/address\\//.test(location.href)) {\n $appendToButton = document.querySelector('.fieq4h-0.eGdsW:nth-child(3) > div .fieq4h-0.eGdsW .ild1xh-1.dBgUTl') || \n document.querySelector('.fieq4h-0.eGdsW:nth-child(3) > div .fieq4h-0.eGdsW .ahwase-1.dZEFco');\n found = true;\n } else if (/^https:\\/\\/(www.)?xmrchain.net\\/search\\?value=/.test(location.href)) { \n $appendToButton = document.querySelector('body div:nth-child(2) h4');\n found = true; \n } else if (/^https:\\/\\/(www\\.)?ardor.tools\\/account\\//.test(location.href)) { \n // account for slow load(angular app? loading animation) \n slowPageTimer('#accountTable')\n }\n\n return found;\n }", "function checkForValidUrl(tabId, changeInfo, tab) {\n // If the letter 'g' is found in the tab's URL...\n if (tab.url.indexOf('www.pivotaltracker.com/s/projects') > -1) {\n chrome.pageAction.show(tabId);\n //Default hide\n PVhidden = toggleStory(tab, PVhidden);\n }\n}", "function checkIfDynatrace() {\n function callback(tabs) {\n //Get the URL from the main window\n let url = tabs[0].url; \n \n //Use Regex to see if you're on a SaaS tenant or a Managed environment\n saasCheck = new RegExp('(\\/\\/[a-z]{3}[1234567890]{5}\\.)').exec(url);\n managedCheck = new RegExp('(\\/e\\/[^\\/]*)').exec(url);\n\n //If you're on a SaaS tenant, set the \"deploy\" to SaaS and extract the values from storage\n if(saasCheck != null) {\n function url_domain(data) {\n var a = document.createElement('a');\n a.href = data;\n return a.hostname;\n }\n \n let saasRegex = new RegExp('([a-z]{3}[1234567890]{5}\\.)(.*)').exec(url_domain(url));\n \n saasHost = saasRegex[2];\n\n deploy = \"saas\";\n setTextBoxDefaults(deploy);\n }\n //If you're on a Managed environment, set the \"deploy\" to Managed and extract the values from storage\n else if(managedCheck != null) {\n deploy = \"managed\";\n setTextBoxDefaults(deploy);\n }\n //otherwise, display a message asking the user to please visit a Dynatrace environment\n else {\n document.getElementById(\"content\").style.display = \"none\";\n document.getElementById(\"no_content\").style.display = \"block\";\n }\n }\n\n //Query the local storage to start the functionality\n chrome.tabs.query(query, callback);\n}", "function verifyWindows() {\n failedLinks = [];\n targetLinks = [];\n \n \n \n links = window.document.links;\n var linkUrl = links.href;\n \n for (linkUrl in links) {\n json = \"\";\n status = 0;\n thisUrl = links[linkUrl].toString();\n json = ajaxReq(thisUrl);\n status = getStatus(json);\n \n console.log (thisUrl + \" has status: \" + status);\n //detect the domain\n var matches = thisUrl.match(/^https?\\:\\/\\/([^\\/:?#]+)(?:[\\/:?#]|$)/i);\n var domains = matches&&matches[1];\n console.log(domains);\n \n if(status === 0 || status === undefined || status >= 400) {\n console.log(\"Link \" + thisUrl + \"failed : \" + status );\n failedLinks.push(thisUrl);\n }\n }\n \n}", "function loaded() {\n var cur_tab_url = chrome.extension.getBackgroundPage().CurrentTabUrl();\n if (/https:/.test(cur_tab_url)) {\n document.getElementById(\"not_ready_alert\").innerHTML =\n \"You can't grab snippets from secure webpages.\";\n } else if (!/http:/.test(cur_tab_url)) {\n document.getElementById(\"not_ready_alert\").innerHTML =\n \"You can't grab snippets from this page.\";\n } else { // http\n checkReadyness();\n }\n\n if (chrome.extension.getBackgroundPage().isFirstActivationOrNewRelease()) {\n document.getElementById('standard_actions').style.display = 'none';\n document.getElementById('update_notifications').style.display = '';\n }\n}", "function showOnThisPage(){\n\t\tvar url = window.location.href;\n\t\tvar path = window.location.pathname;\n\t\tif(url.match(/\\.com/i) && path.match(/learn-/i)){ return true; } // US language catalog pages\n\t\treturn false;\n\t}", "function checkWhichNavigationToDisplay() {\n\t\t\tvar nonStatusUpdates$ = jContainer.find(\".ASWidgetActionDropdown li:not(.ASWidgetStatusUpdatesNaviPoint)\"),\n\t\t\t\tstatusUpdates$ = jContainer.find(\".ASWidgetActionDropdown li.ASWidgetStatusUpdatesNaviPoint\");\n\t\t\tif (jContainer.find(\".ASWidgetstatusUpdates.active\").length) {\n\n\t\t\t\tif (!isCommunityMode()) {\n\t\t\t\t\tnonStatusUpdates$.hide();\n\t\t\t\t\tstatusUpdates$.show();\n\t\t\t\t} else {\n\t\t\t\t\tstatusUpdates$.hide();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnonStatusUpdates$.show();\n\t\t\t\tstatusUpdates$.hide();\n\t\t\t}\n\t\t}", "function checkForValidUrl(tabId, changeInfo, tab) {\n // If the tabs url starts with \"http://specificsite.com\"...\n var str = \"http://gatherer.wizards.com/pages/card\"\n if (tab.url.toLowerCase().indexOf(str) == 0) {\n // ... show the page action.\n chrome.pageAction.show(tabId);\n }\n}", "function checkUrl(){\n\t\n\tvar task = getUrlVar('task');\n\tvar id = getUrlVar('id');\n\tvar radius_simplify = getUrlVar('rs');\n\t//if the id is a number\n\tif (!isNaN(id)){\t\t\n\t\t$('#tabs').tabs('select', 1);\n\t\tswitch(task){\n\t\t\tcase 'ego-centric': \t\n\t\t\t\tviewerControl.displayNetwork('CONTRIBUTOR', id, 0);\n\t\t\t\tbreak;\n\t\t\tcase 'event-centric':\n\t\t\t\tviewerControl.displayNetwork('EVENT', id, 0, radius_simplify) \n\t\t\t\tbreak;\t\t\t\t\n\t\t}\n\t}\n}", "function test(url) {\n // begin switch statement to elimintate exclusions\n switch (true) {\t\n // begin case statement to test for exclusions\n case links[i].host !== location.host:\n // console.log(\"Matched a url that is an external link\");\n totalLinksExternal = totalLinksExternal + 1\n totalLinksExcluded = totalLinksExcluded + 1\n linkInfoExternal = linkInfoExternal + '<span class=\"external\">' + totalLinksExternal.toString() + ') <strong>External</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoExcluded = linkInfoExcluded + '<span class=\"external\">' + totalLinksExcluded.toString() + ') <strong>External</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"external\" style=\"background-color:plum\">' + (i+1).toString() + ') <strong>External</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n break;\n case /layouts/gi.test(url):\n // console.log(\"Matched a url that contains 'layouts'\");\n totalLinksExcluded = totalLinksExcluded + 1\n linkInfoExcluded = linkInfoExcluded + '<span class=\"excluded\">' + totalLinksExcluded.toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"excluded\" style=\"background-color:yellow\">' + (i+1).toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n break;\n case /file/gi.test(url):\n // console.log(\"Matched a url that contains 'file'\");\n totalLinksExcluded = totalLinksExcluded + 1\n linkInfoExcluded = linkInfoExcluded + '<span class=\"excluded\">' + totalLinksExcluded.toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"excluded\" style=\"background-color:yellow\">' + (i+1).toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n break;\n default:\n // console.log(\"this link is okay to test\");\n // console.log(url);\n \n // the next line opens the link and gets the status of the http request. Comment out when testing or working on visual design\n var http = new XMLHttpRequest();\n http.open('HEAD', url, false);\n \n // begin try catch block to test for error on send\n try {\n http.send();\n var response = http.status;\n console.log(response);\n \n if (http.status == 200){\n // console.log(\"found a good link\");\n // console.log(response);\n totalLinksGood = totalLinksGood + 1\n linkInfoGood = linkInfoGood + '<span class=\"good\">' + totalLinksGood.toString() + ') <strong>Good</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"good\" style=\"background-color:LightGreen\">' + (i+1).toString() + ') <strong>Good</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n var linksTested = parseInt(linksTested);\n var linksTested = linksTested++;\n \n } else if (http.status == 404) {\n // console.log(\"found a broken link\");\n // console.log(response);\n totalLinksBad = totalLinksBad + 1\n linkInfoBad = linkInfoBad + '<span class=\"broken\">' + totalLinksBad.toString() + ') <strong>Broken</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"broken\" style=\"background-color:LightCoral\">' + (i+1).toString() + ') <strong>Broken</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n var linksTested = parseInt(linksTested);\n var linksTested = linksTested++;\n \n } else {\n \n // console.log(\"something else is happening here\");\n // console.log(response);\n linkInfoTotal = linkInfoTotal + '<span class=\"something else\" style=\"background-color:LightBlue\">' + (i+1).toString() + ') <strong>Something Else</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n var linksTested = parseInt(linksTested);\n var linksTested = linksTested++;\n \n // end if statement to test http status\n }\n \n } catch (e) {\n \n console.log(e);\n // end try catch block to test for error on send\n // linkInfoTotal = linkInfoTotal + '<span class=\"something else\">' + i.toString() + ') ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n // var linksTested = parseInt(linksTested);\n // var linksTested = linksTested++;\n \n // end try catch block to test for error on send\n }\n \n break;\n // end case statement to test for exclusions\n \n // end switch statement to elimintate exclusions\n }\n // end enclosing function to test url to see if it contains some restricted locations, then open up a http request to the page and see if the page exists\n }", "function checkForValidUrl(tabId, changeInfo, tab) {\r\n\tvar currentUrl = tab.url;\r\n\tvar index = endsWith(currentUrl, \"CrseSchdDetl\");\r\n\tif (currentUrl.startsWith(\"https://www.uvic.ca/mypage/\")) {\r\n\t\tif(index){\r\n\t\t\tchrome.pageAction.show(tabId);\r\n\t\t}\r\n\t}\r\n}", "function displaySelectedCUPortfolioCompTab(){\n var url = parent.location.href;\n s=url.indexOf(\"summary\");\n if (s!=-1){\n obj= document.getElementById('summary-li');\n if(obj){\n document.getElementById('summary').style.display=\"\";\n }\n }\n if (url.indexOf(\"basiccontrol\")!=-1){\n obj= document.getElementById('basiccontrol-li');\n if(obj){\n document.getElementById('basiccontrol').style.display=\"\";\n }\n }\n if (url.indexOf(\"auditreadyasmt\")!=-1){\n obj= document.getElementById('auditreadyasmt-li');\n if(obj){\n document.getElementById('auditreadyasmt').style.display=\"\";\n }\n }\n if (url.indexOf(\"riskmsdcommit\")!=-1){\n obj= document.getElementById('riskmsdcommit-li');\n if(obj){\n document.getElementById('riskmsdcommit').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"auditreview\")!=-1){\n obj= document.getElementById('auditreview-li');\n if(obj){\n document.getElementById('auditreview').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"kctest\")!=-1){\n obj= document.getElementById('kctest-li');\n if(obj){\n document.getElementById('kctest').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"opmetric\")!=-1){\n obj= document.getElementById('opmetric-li');\n if(obj){\n document.getElementById('opmetric').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"accountrating\")!=-1){\n obj= document.getElementById('accountrating-li');\n if(obj){\n document.getElementById('accountrating').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"other\")!=-1){\n obj= document.getElementById('other-li');\n if(obj){\n document.getElementById('other').style.display=\"\";\n }\n }\n}", "function checkForValidUrl(tabId, changeInfo, tab) {\n// If the letter 'g' is found in the tab's URL...\n _.each(window.tobitabi_sites, function(selector, rege) {\n var re = new RegExp(rege);\n if (tab.url.match(re)) {\n // ... show the page action.\n chrome.pageAction.show(tabId);\n CUR_HOSTNAME = rege;\n chrome.storage.local.get(CUR_HOSTNAME, function(res) {\n TO_TOB[CUR_HOSTNAME] = res[CUR_HOSTNAME];\n });\n\n }\n });\n}", "function checkSiteType(){var hostname=window.location.hostname.toLowerCase().trim();if(hostname.indexOf('cosmo.ru')+1){return'cosmo';}if(hostname.indexOf('freundin.de')+1){return'freundin';}if(hostname.indexOf('kp.ru')+1){return'kp';}if(hostname.indexOf('eva.ru')+1){return'eva';}// wmj\nif(hostname.indexOf('wmj.ru')+1){return'wmj';}return'other';}", "function displaySelectedCPCompTab(){\n var url = parent.location.href;\n s=url.indexOf(\"summary\");\n if (s!=-1){\n obj= document.getElementById('summary-li');\n if(obj){\n document.getElementById('summary').style.display=\"\";\n }\n }\n if (url.indexOf(\"basiccontrol\")!=-1){\n obj= document.getElementById('basiccontrol-li');\n if(obj){\n document.getElementById('basiccontrol').style.display=\"\";\n }\n }\n if (url.indexOf(\"auditreadyasmt\")!=-1){\n obj= document.getElementById('auditreadyasmt-li');\n if(obj){\n document.getElementById('auditreadyasmt').style.display=\"\";\n }\n }\n if (url.indexOf(\"riskmsdcommit\")!=-1){\n obj= document.getElementById('riskmsdcommit-li');\n if(obj){\n document.getElementById('riskmsdcommit').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"auditreview\")!=-1){\n obj= document.getElementById('auditreview-li');\n if(obj){\n document.getElementById('auditreview').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"kctest\")!=-1){\n obj= document.getElementById('kctest-li');\n if(obj){\n document.getElementById('kctest').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"opmetric\")!=-1){\n obj= document.getElementById('opmetric-li');\n if(obj){\n document.getElementById('opmetric').style.display=\"\";\n }\n }\n\tif (url.indexOf(\"other\")!=-1){\n obj= document.getElementById('other-li');\n if(obj){\n document.getElementById('other').style.display=\"\";\n }\n }\n}", "function checkCustomize(){\n\tvar matchedIndex = -1;\n\tfor (var i = 0; i < customSites.length; i++) {\n \t\t if (!currentSite.indexOf(customSites[i])) {\n \t\t matchedIndex = i;\n \t break;\n \t\t }\n\t};\n\tif(matchedIndex > -1){\n\t\t\n\t\tcustomizeSites(matchedIndex);\n\t}\n}", "function checkUrl(tab) {\n\t//check if it's a Youtube video\n\tif (tab.url.match(/youtube/) && tab.url.match(/watch/)) {\n\t\t//gets video id\n\t\tvar video_id=removeVideoPrefix('http://www.youtube.com/watch?v=', tab.url);\n\t\tvar video_id_2 = removeVideoSuffix(video_id);\n\t\t//gets video details from YouTube API\n\t\tjQuery.getJSON('https://gdata.youtube.com/feeds/api/videos/'+video_id_2+'?v=2&alt=jsonc',function(data,status,xhr){\n\t\t\tif(typeof (data.data.restrictions) == \"undefined\"){\n\t\t\t\t//placeholder, will not match any strings\n\t\t\t\tcountry = \"North Korea\";\n\t\t\t\t}\n\t\t\telse{\n\t\t\t\t//Checks video restrictions against user's country\n\t\t\t\tfor (i = 0; i < data.data.restrictions[0].countries.length; i+=3) {\n\t\t\t\t\tvar countryprefix = data.data.restrictions[0].countries[i];\n\t\t\t\t\tvar countrysuffix = countryprefix.concat(data.data.restrictions[0].countries[i+1]);\n\t\t\t\t\tif (countrysuffix == user_country) {\n\t\t\t\t\t\tblocked_country = countrysuffix;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//If it's blocked\n\t\t\t\tif (blocked_country != \"null\") {\n\t\t\t\t\tfor (j = 0; j < data.data.restrictions[0].countries.length-3; j+=3) {\n\t\t\t\t\t\tvar country3 = data.data.restrictions[0].countries[j];\n\t\t\t\t\t\tvar country4 = country3.concat(data.data.restrictions[0].countries[j+1]);\n\t\t\t\t\t\t//Creates array of all blocked countries\n\t\t\t\t\t\tcountry_list.push(country4);\n\t\t\t\t\t}\t\n\t\t\t\t\t//Builds list of country suggestions\n\t\t\t\t\tif (country_list.length > 2) {\n\t\t\t\t\t\tvar i = 0;\n\t\t\t\t\t\tvar i = 0;\n\t\t\t\t\t\twhile (i < 4) {\n\t\t\t\t\t\t\tfor (j = 0; j < all_countries.countries.length; j++) {\n\t\t\t\t\t\t\t\tif (jQuery.inArray(all_countries.countries[j].code, country_list) == -1) {\n\t\t\t\t\t\t\t\t\tcountry_sugg[i] = all_countries.countries[j].name;\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//grammar\n\t\t\t\t\t\tunblocked_country = \"Some countries where it isn't blocked are \"+country_sugg[0]+', '+country_sugg[1]+', '+country_sugg[2]+', and '+country_sugg[3]+'.';\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tunblocked_country = \"The video is unblocked everywhere else.\";\n\t\t\t\t\t}\n\t\t\t\tvar notification = webkitNotifications.createNotification(\n\t\t\t\t'icon.png', \n\t\t\t\t'Unblocked Where',\n\t\t\t\t'This video is blocked in your location. '+unblocked_country\n\t\t\t\t); \n\t\t\t\tnotification.show();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function checkTab() {\n\tchrome.tabs.query({active: true, currentWindow: true}, function(arrayOfTabs) {\n\tvar url = arrayOfTabs[0].url;\n\n\t\tif (url.indexOf(\"netflix.com\") > -1) {\n\t\t\n\t\t\t//show the button if netflix is the current tab\n\t\t\tvar id = arrayOfTabs[0].id;\n\t\t\tchrome.pageAction.show(id);\n\t\t\tif (timerOn == false) {\n\n\t\t\t\t//check if the day has changed\n\t\t\t\tvar d = new Date();\n\t\t\t\tvar n = parseInt(d.getDate());\n\t\t\t\tif (n != current) {\n\t\t\t\t\tchrome.storage.local.set({'remaining': reset, 'current': n}, function(something) {});\n\t\t\t\t}\t\t\t\n\t\t\t\t\n\t\t\t\t//start the timer\n\n\t\t\t\tstart(id);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//if the current tab is not netflix but the timer is on, turn it off\n\t\tif (url.indexOf(\"netflix.com\") == -1 && timerOn == true) {\n\t\t\tvar id = arrayOfTabs[0].id;\n\t\t\tchrome.pageAction.hide(id);\n\t\t\tstop(id);\n\t\t}\n\t});\n}", "function runWhenURLMet(){\n url = location.hash.slice(1).split(\"?\")[0];\n data = location.hash.slice(1).split(\"?\");\n \n setActive(url);\n\n if (url === \"home\"){\n list(\"products\", \"homeul\",true);\n }\n if (url === \"login\" || url === \"\"){\n document.getElementById(\"menu\").style.display = \"none\";\n document.getElementById(\"returnBtn\").style.display = \"none\";\n }\n if (url !== \"login\" && url !== \"\"){\n document.getElementById(\"menu\").style.display = \"flex\";\n document.getElementById(\"returnBtn\").style.display = \"block\";\n }\n if (url === \"detail\"){\n details(data[1]);\n }\n}", "function checkForValidUrl(tabId, changeInfo, tab) {\n // If the letter 'file:///' is found in the tab's URL...\n if (tab && tab.url && tab.url.indexOf('file:///') > -1) {\n // ...check options and start jump.\n var jump_list = localStorage['jump_list'];\n if(!jump_list){\n $.ajax({\n url:regPatternUrl,\n type:'get',\n dataType:'text',\n success:function(r){\n localStorage['jump_list'] = r;\n }\n });\n }\n isAuto = localStorage['jump_list_auto'] || 0;\n if(isAuto == 1){\n startProcess(tab);\n }\n }\n}", "function validateNav() {\n switch (navigator.sayswho) {\n // IE\n case 'IE 4':\n case 'IE 5':\n case 'IE 6':\n case 'IE 7':\n case 'IE 8':\n case 'IE 9':\n // safari\n case 'Safari 1':\n case 'Safari 2':\n case 'Safari 3':\n case 'Safari 4':\n case 'Safari 5':\n case 'Safari 6':\n if(ga('.browser-update')\n .length != 0) return false;\n var aj = jAjax(_THEME + '/body/old-browser.html', 'get', '');\n aj.done(function(data) {\n globalCont.prepend(data);\n });\n break;\n }\n}", "function displaySettings (settings) {\n document.querySelector(\"input[name=status]\").checked = settings.status\n document.querySelector(\"input[name=images]\").checked = settings.images\n document.querySelector(\"input[name=bgimages]\").checked = settings.bgImages\n document.querySelector(\"input[name=videos]\").checked = settings.videos\n document.querySelector(\"input[name=iframes]\").checked = settings.iframes\n document.querySelector(\"input[name=bluramt]\").value = settings.blurAmt\n document.querySelector(\"span[name=bluramttext]\").innerHTML = settings.blurAmt + \"px\"\n document.querySelector(\"input[name=grayscale]\").checked = settings.grayscale\n\n\n browser.tabs.query({ active: true, currentWindow: true }, function (tabs) {\n var url = new URL(tabs[0].url)\n currentDomain = url.hostname\n\n var isWhitelisted = settings.ignoredDomains.indexOf(currentDomain) !== -1;\n\n document.querySelector('#current-domain').innerHTML = currentDomain;\n document.querySelector('#btn-whitelist-add').style.display = isWhitelisted ? 'none' : 'initial';\n document.querySelector('#btn-whitelist-remove').style.display = isWhitelisted ? 'initial' : 'none';\n });\n}", "function checkStatus() {\n $.ajax({\n type: 'GET',\n url: url,\n success: function (html) {\n let status = parseStatusHTML(html);\n if (typeof status !== 'undefined' && status !== 'QUE') {\n browser.runtime.sendMessage({\n action: 'displayStatusNotification',\n submitID: submitID,\n problemCode: problemCode,\n problemStatus: status,\n });\n location.reload();\n } else {\n setTimeout(checkStatus, REFRESH_INTERVAL);\n }\n },\n error: function () {\n setTimeout(checkStatus, REFRESH_INTERVAL);\n },\n });\n }", "function checkUrl(tab) {\n let id = tab.tabId || tab.id\n\n chrome.tabs.get(id, tabinfo => {\n url = tabinfo.url.split('/');\n\n if (!url[2]) return\n\n chrome.storage.sync.get(['pages'], function(result) {\n let pages=result.pages\n\n if (!pages){\n pages=[]\n }\n\n for (link of pages) {\n //console.log(link+\" :: \"+url[2])\n if (url[2].includes(link)) {\n inject();\n break;\n }\n }\n })\n \n })\n}", "function checkingHosting() {\n if (window.location.hostname === \"localhost\") {\n //checkingLocalHostURLS();\n console.log(\"User is on LOCALHOST\");\n }\n\n if (window.location.hostname === \"127.0.0.1\") {\n //checkingLocalHostURLS();\n console.log(\"User is on LOCALHOST\");\n }\n\n if (window.location.hostname !== \"localhost\") {\n checkingServerURLS();\n console.log(\"User is on HOSTING SERVER\");\n }\n\n if (window.location.hostname !== \"127.0.0.1\") {\n checkingServerURLS();\n console.log(\"User is on HOSTING SERVER\");\n }\n }", "function checkForValidUrl(tabId, changeInfo, tab) {\n if(changeInfo.status === \"loading\") {\n if (tab.url.indexOf('www.facebook.com') > -1) {\n chrome.pageAction.show(tabId);\n }\n }\n}", "function initialSiteCheck(){\n\tchrome.storage.local.get(\"urls\", function(result){\n\t\tresult = result[\"urls\"];\n\t\tresult = (result === undefined ? {} : result);\n\t\t\n\t\t//Prompt if empty\n\t\tif (Object.keys(result).length === 0 && result.constructor === Object){\n\t\t\tpromptUserForSite(false, function(url){\n\t\t\t\t\n\t\t\t\tlet type = getURLType(url);\n\t\t\t\t\n\t\t\t\tif (type == \"pokebeach\"){\n\t\t\t\t\turl = url.substr(0, url.lastIndexOf('/') + 1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if (type == \"qt\"){\n\t\t\t\t\tif (url.indexOf('?') !== -1)\n\t\t\t\t\t\turl = url.substr(0, url.indexOf('?'));\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Save url\n\t\t\t\tresult[url] = {url:url, currentPage: null, type: type, version:VERSION};\n\t\t\t\tchrome.storage.local.set({\"urls\" : result}, function() {\n\t\t\t\t\t//Download Posts\n\t\t\t\t\t//alert(\"hello world\");\n\t\t\t\t\tdownloadPosts();\n\t\t\t\t});\n\t\t\t})\n\t\t\t}\n\t\t}\n)\n\t\n}", "function hasStarted() {\n return window.location.href.indexOf(\"http://www3.nhk.or.jp/\") > -1; \n}", "function getDeslideSupportedSites() {\n return { \n 'about.com': '*.about.com', 'accessatlanta.com': '*.accessatlanta.com', 'answers.com': '*.answers.com', 'aol.com': '*.aol.com', 'askmen.com': '*.askmen.com', 'bleacherreport.com': '*.bleacherreport.com', 'cafemom.com': '*.cafemom.com', 'cbslocal.com': '*.cbslocal.com', 'cnn.com': '*.cnn.com', 'competitor.com': '*.competitor.com', 'complex.com': '*.complex.com', 'egotastic.com': '*.egotastic.com', 'eonline.com': '*.eonline.com', 'ew.com': '*.ew.com', 'fark.com': '*.fark.com', 'forbes.com': '*.forbes.com', 'howstuffworks.com': '*.howstuffworks.com', 'ibtimes.com': '*.ibtimes.com', 'imageshack.us': '*.imageshack.us', 'instyle.com': '*.instyle.com', 'latimes.com': '*.latimes.com', 'likes.com': '*.likes.com', 'mercurynews.com': '*.mercurynews.com', 'metromix.com': '*.metromix.com', 'msn.com': '*.msn.com', 'nymag.com': '*.nymag.com', 'nytimes.com': '*.nytimes.com', 'omaha.com': '*.omaha.com', 'photobucket.com': '*.photobucket.com', 'reuters.com': '*.reuters.com', 'seriouseats.com': '*.seriouseats.com', 'sfgate.com': '*.sfgate.com', 'slate.com': '*.slate.com', 'talkingpointsmemo.com': '*.talkingpointsmemo.com', 'theglobeandmail.com': '*.theglobeandmail.com', 'time.com': '*.time.com', 'topix.com': '*.topix.com', 'uproxx.com': '*.uproxx.com', 'viralnova.com': '*.viralnova.com', 'wtnh.com': '*.wtnh.com', 'yahoo.com': '*.yahoo.com', 'diply.com': '*diply.com', 'wildammo.com': '*wildammo.com', //' ': 'Coppermine galleries', // huh?\n 'abcnews.go.com': 'abcnews.go.com', \n 'espn.go.com': 'espn.go.com', 'all-that-is-interesting.com': 'all-that-is-interesting.com', 'animal.discovery.com': 'animal.discovery.com', 'arstechnica.com': 'arstechnica.com', 'austin.culturemap.com': 'austin.culturemap.com', 'blastr.com': 'blastr.com', 'blog.chron.com': 'blog.chron.com', 'blog.laptopmag.com': 'blog.laptopmag.com', 'blog.makezine.com': 'blog.makezine.com', 'blog.moviefone.com': 'blog.moviefone.com', 'blog.seattlepi.com': 'blog.seattlepi.com', 'blog.timesunion.com': 'blog.timesunion.com', 'blog.amctv.com': 'blogs.amctv.com', 'blog.laweekly.com': 'blogs.laweekly.com', 'bossip.com': 'bossip.com', 'boston.com': 'boston.com', 'thestreet.com': 'business-news.thestreet.com', 'bustedcoverage.com': 'bustedcoverage.com', 'buzzlie.com': 'buzzlie.com', 'celebritytoob.com': 'celebritytoob.com', 'celebuzz.com': 'celebslam.celebuzz.com', 'coed.com': 'coed.com', 'coedmagazine.com': 'coedmagazine.com', 'collegecandy.com': 'collegecandy.com', 'kiplinger.com': 'content.kiplinger.com', 'dailycaller.ca': 'dailycaller.ca', 'dailycaller.com': 'dailycaller.com', 'dailysanctuary.com': 'dailysanctuary.com', 'dallas.culturemap.com': 'dallas.culturemap.com', 'darkroom.baltimoresun.com': 'darkroom.baltimoresun.com', 'deadspin.com': 'deadspin.com', 'definition.org': 'definition.org', 'diffuser.fm': 'diffuser.fm', 'dvice.com': 'dvice.com', 'einestages.spiegel.de': 'einestages.spiegel.de', 'emgn.com': 'emgn.com', 'empireonline.com': 'empireonline.com', 'english.caixin.com': 'english.caixin.com', \n 'fansided.com': 'fansided.com', 'fashion.telegraph.co.uk': 'fashion.telegraph.co.uk', 'firstwefeast.com': 'firstwefeast.com', 'flavorwire.com': 'flavorwire.com', 'fu-berlin.de': 'fu-berlin.de', 'funnie.st': 'funnie.st', 'gamedayr.com': 'gamedayr.com', 'gamerant.com': 'gamerant.com', 'gamingbolt.com': 'gamingbolt.com', 'gawker.com': 'gawker.com', // Gawker Are Fucking Dead\n 'gizmodo.com': 'gizmodo.com', 'gothamist.com': 'gothamist.com', 'guff.com': 'guff.com', 'guyism.com': 'guyism.com', 'hdden.com': 'hdden.com', 'heavy.com': 'heavy.com', 'heldendesalltags.net': 'heldendesalltags.net', 'hollywoodlife.com': 'hollywoodlife.com', 'houston.culturemap.com': 'houston.culturemap.com', 'humorsignals.com': 'humorsignals.com', 'idolator.com': 'idolator.com', 'images.businessweek.com': 'images.businessweek.com', 'imgur.com': 'imgur.com', 'io9.com': 'io9.com', 'jalopnik.com': 'jalopnik.com', 'jezebel.com': 'jezebel.com', 'juicyceleb.com': 'juicyceleb.com', 'justviral.eu': 'justviral.eu', 'kittentoob.com': 'kittentoob.com', 'kotaku.com': 'kotaku.com', 'lifehacker.com': 'lifehacker.com', 'listcovery.com': 'listcovery.com', 'lotsoflaughters.com': 'lotoflaughters.com', 'm.n4g.com': 'm.n4g.com', 'm.spiegel.de': 'm.spiegel.de', 'madamenoire.com': 'madamenoire.com', 'makezine.com': 'makezine.com', 'mashable.com': 'mashable.com', 'mediacenter.dailycamera.com': 'mediacenter.dailycamera.com', 'mediagallery.usatoday.com': 'mediagallery.usatoday.com', 'menify.com': 'menify.com', 'mentalflare.com': 'mentalflare.com', 'metv.com': 'metv.com', 'mommynoire.com': 'mommynoire.com', 'motherjones.com': 'motherjones.com', 'moviesum.com': 'movieseum.com', 'msn.foxsports.com': 'msn.foxsports.com', 'myfox8.com': 'myfox8.com', 'n4g.com': 'n4g.com', 'natmonitor.com': 'natmonitor.com', 'news.cincinnati.com': 'news.cincinnati.com', 'news.cnet.com': 'news.cnet.com', 'news.discovery.com': 'news.discovery.com', 'news.moviefone.com': 'news.moviefone.com', 'news.nationalgeographic.com': 'news.nationalgeographic.com', 'news.xinhuanet.com': 'news.xinhuanet.com', 'nflspinzone.com': 'nflspinzone.com', 'noisey.vice.com': 'noisey.vice.com', 'nypost.com': 'nypost.com', 'opinion.people.com.cn': 'opinion.people.com.cn', 'origin.wtsp.com': 'origin.wtsp.com', 'perezhilton.com': 'perezhilton.com', 'photos.caixin.com': 'photos.caixin.com', 'photos.denverpost.com': 'photos.denverpost.com', 'photos.ellen.warnerbros.com': 'photos.ellen.warnerbros.com', 'photos.nj.com': 'photos.nj.com', 'photos.pennlive.com': 'photos.pennlive.com', 'photos.tmz.com': 'photos.tmz.com', 'photos.toofab.com': 'photos.toofab.com', 'picasaweb.google.com': 'picasaweb.google.com', 'popnhop.com': 'popnhop.com', 'puppytoob.com': 'puppytoob.com', 'pyz.am': 'pyz.am', 'radaronline.com': 'radaronline.com', 'rantchic.com': 'rantchic.com', 'regretfulmorning.com': 'regretfulmorning.com', 'reviews.cnet.com': 'reviews.cnet.com', 'ripbird.com': 'ripbird.com', 'rottenpanda.com': 'rottenpanda.com', 'runt-of-the-web.com': 'runt-of-the-web.com', 'salary.com': 'salary.com', 'screencrush.com': 'screencrush.com', 'screenrant.com': 'screenrant.com', 'seattletimes.com': 'seattletimes.com', 'seattletimes.nwsource.com': 'seattletimes.nwsource.com', 'shortlist.com': 'shortlist.com', 'slideshow.nbcnews.com': 'slideshow.nbcnews.com', 'slideshow.today.com': 'slideshow.today.com', 'slideshows.collegehumor.com': 'slideshows.collegehumor.com', 'socialitelife.com': 'socialitelife.com', 'static.thefrisky.com': 'static.thefrisky.com', 'story.wittyfeed.com': 'story.wittyfeed.com', 'styleblazer.com': 'styleblazer.com', 'sz-magazin.sueddeutsche.de': 'sz-magazin.sueddeutsche.de', 'theblemish.com': 'theblemish.com', 'thehill.com': 'thehill.com', 'theweek.com': 'theweek.com', 'thewire.co.uk': 'thewire.co.uk', 'time.com': 'time.com', 'travel.allwomenstalk.com': 'travel.allwomenstalk.com', // always wonder how to parse this - \"all women's talk\" or \"all women stalk\"??\n 'twentytwowords.com': 'twentytwowords.com', 'venturebeat.com': 'venturebeat.com', 'viewmixed.com': 'viewmixed.com', 'wallstcheatsheet.com': 'wallstcheatsheet.com', 'whatculture.com': 'whatculture.com', 'worldwideinterweb.com': 'worldwideinterweb.com', 'worthly.com': 'worthly.com', 'wtkr.com': 'wtkr.com', 'wtvr.com': 'wtvr.com', '10best.com': 'www.10best.com', '123inspiration.com': 'www.123inspiration.com', '29-95.com': 'www.29-95.com', 'aarp.org': 'www.aarp.org', 'adweek.com': 'www.adweek.com', 'ajc.com': 'www.ajc.com', 'animalplanet.com': 'www.animalplanet.com', 'aolnews.com': 'www.aolnews.com', 'art-magazin.de': 'www.art-magazin.de', 'autobild.de': 'www.autobild.de', 'azcentral.com': 'www.azcentral.com', 'azfamily.com': 'www.azfamily.com', 'babble.com': 'www.babble.com', 'baltimoresun.com': 'www.baltimoresun.com', 'bankrate.com': 'www.bankrate.com', 'bbc.co.uk': 'www.bbc.co.uk', 'bbc.com': 'www.bbc.com', 'belfasttelegraph.co.uk': 'www.belfasttelegraph.co.uk', 'bellasugar.com': 'www.bellasugar.com', 'berliner-zeitung.de': 'www.berliner-zeitung.de', 'bild.de': 'www.bild.de', 'bizjournals.com': 'www.bizjournals.com', 'blastr.com': 'www.blastr.com', 'bleedingcool.com': 'www.bleedingcool.com', 'bloomberg.com': 'www.bloomberg.com', 'bobvila.com': 'www.bobvila.com', 'bonappetit.com': 'www.bonappetit.com', 'boredlion.com': 'www.boredlion.com', 'boston.com': 'www.boston.com', 'bostonherald.com': 'www.bostonherald.com', 'bracketsdaily.com': 'www.bracketsdaily.com', 'brainjet.com': 'www.brainjet.com', 'break.com': 'www.break.com', 'brisbanetimes.com.au': 'www.brisbanetimes.com.au', 'brobible.com': 'www.brobible.com', // ew\n 'buddytv.com': 'www.buddytv.com', 'businessinsider.com': 'www.businessinsider.com', 'businessnewsdaily.com': 'www.businessnewsdaily.com', 'bustle.com': 'www.bustle.com', 'buzzfeed.com': 'www.buzzfeed.com', 'buzzsugar.com': 'www.buzzsugar.com', 'bytesized.me': 'www.bytesized.me', 'canberratimes.com.au': 'www.canberratimes.com.au', 'casasugar.com': 'www.casasugar.com', 'cbc.ca': 'www.cbc.ca', 'cbs.com': 'www.cbs.com', 'cbsnews.com': 'www.cbsnews.com', 'cbssports.com': 'www.cbssports.com', 'celebritynetworth.com': 'www.celebritynetworth.com', 'celebstyle.com': 'www.celebstyle.com', // ' ': 'www.celebuzz.com', \n 'celebzen.com': 'www.celebzen.com', 'celebzen.com.au': 'www.celebzen.com.au', 'chacha.com': 'www.chacha.com', 'cheatcc.com': 'www.cheatcc.com', 'chicagotribune.com': 'www.chicagotribune.com', 'chip.de': 'www.chip.de', 'chron.com': 'www.chron.com', 'cinemablend.com': 'www.cinemablend.com', 'cio.com': 'www.cio.com', 'classicfm.com': 'www.classicfm.com', 'clickorlando.com': 'www.clickorlando.com', 'cnbc.com': 'www.cnbc.com', 'cntraveler.com': 'www.cntraveler.com', 'collegehumor.com': 'www.collegehumor.com', 'comicbookmovie.com': 'www.comicbookmovie.com', 'complexmag.ca': 'www.complexmag.ca', 'complexmag.com': 'www.complexmag.com', 'computerworld.com': 'www.computerworld.com', 'corriere.it': 'www.corriere.it', 'cosmopolitan.co.uk': 'www.cosmopolitan.co.uk', 'cosmopolitan.com ': 'www.cosmopolitan.com', 'courant.com': 'www.courant.com', 'cracked.com': 'www.cracked.com', 'csmonitor.com': 'www.csmonitor.com', 'csoonline.com': 'www.csoonline.com', 'ctnow.com': 'www.ctnow.com', 'dailyfunlists.com': 'www.dailyfunlists.com', 'dailygazette.com': 'www.dailygazette.com', 'dallasobserver.com': 'www.dallasobserver.com', 'darkreading.com': 'www.darkreading.com', 'daytondailynews.com': 'www.daytondailynews.com', 'delish.com': 'www.delish.com', 'designsponge.com': 'www.designsponge.com', 'desmoinesregister.com': 'www.desmoinesregister.com', 'digitalone.com.sg': 'www.digitalone.com.sg', 'digitalspy.co.uk': 'www.digitalspy.co.uk', 'digitalspy.com': 'www.digitalspy.com', 'digitalspy.com.au': 'www.digitalspy.com.au', 'dispatch.com': 'www.dispatch.com', 'dorkly.com': 'www.dorkly.com', 'ebaumsworld.com': 'www.ebaumsworld.com', 'elle.com': 'www.elle.com', 'empireonline.com': 'www.empireonline.com', 'entertainmentwise.com': 'www.entertainmentwise.com', 'environmentalgraffiti.com': 'www.environmentalgraffiti.com', 'escapehere.com': 'www.escapehere.com', 'esquire.com': 'www.esquire.com', 'everyjoe.com': 'www.everyjoe.com', 'eweek.com': 'www.eweek.com', 'examiner.com': 'www.examiner.com', 'fabsugar.com': 'www.fabsugar.com', 'fame10.com': 'www.fame10.com', 'fastcodesign.com': 'www.fastcodesign.com', 'faz.net': 'www.faz.net', 'fieldandstream.com': 'www.fieldandstream.com', 'fitsugar.com': 'www.fitsugar.com', 'flavorwire.com': 'www.flavorwire.com', 'focus.de': 'www.focus.de', 'food.com': 'www.food.com', 'foodandwine.com': 'www.foodandwine.com', 'footballnation.com': 'www.footballnation.com', 'foreignpolicy.com': 'www.foreignpolicy.com', 'fox2now.com': 'www.fox2now.com', 'fox40.com': 'www.fox40.com', 'fox59.com': 'www.fox59.com', 'fox5sandiego.com': 'www.fox5sandiego.com', 'foxnews.com': 'www.foxnews.com', 'fr-online.de': 'www.fr-online.de', 'gameranx.com': 'www.gameranx.com', 'gamesblog.it': 'www.gamesblog.it', 'gamespot.com': 'www.gamespot.com', 'gamesradar.com': 'www.gamesradar.com', 'geeksaresexy.net': 'www.geeksaresexy.net', 'geeksugar.com': 'www.geeksugar.com', 'gigwise.com': 'www.gigwise.com', 'gizmopod.com': 'www.gizmopod.com', 'golf.com': 'www.golf.com', 'gq.com': 'www.gq.com', 'grated.com': 'www.grated.com', 'guardian.co.uk': 'www.guardian.co.uk', 'haikudeck.com': 'www.haikudeck.com', 'harpersbazaar.com': 'www.harpersbazaar.com', 'health.com': 'www.health.com', 'heise.de': 'www.heise.de', 'hgtvremodels.com': 'www.hgtvremodels.com', 'highrated.net': 'www.highrated.net', 'hitfix.com': 'www.hitfix.com', 'hlntv.com': 'www.hlntv.com', 'hollyscoop.com': 'www.hollyscoop.com', 'hollywood.com': 'www.hollywood.com', 'hollywoodreporter.com': 'www.hollywoodreporter.com', 'hollywoodtuna.com': 'www.hollywoodtuna.com', 'houstonpress.com': 'www.houstonpress.com', 'huffingtonpost.com': 'www.huffingtonpost.*', // TODO\n 'idolator.com': 'www.idolator.com', 'ign.com': 'www.ign.com', 'imdb.com': 'www.imdb.com', 'informationweek.com': 'www.informationweek.com', 'infoworld.com': 'www.infoworld.com', 'irishcentral.com': 'www.irishcentral.com', 'itworld.com': 'www.itworld.com', 'ivillage.com': 'www.ivillage.com', 'kare11.com': 'www.kare11.com', 'katu.com': 'www.katu.com', 'kentucky.com': 'www.kentucky.com', 'kicker.de': 'www.kicker.de', 'killsometime.com': 'www.killsometime.com', 'kiplinger.com': 'www.kiplinger.com', 'kitv.com': 'www.kitv.com', 'ktla.com': 'www.ktla.com', 'ktvu.com': 'www.ktvu.com', 'kvia.com': 'www.kvia.com', 'laudable.com': 'www.laudable.com', 'laweekly.com': 'www.laweekly.com', 'life.com': 'www.life.com', 'lifebuzz.com': 'www.lifebuzz.com', 'lifedaily.com': 'www.lifedaily.com', 'lifescript.com': 'www.lifescript.com', 'lilsugar.com': 'www.lilsugar.com', 'littlethings.com': 'www.littlethings.com', 'livescience.com': 'www.livescience.com', 'livestrong.com': 'www.livestrong.com', 'local10.com': 'www.local10.com', 'london2012.com': 'www.london2012.com', 'makezine.com': 'www.makezine.com', 'mandatory.com': 'www.mandatory.com', 'marketwatch.com': 'www.marketwatch.com', 'mcall.com': 'www.mcall.com', 'menshealth.com': 'www.menshealth.com', 'miamiherald.com': 'www.miamiherald.com', 'mirror.co.uk': 'www.mirror.co.uk', 'mlive.com': 'www.mlive.com', 'mnn.com': 'www.mnn.com', 'monopol-magazin.de': 'www.monopol-magazin.de', 'motherjones.com': 'www.motherjones.com', 'myfox8.com': 'www.myfox8.com', 'myhealthnewsdaily.com': 'www.myhealthnewsdaily.com', 'mysanantonio.com': 'www.mysanantonio.com', 'nationaltimes.com.au': 'www.nationaltimes.com.au', 'nba.com': 'www.nba.com', 'nbc.com': 'www.nbc*', // TODO\n 'nbcnews.com': 'www.nbcnews.com', 'networkworld.com': 'www.networkworld.com', 'neverunderdressed.com': 'www.neverunderdressed.com', 'news800.com': 'www.news800.com', 'newsarama.com': 'www.newsarama.com', 'newser.com': 'www.newser.com', 'newstimes.com': 'www.newstimes.com', 'newyorker.com': 'www.newyorker.com', 'nfl.com': 'www.nfl.com', 'ngz-online.de': 'www.ngz-online.de', 'nj.com': 'www.nj.com', 'nme.com': 'www.nme.com', 'notsafeforwhat.com': 'www.notsafeforwhat.com', 'npr.org': 'www.npr.org', 'nsmbl.nl': 'www.nsmbl.nl', 'numberfire.com': 'www.numberfire.com', 'nuts.co.uk': 'www.nuts.co.uk', 'nydailynews.com': 'www.nydailynews.com', 'nypost.com': 'www.nypost.com', 'ocregister.com': 'www.ocregister.com', 'ocweekly.com': 'www.ocweekly.com', 'officialplaystationmagazine.co.uk': 'www.officialplaystationmagazine.co.uk', 'omghacks.com': 'www.omghacks.com', 'opposingviews.com': 'www.opposingviews.com', 'oregonlive.com': 'www.oregonlive.com', 'orlandosentinel.com': 'www.orlandosentinel.com', 'ouramazingplanet.com': 'www.ouramazingplanet.com', 'parenting.com': 'www.parenting.com', 'parents.com': 'www.parents.com', 'parentsociety.com': 'www.parentsociety.com', 'pcgamer.com': 'www.pcgamer.com', 'pcmag.com': 'www.pcmag.com', 'pcworld.com': 'www.pcworld.com', 'people.com': 'www.people.com', 'peoplepets.com': 'www.peoplepets.com', 'peoplestylewatch.com': 'www.peoplestylewatch.com', 'petsugar.com': 'www.petsugar.com', 'philly.com': 'www.philly.com', 'phoenixnewtimes.com': 'www.phoenixnewtimes.com', 'politico.com': 'www.politico.com', 'popcrunch.com': 'www.popcrunch.com', 'popsci.com': 'www.popsci.com', 'popsugar.com': 'www.popsugar.com', 'popularmechanics.com': 'www.popularmechanics.com', 'press-citizen.com': 'www.press-citizen.com', 'pressroomvip.com': 'www.pressroomvip.com', 'q13fox.com': 'www.q13fox.com', 'ranker.com': 'www.ranker.com', 'rantchic.com': 'www.rantchic.com', 'rantfood.com': 'www.rantfood.com', 'rantlifestyle.com': 'www.rantlifestyle.com', 'rantsports.com': 'www.rantsports.com', 'rd.com': 'www.rd.com', 'readersdigest.ca': 'www.readersdigest.ca', 'realclearscience.com': 'www.realclearscience.com', 'realclearworld.com': 'www.realclearworld.com', 'realsimple.com': 'www.realsimple.com', 'realtor.com': 'www.realtor.com', 'rebelcircus.com': 'www.rebelcircus.com', 'redeyechicago.com': 'www.redeyechicago.com', 'refinedguy.com': 'www.refinedguy.com', 'refinery29.com': 'www.refinery29.com', 'repubblica.it': 'www.repubblica.it', 'riverfronttimes.com': 'www.riverfronttimes.com', 'roasted.com': 'www.roasted.com', 'rollingstone.com': 'www.rollingstone.com', 'rottenpanda.com': 'www.rottenpanda.com', 'rottentomatoes.com': 'www.rottentomatoes.com', 'rp-online.de': 'www.rp-online.de', 'rsvlts.com': 'www.rsvlts.com', // 'salary.com': 'www.salary.com', \n 'salon.com': 'www.salon.com', 'savvysugar.com': 'www.savvysugar.com', 'seattlepi.com': 'www.seattlepi.com', 'seattleweekly.com': 'www.seattleweekly.com', 'sfweekly.com': 'www.sfweekly.com', 'sfx.co.uk': 'www.sfx.co.uk', 'shape.com': 'www.shape.com', 'shebudgets.com': 'www.shebudgets.com', 'shefinds.com': 'www.shefinds.com', 'shortlist.com': 'www.shortlist.com', 'si.com': 'www.si.com', 'slideshare.net': 'www.slideshare.net', 'sltrib.com': 'www.sltrib.com', 'smh.com.au': 'www.smh.com.au', 'smithsonianmag.com': 'www.smithsonianmag.com', 'snakkle.com': 'www.snakkle.com', 'southernliving.com': 'www.southernliving.com', 'space.com': 'www.space.com', 'spiegel.de': 'www.spiegel.de', 'spin.com': 'www.spin.com', 'sportal.de': 'www.sportal.de', 'sportsradiokjr.com': 'www.sportsradiokjr.com', 'stamfordadvocate.com': 'www.stamfordadvocate.com', 'star-telegram.com': 'www.star-telegram.com', 'starpulse.com': 'www.starpulse.com', 'stereogum.com': 'www.stereogum.com', 'stereotude.com': 'www.stereotude.com', 'stern.de': 'www.stern.de', 'stuff.co.nz': 'www.stuff.co.nz', 'stuffyoushouldknow.com': 'www.stuffyoushouldknow.com', 'stylebistro.com': 'www.stylebistro.com', 'stylelist.com': 'www.stylelist.com', 'stylist.co.uk': 'www.stylist.co.uk', 'sueddeutsche.de': 'www.sueddeutsche.de', 'suggest.com': 'www.suggest.com', 'sun-sentinel.com': 'www.sun-sentinel.com', 'tagesschau.de': 'www.tagesschau.de', 'tagesspiegel.de': 'www.tagesspiegel.de', 'takepart.com': 'www.takepart.com', 'techconnect.com': 'www.techconnect.com', 'technewsdaily.com': 'www.technewsdaily.com', 'techradar.com': 'www.techradar.com', 'techrepublic.com': 'www.techrepublic.com', 'techworld.com.au': 'www.techworld.com.au', 'telegraph.co.uk': 'www.telegraph.co.uk', 'theage.com.au': 'www.theage.com.au', 'theatlantic.com': 'www.theatlantic.com', 'thedailybeast.com': 'www.thedailybeast.com', 'thedailymeal.com': 'www.thedailymeal.com', 'thefiscaltimes.com': 'www.thefiscaltimes.com', 'thefrisky.com': 'www.thefrisky.com', 'thefumble.com': 'www.thefumble.com', 'theguardian.com': 'www.theguardian.com', 'theleek.com': 'www.theleek.com', 'thelocal.com': 'www.thelocal.*', // TODO\n 'theonion.com': 'www.theonion.com', 'thepostgame.com': 'www.thepostgame.com', 'therichest.com': 'www.therichest.com', 'thesmokinggun.com': 'www.thesmokinggun.com', 'thestreet.com': 'www.thestreet.com', 'thesun.co.uk': 'www.thesun.co.uk', 'thesuperficial.com': 'www.thesuperficial.com', 'thevine.com.au': 'www.thevine.com.au', 'thewrap.com': 'www.thewrap.com', 'thinkadvisor.com': 'www.thinkadvisor.com', 'thisoldhouse.com': 'www.thisoldhouse.com', 'tmz.com': 'www.tmz.com', 'today.com': 'www.today.com', 'tomorrowoman.com': 'www.tomorrowoman.com', 'tomsguide.com': 'www.tomsguide.com', 'tomshardware.com': 'www.tomshardware.com', 'topgear.com': 'www.topgear.com', 'torontosun.com': 'www.torontosun.com', 'totalfilm.com': 'www.totalfilm.com', 'totalprosports.com': 'www.totalprosports.com', 'travelandleisure.com': 'www.travelandleisure.com', 'treehugger.com': 'www.treehugger.com', 'tressugar.com': 'www.tressugar.com', 'trutv.com': 'www.trutv.com', 'tvguide.com': 'www.tvguide.com', 'tvovermind.com': 'www.tvovermind.com', 'upi.com': 'www.upi.com', 'usmagazine.com': 'www.usmagazine.com', 'usnews.com': 'www.usnews.com', 'vanityfair.com': 'www.vanityfair.com', 'vg247.com': 'www.vg247.com', 'vh1.com': 'www.vh1.com', 'vice.com': 'www.vice.com', 'villagevoice.com': 'www.villagevoice.com', 'viralands.com': 'www.viralands.com', 'vulture.com': 'www.vulture.com', 'washingtonpost.com': 'www.washingtonpost.com', 'watoday.com.au': 'www.watoday.com.au', 'wbaltv.com': 'www.wbaltv.com', 'wcvb.com': 'www.wcvb.com', 'weather.com': 'www.weather.com', 'weblyest.com': 'www.weblyest.com', 'welt.de': 'www.welt.de', 'wesh.com': 'www.wesh.com', 'westworld.com': 'www.westword.com', 'wftv.com': 'www.wftv.com', 'wgal.com': 'www.wgal.com', 'whas11.com': 'www.whas11.com', 'wholeliving.com': 'www.wholeliving.com', 'wired.co.uk': 'www.wired.co.uk', 'wired.com': 'www.wired.com', 'wisn.com': 'www.wisn.com', 'wittyfeed.com': 'www.wittyfeed.com', 'wlac.com': 'www.wlac.com', 'wlsam.com': 'www.wlsam.com', 'wlwt.com': 'www.wlwt.com', 'wmtw.com': 'www.wmtw.com', 'wowthatscool.com': 'www.wowthatscool.com', 'wpix.com': 'www.wpix.com', 'wptv.com': 'www.wptv.com', 'wsbtv.com': 'www.wsbtv.com', 'wtae.com': 'www.wtae.com', 'wtkr.com': 'www.wtkr.com', 'wtsp.com': 'www.wtsp.com', 'wusa9.com': 'www.wusa9.com', 'wwe.com': 'www.wwe.com', 'wwtdd.com': 'www.wwtdd.com', 'yumsugar.com': 'www.yumsugar.com', 'zagat.com': 'www.zagat.com', 'zap2it.com': 'www.zap2it.com', 'zdnet.com': 'www.zdnet.com', 'zeit.de': 'www.zeit.de', 'zimbio.com': 'www.zimbio.com', 'www2.tbo.com': 'www2.tbo.com', 'xfinity.comcast.net': 'xfinity.comcast.net', 'xhamster.com': 'xhamster.com' // not sure about this one\n };\n}", "function monitorCurrentPage() {\n $('#monitor_page').addClass('inprogress');\n chrome.tabs.getSelected(null, function(tab) {\n initializePageModePickerPopup(tab);\n _gaq.push(['_trackEvent', tab.url, 'add']);\n\n chrome.tabs.getAllInWindow(null, function(tabs){\n var found = false;\n for (var i = 0; i < tabs.length; i++) {\n if(tabs[i].url == chrome.extension.getURL(\"options.htm\")) \n {\n found = true;\n break;\n }\n }\n \n if (found == false)\n {\n chrome.tabs.create({url: \"options.htm\", active: false});\n }\n addPage({url: tab.url, name: tab.title}, function() {\n BG.takeSnapshot(tab.url);\n });\n});\n \n });\n}", "function check_site(url,testing_cb,down_cb,up_cb) {\n $.getJSON('/list',\n function(list) {\n \tconsole.log(list)\n for (var i = 0; i < list.length; i++) {\n var minion = list[i]\n ex_check_site(url,minion,testing_cb,down_cb,up_cb)\n }\n });\n}", "function ciHomePanels(panel) {\r\n if(panel == \"news\") {\r\n\tjQuery(\"#ciHomeNewsTab > a\").css(\"color\",\"#074377\");\r\n\tjQuery(\"#ciHomeVideoTabs > a\").css(\"color\",\"#c2e1fe\");\r\n\tjQuery(\"#ciHomeTabsNav\").css(\"backgroundPosition\",\"-5674px 0px\");\r\n\tjQuery(\"#ciNewsPnl\").css(\"display\",\"block\");\r\n\tjQuery(\"#ciVideoPnl\").css(\"display\",\"none\");\r\n }\r\n if(panel == \"video\") {\r\n\tjQuery(\"#ciHomeNewsTab > a\").css(\"color\",\"#c2e1fe\");\r\n\tjQuery(\"#ciHomeVideoTabs > a\").css(\"color\",\"#074377\");\r\n\tjQuery(\"#ciHomeTabsNav\").css(\"backgroundPosition\",\"-5946px 0px\");\r\n\tjQuery(\"#ciNewsPnl\").css(\"display\",\"none\");\r\n\tjQuery(\"#ciVideoPnl\").css(\"display\",\"block\");\r\n\tlnkTrackVals(\"vdo:video tab\"); //Video Tab and Video headlines link tracking\r\n }\r\n}", "isSpecialPage(href, linkNode, currentHref, window) {\r\n let blocked;\r\n try {\r\n // for the moment just do it for Google and Yahoo....\r\n // tvguide.com - added 2013-07-20\r\n // duckduckgo.com - added 2014-12-24\r\n // jetbrains.com - added 2016-05-01\r\n let re = /duckduckgo.com|tvguide.com|google|yahoo.com|jetbrains.com|github.io|github.com/;\r\n blocked = re.test(currentHref);\r\n // youtube.com - added 2013-11-15\r\n if (!blocked && /youtube.com/.test(currentHref) &&\r\n (!this.isGMEnabled(window) || decodeURI(href).indexOf(\"return false;\") == -1)) {\r\n blocked = true;\r\n } else if (!blocked) {\r\n // make sure external links in developer.mozilla.org open new tab\r\n let uri = Services.io.newURI(currentHref);\r\n let host = uri && uri.host;\r\n blocked = host == \"developer.mozilla.org\" && linkNode.host != host &&\r\n linkNode.classList.contains(\"external\");\r\n }\r\n } catch (ex) {\r\n blocked = false;\r\n }\r\n return blocked;\r\n }", "function check_site(val) {\n if ($('#checkName').val() == '' || $('#checkName').val() != val) {\n if (val != '' && val.length <= 25) {\n $(this).ajaxStart(function () {\n $('#busy-indicator').show();\n $('#unavailable').hide();\n $('#available').hide();\n });\n\n $(\"#loading\").ajaxStop(function () {\n $('#busy-indicator').hide();\n });\n\n $('#checkResponse').val($.ajax({\n url:'/sites/check_site_name',\n type:'post',\n async:false,\n data:{data:{site:val}},\n success:function (responce) {\n if (responce != 1) {\n $('#available').show();\n $('#unavailable').hide();\n } else {\n $('#available').hide();\n $('#unavailable').show();\n }\n $('#busy-indicator').hide();\n }\n }).responseText);\n } else {\n $('#busy-indicator').hide();\n $('#checkResponse').val(1);\n }\n } else {\n $('#available').show();\n $('#checkResponse').val('');\n }\n}", "async _check(currentUrl, refererUrl) {\n this.urlCache.add(currentUrl);\n\n const { html, isHtml, status } = await this._getHTML(currentUrl);\n\n if (status >= 300) {\n this.result.fail++;\n this.logger.error(chalk.red('#%s [%s] request %s, referer %s'),\n this.result.count++, status, currentUrl, refererUrl || '');\n return;\n }\n\n this.result.success++;\n this.logger.info(chalk.green('#%s [%s] request %s'), this.result.count++, status, currentUrl);\n\n if (!isHtml) {\n // ignore non-html file\n return;\n }\n\n const linkUrls = this._getUrls(html, currentUrl);\n for (const linkUrl of linkUrls) {\n if (!linkUrl) continue;\n const linkHost = url.parse(linkUrl).host;\n // ignore when it has cached or host is not allow\n if (!this.urlCache.has(linkUrl) && this.allowHost.includes(linkHost)) {\n await this._check(linkUrl, currentUrl);\n }\n }\n }", "async function checkStoreAvailability(){\n const store_url = document.querySelector('#store_url').value\n if(store_url.length < 3){\n document.querySelector('.store-url-error').style.display = 'block';\n }\n else{\n document.querySelector('.store-url-error').style.display = 'none';\n const response = await fetch(`/url/check/${store_url}`)\n if (response.status === 400){\n document.querySelector('.url-error').style.display = 'block';\n }\n else{\n document.querySelector('#url-anchor').innerHTML = `https://usell.com/@${store_url}`;\n document.querySelector('#url-anchor').href = `/@${store_url}`;\n document.querySelector('.url-error').style.display = 'none';\n }\n }\n}", "function checkExcludeURLStatus() {\n var excludeStatus = false,\n urls = settings.excludeURL,\n len = urls.length,\n i = -1,\n href = document.referrer;\n\n while (++i < len && !excludeStatus) {\n if (url_check_equals(urls[i], href)) {\n excludeStatus = true;\n }\n }\n return excludeStatus;\n }", "function check_current_window_status(test)\n{\n manage_crash();\n\n if (PV_API)\n {\n var active_status = \"Inactive\";\n var windows_list = get_main_windows_list();\n\n var active_windows_list = get_active_windows_list();\n\n if (windows_list.indexOf(localStorage.active_window) < 0)\n {\n //last actived windows is not alive anymore!\n //remove_from_main_windows_list(localStorage.active_window);\n\n //set the last added window, as active_window\n localStorage.active_window = windows_list[windows_list.length - 1];\n }\n\n if (! document[PV_API.hidden])\n {\n //Window's page is visible\n localStorage.active_window = current_window_id;\n }\n\n if (localStorage.active_window == current_window_id)\n {\n active_status = \"Active\";\n }\n\n if (active_status == \"Active\")\n {\n active_windows_list = add_to_active_windows(current_window_id);\n }\n else\n {\n active_windows_list = remove_from_active_windows(current_window_id);\n }\n\n console.log(test, active_windows_list);\n\n var element_holder = document.getElementById(\"holder_element\");\n element_holder.insertAdjacentHTML(\"afterbegin\", \"<div>\"+element_holder.childElementCount+\") Current Windows is \"+ active_status +\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"+active_windows_list.length+\" window(s) is visible and active of \"+ windows_list.length +\" windows</div>\");\n }\n else\n {\n console.log(\"PageVisibility API is not supported :(\");\n //our INACTIVE pages, will remain INACTIVE forever, you need to make some action in this case!\n }\n\n localStorage.last_update = Date.now();\n}", "function TabManager() {\n this.lastOpenTabId, this.previousSearchTerm, this.currentSearchTerm, \n this.currentTabId, this.currentUrl, this.previousUrl;\n this.isNewUrl = function(tab) {\n return this.currentUrl.href != tab.url.href;\n }\n \n this.checkCurrentTabIsSearchPage = function() {\n console.log(\"checking if this is a search page\");\n console.log(this.currentUrl.href + \" \" + this.currentUrl.hostname);\n currentHostName = this.currentUrl.hostname;\n var isDomainUrl = searchDomains.some(function(rx) { \n return rx.test(currentHostName); \n }); \n console.log(isDomainUrl);\n return isDomainUrl;\n }\n\n this.updateTabInfo = function(tab) {\n this.previousUrl = this.currentUrl;\n this.previousTabId = this.currentTabId;\n this.currentTabId = tab.id;\n this.currentUrl = new URL(tab.url);\n this.previousSearchTerm = this.currentSearchTerm;\n this.currentSearchTerm = searchDict.getCurrentSearchTerm(tab.id, tab.url);\n };\n\n this.getSelectedSearchTerm = function() {\n return this.currentSearchTerm; \n }\n\n this.updateData = function(tab) {\n //if this is a webpage and not a blank page\n if (tab.url) {\n //if this is a page update\n if(this.previousUrl.href != this.currentUrl.href) {\n\t if (this.checkCurrentTabIsSearchPage()) {\n\t var newSearchTerm = getSearchTerm(this.currentUrl);\n\t if (newSearchTerm) {\n\t this.currentSearchTerm = getSearchTerm(this.currentUrl);\n\t }\n }\n searchDict.addUrlToTab(this.currentSearchTerm, this.currentTabId, this.currentUrl.href, this.previousTabId, this.previousUrl.href);\n\t console.log(searchDict);\n }\n }\n }\n this.updateExtensionEnabled = function(tab) {\n if(qualifyingProtocols.indexOf(this.currentUrl.protocol) != -1) {\n chrome.browserAction.enable(tab.id); \n updateContextMenu(this.currentSearchTerm);\n }\n } \n}", "function display_external_tab_content(scale_title){\n var scaled_result = $(scale_title + \"_results\");\n var chosen_tab = scaled_result.getElementsByClassName('tabberactive')[0];\n var scale_and_type = chosen_tab.childNodes[0].className;\n //the content could come from external search\n if (scale_and_type.match(\"external_result\") != null){\n scale_and_type = scale_and_type.split('external_result')[0];\n var resource_type = scale_and_type.split('_')[1].strip();\n $(resource_type).show();\n }\n\n}", "function getActiveSites() {\n developer.Api('/plugins/' + FS__API_PLUGIN_ID + '/installs.json', 'GET', [], [], function (sites) {\n // list active sites\n console.log(JSON.parse(sites));\n\n // list just the active site URLs\n JSON.parse(sites).installs.forEach(function(site) {\n console.log(site.url);\n });\n });\n}", "function checkVisits(){\n\t\tif(localStorage.visits == 1){\n\t\t\t//No class will be toggled, the popup will remain invisible to user and screenreader.\n\t\t\tconsole.log(\"User has visited this site before.\");\n\t\t}else{\n\t\t\tsetTimeout(makeVisible, 3000); //Delays the popup for 3 seconds\n\t\t\tconsole.log(\"User has never visited this site before.\");\n\t\t}\n\t}", "function whichPage(){\n if ( document.URL.includes(\"index.html\") ) {\n $(\"#home-btn\").addClass('actives');\n // hoverAbout();\n // hoverResume();\n // hoverWriting();\n\n } else if ( document.URL.includes(\"about.html\") ) {\n $(\"#about-btn\").addClass('actives');\n // hoverHome();\n // hoverResume();\n // hoverWriting();\n } else if ( document.URL.includes(\"writing\") ) {\n $(\"#writing-btn\").addClass('actives');\n // hoverAbout();\n // hoverResume();\n // hoverHome();\n } else if ( document.URL.includes(\"resume\") ) {\n $(\"#resume-btn\").addClass('actives');\n // hoverAbout();\n // hoverHome();\n // hoverWriting();\n }\n}", "async function updateExecution() {\n const options = await loadOptions();\n const currentUrl = window.location.href;\n\n if (\n !isUrlAccepted(\n currentUrl,\n options.enabledSites,\n options.disabledSites\n )\n ) {\n interrupt();\n } else {\n start(options);\n }\n }", "function checkForValidUrl(tabId, changeInfo, tab) {\n\tlastTabId = tabId;\n // If the letter 'g' is found in the tab's URL...\n if (tab.url.indexOf('fr.vente-privee.com') > -1 && tab.url.indexOf('https://secure.fr.vente-privee.com') === -1) {\n // ... show the page action.\n chrome.pageAction.show(tabId);\n }\n}", "function updateButtonsState() {\n // Enable/Disable the Monitor This Page button.\n chrome.tabs.getSelected(null, function(tab) {\n isPageMonitored(tab.url, function(monitored) {\n if (monitored || !tab.url.match(/^https?:/)) {\n $('#monitor_page').unbind('click').addClass('inactive');\n $('#monitor_page img').attr('src', 'img/monitor_inactive.png');\n var message = monitored ? 'page_monitored' : 'monitor';\n $('#monitor_page span').text(chrome.i18n.getMessage(message));\n } else {\n // $('#monitor_page').click(monitorCurrentPage).removeClass('inactive');\n $('#monitor_page img').attr('src', 'img/monitor.png');\n $('#monitor_page span').text(chrome.i18n.getMessage('monitor'));\n }\n });\n });\n\n // Enable/Disable the View All button.\n if ($('#notifications .notification').length) {\n $('#view_all').removeClass('inactive');\n $('#view_all img').attr('src', 'img/view_all.png');\n \n } else {\n $('#view_all').addClass('inactive');\n $('#view_all img').attr('src', 'img/view_all_inactive.png');\n }\n \n\n // Enable/disable the Check All Now button.\n getAllPageURLs(function(urls) {\n getAllUpdatedPages(function(updated_urls) {\n if (urls.length == 0) {\n $('#check_now').addClass('inactive');\n $('#check_now img').attr('src', 'img/refresh_inactive.png');\n } else {\n $('#check_now').removeClass('inactive');\n $('#check_now img').attr('src', 'img/refresh.png');\n }\n });\n });\n initializePageCheck();\n}", "function loadpage() {\n var pageurl = window.location.href;\n\n //On page load, the content of all the 4 product types is disabled\n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n\n //Below line reads the product type selected by the user in dashboard page \n var product = getParameterByName('producttype', window.location.href.toLowerCase());\n if (pageurl.toLowerCase().indexOf(\"?producttype=\") > 0) {\n\n //If the user clicks Accept.js product type in the dashboard page, the following code gets executed.\n if (product == \"acceptjs\") {\n\n //The product type selected by the user in the dashboard page is assigned to the activeCont variable which is used for future reference\n activeCont = \"acceptjs\";\n\n //Below function checks if customer ID is passed in the request URL \n checkForCustomerIdInUrl(pageurl)\n }\n\n //If the user clicks Accept.js UI product type in the dashboard page, the following code gets executed\n else if (product == \"acceptui\") {\n\n //The product type selected by the user in the dashboard page is assigned to the activeCont variable which is used for future reference\n activeCont = \"acceptui\";\n\n //Below function checks if customer ID is passed in the request URL \n checkForCustomerIdInUrl(pageurl)\n }\n\n //If the user clicks Accept Hosted product type in the dashboard page, the following code gets executed.\n else if (product == \"accepthosted\") {\n activeCont = \"accepthosted\";\n\n //Below logic is to check if there are more than one parameter passed in the URL \n if (pageurl.toLowerCase().indexOf(\"&\") > 0) {\n \n //Customer ID is an optional parameter for Accept Hosted product type\n //Below code gets executed when the user passes customer id in the request URL\n if (pageurl.toLowerCase().indexOf(\"&customerid=\") > 0) {\n var id = getParameterByName('customerid', window.location.href.toLowerCase());\n\n //Validation of customer id will be done by using the below function\n var result = ValidateCustomer(id);\n\n //If the customer id is a valid id, then AcceptHosted function gets executed\n if (result.valid)\n {\n AcceptHosted(id);\n }\n else {\n\n //If the invalid customer id declared in the URL, then user gets redirected to the error message section\n var elements = document.getElementsByClassName(\"productCont\");\n\n //The content of all the 4 product types is disabled on the page\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Customer not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n }\n //Below code gets executed when the user passes when there are more than one parameters (other than customer id) which are invalid in the request URL\n else {\n\n //Below code gets executed when user passes invalid parameters in the URL \n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n\n }\n }\n else {\n\n //When customer id parameter is not passed in the URL, AcceptHosted function gets executed\n AcceptHosted('');\n }\n }\n\n //If the user clicks Accept Customer product type in the dashboard page, the following code gets executed.\n else if (product == \"acceptcustomer\") {\n activeCont = \"acceptcustomer\";\n\n //Below line populates the customer id textbox with a valid customer id\n document.getElementById(\"txtCustomerId\").value = globalVars.ValidCustomer;\n \n //Below code gets executed when the user passes customer id in the request URL\n if (pageurl.toLowerCase().indexOf(\"&customerid=\") > 0) {\n\n document.getElementById(\"acceptCustomer\").style.display = \"none\";\n\n //Below line gets the customer id declared in the url by the user\n var id = getParameterByName('customerid', window.location.href.toLowerCase());\n\n //Below function checks if the customer id is already validated or not\n //Customer id validaton occurs on click of continue button in dashboard and on accept customer page load\n //In order to avoid multiple validation requests to API, storing the validation status in the session storage\n var customerIdValidationStatus = sessionStorage.getItem('isValidated');\n\n //If customer id is not validated\n if (customerIdValidationStatus != \"true\") {\n\n //Validation of customer id will be done by using the below function\n var result = ValidateCustomer(id);\n\n //If the customer id is a valid id, then AcceptCustomer function gets executed\n if (result.valid)\n {\n AcceptCustomer(id);\n }\n else {\n\n //If the invalid customer id declared in the URL, then user gets redirected to the error message section\n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Customer not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n\n }\n //If customer id is already validated in dashboard page\n else {\n AcceptCustomer(id);\n sessionStorage.setItem('isValidated', 'false');\n }\n }\n else {\n\n //If customer id is not provided in the URL, a pop up to enter customer id is displayed.\n document.getElementById(\"acceptCustomer\").style.display = \"block\";\n }\n }\n else {\n\n //Below code gets executed when user passes invalid product type parameters in the URL \n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n }\n else {\n\n //Below code gets executed when user passes invalid product type parameters in the URL \n if (document.getElementById(\"invalidPage\") != null) {\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n }\n}", "function openSelectedUrls() {\n commonLookup.getUserTltSetting().then((tlt) => {\n let urls = getSelectedUrls(tlt.userTltSetting.fixUrlQuotEnd,tlt.userTltSetting.blobUrlToLocal);\n let limit = Number(tlt.userTltSetting.openPagesLimit);\n if (urls.length > limit) {\n urls = urls.slice(0, limit);\n alert(commonLookup.getMessage(tlt.userTltSetting.locale,tlt.userTltSetting.localeData,\"tabsLimitAlert\").format(tlt.userTltSetting.openPagesLimit));\n }\n browser.runtime.sendMessage({\n cmd: commonLookup.actlist.serverOpenTabs,\n data: urls\n });\n });\n}", "function hostIsApplicable(url) {\n var anchor = document.createElement('a');\n anchor.href = url;\n var pattern;\n for (var i = 0; i < APPLICABLE_HOSTS.length; i++) {\n pattern = new RegExp(APPLICABLE_HOSTS[i]);\n if (pattern.test(anchor.hostname)) {\n return true;\n }\n }\n return false;\n}", "function checkStatus() {\n if (imageGallery.supportsAvif !== null && imageGallery.supportsWebp !== null) {\n imageGallery.showOverlay(imageIndex);\n return;\n }\n }", "function in_array(value, array, tab) { \n for (var i = 0; i < array.length; i++) {\n \n if(value.indexOf(siteList[i]) > -1) { \n var localIndex = parseInt(localStorage.getItem('localStorage entries'));\n\n if (localStorage.getItem(tab.url) === null) {\n localIndex = localIndex + 1;\n localStorage.setItem('localStorage entries', localIndex); \n }\n // Push URL to LocalStorage as a key and siteList name as a value\n localStorage.setItem(tab.url, siteList[i]); \n return true; \n }\n }\nreturn false;\n}", "function showTab() {\n var url = window.location.href;\n if(url.indexOf('/get_started/why_mxnet') != -1) return;\n for(var i = 0; i < TITLE.length; ++i) {\n if(url.indexOf(TITLE[i]) != -1) {\n var tab = $($('#main-nav').children().eq(i));\n if(!tab.is('a')) tab = tab.find('a').first();\n tab.css('border-bottom', '3px solid');\n }\n }\n}", "function checkWidth() {\n if (($(window).width() >= bp_med)) {\n // Show all li selectors\n $('.tabs-course_browser_list-tabs > li').css('display', 'inline-block');\n }\n else {\n // Display list-item for all li selectors\n $('.tabs-course_browser_list-tabs > li').css('display', 'list-item');\n // Hide all li selectors expect first one\n $('.tabs-course_browser_list-tabs > li:gt(0)').hide();\n }\n }", "function checkWhatToLoad(){\n var hrefPath = \"\";\n var url = \"\";\n currModuleType = $(\"#template-menu\").attr(\"data-current-module-type\");\n sideType = $(\"#template-menu\").attr(\"data-side\");\n url = $(\"#template-menu\").attr(\"data-href\").replace(urlCharDeeplink,'');\n prevURL = urlCharDeeplink + url;\n if( templateFirstRun == true ){\n var checkURL = document.URL;\n checkURL = checkURL.replace(templateBaseURL, \"\");\n var hashURL = \"\";\n if(checkURL.indexOf(urlCharDeeplink) == -1 && checkURL != \"\"){\n if( checkURL == \"index.html\" || checkURL == \"index.htm\" ){\n checkURL = \"\";\n if( checkURL == \"\" && customPageStart == true ){\n checkURL = customPageStartURL;\n checkURL = checkURL.replace(templateBaseURL, \"\");\n }\n checkURL = checkURL.replace(urlCharDeeplink, \"\");\n checkURL = checkURL.substring( checkURL.lastIndexOf(\"/\") + 1);\n hashURL = updateMenu(checkURL, prevURL, false, true);\n window.location.hash = hashURL;\n }\n else{\n checkURL = checkURL.replace(urlCharDeeplink, \"\");\n checkURL = checkURL.substring( checkURL.lastIndexOf(\"/\") + 1);\n hashURL = updateMenu(checkURL, prevURL, false, true);\n window.location.href = templateBaseURL + hashURL;\n }\n }\n else{\n if( checkURL == \"\" && customPageStart == true ){\n checkURL = customPageStartURL;\n checkURL = checkURL.replace(templateBaseURL, \"\");\n url = customPageStartURL.replace(urlCharDeeplink, \"\");\n }else{\n checkURL = checkURL.replace(urlCharDeeplink, \"\");\n checkURL = checkURL.substring( checkURL.lastIndexOf(\"/\") + 1);\n checkURL = (checkURL != \"\" && checkURL != urlCharDeeplink) ? checkURL : url;\n url = checkURL;\n\n if( checkURL.indexOf(\"index.html\") != -1 || checkURL.indexOf(\"index.htm\") != -1){\n checkURL = checkURL.substring( checkURL.lastIndexOf(urlCharDeeplink) + 1);\n }\n }\n checkURL = checkURL.replace(urlCharDeeplink, \"\");\n checkURL = checkURL.substring( checkURL.lastIndexOf(\"/\") + 1);\n hashURL = updateMenu(checkURL, prevURL, false, true);\n window.location.hash = hashURL;\n }\n }\n hrefPath = oldMenuData[3];\n hrefPath = (hrefPath == undefined) ? \"\" : hrefPath;\n setMobileMenuOption(oldMenuData[2]);\n $(\"#module-container\").empty();\n\t\t$(\"#module-container\").load( hrefPath + url + ' title, #module-container > *', firstRunLoaded );\n\n }", "function hrefCheck(currentLocation) {\r\n if (window.location.href.includes(currentLocation)) {\r\n console.log(\"Applying script for: \" + currentLocation);\r\n iCurrentHref = currentLocation;\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function updateVars() {\n var url = location.href;\n // if user on the same tab, they've kept surfing it, so add time\n chrome.storage.sync.get(\"active_tab\", (response) => {\n if (url === response.active_tab) {\n // from: https://stackoverflow.com/questions/154059/how-can-i-check-for\n // -an-empty-undefined-null-string-in-javascript\n if (url) { // url cannot be null or undefined\n // url cannot be empty, blank, or contain only white space\n //if (!(url === \"\") && !(url.trim().length === 0) && !url.trim()) {\n if (!(url === \"\")) {\n var website;\n if ((url.slice(0, 7) === \"http://\") ||\n (url.slice(0, 8) === \"https://\")) {\n website = url.split(\"/\")[2]; // the url after http or https\n } else {\n website = url.split(\"/\")[0]; // the url has no http or https\n }\n if (website.length > 0) {\n increaseTime(website);\n }\n }\n }\n }\n })\n}", "function CheckCountrySelector(formId, defaultvalue, isgloballist, sitecountrycode, blockID) {\n\n var globallistpresent = isgloballist;\n var trueflag = \"true\";\n\n var selected = document.getElementById(formId).elements[\"country\"].options[document\n .getElementById(formId).elements[\"country\"].selectedIndex].value;\n if (defaultvalue == selected) {\n //alert(\" not selected any thing\"+defaultvalue);\n fnLinkFullUI(errorMessage, blockID);\n return false;\n } else {\n if (globallistpresent == trueflag) {\n //alert(\"list is global normal flow\");\n //open all the URL in same window for \"global_list\" as per the\n //ticket requirment DHL-1973\n window.open(selected, \"_parent\");\n return false;\n } else {\n if (selected.indexOf(sitecountrycode) >= 0) {\n //if selected list is other than \" gloabl_locator\"\n //then if country selected is same as country of site\n //open url in same window\n window.open(selected, \"_parent\");\n return false;\n }\n\n else if (selected.indexOf(\"http\") >= 0\n || selected.indexOf(\"https\") >= 0) {\n\n //if country selected is diffrent then\n //noraml flow /since normol-flow open all the url in new window\n window.open(selected, \"DHL\");\n return false;\n } else {\n // if any case is not covered\n //then open URL in new window as normal flow\n return true;\n }\n\n }\n\n }\n}", "function showHostsAndSettingsMode() {\r\n console.log('entering show hosts and settings mode.');\r\n $('#backIcon').hide();\r\n $('#quitCurrentApp').hide();\r\n $(\".mdl-layout__header\").show();\r\n $(\"#main-content\").children().not(\"#listener, #loadingSpinner, #naclSpinner\").show();\r\n $(\"#game-grid\").hide();\r\n $(\"#main-content\").removeClass(\"fullscreen\");\r\n $(\"#listener\").removeClass(\"fullscreen\");\r\n $(\"body\").css('backgroundColor', 'white');\r\n // We're no longer in a host-specific screen. Null host, and add it back to the polling list\r\n if(api) {\r\n beginBackgroundPollingOfHost(api);\r\n api = null; // and null api\r\n }\r\n}", "function WhatPage(){\n if (window.location.href.includes(\"hackforums.net/member.php?action=profile&uid=\")){\n RunOnEveryPage();\n RunOnProfile();\n return;\n }\n if (window.location.href.includes(\"hackforums.net/managegroup.php?gid=\")){\n RunOnEveryPage();\n HighlightUser();\n return;\n }\n else{\n RunOnEveryPage();\n return;\n }\n}", "function finally_it_has_loaded_its_stuff() {\r\n if (domaindata.settings.debug_logging)\r\n $(\".onlyifdebug\").show();\r\n // Create the table of resources and make it sortable\r\n generateTable();\r\n $(\"#resourceslist\").tablesorter({\r\n headers: { 0: {sorter:false}, 4: {sorter:false}},\r\n cancelSelection: true,\r\n sortList: [[3,0],[1,0],[3,0]]\r\n });\r\n $(\"#resourceslist tbody tr\").mouseenter(function() {\r\n if ($(this).hasClass('selected'))\r\n return;\r\n $(this).children(\":not(:first-child)\").\r\n css(\"border-top\", \"black 1px dotted\").\r\n css(\"border-bottom\", \"black 1px dotted\");\r\n });\r\n $(\"#resourceslist tr\").mouseleave(function() {\r\n $(this).children().\r\n css(\"border\", \"none\");\r\n });\r\n\r\n // Close the legend\r\n $(\"#legend a\").click(function(event) {\r\n event.preventDefault();\r\n $(\"#legend\").remove();\r\n });\r\n\r\n // An item has been selected\r\n $('.clickableRow, input:enabled', '#resourceslist').click(function() {\r\n if ($('.selected','#resourceslist').length > 0)\r\n return; //already selected a resource\r\n $(\"#choosedifferentresource\").show();\r\n $(\"#choosedifferentresource\").click(function() {\r\n document.location.reload();\r\n });\r\n $(this).parents('tr').addClass('selected');\r\n $(\"#resourceslist tr:not(.selected)\").remove();\r\n $(\"#resourceslist tr input\").\r\n attr('checked', 'checked').\r\n attr('disabled', 'disabled');\r\n $('.clickableRow').removeClass('clickableRow');\r\n $('#resourceslist tr').css('border', 'black 1px dotted');\r\n $('#legend').remove();\r\n \r\n // Show the 'choose url' area\r\n $(\"#selectblockableurl\").show();\r\n generateFilterSuggestions();\r\n // If the user clicks the 'next' button\r\n $(\"#confirmUrl\").click(function() {\r\n if ($('#custom:checked').length == 1 && \r\n $('#customurl').val().trim() == '') {\r\n alert(translate('novalidurlpattern'));\r\n return;\r\n }\r\n // Hide unused stuff\r\n $(\"#selectblockableurl input:radio:not(:checked)\").\r\n nextUntil('input').remove();\r\n $(\"#selectblockableurl input:radio:not(:checked)\").remove();\r\n $(\"#confirmUrl\").next().remove();\r\n $(\"#confirmUrl\").remove();\r\n $(\"#selectblockableurl *:not(br):not(b)\").attr(\"disabled\", \"disabled\");\r\n\r\n // Show the options\r\n $(\"#chooseoptions\").show();\r\n var domainOfSelectedUrl = $(\".selected td:nth-of-type(2)\").\r\n attr('title').replace(/^[a-z]{0,5}\\:\\/\\//, '').match(/^[^\\/]+/)[0];\r\n var isThirdParty = CheckThirdParty(domain, domainOfSelectedUrl);\r\n if (!isThirdParty) {\r\n $(\"#thirdparty + * + *\").remove();\r\n $(\"#thirdparty + *\").remove();\r\n $(\"#thirdparty\").remove();\r\n } else\r\n // Use .find().text() so data from query string isn't injected as HTML\r\n $(\"#thirdparty + label\").\r\n html(translate(\"thirdpartycheckbox\", \"<i></i>\")).\r\n find(\"i\").text(GetThirdPartyDomain(domainOfSelectedUrl));\r\n $(\"#domainlist\").\r\n val(domain.replace(/^www\\./, '')).\r\n click(function() {\r\n $(\"#domainis\").\r\n attr(\"checked\", \"checked\").\r\n change();\r\n }).\r\n keyup(function() {\r\n if (isValidDomainList($(this).val().trim().\r\n replace(/[a-z](\\ |\\,\\ ?|\\;\\ ?)\\~?[a-z0-9]/gi,'a|a'))){\r\n $(\"#domainis\").val('domain=' + \r\n $(this).val().trim().replace(/(\\ |\\,|\\;)+/g,'|'));\r\n $(\"#domainlist\").css('color', 'black');\r\n } else {\r\n $(\"#domainis\").val('');\r\n $(\"#domainlist\").css('color', 'red');\r\n }\r\n $(\"#filterpreview\").text(createfilter());\r\n });\r\n $(\"#domainis\").val('domain=' + domain.replace(/^www\\./, ''));\r\n var selectorForFixedType = '[value=\"~' + \r\n $(\".selected td:nth-of-type(3)\").attr('name') + '\"]';\r\n $(selectorForFixedType).attr('disabled', 'disabled');\r\n\r\n // Update the preview filter\r\n $(\"#chooseoptions *\").change(function() {\r\n $(\"#filterpreview\").text(createfilter());\r\n });\r\n $(\"#filterpreview\").text(createfilter());\r\n\r\n // Add the filter\r\n $(\"#addthefilter\").click(function() {\r\n BGcall('add_custom_filter', createfilter(), function() {\r\n alert(translate(\"filterhasbeenadded\"));\r\n window.close();\r\n });\r\n });\r\n });\r\n });\r\n }", "function checkStatus(website, callback){\n var r = null;\n website = extractDomain(website);\n\tchrome.storage.sync.get({dpalertlist: []}, function(res){\n\t\tvar blacklist = res.dpalertlist;\n\n if(blacklist.indexOf(website) === -1){\n if(callback) callback(false);\n }else{\n if(callback) callback(true);\n }\n });\n}", "function checkQflowOpen() {\r\n\t\tchrome.tabs.query({url: \"http://834s-qflow-pa.its.unimelb.edu.au/*\"},\r\n\t\t\tfunction(tabs) {\r\n\t\t\t\tif (tabs.length > 0) {\r\n\t\t\t\t\tqflowActive = true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tqflowActive = false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t// isEnabled is true if notifications are allowed to be sent\r\n\t\t\t\tif (!qflowActive) {\r\n\t\t\t\t\tchrome.browserAction.setIcon({path: QFLOW_CLOSED});\r\n\t\t\t\t} else if (qflowActive && !isEnabled && isAuth) {\r\n\t\t\t\t\tchrome.browserAction.setIcon({path: QFLOW_PAUSED});\r\n\t\t\t\t} else if (qflowActive && isEnabled && isAuth) {\r\n\t\t\t\t\tchrome.browserAction.setIcon({path: QFLOW_ACTIVE});\r\n\t\t\t\t} else {\r\n\t\t\t\t\tchrome.browserAction.setIcon({path: QFLOW_ERROR});\r\n\t\t\t\t}\r\n\t\t} );\r\n}", "function checkContent(element) {\n\n var social_media_name = element.id.replace('_input_button', '');\n var social_media_name_ph = element.id.replace('_button', '');\n\n if ($(\"#\" + social_media_name_ph + \"_field\").val() !== \"https://www.\" + social_media_name + \".com/\" && $(\"#\" + social_media_name_ph + \"_field\").val().indexOf((\"https://www.\" + social_media_name + \".com/\")) > -1) {\n\n window.temp_url = $(\"#\" + social_media_name_ph + \"_field\").val();\n $(\"#\" + social_media_name + \"_long\").html(\"<i class='fa fa-\" + social_media_name + \"'></i>\" + $(\"#\" + social_media_name_ph + \"_field\").val());\n $(\"#\" + social_media_name + \"_long\").hide();\n $(\"#\" + social_media_name + \"_input\").hide();\n window.temp_soc_med_name = social_media_name;\n\n /*\n * Insert new url\n */\n\n $.ajax({\n url: 'https://proxy.uretimosb.com/SlimProxyBoot.php',\n// url: 'http://proxy.uretimosb.com:9990/SlimProxyBoot.php',\n data: {\n url: 'pkInsert_infoFirmSocialmedia',\n pk: $(\"#pk\").val(),\n npk: $(\"#selectedCompanyNpk\").val(),\n language_code: $(\"#langCode\").val(),\n sys_socialmedia_id: window.selected_soc_med_id,\n firm_link: window.temp_url,\n profile_public: 0\n },\n method: \"GET\",\n dataType: \"json\",\n success: function (data) {\n if (data['errorInfo'][0] === '00000') {\n\n var appending =\n \"<div class='btn-group' id='\"\n + social_media_name\n + \"_btn_group_\"\n + data.lastInsertId\n + \"' url_value='\"\n + window.temp_url\n + \"'>\"\n + \"<a id='\"\n + social_media_name\n + \"_button_\"\n + data.lastInsertId\n + \"' class='btn btn-social-icon dropdown-toggle btn-\"\n + social_media_name\n + \"' data-toggle='dropdown' aria-expanded='false' target='_newtab' \"\n + \" \"\n + \"style='margin-left:5px'>\"\n + \"<i class='fa fa-\"\n + social_media_name\n + \"'></i>\"\n + \"</a>\"\n + \"<button type='button' class='btn dropdown-toggle btn-\"\n + social_media_name\n + \"' data-toggle='dropdown' aria-expanded='false'>\"\n + \"<span class='caret'></span>\"\n + \"<span class='sr-only'>Toggle Dropdown</span>\"\n + \"</button>\"\n + \"<ul class='dropdown-menu' role='menu'>\"\n + \"<li class='btn' id='\"\n + social_media_name\n + \"_goto_btn_'\"\n + data.lastInsertId\n + \"' onclick='goto_social(this)'>\"\n + window.lang.translate('Goto')\n + \"</li><br/>\"\n// + \"<li class='btn' id='\"\n// + social_media_name\n// + \"_edit_btn' onclick='edit_social(this)'>\"\n// + window.lang.translate('Edit')\n// + \"</li><br/>\"\n + \"<li class='btn' id='\"\n + social_media_name\n + \"_remove_btn_'\"\n + data.lastInsertId\n + \"' soc_id_val='\"\n + data.lastInsertId\n + \"' onclick='remove_social(this)'>\"\n + window.lang.translate('Delete')\n + \"</li>\"\n + \"</ul>\"\n + \"</div>\";\n\n $('#ava_med_ph').append(appending);\n }\n }\n });\n\n\n } else {\n\n $(\"#\" + social_media_name + \"_long\").show();\n $(\"#\" + social_media_name + \"_input\").hide();\n var default_value = \"https://www.\" + social_media_name + \".com/\";\n $(\"#\" + social_media_name_ph + \"_field\").val(default_value);\n }\n}", "function continueExecution(){\n\n w.document.body.appendChild(testStatus);\n w.document.body.appendChild(testProgressBadLinks);\n w.document.body.appendChild(testProgressGoodLinks);\n w.document.body.appendChild(testProgressExternalLinks);\n w.document.body.appendChild(testProgressExcludedLinks); \n w.document.body.appendChild(testProgressTotal);\n \n testProgressGoodLinks.style.width = \"100%\";\n testProgressBadLinks.style.width = \"100%\";\n testProgressExternalLinks.style.width = \"100%\"; \n testProgressExcludedLinks.style.width = \"100%\"; \n testProgressTotal.style.width = \"100%\";\n \n testStatus.innerHTML = '<h1>Link Test Started for ' + pageTitle + '</h1>'\n\n // begin for loop over links here\n for (var i = 0 ; i < links.length; i++)\n {\n\n url = links[i].href;\n\n // begin switch statement to elimintate exclusions\n \n // begin enclosing function to test url to see if it contains some restricted locations, then open up a http request to the page and see if the page exists\n function test(url) {\n // begin switch statement to elimintate exclusions\n switch (true) {\t\n // begin case statement to test for exclusions\n case links[i].host !== location.host:\n // console.log(\"Matched a url that is an external link\");\n totalLinksExternal = totalLinksExternal + 1\n totalLinksExcluded = totalLinksExcluded + 1\n linkInfoExternal = linkInfoExternal + '<span class=\"external\">' + totalLinksExternal.toString() + ') <strong>External</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoExcluded = linkInfoExcluded + '<span class=\"external\">' + totalLinksExcluded.toString() + ') <strong>External</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"external\" style=\"background-color:plum\">' + (i+1).toString() + ') <strong>External</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n break;\n case /layouts/gi.test(url):\n // console.log(\"Matched a url that contains 'layouts'\");\n totalLinksExcluded = totalLinksExcluded + 1\n linkInfoExcluded = linkInfoExcluded + '<span class=\"excluded\">' + totalLinksExcluded.toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"excluded\" style=\"background-color:yellow\">' + (i+1).toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n break;\n case /file/gi.test(url):\n // console.log(\"Matched a url that contains 'file'\");\n totalLinksExcluded = totalLinksExcluded + 1\n linkInfoExcluded = linkInfoExcluded + '<span class=\"excluded\">' + totalLinksExcluded.toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"excluded\" style=\"background-color:yellow\">' + (i+1).toString() + ') <strong>Excluded</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n break;\n default:\n // console.log(\"this link is okay to test\");\n // console.log(url);\n \n // the next line opens the link and gets the status of the http request. Comment out when testing or working on visual design\n var http = new XMLHttpRequest();\n http.open('HEAD', url, false);\n \n // begin try catch block to test for error on send\n try {\n http.send();\n var response = http.status;\n console.log(response);\n \n if (http.status == 200){\n // console.log(\"found a good link\");\n // console.log(response);\n totalLinksGood = totalLinksGood + 1\n linkInfoGood = linkInfoGood + '<span class=\"good\">' + totalLinksGood.toString() + ') <strong>Good</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"good\" style=\"background-color:LightGreen\">' + (i+1).toString() + ') <strong>Good</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n var linksTested = parseInt(linksTested);\n var linksTested = linksTested++;\n \n } else if (http.status == 404) {\n // console.log(\"found a broken link\");\n // console.log(response);\n totalLinksBad = totalLinksBad + 1\n linkInfoBad = linkInfoBad + '<span class=\"broken\">' + totalLinksBad.toString() + ') <strong>Broken</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n linkInfoTotal = linkInfoTotal + '<span class=\"broken\" style=\"background-color:LightCoral\">' + (i+1).toString() + ') <strong>Broken</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n var linksTested = parseInt(linksTested);\n var linksTested = linksTested++;\n \n } else {\n \n // console.log(\"something else is happening here\");\n // console.log(response);\n linkInfoTotal = linkInfoTotal + '<span class=\"something else\" style=\"background-color:LightBlue\">' + (i+1).toString() + ') <strong>Something Else</strong> ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n var linksTested = parseInt(linksTested);\n var linksTested = linksTested++;\n \n // end if statement to test http status\n }\n \n } catch (e) {\n \n console.log(e);\n // end try catch block to test for error on send\n // linkInfoTotal = linkInfoTotal + '<span class=\"something else\">' + i.toString() + ') ' + links[i].href + ' = ' + linkAnchors[i].text + '</span><br />'\n // var linksTested = parseInt(linksTested);\n // var linksTested = linksTested++;\n \n // end try catch block to test for error on send\n }\n \n break;\n // end case statement to test for exclusions\n \n // end switch statement to elimintate exclusions\n }\n // end enclosing function to test url to see if it contains some restricted locations, then open up a http request to the page and see if the page exists\n }\n \n // call enclosing function to test url to see if it contains some restricted locations, then open up a http request to the page and see if the page exists\n test(url);\n\n // end for loop over links here\n }\n\n\ntestStatus.innerHTML = '<h1>Link Test Finished for: ' + pageTitle + '</h1>'\n\n// alert(linksTested);\n// testProgressGoodLinks.innerHTML = 'Total Links: ' + totalLinks + '<br /> Links Tested: ' + linksTested.toString() + '<br />'\n// testProgressGoodLinks.textContent = linkInfo\n\ntestProgressTotal.innerHTML = '<h2>Total Links: ' + totalLinks + '</h2>' + linkInfoTotal\ntestProgressBadLinks.innerHTML = '<h2>Total Bad Links: ' + totalLinksBad + '</h2>' + linkInfoBad\ntestProgressExternalLinks.innerHTML = '<h2>Total External Links: ' + totalLinksExternal + '</h2>' + linkInfoExternal\ntestProgressExcludedLinks.innerHTML = '<h2>Total Excluded Links: ' + totalLinksExcluded + '</h2>' + linkInfoExcluded\ntestProgressGoodLinks.innerHTML = '<h2>Total Good Links: ' + totalLinksGood + '</h2>' + linkInfoGood\n\n// end contintueExecution function here\n}", "function webSiteInfo() {\n var featureRelId = getUrlVars()['transferId'];\n var userSiteId = getUrlVars()['touchId'];\n var featureId = getUrlVars()['mId'];\n\tvar featureName = getUrlVars()['featureName'];\n\tfeatureName = featureName.replace(/\\%20/g,' ');\n\tfeatureNameTitle(featureName);\n\t\n var url = baseUrl + 'web/web/getMenuHtml/' + featureId + '/' + featureRelId + '/' + userSiteId;\n\n var data = '';\n doAjaxCall(url, data, false, function (html) {\n if ($.isEmptyObject(html)) {\n $('#main-content').html('Sorry we have an Empty data');\n } else {\n\n var data = '<ul data-role=\"listview\" data-inset=\"false\" data-divider-theme=\"d\" id=\"aboutclass\">';\n $.each(html, function (i, item) {\n\t\t\t\n if (i == 0) { addBackground(item); }\n\t\t\t\t if (i % 2 == 0) {\n className = 'evenbg';\n } else {\n className = 'oddbg';\n }\n data += '<li src=\"' + item.url + '\"><a href=\"detail.html?id=' + i + '&transferId=' + featureRelId + '&touchId=' + userSiteId + '&mId=' + featureId + '&return_url=' + item.url + '&featureName=' + item.name + '\" class=\"'+className+'\" rel=\"external\" >';\n\t\t\t\t\tif(item.thumbnail ==''){\n\t\t\t\tdata\t+= '<img src=\"'+baseUrl+'assets/images/nobutton.png\" >';\n\t\t\t\t}else{\n\t\t\t\tdata\t+= '<img src=\"'+baseUrl+item.thumbnail+'\">';\t\n\t\t\t\t}\t\n\t\t\t\tdata += item.name + ' </a></li>';\n\t\t\t\t\n\n })\n data += '</ul>';\n $('#main-content').html(data);\n\n try {\n $(\"#aboutclass\").listview('refresh');\n } catch (e) {\n $(\"#aboutclass\").listview();\n }\n var backGroundColor=html[0].globalBackground;\n var textColor=html[0].globalTextColor;\n $('#main-content').css({ 'background-color': '#' + backGroundColor, 'color': '#' + textColor });\n \n if(isMobile.iOS()){\n \n var im=html[0].iphone5Background;\n $('#main-content').css('backgroundImage','url('+baseUrl+'/'+im+')');\n $('#main-content').css('background-size','100%');\n }else{\n var im=html[0].mobileBackground;\n $('#main-content').css('backgroundImage','url('+baseUrl+'/'+im+')');\n $('#main-content').css('background-size','100%');\n }\n }\n // for background color and images \n\n\t\t\t\n\n// end of it\n getUserAppereance();\n });\n}", "function checkPageStatus(device_ID, queue_ID, processID, loadingProcessID, downloadType) {\n\n\n\t// If being force reinternalizing, update the URL\n\tremoveQueryArgFromCurrentUrl('redownload');\n\tremoveQueryArgFromCurrentUrl('ssr');\n\tremoveQueryArgFromCurrentUrl('capture');\n\tremoveQueryArgFromCurrentUrl('new');\n\tremoveQueryArgFromCurrentUrl('secondtry');\n\n\n\t// Get the up-to-date pins\n\tvar statusCheckRequest = ajax('internalize-status',\n\t\t{\n\t\t\t'device_ID': device_ID,\n\t\t\t'queue_ID': queue_ID,\n\t\t\t'processID': processID,\n\t\t\t'page_type': downloadType\n\n\t\t}).done(function (result) {\n\n\n\t\t\tvar data = result.data; console.log('RESULTS: ', result);\n\n\n\t\t\t// LOG\n\t\t\t$.each(data, function (key, value) {\n\n\t\t\t\t// Append the log !!!\n\t\t\t\tconsole.log(key + ': ', value);\n\n\t\t\t});\n\n\n\t\t\t// Update the proggress bar\n\t\t\tvar width = data.processPercentage;\n\t\t\teditProcess(loadingProcessID, width);\n\n\n\t\t\t// Finish the process if done\n\t\t\tif (width == 100)\n\t\t\t\tendProcess(loadingProcessID);\n\n\n\t\t\t// Print the current status\n\t\t\t$('#loading-info').text(Math.round(width) + '% ' + data.processDescription + '...');\n\n\n\t\t\t// Print the error message when stops before completion\n\t\t\tif (data.status == \"not-running\" && data.processStatus != \"ready\" && downloadType != \"capture\") {\n\t\t\t\t$('#loading-info').text('Error');\n\t\t\t\teditProcess(loadingProcessID, 0);\n\t\t\t}\n\n\n\t\t\t// If successfully downloaded\n\t\t\tif (\n\t\t\t\t(width == 100 && data.processStatus == \"ready\") ||\n\t\t\t\t(downloadType == \"capture\" && data.status == \"not-running\")\n\t\t\t) {\n\n\t\t\t\t// Update the global page URL\n\t\t\t\tpage_URL = data.phaseUrl;\n\t\t\t\tconsole.log('PAGE URL: ', page_URL);\n\n\n\t\t\t\t// Redirects\n\t\t\t\tif (\n\t\t\t\t\t(page_URL.startsWith(\"http://\") && currentUrl().startsWith(\"https://\")) ||\n\t\t\t\t\t(page_URL.startsWith(\"https://\") && currentUrl().startsWith(\"http://\"))\n\t\t\t\t) location.reload();\n\n\n\t\t\t\t// Update the iframe url\n\t\t\t\t$('#the-page').attr('src', page_URL);\n\n\n\t\t\t\t// Run the inspector\n\t\t\t\trunTheInspector();\n\n\n\t\t\t\t// Capture mode\n\t\t\t\tif (downloadType == \"capture\") endProcess(loadingProcessID);\n\n\t\t\t}\n\n\n\t\t\t// Restart if not done\n\t\t\tif (data.status != \"not-running\" && data.processStatus != \"ready\") {\n\n\t\t\t\tsetTimeout(function () {\n\n\t\t\t\t\tcheckPageStatus(device_ID, queue_ID, processID, loadingProcessID, downloadType);\n\n\t\t\t\t}, 1000);\n\n\t\t\t}\n\n\n\t\t}).fail(function () {\n\n\n\t\t\t// Abort the latest request if not finalized\n\t\t\tif (statusCheckRequest && statusCheckRequest.readyState != 4) {\n\t\t\t\tconsole.log('Latest status check request aborted');\n\t\t\t\tstatusCheckRequest.abort();\n\t\t\t}\n\n\t\t\tsetTimeout(function () {\n\n\t\t\t\tcheckPageStatus(device_ID, queue_ID, processID, loadingProcessID, downloadType);\n\n\t\t\t}, 1000);\n\n\n\t\t});\n\n\n}", "function checkForValidUrl(tabId, changeInfo, tab) {\n\t// If the url text does not start with 'reddit.com' or 'www.reddit.com' is found in the tab's URL...\n\tif (\n\t\t(tab.url.indexOf('www.reddit.com') == -1)\n\t\t&& (tab.url.indexOf('reddit.com') == -1)\n && (tab.url.indexOf('redd.it') == -1)\n\t\t&& (tab.url.indexOf('chrome://') == -1) ) {\n\t\t\t// ... show the page action.\n\t\t\tchrome.pageAction.show(tabId);\n\t\t}\n}", "function isAtCamp() {\r\n\tvar url = window.location.toString().toLowerCase();\r\n\tif(url == 'http://apps.facebook.com/levynlight/' \r\n\t|| url == 'https://apps.facebook.com/levynlight/' \r\n\t|| url == 'http://apps.facebook.com/levynlight/index.php' \r\n\t|| url == 'https://apps.facebook.com/levynlight/index.php' \r\n\t|| url == 'http://apps.facebook.com/levynlight/turn.php' \r\n\t|| url == 'https://apps.facebook.com/levynlight/turn.php'\r\n\t)\r\n\t\treturn true;\r\n\telse\r\n\t\treturn false;\r\n}", "function listBlockedSites(){\r\n\t\tvar ul = $(\"#settings ul\"),\r\n\t\t\tli, pElm, delDiv;\r\n\r\n\t\t// if atleast one blocked site\r\n\t\tif(Data.blockedSites[0]) ul.html(\"\");\r\n\t\telse{\r\n\t\t\tul.html(\"<li>None Currently</li>\");\r\n\r\n\t\t\treturn; // exit\r\n\t\t}\r\n\r\n\t\tfor(var i = 0, len = Data.blockedSites.length; i < len; i++){\r\n\t\t\tli = document.createElement(\"li\");\r\n\r\n\t\t\tpElm = document.createElement(\"p\");\r\n\t\t\tli.appendChild(pElm.html(Data.blockedSites[i]));\r\n\r\n\t\t\tdelDiv = document.createElement(\"div\");\r\n\t\t\tli.appendChild(delDiv.html(\"Unblock\"));\r\n\r\n\t\t\tul.appendChild(li);\r\n\t\t}\r\n\t}", "function checkIfCount() {\n if(focus == true){ // Is Chrome focused?\n chrome.tabs.query({'active': true, 'lastFocusedWindow': true},\n function(tabs){\n chrome.storage.local.get(['urlList'], function(result) {\n checkReset(1); // checks and resets variables at each new day\n checkUrlInList(tabs, result);\n });\n });\n }\n }", "function LastCall() {\n\tif (urlLength % 2 == 1){\n\t\tOddWindow = window.open(url[count-1]);\n\t\tOddWindow.window.addEventListener('load', function(){\n\t\t\tconsole.log(count-1 + ' Display: ' + !EvenWindow.document.getElementById('sku').style[\"display\"] + ',' + url[count-1]);\n\t\t\tSafeBox.setItem(url[count-1],'Display: ' + !EvenWindow.document.getElementById('sku').style[\"display\"] );\n\t\t\tEvenWindow.close();\n\t\t\tOddWindow.close();\n\t\t});\n\t} else {\n\t\tEvenWindow = window.open(url[count-1]);\n\t\tEvenWindow.window.addEventListener('load', function(){\n\t\t\tconsole.log(count + ' Display: ' + !OddWindow.document.getElementById('sku').style[\"display\"] + ',' + url[count]);\n\t\t\tSafeBox.setItem(url[count],'Display: ' + !OddWindow.document.getElementById('sku').style[\"display\"] );\n\t\t\tOddWindow.close();\n\t\t\tEvenWindow.close();\n\t\t});\n\t}\n}", "function checkOnlineStatuses() {\n\tif(DEBUG) {\n\t\tconsole.group(\"checkOnlineStatuses\");\n\t\tconsole.time(\"checkOnlineStatuses\");\n\t\tconsole.count(\"checkOnlineStatuses count\");\n\t}\n\t\n\tfor (var i in usersOnThisPage) {\n\t\tif(DEBUG) console.debug(\"Retrieving data for user %s.\", i);\n\t\tvar tempULS = getUserLastSeen(i);\n\t\tif(tempULS === null) getUserOptions(i);\n\t\tif((tempULS !== null) && (tempULS != \"false\")) {\n\t\t\tvar tempEvent = document.createEvent(\"UIEvents\");\n\t\t\ttempEvent.initUIEvent(\"user_last_seen_ready\", false, false, window, i);\n\t\t\tdocument.dispatchEvent(tempEvent);\n\t\t}\n\t}\n\t\n\tif(DEBUG) {\n\t\tconsole.timeEnd(\"checkOnlineStatuses\");\n\t\tconsole.groupEnd();\n\t}\n}", "function checkForBuildUrl(tabId, changeInfo, tab) {\n // If the tabs url starts with \"http://specificsite.com\"...\n if (/.*buildkite\\.com\\/[\\w-\\d]+\\/\\w+\\/builds\\/\\d{1,6}(#.*)?$/.test(tab.url)) {\n console.log(\"Whooo! Tab {0} is on buildkite!\".format(tabId));\n chrome.browserAction.enable(tabId);\n\n var build_num = tab.url.match(/.*buildkite\\.com\\/[\\w-\\d]+\\/\\w+\\/builds\\/(\\d{1,6})(#.*)?$/)[1];\n console.log(build_num);\n if (-1 === $.inArray(parseInt(build_num), tracked_builds)) {\n chrome.browserAction.setTitle({'title': \"Track this build!\", 'tabId': tabId});\n } else {\n indicateTabIsTracked(tabId);\n }\n } else {\n chrome.browserAction.disable(tabId);\n chrome.browserAction.setTitle({'title': \"This page is not a trackable build.\", 'tabId': tabId});\n }\n}", "function initTabStatus(){\n\tvar isVirtual = getParameter(\"IsVirtual\");\n\tif(Ext.isTrue(isVirtual)){\n\t\tvar channelType = getParameter(\"channelType\");\n\t\t//由于只使用检索条件的栏目会变成虚栏目,但这3类权限设置都要有,所以不能这样return,否则都不会显示了\n\t\t//if(channelType == \"\" || channelType == 0) return; \n\t\tvar tableObj = document.getElementById(\"id_TRSSimpleTab\").childNodes[0];\n\t\tif(!tableObj)return;\n\t\tif(channelType != \"\" && channelType != 0){\n\t\t\ttableArray = tableObj.getElementsByTagName(\"table\");\n\t\t\ttableArray[m_aRightTypeIds[\"template\"]].parentNode.parentNode.style.display = 'none';\n\t\t}\n\t}\n\tElement.removeClassName('tabTd', 'hideChild');\n}", "function isReviewPage() {\n return window.location.href.match(/^(http|https):\\/\\/www.stumbleupon.com\\/url/i);\n}", "function checkForCustomerIdInUrl(pageurl)\n{\n //Accept.js and Accept.js UI accepts only product type\n //If the user passes customer id to Accept.js or Accept.js UI product type, then user gets redirected to the error message section\n if (pageurl.toLowerCase().indexOf(\"&customerid=\") > 0) {\n\n //The content of all the 4 product types is disabled on the page\n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n\n //Below code gets executed on invalid page request by the user\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n else {\n\n //If the user selects Accept.js UI product type in the dashboard page\n if(activeCont == \"acceptui\")\n {\n document.getElementById(\"acceptui\").style.display = \"block\";\n AcceptUI();\n }\n //If the user selects Accept.js product type in the dashboard page\n else\n {\n document.getElementById(\"acceptjs\").style.display = \"block\";\n\n //By default credit card radio button is selected for accept js \n document.getElementById(\"rdCard\").click();\n }\n }\n}", "function DashboardTabChecker(){\n\t$('#content').on('click', 'a.tab-link', function(e){\n\t\te.preventDefault();\n\t\t$('div#dashboard_tabs').find('div[id^=dashboard]').each(function(){\n\t\t\t$(this).css('visibility', 'hidden').css('position', 'absolute');\n\t\t});\n\t\tvar attr = $(this).attr('id');\n\t\t$('#'+'dashboard-'+attr).css('visibility', 'visible').css('position', 'relative');\n\t\t$(this).closest('.nav').find('li').removeClass('active');\n\t\t$(this).closest('li').addClass('active');\n\t});\n}", "function update_is_hudl(url) {\n\n var is_hudl = is_page_hudl(url);\n\n chrome.storage.local.set({'is_hudl': is_hudl}, function () {\n });\n}", "function checkTabDisplay() {\n\t// Don't display tabs until >1 toys are listed\n\tif (trackedToys<=1) {\n\t\t$('.tab-label').hide();\n\t} else {\n\t\t$('.tab-label').show();\n\t}\n}", "function checkURL(sites) {\n console.log(`🕵️ Checking for updates...`);\n sites.forEach(async (site, index) => {\n await huntForChanges(index);\n\n });\n}", "function displayAvailableColors(apiURL) {\n\ttry {\n\t\t$.getJSON( apiURL, function( json ) {\n\t\t\twindow.availableColors = json;\n\t\t})\n\t\t.error(function() {\n\t\t\tconsole.log(\"No available colors\")\n\t\t})\n\t\t.complete(function() { \n\t\t\t\n\t\t});\n\t}\n\tcatch (err) {\n\t\tconsole.log(err)\n\t}\n}", "function tabsReady() {\n // If the user has already interacted, then disable the automatic tab selection behavior\n if(userInteracted) return false;\n\n // If the user isn't logged in, set recsReady as true for conformity\n if( !$rootScope.isUserLogged() ) {\n recsReady = true;\n }\n // console.log('tabsReady', recsReady, promosReady, episodesReady, webReady);\n // Mark all tabs as ready by checking their individual states\n var tabsReady = ( recsReady && promosReady && episodesReady && webReady );\n\n // We don't want one delayed request to cause a blank screen, so show the first\n // tab that is visible on each check.\n $timeout(function(){\n var tabCount = $tabTriggers.length;\n for(var i = 0; i < tabCount; i++) {\n if( $tabTriggers.eq(i).is(':visible') ) {\n // console.log($tabTriggers.eq(i), i);\n showTab(i);\n break;\n } else {\n // console.log('Index', i, 'is hidden');\n }\n }\n });\n\n // Return the value of tabsReady for debugging purposes\n return tabsReady;\n }", "function check_status() {\n YUI().use(\"io-base\", function(Y) {\n var url = M.cfg.wwwroot+'/local/rlsiteadmin/mass/addonstatus.php?addoncommand='+$response.file+'&hash='+$response.hash;\n var cfg = {\n method: 'GET',\n on: {\n success: function(id, o) {\n var $status = null;\n YUI().use('json-parse', function (Y) {\n try {\n $status = Y.JSON.parse(o.responseText);\n var status = \"waiting\";\n if ($status.running) {\n status = \"running\";\n } else if (!$status.running && $status.fileexists === false && $status.results) {\n status = \"completed\";\n }\n if (status != \"completed\") {\n update_modal(status);\n setTimeout(function() {\n check_status();\n }, 2000);\n } else {\n $response.results = $status.results;\n complete_feedback();\n }\n }\n catch (e) {\n Y.log(\"Parsing failed.\");\n }\n });\n },\n failure: function(c, o) {\n if (o.status == '503') {\n // Ignore failures caused by this site is upgrading messages.\n setTimeout(function() {\n check_status();\n }, 2000);\n return;\n }\n try {\n $status = Y.JSON.parse(o.responseText);\n complete_feedback();\n } catch (e) {\n // Some other error has occured. The progress bar will now stop moving.\n Y.log(\"Parsing failed.\");\n }\n }\n }\n };\n $addons = Y.io(url, cfg);\n });\n }", "function toggleEnabledForCurrentDomain() {\n var isCurrentDomainBlacklisted = !getEnabledForDomainCheckbox().checked;\n\n chrome.tabs.query({\n 'active': true,\n 'currentWindow': true\n }, function (tabs) {\n var tab = tabs[0];\n var domain = domainFromURL(tab.url);\n toggleEnabledForDomain(domain);\n });\n}", "function requestLinks() {\n // GET LIST OF ACTIVE TABS AND CURRENT WINDOW\n chrome.tabs.query({\n active: true,\n currentWindow: true\n }, function(tabs) {\n // CHECK THAT PAGE IS FACEBOOK OR TWITTER\n if (tabs[0].url.includes('facebook.com') || tabs[0].url.includes('twitter.com')) {\n // SEND MESSAGE TO EVENT PAGE\n chrome.runtime.sendMessage({\n from: 'popup',\n subject: 'sendAds',\n }, setText);\n } else {\n // FLAG IF NOT FACEBOOK OR TWITTER\n setText(false);\n }\n });\n }", "checkLinks() {\n let parentlink = document.querySelector('link[rel=\"parent\"]');\n if (parentlink) parentlink = parentlink.href;\n\n const elems = this.parentNode.children;\n for (let elem of elems) {\n if (elem == this) continue;\n const link = elem.children[0];\n if (!link.href) continue;\n const classlist = link.classList;\n classlist.remove(\"active\");\n classlist.remove(\"semiactive\");\n const url = new URL(link.href);\n if (url.pathname == window.location.pathname && url.search == window.location.search)\n classlist.add(\"active\");\n else if (link.href == parentlink)\n classlist.add(\"semiactive\");\n }\n }" ]
[ "0.6739667", "0.6406322", "0.62774795", "0.6115601", "0.6068798", "0.6045893", "0.6015041", "0.5995952", "0.59887606", "0.596339", "0.5937359", "0.5906672", "0.58229846", "0.5817317", "0.58070564", "0.578137", "0.57801634", "0.5776091", "0.57722765", "0.57716405", "0.57697797", "0.57391405", "0.5738596", "0.5737178", "0.5729333", "0.57201916", "0.5701444", "0.5690656", "0.5687714", "0.56811106", "0.5668165", "0.56646335", "0.56408536", "0.56369954", "0.5629672", "0.56226337", "0.56111765", "0.5600269", "0.558715", "0.5573553", "0.5558738", "0.5539608", "0.55201674", "0.55174816", "0.5512326", "0.54962915", "0.54812014", "0.54680705", "0.5465774", "0.54636645", "0.5458893", "0.5441342", "0.5436881", "0.54344535", "0.5418082", "0.54137725", "0.541214", "0.5409458", "0.5406302", "0.54060584", "0.53938407", "0.5380759", "0.5378586", "0.53712267", "0.53653777", "0.53586465", "0.53515714", "0.53357774", "0.53252614", "0.5323014", "0.53165466", "0.5313078", "0.5306235", "0.53045005", "0.52922726", "0.52896476", "0.5286751", "0.5284808", "0.5284331", "0.5284226", "0.5281815", "0.52758396", "0.5274423", "0.5271304", "0.5250871", "0.5241301", "0.52387005", "0.52366555", "0.52258277", "0.52216166", "0.52174604", "0.5211753", "0.52099794", "0.52088267", "0.5208489", "0.5205538", "0.52041173", "0.5201056", "0.519344", "0.5190014" ]
0.77683234
0
Load selectors to match Quick Claim form input into site form. Pass in the detected site object then get the predefined selectors and make use of them. Get number of diagnosis codes entered in native site
function getObjLength(diagObjString) { var count = 0; diagObj = JSON.parse(diagObjString); for (p in diagObj) { count += 1; } return count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_hpsm_fields() {\n var arr = document.querySelectorAll(\".x-tab-panel-body .x-panel.x-panel-noborder\");\n for (var i=0; i < arr.length; i++) {\n if(arr[i].id.substring(0, 3) == \"ext\") {\n if(arr[i].className.indexOf('x-hide-nosize') == -1){\n var arr2 = arr[i].querySelectorAll(\"iframe.ux-mif\");\n if(arr2.length === 1) {\n var doc = arr2[0].contentWindow.document;\n console.log(doc);\n var fields = {}, listButtons = {}, unknownButtons = {}, findButtons = {}, fillButtons = {}, actionButtons = {}, labels = {};\n\n labels[\"interactionId\"] = $('label:contains(\"Interaction ID\")', doc).first();\n labels[\"status\"] = $('label:contains(\"Status\")', doc).first();\n labels[\"helpdesk\"] = $('label:contains(\"Helpdesk\")', doc).first();\n labels[\"contact\"] = $('label:contains(\"Contact\")', doc).first();\n labels[\"contactEmail\"] = $('label:contains(\"Contact email\")', doc).first();\n labels[\"title\"] = $('label:contains(\"Title\")', doc).first();\n labels[\"endUser\"] = $('label:contains(\"End user\")', doc).first();\n labels[\"endUserDept\"] = $('label:contains(\"End user dept.\")', doc).first();\n labels[\"description\"] = $('label:contains(\"Description\")', doc).first();\n labels[\"category\"] = $('label:contains(\"Category\")', doc).first();\n labels[\"subcategory\"] = $('label:contains(\"Subcategory\")', doc).first();\n labels[\"service\"] = $('label:contains(\"Service\")', doc).first();\n labels[\"impact\"] = $('label:contains(\"Impact\")', doc).first();\n labels[\"urgency\"] = $('label:contains(\"Urgency\")', doc).first();\n labels[\"priority\"] = $('label:contains(\"Priority\")', doc).first();\n labels[\"assignmentGroup\"] = $('label:contains(\"Assignment group\")', doc).first();\n labels[\"assignee\"] = $('label:contains(\"Assignee\")', doc).first();\n labels[\"targetDate\"] = $('label:contains(\"SLA target date\")', doc).first();\n labels[\"newUpdate\"] = $('label:contains(\"New update\")', doc).first();\n labels[\"closureCode\"] = $('label:contains(\"Closure code\")', doc).first();\n labels[\"solution\"] = $('label:contains(\"Solution\")', doc).first();\n\n fields[\"interactionId\"] = $(\"#\"+labels[\"interactionId\"].attr(\"for\"), doc);\n fields[\"status\"] = $(\"#\"+labels[\"status\"].attr(\"for\"), doc);\n fields[\"helpdesk\"] = $(\"#\"+labels[\"helpdesk\"].attr(\"for\"), doc);\n fields[\"contact\"] = $(\"#\"+labels[\"contact\"].attr(\"for\"), doc);\n fields[\"contactEmail\"] = $(\"#\"+labels[\"contactEmail\"].attr(\"for\"), doc);\n fields[\"title\"] = $(\"#\"+labels[\"title\"].attr(\"for\"), doc);\n fields[\"endUser\"] = $(\"#\"+labels[\"endUser\"].attr(\"for\"), doc);\n fields[\"endUserDept\"] = $(\"#\"+labels[\"endUserDept\"].attr(\"for\"), doc);\n fields[\"description\"] = $(\"#\"+labels[\"description\"].attr(\"for\"), doc);\n fields[\"category\"] = $(\"#\"+labels[\"category\"].attr(\"for\"), doc);\n fields[\"subcategory\"] = $(\"#\"+labels[\"subcategory\"].attr(\"for\"), doc);\n fields[\"service\"] = $(\"#\"+labels[\"service\"].attr(\"for\"), doc);\n fields[\"impact\"] = $(\"#\"+labels[\"impact\"].attr(\"for\"), doc);\n fields[\"urgency\"] = $(\"#\"+labels[\"urgency\"].attr(\"for\"), doc);\n fields[\"priority\"] = $(\"#\"+labels[\"priority\"].attr(\"for\"), doc);\n fields[\"assignmentGroup\"] = $(\"#\"+labels[\"assignmentGroup\"].attr(\"for\"), doc);\n fields[\"assignee\"] = $(\"#\"+labels[\"assignee\"].attr(\"for\"), doc);\n // fields[\"assigneeFull\"] = $( \"#X\" + (parseInt(labels[\"assignee\"].attr(\"for\").replace(\"X\", \"\")) + 1), doc );\n fields[\"targetDate\"] = $(\"#\"+labels[\"targetDate\"].attr(\"for\"), doc);\n fields[\"newUpdate\"] = $(\"#\"+labels[\"newUpdate\"].attr(\"for\"), doc);\n fields[\"closureCode\"] = $(\"#\"+labels[\"closureCode\"].attr(\"for\"), doc);\n fields[\"solution\"] = $(\"#\"+labels[\"solution\"].attr(\"for\"), doc);\n\n listButtons[\"status\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"Button\", doc);\n listButtons[\"helpdesk\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"Button\", doc);\n listButtons[\"impact\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"Button\", doc);\n\n unknownButtons[\"contact\"] = $( \"#X\" + (parseInt(labels[\"contact\"].attr(\"for\").replace(\"X\", \"\")) + 1), doc );\n unknownButtons[\"endUser\"] = $( \"#X\" + (parseInt(labels[\"endUser\"].attr(\"for\").replace(\"X\", \"\")) + 1), doc );\n unknownButtons[\"service\"] = $( \"#X\" + (parseInt(labels[\"service\"].attr(\"for\").replace(\"X\", \"\")) + 1), doc );\n\n findButtons[\"service\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FindButton\", doc);\n\n fillButtons[\"contact\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"endUser\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"category\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"subcategory\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"service\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"assignmentGroup\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"assignee\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n fillButtons[\"closureCode\"] = $(\"#\"+labels[\"status\"].attr(\"for\") + \"FillButton\", doc);\n\n actionButtons[\"markAsSpam\"] = $('button:contains(\"Mark as SPAM\")', doc);\n actionButtons[\"newEmail\"] = $('button:contains(\"New Email\")', doc);\n actionButtons[\"fullCaseflow\"] = $('button:contains(Full Case Flow)', doc);\n actionButtons[\"refreshHistory\"] = $('button:contains(Refresh History)', doc);\n\n var parsed = {}\n parsed[\"fields\"] = fields;\n parsed[\"listButtons\"] = listButtons;\n parsed[\"unknownButtons\"] = unknownButtons;\n parsed[\"findButtons\"] = findButtons;\n parsed[\"fillButtons\"] = fillButtons;\n parsed[\"actionButtons\"] = actionButtons;\n //console.log(parsed);\n return parsed;\n }\n }\n }\n }\n}", "function get_app_count(switcher, query){\n // TODO : add AHAH call to the php and query the App count\n var devices = 0;\n switch(switcher){\n case 'all':\n devices = 5430;\n break;\n case 'manual':\n devices = 250;\n break;\n }\n // set app count to a hidden variable\n $(\".display_count_hid\").val(devices);\n return devices;\n}", "function initializePage() {\r\n\t$('.opt_a').hide();\r\n\t$('.sug').hide();\r\n\t$('#q1').show();\r\n\tconsole.log('Javascript connected!');\r\n\tvar numberofsuggestions = 10;\r\n\tfor (var i = 0; i < numberofsuggestions; i++) { \r\n \tvar suggestion = '#s' + i+ ' #opt1';\r\n \tconsole.log($(suggestion).text());\r\n \r\n \t\r\n\t}\r\n\t/*\tfor each suggestions\r\ncompare provided response with json properties (to be inputted)\r\nthen pick a random suggestion from those that matched\r\n\r\n*/\r\n\tvar strring = '#s'+Math.floor((Math.random() * \t10) + 1);\r\n\t\r\n\tconsole.log( strring);\r\n\t$(strring).show();\r\n}", "function scrapeFields() {\n\tvar provider = providers[$(\"#autofill-provider\").val()];\n\tscrapeRandom(provider);\n}", "function countUserInteractiveHatsFormFields(){\r\n\tvar uihff=0;\r\n\tif (hatsForm == null) return 0;\r\n\tvar elements = hatsForm.elements;\r\n\tfor (var i=0,iL=elements.length,elementNext; i<iL; ++i){\r\n\t\telementNext=elements[i];\r\n\t\tif ((isHInput(elementNext.type, elementNext.name))\r\n\t\t\t\t&& (!elementNext.disabled)\r\n\t\t\t\t&& (!elementNext.readOnly)\r\n\t\t\t\t&& (elementNext.type!=\"hidden\")){\r\n\t\t\tuihff=uihff+1;\r\n\t\t}\r\n\t}\r\n\treturn uihff;\r\n}", "function findCodePages(){\r\n callEloqua(false,function(html){\r\n var str = tmp.shortcode_pages(html)\r\n jQuery('.eloqua-pages.shortcode-query').removeClass('waiting')\r\n jQuery('.eloqua-pages.shortcode-query').html(str) \r\n },function(err){\r\n log(err) \r\n },'find_form_shortcode')\r\n}", "function countMinimumUserInteractiveHatsFormFields(){\r\n\tif (hatsForm == null) return 0;\r\n\tvar elements = hatsForm.elements;\r\n\tfor (var i=0,iL=elements.length,elementNext; i<iL; ++i){\r\n\t\telementNext=elements[i];\r\n\t\tif((!elementNext.disabled) && (elementNext.type!=\"hidden\")){\r\n\t\t\tif(isHInput(elementNext.type, elementNext.name)){\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn 0;\r\n}", "function analyzeResults() {\n loadResults(function(results) {\n var sadCount = results.slice(0,5).filter(function(item) {\n return item.result == \"sad\";\n }).length;\n\n console.log(\"sadCount: \" + sadCount);\n\n if (sadCount >= 5) {\n selectPage(\"call-help-page\");\n }\n });\n}", "function getMultiTrainCount() {\n var count = 0;\n if (multiTrainSelect1.value != \"\") {\n count ++;\n }\n if (multiTrainSelect2.value != \"\") {\n count ++;\n }\n if (multiTrainSelect3.value != \"\") {\n count ++;\n }\n if (multiTrainSelect4.value != \"\") {\n count ++;\n }\n return count;\n}", "function parseRsel() {\n var TA=document.getElementById('pageContentId');\n var text = TA.value;\n\n // Note: All commands initially start with rsel|, to differentiate them from any other tables.\n // Fix first lines.\n text = text.replace(/^ *@selenium\\.open *\"([^\"]*)\" *$/m, \"rsel| script | Selenium test | $1 | !{host: ${HOST}, stop_on_failure:true} |\\nrsel| Open browser |\\nrsel| Maximize browser |\");\n\n // Other lines like that are Visit lines.\n text = text.replace(/^ *@selenium\\.open *\"([^\"]*)\" *$/gm, \"rsel| Visit |!-$1-!|\");\n\n // Delete begin-rescue-end blocks except for the asserted contents.\n text = text.replace(/^ *begin *\\r?\\n/gm, '');\n text = text.replace(/^ *rescue Test::Unit::AssertionFailedError *\\r?\\n.*\\r?\\n *end *\\r?\\n/gm, '');\n text = text.replace(/def (setup|teardown)[\\s\\S]*?end/g, '');\n\n text = text.replace(/^ *@selenium\\.type *\"([^\"]*)\", *\"([^\"]*)\" *$/gm, 'rsel| Type |!-$2-!| into field |!-$1-!|');\n text = text.replace(/^ *@selenium\\.select *\"([^\"]*)\", *\"label=([^\"]*)\" *$/gm, 'rsel| Select |!-$2-!| from dropdown |!-$1-!|');\n text = text.replace(/^ *@selenium\\.wait_for_page_to_load *\"([0-9]+)000\" *$/gm, 'rsel| Page loads in | $1 | seconds or less |');\n text = text.replace(/^ *@selenium\\.click *\"\\/(.*)\" *$/gm, 'rsel| Click |!-xpath=/$1-!|');\n text = text.replace(/^ *@selenium\\.click *\"(.*)\" *$/gm, 'rsel| Click |!-$1-!|');\n text = text.replace(/^ *assert @selenium.is_text_present\\(\"(.*)\"\\) *$/gm, 'rsel| See |!-$1-!|');\n text = text.replace(/^ *assert [email protected]_text_present\\(\"(.*)\"\\) *$/gm, 'rsel| Do not see |!-$1-!|');\n text = text.replace(/^ *@selenium.choose_([a-z]+)_on_next_confirmation *$/gm, 'rsel| Choose $1 on next confirmation |');\n text = text.replace(/^ *assert_equal \"([^\"]*)\", *@selenium.get_([a-z]+)\\(\"(.*)\"\\) *$/gm, 'rsel| Check | get $2 |!-$3-!|!-$1-!|');\n text = text.replace(/^ *assert \\/(.*)\\/ *=~ *@selenium.get_([a-z]+)\\(\"(.*)\"\\) *$/gm, 'rsel| Check | get $2 |!-$3-!|!-regex:$1-!|');\n text = text.replace(/^ *assert \\/(.*)\\/ *=~ *@selenium.get_([a-z]+) *$/gm, 'rsel| Check | get $2 |!-regex:$1-!|');\n text = text.replace(/^ *assert !([0-9]+).times{ break if \\(@selenium.is_text_present\\(\"(.*)\"\\) rescue false\\); sleep 1 } *$/gm, 'rsel| See |!-$2-!| within | $1 | seconds |');\n\n // Pick up most remaining one-argument Selenium commands.\n text = text.replace(/^ *@selenium\\.([a-z_]+) *\"\\/\\/([^\"]*)\" *$/gm, \"rsel| $1 |!-xpath=//$2-!|\");\n text = text.replace(/^ *@selenium\\.([a-z_]+) *\"([^\"]*)\" *$/gm, \"rsel| $1 |!-$2-!|\");\n\n // Fix any remaining Selenium commands with underscores to have spaces instead.\n text = text.replace(/^(rsel\\|[^|]*)_/gm, '$1 ');\n\n // Fix any remaining Selenium commands with escaped quotes, but only on Rsel lines.\n text = text.replace(/^(rsel\\|.*)\\\\\"/gm, \"$1\\\"\");\n\n // Add closing line.\n text = text.replace(/^ *end *$/m, 'rsel| Close browser |');\n // Clean up rsel|.\n text = text.replace(/^rsel\\|/gm, '|');\n TA.value = text;\n}", "function getHtmlElementCounterObj()\r\n\t\t{\r\n\t\t\tvar\r\n\t\t\t\thtmlElementCounterObj = {},\r\n\t\t\t\turlToTheCheckPageInputElement = document.getElementById(\"url_to_the_check_page_input\"),\r\n\t\t\t\thtmlElementNameInputElement = document.getElementById(\"html_element_name_input\"),\r\n\t\t\t\tallFieldsAreRequiredMessageElement = document.getElementById(\"all_fields_are_required_message\"),\r\n\t\t\t\tinvalidUrlMessageElement = document.getElementById(\"invalid_url_message\"),\r\n\t\t\t\tinvalidHtmlElementNameMessageElement = document.getElementById(\"invalid_html_element_name_message\"),\r\n\t\t\t\tinaccessibleUrlMessageElement = document.getElementById(\"inaccessible_url_message\");\r\n\t\t\t\r\n\t\t\thtmlElementCounterObj.runHtmlElementCounter = function ()\r\n\t\t\t{\r\n\t\t\t\tvar\r\n\t\t\t\t\turlToTheCheckPage = urlToTheCheckPageInputElement.value.replace(/^\\s+|\\s+$/g, \"\"),\r\n\t\t\t\t\thtmlElementName = htmlElementNameInputElement.value.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\t\r\n\t\t\t\turlToTheCheckPageInputElement.oninput = htmlElementNameInputElement.oninput = htmlElementCounterObj.hideErrorMessages;\r\n\t\t\t\t\r\n\t\t\t\t//begin: Validation of form fields.\r\n\t\t\t\tvar errorFlagOfFormFill = false; // Initially I believe that there are no errors.\r\n\t\t\t\t\r\n\t\t\t\t//begin: Check the form is filled.\r\n\t\t\t\tif\r\n\t\t\t\t(\r\n\t\t\t\t\turlToTheCheckPage === \"\" || htmlElementName === \"\"\r\n\t\t\t\t)\r\n\t\t\t\t{\r\n\t\t\t\t\tallFieldsAreRequiredMessageElement.classList.remove(\"display_none\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (urlToTheCheckPage === \"\")\r\n\t\t\t\t\t\turlToTheCheckPageInputElement.focus();\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\thtmlElementNameInputElement.focus();\r\n\t\t\t\t\t\r\n\t\t\t\t\terrorFlagOfFormFill = true;\r\n\t\t\t\t}\r\n\t\t\t\t//end: Check the form is filled.\r\n\t\t\t\t\r\n\t\t\t\tif (urlToTheCheckPage !== \"\" && !/^(ftp|http|https):\\/\\/[^ \"]+$/i.test(urlToTheCheckPage)) // URL validation check\r\n\t\t\t\t{\r\n\t\t\t\t\tinvalidUrlMessageElement.classList.remove(\"display_none\");\r\n\t\t\t\t\turlToTheCheckPageInputElement.focus();\r\n\t\t\t\t\turlToTheCheckPageInputElement.select();\r\n\t\t\t\t\terrorFlagOfFormFill = true;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tvar arrOfHtmlElementNames = [\"!--\", \"!doctype\", \"a\", \"abbr\", \"acronym\", \"address\", \"applet\", \"area\", \"article\", \"aside\", \"audio\", \"b\", \"base\", \"basefont\", \"bdi\", \"bdo\", \"big\", \"blockquote\", \"body\", \"br\", \"button\", \"canvas\", \"caption\", \"center\", \"cite\", \"code\", \"col\", \"colgroup\", \"data\", \"datalist\", \"dd\", \"del\", \"details\", \"dfn\", \"dialog\", \"dir\", \"div\", \"dl\", \"dt\", \"em\", \"embed\", \"fieldset\", \"figcaption\", \"figure\", \"font\", \"footer\", \"form\", \"frame\", \"frameset\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"head\", \"header\", \"hr\", \"html\", \"i\", \"iframe\", \"img\", \"input\", \"ins\", \"kbd\", \"label\", \"legend\", \"li\", \"link\", \"main\", \"map\", \"mark\", \"meta\", \"meter\", \"nav\", \"noframes\", \"noscript\", \"object\", \"ol\", \"optgroup\", \"option\", \"output\", \"p\", \"param\", \"picture\", \"pre\", \"progress\", \"q\", \"rp\", \"rt\", \"ruby\", \"s\", \"samp\", \"script\", \"section\", \"select\", \"small\", \"source\", \"span\", \"strike\", \"strong\", \"style\", \"sub\", \"summary\", \"sup\", \"svg\", \"table\", \"tbody\", \"td\", \"template\", \"textarea\", \"tfoot\", \"th\", \"thead\", \"time\", \"title\", \"tr\", \"track\", \"tt\", \"u\", \"ul\", \"var\", \"video\", \"wbr\"];\r\n\t\t\t\t\r\n\t\t\t\tif (htmlElementName !== \"\" && -1 === arrOfHtmlElementNames.indexOf(htmlElementName.toLowerCase()))\r\n\t\t\t\t{\r\n\t\t\t\t\tinvalidHtmlElementNameMessageElement.classList.remove(\"display_none\");\r\n\t\t\t\t\thtmlElementNameInputElement.focus();\r\n\t\t\t\t\thtmlElementNameInputElement.select();\r\n\t\t\t\t\terrorFlagOfFormFill = true;\r\n\t\t\t\t}\r\n\t\t\t\t//end: Validation of form fields.\r\n\t\t\t\t\r\n\t\t\t\tif (!errorFlagOfFormFill) // No errors.\r\n\t\t\t\t{ // Transfer data to server.\r\n\t\t\t\t\tdocument.body.classList.add(\"loading\"); // Animation of the process of transferring data and receiving a response.\r\n\t\t\t\t\t\r\n\t\t\t\t\tsendGet\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t\"php\\/i.php?url=\" + encodeURIComponent(urlToTheCheckPage) + \"&htmlElementName=\" + encodeURIComponent(htmlElementName) + \"&r=\" + Math.random(),\r\n\t\t\t\t\t\tfunction (result) // callbackFun\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tvar resultObj = getResultObj_initialParsingOfTheResponseFromTheServer // Getting the result object from the server and initial parsing the response from the server. (To eliminate errors.)\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tresult // response from the server\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tswitch (resultObj.responseId)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcase \"infoData\":\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"web_page_url_id\").innerHTML = resultObj.infoData.webPageUrl;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"html_element_name_id_0\").innerHTML =\r\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"html_element_name_id_1\").innerHTML =\r\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"html_element_name_id_2\").innerHTML =\r\n\t\t\t\t\t\t\t\t\t\tresultObj.infoData.htmlElementName;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"fetch_time_id\").innerHTML = getDatetimeStr(convertUTCDateToLocalDate(getJsDateObjByDbDateString(resultObj.infoData.fetchTimeUTC)));\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"duration_ms_id\").innerHTML = resultObj.infoData.durationMs;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"count_of_html_elements_id\").innerHTML = resultObj.infoData.countOfHtmlElements;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"count_of_checked_urls_from_that_domain_id\").innerHTML = resultObj.infoData.countOfCheckedURLsfromThatDomain;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"average_page_fetch_time_from_that_domain_during_the_last_24_hours_id\").innerHTML = resultObj.infoData.averagePageFetchTimeFromThatDomainDuringTheLast24Hours;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"total_count_of_this_element_from_this_domain_id\").innerHTML = resultObj.infoData.totalCountOfThisElementFromThisDomain;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"total_count_of_this_element_from_all_requests_ever_made_id\").innerHTML = resultObj.infoData.totalCountOfThisElementFromAllRequestsEverMade;\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"domain_id_0\").innerHTML =\r\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"domain_id_1\").innerHTML =\r\n\t\t\t\t\t\t\t\t\t\tdocument.getElementById(\"domain_id_2\").innerHTML =\r\n\t\t\t\t\t\t\t\t\t\tresultObj.infoData.webPageUrl.split(\"/\")[2];\r\n\t\t\t\t\t\t\t\t\tdocument.getElementById(\"result_box_id\").classList.remove(\"display_none\");\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tcase \"Inaccessible URL\":\r\n\t\t\t\t\t\t\t\t\tinaccessibleUrlMessageElement.classList.remove(\"display_none\");\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t\thandlingCommonResponseErrorsFromTheServer // handling common response errors from the server\r\n\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\tresultObj // response from the server\r\n\t\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tdocument.body.classList.remove(\"loading\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\thtmlElementCounterObj.hideErrorMessages = function()\r\n\t\t\t{\r\n\t\t\t\tallFieldsAreRequiredMessageElement.classList.add(\"display_none\");\r\n\t\t\t\tinvalidUrlMessageElement.classList.add(\"display_none\");\r\n\t\t\t\tinvalidHtmlElementNameMessageElement.classList.add(\"display_none\");\r\n\t\t\t\tinaccessibleUrlMessageElement.classList.add(\"display_none\");\r\n\t\t\t\tdocument.getElementById(\"result_box_id\").classList.add(\"display_none\");\r\n\t\t\t};\r\n\t\t\t\r\n\t\t\treturn htmlElementCounterObj;\r\n\t\t}", "function checkRequired(checksum) {\n let allElements = document.getElementsByClassName(\"main\")[currentPage].querySelectorAll(\"input, select, textarea\"); \n let counter = 0;\n for (let i = 0; i < allElements.length; i++) {\n let currentItem = allElements[i];\n if (currentItem.tagName == \"TEXTAREA\" || currentItem.tagName == \"SELECT\") {\n if (currentItem.value != 0) {\n counter++;\n //console.log(currentItem.value);\n }\n }\n else if (currentItem.type = \"radio\") {\n if (currentItem.checked == true) {\n counter++;\n }\n }\n }\n let numberOfPages = document.getElementsByClassName(\"page\").length;\n if (counter == checksum) {\n if (currentPage < numberOfPages - 2) {\n nextPage();\n }\n else {\n submit();\n }\n\n }\n else {\n document.getElementsByClassName(\"main\")[currentPage].querySelectorAll(\"p.alert\")[0].style.display = \"block\";\n }\n}", "get resultsFound () { return $('//*[@class=\"srp-controls__control srp-controls__count\"]') }", "function radio_onload() {\n searchItems = new Array();\n for (var siteIndex = 0; siteIndex < window.sitecollection.length; siteIndex++) {\n var index;\n index = jQuery.inArray(window.sitecollection[siteIndex].Name, searchItems);\n if (index == -1) {\n searchItems.push(window.sitecollection[siteIndex].Name);\n }\n if (window.sitecollection[siteIndex].IsNotApplicable == true) {\n window.sitecollection[siteIndex].IsNotApplicable = true;\n window.sitecollection[siteIndex].IsSafeTerritory = false;\n }\n else if (window.sitecollection[siteIndex].IsSafeTerritory == true) {\n window.sitecollection[siteIndex].IsNotApplicable = false;\n window.sitecollection[siteIndex].IsSafeTerritory = true;\n index = jQuery.inArray(window.sitecollection[siteIndex].Name, include);\n if (index == -1) {\n include.push(window.sitecollection[siteIndex].Name);\n }\n }\n else {\n window.sitecollection[siteIndex].IsNotApplicable = true;\n window.sitecollection[siteIndex].IsSafeTerritory = false;\n }\n }\n sortAppendedElements();\n\n //fill the autocomplete texbox values\n $(\"input#autocomplete\").autocomplete({\n source: searchItems, minLength: 3\n });\n}", "function onloadPages(ev)\n{\n // scan through all forms and set dynamic functionality\n // for specific elements\n for(var i = 0; i < document.forms.length; i++)\n { // iterate through all forms \n var form = document.forms[i];\n for(var j = 0; j < form.elements.length; j++)\n { // loop through elements in form\n var element = form.elements[j];\n element.onkeydown = keyDown;\n\n var name = element.name;\n if (!name || name.length == 0)\n name = element.id;\n\n switch(name)\n { // act on specific elements\n case \"CensusSel\":\n {\n element.addEventListener('change', changeCensus);\n var evt = new Event('change',{'bubbles':true});\n element.dispatchEvent(evt);\n break;\n } // function Census\n \n case \"Province\":\n {\n element.addEventListener('change', changeProv);\n break;\n } // function Province\n \n case \"District\":\n {\n element.addEventListener('change', changeDist);\n break;\n } // function District\n \n case \"SubDistrict\":\n {\n element.addEventListener('change', changeSubDist);\n break;\n } // function SubDistrict\n\n } // act on specific elements\n } // loop through elements in form\n } // iterate through all forms\n}", "function detectColors() {\n\n\n\t//console.log('Colors are being detected in the page...');\n\n\n\tiframeElement('body *').each(function () {\n\n\n\t\tvar color = $(this).css('color');\n\t\tif (color.indexOf('a') == -1) color = color.replace(')', ', 1)').replace('rgb', 'rgba');\n\t\tif (color == \"rgba(0, 0, 0, 1)\") color = \"rgba(0, 0, 0, 0)\"; // Reduce whites\n\n\t\tvar bgColor = $(this).css('background-color');\n\t\tif (bgColor.indexOf('a') == -1) bgColor = bgColor.replace(')', ', 1)').replace('rgb', 'rgba');\n\t\tif (bgColor == \"rgba(0, 0, 0, 1)\") bgColor = \"rgba(0, 0, 0, 0)\"; // Reduce whites\n\n\n\t\tvar colorCount = parseInt(page_colors[color]) || 0;\n\t\tpage_colors[color] = colorCount + 1;\n\n\n\t\tvar bgColorCount = parseInt(page_colors[bgColor]) || 0;\n\t\tpage_colors[bgColor] = bgColorCount + 1;\n\n\n\t});\n\n\n\t// Order the colors\n\tcolorsSorted = Object.keys(page_colors).sort(function (a, b) { return page_colors[b] - page_colors[a]; });\n\t$(\"input[type='color']\").spectrum(\"option\", \"palette\", colorsSorted);\n\n\n\tconsole.log('Color detection complete.', colorsSorted);\n\n}", "function get_human_selector(data) {\n\n var allSelectors, i;\n\n // Don't search it always\n if (window.humanSelectorArray.length === 0) {\n\n // Getting minimized data.\n data = get_minimized_css(data, true);\n\n // if no data, stop.\n if (data == '') {\n return false;\n }\n\n data = data.toString().replace(/\\}\\,/g, \"}\");\n\n // Getting All CSS Selectors.\n allSelectors = array_cleaner(data.replace(/\\{(.*?)\\}/g, '|BREAK|').split(\"|BREAK|\"));\n\n }\n\n // Vars\n var foundedSelectors = [];\n var selector;\n\n // get cached selector Array\n if (window.humanSelectorArrayEnd) {\n allSelectors = window.humanSelectorArray;\n }\n\n if (isUndefined(allSelectors)) {\n return false;\n }\n\n // Each All Selectors\n for (i = 0; i < allSelectors.length; i++) {\n\n // Get Selector.\n selector = space_cleaner(allSelectors[i]);\n selector = space_cleaner(selector.replace(\"{\", '').replace(\"}\", ''));\n\n // YP not like so advanced selectors.\n if (selector.indexOf(\",\") != -1 || selector.indexOf(\":\") != -1 || selector.indexOf(\"*\") != -1 || selector.indexOf(\"/\") != -1) {\n continue;\n }\n\n // Not basic html tag selectors.\n if (selector.indexOf(\"#\") == -1 && selector.indexOf(\".\") == -1) {\n continue;\n }\n\n // min two\n if (get_selector_array(selector).length < 2) {\n continue;\n }\n\n // Check if selector valid\n if (iframeBody.find(selector).length > 0) {\n\n // Cache other selectors.\n if (window.humanSelectorArrayEnd === false) {\n window.humanSelectorArray.push(selector);\n }\n\n // Founded Selector\n if (iframeBody.find(selector).hasClass(\"yp-selected\")) {\n foundedSelectors.push(selector);\n }\n\n }\n\n }\n\n // Don't read again css files. cache all human CSS selectors.\n window.humanSelectorArrayEnd = true;\n\n // New selectors\n var foundedNewSelectors = [];\n\n // Each all founded selectors.\n // Don't use if has non useful classes as format-link etc.\n for (i = 0; i < foundedSelectors.length; i++) {\n\n var selectorBefore = foundedSelectors[i].replace(/\\-/g, 'W06lXW');\n var passedClasses = true;\n\n // Check if has an useful class\n $.each((filterBadClassesBasic), function (x, v) {\n\n v = v.replace(/\\-/g, 'W06lXW').replace(/0W06lXW9/g, '0-9').replace(/\\(\\w\\+\\)/g, '\\(\\\\w\\+\\)').replace(/aW06lXWzAW06lXWZ0-9_W06lXW/g, 'a-zA-Z0-9_-').toString();\n var re = new RegExp(\"\\\\b\" + v + \"\\\\b\", \"g\");\n\n // Founded an non useful class.\n if (selectorBefore.match(re) !== null) {\n passedClasses = false;\n }\n\n });\n\n // Check if has bad class\n $.each((filterBadClassesPlus), function (x, v) {\n\n v = v.replace(/\\-/g, 'W06lXW').replace(/0W06lXW9/g, '0-9').replace(/\\(\\w\\+\\)/g, '\\(\\\\w\\+\\)').replace(/aW06lXWzAW06lXWZ0-9_W06lXW/g, 'a-zA-Z0-9_-').toString();\n var re = new RegExp(\"\\\\b\" + v + \"\\\\b\", \"g\");\n\n // Founded an bad class.\n if (selectorBefore.match(re) !== null) {\n passedClasses = false;\n }\n\n });\n\n // Successful.\n if (passedClasses === true) {\n foundedNewSelectors.push(foundedSelectors[i]);\n }\n\n }\n\n return foundedNewSelectors;\n\n }", "function updateAvailableSkillsSelectors(){\n var currentCR = publicAPI.$npcCRField.val();\n var currentType = publicAPI.$npcSelectedType.val();\n var masterSkillCount = 0;\n var goodSkillCount = 0;\n var $masterSkillsList = $(`.${masterSkillsID}_list .skill_selector`);\n var $goodSkillsList = $(`.${goodSkillsID}_list .skill_selector`);\n\n // This hackey shit can be replaced when I build a better control for the CP selector\n if(currentCR === \"0.33\"){\n currentCR = \"third\";\n }\n else if (currentCR === \"0.5\"){\n currentCR = \"half\";\n }\n\n switch(currentType){\n case \"combatant\":\n masterSkillCount = myApp.combantant_stats[currentCR].masterskillcount;\n goodSkillCount = myApp.combantant_stats[currentCR].goodskillcount;\n break;\n case \"expert\":\n masterSkillCount = myApp.expert_stats[currentCR].masterskillcount;\n goodSkillCount = myApp.expert_stats[currentCR].goodskillcount;\n break;\n case \"spellcaster\":\n masterSkillCount = myApp.spellcaster_stats[currentCR].masterskillcount;\n goodSkillCount = myApp.spellcaster_stats[currentCR].goodskillcount;\n break;\n }\n\n // Check for existing skill selectors, we just want to add new ones or lop off the last extras\n // if the current UI is wrong, that way they don't all get reset\n if( $(\".skill_selector\").length < 1){\n // this is the initial call, just add all new selectors\n addSkillSelectors(masterSkillsID, 0, masterSkillCount);\n addSkillSelectors(goodSkillsID, 0, goodSkillCount);\n }\n else{\n if($masterSkillsList.length > masterSkillCount){\n // there are too many master skill selectors for the current settings, remove the extras from the end\n removeSkillSelectors(masterSkillsID,masterSkillCount);\n }\n else if ($masterSkillsList.length < masterSkillCount){\n // there are not enough master skill selectors for the current settings, add the requied new selectors to the end\n addSkillSelectors(masterSkillsID, $masterSkillsList.length, masterSkillCount);\n }\n if ($goodSkillsList.length > goodSkillCount){\n // there are too many good skill selectors for the current settings, remove the extras from the end\n removeSkillSelectors(goodSkillsID, goodSkillCount);\n }\n else if ($goodSkillsList.length < goodSkillCount) {\n addSkillSelectors(goodSkillsID, $goodSkillsList.length, goodSkillCount);\n }\n }\n }", "function loadAnomalySelectionForm() {\n currentState = \"SelectAnomalyTypes\";\n customInputsTitle.innerText = \"Select Anomaly Presence\";\n customInputsContent.innerHTML = \"\";\n var anomalySelectionList = document.createElement(\"ul\");\n anomalySelectionList.setAttribute(\"id\", \"anomaly-selection-list\");\n anomalySelectionList.setAttribute(\"class\", \"selection-list\");\n for (var i in anomalySelectionForm.anomalyTypes) {\n var type = anomalySelectionForm.anomalyTypes[i];\n var typeId = type + \"-count\";\n // create list item element\n var newListItem = document.createElement(\"li\");\n newListItem.setAttribute(\"id\", type + \"-list-item\");\n // create nubmer input element\n var numberField = document.createElement('input');\n numberField.setAttribute(\"class\", \"custom-input\");\n numberField.setAttribute(\"type\", \"number\");\n numberField.setAttribute(\"id\", typeId);\n numberField.setAttribute(\"min\", 0);\n numberField.setAttribute(\"max\", maxAnomalies);\n numberField.value = anomalySelectionForm.counts[type];\n // create label element for checkbox\n var newLabel = document.createElement(\"label\");\n newLabel.setAttribute(\"for\", typeId);\n newLabel.innerText = type;\n // add elements to DOM\n newListItem.appendChild(numberField);\n newListItem.appendChild(newLabel);\n anomalySelectionList.appendChild(newListItem);\n }\n customInputsContent.appendChild(anomalySelectionList);\n}", "function lgm_addControls() {\n var foundSite = gmFoundFilter2(currSite);\n if (gmIsObject(foundSite)) {\n img2Search = foundSite.url;\n elemSearchUrl = foundSite.search;\n elemReplUrl = foundSite.replace;\n elemReplUrlLarge = foundSite.replace_large;\n elemWithDownLink = foundSite.withDownload;\n }\n\n //alert(img2Search);\n\n //getFilter(currSite);\n}", "function request_concept_specifics(natures_selector)\n {\n var natures = []\n natures_selector.each(function(index, element)\n {\n if (element.value)\n {\n natures.push(element.value)\n }\n })\n $.ajax(\"/\" + window.collecster_app_name + \"/ajax/concept_admin_formsets/html/\",\n {\n data: $.param({ nature: natures }, true),\n success: div_replacer\n })\n }", "function selectSite(){\n var restriction = \"site.site_id IN (select bl.site_id from bl where exists(select 1 from gb_fp_setup where gb_fp_setup.bl_id = bl.bl_id\";\n if (valueExistsNotEmpty(getFieldRes('gb_fp_setup.calc_year'), true)) {\n restriction += \" and \" + getFieldRes('gb_fp_setup.calc_year', true);\n }\n \n if (valueExistsNotEmpty(getFieldRes('gb_fp_setup.scenario_id'))) {\n restriction += \" and \" + getFieldRes('gb_fp_setup.scenario_id');\n }\n \n restriction += \"))\";\n\t\n View.selectValue(\"abGbFpEsExpConsole\", '', [\"bl.site_id\"], \"site\", [\"site.site_id\"], [\"site.name\", \"site.site_id\"], restriction, null, null, null, null, null, null, 'multiple');\n \n}", "function initializeVars() {\r\n\tsimProgress = 0;\r\n\tcount5any = 0;\r\n\tcount4any = 0;\r\n\tcount3 = 0;\r\n\t\r\n\tcount5charAny = 0;\r\n\tcount5charFeat = 0;\r\n\tcount5weapAny = 0;\r\n\tcount5weapFeat1 = 0;\r\n\tcount5weapFeat2 = 0;\r\n\t\r\n\tcount4charAny = 0;\r\n\tcount4weapAny = 0;\r\n\tcount4charFeat1 = 0;\r\n\tcount4charFeat2 = 0;\r\n\tcount4charFeat3 = 0;\r\n\tcount4weapFeat1 = 0;\r\n\tcount4weapFeat2 = 0;\r\n\tcount4weapFeat3 = 0;\r\n\tcount4weapFeat4 = 0;\r\n\tcount4weapFeat5 = 0;\r\n\t\r\n\tfeat5Miss = false;\r\n\tfeat4Miss = false;\r\n\tfateActive = 0;\r\n\tfateCount = 0;\r\n\t\r\n\tnonFeat4Threshold = 500;\r\n\t\r\n\twishCount = 0;\r\n\t\r\n\tresultContent = \"\";\r\n}", "function loadSelector() {\n for (var i = 0; i < core.n_; i++) {\n $('#page-selector').append(\n [\"<option value='\", i, \"'>\", i + 1, '</option>'].join('')\n );\n }\n}", "function applyToForm(){\n\tvar divId = GLOBAL.CurrentAnalysisDivId;\n\tvar probesAgg = document.getElementById(\"probesAggregation\");\n\tvar snpType = document.getElementById(\"SNPType\");\n\t\n\tvar subsetCount = multipleSubsets()?2:1;\n\tfor(var idx = 1; idx<=subsetCount; idx++){\n\t\tapplySubsetToForm(divId, idx);\n\t}\n\t\n\t//Pull other values from javascript object.\n\twindow[divId+'pathway']\t\t\t\t= GLOBAL.CurrentPathway;\n\twindow[divId+'pathwayName'] \t\t= GLOBAL.CurrentPathwayName;\n\twindow[divId+'probesAggregation']\t= probesAgg.checked;\n\twindow[divId+'SNPType']\t\t\t\t= snpType.value;\n\twindow[divId+'markerType']\t\t\t= GLOBAL.HighDimDataType;\n\t\n\t//Pull the actual values for these items so we can filter on them in a SQL query later. When we click on the items in the dropdowns these \"Value\" fields get a list of all items in both subsets.\n\twindow[divId+'samplesValues']\t\t= GLOBAL.CurrentSamples;\n\twindow[divId+'tissuesValues']\t\t= GLOBAL.CurrentTissues;\n\twindow[divId+'timepointsValues']\t= GLOBAL.CurrentTimepoints;\n\twindow[divId+'gplValues']\t\t\t= GLOBAL.CurrentGpls.toArray();\t\n\t\n\tdisplayHighDimSelectionSummary(subsetCount, divId, probesAgg, snpType);\n\n\tcompareStepPathwaySelection.hide();\n}", "function checkNumberOfFields( selector ){\n\tvar i=0;\n\t$(selector+\" :text, :file, :checkbox, select, textarea\").each(function() {\t\t\n\t\ti=i+1;\n\t});\n\treturn i;\n}", "isaMajorTrackingNetwork() {\n let result = 0\n pagesSeenOnRegexList.some(network => {\n let match = network.exec(this.domain)\n if (match) {\n // remove period at end for lookup in pagesSeenOn\n let name = match[0].slice(0,-1)\n return result = Math.ceil(pagesSeenOn[name] / 10)\n }\n })\n return result\n }", "function domLoaded() {\n\n document.getElementById('navbarNavDropdown').className = 'noshow navbar-collapse collapse';\n\n //* Global Variables drawn from DOM\n originalFlSummary = document.getElementById(\"pln-flsummary\").innerHTML;\n\n //* Event Listeners *//\n //* Event Listener for Get Started Button *//\n document.getElementById(\"pln-cta-primary\").addEventListener(\"click\", function (event) {\n showMenuComponent(\"FlightParameters\");\n });\n\n //* Event Listener for Drone Safety Map Button *//\n document.getElementById(\"pln-dronesafety\").addEventListener(\"click\", function (event) {\n droneSafetyMap();\n instrDisplay(\"pln-step-three\", 2);\n instrDisplay(\"pln-step-four\", 2);\n instrDisplay(\"pln-step-five\", 2);\n instrDisplay(\"pln-step-six\", 1);\n });\n\n //*Event Listeners for Location Page*//\n document.getElementById(\"pln-postcode\").addEventListener(\"keyup\", function (event) {\n event.preventDefault();\n if (event.keyCode === 13) {\n getPostcodeData(document.getElementById(\"pln-postcode\").value);\n }\n });\n\n document.getElementById(\"pln-postcode\").addEventListener(\"blur\", function (event) {\n event.preventDefault();\n getPostcodeData(document.getElementById(\"pln-postcode\").value);\n });\n\n //*Event Listeners for Flight Parameters Page*//\n\n //* Click Event listeners for Competencies *//\n var inputBoxes = document.getElementsByClassName(\"pln-comp\");\n\n for (i = 0; i < inputBoxes.length; i++) {\n inputBoxes[i].addEventListener('click', function () {paramUpdate(1, this); });\n }\n\n //* Click Event listeners for Drone Categories *//\n var inputCompBoxes = document.getElementsByClassName(\"pln-dronecat\");\n\n for (i = 0; i < inputCompBoxes.length; i++) {\n inputCompBoxes[i].addEventListener('click', function () { paramUpdate(2, this); });\n }\n\n //* Click Event listeners for selectors *//\n var inputCheckBoxes = document.getElementsByClassName(\"pln-param-input\");\n\n for (i = 0; i < inputCheckBoxes.length; i++) {\n inputCheckBoxes[i].addEventListener('click', function () {\n if (this.checked) { this.checked = false; }\n else { this.checked = true; }\n\n });\n }\n\n //* Hover Event Listeners for Boxes *//\n var fcBox = document.querySelectorAll(\".pln-flightcat, .pln-dronecat\");\n for (i = 0; i < fcBox.length; i++) {\n fcBox[i].addEventListener('mouseover', function () { paramHlight(this); });\n }\n\n //* Event Listener for Flight Parameters reset *//\n document.getElementById(\"pln-param-reset\").addEventListener('click', function () { paramReset(); });\n\n //* Event Listener for Flight Parameters review Location Button *//\n document.getElementById(\"pln-next-location\").addEventListener(\"click\", function (event) {\n showMenuComponent(\"Location\");\n });\n\n //* Event Listener for Step Four Next Button *//\n document.getElementById(\"pln-stepfour-next\").addEventListener(\"click\", function (event) {\n instrDisplay(\"pln-step-four\", 2);\n instrDisplay(\"pln-step-five\", 1);\n document.getElementById(\"pln-stepfour-next\").style.display=\"none\";\n });\n\n //* End of Event Listeners\n\n //* Styling for first instruction step one on the Parameters page * //\n instrDisplay(\"pln-step-one\", 1);\n\n //* Styling for third instruction step three on the Location Page * //\n instrDisplay(\"pln-step-three\", 1);\n\n //* Styling for the Flight Summary on the Location Page * //\n instrDisplay(\"pln-flsummary\", 2);\n}", "function getSupportedSitesInfo() {\n var sites = {\n\n // Example URLs:\n // http://www.refinery29.com/2016/12/133127/how-to-wrap-presents\n \"refinery29.com\": {\n loadAll: function (thisInfo, fullArticleContainer, url) {\n addClassToDOMElements('.opener', 'isVisible active', function (unused) {\n addClassToDOMElements('.slide', 'isVisible active', function (msg) {\n displayResult('Loaded ' + (msg.numLoaded ? msg.numLoaded : 'all') + ' slides');\n });\n });\n }\n },\n\n \"knowable.com\": {\n // Example URLs:\n // http://www.knowable.com/a/23-people-were-asked-what-is-the-most-messed-up-family-secret-you-know/p-1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(knowable\\.com\\/a\\/[^\\/]+)((\\/p-)([0-9]+))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // knowable.com/a/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/p-{0}') // /p-X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.article-body',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '/t/end-gallery',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('.article-body .btn-next-xl');\n return (!nextLink.length || nextLink.attr('href') == '/t/end-gallery');\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n if (pageNum > 1) { // hide article title after page 1\n articleMeat.find('.article-header').addClass('hidden');\n }\n articleMeat.find('.article-footer-v2').addClass('hidden');\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n fullArticleContainer.addClass(thisInfo.articleMeatSelector);\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements(thisInfo.articleMeatSelector, fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"suggest.com\": { // also applies to minq.com\n // Example URLs:\n // http://www.suggest.com/lifestyle/1600362/how-did-they-even-get-hired-employees-share-their-17-most-insane-crazy-employee-stories?story_page=1\n // http://www.minq.com/lifestyle/1599990/21-people-share-awesome-stories-about-how-they-became-friends-with-their-bffs?story_page=1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(.+\\.com\\/[^\\/]+\\/[^\\/]+\\/[^\\/]+)((\\/\\?story_page=)([0-9]+))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // suggest.com/section/1234/article-title-here OR minq.com/...\n + (matches[4] ? matches[5] + '{0}' : '/?story_page={0}') // /?story_page=X\n + (matches[7] && matches[7] != '/' ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.slide',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '#',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('.next-story');\n return (!nextLink.length || nextLink.attr('href').indexOf('story_page') == -1); // next page is a new article\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n fullArticleContainer.addClass(thisInfo.articleMeatSelector + ' partial content_story_pages_slide primary');\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements('.slot[data-slot=\"center\"]', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"emgn.com\": {\n // Example URL:\n // http://emgn.com/s2/19-extreme-body-transformations-thatll-leave-jaw-aching/1\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(emgn\\.com\\/[^\\/]+\\/[^\\/]+)((\\/)([0-9]*))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // emgn.com/something/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/{0}') // /X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.content > *:not(aside):not(.pagination):not(.rrssb-holder)',\n isPastLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one with text 'Next Article',\n // we've past the last page\n var html = $.parseHTML(responseText);\n var nextDiv = $(html).find('.pagination .next');\n return (nextDiv.length && (nextDiv[0].innerText).indexOf('Article') >= 0); // this is the junky page before next article\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Function to execute after retrieving all of the article content\n var afterLastPage = function (pageNum) {\n fullArticleContainer.addClass('content');\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n replaceDOMElements('article.content', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n if (thisInfo.isPastLastPage(responseText)) {\n afterLastPage(pageNum);\n }\n else {\n if (pageNum > 1) {\n thisInfo.articleMeatSelector += ':not(h1)'; // don't show the title more than once\n }\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n fullArticleContainer.append(articleMeat);\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"lifebuzz.com\": {\n // Example URL:\n // http://www.lifebuzz.com/princess-diana/1/\n getReplaceFormat: function (url) {\n var ret = '';\n var regex = /(http[s]?:\\/\\/)?(www\\.)*(lifebuzz\\.com\\/[^\\/]+)((\\/)([0-9]*))?(.*)/i;\n var matches = url.match(regex);\n if (!matches) {\n renderStatus('Invalid URL format :(');\n return ret;\n }\n // Reconstruct URL\n ret += (matches[1] ? matches[1] : '') // http://\n + (matches[2] ? matches[2] : '') // www.\n + (matches[3]) // lifebuzz.com/article-title-here\n + (matches[4] ? matches[5] + '{0}' : '/{0}') // /X\n + (matches[7] ? matches[7] : ''); // anything after that\n return ret;\n },\n articleMeatSelector: '.single > *:not(#desktop-below-post-trending)',\n isLastPage: function (responseText) {\n // If there isn't a 'Next' button, or there is one that links to '/t/end-gallery',\n // this is the last page\n var html = $.parseHTML(responseText);\n var nextLink = $(html).find('a.next-post');\n return (nextLink.length);\n },\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Recursively retrieve pages of article until the last one\n var urlFormat = thisInfo.getReplaceFormat(url);\n var addPage = function (pageNum) {;\n httpGet(urlFormat.format(pageNum), function (responseText) {\n // Get the meat of the article and append it to our fullArticleContainer element\n var html = $.parseHTML(responseText);\n var articleMeat = $(html).find(thisInfo.articleMeatSelector);\n articleMeat.find('img.lazy').each(function (index, listItem) {\n $(listItem).attr('src', $(listItem).attr('data-original'));\n });\n fullArticleContainer.append(articleMeat);\n // Examine the page. If it's the last one, add the elements to the page;\n // otherwise, keep going.\n if (thisInfo.isLastPage(responseText)) {\n // Done - get the appropriate element on the page and replace it with \n // the element that we created.\n fullArticleContainer.addClass('single');\n fullArticleContainer.find('.post-pagination').addClass('hidden');\n fullArticleContainer.find('.share-bar').addClass('hidden');\n replaceDOMElements('.single', fullArticleContainer[0].outerHTML, function (msg) {\n if (msg && msg.success) {\n displayResult('Loaded ' + (pageNum) + ' pages');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n else {\n addPage(pageNum + 1);\n }\n });\n }\n addPage(1);\n }\n },\n\n \"forbes.com\": {\n buttonNote: '(will open in new window)',\n // Example URL:\n // http://www.forbes.com/sites/michaelbobelian/2016/12/16/democrats-best-hope-to-defeat-trumps-cabinet-picks-lies-in-glare-of-confirmation-process/\n loadAll: function (thisInfo, fullArticleContainer, url) {\n // Click the 'print' button\n triggerEventOnDOMElement('.print a', 'click', function (msg) {\n if (msg && msg.success) {\n displayResult('Opened full article');\n }\n else {\n console.error(msg.error);\n displayResult(GENERIC_ERROR);\n }\n });\n }\n },\n }\n\n // minq.com has the same format as suggest.com (wat)\n sites['minq.com'] = sites['suggest.com'];\n\n return sites;\n}", "function callPageView() {\n initVars();\n var isPathindicatorEng = \"\";\n var currentUrl = unescape(window.location.href);\n\n // Exception part\n if (getOmniInputTagValue(\"pid\") == \"no\") {\n initVars();\n return;\n }\n\n /* exception code will be used in the future...\n if ((\"fr\".indexOf(getOmniSiteCd())!=-1 && currentUrl.indexOf(\"http://\"+window.location.host+\"/fr/business/smart-printers/\") !=-1)) {\n initVars();\n return;\n }\n */\n if (getOmniInputTagValue(\"microsite\") == \"microsite\") {\n initVars();\n s.linkTrackVars = \"none\";\n s.linkTrackEvents = \"none\";\n s.pageName = getOmniSiteCd() + \":campaign\";\n var s_code = s.t(); if (s_code) document.write(s_code);\n return;\n }\n\n if (currentUrl.indexOf('/sns/login') != -1) {\n return;\n }\n\n if (currentUrl.indexOf('/_ui/desktop/static/') != -1) {\n return;\n }\n\n if (currentUrl.indexOf('support-ca.samsung.com/cyber/mysamsung/') != -1) {\n console.log(\"ca mySamsung\");\n return;\n }\n\n if (currentUrl.indexOf('/ng/') != -1) {//Store Page\n isPathindicatorEng = \"STORE\";\n } else if (currentUrl.indexOf('shop.samsung.com/br') != -1) {\n isPathindicatorEng = \"BRSTORE\";\n } else if (getOmniInputTag(\"pathindicatorENG\") != \"none\") {//Check the pathindicatorENG tag\n if (getOmniInputTag(\"pathindicatorENG\").getElementsByTagName(\"a\").item(0).innerHTML) {\n isPathindicatorEng = \"Y\"\n } else {\n isPathindicatorEng = \"N\";\n }\n } else {\n isPathindicatorEng = \"N\";\n }\n\n switch (isPathindicatorEng) {\n case \"STORE\": sendPageCodeStore(); break;\n case \"BRSTORE\": sendPageCodeStoreBr(); break;\n case \"Y\": sendPageCode(); break;\n case \"N\": sendPageCodeUrl(); break;\n }\n}", "function do_gigmasters1()\n {\n var i,j;\n var result={success:false};\n var vendor_re=/VENDORS\\s*(\\d+)\\s*-\\s*(\\d+)\\s*of\\s*(\\d+)/i,vendor_match;\n var enum_re=/#\\s*(\\d+)/,enum_match;\n var loadmore=document.getElementsByClassName(\"loadmore\")[0];\n var loadbutton=document.getElementsByClassName(\"load-more-btn\");\n\n var p=loadmore.getElementsByTagName(\"p\")[0];\n var search=document.getElementsByClassName(\"search-result\");\n vendor_match=p.innerText.match(vendor_re);\n var name;\n var gig_url;\n\n if(vendor_match!==null &&\n\n (my_query.listing_num <= parseInt(vendor_match[2])) || (my_query.listing_num<=25))\n {\n console.log(\"Found good, \"+my_query.listing_num+\", \"+vendor_match[2]);\n if(my_query.listing_num>parseInt(vendor_match[2])) my_query.listing_num=parseInt(vendor_match[2]);\n\n }\n else\n {\n if(loadbutton[0].parentNode.className!==\"ng-hide\" && my_query.loadCount<10)\n {\n my_query.loadCount++;\n loadbutton[0].click();\n setTimeout(do_gigmasters1,700);\n return;\n }\n else\n {\n console.log(\"loadbutton[0].parentNode.className=\"+loadbutton[0].parentNode.className+\"\\tloadCount=\"\n +my_query.loadCount);\n }\n console.log(\"Found bad, \"+my_query.listing_num+\", \"+vendor_match[2]);\n GM_setValue(\"returnHit\",true);\n return;\n }\n\n\n /* Find the right search */\n for(i=0; i < search.length; i++)\n {\n enum_match=search[i].getElementsByClassName(\"enumerator\")[0].innerText.match(enum_re);\n if((enum_match!==null && parseInt(enum_match[1])===my_query.listing_num)\n ||(i===my_query.listing_num-1)\n )\n {\n name=search[i].getElementsByClassName(\"name\")[0];\n console.log(\"Found match\");\n result={name:name.innerText.trim(),success:true};\n gig_url=name.getElementsByTagName(\"a\")[0].href;\n }\n\n }\n GM_setValue(\"gig_result\",result);\n if(gig_url!==undefined) window.location.href=gig_url;\n }", "function checkForCustomerIdInUrl(pageurl)\n{\n //Accept.js and Accept.js UI accepts only product type\n //If the user passes customer id to Accept.js or Accept.js UI product type, then user gets redirected to the error message section\n if (pageurl.toLowerCase().indexOf(\"&customerid=\") > 0) {\n\n //The content of all the 4 product types is disabled on the page\n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n\n //Below code gets executed on invalid page request by the user\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n else {\n\n //If the user selects Accept.js UI product type in the dashboard page\n if(activeCont == \"acceptui\")\n {\n document.getElementById(\"acceptui\").style.display = \"block\";\n AcceptUI();\n }\n //If the user selects Accept.js product type in the dashboard page\n else\n {\n document.getElementById(\"acceptjs\").style.display = \"block\";\n\n //By default credit card radio button is selected for accept js \n document.getElementById(\"rdCard\").click();\n }\n }\n}", "function pageInit() {\n $(window).load(function() {\n // Animate loader off screen\n $(\".se-pre-con\").fadeOut(\"slow\");;\n });\n\n console.log(document.getElementsByClassName('instruction_button'));\n\n //Search: RP - Services\n var serviceSearch = search.load({\n id: 'customsearch_rp_services',\n type: 'customrecord_service'\n });\n \n var currRecord = currentRecord.get();\n var zeeVal = currRecord.getValue({\n fieldId: 'zee'\n });\n\n serviceSearch.filters.push(search.createFilter({\n name: 'custrecord_service_franchisee',\n operator: search.Operator.ANYOF,\n values: zeeVal\n }));\n\n \n \n var resultSetCustomer = serviceSearch.run();\n var old_customer_id;\n var old_service_id;\n var old_entity_id;\n var old_company_name;\n \n var count = 0;\n var customer_count = 0;\n \n var service_id_array = [];\n var service_name_array = [];\n var service_descp_array = [];\n var service_price_array = [];\n var service_freq_count_array = [];\n var service_leg_count_array = [];\n var service_no_of_legs_array = [];\n \n var reviewed = false;\n \n var dataSet = '{\"data\":[';\n\n \n resultSetCustomer.each(function(searchResult) {\n\n var custid = searchResult.getValue({ name: \"custrecord_service_customer\", join: null, summary: search.Summary.GROUP});\n \n var entityid = searchResult.getValue({ name: \"entityid\", join: \"CUSTRECORD_SERVICE_CUSTOMER\", summary: search.Summary.GROUP});\n \n var companyname = searchResult.getValue({ name: \"companyname\", join: \"CUSTRECORD_SERVICE_CUSTOMER\", summary: search.Summary.GROUP});\n \n var service_id = searchResult.getValue({ name: \"internalid\", join: null, summary: search.Summary.GROUP});\n \n var service_name = searchResult.getText({ name: \"custrecord_service\", join: null, summary: search.Summary.GROUP});\n \n var service_descp = searchResult.getValue({ name: \"custrecord_service_description\", join: null, summary: search.Summary.GROUP});\n \n var service_price = searchResult.getValue({ name: \"custrecord_service_price\", join: null, summary: search.Summary.GROUP});\n \n var service_leg_freq_count = searchResult.getValue({ name: \"internalid\", join: \"CUSTRECORD_SERVICE_FREQ_SERVICE\", summary: search.Summary.COUNT});\n \n var service_leg_count = searchResult.getValue({ name: \"internalid\", join: \"CUSTRECORD_SERVICE_LEG_SERVICE\", summary: search.Summary.COUNT});\n \n var no_of_legs = searchResult.getValue({ name: \"custrecord_service_type_leg_no\", join: \"CUSTRECORD_SERVICE\", summary: search.Summary.GROUP});\n \n if (count != 0 && old_customer_id != custid) {\n\n\n dataSet += '{\"cust_id\":\"' + old_customer_id + '\", \"entity_id\":\"' + old_entity_id + '\", \"company_name\":\"' + old_company_name + '\",\"reviewed\": \"' + reviewed + '\",'\n\n dataSet += '\"services\": ['\n\n for (var i = 0; i < service_id_array.length; i++) {\n\n\n dataSet += '{';\n\n dataSet += '\"service_name\": \"' + service_name_array[i] + '\", \"service_descp\": \"' + service_descp_array[i] + '\", \"freq_count\": \"' + service_freq_count_array[i] + '\", \"leg_count\": \"' + service_leg_count_array[i] + '\", \"no_of_legs\": \"' + service_no_of_legs_array[i] + '\", \"service_price\": \"' + service_price_array[i] + '\",\"service_id\": \"' + service_id_array[i] + '\"'\n\n dataSet += '},'\n }\n dataSet = dataSet.substring(0, dataSet.length - 1);\n dataSet += ']},'\n\n customer_count++;\n\n service_id_array = [];\n service_name_array = [];\n service_descp_array = [];\n service_price_array = [];\n service_freq_count_array = [];\n service_leg_count_array = [];\n service_no_of_legs_array = [];\n\n reivewed = false;\n\n service_id_array[service_id_array.length] = service_id;\n service_name_array[service_name_array.length] = service_name;\n service_descp_array[service_descp_array.length] = service_descp;\n service_price_array[service_price_array.length] = service_price;\n service_freq_count_array[service_freq_count_array.length] = service_leg_freq_count;\n service_leg_count_array[service_leg_count_array.length] = service_leg_count;\n service_no_of_legs_array[service_no_of_legs_array.length] = no_of_legs;\n\n if (service_leg_freq_count == service_leg_count && service_leg_count == no_of_legs) {\n reviewed = true;\n } else {\n reviewed = false;\n }\n } else {\n service_id_array[service_id_array.length] = service_id;\n service_name_array[service_name_array.length] = service_name;\n service_descp_array[service_descp_array.length] = service_descp;\n service_price_array[service_price_array.length] = service_price;\n service_freq_count_array[service_freq_count_array.length] = service_leg_freq_count;\n service_leg_count_array[service_leg_count_array.length] = service_leg_count;\n service_no_of_legs_array[service_no_of_legs_array.length] = no_of_legs;\n if (service_leg_freq_count == service_leg_count && service_leg_count == no_of_legs) {\n reviewed = true;\n } else {\n reviewed = false;\n }\n }\n\n old_customer_id = custid;\n old_service_id = service_id;\n old_entity_id = entityid;\n old_company_name = companyname;\n\n count++;\n return true;\n });\n\n if (count > 0) {\n dataSet += '{\"cust_id\":\"' + old_customer_id + '\", \"entity_id\":\"' + old_entity_id + '\", \"company_name\":\"' + old_company_name + '\",\"reviewed\": \"' + reviewed + '\",'\n \n dataSet += '\"services\": ['\n \n for (var i = 0; i < service_id_array.length; i++) {\n \n \n dataSet += '{';\n \n dataSet += '\"service_name\": \"' + service_name_array[i] + '\", \"service_descp\": \"' + service_descp_array[i] + '\", \"freq_count\": \"' + service_freq_count_array[i] + '\", \"leg_count\": \"' + service_leg_count_array[i] + '\", \"no_of_legs\": \"' + service_no_of_legs_array[i] + '\", \"service_price\": \"' + service_price_array[i] + '\",\"service_id\": \"' + service_id_array[i] + '\"'\n \n dataSet += '},'\n }\n dataSet = dataSet.substring(0, dataSet.length - 1);\n dataSet += ']},'\n }\n \n dataSet = dataSet.substring(0, dataSet.length - 1);\n dataSet += ']}';\n var parsedData = JSON.parse(dataSet);\n console.log(parsedData.data);\n\n\n // AddStyle('https://1048144.app.netsuite.com/core/media/media.nl?id=1988776&c=1048144&h=58352d0b4544df20b40f&_xt=.css', 'head');\n\n //JQuery to sort table based on click of header. Attached library \n $(document).ready(function() {\n table = $(\"#customer\").DataTable({\n \"data\": parsedData.data,\n \"columns\": [{\n \"orderable\": false,\n \"data\": null,\n \"defaultContent\": '<button type=\"button\" class=\"details-control form-control btn-xs btn-success \" ><span class=\"span_class glyphicon glyphicon-plus\"></span></button>'\n }, {\n \"data\": null,\n \"render\": function(data, type, row) {\n return '<button type=\"button\" data-custid=\"' + data.cust_id + '\" class=\"edit_customer form-control btn-xs btn-warning \" ><span class=\"span_class glyphicon glyphicon-pencil\"></span></button>';\n }\n }, {\n \"data\": \"entity_id\"\n }, {\n \"data\": \"company_name\"\n }, {\n \"data\": null,\n \"defaultContent\": ''\n }, ],\n \"columnDefs\": [{\n\n \"render\": function(data, type, row) {\n if (data.reviewed == 'true') {\n return '<img src=\"https://1048144.app.netsuite.com/core/media/media.nl?id=1990778&c=1048144&h=e7f4f60576de531265f7\" height=\"25\" width=\"25\">';\n }\n },\n \"targets\": [4]\n }],\n \"order\": [\n [1, 'asc']\n ],\n \"pageLength\": 100\n });\n });\n var main_table = document.getElementsByClassName(\"uir-outside-fields-table\");\n var main_table2 = document.getElementsByClassName(\"uir-inline-tag\");\n\n\n for (var i = 0; i < main_table.length; i++) {\n main_table[i].style.width = \"50%\";\n }\n\n for (var i = 0; i < main_table2.length; i++) {\n main_table2[i].style.position = \"absolute\";\n main_table2[i].style.left = \"10%\";\n main_table2[i].style.width = \"80%\";\n main_table2[i].style.top = \"275px\";\n }\n\n jQuery();\n }", "function SetInputControl2(screenIdEnum) {\n \n\n var inst; //instance of source control\n\n //Get instance of the tree control for the page you are switching to\n switch (screenIdEnum) {\n case ScreenId.StatementsPast:\n inst = $(\"#Statements-Past-Input\").mobiscroll('getInst');\n break;\n case ScreenId.StatementsPresent:\n inst = $(\"#Statements-Present-Input\").mobiscroll('getInst');\n break;\n case ScreenId.StatementsFuture:\n inst = $(\"#Statements-Future-Input\").mobiscroll('getInst');\n break;\n case ScreenId.SwitchPast:\n inst = $(\"#Switch-Past-Input\").mobiscroll('getInst');\n break;\n case ScreenId.SwitchPresent:\n inst = $(\"#Switch-Present-Input\").mobiscroll('getInst');\n break;\n case ScreenId.SwitchFuture:\n inst = $(\"#Switch-Future-Input\").mobiscroll('getInst');\n break;\n default:\n Alert(\"Error\");//error\n break; \n }\n \n inst.hide();\n //if the setValue function exists\n if (Object.keys(inst).some(function (k) { return ~k.indexOf(\"setArrayVal\") })) {\n //alert(LastSentenceSelections);\n try {\n inst.setArrayVal(LastSentenceSelections); //set values to match the last sentence\n //alert(screenIdEnum); \n }\n catch (err) {\n alert(err);\n }\n\n }\n inst.show();//Trigger OnShow Event \n\n //Update Sentence\n DisplaySentence2(screenIdEnum);\n \n}", "function examinePage() {\n\n var pd = {};\n\n {\n // search for text that might indicate an article requires sourcing...\n var indicators = [\"scientists have\", \"scientists say\", \"paper published\", \"research suggests\", \"latest research\", \"researchers\", \"the study\"]\n /* other possibilities:\n \"according to a new study\"\n \"the study\"\n \"findings\"\n */\n\n /* TODO: could check for obvious containers, to exclude menus, sidebars and other cruft */\n var hits = searchHTML(document.body, indicators);\n if(hits.length>0) {\n // looks like sourcing is needed...\n pd.indicatorsFound = true;\n } else {\n pd.indicatorsFound = false;\n }\n }\n\n\n // is an og:type metatag present?\n {\n pd.ogType = null;\n var meta_ogtype = document.querySelector('meta[property=\"og:type\"]');\n if( meta_ogtype != null ) {\n if(meta_ogtype.content !== undefined) {\n pd.ogType = meta_ogtype.content;\n }\n }\n }\n\n // how about a schema.org type?\n {\n var container = document.querySelector('[itemscope][itemtype]')\n if( container != null ) {\n pd.schemaType = container.getAttribute('itemtype');\n } else {\n pd.schemaType = null;\n }\n }\n\n // hNews?\n {\n hnews = document.querySelector('.hnews')\n if( hnews != null ) {\n pd.hnews = true;\n } else {\n pd.hnews = false;\n }\n }\n\n\n var schemaorg_art_types = [\n \"http://schema.org/Article\",\n \"http://schema.org/NewsArticle\",\n \"http://schema.org/BlogPosting\",\n \"http://schema.org/ScholarlyArticle\",\n \"http://schema.org/MedicalScholarlyArticle\" ];\n\n /* now make a call - are we confident it is or isn't an article? */\n pd.isDefinitelyArticle = false;\n pd.isDefinitelyNotArticle = false;\n\n if(pd.schemaType !== null ) {\n if(schemaorg_art_types.indexOf(pd.schemaType) > -1 ) {\n pd.isDefinitelyArticle = true;\n } else {\n pd.isDefinitelyNotArticle = true;\n }\n }\n\n if( pd.ogType !== null ) {\n if( pd.ogType=='article' || pd.ogType=='tumblr-feed:entry') {\n pd.isDefinitelyArticle = true;\n }\n\n if( pd.ogType=='website') {\n pd.isDefinitelyNotArticle = true;\n }\n }\n\n if( pd.hnews==true ) {\n pd.isDefinitelyArticle = true;\n }\n\n // could have conflicting info...\n if( pd.isDefinitelyArticle && pd.isDefinitelyNotArticle ) {\n // ignore all!\n pd.isDefinitelyArticle = false;\n pd.isDefinitelyNotArticle = false;\n }\n\n return pd;\n}", "function initializeInstrumentsAndMethods() {\n var auids = [];\n\n /// Get all the analysis UIDs from this manage results table, cause\n // we'll need them to retrieve all the IMM constraints/rules to be\n // applied later.\n var dictuids = $.parseJSON($('#lab_analyses #item_data, #analyses_form #item_data').val());\n $.each(dictuids, function(key, value) { auids.push(key); });\n\n // Retrieve all the rules/constraints to be applied for each analysis\n // by using an ajax call. The json dictionary returned is assigned to\n // the variable mi_constraints for further use.\n // FUTURE: instead of an ajax call to retrieve the dictionary, embed\n // the dictionary in a div when the bika_listing template is rendered.\n $.ajax({\n url: window.portal_url + \"/get_method_instrument_constraints\",\n type: 'POST',\n data: {'_authenticator': $('input[name=\"_authenticator\"]').val(),\n 'uids': $.toJSON(auids) },\n dataType: 'json'\n }).done(function(data) {\n // Save the constraints in the m_constraints variable\n mi_constraints = data;\n $.each(auids, function(index, value) {\n // Apply the constraints/rules to each analysis.\n load_analysis_method_constraint(value, null);\n });\n }).fail(function() {\n window.bika.lims.log(\"bika.lims.worksheet: Something went wrong while retrieving analysis-method-instrument constraints\");\n });\n }", "function initialize_expand_state_parameters() {\n\tvar non_during_cookies = get_non_account_cookies(my_domain);\n\tnon_during_suspected_account_cookies_array = Object.keys(non_during_cookies);\n\ttot_non_during_cookies = non_during_suspected_account_cookies_array.length;\n }", "function lgm_addControls() {\n var foundSite = gmFoundFilter2(currSite);\n if (gmIsObject(foundSite)) {\n img2Search = foundSite.url;\n elemSearchUrl = foundSite.search;\n elemReplUrl = foundSite.replace;\n elemReplUrlLarge = foundSite.replace_large;\n elemWithDownLink = foundSite.withDownload;\n }\n return true;\n}", "function SP_GetLaunchedFormNo(linksField)\n{\n var oListFormNos = document.getElementById(linksField); \n\tif(oListFormNos.length != 0)\n\t{\n\t\tvar sLastFormNum;\n\t\tvar nRevIndex;\n\t\tvar arry = new Array();\n\t\tvar i;\n\t\t\n\t\tfor (i=0; i<oListFormNos.length;i++)\n\t\t{\n\t\t\tvar itemFace = oListFormNos[i].value;\n\t\t\tarry[i] = itemFace;\n\t\t} \n\t\tarry.sort();\n\t\t\n\t\tsLastFormNum = arry[arry.length-1];\n\t\tnRevIndex = sLastFormNum.toLowerCase().indexOf(new String(\"Rev\").toLowerCase());\n\t\tif (nRevIndex>-1)\n\t\tsLastFormNum = sLastFormNum.substr(0, nRevIndex-1);\n\t\t\n\t\treturn sLastFormNum;\n\t}\n\telse\n\t{\n\t\treturn \"\";\n\t}\t\n}", "function _trackForms () {\r\n [].forEach.call(document.querySelectorAll('form[id][' + objSettings.attribute + ']'), function each (element) {\r\n providers.forEach(function _trackCharge (provider) {\r\n if (typeof provider.obj.trackForm === 'function') {\r\n provider.obj.trackForm('#' + element.id, element.getAttribute(objSettings.attribute));\r\n }\r\n });\r\n });\r\n}", "function loadCountryCodes() {\n $('select[name=\"gwapi[cc]\"], #recipient_cc').gwapiMobileCc();\n }", "findControls() {\n\t\tthis.hiderElement = this.container.querySelector(this.hiderElementSelector);\n\t\tthis.showerElement = this.container.querySelector(this.showerElementSelector);\n\t}", "function initTellCompany(){\t\t\t\n//\t$(\"#country\").change( onCountrySelect );\n\t\n\tvar ftype_ = $(\"#ftype\").val();\n\tif(stdSmartFormUsrReg == ftype_){\n\t\tvar fieldMap= {\"industries\":\"#sel_industry\"};\n\t\t//alert(\"initializing dropdowns as the page loading is done !!\");\n\t\tloadDropdowns(fieldMap,\"#getAllStaticDataUrl\");\n\t}\n\tif( evalProductForm == ftype_ ){\n\t\tvar fieldMap= {\"industries\":\"#sel_industry\",\"globalEmployees\":\"#sel_employees_globally\",\"nationalEmployees\":\"#sel_employees_country\"};\n\t\tloadDropdowns(fieldMap,\"#getAllStaticDataUrl\");\n\t}\n\t\n\t\n//\tvar fieldMap= {\"industries\":\"#sel_industry\",\"globalEmployees\":\"#sel_employees_globally\",\"nationalEmployees\":\"#sel_employees_country\"};\n//\t//alert(\"initializing dropdowns as the page loading is done !!\");\n//\tloadDropdowns(fieldMap,\"#getAllStaticDataUrl\");\n\t\n}", "function getNumRequests() {\n var selector = document.getElementById(\"pages\");\n return selector.options[selector.selectedIndex].value;\n}", "function CollectLabels(){\r\n\tconst pntD = document.getElementById('selection'); //Points to display DIV in HTML\r\n\tvar priorities = [];\r\n\t\t//Tools to Get the Text Given by User\r\n\tvar labels = document.getElementsByTagName('input');\r\n\tvar cnt = labels.length;\r\n\t\r\n\tfor(let i=0; i<cnt; i++) {\r\n\t\tif((labels[i].getAttribute('type')=='text')&&(labels[i].value != \"\")){\r\n\t\t\tlet regex = /^\\s+$/;\r\n\t\t\tif(regex.test(labels[i].value) !== true){\r\n\t\t\t\tpriorities.push(labels[i].value);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\tdocument.getElementById('result').innerHTML = \" \"; //Clear any exsisting results list.\r\n\t\r\n\tCreateSelectBoxes(pntD, priorities); //Set-up for collecting further data from user\r\n\tpriLabels = priorities; //Add to global variable, for numbercrunching later\r\n}", "function countSites(task) {\r\n if (task == 1) {\r\n const count_total = sites.concat(icon_sites).length;\r\n return count_total;\r\n }\r\n if (task == 2) {\r\n // Init GM_config to get amount of selected sites.\r\n // GM_config's fields needs to be mirrored to keep Settings intact.\r\n var config_fields = {\r\n 'aftertitle': {'type': 'hidden'},\r\n 'imdbtotalstats': {'type': 'hidden'},\r\n 'imdbselectedstats': {'type': 'hidden'},\r\n 'imdbscoutmod_header_text': {'type': 'text'},\r\n 'imdbscoutsecondbar_header_text': {'type': 'text'},\r\n 'imdbscoutthirdbar_header_text': {'type': 'text'},\r\n 'mod_icons_size': {'type': 'text'},\r\n 'iconsborder_size': {'type': 'select', 'options': ['2px', '3px', '4px', '5px', '6px']},\r\n 'cfg_iconsize': {'type': 'text'},\r\n 'timeout_ms': {'type': 'select', 'options': ['10000 ms', '20000 ms', '30000 ms', '45000 ms', '60000 ms']},\r\n 'load_icons_in_settings': {'type': 'checkbox'},\r\n 'remove_ads': {'type': 'checkbox'},\r\n 'debug_sites': {'type': 'checkbox'},\r\n 'loadmod_on_start_movie': {'type': 'checkbox'},\r\n 'load_second_bar': {'type': 'checkbox'},\r\n 'load_third_bar_movie': {'type': 'checkbox'},\r\n 'switch_bars': {'type': 'checkbox'},\r\n 'sortReqOnNewLine': {'type': 'checkbox'},\r\n 'call_http_mod_movie': {'type': 'checkbox'},\r\n 'hide_missing_movie': {'type': 'checkbox'},\r\n 'use_mod_icons_movie': {'type': 'checkbox'},\r\n 'one_line': {'type': 'checkbox'},\r\n 'ignore_type_movie': {'type': 'checkbox'},\r\n 'remove_openall': {'type': 'checkbox'},\r\n 'force_reference_view': {'type': 'checkbox'},\r\n 'dark_reference_view': {'type': 'checkbox'},\r\n 'compact_reference_view': {'type': 'checkbox'},\r\n 'greybackground_reference_view': {'type': 'checkbox'},\r\n 'highlight_sites_movie': {'type': 'text'},\r\n 'highlight_missing_movie': {'type': 'text'},\r\n 'loadmod_on_start_search': {'type': 'checkbox'},\r\n 'load_third_bar_search': {'type': 'checkbox'},\r\n 'call_http_mod_search': {'type': 'checkbox'},\r\n 'hide_missing_search': {'type': 'checkbox'},\r\n 'use_mod_icons_search': {'type': 'checkbox'},\r\n 'ignore_type_search': {'type': 'checkbox'},\r\n 'highlight_sites_search': {'type': 'text'},\r\n 'highlight_missing_search': {'type': 'text'},\r\n 'ratings_img_px': {'type': 'select', 'options': ['32px', '48px', '64px']},\r\n 'ratings_cfg_imdb': {'type': 'checkbox'},\r\n 'ratings_cfg_metacritic': {'type': 'checkbox'},\r\n 'ratings_cfg_rotten': {'type': 'checkbox'},\r\n 'ratings_cfg_letterboxd': {'type': 'checkbox'},\r\n 'ratings_cfg_douban': {'type': 'checkbox'},\r\n 'ratings_cfg_allocine': {'type': 'checkbox'},\r\n 'ratings_imdb_fem': {'type': 'checkbox'},\r\n 'ratings_cfg_color': {'type': 'checkbox'},\r\n 'ratings_cfg_color_scheme': {'type': 'text'},\r\n 'ratings_cfg_omdb_apikey': {'type': 'text'},\r\n 'radarr_searchformovie': {'type': 'checkbox'},\r\n 'radarr_monitored': {'type': 'checkbox'},\r\n 'radarr_url': {'type': 'text'},\r\n 'radarr_apikey': {'type': 'text'},\r\n 'radarr_rootfolderpath': {'type': 'text'},\r\n 'radarr_profileid': {'type': 'select', 'options': ['Any', 'HD - 720p/1080p', 'HD-1080p', 'HD-720p', 'SD', 'Ultra-HD', 'Custom']},\r\n 'radarr_customprofileid': {'type': 'text'},\r\n 'radarr_minimumavailability': {'type': 'select', 'options': ['announced', 'inCinemas', 'released', 'preDB']},\r\n 'sonarr_searchformissing': {'type': 'checkbox'},\r\n 'sonarr_searchforcutoff': {'type': 'checkbox'},\r\n 'sonarr_ignoreEpisodesWithFiles': {'type': 'checkbox'},\r\n 'sonarr_ignoreEpisodesWithoutFiles': {'type': 'checkbox'},\r\n 'sonarr_seasonfolder': {'type': 'checkbox'},\r\n 'sonarr_usescenenumbering': {'type': 'select', 'options': ['Auto', 'No', 'Yes']},\r\n 'sonarr_monitored': {'type': 'select', 'options': ['All Episodes', 'Future Episodes', 'Missing Episodes', 'Existing Episodes', 'Pilot Episode', 'Only First Season', 'Only Latest Season', 'None']},\r\n 'sonarr_url': {'type': 'text'},\r\n 'sonarr_apikey': {'type': 'text'},\r\n 'sonarr_rootfolderpath': {'type': 'text'},\r\n 'sonarr_profileid': {'type': 'select', 'options': ['Any', 'HD - 720p/1080p', 'HD-1080p', 'HD-720p', 'SD', 'Ultra-HD', 'Custom']},\r\n 'sonarr_customprofileid': {'type': 'text'},\r\n 'sonarr_languageprofileid': {'type': 'text'},\r\n 'sonarr_seriestype': {'type': 'select', 'options': ['standard', 'daily', 'anime']},\r\n 'trakt_synclimiter': {'type': 'select', 'options': ['15', '30', '60', '300']},\r\n 'plex_server_url': {'type': 'text'},\r\n 'plex_token': {'type': 'text'},\r\n 'jellyfin_server_url': {'type': 'text'},\r\n 'jellyfin_username': {'type': 'text'},\r\n 'jellyfin_password': {'type': 'text'},\r\n 'jellyfin_debug': {'type': 'checkbox'},\r\n 'emby_server_url': {'type': 'text'},\r\n 'emby_username': {'type': 'text'},\r\n 'emby_password': {'type': 'text'},\r\n 'emby_debug': {'type': 'checkbox'},\r\n 'milkie_authToken': {'type': 'text'},\r\n 'tnt_authToken': {'type': 'text'}\r\n };\r\n $.each(custom_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(public_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(private_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(german_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(usenet_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(subs_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(pre_databases, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(other_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(streaming_sites, function(index, site) {config_fields[configName(site)] = {'type': 'checkbox'};});\r\n $.each(icon_sites_main, function(index, icon_site) {config_fields['show_icon_' + icon_site['name']] = {'type': 'checkbox'};});\r\n $.each(special_buttons, function(index, icon_site) {config_fields['show_icon_' + icon_site['name']] = {'type': 'checkbox'};});\r\n\r\n GM_config.init({'id': 'imdb_scout', 'fields': config_fields});\r\n\r\n $.each(sites, function(index, site) {\r\n site['show'] = GM_config.get(configName(site));\r\n });\r\n $.each(icon_sites, function(index, icon_site) {\r\n icon_site['show'] = GM_config.get('show_icon_' + icon_site['name']);\r\n });\r\n\r\n const count_selected = sites.concat(icon_sites).reduce(function (n, site) {\r\n return n + (site['show'] == true); }, 0);\r\n\r\n return count_selected;\r\n }\r\n}", "async function getClassDetailsIter(number) {\n const browser = await puppeteer.launch({headless: false});\n const page = await browser.newPage();\n await page.goto(\"https://sa.ucla.edu/ro/public/soc\", {\n waitUntil: \"networkidle2\",\n });\n await page.click(\"#select_filter_subject\");\n await page.waitFor(1000);\n\n let i = 0;\n while (i < number + 1) {\n await page.keyboard.press(\"ArrowDown\");\n await page.waitFor(150);\n i++;\n }\n\n await page.waitFor(300);\n await page.keyboard.press(\"Enter\");\n await page.waitFor(200);\n await page.keyboard.press(\"Enter\");\n\n let isNull = false;\n await page\n .waitForNavigation({\n timeout: 10000,\n })\n .catch(() => {\n isNull = true;\n });\n\n if (isNull == true) {\n await browser.close();\n return [{}];\n }\n\n //now on results page\n await page.waitForSelector(\"#divExpandAll\");\n //expand all classes\n await page.focus(\"#divExpandAll > a\");\n await page.waitFor(500);\n await page.keyboard.press(\"Enter\");\n await page.waitFor(10000);\n //if multiple pages, create counter for pages,\n //while loop for counter and if counter > 1 go to next page by clicking right arrow\n let numPages = 1;\n\n let multiplePages = await page.$(\"div.demo > div.demo1.jPaginate\");\n\n if (multiplePages != null) {\n numPages = await page.evaluate(() => {\n let numPages = document\n .querySelectorAll(\"div.jPaginate > div\")[1]\n .querySelector(\"ul\")\n .getElementsByTagName(\"li\").length;\n return numPages;\n });\n }\n\n let classInfo = [];\n while (numPages > 0) {\n //create JSONs\n classInfo = [\n ...classInfo,\n ...(await page.evaluate(async () => {\n let subject = document.querySelector(\"div#divSearchResultsHeader > span#spanSearchResultsHeader\").textContent.split(\", \")[2];\n let subjectSplit = subject.split(\" (\");\n let subjectName = subjectSplit[0];\n let subjectCode = \"\";\n if (subjectSplit.length == 2)\n subjectCode = subjectSplit[1].replace(\")\", \"\");\n else \n subjectCode = subjectName\n let classes = []; //array of JSONs\n\n let elements = document.querySelectorAll(\"div.class-title\");\n for (var element of elements) {\n if (element != null) {\n let lectures = element.querySelectorAll(\"div.primary-row\");\n for (var lecture of lectures) {\n let time = lecture.querySelector(\"div.timeColumn > p\");\n if (time == null || time.innerText == \"\" || time.innerText == \"To be arranged\") \n break;\n let obj = {};\n let title = element.querySelector(\"h3\");\n let status = lecture.querySelector(\"div.statusColumn > p\");\n let waitlist = lecture.querySelector(\"div.waitlistColumn > p\");\n let days = lecture.querySelector(\"div.dayColumn a\");\n let location = lecture.querySelector(\"div.locationColumn > p\");\n let units = lecture.querySelector(\"div.unitsColumn > p\");\n let instructor = lecture.querySelector(\"div.instructorColumn > p\");\n let detail = lecture.querySelector(\"div.sectionColumn a\");\n obj.subjectName = subjectName;\n obj.subjectCode = subjectCode;\n if (title != null) \n obj.title = title.innerText;\n if (status != null) {\n obj.status = status.innerText.split(\"\\n\")[0].replace(/ .*/, \"\");\n obj.spots = status.innerHTML.split(\"<br>\")[1];\n }\n if (waitlist != null) \n obj.waitlist = waitlist.innerText;\n if (days != null) {\n let daysString = days.innerText;\n obj.M = false;\n obj.T = false;\n obj.W = false;\n obj.R = false;\n obj.F = false;\n for (i in daysString) {\n switch (daysString[i]) {\n case \"M\":\n obj.M = true;\n break;\n case \"T\":\n obj.T = true;\n break;\n case \"W\":\n obj.W = true;\n break;\n case \"R\":\n obj.R = true;\n break;\n case \"F\":\n obj.F = true;\n break;\n }\n }\n }\n if (time != null) \n obj.time = time.innerText;\n if (location != null) {\n obj.location = location.innerText.trim().replace(\"\\n\", \"\");\n }\n if (units != null) \n obj.units = units.innerText;\n //classes with multiple instructors will return names with a comma in between the names\n if (instructor != null) {\n obj.instructor = instructor.innerText.replace(\"\\n\", \", \");\n }\n if (detail != null) \n obj.detail = detail.href;\n //discussions\n let secondarySection = element.querySelector(\"div.secondarySection\");\n if (secondarySection != null) {\n let secondaryTimeElements = secondarySection.querySelectorAll(\"div.timeColumn > p\");\n let secondaryStatusElements = secondarySection.querySelectorAll(\"div.statusColumn > p\");\n let secondaryDayElements = secondarySection.querySelectorAll(\"div.dayColumn a\");\n let discussions = [];\n let statusCounter = 0;\n let daysCounter = 0;\n for (var thingy of secondaryTimeElements) {\n let discussionObj = {};\n discussionObj.time = thingy.textContent;\n discussionObj.status = secondaryStatusElements[\n statusCounter\n ].innerText.split(\"\\n\")[0].replace(/ .*/, \"\");\n\n discussionObj.M = false;\n discussionObj.T = false;\n discussionObj.W = false;\n discussionObj.R = false;\n discussionObj.F = false;\n if (secondaryDayElements[daysCounter] != null && secondaryDayElements[daysCounter] != \"Not scheduled\") {\n let daysString = secondaryDayElements[daysCounter].innerText;\n for (i in daysString) {\n switch (daysString[i]) {\n case \"M\":\n discussionObj.M = true;\n break;\n case \"T\":\n discussionObj.T = true;\n break;\n case \"W\":\n discussionObj.W = true;\n break;\n case \"R\":\n discussionObj.R = true;\n break;\n case \"F\":\n discussionObj.F = true;\n break;\n }\n }\n }\n\n discussions.push(discussionObj);\n statusCounter += 1;\n daysCounter += 1;\n }\n obj.discussions = discussions;\n }\n classes.push(obj);\n }\n }\n }\n return classes;\n })),\n ];\n if (numPages > 1) {\n //go to next page\n await page.$eval(\"div.jPag-control-front > span.jPag-snext-img\", (elem) =>\n elem.click()\n );\n await page.waitFor(500);\n\n //now on results page\n await page.waitForSelector(\"#divExpandAll\");\n //expand all classes\n await page.focus(\"#divExpandAll > a\");\n\n await page.waitFor(500);\n await page.keyboard.press(\"Enter\");\n\n await page.waitFor(10000);\n }\n\n numPages -= 1;\n }\n\n// await browser.close();\n //loop through classInfo processing the times\n for (let i = 0; i < classInfo.length; i++) {\n console.log(classInfo[i].title)\n if (classInfo[i].time == \"\" || classInfo[i].time.match(/\\d+/) == null) {\n continue;\n }\n time = classInfo[i].time.split(\"-\");\n\n timeStrings = [];\n for (let j = 0; j < time.length; j++) {\n if (time[j].includes(\":\")) {\n minutes = time[j].match(/\\d+/g)[1];\n } else {\n minutes = \"00\";\n }\n hour = time[j].match(/\\d+/)[0];\n //the 10 just means base 10\n int = parseInt(hour, 10);\n if (time[j].includes(\"pm\")) {\n if (int + 12 < 24) {\n int += 12;\n }\n }\n timeStrings.push(int.toString() + minutes.toString());\n }\n classInfo[i].startTime = parseInt(\n moment(timeStrings[0], \"hmm\").format(\"HHmm\"),\n 10\n );\n classInfo[i].endTime = parseInt(\n moment(timeStrings[1], \"hmm\").format(\"HHmm\"),\n 10\n );\n\n //if there are discussions:\n if (\n classInfo[i].discussions != null &&\n classInfo[i].discussions.length > 0\n ) {\n for (let d = 0; d < classInfo[i].discussions.length; d++) {\n if (\n classInfo[i].discussions[d].time.match(/\\d+/) == null ||\n classInfo[i].discussions[d].time == \"\"\n ) {\n continue;\n }\n time = classInfo[i].discussions[d].time.split(\"-\");\n\n timeStrings = [];\n for (let j = 0; j < time.length; j++) {\n if (time[j].includes(\":\")) {\n minutes = time[j].match(/\\d+/g)[1];\n } else {\n minutes = \"00\";\n }\n hour = time[j].match(/\\d+/)[0];\n //the 10 just means base 10\n int = parseInt(hour, 10);\n if (time[j].includes(\"pm\")) {\n if (int + 12 < 24) {\n int += 12;\n }\n }\n timeStrings.push(int.toString() + minutes.toString());\n }\n let startTime = parseInt(\n moment(timeStrings[0], \"hmm\").format(\"HHmm\"),\n 10\n );\n let endTime = parseInt(\n moment(timeStrings[1], \"hmm\").format(\"HHmm\"),\n 10\n );\n classInfo[i].discussions[d].time = {\n gte: startTime,\n lte: endTime,\n };\n // console.log(classInfo[i].discussions[d].time);\n }\n }\n }\n return classInfo;\n}", "function getInputValue(){\n \tvar html=document.getElementById('textField').value; \n \tcountDivs(html);\n }", "function main() {\n // Variables\n var\n // the user agent object before adding\n uaInfo = {},\n\n // cashing the navigator.userArgent String\n uaString = navigator.userAgent;\n\n\n for ( var k in PREFIXES ) {\n // add to userAgentInfo the positive resulte item\n uaInfo[k] = testUserAgentAgaintsChecklist( PREFIXES[k], uaString );\n\n // add to userAgentInfo an array of negative resault\n uaInfo[ PREFIX_NOT + k ] = filterChecklist( PREFIXES[k], uaInfo[k] );\n }\n\n // check for mobile\n uaInfo[ PREFIX_MOBILE ] = testUserAgentIfMobile( MOBILE, uaString );\n\n // adding to the root element classes of useragent result\n addCSSClassesToElement( document.documentElement, uaInfo );\n\n // add languages\n // the languages is done after the css is being added\n // so won't be language classes\n addLanguageToUserAgent( uaInfo );\n\n // check & backup if there is object in the globalscope and add to the global scope\n if ( 'userAgentInfo' in window ) oldUserAgentInfo = window.userAgentInfo;\n\n // add the userAgentInfo to the global scope\n window.userAgentInfo = uaInfo;\n }", "function determine_page_type(doc,url,resolve,reject) {\n var sidearm=doc.getElementsByClassName(\"sidearm-table\"),j,temp_var=\"\";\n var begin_url=url.replace(/(https?:\\/\\/[^\\/]+).*$/,\"$1/\")\n if(sidearm!==null && sidearm!==undefined && sidearm.length>0) {\n if(url.indexOf(\"coaches.aspx?path=\")!==-1) {\n parse_sidearm2(doc,url,resolve,reject,sidearm[0]);\n return;\n }\n else if(parse_sidearm(doc,url,resolve,reject,sidearm[0])&&(resolve(\"\")||true)) return;\n else if(!my_query.doneReparse) {\n my_query.doneReparse=true;\n let reparse_promise=MTP.create_promise(begin_url+\"staff.aspx\",sports_response,resolve,reject);\n return;\n }\n else return;\n }\n else if(/\\/directory\\/index/.test(url) && doc.getElementById(\"mainbody\")!==null && parse_info_directory(doc,url,resolve,reject)) return;\n if(/\\/directory\\/staff/.test(url) && parse_info_directory_staff(doc,url,resolve,reject)) return;\n if(/\\/staff\\.php/.test(url)) {\n let staff;\n console.log(\"staff.php, doc.body.innerText=\"+doc.getElementById(\"staff-list\"));\n if(doc.getElementById(\"staff-list\")!==null) return parse_staff_php(doc,url,resolve,reject,doc.getElementById(\"staff-list\"));\n if((staff=doc.querySelector(\".staff\"))) return parse_php_table(doc,url,resolve,reject,staff);\n }\n if(is_sport_index(url,\"coaches\")) return parse_sports_index(doc,url,resolve,reject);\n else if(doc.getElementsByClassName(\"staff_dgrd\").length>0) {\n console.log(\"Found staff_dgrd\");\n var script=doc.getElementById(\"ctl00_contentDiv\").getElementsByTagName(\"script\");\n for(j=0; j < script.length; j++) { if(script[j].innerHTML.indexOf(\"loadRow\")!==-1) break; }\n if(j>=script.length) j=0;\n return parse_staff_dgrd(doc,url,resolve,reject,doc.getElementsByClassName(\"staff_dgrd\")[0],\"staff\",script[j]);\n }\n else if((temp_var=doc.getElementsByClassName(\"coaches_dgrd\")).length>0) return parse_staff_dgrd(doc,url,resolve,reject,temp_var[0],\"coaches\");\n else if(url.indexOf(\"/athletics/staff\")!==-1 && url.indexOf(\"/athletics/staff.\")===-1\n && url.indexOf(\"/athletics/staff-\")===-1 && url.indexOf(\"/athletics/staff_\")===-1\n && url.indexOf(\"/athletics/staffdirectory\")===-1) return parse_athletics_staff(doc,url,resolve,reject);\n if(url.indexOf(\".dbml\")!==-1) return parse_dbml(doc,url,resolve,reject);\n else if(url.indexOf(\"hometeamsonline.com\")!==-1) return parse_hometeamsonline(doc,url,resolve,reject);\n else if(doc.getElementById(\"staffdir\")) return parse_staffdir(doc,url,resolve,reject);\n else if(doc.getElementsByClassName(\"coach-bios\").length>0) return parse_coachbios(doc,url,resolve,reject);\n else if(doc.getElementsByClassName(\"staffBioWrapper\").length>0) return parse_staff_bio_wrapper(doc,url,resolve,reject);\n else if((doc.getElementsByClassName(\"view-coaches\").length>0 ||\n doc.getElementsByClassName(\"view-contact-persons\").length>0)) return parse_view_coaches(doc,url,resolve,reject);\n\n else if(doc.getElementsByClassName(\"dataTables_scrollHead\").length>0) return parse_scrollHead(doc,url,resolve,reject);\n else if(doc.getElementsByClassName(\"staff-department\").length>0 && parse_staff_department(doc)&&(resolve(\"\")||true)) return true;\n else if(/\\/staff-directory/.test(url) && parse_staff_dash_directory(doc,url)&&(resolve(\"\")||true)) return true;\n else if(doc.getElementsByClassName(\"staff-directory\").length>0) return parse_staff_directory(doc,url,resolve,reject);\n else { x=parse_generic(doc,url,resolve,reject);\n console.log(\"x=\"+x);\n return x;\n }\n\n }", "function getOmniSiteCd() {\n var siteUrl = document.URL;\n var splitUrl;\n var siteCd;\n try {\n splitUrl = siteUrl.split(\"#\")[0].split(\"/\");\n siteCd = splitUrl[3];\n } catch (e) {\n siteCd = \"etc\";\n }\n //Live - japan\n if (splitUrl[2].indexOf(\"japan.samsung.com\") != -1) {\n siteCd = \"jp\";\n }\n //stgweb4 - japan\n if (splitUrl[2].indexOf(\"stgweb4.samsung.com\") != -1 && splitUrl[3].indexOf(\"japan\") != -1) {\n siteCd = \"jp\";\n }\n //Origin2 - japan\n if (splitUrl[2].indexOf(\"japan-origin.samsung.com\") != -1) {\n siteCd = \"jp\";\n }\n //live cn support\n if (splitUrl[2].indexOf(\"support-cn.samsung.com\") != -1) {\n siteCd = \"cn\";\n }\n //mySamsung - EU\n if (splitUrl[2].indexOf(\"my.eu.samsung.com\") != -1) {\n siteCd = getOmniUrlParam(\"language\");\n }\n //sec local page\n if (splitUrl[2].indexOf(\"local.sec.samsung.com\") != -1) {\n siteCd = \"sec\";\n }\n //live ru support\n if (splitUrl[2].indexOf(\"support.ru.samsung.com\") != -1) {\n siteCd = \"ru\";\n }\n //mySamsung - ca ca_fr\n if (splitUrl[2].indexOf(\"support-ca.samsung.com\") != -1) {\n siteCd = getOmniUrlParam(\"lang\");\n }\n\n return siteCd;\n}", "function getIDocH(select, invCode) {\n //$('#invSelect').val(sessionStorage.invSelect); \n if (sessionStorage.invSelect == \"\" || sessionStorage.invSelect == \"null\" || sessionStorage.invSelect == null)\n invCode = 0;\n ajaxFunction(IDocHUri + ace + '/' + sal + '/' + group + '/' + sessionStorage.ModeCode + '/top' + select + '/' + invCode + '/' + sessionStorage.userName + '/' + sessionStorage.AccessSanad, 'GET').done(function (data) {\n flagupdateHeader = 0;\n sessionStorage.flagupdateHeader = 0;\n self.IDocHList(data);\n ajaxFunction(IDocHCountUri + ace + '/' + sal + '/' + group + '/' + sessionStorage.ModeCode, 'GET').done(function (dataCount) {\n $('#countAllRecord').text(dataCount);\n });\n });\n }", "function contarInputs() {\n let inputs = $(\"input[name^=articulos]\");\n let count = inputs.length;\n document.getElementById(\"count\").value = count;\n /* alert(count); */\n }", "findSearchFields(){\n\t\tthis.driver.findElement(By.id('keywords'));\n\t\tthis.driver.findElement(By.id('location'));\n\t\tthis.driver.findElement(By.id('RadialLocation'));\n\t}", "function loadpage() {\n var pageurl = window.location.href;\n\n //On page load, the content of all the 4 product types is disabled\n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n\n //Below line reads the product type selected by the user in dashboard page \n var product = getParameterByName('producttype', window.location.href.toLowerCase());\n if (pageurl.toLowerCase().indexOf(\"?producttype=\") > 0) {\n\n //If the user clicks Accept.js product type in the dashboard page, the following code gets executed.\n if (product == \"acceptjs\") {\n\n //The product type selected by the user in the dashboard page is assigned to the activeCont variable which is used for future reference\n activeCont = \"acceptjs\";\n\n //Below function checks if customer ID is passed in the request URL \n checkForCustomerIdInUrl(pageurl)\n }\n\n //If the user clicks Accept.js UI product type in the dashboard page, the following code gets executed\n else if (product == \"acceptui\") {\n\n //The product type selected by the user in the dashboard page is assigned to the activeCont variable which is used for future reference\n activeCont = \"acceptui\";\n\n //Below function checks if customer ID is passed in the request URL \n checkForCustomerIdInUrl(pageurl)\n }\n\n //If the user clicks Accept Hosted product type in the dashboard page, the following code gets executed.\n else if (product == \"accepthosted\") {\n activeCont = \"accepthosted\";\n\n //Below logic is to check if there are more than one parameter passed in the URL \n if (pageurl.toLowerCase().indexOf(\"&\") > 0) {\n \n //Customer ID is an optional parameter for Accept Hosted product type\n //Below code gets executed when the user passes customer id in the request URL\n if (pageurl.toLowerCase().indexOf(\"&customerid=\") > 0) {\n var id = getParameterByName('customerid', window.location.href.toLowerCase());\n\n //Validation of customer id will be done by using the below function\n var result = ValidateCustomer(id);\n\n //If the customer id is a valid id, then AcceptHosted function gets executed\n if (result.valid)\n {\n AcceptHosted(id);\n }\n else {\n\n //If the invalid customer id declared in the URL, then user gets redirected to the error message section\n var elements = document.getElementsByClassName(\"productCont\");\n\n //The content of all the 4 product types is disabled on the page\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Customer not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n }\n //Below code gets executed when the user passes when there are more than one parameters (other than customer id) which are invalid in the request URL\n else {\n\n //Below code gets executed when user passes invalid parameters in the URL \n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n\n }\n }\n else {\n\n //When customer id parameter is not passed in the URL, AcceptHosted function gets executed\n AcceptHosted('');\n }\n }\n\n //If the user clicks Accept Customer product type in the dashboard page, the following code gets executed.\n else if (product == \"acceptcustomer\") {\n activeCont = \"acceptcustomer\";\n\n //Below line populates the customer id textbox with a valid customer id\n document.getElementById(\"txtCustomerId\").value = globalVars.ValidCustomer;\n \n //Below code gets executed when the user passes customer id in the request URL\n if (pageurl.toLowerCase().indexOf(\"&customerid=\") > 0) {\n\n document.getElementById(\"acceptCustomer\").style.display = \"none\";\n\n //Below line gets the customer id declared in the url by the user\n var id = getParameterByName('customerid', window.location.href.toLowerCase());\n\n //Below function checks if the customer id is already validated or not\n //Customer id validaton occurs on click of continue button in dashboard and on accept customer page load\n //In order to avoid multiple validation requests to API, storing the validation status in the session storage\n var customerIdValidationStatus = sessionStorage.getItem('isValidated');\n\n //If customer id is not validated\n if (customerIdValidationStatus != \"true\") {\n\n //Validation of customer id will be done by using the below function\n var result = ValidateCustomer(id);\n\n //If the customer id is a valid id, then AcceptCustomer function gets executed\n if (result.valid)\n {\n AcceptCustomer(id);\n }\n else {\n\n //If the invalid customer id declared in the URL, then user gets redirected to the error message section\n var elements = document.getElementsByClassName(\"productCont\");\n for (var x = 0; x < elements.length; x++) {\n elements[x].style.display = \"none\";\n }\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Customer not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n\n }\n //If customer id is already validated in dashboard page\n else {\n AcceptCustomer(id);\n sessionStorage.setItem('isValidated', 'false');\n }\n }\n else {\n\n //If customer id is not provided in the URL, a pop up to enter customer id is displayed.\n document.getElementById(\"acceptCustomer\").style.display = \"block\";\n }\n }\n else {\n\n //Below code gets executed when user passes invalid product type parameters in the URL \n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n }\n else {\n\n //Below code gets executed when user passes invalid product type parameters in the URL \n if (document.getElementById(\"invalidPage\") != null) {\n document.getElementById(\"invalidPage\").innerHTML = \"\";\n document.getElementById(\"invalidPage\").innerHTML = \"Product Type not Found\";\n document.getElementById(\"invalidProduct\").style.display = \"block\";\n }\n }\n}", "function parseCodes()\n{\n\tvar codes=document.getElementsByTagName(\"code\");\n\tparseActual(codes, 0);\n }", "function getSetupSteps()\n{\n var dom = null;\n var url = \"\";\n var curSite = null;\n\n // Try to get the site for the currently selected document\n dom = dw.getDocumentDOM();\n if (dom != null)\n url = dom.URL;\n if (url.length > 0)\n curSite = site.getSiteForURL(url);\n else\n curSite = site.getCurrentSite(); \n if (curSite.length == 0)\n\tcurSite = site.getCurrentServerSite();\n\n var instructions = new Array();\n\n\tinstructions.push(MM.MSG_BeforeUsingDynamicData);\n if (curSite.length != 0 && site.getIsServerSite(curSite))\n\t instructions.push(dwscripts.sprintf(MM.MSG_CreateServer,'<a href=\"#\" onMouseDown=\"event:CreateSite\">','</a>'));\n else\n\tinstructions.push(dwscripts.sprintf(MM.MSG_CreateSite,'<a href=\"#\" onMouseDown=\"event:CreateSite\">','</a>'));\n\tinstructions.push(dwscripts.sprintf(MM.MSG_ChooseDynamicDocType,'<a href=\"#\" onMouseDown=\"event:SetDocType\">','</a>'));\n if (curSite.length != 0 && site.getIsServerSite(curSite))\n\t instructions.push(dwscripts.sprintf(MM.MSG_SetURLPrefix,'<a href=\"#\" onMouseDown=\"event:CreateSite\">','</a>'));\n else\n\tinstructions.push(dwscripts.sprintf(MM.MSG_SetAppServer,'<a href=\"#\" onMouseDown=\"event:SetAppServer\">','</a>'));\n if (isDisplayingColdfusionConnections())\n {\n\t\tinstructions.push(dwscripts.sprintf(MM.MSG_SetRDSPassword,'<a href=\"#\" onMouseDown=\"event:SetRDSPassword\">','</a>'));\n\t}\n\tinstructions.push(MM.MSG_ClickPlusBtnToCreateConn);\n\n\treturn instructions;\n}", "function numberOfCks(frm) {\nvar i;\nck = 0;\nfor(i = 0; i < frm.elements.length; i++) {\n elem = frm.elements[i];\n if(elem.type && elem.type.toLowerCase() == 'checkbox' && elem.checked) ck++;\n}\nreturn ck;\n}", "function findCount(){\n\tvar text = document.getElementById('textToFind').value;\n\tif(text == \"\"){\n\t\talert(\"Please enter something to search for!\");\n\t\treturn;\n\t}\n\tvar resultsArray = XPODoc.document.findAllMatches(text, document.findForm.findMatchCase.checked);\n\tif( resultsArray == false ) alert( \"0 tokens found.\" );\n\telse alert( resultsArray.length + \" tokens are found.\" );\n}", "function countWords() {\n let page = document.getElementsByClassName(\"kix-zoomdocumentplugin-outer\")[0];\n if (page == null) {\n return (\"Element does not exist on the document.\")\n }\n const pageText = page.innerText;\n const words = pageText.split(\" \");\n \n return words.length; \n}", "function updateCounts() {\n const counts = classifier.getClassExampleCount();\n\n select('#exampleRock').html(counts['Rock'] || 0);\n select('#examplePaper').html(counts['Paper'] || 0);\n select('#exampleScissor').html(counts['Scissor'] || 0);\n}", "_findSelectors() {\n this._container = document.querySelector(this._settings.targetSelector);\n this._items = Array.from(\n document.querySelectorAll(`.${this._container.firstElementChild.className}`)\n );\n this._relatedSliders = this._settings.relatedSlidersSelectors\n .map(selector => document.querySelector(selector));\n this._leftControl = document.querySelector(this._settings.leftSelector);\n this._rightControl = document.querySelector(this._settings.rightSelector);\n }", "function getScopusCites(title, year){\n \n // Goto to url\n iimPlay('CODE: URL GOTO=http://www.scopus.com/search/form.url');\n \n //Prepare search fields and click search button\n if (year && year > 0) {\n iimPlay('CODE: TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:BasicValidatedSearchForm ATTR=ID:searchterm1 CONTENT=' + title.replace(/ /g, '<SP>') + '\\n' +\n 'TAG POS=1 TYPE=SELECT FORM=NAME:BasicValidatedSearchForm ATTR=ID:yearFrom CONTENT=%' + year + '\\n' +\n 'TAG POS=1 TYPE=SELECT FORM=NAME:BasicValidatedSearchForm ATTR=ID:yearTo CONTENT=%' + year + '\\n' +\n 'TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:BasicValidatedSearchForm ATTR=ID:subArea-2 CONTENT=NO\\n' +\n 'TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:BasicValidatedSearchForm ATTR=ID:subArea-4 CONTENT=NO\\n' +\n 'TAG POS=2 TYPE=INPUT:SUBMIT FORM=NAME:BasicValidatedSearchForm ATTR=VALUE:Search');\n } else {\n iimPlay('CODE: TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:BasicValidatedSearchForm ATTR=ID:searchterm1 CONTENT=' + title.replace(/ /g, '<SP>') + '\\n' +\n 'TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:BasicValidatedSearchForm ATTR=ID:subArea-2 CONTENT=NO\\n' +\n 'TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:BasicValidatedSearchForm ATTR=ID:subArea-4 CONTENT=NO\\n' +\n 'TAG POS=2 TYPE=INPUT:SUBMIT FORM=NAME:BasicValidatedSearchForm ATTR=VALUE:Search');\n }\n \n //Position at \"Cited by\" result col \"dataCol6\" and save value in EXTRACT\n iimPlay('CODE: TAG POS=1 TYPE=LI ATTR=CLASS:dataCol6 EXTRACT=TXT');\n var citesText = iimGetLastExtract().trim();\n \n // Extract cites number\n if (citesText == '#EANF#' || citesText == ''){\n return undefined;\n } else {\n return parseInt(citesText);\n }\n}", "function calculate_all(){\n\tlet counter = [ //how common the xss is so it can give a warning\n\t\t0, //external\n\t\t0, //obfuscated\n\t\t0, //handler\n\t\t0, //tag\n\t]\n\n\tfor(let i = 0;i < payload.length; i++){\n\t\tcounter[0]+= externa_scr(payload[i].toLowerCase())\n\t\tcounter[1]+= obfuscated(payload[i].toLowerCase())\n\t\tcounter[2]+= handler(payload[i].toLowerCase())\n\t\tcounter[3]+= tag(payload[i].toLowerCase())\n\t}\n\t\n\tfor(let i = 0;i < counter.length; i++){\n\t\tcounter[i] = counter[i]/payload.length\n\t}\n\n\tdocument.getElementById('scr_av').innerHTML = counter[0]\n\tdocument.getElementById('obf_av').innerHTML = counter[1]\n\tdocument.getElementById('hand_av').innerHTML = counter[2]\n\tdocument.getElementById('tag_av').innerHTML = counter[3]\n\n}", "onSourceLoad(){\n let elements = RVRreport.queryElements(this.document);\n if(elements != null){\n elements.forEach(el=>RVRreport.elementDetection(el));\n }\n }", "function investigatePage() {\r\n var rows = document.evaluate(\"//div[@class='objectinfo']\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n pageIDs[i] = /immo(\\d+)/.exec(rows.snapshotItem(i).id)[1];\r\n lastSeenIDs[pageIDs[i]] = new Date().getTime();\r\n }\r\n rows = document.evaluate(\"//div[@class='titel']/a\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n pageTitles[i] = rows.snapshotItem(i).textContent.toString();\r\n }\r\n rows = document.evaluate(\"//div[@class='adresse']\", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\r\n for (var i=0;i<rows.snapshotLength;i++) {\r\n pageLocations[i] = rows.snapshotItem(i).textContent.toString();\r\n }\r\n if (lastSeenIDs) GM_setValue('lastSeenIDs',lastSeenIDs.toSource());\r\n}", "function fillMain() {\n if (formExistsInPage()) {\n console.log(\"Filling in main form\");\n getMainData(function(icrdata) {\n\n ELEMENTS.forEach(function (field) {\n console.log(\"populating \" + field.id);\n\n switch (field.type) {\n case \"text\" || \"textarea\":\n fillText(field.id, icrdata[field.name]);\n break;\n case \"select\":\n if (field.ref) {\n select(field.id, icrdata[field.name]);\n if (field.id == \"requestExpirationDateLabel\") {\n document.getElementById(\"otherDateArea\").style.display = \"block\";\n }\n document.getElementById(field.ref_id).value = icrdata[field.ref];\n } else {\n select(field.id, icrdata[field.name]);\n }\n break;\n case \"radio\":\n radio(field.id, icrdata[field.name], field.options);\n break;\n case \"checkbox\":\n check(field.id, icrdata[field.name]);\n break;\n case \"custom\":\n fillWithAssumption(field.id, icrdata[field.name]);\n break;\n case \"complex\":\n fillComplex(field, icrdata[field.name]);\n break;\n case \"modal\":\n fillModal(field, icrdata[field.name]);\n break;\n }\n highlight(field);\n });\n hasICs(function(has_ics) {\n if(has_ics) {\n console.log(\"it has ICs\");\n setNextAction(ACTIONS.ADD_IC);\n clickLinkToICs();\n }\n });\n });\n }\n}", "function loadCrawlers(e) {\n var datalist = document.getElementById('website-crawlers');\n var country = $('input[name=country]:checked').val();\n var crawlers = {\n uk: [\n 'Yell.com'\n ],\n us: [\n 'Citysearch.com',\n 'Yellowpages.com',\n 'Restaurant.com',\n 'Tripdavisor.com',\n 'Yelp.com'\n ]\n }\n\n var crawler;\n\n if (country == 'United States') {\n crawler = crawlers['us'];\n\n } else if (country == 'United Kingdom') {\n crawler = crawlers['uk'];\n }\n\n if (datalist.hasChildNodes()) {\n while (datalist.firstChild) {\n datalist.removeChild(datalist.firstChild);\n }\n }\n\n for (var i = 0; i < crawler.length; i++) {\n var option = document.createElement('option');\n\n option.value = crawler[i];\n datalist.appendChild(option);\n }\n }", "function HeaderDocumentReadyScripts() {\n\n\tif ($.trim(SearchPageUrl).length > 0) {\n\t\tsessionStorage.setItem('SearchPageUrl', SearchPageUrl);\n\t}\n\n\t$(\"body\").find(\"div\").click(function () {\n\t\tif ($(this).hasClass(\"village-cinema-bg\") == false && $(this).hasClass(\"wrapper\") == false) { //#5322 - To Allow click on main div or body.\n\t\t\tisBodyClicked = false;\n\t\t}\n\t});\n\n\tif ($('#LoginTexthWidget').length > 0) {\n\t\t$('#LoginTexthWidget').hover(function () {\n\t\t\treturn false;\n\t\t});\n\n\t\t$('#LoginTexthWidget').click(function () {\n\t\t\treturn false;\n\t\t});\n\n\t}\n\n\tSetPasswordDefaultText();\n\tWidgetStateChange();\n\tWidgetByMovieFilterChange('All');\n\tWidgetByCinemaFilterChange('All');\n\n\tstyleFormElements();\n\n\tEnableDisableControl('ddlByMovieCinemas', true);\n\tEnableDisableControl('ddlByMovieSessions', true);\n\tEnableDisableControl('ddlByCinemaMovies', true);\n\tEnableDisableControl('ddlByCinemaSessions', true);\n\n\t$('#ddlByMovieCinemas').parent().find('span').html('Select cinema');\n\t$('#ddlByMovieSessions').parent().find('span').html('Select session');\n\t$('#ddlByCinemaMovies').parent().find('span').html('Select movie');\n\t$('#ddlByCinemaSessions').parent().find('span').html('Select session');\n\n\t//code for call cinema page on enter press in CinemaMegaMenu \n\t/* fix for defect #643 */\n\t$('#Cinema-Search').bind('keypress', function (e) {\n\t\tvar code = (e.keyCode ? e.keyCode : e.which);\n\t\tif (code == 13) {\n\t\t\t$('#imgCinemaNavFindCinema').trigger('click');\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t$('#QuickTicketsMenu ul.tabs a').click(function () {\n\n\t\tif ($(this).attr('href') == '#CinemaTab') {\n\t\t\tWidgetTab('bycinema');\n\t\t}\n\t\telse {\n\t\t\tWidgetTab('bymovie');\n\t\t}\n\n\t\t$('#txtCurrentWidgetTab').val($(this).attr('href'));\n\n\t});\n\n\t$('#divHeaderForgotPwdContent').html($('#hidForgotPasswordText').val());\n\t$('#divHeaderMailSentContent').html($('#hidMailSentText').val());\n\n}", "obtainNumberOfDataCodeWord() {\n let countOfDataCodeWord = 0;\n switch (this.mVersion) {\n case 1:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 19;\n break;\n case 15:\n countOfDataCodeWord = 16;\n break;\n case 25:\n countOfDataCodeWord = 13;\n break;\n case 30:\n countOfDataCodeWord = 9;\n break;\n }\n break;\n case 2:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 34;\n break;\n case 15:\n countOfDataCodeWord = 28;\n break;\n case 25:\n countOfDataCodeWord = 22;\n break;\n case 30:\n countOfDataCodeWord = 16;\n break;\n }\n break;\n case 3:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 55;\n break;\n case 15:\n countOfDataCodeWord = 44;\n break;\n case 25:\n countOfDataCodeWord = 34;\n break;\n case 30:\n countOfDataCodeWord = 26;\n break;\n }\n break;\n case 4:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 80;\n break;\n case 15:\n countOfDataCodeWord = 64;\n break;\n case 25:\n countOfDataCodeWord = 48;\n break;\n case 30:\n countOfDataCodeWord = 36;\n break;\n }\n break;\n case 5:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 108;\n break;\n case 15:\n countOfDataCodeWord = 86;\n break;\n case 25:\n countOfDataCodeWord = 62;\n break;\n case 30:\n countOfDataCodeWord = 46;\n break;\n }\n break;\n case 6:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 136;\n break;\n case 15:\n countOfDataCodeWord = 108;\n break;\n case 25:\n countOfDataCodeWord = 76;\n break;\n case 30:\n countOfDataCodeWord = 60;\n break;\n }\n break;\n case 7:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 156;\n break;\n case 15:\n countOfDataCodeWord = 124;\n break;\n case 25:\n countOfDataCodeWord = 88;\n break;\n case 30:\n countOfDataCodeWord = 66;\n break;\n }\n break;\n case 8:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 194;\n break;\n case 15:\n countOfDataCodeWord = 154;\n break;\n case 25:\n countOfDataCodeWord = 110;\n break;\n case 30:\n countOfDataCodeWord = 86;\n break;\n }\n break;\n case 9:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 232;\n break;\n case 15:\n countOfDataCodeWord = 182;\n break;\n case 25:\n countOfDataCodeWord = 132;\n break;\n case 30:\n countOfDataCodeWord = 100;\n break;\n }\n break;\n case 10:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 274;\n break;\n case 15:\n countOfDataCodeWord = 216;\n break;\n case 25:\n countOfDataCodeWord = 154;\n break;\n case 30:\n countOfDataCodeWord = 122;\n break;\n }\n break;\n case 11:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 324;\n break;\n case 15:\n countOfDataCodeWord = 254;\n break;\n case 25:\n countOfDataCodeWord = 180;\n break;\n case 30:\n countOfDataCodeWord = 140;\n break;\n }\n break;\n case 12:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 370;\n break;\n case 15:\n countOfDataCodeWord = 290;\n break;\n case 25:\n countOfDataCodeWord = 206;\n break;\n case 30:\n countOfDataCodeWord = 158;\n break;\n }\n break;\n case 13:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 428;\n break;\n case 15:\n countOfDataCodeWord = 334;\n break;\n case 25:\n countOfDataCodeWord = 244;\n break;\n case 30:\n countOfDataCodeWord = 180;\n break;\n }\n break;\n case 14:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 461;\n break;\n case 15:\n countOfDataCodeWord = 365;\n break;\n case 25:\n countOfDataCodeWord = 261;\n break;\n case 30:\n countOfDataCodeWord = 197;\n break;\n }\n break;\n case 15:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 523;\n break;\n case 15:\n countOfDataCodeWord = 415;\n break;\n case 25:\n countOfDataCodeWord = 295;\n break;\n case 30:\n countOfDataCodeWord = 223;\n break;\n }\n break;\n case 16:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 589;\n break;\n case 15:\n countOfDataCodeWord = 453;\n break;\n case 25:\n countOfDataCodeWord = 325;\n break;\n case 30:\n countOfDataCodeWord = 253;\n break;\n }\n break;\n case 17:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 647;\n break;\n case 15:\n countOfDataCodeWord = 507;\n break;\n case 25:\n countOfDataCodeWord = 367;\n break;\n case 30:\n countOfDataCodeWord = 283;\n break;\n }\n break;\n case 18:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 721;\n break;\n case 15:\n countOfDataCodeWord = 563;\n break;\n case 25:\n countOfDataCodeWord = 397;\n break;\n case 30:\n countOfDataCodeWord = 313;\n break;\n }\n break;\n case 19:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 795;\n break;\n case 15:\n countOfDataCodeWord = 627;\n break;\n case 25:\n countOfDataCodeWord = 445;\n break;\n case 30:\n countOfDataCodeWord = 341;\n break;\n }\n break;\n case 20:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 861;\n break;\n case 15:\n countOfDataCodeWord = 669;\n break;\n case 25:\n countOfDataCodeWord = 485;\n break;\n case 30:\n countOfDataCodeWord = 385;\n break;\n }\n break;\n case 21:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 932;\n break;\n case 15:\n countOfDataCodeWord = 714;\n break;\n case 25:\n countOfDataCodeWord = 512;\n break;\n case 30:\n countOfDataCodeWord = 406;\n break;\n }\n break;\n case 22:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1006;\n break;\n case 15:\n countOfDataCodeWord = 782;\n break;\n case 25:\n countOfDataCodeWord = 568;\n break;\n case 30:\n countOfDataCodeWord = 442;\n break;\n }\n break;\n case 23:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1094;\n break;\n case 15:\n countOfDataCodeWord = 860;\n break;\n case 25:\n countOfDataCodeWord = 614;\n break;\n case 30:\n countOfDataCodeWord = 464;\n break;\n }\n break;\n case 24:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1174;\n break;\n case 15:\n countOfDataCodeWord = 914;\n break;\n case 25:\n countOfDataCodeWord = 664;\n break;\n case 30:\n countOfDataCodeWord = 514;\n break;\n }\n break;\n case 25:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1276;\n break;\n case 15:\n countOfDataCodeWord = 1000;\n break;\n case 25:\n countOfDataCodeWord = 718;\n break;\n case 30:\n countOfDataCodeWord = 538;\n break;\n }\n break;\n case 26:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1370;\n break;\n case 15:\n countOfDataCodeWord = 1062;\n break;\n case 25:\n countOfDataCodeWord = 754;\n break;\n case 30:\n countOfDataCodeWord = 596;\n break;\n }\n break;\n case 27:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1468;\n break;\n case 15:\n countOfDataCodeWord = 1128;\n break;\n case 25:\n countOfDataCodeWord = 808;\n break;\n case 30:\n countOfDataCodeWord = 628;\n break;\n }\n break;\n case 28:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1531;\n break;\n case 15:\n countOfDataCodeWord = 1193;\n break;\n case 25:\n countOfDataCodeWord = 871;\n break;\n case 30:\n countOfDataCodeWord = 661;\n break;\n }\n break;\n case 29:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1631;\n break;\n case 15:\n countOfDataCodeWord = 1267;\n break;\n case 25:\n countOfDataCodeWord = 911;\n break;\n case 30:\n countOfDataCodeWord = 701;\n break;\n }\n break;\n case 30:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1735;\n break;\n case 15:\n countOfDataCodeWord = 1373;\n break;\n case 25:\n countOfDataCodeWord = 985;\n break;\n case 30:\n countOfDataCodeWord = 745;\n break;\n }\n break;\n case 31:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1843;\n break;\n case 15:\n countOfDataCodeWord = 1455;\n break;\n case 25:\n countOfDataCodeWord = 1033;\n break;\n case 30:\n countOfDataCodeWord = 793;\n break;\n }\n break;\n case 32:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 1955;\n break;\n case 15:\n countOfDataCodeWord = 1541;\n break;\n case 25:\n countOfDataCodeWord = 1115;\n break;\n case 30:\n countOfDataCodeWord = 845;\n break;\n }\n break;\n case 33:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2071;\n break;\n case 15:\n countOfDataCodeWord = 1631;\n break;\n case 25:\n countOfDataCodeWord = 1171;\n break;\n case 30:\n countOfDataCodeWord = 901;\n break;\n }\n break;\n case 34:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2191;\n break;\n case 15:\n countOfDataCodeWord = 1725;\n break;\n case 25:\n countOfDataCodeWord = 1231;\n break;\n case 30:\n countOfDataCodeWord = 961;\n break;\n }\n break;\n case 35:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2306;\n break;\n case 15:\n countOfDataCodeWord = 1812;\n break;\n case 25:\n countOfDataCodeWord = 1286;\n break;\n case 30:\n countOfDataCodeWord = 986;\n break;\n }\n break;\n case 36:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2434;\n break;\n case 15:\n countOfDataCodeWord = 1914;\n break;\n case 25:\n countOfDataCodeWord = 1354;\n break;\n case 30:\n countOfDataCodeWord = 1054;\n break;\n }\n break;\n case 37:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2566;\n break;\n case 15:\n countOfDataCodeWord = 1992;\n break;\n case 25:\n countOfDataCodeWord = 1426;\n break;\n case 30:\n countOfDataCodeWord = 1096;\n break;\n }\n break;\n case 38:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2702;\n break;\n case 15:\n countOfDataCodeWord = 2102;\n break;\n case 25:\n countOfDataCodeWord = 1502;\n break;\n case 30:\n countOfDataCodeWord = 1142;\n break;\n }\n break;\n case 39:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2812;\n break;\n case 15:\n countOfDataCodeWord = 2216;\n break;\n case 25:\n countOfDataCodeWord = 1582;\n break;\n case 30:\n countOfDataCodeWord = 1222;\n break;\n }\n break;\n case 40:\n switch (this.mErrorCorrectionLevel) {\n case 7:\n countOfDataCodeWord = 2956;\n break;\n case 15:\n countOfDataCodeWord = 2334;\n break;\n case 25:\n countOfDataCodeWord = 1666;\n break;\n case 30:\n countOfDataCodeWord = 1276;\n break;\n }\n break;\n }\n return countOfDataCodeWord;\n }", "function get_single_tag_information(selector) {\n\n selector = get_foundable_query(selector, true, true, true);\n\n if (iframe.find(selector).length <= 0) {\n return;\n }\n\n var PPname, Pname;\n\n // tagName\n var a = iframe.find(selector)[0].nodeName;\n\n // length\n var length = get_selector_array(selector).length - 1;\n\n // Names\n var n = get_selector_array(selector)[length].toUpperCase();\n if (n.indexOf(\".\") != -1) {\n n = n.split(\".\")[1].replace(/[^\\w\\s]/gi, '');\n }\n\n // Class Names\n var className = $.trim(get_selector_array(selector)[length]);\n if (className.indexOf(\".\") != -1) {\n className = className.split(\".\")[1];\n }\n\n // ID\n var id = get_selected_element().attr(\"id\");\n\n if (isDefined(id)) {\n id = id.toUpperCase().replace(/[^\\w\\s]/gi, '');\n }\n\n // Parents 1\n if (length > 1) {\n Pname = get_selector_array(selector)[length - 1].toUpperCase();\n if (Pname.indexOf(\".\") != -1) {\n Pname = Pname.split(\".\")[1].replace(/[^\\w\\s]/gi, '');\n }\n } else {\n Pname = '';\n }\n\n // Parents 2\n if (length > 2) {\n PPname = get_selector_array(selector)[length - 2].toUpperCase();\n if (PPname.indexOf(\".\") != -1) {\n PPname = PPname.split(\".\")[1].replace(/[^\\w\\s]/gi, '');\n }\n } else {\n PPname = '';\n }\n\n // ID\n if (id == 'TOPBAR') {\n return l18_topbar;\n } else if (id == 'HEADER') {\n return l18_header;\n } else if (id == 'FOOTER') {\n return l18_footer;\n } else if (id == 'CONTENT') {\n return l18_content;\n }\n\n // Parrents Class\n if (PPname == 'LOGO' || PPname == 'SITETITLE' || Pname == 'LOGO' || Pname == 'SITETITLE') {\n return l18_logo;\n } else if (n == 'MAPCANVAS') {\n return l18_google_map;\n } else if (Pname == 'ENTRYTITLE' && a == 'A') {\n return l18_entry_title_link;\n } else if (Pname == 'CATLINKS' && a == 'A') {\n return l18_category_link;\n } else if (Pname == 'TAGSLINKS' && a == 'A') {\n return l18_tag_link;\n }\n\n // Current Classes\n if (n == 'WIDGET') {\n return l18_widget;\n } else if (n == 'FA' || get_selector_array(selector)[length].toUpperCase().indexOf(\"FA-\") >= 0) {\n return l18_font_awesome_icon;\n } else if (n == 'SUBMIT' && a == 'INPUT') {\n return l18_submit_button;\n } else if (n == 'MENUITEM') {\n return l18_menu_item;\n } else if (n == 'ENTRYMETA' || n == 'ENTRYMETABOX' || n == 'POSTMETABOX') {\n return l18_post_meta_division;\n } else if (n == 'COMMENTREPLYTITLE') {\n return l18_comment_reply_title;\n } else if (n == 'LOGGEDINAS') {\n return l18_login_info;\n } else if (n == 'FORMALLOWEDTAGS') {\n return l18_allowed_tags;\n } else if (n == 'LOGO') {\n return l18_logo;\n } else if (n == 'ENTRYTITLE' || n == 'POSTTITLE') {\n return l18_post_title;\n } else if (n == 'COMMENTFORM') {\n return l18_comment_form;\n } else if (n == 'WIDGETTITLE') {\n return l18_widget_title;\n } else if (n == 'TAGCLOUD') {\n return l18_tag_cloud;\n } else if (n == 'ROW' || n == 'VCROW') {\n return l18_row;\n } else if (n == 'BUTTON') {\n return l18_button;\n } else if (n == 'BTN') {\n return l18_button;\n } else if (n == 'LEAD') {\n return l18_lead;\n } else if (n == 'WELL') {\n return l18_well;\n } else if (n == 'ACCORDIONTOGGLE') {\n return l18_accordion_toggle;\n } else if (n == 'PANELBODY') {\n return l18_accordion_content;\n } else if (n == 'ALERT') {\n return l18_alert_division;\n } else if (n == 'FOOTERCONTENT') {\n return l18_footer_content;\n } else if (n == 'GLOBALSECTION' || n == 'VCSSECTION') {\n return l18_global_section;\n } else if (n == 'MORELINK') {\n return l18_show_more_link;\n } else if (n == 'CONTAINER' || n == 'WRAPPER') {\n return l18_wrapper;\n } else if (n == 'DEFAULTTITLE') {\n return l18_article_title;\n } else if (n == 'MENULINK' || n == 'MENUICON' || n == 'MENUBTN' || n == 'MENUBUTTON') {\n return l18_menu_link;\n } else if (n == 'SUBMENU') {\n return l18_submenu;\n\n // Bootstrap Columns\n } else if (n.indexOf('COLMD1') != -1 || n == 'MEDIUM1' || n == 'LARGE1' || n == 'SMALL1') {\n return l18_column + ' 1/12';\n } else if (n.indexOf('COLMD2') != -1 || n == 'MEDIUM2' || n == 'LARGE2' || n == 'SMALL2') {\n return l18_column + ' 2/12';\n } else if (n.indexOf('COLMD3') != -1 || n == 'MEDIUM3' || n == 'LARGE3' || n == 'SMALL3') {\n return l18_column + ' 3/12';\n } else if (n.indexOf('COLMD4') != -1 || n == 'MEDIUM4' || n == 'LARGE4' || n == 'SMALL4') {\n return l18_column + ' 4/12';\n } else if (n.indexOf('COLMD5') != -1 || n == 'MEDIUM5' || n == 'LARGE5' || n == 'SMALL5') {\n return l18_column + ' 5/12';\n } else if (n.indexOf('COLMD6') != -1 || n == 'MEDIUM6' || n == 'LARGE6' || n == 'SMALL6') {\n return l18_column + ' 6/12';\n } else if (n.indexOf('COLMD7') != -1 || n == 'MEDIUM7' || n == 'LARGE7' || n == 'SMALL7') {\n return l18_column + ' 7/12';\n } else if (n.indexOf('COLMD8') != -1 || n == 'MEDIUM8' || n == 'LARGE8' || n == 'SMALL8') {\n return l18_column + ' 8/12';\n } else if (n.indexOf('COLMD9') != -1 || n == 'MEDIUM9' || n == 'LARGE9' || n == 'SMALL9') {\n return l18_column + ' 9/12';\n } else if (n.indexOf('COLMD10') != -1 || n == 'MEDIUM10' || n == 'LARGE10' || n == 'SMALL10') {\n return l18_column + ' 10/12';\n } else if (n.indexOf('COLMD11') != -1 || n == 'MEDIUM11' || n == 'LARGE11' || n == 'SMALL11') {\n return l18_column + ' 11/12';\n } else if (n.indexOf('COLMD12') != -1 || n == 'MEDIUM12' || n == 'LARGE12' || n == 'SMALL12') {\n return l18_column + ' 12/12';\n } else if (n.indexOf('COLXS1') != -1) {\n return l18_column + ' 1/12';\n } else if (n.indexOf('COLXS2') != -1) {\n return l18_column + ' 2/12';\n } else if (n.indexOf('COLXS3') != -1) {\n return l18_column + ' 3/12';\n } else if (n.indexOf('COLXS4') != -1) {\n return l18_column + ' 4/12';\n } else if (n.indexOf('COLXS5') != -1) {\n return l18_column + ' 5/12';\n } else if (n.indexOf('COLXS6') != -1) {\n return l18_column + ' 6/12';\n } else if (n.indexOf('COLXS7') != -1) {\n return l18_column + ' 7/12';\n } else if (n.indexOf('COLXS8') != -1) {\n return l18_column + ' 8/12';\n } else if (n.indexOf('COLXS9') != -1) {\n return l18_column + ' 9/12';\n } else if (n.indexOf('COLXS10') != -1) {\n return l18_column + ' 10/12';\n } else if (n.indexOf('COLXS11') != -1) {\n return l18_column + ' 11/12';\n } else if (n.indexOf('COLXS12') != -1) {\n return l18_column + ' 12/12';\n } else if (n.indexOf('COLSM1') != -1) {\n return l18_column + ' 1/12';\n } else if (n.indexOf('COLSM2') != -1) {\n return l18_column + ' 2/12';\n } else if (n.indexOf('COLSM3') != -1) {\n return l18_column + ' 3/12';\n } else if (n.indexOf('COLSM4') != -1) {\n return l18_column + ' 4/12';\n } else if (n.indexOf('COLSM5') != -1) {\n return l18_column + ' 5/12';\n } else if (n.indexOf('COLSM6') != -1) {\n return l18_column + ' 6/12';\n } else if (n.indexOf('COLSM7') != -1) {\n return l18_column + ' 7/12';\n } else if (n.indexOf('COLSM8') != -1) {\n return l18_column + ' 8/12';\n } else if (n.indexOf('COLSM9') != -1) {\n return l18_column + ' 9/12';\n } else if (n.indexOf('COLSM10') != -1) {\n return l18_column + ' 10/12';\n } else if (n.indexOf('COLSM11') != -1) {\n return l18_column + ' 11/12';\n } else if (n.indexOf('COLSM12') != -1) {\n return l18_column + ' 12/12';\n } else if (n.indexOf('COLLG1') != -1) {\n return l18_column + ' 1/12';\n } else if (n.indexOf('COLLG2') != -1) {\n return l18_column + ' 2/12';\n } else if (n.indexOf('COLLG3') != -1) {\n return l18_column + ' 3/12';\n } else if (n.indexOf('COLLG4') != -1) {\n return l18_column + ' 4/12';\n } else if (n.indexOf('COLLG5') != -1) {\n return l18_column + ' 5/12';\n } else if (n.indexOf('COLLG6') != -1) {\n return l18_column + ' 6/12';\n } else if (n.indexOf('COLLG7') != -1) {\n return l18_column + ' 7/12';\n } else if (n.indexOf('COLLG8') != -1) {\n return l18_column + ' 8/12';\n } else if (n.indexOf('COLLG9') != -1) {\n return l18_column + ' 9/12';\n } else if (n.indexOf('COLLG10') != -1) {\n return l18_column + ' 10/12';\n } else if (n.indexOf('COLLG11') != -1) {\n return l18_column + ' 11/12';\n } else if (n.indexOf('COLLG12') != -1) {\n return l18_column + ' 12/12';\n } else if (n == 'POSTBODY') {\n return l18_post_division;\n } else if (n == 'POST') {\n return l18_post_division;\n } else if (n == 'CONTENT' || n == 'DEFAULTCONTENT') {\n return l18_content_division;\n } else if (n == 'ENTRYTITLE') {\n return l18_entry_title;\n } else if (n == 'ENTRYCONTENT') {\n return l18_entry_content;\n } else if (n == 'ENTRYFOOTER') {\n return l18_entry_footer;\n } else if (n == 'ENTRYHEADER') {\n return l18_entry_header;\n } else if (n == 'ENTRYTIME') {\n return l18_entry_time;\n } else if (n == 'POSTEDITLINK') {\n return l18_post_edit_link;\n } else if (n == 'POSTTHUMBNAIL') {\n return l18_post_thumbnail;\n } else if (n == 'THUMBNAIL') {\n return l18_thumbnail;\n } else if (n.indexOf(\"ATTACHMENT\") >= 0) {\n return l18_thumbnail_image;\n } else if (n == 'EDITLINK') {\n return l18_edit_link;\n } else if (n == 'COMMENTSLINK') {\n return l18_comments_link_division;\n } else if (n == 'SITEDESCRIPTION') {\n return l18_site_description;\n } else if (n == 'POSTCLEAR' || n == 'POSTBREAK') {\n return l18_post_break;\n }\n\n // Smart For ID\n if (get_name_by_classes(id) !== false) {\n return get_name_by_classes(id);\n }\n\n // Smart For Class\n if (get_name_by_classes(className) !== false) {\n return get_name_by_classes(className);\n }\n\n // If not have name found, use clear.\n if (n.indexOf(\"CLEARFIX\") != -1 || n.indexOf(\"CLEARBOTH\") != -1 || n == \"CLEAR\") {\n return l18_clear;\n }\n\n // TAG NAME START\n if (a == 'P') {\n return l18_paragraph;\n } else if (a == 'BR') {\n return l18_line_break;\n } else if (a == 'HR') {\n return l18_horizontal_rule;\n } else if (a == 'A') {\n return l18_link;\n } else if (a == 'LI') {\n return l18_list_item;\n } else if (a == 'UL') {\n return l18_unorganized_list;\n } else if (a == 'OL') {\n return l18_unorganized_list;\n } else if (a == 'IMG') {\n return l18_image;\n } else if (a == 'B') {\n return l18_bold_tag;\n } else if (a == 'I') {\n return l18_italic_tag;\n } else if (a == 'STRONG') {\n return l18_strong_tag;\n } else if (a == 'Em') {\n return l18_italic_tag;\n } else if (a == 'BLOCKQUOTE') {\n return l18_blockquote;\n } else if (a == 'PRE') {\n return l18_preformatted;\n } else if (a == 'TABLE') {\n return l18_table;\n } else if (a == 'TR') {\n return l18_table_row;\n } else if (a == 'TD') {\n return l18_table_data;\n } else if (a == 'HEADER' || n == 'HEADER') {\n return l18_header_division;\n } else if (a == 'FOOTER' || n == 'FOOTER') {\n return l18_footer_division;\n } else if (a == 'SECTION' || n == 'SECTION') {\n return l18_section;\n } else if (a == 'FORM') {\n return l18_form_division;\n } else if (a == 'BUTTON') {\n return l18_button;\n } else if (a == 'CENTER') {\n return l18_centred_block;\n } else if (a == 'DL') {\n return l18_definition_list;\n } else if (a == 'DT') {\n return l18_definition_term;\n } else if (a == 'DD') {\n return l18_definition_description;\n } else if (a == 'H1') {\n return l18_header + ' (' + l18_level + ' 1)';\n } else if (a == 'H2') {\n return l18_header + ' (' + l18_level + ' 2)';\n } else if (a == 'H3') {\n return l18_header + ' (' + l18_level + ' 3)';\n } else if (a == 'H4') {\n return l18_header + ' (' + l18_level + ' 4)';\n } else if (a == 'H5') {\n return l18_header + ' (' + l18_level + ' 5)';\n } else if (a == 'H6') {\n return l18_header + ' (' + l18_level + ' 6)';\n } else if (a == 'SMALL') {\n return l18_smaller_text;\n } else if (a == 'TEXTAREA') {\n return l18_text_area;\n } else if (a == 'TBODY') {\n return l18_body_of_table;\n } else if (a == 'THEAD') {\n return l18_head_of_table;\n } else if (a == 'TFOOT') {\n return l18_foot_of_table;\n } else if (a == 'U') {\n return l18_underline_text;\n } else if (a == 'SPAN') {\n return l18_span;\n } else if (a == 'Q') {\n return l18_quotation;\n } else if (a == 'CITE') {\n return l18_citation;\n } else if (a == 'CODE') {\n return l18_expract_of_code;\n } else if (a == 'NAV' || n == 'NAVIGATION' || n == 'NAVIGATIONCONTENT') {\n return l18_navigation;\n } else if (a == 'LABEL') {\n return l18_label;\n } else if (a == 'TIME') {\n return l18_time;\n } else if (a == 'DIV') {\n return l18_division;\n } else if (a == 'CAPTION') {\n return l18_caption_of_table;\n } else if (a == 'INPUT') {\n return l18_input;\n } else {\n return a.toLowerCase();\n }\n\n }", "function control_cdms_report_form(ptr)\n {\n \n jQuery('#search_text').val('');\n jQuery('#report_of_br_ao_do_div_msg').html('<td COLSPAN=\"3\"><h6 style=\"color: red;\">Type on search box to get desired office </h6></td>');\n if(ptr>0)\n {\n jQuery('#search_form_table').show('slow');\n if(ptr==1 || ptr==5)\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').hide('slow');\n }\n else\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').show('slow');\n \n }\n \n //control missing & completed\n if(ptr==2)\n {\n jQuery('#missing_list,#completed_list').hide('slow'); \n }\n else\n {\n var login_office_status=jQuery('#login_office_status').val();\n if(login_office_status != 4)\n {\n jQuery('#missing_list,#completed_list').show('slow'); \n }\n else\n {\n jQuery('#missing_list,#completed_list').hide('slow'); \n }\n }\n \n }\n else\n {\n jQuery('#search_form_table').hide('slow'); \n }\n }", "function metricsSelected(parent){\n\t var length = 0;\n\t \n\t if(parent.find('.level.last-level a.selected') != undefined){\n\t\tvar selected = parent.parents('ul.list').find('.level.last-level a.selected');\n\t\tlength = selected.length;\n\t\tconsole.log(length);\n\t }\n\t \n\t parent.parents('ul.list').find('#addMetrics span').html(length);\n }", "function get_updated_controls(){\n selected_service_uids = [];\n $.each($(\"input:checked\"), function(i,e){\n selected_service_uids.push($(e).val());\n });\n\n if (window.location.href.search('add_control') > -1) {\n control_type = 'c';\n } else {\n control_type = 'b';\n }\n\n url = window.location.href.split(\"?\")[0]\n .replace(\"/add_blank\", \"\")\n .replace(\"/add_control\", \"\") + \"/getWorksheetReferences\"\n element = $(\"#worksheet_add_references\");\n if(element.length > 0){\n $(element).load(url,\n {'service_uids': selected_service_uids.join(\",\"),\n 'control_type': control_type,\n '_authenticator': $('input[name=\"_authenticator\"]').val()},\n function(responseText, statusText, xhr, $form) {\n }\n );\n };\n }", "function renderStatus(url, tabs) {\n var host = url.match(/^(.*?:\\/{2,3})?(.+?)(\\/|$)/)[2];\n var result = $.grep(supported_sites, function (elem) {\n return elem.url === host;\n });\n\n if (result.length == 0) {\n $(\"#siteStatus\")\n .text(\"Current site not supported\")\n .addClass(\"notSupported\");\n } else if (result.length == 1) {\n var siteObj = result[0]; // Get specific siteObject from supported_sites\n switch (siteObj.name) {\n case \"Office Ally\":\n case \"Office Ally Demo\":\n case \"United Health Care Dev\":\n case \"United Health Care\":\n enableForm();\n showOAOptions(tabs[0].id);\n $(\"#siteStatus\")\n .text(siteObj.name + \" is supported!\")\n .addClass(\"supported\");\n $(\"#fillForm\").on(\"click\", function () {\n fillFormHandler(siteObj, tabs[0].id);\n });\n // Submit form after hitting enter\n $(\"#datesForm\").keydown(function (event) {\n if (event.which == 13) {\n event.preventDefault();\n fillFormHandler(siteObj, tabs[0].id);\n }\n });\n $(\"#undoForm\")\n .prop(\"disabled\", false)\n .on(\"click\", function () {\n chrome.tabs.sendMessage(\n tabs[0].id,\n {\n message: \"undoForm\",\n siteObj: JSON.stringify(siteObj),\n },\n function (response) {\n ResponseHandler(response);\n }\n );\n });\n\n chrome.tabs.sendMessage(\n tabs[0].id,\n { message: \"getDiagnoses\", siteName: siteObj.name },\n function (diagObj) {\n if (diagObj) {\n if (diagObj.length > 4) {\n $(\"#statusBarMsg\")\n .text(\n \"More than 4 diagnoses detected. Column 24.E will not be filled due to site limitations.\"\n )\n .addClass(\"warning\");\n return;\n }\n $(\"#statusBarMsg\")\n .text(\n diagObj.length +\n \" diagnosis code(s) detected, Enter CPT Codes.\"\n )\n .addClass(\"supported\");\n } else {\n $(\"#statusBarMsg\").text(\n \"No diagnosis detected in section 21. You will enter diagnosis pointers manually for each row.\"\n );\n }\n }\n );\n break;\n default:\n $(\"#siteStatus\")\n .text(siteObj.name + \" is not yet supported\")\n .addClass(\"notSupported\");\n break;\n }\n }\n}", "function extractCodedData()\n{\n // Get global CODED_DATA string.\n CODED_DATA = document.getElementById(\"codedData\").innerHTML;\n\n // Initialise INDEX of 'CODED_DATA' string (global variable).\n INDEX = 0;\n\n // Skip comment start ('<!--').\n getNextWordFromCodedData();\n\n // Set global totals (NOTE: must be done in correct order).\n N_PLAYERS = getNextWordFromCodedData();\n N_OPP_TEAMS = getNextWordFromCodedData();\n N_SEASONS = getNextWordFromCodedData();\n N_MATCHES = getNextWordFromCodedData();\n\n // Create global arrays (NOTE: must be done in correct order).\n buildPlayersArray();\n buildOppTeamsArray();\n buildSeasonsArray();\n buildMatchesArray();\n\n //testExtractCodedData(N_PLAYERS, N_OPP_TEAMS, N_SEASONS, N_MATCHES);\n}", "function sendPageCode(group, category) {\n if (group != null) {\n return;\n }\n\n try {\n var tagFind = getOmniInputTag(\"pathindicatorENG\").childNodes;\n var result = [];\n\n for (i = 0; i < tagFind.length; i++) {\n if (tagFind[i].nodeType == 1 && tagFind[i].innerHTML != undefined && tagFind[i].innerHTML != \"\") {\n result.push(tagFind[i].innerHTML.replace(/\\//gi, '-').replace(/&amp;/gi, 'and').toLowerCase());\n }\n }\n\n //check setup the <a> tag value\n for (k = 1; k < result.length; k++) {\n if (result[k] == \"\") {\n printOmniLog(\"P4 Must Set up the Value of <a> tag in pathindicatorENG!!!!!!!\");\n break;\n }\n }\n //end of check\n\n //according to the URL, control setting the vlaue of s.prop1\n if (isOmniInstore()) {\n s.prop1 = getOmniShopId();\n } else {\n s.prop1 = getOmniSiteCd();\n }\n //end fo the setting\n\n if (getOmniInputTagValue(\"pageTrack\") == \"product detail\" || getOmniInputTagValue(\"pageTrack\") == \"support detail\" || getOmniInputTagValue(\"pageTrack\") == \"business product detail\" || getOmniInputTagValue(\"pageTrack\") == \"instore product detail\") {\n s.pageName = s.prop1 + \":\" + result.join(\":\") + \":\" + getOmniInputTagValue(\"model_code\");\n } else if (getOmniInputTagValue(\"pageTrack\") == \"business insights detail\" && result.length == 3 && result[0] == \"business\" && (result[1] == \"resources\" || result[1] == \"resource\")) { //business insights detail \n (getOmniInputTagValue(\"resource_name\")) ? result.push(getOmniInputTagValue(\"resource_name\")) : \"\";\n s.pageName = s.prop1 + \":\" + result.join(\":\");\n //(getOmniInputTagValue(\"resource_name\")) ? s.pageName = s.prop1 + \":\" + result.join(\":\") + \":\" + getOmniInputTagValue(\"resource_name\") : s.pageName = s.prop1 + \":\" + result.join(\":\")\n } else if (getOmniInputTagValue(\"pageTrack\") == \"business resource detail\" && result.length == 3 && result[0] == \"business\" && result[1] == \"resource\") { //business resource detail \n (getOmniInputTagValue(\"resource_name\")) ? result.push(getOmniInputTagValue(\"resource_name\")) : \"\";\n s.pageName = s.prop1 + \":\" + result.join(\":\");\n } else if (getOmniInputTagValue(\"pageTrack\") == \"support category\" && result.length == 2 && result[0] == \"support\") { //support category\n (getOmniInputTagValue(\"type\")) ? result.push(getOmniInputTagValue(\"type\")) : \"\";\n s.pageName = s.prop1 + \":\" + result.join(\":\");\n } else if (getOmniInputTagValue(\"pageTrack\") == \"news detail\" && result.length == 2 && result[0] == \"news\") { //news detail\n (getOmniInputTagValue(\"new_alert_name\")) ? result.push(getOmniInputTagValue(\"new_alert_name\")) : \"\";\n s.pageName = s.prop1 + \":\" + result.join(\":\");\n } else if (getOmniInputTagValue(\"pageTrack\") == \"estore\" && result.length == 1) { //estore main\n result[0] = result[0].replace('e-store', 'shop');\n result[0] = result[0].replace('e-shop', 'shop');\n s.pageName = s.prop1 + \":\" + result.join(\":\");\n } else {\n s.pageName = s.prop1 + \":\" + result.join(\":\");\n }\n\n if (s.pageName.indexOf(\":error\") != -1 || s.pageName.indexOf(\":page not found\") != -1) {\n initVars();\n s.pageType = \"errorPage\";\n var s_code = s.t(); if (s_code) document.write(s_code);\n return;\n }\n\n if (result[0]) s.prop2 = s.prop1 + \":\" + result[0];\n if (result[1]) s.prop3 = s.prop2 + \":\" + result[1];\n if (result[2]) s.prop4 = s.prop3 + \":\" + result[2];\n if (result[3]) s.prop5 = s.prop4 + \":\" + result[3];\n\n s.hier1 = s.pageName.replace(/:/gi, \">\");\n s.prop40 = s.pageName;\n\n } catch (e) {\n printOmniLog(\"Error occurs in sendPageCode`s Top\");\n }\n\n try {\n var pageType = getOmniInputTagValue(\"pageTrack\");\n\n if (pageType != \"\") {\n if (pageType.indexOf(\"product article\") != -1) {\n if (pageType.indexOf(\"detail\") != -1) {\n var articleVal = [];\n var articleValNo;\n\n if (getOmniInputTagValue(\"artice_id\") != \"\" || getOmniInputTagValue(\"article_id\") != \"\") {\n articleVal.push(getOmniInputTagValue(\"artice_id\"));\n articleVal.push(getOmniInputTagValue(\"article_id\"));\n } else {\n printOmniLog(\"You must set up the artice_id!!!!!!\");\n }\n\n if (getOmniInputTagValue(\"artice_name\") != \"\" || getOmniInputTagValue(\"article_name\") != \"\") {\n articleVal.push(getOmniInputTagValue(\"artice_name\"));\n articleVal.push(getOmniInputTagValue(\"article_name\"));\n } else {\n printOmniLog(\"You must set up the artice_name!!!!!!\");\n }\n\n articleValNo = articleVal.length;\n for (var i = 0; i < articleValNo; i++) {\n if (articleVal[0] == \"\") {\n articleVal.shift();\n }\n }\n s.eVar38 = \"article:\" + articleVal[0];\n } else {\n s.eVar38 = \"article\";\n }\n } else if (pageType.indexOf(\"product offer detail\") != -1 || pageType.indexOf(\"instore offer detail\") != -1) {\n var offerVal = [];\n\n if (getOmniInputTagValue(\"offer_id\") != \"\") {\n offerVal.push(getOmniInputTagValue(\"offer_id\"));\n } else {\n printOmniLog(\"You must set up the offer_id!!!!!!\");\n }\n\n if (getOmniInputTagValue(\"offer_name\") != \"\") {\n offerVal.push(getOmniInputTagValue(\"offer_name\"));\n } else {\n printOmniLog(\"You must set up the offer_name!!!!!!\");\n }\n\n s.eVar38 = \"offer:\" + offerVal[0];\n } else if (pageType.indexOf(\"business solution detail\") != -1) {\n s.eVar11 = getOmniInputTagValue(\"pvi_type_name\");\n s.eVar12 = getOmniInputTagValue(\"pvi_subtype_name\");\n s.eVar13 = getOmniInputTagValue(\"pvi_project_name\");\n\n var solutionVal = [];\n\n if (getOmniInputTagValue(\"solution_id\") != \"\") {\n solutionVal.push(getOmniInputTagValue(\"solution_id\"));\n } else {\n printOmniLog(\"You must set up the solution_id!!!!!!\");\n }\n\n if (getOmniInputTagValue(\"solution_name\") != \"\") {\n solutionVal.push(getOmniInputTagValue(\"solution_name\"));\n } else {\n printOmniLog(\"You must set up the solution_name!!!!!!\");\n }\n s.eVar38 = solutionVal.join(\":\");\n } else if (pageType.indexOf(\"support detail\") != -1) {\n s.eVar14 = getOmniInputTagValue(\"model_code\");\n s.eVar15 = getOmniInputTagValue(\"display_name\");\n\n s.events = \"event2\";\n if (getOmniInputTagValue(\"model_name\") != \"\") {\n s.products = \";\" + getOmniInputTagValue(\"model_name\").toUpperCase();\n } else {\n printOmniLog(\"You Must set up the input tag value about model_name!!!!!!!\")\n }\n } else if (pageType.indexOf(\"business product detail\") != -1) {\n s.eVar11 = getOmniInputTagValue(\"pvi_type_name\");\n s.eVar12 = getOmniInputTagValue(\"pvi_subtype_name\");\n s.eVar13 = getOmniInputTagValue(\"pvi_project_name\");\n s.eVar14 = getOmniInputTagValue(\"model_code\");\n s.eVar15 = getOmniInputTagValue(\"display_name\");\n\n s.events = \"prodView,event2\";\n if (getOmniInputTagValue(\"model_name\") != \"\") {\n s.products = \";\" + getOmniInputTagValue(\"model_name\").toUpperCase();\n } else {\n printOmniLog(\"You Must set up the input tag value about !!!!!!model_name!!!!!!!\")\n }\n } else if (pageType.indexOf(\"product detail\") != -1 || pageType.indexOf(\"instore product detail\") != -1) {\n s.eVar11 = getOmniInputTagValue(\"pvi_type_name\");\n s.eVar12 = getOmniInputTagValue(\"pvi_subtype_name\");\n s.eVar13 = getOmniInputTagValue(\"pvi_project_name\");\n s.eVar14 = getOmniInputTagValue(\"model_code\");\n s.eVar15 = getOmniInputTagValue(\"display_name\");\n\n s.events = \"prodView,event2\";\n if (getOmniInputTagValue(\"model_name\") != \"\") {\n s.products = \";\" + getOmniInputTagValue(\"model_name\").toUpperCase();\n } else {\n printOmniLog(\"You must setup the input tag value about !!!!!!model_name!!!!!!!\");\n }\n } else if (pageType.indexOf(\"product category\") != -1 || pageType.indexOf(\"support category\") != -1 || (pageType.indexOf(\"business\") != -1 && pageType.indexOf(\"landing\") != -1) && pageType.indexOf(\"business support landing\") == -1 || \"support sub category\".indexOf(pageType) != -1) {\n //B2B prop8 setting correction\n var groupVal = [];\n if (getOmniTopSection() != \"\") groupVal.push(getOmniTopSection());\n if (pageType == \"business product category\") {//BUSINESS\n groupVal.push(getOmniInputTagValue(\"type\").toLowerCase());\n s.eVar8 = s.prop8 = groupVal.join(\":\");\n } else if (\"support category,support sub category,product category,business product category\".indexOf(pageType) != -1) {//B2C, SUPPORT\n groupVal.push(getOmniInputTagValue(\"group\").toLowerCase());\n s.eVar8 = s.prop8 = groupVal.join(\":\");\n }\n }\n }\n } catch (e) {\n printOmniLog(\"Error occurs in sendPageCode`s Bottom\");\n }\n\n if (s.events) {\n s.events = s.events + \",event1\";\n } else {\n s.events = \"event1\";\n }\n\n var s_code = s.t(); if (s_code) document.write(s_code);\n}", "function control_omis_report_form(ptr)\n {\n \n jQuery('#search_text').val('');\n jQuery('#report_of_br_ao_do_div_msg').html('<td COLSPAN=\"2\"><h6 style=\"color: red;\">Type on search box to get desired office </h6></td>');\n if(ptr>0)\n {\n jQuery('#search_form_table').show('slow');\n if(ptr==1 || ptr==5 || ptr==7)\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').hide('slow');\n }\n else\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').show('slow');\n \n }\n \n //control missing & completed\n if(ptr==2)\n {\n jQuery('#missing_list,#completed_list').hide('slow'); \n }\n else\n {\n var login_office_status=jQuery('#login_office_status').val();\n if(login_office_status != 4)\n {\n jQuery('#missing_list,#completed_list').show('slow'); \n }\n else\n {\n jQuery('#missing_list,#completed_list').hide('slow'); \n }\n }\n \n }\n else\n {\n jQuery('#search_form_table').hide('slow'); \n }\n }", "async getBasicInfo(){\n //<== Html selectors ==>\n const fieldNameClassName = \".gsc_oci_field\";\n const valueClassName = \".gsc_oci_value\";\n\n // <== Logic ==>\n\n // get fields \n const page = this.page;\n const fieldNameLst = await page.$$eval(fieldNameClassName, (options) =>\n options.map((option) => option.textContent\n ));\n const valueLst = await page.$$eval(valueClassName, (options) =>\n options.map((option) => option.textContent\n ));\n \n\n // <== Set data to json ==>\n for (var i in fieldNameLst){\n const fieldName = fieldNameLst[i];\n if (fieldName===\"Description\"){\n continue\n }\n if (fieldName==\"Total citations\"){\n continue\n }\n const value = valueLst[i];\n this.json[fieldName] = value\n }\n \n\n }", "function autoInit () {\n\t\tvar ddPageinfo = IBMCore.common.meta.page.pageInfo,\n\t\t\tncForm = \"\";\n\n\t\t// Check if they have the proper settings before we .getscript the NC JS file.\n\t\t// First they need the proper NC and ID object that tells us where the form and the placeholder div is.\n\t\tif (ddPageinfo.nc && ddPageinfo.nc.id) {\n\t\t\t// Onload, check if the form and placeholder exists, then include extra JS if so.\n\t\t\t$(function(){\n\t\t\t\tncForm = ddPageinfo.nc.id.form ? $(\"#\" + ddPageinfo.nc.id.form) : ($(\".nc_register_form\")[0] || $(\"#registerform\"));\n\n\t\t\t\t// Validate that the form and the placeholder div exist on the page\n\t\t\t\tif (ncForm.length === 0 || $(\"#\" + ddPageinfo.nc.id.privacyDiv).length === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$.ajax({\n\t\t\t\t\turl: \"//1.www.s81c.com/common/v18/js/notice-choice.js\",\n\t\t\t\t\t//url: \"/v18/js/notice-choice.js\",\n\t\t\t\t\tdataType: \"script\",\n\t\t\t\t\tcache: true\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}", "function iHateJavaScript() {\n var pagelist = new Array();\n var pagelist_opens = new Array();\n\n var next_i = START_INDEX + CONCURRENT_PAGES;\n var active = CONCURRENT_PAGES;\n var sites_visited = 0;\n var connections = 0;\n var successes = 0;\n \n function processNext(page, slot) {\n page.close();\n var my_next_i = next_i++; \n if (my_next_i < END_INDEX) {\n \tvar time = new Date().getTime();\n //console.log(\"[\" + time + \"] slot #\" + slot + \" about to process site #\" + my_next_i + \" \" + addresses[my_next_i]);\n processPage(addresses[my_next_i], pagelist, slot, my_next_i);\n } else {\n --active;\n if (active < 1) {\n phantom.exit();\n }\n }\n }\n \n function processPage(address, pagelist, i, site_num) {\n sites_visited++;\n var slot = i\n var logs = new Array();\n var time = new Date().getTime();\n //console.log(\"[\" + time + \"] slot #\" + slot + \" processing site \" + address);\n var page = require('webpage').create();\n page.onError = ( function(msg, trace) {} );\n pagelist[slot] = address;\n\n page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36';\n\n page.onResourceRequested = function(request) {\n var msg = JSON.stringify(request, undefined, 4);\n //console.log('Request ' + msg);\n dbLog(2, address, request, 'request', 0, logs);\n };\n page.onResourceReceived = function(response) {\n var msg = JSON.stringify(response, undefined, 4);\n //console.log('Response ' + msg);\n dbLog(2, address, response, 'response', 0, logs);\n };\n\n var timeout_count = 0;\n var connection_timeout_id;\n connection_timeout_id = setInterval(function() {\n \tvar time = new Date().getTime();\n \t//console.log(\"[\" + time + \"] slot #\" + slot + \" \" + address + \" reached timeout limit\");\n if (page && (page.url == \"about:blank\" || timeout_count > 0)) {\n \t//console.log(\"[\" + time + \"] slot #\" + slot + \" \" + address + \" timed out.\");\n dbLog(3, address, -1, null, 1, logs);\n pagelist[slot] = \"\";\n processNext(page, slot);\n }\n timeout_count++;\n }, CONNECTION_TIMEOUT);\n \n dbLog(1, address, site_num, null, 1, logs);\n page.open('http://'+address, function(status) {\n connections++;\n clearInterval(connection_timeout_id);\n var time = new Date().getTime();\n //console.log(\"[\" + time + \"] slot #\" + slot + \" opened \" + address);\n ++pagelist_opens[slot];\n var interval1_id, interval2_id;\n var timeout1_id, timeout2_id, timeout3_id;\n if (status !== 'success') {\n var time = new Date().getTime();\n \t//console.log(\"[\" + time + \"] FAIL to load the address \" + address);\n dbLog(3, address, -1, null, 1, logs);\n pagelist[slot] = \"\";\n --pagelist_opens[slot];\n processNext(page, slot);\n }\n else {\n successes++;\n var time = new Date().getTime();\n \t//console.log(\"[\" + time + \"] Initial page load of \" + address + \" complete\");\n dbLog(3, address, 0, null, 0, logs);\n\n var coordsx = 0;\n var coordsy = 0;\n var count = 0;\n \n function createUserEvent (iters) {\n\t\t\t\t\tfor(i = 0; i<iters; i++)\n {\n //coordsy += getRandomInt(1,10);\n //coordsx += getRandomInt(1,10);\n //if(coordsx > 1500) coordsx = 0;\n //if(coordsy > 1500) coordsy = 0;\n coordsx = getRandomInt(100, 1000);\n coordsy = getRandomInt(100, 1000);\n //coordsx = 1000;\n //coordsy = 200;\n if (count % 2 != 0) {\n coordsx = Math.floor(coordsx / 50);\n coordsy = Math.floor(coordsy / 50);\n }\n \n if (EVENT_TYPE == \"mousemove\") {\n \tpage.sendEvent('mousemove', coordsx, coordsy);\n }\n else if (EVENT_TYPE == \"mouseclick\") {\n \tpage.sendEvent('click', coordsx, coordsy, 'left');\n }\n else if (EVENT_TYPE == \"keypress\") {\n \tvar k = getRandomInt(0,25);\n \tswitch (k) {\n \t\tcase 0: var key = page.event.key.A; break; case 1: var key = page.event.key.B; break; case 2: var key = page.event.key.C; break; case 3: var key = page.event.key.D; break; case 4: var key = page.event.key.E; break; case 5: var key = page.event.key.F; break; case 6: var key = page.event.key.G; break; case 7: var key = page.event.key.H; break; case 8: var key = page.event.key.I; break; case 9: var key = page.event.key.J; break; case 10: var key = page.event.key.K; break; case 11: var key = page.event.key.L; break; case 12: var key = page.event.key.M; break; case 13: var key = page.event.key.N; break; case 14: var key = page.event.key.O; break; case 15: var key = page.event.key.P; break; case 16: var key = page.event.key.Q; break; case 17: var key = page.event.key.R; break; case 18: var key = page.event.key.S; break; case 19: var key = page.event.key.T; break; case 20: var key = page.event.key.U; break; case 21: var key = page.event.key.V; break; case 22: var key = page.event.key.W; break; case 23: var key = page.event.key.X; break; case 24: var key = page.event.key.Y; break; case 25: var key = page.event.key.Z; break;\n \t}\n \tpage.sendEvent('keypress', key, null, null, 0);\n }\n count++;\n }\n\t\t\t\t}\n\n timeout1_id = setTimeout(function() {\n \tdbLog(3, address, 1, null, 0, logs);\n \tinterval1_id = setInterval(function() {\n \t\tcreateUserEvent(20);\n \t}, 10);\n }, PAGE_LOAD_TIME);\n\t\t\t\t\n\t\t\t\ttimeout2_id = setTimeout(function() {\n clearInterval(interval1_id);\n dbLog(3, address, 2, null, 0, logs);\n }, PAUSE_START_TIME);\n \n\t\t\t\ttimeout3_id = setTimeout(function() {\n \tdbLog(3, address, 3, null, 0, logs);\n interval2_id = setInterval(function() {\n \tcreateUserEvent(20);\n }, 10);\n }, PAUSE_END_TIME);\n \n setTimeout(function(){\n var time = new Date().getTime();\n \t\t//console.log(\"[\" + time + \"] slot #\" + slot + \" \" + address + \" is done\");\n dbLog(3, address, 4, null, 1, logs);\n clearTimeout(timeout1_id);\n clearTimeout(timeout2_id);\n clearTimeout(timeout3_id);\n clearInterval(interval1_id);\n clearInterval(interval2_id);\n pagelist[slot] = \"\";\n --pagelist_opens[slot];\n processNext(page, slot);\n }, TIME_ON_PAGE);\n }\n });\n }\n /*\n setInterval( function() {\n var time = new Date().getTime();\n console.log(\"========\\n\\t[\" + time + \"] \\tprocessed: \" + sites_visited + \" \\t connections: \" + connections + \" \\t successes: \" + successes);\n var s = \"\\tworking right now:\\n\";\n for(var j = 0; j<CONCURRENT_PAGES; j++) {\n s = s + \" \\t\\tslot #\" + j + \" (\" + pagelist_opens[j] + \") \" + pagelist[j] + \"\\n\";\n }\n console.log(s + \"========\");\n }, 10000);\n */\n \n for (var i = 0; (i < CONCURRENT_PAGES )&& (START_INDEX + i < END_INDEX) && (START_INDEX + i < addresses.length); i++) {\n pagelist_opens[i] = 0;\n processPage(addresses[START_INDEX + i], pagelist, i, START_INDEX + i);\n }\n}", "function get_values_from_experimental_design(form_group) {\n var inputs_div = form_group.children('div:last');\n var factor = parseInt(inputs_div.find('input:radio:checked').val());\n var factor_cards = inputs_div.find('.factor_card');\n\n var factors = [];\n\n // There is always the first factor.\n var factor_1 = get_values_from_factor_card(factor_cards.eq(0));\n factors.push(factor_1);\n\n if (factor == 2) {\n var factor_2 = get_values_from_factor_card(factor_cards.eq(1));\n factors.push(factor_2);\n }\n\n return factors;\n}", "function inspectBehavior(upStr){\n var argArray,numArgs,found,i,numTokens,theFieldNS,theChk;\n\n argArray = extractArgs(upStr); //get new list of Field,Chk pairs (ignore argArray[0])\n numArgs = argArray.length;\n for (i=1; i<(numArgs-2); i+=3) { //with each FieldNS, FieldIE, Chk triplet\n theFieldNS = argArray[i];\n theChk=argArray[i+2];\n\n //Now that form is there, look for field name\n found = false;\n numFields = document.MM_NS_REFS.length;\n for (j=0; j<numFields; j++) { //check if Field is in menu\n if (theFieldNS==document.MM_NS_REFS[j] || theFieldNS==getNameFromRef(document.MM_NS_REFS[j])) { //if Field there\n addValueToMenuItem(document.theForm.fieldMenu,j,theChk);\n found = true;\n break;\n } }\n if (!found) alert(errMsg(MSG_FldNotFound,theFieldNS,theChk)); //if Field name not found\n }\n document.theForm.fieldMenu.selectedIndex = 0;\n displaySelection();\n}", "function countMe() {\r\n \r\n var field1 = 1;\r\n \r\n $.ajax({\r\n url: \"https://docs.google.com/forms/d/e/1FAIpQLSfiVdBlxKWkTLNj7nmYgigFbXDWJ6TkQb5KVMtPiFCiNx9bFA/formResponse\",\r\n\t\t\tdata: {\r\n\t\t\t\t\"entry.511239071\": field1,\r\n\t\t\t},\r\n type: \"POST\",\r\n dataType: \"xml\",\r\n \r\n \t\tsuccess: function(d)\r\n\t\t\t\t {\r\n\t\t\t\t },\r\n\t\t\t\t error: function(x, y, z)\r\n\t\t\t\t {\r\n\t\t\t\t }\r\n });\r\n\t\t\t\treturn false;\r\n\t}", "function report_select_steps_(obj, codevar){\n\t\t// ONLY SELECT STEP\n\t\tif( obj.closest('.fp_fieldline').hasClass('ss_in')){\n\t\t\tif(ss_shortcode_vars.indexOf(codevar)==-1){\n\t\t\t\tss_shortcode_vars.push(codevar);\n\t\t\t}\n\t\t}\n\n\t}", "function buildPageElements() {\n \n var pageHeader = document.getElementsByTagName(\"header\")\n if(pageHeader.length > 1) { console.log(\"Page out of spec: Too many <header> elements.\") }\n else { buildGlobalNavigation('header') }\n\n var pageTitle = document.getElementsByClassName('page-title')\n if(pageTitle.length !== 1) { console.log(\"Page out of spec: A page must have exactlly 1 Page-Title elements.\") }\n else { buildPageTitle('page-title') }\n\n var contactInfo = document.getElementsByClassName('contact-info')\n if(contactInfo.length < 1) { console.log('Page out of spec: There are no Company-Info (<address class=\"contact-info\">) elements on this page.') }\n else { buildContactInfo('contact-info') }\n\n}", "function dynamicSummary(){\n fieldArray = [];\t//\tclear array so everytime this is called we update the data\n window.guideBridge.visit(function(cmp){\n var name = cmp.name;\n if(name && isVisible(cmp)){\n var grouped = isGrouped(cmp);\n var hideLabel = isHideLabel(cmp);\n var hideLink = isHideLink(cmp);\n\n if(name.indexOf(\"block_heading_\") == 0){//\tcheck if block heading (like for the address block fields)\n fieldArray.push({\"type\":\"block_heading\",\"size\":size(cmp),\"name\":cmp.name,\"value\":$(cmp.value).html(),\"grouped\":grouped, \"hideLink\":hideLink, \"className\":cmp.className, \"cssClassName\":cmp.cssClassName,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else if(name.indexOf(\"block_\") == 0) {//\tcheck if object is a group panel\n fieldArray.push({\"type\":\"block\",\"size\":size(cmp),\"name\":cmp.name,\"title\":cmp.title, \"grouped\":grouped, \"className\":cmp.className, \"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else if(name.indexOf(\"heading_\") == 0){//\tcheck if heading\n fieldArray.push({\"type\":\"heading\",\"size\":size(cmp),\"name\":cmp.name,\"value\":$(cmp.value).html(),\"grouped\":grouped, \"hideLink\":hideLink, \"className\":cmp.className, \"cssClassName\":cmp.cssClassName,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n else{\n //if(cmp.value != null){\n if(cmp.className == \"guideTextBox\"){\n fieldArray.push({\"type\":\"field\",\"name\":cmp.name,\"title\":cmp.title,\"grouped\":grouped,\"hideLabel\":hideLabel, \"hideLink\":hideLink, \"value\":((cmp.value)?cmp.value:\"Not provided\"),\"className\":cmp.className,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n if(cmp.className == \"guideRadioButton\" ||\n cmp.className == \"guideCheckBox\" ){\n fieldArray.push({\"type\":\"option\",\"name\":cmp.name,\"title\":cmp.title,\"grouped\":grouped,\"hideLabel\":hideLabel,\"hideLink\":hideLink, \"value\":((cmp.value)?cmp.value:\"Not provided\"), \"obj\":cmp,\"className\":cmp.className,\"id\":cmp.id,\"som\":cmp.somExpression});\n }\n //}\n }\n }\n });\n\n renderHTML();\t//\tthis generates the html inside the summary component\n}", "function saveForm() {\n\n\n var numberOdRows = rowsCount - 1;\n var formName = document.getElementById('search');\n if (formName) {\n var Name = formName.value;\n\n //loop will update html code an prepare it for save to database\n //html elemets properties will be added and updated\n for (var i = 0; i < numberOdRows; i++) {\n if (document.getElementById('inpt' + (i + 1))) {\n document.getElementById('inpt' + (i + 1)).defaultValue = document.getElementById('inpt' + (i + 1)).value;\n }\n if (document.getElementById('countCheck' + (i + 1) + \" 1\")) {\n document.getElementById('countCheck' + (i + 1) + \" 1\").defaultValue = document.getElementById('countCheck' + (i + 1) + \" 1\").value;\n }\n if (document.getElementById('countCheck' + (i + 1) + \" 2\")) {\n document.getElementById('countCheck' + (i + 1) + \" 2\").defaultValue = document.getElementById('countCheck' + (i + 1) + \" 2\").value;\n }\n if (document.getElementById('countCheck' + (i + 1) + \" 3\")) {\n document.getElementById('countCheck' + (i + 1) + \" 3\").defaultValue = document.getElementById('countCheck' + (i + 1) + \" 3\").value;\n }\n if (document.getElementById('countRadio' + (i + 1) + \" 1\")) {\n document.getElementById('countRadio' + (i + 1) + \" 1\").defaultValue = document.getElementById('countRadio' + (i + 1) + \" 1\").value;\n }\n if (document.getElementById('countRadio' + (i + 1) + \" 2\")) {\n document.getElementById('countRadio' + (i + 1) + \" 2\").defaultValue = document.getElementById('countRadio' + (i + 1) + \" 2\").value;\n }\n if (document.getElementById('countRadio' + (i + 1) + \" 3\")) {\n\n document.getElementById('countRadio' + (i + 1) + \" 3\").defaultValue = document.getElementById('countRadio' + (i + 1) + \" 3\").value;\n }\n if (document.getElementById('radioCoun' + (i + 1))) {\n document.getElementById('radioCoun' + (i + 1)).selectedValue = document.getElementById('radioCoun' + (i + 1)).selectedValue;\n }\n if (document.getElementById('checkCoun' + (i + 1))) {\n document.getElementById('checkCoun' + (i + 1)).selected = document.getElementById('checkCoun' + (i + 1)).value;\n }\n if (document.getElementById('typeDrop ' + (i + 1))) {\n document.getElementById('typeDrop ' + (i + 1)).selected = document.getElementById('typeDrop ' + (i + 1)).value;\n }\n if (document.getElementById('formDrop ' + (i + 1))) {\n document.getElementById('formDrop ' + (i + 1)).selectedValue = document.getElementById('formDrop ' + (i + 1)).selectedIndex;\n }\n }\n\n //after html code is updated and adjusted it will be stored to variable\n\n var node = document.getElementById('form block').innerHTML;\n \n //here function will be called to store new or updated template,along with template code function will get template name\n //template name will be used as key in database\n addTemplateToDB(node, Name);\n generateAndSaveFormularTemplate();\n }\n}", "function fetchData() {\n let count = $(\"code1\").innerText;\n console.log(count);\n let params = new FormData();\n params.append(\"pull\", count);\n fetch(URL+\"/backend/scanner.php\", {method: \"POST\", mode: \"cors\", body: params})\n .then(checkStatus)\n .then(JSON.parse)\n .then(displayResult)\n .catch(console.log);\n }", "async function scrap() {\n // launch puppeteer and add some args to fix error in heroku\n const browser = await puppeteer.launch({\n args: ['--no-sandbox', '--disable-setuid-sandbox'],\n });\n const page = await browser.newPage();\n await page.goto('http://www.nrhmhp.gov.in/content/immunisation');\n const data = await page.evaluate(() => {\n // pick all the contents with query selector \"tr\"\n const tds = Array.from(document.querySelectorAll('tr'));\n return tds.map((td) => td.innerText);\n });\n // initialize an empty model for storing the scrapped data\n data.forEach((entry) => {\n let finalObj = {\n name: '',\n whenToGive: '',\n dose: '',\n route: '',\n site: '',\n };\n // split the array of data to get indiidual column\n let temp = entry.split('\\t');\n finalObj.name = temp[0];\n finalObj.whenToGive = temp[1];\n finalObj.dose = temp[2];\n finalObj.route = temp[3];\n finalObj.site = temp[4];\n final.push(finalObj);\n });\n final.forEach((entry) => {\n if (entry.name && entry.whenToGive && entry.site !== 'Site') {\n finalFiltered.push(entry);\n }\n });\n await browser.close();\n return finalFiltered;\n }", "async function scrap() {\n // launch puppeteer and add some args to fix error in heroku\n const browser = await puppeteer.launch({\n args: ['--no-sandbox', '--disable-setuid-sandbox'],\n });\n const page = await browser.newPage();\n await page.goto('http://www.nrhmhp.gov.in/content/immunisation');\n const data = await page.evaluate(() => {\n // pick all the contents with query selector \"tr\"\n const tds = Array.from(document.querySelectorAll('tr'));\n return tds.map((td) => td.innerText);\n });\n // initialize an empty model for storing the scrapped data\n data.forEach((entry) => {\n let finalObj = {\n name: '',\n whenToGive: '',\n dose: '',\n route: '',\n site: '',\n };\n // split the array of data to get indiidual column\n let temp = entry.split('\\t');\n finalObj.name = temp[0];\n finalObj.whenToGive = temp[1];\n finalObj.dose = temp[2];\n finalObj.route = temp[3];\n finalObj.site = temp[4];\n final.push(finalObj);\n });\n final.forEach((entry) => {\n if (entry.name && entry.whenToGive && entry.site !== 'Site') {\n finalFiltered.push(entry);\n }\n });\n await browser.close();\n return finalFiltered;\n }", "function getAttendeeInfo() {\r\n console.log(\"getAttendeeInfo Received a request to load up the attendee data\");\r\n //var badgeNumber = getParameterByName(\"id\"); //This was the old way, before an extra window broke it\r\n\r\n // Old version of badge number with attendee ID\r\n var attendeeId = $(\"label:contains('Attendee ID')\").siblings().text().trim();\r\n\r\n // New version of badge number with account ID\r\n //var accountId = document.getElementById('usHidden').value;\r\n var accountId = new URL(window.location.toString()).searchParams.get('acct');\r\n\r\n //var badgeNumber = \"1234\"; //For testing\r\n\r\n var attendeeName = \"\".concat(document.getElementsByName('attendee.firstName')[0].value,\" \",document.getElementsByName('attendee.lastName')[0].value);\r\n var attendeeBadgeName = $(\"label:contains('Badge Name'):first\").next().find(\"input\").val();\r\n\r\n if (attendeeBadgeName == \"\" || attendeeBadgeName == null) {\r\n attendeeBadgeName = attendeeName;\r\n }\r\n\r\n var numActBadgesFromElement = $(\"label:contains('Number of Active Badges'):first\").next().find(\"input\").val();\r\n var numberActiveBadges = numActBadgesFromElement === '' ? 0 : parseInt(numActBadgesFromElement);\r\n var ticketType = document.getElementById('ticketPackageId').options[document.getElementById('ticketPackageId').selectedIndex].text;\r\n var arrChecks = $(\"label:contains('Art Show Hold - Do Not Release'):first\").next().find(\"input\");\r\n var opsHoldCheck = $(\"label:contains('Operations Hold - Do Not Release'):first\").next().find(\"input\");\r\n var nonTransferName = $(\"label:contains('Non-Transferable First and Last Name'):first\").next().find(\"input\").val();\r\n /*\r\n if (window.jQuery) {\r\n console.log(\"jQuery Is Loaded\");\r\n } else {\r\n // jQuery is not loaded\r\n console.log(\"jQuery Is NOT Loaded\");\r\n }\r\n */\r\n var regStatus = $(\"label:contains('Registration Status')\").siblings().text().trim();\r\n console.log(regStatus);\r\n\r\n //var regStatus = \"SUCCEED\"; //For Testing Only\r\n\r\n var artShowHold=\"No\";\r\n for (i=0; arrChecks[i]; i++)\r\n {\r\n if(arrChecks[i].checked){\r\n //checkedValue = arrChecks[i].value;\r\n artShowHold=\"Yes\";\r\n break;\r\n }\r\n }\r\n var opsHold=\"No\";\r\n for (i=0; opsHoldCheck[i]; i++)\r\n {\r\n if(opsHoldCheck[i].checked){\r\n //checkedValue = arrChecks[i].value;\r\n opsHold=\"Yes\";\r\n break;\r\n }\r\n }\r\n\r\n\r\n console.log(\"Is there an art show hold? \"+artShowHold);\r\n console.log(\"Is there an operations department hold? \"+opsHold);\r\n console.log(\"Ticket: \"+ticketType);\r\n console.log(\"Attendee ID: \"+attendeeId);\r\n console.log(\"Account ID: \"+accountId);\r\n console.log(\"Name: \"+attendeeName+\" NonTransfer Name: \"+nonTransferName);\r\n\r\n var dataObject=new attendee(accountId, attendeeId, attendeeName, ticketType, numberActiveBadges, attendeeBadgeName, regStatus, artShowHold, opsHold, nonTransferName );\r\n\r\n return dataObject;\r\n}", "function display_survey() {\n // const prev_site = window.localStorage.getItem('prev_site');\n if (site_history === null || site_history.length === 0) {\n var articles = {\n article1: null,\n article2: null,\n };\n update_survey(articles);\n return;\n }\n const prev_site = site_history[site_history.length - 1];\n const req_json = {\n url: prev_site,\n };\n const param_det = {\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(req_json),\n method: 'POST',\n };\n console.log('Start analyzing...');\n // fetch('http://15.164.214.36/analyze-entity', param_det)\n // .then((data) => {\n // return data.json();\n // })\n // .then((res) => {\n // get_article_id(res.title, prev_site, res.entities.entities);\n // });\n\n //TRIAL: get the entity from firebase instead of analyzing it in the server\n db.collection('Articles').where('url', '==', prev_site)\n .get().then(function(querySnapshot) {\n var article = []\n querySnapshot.forEach((doc) => {\n article.push({title: doc.data().title, entities: doc.data().entities});\n });\n\n if (article.length > 0) {\n get_article_id(article[0].title, prev_site, article[0].entities)\n } else {\n console.log(\"Not found\")\n return\n }\n })\n}", "function setCustomValues(analyticsFacts) {\n var values = getCustomValues(analyticsFacts);\n\n if (typeof values != 'undefined') {\n try {\n /* Add all of the site specific variables here */\n\n // Server. ex: server = uk.myherbalife.com\n s_omntr.server = values.host;\n\n // Page Name. ex: pageName = myhl:us:en:ordering:hoppingCart\n // https://www.myherbalife.com/Ordering/ShoppingCart.aspx\n s_omntr.pageName = values.pageName;\n\n // Page Name Copy. Conversion Variable \n s_omntr.eVar3 = values.pageNameBreadCrumbs;\n\n // Page Title. Traffic Variable ex prop33 = toolsAndTrainingOverview\n s_omntr.prop33 = values.pageTitle;\n s_omntr.eVar33 = \"D=c33\";\n\n // Local PageTitle. Traffic Variable ex prop35 = herramientas y capacitacion\n s_omntr.prop35 = values.localPageTitle;\n s_omntr.eVar35 = values.localPageTitle;\n\n // Section. ex: s_channel = myherbalife:toolsandtraining\n s_omntr.channel = values.parentSection;\n\n // Region. Traffic Variable ex: s_prop1 = myhl3\n //s_omntr.prop1 = values.region;\n\n // Country. Traffic Variable ex: prop2 = myhl3:us \n s_omntr.prop2 = values.country;\n s_omntr.eVar12 = \"D=c2\";\n\n // Language. Traffic Variable ex: prop6 = en\n s_omntr.prop6 = values.language;\n\n // Locale. Traffic Variable ex: prop29 = en-US\n s_omntr.prop29 = values.locale;\n s_omntr.eVar29 = values.locale;\n\n // Sub Sections (Level 1). Traffic Variable ex: prop3 = myhl:na:us:toolsandtraining \n s_omntr.prop3 = values.sectionLevel1;\n s_omntr.eVar13 = \"D=c3\";\n\n // Sub Sections (Level 2). Traffic Variable ex: prop4 = myhl:na:us:toolsandtraining:resourcelibrary\n if (values.sectionLevel2 != \"\") {\n s_omntr.prop4 = values.sectionLevel2;\n s_omntr.eVar14 = \"D=c4\";\n }\n\n // Sub Sections (Level 3). Traffic Variable ex: prop5 = myhl:na:us:toolsandtraining:resourcelibrary:tutorialsandquizzes\n if (values.sectionLevel3 != \"\") {\n s_omntr.prop5 = values.sectionLevel3;\n s_omntr.eVar15 = \"D=c5\";\n }\n\n // Sub Sections (Level 4). Traffic Variable ex: prop16 = myhl:na:us:toolsandtraining:resourcelibrary:tutorialsandquizzes:subsection4\n if (values.sectionLevel4 != \"\") {\n s_omntr.prop16 = values.sectionLevel4;\n }\n\n // Sub Sections (Level 5). Traffic Variable ex: prop17 = myhl:na:us:toolsandtraining:resourcelibrary:tutorialsandquizzes:subsection4:subsection5\n if (values.sectionLevel5 != \"\") {\n s_omntr.prop17 = values.sectionLevel5;\n }\n\n // Hierarchy. ex: hier1 = myhl:na:us:toolsandtraining|myhl:na:us:toolsandtraining:resourcelibrary|myhl:na:us:toolsandtraining:resourcelibrary:tutorialsandquizzes \n s_omntr.hier1 = values.hierarchy1;\n\n // Currency Code. ex: currencyCode = USD\n s_omntr.currencyCode = values.currencyCode;\n\n // Distributor Profile.\n if (values.distributorId != \"\") {\n // DS ID. Traffic Variable ex prop19 = STAFF \n s_omntr.prop19 = values.distributorId;\n // Distributor ID. Conversion Variable ex: eVar22 = STAFF\n s_omntr.eVar22 = values.distributorId;\n\n if (values.distributorTeam != \"\") {\n // DS Team. Traffic Variable ex: prop26 = PT \n s_omntr.prop26 = values.distributorTeam;\n // DS Team. Conversion Variable ex eVar8 = PT\n s_omntr.eVar8 = values.distributorTeam;\n // Levels pathing. Traffic Variable ex: prop18 = PT:myhl:na:us:toolsandtraining\n s_omntr.prop18 = values.distributorTeam + \":\" + values.pageName;\n }\n if (values.countryOfProcessing != \"\") {\n // Country of Processing. Traffic Variable ex prop25 = US\n s_omntr.prop25 = values.countryOfProcessing;\n // Country of Processing. Conversion Variable ex eVar25 = US\n s_omntr.eVar25 = values.countryOfProcessing;\n }\n if (values.dsIsBizworksSubscriber != \"\") {\n // Bizworks Subscriber. Traffic Variable ex: prop27 = false\n s_omntr.prop27 = values.dsIsBizworksSubscriber;\n // Bizworks Subscriber. Conversion Variable ex: eVar27 = false\n s_omntr.eVar27 = values.dsIsBizworksSubscriber;\n }\n if (values.dsIsDwsOwner != \"\") {\n // Ds Owns DWS. Traffic Variable ex: prop34 = false \n s_omntr.prop34 = values.dsIsDwsOwner;\n // Ds Owns DWS. Conversion Variable ex: eVar34 = false\n s_omntr.eVar34 = values.dsIsDwsOwner;\n }\n }\n\n // Logged in Status.\n if (values.loggedStatus != \"\") {\n // Custom eVar28. Conversion Variable ex: eVar28 = logged in\n s_omntr.eVar28 = values.loggedStatus;\n // copy eVar28 \"logged in\" status. Traffic Variable ex: prop28 = logged in \n s_omntr.prop28 = values.loggedStatus;\n }\n\n //Waiting Room\n if (values.WaitingRoom) {\n s_omntr.events = \"event10\";\n }\n\n\n // Product View\n if (values.productDetail != \"\") {\n // Product Name. Traffic Variable ex: prop15 = formula 1 instant healthy meal nutritional shake mix\n s_omntr.prop15 = values.productName;\n s_omntr.events = \"prodView\";\n s_omntr.products = values.productDetail;\n }\n\n //Shopping Cart\n if (values.products != \"\") {\n // Products. ex: products = \";formula 1 nutritional shake mix-french vanilla 750g (3106);1;19.87,;formula 1 nutritional shake mix-wild berry 750g (3108);2;39.74\";\n s_omntr.products = values.products;\n if (values.purchaseId == \"scView\") {\n s_omntr.events = \"scView\";\n } else if (values.purchaseId == \"scCheckout\") {\n s_omntr.events = \"scCheckout\";\n } else if (values.purchaseId != \"\" && values.purchaseId != \"scView\" && values.purchaseId != \"scCheckout\") {\n s_omntr.events = \"purchase\";\n s_omntr.purchaseId = values.purchaseId; // Purchase ID. Traffic Variable ex: eVar9 = DA00020508\n s_omntr.eVar9 = s_omntr.purchaseId;\n }\n }\n /* End */\n if (values.events) {\n s_omntr.events = s_omntr.apl(s_omntr.events, values.events, ',', 1);\n }\n return true;\n\n } catch (err) {\n return false;\n }\n } else {\n return false;\n }\n }", "function populate_side(/* country_name,country_code,search_terms */) {\n\n\tvar menu_target = 'main';\n\tvar sidepanel_content = '';\n\tvar sidepanel_item = '';\n\tvar country_code = 'IN';\n\tvar country_name = 'India';\n\n\tvar file_to_load;\n\n\t//select reegion on sidepanel results filter\n\t//ONLY WORKS IF DATA-SIDEPANEL-CONTENT == DISHES\n\t$('#sidepanel-content').on('change','select[name=\"region\"][data-sidepanel-content=\"dishes\"]',function () {\n\n\t\tcountry_code = 'IN';\n\t\tvar region_code = 'KA';\n\n\t\tsidepanel_content = $(this).attr('data-sidepanel-content');\n\n\t\tfile_to_load = country_code+'-'+region_code+'-'+sidepanel_content+'.php';\n\n\t\t$(\"#sidepanel-content\").load('content/'+file_to_load);\n\t\t$('.sidepanel-menu a[data-sidepanel-content=info]').attr('data-sidepanel-content','KA-info');\n\t\t$('.sidepanel-menu a[data-sidepanel-content=dishes]').attr('data-sidepanel-content','KA-dishes');\n\n\t}).change();\n\n\n\t// click on links to sidepanel\n\t$('body').on('click', '.sidepanel-content', function(e){\n\t\te.preventDefault();\n\n\n\t\t// check if data attr exist and set variables\n\t\tif ($(this).is('[data-menu-target]')) {\n\t\t\t// attribute exists\n\t\t\tmenu_target = $(this).attr('data-menu-target');\n\t\t}\n\n\t\tif ($(this).is('[data-sidepanel-content]')) {\n\t\t\t// attribute exists\n\t\t\tsidepanel_content = $(this).attr('data-sidepanel-content');\n\t\t}\n\n\t\tif ($(this).is('[data-sidepanel-item]')) {\n\t\t\t// attribute exists\n\t\t\tsidepanel_item = $(this).attr('data-sidepanel-item');\n\t\t}\n\n\t\t/*\n\t\tif ($(this).is('[data-country-code]')) {\n\t\t\t// attribute exists\n\t\t\tcountry_code = $(this).attr('data-country-code');\n\t\t}\n\n\t\tif ($(this).is('[data-country-name]')) {\n\t\t\t// attribute exists\n\t\t\tcountry_name = $(this).attr('data-country-name');\n\t\t}*/\n\t\tconsole.log('menu target = '+menu_target+' | content = '+sidepanel_content+' | item = '+sidepanel_item+' | country code = '+country_code+' | country = '+country_name );\n\n\n\t\t// figure out what file to load\n\t\tif ( menu_target == 'main' ) {\n\t\t\t//si menu target MAIN\n\t\t\tfile_to_load = country_code+'-'+sidepanel_content+'.php';\n\t\t\t$('#sidepanel-navigation .showmenu').removeClass('showmenu');\n\t\t\tmark_current(menu_target,sidepanel_content,'');\n\n\t\t\tvar str2 = \"KA-\";\n\t\t\tif(sidepanel_content.indexOf(str2) != -1){\n\t\t\t\t//alert('yes');\n\t\t\t} else {\n\t\t\t\t//alert('no');\n\t\t\t\t$('.sidepanel-menu a[data-sidepanel-content=KA-info]').attr('data-sidepanel-content','info');\n\t\t\t\t$('.sidepanel-menu a[data-sidepanel-content=KA-dishes]').attr('data-sidepanel-content','dishes');\n\t\t\t}\n\n\t\t} else {\n\t\t\t//si menu target SUB\n\t\t\tfile_to_load = sidepanel_item+'-'+sidepanel_content+'.php';\n\n\t\t\tif(sidepanel_item != 'arroz-basmati') {\n\t\t\t\tshow_submenu(menu_target);\n\t\t\t\tmark_current(menu_target,sidepanel_content,sidepanel_item);\n\t\t\t}\n\n\n\n\t\t}\n\t\tconsole.log(file_to_load);\n\n\t\t//load file in sidepanel\n\t\t$(\"#sidepanel-content\").load('content/'+file_to_load);\n\n\n\t});\n\n\n\n\n\t//make submenu visible\n\tfunction show_submenu(submenu_target){\n\t\tconsole.log('show sub! '+submenu_target);\n\n\t\t$('#sidepanel-navigation .'+submenu_target).addClass('showmenu');\n\t\t$('#sidepanel-navigation .sidepanel-submenu').not( '.'+submenu_target ).removeClass('showmenu');\n\n\t}\n\n\t//mark current link\n\tfunction mark_current(menu_target,content,item){\n\t\tconsole.log('target menu '+menu_target+' | content '+content+' | item '+item);\n\n\t\tif (menu_target == 'main') {\n\t\t\t//\n\t\t\t$('.sidepanel-menu > li > a[data-sidepanel-content=\"'+content+'\"]').addClass('current');\n\t\t\t$('.sidepanel-menu > li > a').not( '[data-sidepanel-content=\"'+sidepanel_content+'\"]' ).removeClass('current');\n\t\t} else {\n\t\t\t//target menu sub-dishes | content generalinfo | item bisi-bele-bath\n\t\t\t$('.'+menu_target+' > li > a[data-sidepanel-content=\"'+content+'\"]').addClass('current');\n\t\t\t$('.'+menu_target+' > li > a').not( '[data-sidepanel-content=\"'+sidepanel_content+'\"]' ).removeClass('current');\n\t\t\t$('.submenu').not('.'+menu_target).find('li a').removeClass('current');\n\n\t\t\tvar parent_menu = menu_target.replace(\"sub-\", \"\");\n\t\t\t$('.sidepanel-menu > li > a[data-sidepanel-content=\"'+parent_menu+'\"]').not('.current').addClass('current');\n\n\t\t}\n\n\t}\n\n\tshow_action_tooltip();\n\n}", "function setCardSectionSelectors() {\n let cardSectionSelector = null;\n let cardDigitsSelector = null;\n let cardNameSelector = null;\n\n if(document.querySelector('.pmts-instrument-detail-rows')) {\n // Wallet Page\n cardSectionSelector = '.pmts-instrument-detail-rows';\n cardNameSelector = '.pmts-instrument-display-name';\n cardDigitsSelector = '.pmts-instrument-number-tail:nth-child(2)';\n\n } else if(document.querySelector('.a-row.card-info')) {\n // Checkout Page\n cardSectionSelector = '.a-row.card-info';\n cardNameSelector = '#credit-card-name';\n cardDigitsSelector = 'span:nth-of-type(2)';\n\n } else if(document.querySelector('.pmts-cc-detail')) {\n // Reload Page\n cardSectionSelector = '.pmts-cc-detail';\n cardNameSelector = '.pmts-cc-issuer-name';\n cardDigitsSelector = '.pmts-cc-number';\n } else if(document.querySelector('.pmts-instrument-box')) {\n // Auto Reload Page\n cardSectionSelector = '.pmts-instrument-box';\n cardNameSelector = '.pmts-instrument-display-string';\n cardDigitsSelector = '.pmts-inst-tail';\n }\n\n return [cardSectionSelector, cardDigitsSelector, cardNameSelector];\n}", "function processEntries () {\n document.extraSearchEngines = {\n \"tangorin search\": \"http://tangorin.com/dict.php?dict=general&s=%s\",\n \"Forvo pronunciation\": \"http://www.forvo.com/search/%s\",\n \"Tatoeba example sentences\": \"http://tatoeba.org/eng/sentences/search?query=%s\"\n };\n document.verbSearchEngines = {\n \"Verbix verb conjugation\": \"http://www.verbix.com/webverbix/go.php?T1=%s&D1=51&H1=151\",\n \"Japanese Verb Conjugator\": \"http://www.japaneseverbconjugator.com/VerbDetails.asp?txtVerb=%s\"\n };\n document.kanjiSearchEngines = {\n \"SLJFAQ kanji search\": \"http://kanji.sljfaq.org/soft-keyboard.html#?=%s\",\n \"Red Finch kanji search\": \"http://redfinchjapanese.com/?action=kanji_dictionary?=%s\"\n };\n document.entryNodes = content.document.getElementsByClassName(\"concept_light\");\n function getEntryName(x) {\n return String.trim(x.getElementsByClassName(\"text\")[0].textContent);\n }\n document.results = map(document.entryNodes, getEntry);\n function getEntryStatusLinks(x) {\n return x.getElementsByClassName(\"concept_light-status_link\");\n }\n function getEntryLinksDropdown(x) {\n var links = getEntryStatusLinks(x);\n var dropdownId;\n for (i=0; i<links.length; ++i) {\n if (links[i].textContent == \"Links\")\n dropdownId = links[i].getAttribute(\"data-dropdown\");\n return document.getElementById(dropdownId);\n }\n }\n}", "function saveAnomalyTypesForm() {\n // Save anomaly types form\n var anomalyList = document.getElementById(\"anomaly-selection-list\").children;\n for (var i = 0; i < anomalyList.length; i++) {\n var item = anomalyList[i];\n var type = item.getElementsByTagName(\"label\")[0].innerText;\n var value = item.getElementsByTagName(\"input\")[0].value;\n anomalySelectionForm.counts[type] = value;\n }\n // Sets whether anomaly form is used or not\n for (var _type in anomalySelectionForm.counts) {\n var count = anomalySelectionForm.counts[_type];\n var startIndex = anomalyTypeIndexes[_type];\n for (var _i3 = startIndex; _i3 < startIndex + maxAnomalies; _i3++) {\n if (count != 0) {\n anomalyForms[_i3][\"selected\"] = true;\n count -= 1;\n } else anomalyForms[_i3][\"selected\"] = false;\n }\n }\n}", "function getAnalyticsPageTypePatterns() {\n var patterns = [\n {\n // Matches /about, /about/, /about-us, and /about-us/\n // Does not match /about-kplu, /about-the-election\n 'page_type': 'Content/About',\n 'regex_pattern': '/about(-us)?/?$',\n 'pattern_name': 'Core Publisher About Page'\n },\n {\n // Matches /events, /events/, events/2015\n // Does not match /events-for-kplu\n 'page_type': 'Events',\n 'regex_pattern': '/events(/|$)',\n 'pattern_name': 'Core Publisher Events Page'\n },\n {\n // Matches /people, /people/, /people/rest-of-url\n // Does not match /people-protest-for-change\n 'page_type': 'People',\n 'regex_pattern': '/people(/|$)',\n 'pattern_name': 'Core Publisher People Page'\n },\n {\n // Matches /search_playlists, /search_playlists/\n // Does not match /search_playlists-of-site, /search_playlists/rest-of-url\n 'page_type': 'Playlist',\n 'regex_pattern': '/search_playlists/?$',\n 'pattern_name': 'Core Publisher Playlist Page'\n },\n {\n // Matches /programs, /programs/, /programs/rest-of-url\n // Does not match /programs-for-station\n 'page_type': 'Program',\n 'regex_pattern': '/programs(/|$)',\n 'pattern_name': 'Core Publisher Program Page'\n },\n {\n // Matches /schedule, /schedule/, /schedule/week, /schedule/wwno3, etc.\n // Does not match /schedule-of-events\n 'page_type': 'Schedule',\n 'regex_pattern': '/schedule(/|$)',\n 'pattern_name': 'Core Publisher Schedule Page'\n },\n {\n // Matches /search/google, /search/google/, /search/google/rest-of-url\n // Does not match /search, /search/, /search/google-search\n 'page_type': 'Search',\n 'regex_pattern': '/search/google/?',\n 'pattern_name': 'Core Publisher Search GSA Page'\n },\n {\n // Matches /post/some-cool-story, /webclip/some-cool-webclip\n // Does not match /post, /post-of-something-cool, /webclip, /webclip-here\n 'page_type': 'Story',\n 'regex_pattern': '/post/|/webclip/',\n 'pattern_name': 'Core Publisher Story Page'\n },\n {\n // Matches /listen, /listen/, /listen-live, /listen-live/\n 'page_type': 'Streaming',\n 'regex_pattern': '/listen(-live)?/?(#|$)',\n 'pattern_name': 'Core Publisher Listen Live Page'\n }\n ];\n\n return patterns;\n }", "function processMainPage($, ccyys, callback) {\n $(\"#fos_cn > option\").each(function(i, el) {\n let e = $(el);\n if(e.attr(\"value\") != \"\") {\n fields.push([e.attr(\"value\"), e.text()]);\n }\n });\n $(\"#core_code > option\").each(function(i, el) {\n let e = $(el);\n if(e.attr(\"value\") != \"\") {\n cores.push([e.attr(\"value\"), e.text()]);\n }\n });\n for(let flagindex = 1;; flagindex++) {\n let potentialflag = $(\"label[for=flag\" + flagindex + \"]\").text();\n if(potentialflag == undefined || potentialflag == \"\") break;\n else flags.push(potentialflag);\n }\n //console.log(fields[3]);\n let fs = require(\"fs\");\n //saveAllClassesTo(ccyys, \"out.json\");\n fs.writeFile(\"data.json\", JSON.stringify({\"fields\": fields, \"cores\": cores, \"flags\": flags}), function(e) {});\n}", "function getInfo(form) {\r\n form.info.value = \"Browser Information: \" + navigator.userAgent;\r\n}" ]
[ "0.5382703", "0.5172645", "0.5065163", "0.49346924", "0.48996794", "0.48668793", "0.48654985", "0.4816717", "0.4798568", "0.4760419", "0.4757643", "0.4745863", "0.47445166", "0.47421628", "0.4725101", "0.47023365", "0.46835566", "0.46762025", "0.46661854", "0.46553585", "0.46496943", "0.46477172", "0.46443358", "0.46114135", "0.4603818", "0.45978883", "0.45963958", "0.45884958", "0.45884302", "0.45859465", "0.45686796", "0.456845", "0.45618004", "0.4560295", "0.45597363", "0.45352256", "0.45327997", "0.45268935", "0.45232928", "0.45015928", "0.44939682", "0.44918287", "0.44913813", "0.44658408", "0.44548035", "0.44538134", "0.44499496", "0.4437961", "0.44333136", "0.44276744", "0.4427439", "0.44256568", "0.44225484", "0.4415477", "0.4414064", "0.44123554", "0.44048902", "0.4403511", "0.44029096", "0.4391602", "0.43822208", "0.43725297", "0.43626624", "0.4361891", "0.43548185", "0.4352602", "0.4348599", "0.43445215", "0.43431026", "0.43369457", "0.4323676", "0.43216795", "0.43214962", "0.43198153", "0.43164268", "0.43154767", "0.43119875", "0.43109772", "0.43037382", "0.4301358", "0.42995915", "0.42926717", "0.4285054", "0.4273366", "0.42732367", "0.42717475", "0.42647982", "0.42597625", "0.4256143", "0.42511305", "0.42511305", "0.42470163", "0.423409", "0.4233692", "0.4227758", "0.42214388", "0.42199892", "0.4218812", "0.42159235", "0.42155284", "0.42142734" ]
0.0
-1
Retrieve input data from user Quick Claim form
function getUserInput(siteObj) { var cptValues = $("#cptForm").serializeArray(); var datesValues = $("#datesForm").serializeArray(); var cptObjects = {}; var datesArray = []; for (var i = 0; i < 6; i++) { var tempObj = {}; if (cptValues[i].value) { // Check if user input cpt is in profile saved cpt via store.js var cptObj = store.get("cpt" + cptValues[i].value); if (cptObj) { tempObj = objectTrimmer(cptObj); } cptObjects["cpt" + cptValues[i].value] = tempObj; } } for (var i = 0; i < 15; i++) { if (datesValues[i].value) { datesArray.push(datesValues[i].value); } } var rowsRequired = Object.keys(cptObjects).length * datesArray.length; if (rowsRequired > siteObj.maxRows) { $("#statusBarMsg") .text("Row limit exeeded. Further rows will not be added.") .addClass("warning"); } var claimObj = { cpts: cptObjects, dates: datesArray, rows: rowsRequired }; return claimObj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_claims_info()\n{\n //fade_in_loader_and_fade_out_form(\"loader\", \"stats_info\"); \n var bearer = \"Bearer \" + localStorage.getItem(\"access_token\"); \n send_restapi_request_to_server_from_form(\"get\", api_get_claims_url, bearer, \"\", \"json\", get_claims_info_success_response_function, get_claims_info_error_response_function);\n}", "function getFormValuesAndDisplayResults() {\n}", "function getFormValues(){\n\nsignupInfo.email = document.getElementById('email').value;\nsignupInfo.username = document.getElementById('username').value;\nsignupInfo.password = document.getElementById('password').value;\nsignupInfo.firstName = document.getElementById('firstName').value;\nsignupInfo.lastName = document.getElementById('lastName').value;\n\nsendToApi ();\n}", "function get_form_data() {\n var data = {};\n data[\"out\"] = $(\"#outcome-resp\").val();\n data[\"int\"] = $(\"#intervention-resp\").val();\n data[\"cmp\"] = $(\"#comparator-resp\").val();\n data[\"ans\"] = getCheckBoxSelection();\n data[\"res\"] = $(\"#reasoning-resp\").val();\n data[\"xml\"] = $(\"#reasoning-resp\").attr('xml_offsets');\n return data;\n}", "function getRegInputData() {\n const name = userName.value;\n const email = userEmail.value;\n const password = userPassword.value;\n const passwordConfirm = userPasswordCnfrm.value;\n return { name, email, password, passwordConfirm };\n}", "function form1(){\n var form = {\n fname: document.getElementById('fname').value,\n lname: document.getElementById('lname').value,\n email: document.getElementById('email').value,\n password: document.getElementById('password').value,\n }\n \n console.log(\"Account Information \", form)\n}", "function getInputData() {\n\n log.audit({title: 'START', details: 'START OF RUN'});\n\n var policyList = getPolicyList();\n\n\n return policyList;\n }", "function getInput() {\n \tvar data = {},\n \t form = pageElements.input,\n \t tagString;\n\n\n \tdata.id = form.id.value;\n \tdata.title = form.title.value;\n \tdata.url = form.url.value\n \tdata.author = form.author.value;\n \tdata.tags = \"\";\n \tdata.comments = form.comments.value;\n\n \ttagString = form.tags.value;\n \tif(tagString.length) {\n \t\tdata.tags = tagString.toLowerCase().replace(/\\s*/g, \"\").split(\",\");\n \t}\n\n \treturn data;\n }", "function getForm() {\n return questionForm;\n}", "function gatherData()\n{\n\tk_username = getKeystrokesData();\n\tdocument.getElementById('k_username').value = k_username;\n\tdocument.getElementById('login_form').submit();\n\t\n}", "function getPractitioner(data) {\n $('input[name=\"practitioner\"]').val(data.key);\n}", "function getUserInput(form) {\n var data = [];\n const formData = new FormData(form);\n formData.forEach((item, i) => {\n data.push(Number(item));\n });\n tab_values[current_tab] = data;\n renderTable(createTableData(data));\n}", "function getInput(){\n prompt.get(['Organization'], function(err, result) {\n if(err) { return onErr(err); }\n var inputStream = result.Organization\n console.log('Input Stream: ' + inputStream);\n\n var input = inputStream.split('^');\n\n clearAll();\n\n console.log('Partner Name:' + input[4]);\n\n recordUser(inputStream);\n\n selectField(\"Partner Name\", input[4]);\n getInput();\n });\n}", "function getForm() {\n inputNombre.value = localStorage.getItem('nombre');\n inputApellido.value = localStorage.getItem('apellido');\n inputTel.value = localStorage.getItem('tel');\n inputDir.value = localStorage.getItem('dir');\n inputObs.value = localStorage.getItem('obs');\n console.log('data loaded');\n}", "function onReaderLoad(event){\n \n let form = document.querySelector('form')\n form.remove();\n\n let obj = JSON.parse(event.target.result)\n p = params(obj.features, obj.features[0])\n}", "componentDidMount() {\n this.props.getForm(FORMS.PASSPHRASE);\n this.props.getForm(FORMS.IDENTITY_NAME);\n }", "_getSavedQueryDetails (params) {\n let queryName = this.refs.queryName.getDOMNode().value;\n if (!queryName) {\n this.setState({clientMessage: clientMessages.noName});\n return;\n }\n\n let secretToken = UserStore.getUserDetails().secretToken;\n let user = UserStore.getUserDetails().email;\n let query = codeMirror.getValue();\n\n return {\n secretToken: secretToken,\n user: user,\n query: query,\n parameters: params && params.parameters,\n description: params && params.description,\n name: queryName\n };\n }", "function getFormValues() {\n\tname = document.getElementById(\"name\").value;\n\temail = document.getElementById(\"email\").value;\n\tsubject = document.getElementById(\"subject\").value;\n\tmessage = document.getElementById(\"message\").value;\n}", "function getUserData() {\n\n // Retrieve all keys and values from application storage, including public app config. Set the values for select, input and textarea elements on a page in a callback\n\n EcwidApp.getAppStorage(function (allValues) {\n setValuesForPage(allValues);\n checkTestModeValue(); // Check if test mode is \n });\n\n}", "function fetchformdata() {\nlet form = document.forms[0];\nlet day, month, year, gender;\n\ngender = form.gender.value;\n\nday = parseInt(form.day.value);\nmonth = parseInt(form.month.value);\nyear = parseInt(form.year.value);\n\nreturn [gender, day, month, year];\n\n}", "function getInpData() {\n return document.querySelector('input[placeholder=\"Add New Part\"]').value;\n}", "function getFormValues() { \n\t\tvar firstname = document.getElementById(\"form1\").fname.value;\n\t\tvar lastname = document.getElementById(\"form1\").lname.value;\n\t\tconsole.log(firstname + \" \" + lastname);\n\t}", "userRegistration() {\n let regUserName = document.querySelector(\"#regUserName\").value;\n let regEmail = document.querySelector(\"#regEmail\").value;\n let regPassword = document.querySelector(\"#regPassword\").value; // let regConfirmPassword = document.querySelector(\"#regUserName\").value\n\n _nomadData.default.connectToData({\n \"dataSet\": \"users\",\n \"fetchType\": \"POST\",\n \"dataBaseObject\": {\n \"userName\": regUserName,\n \"email\": regEmail,\n \"password\": regPassword\n }\n }).then(_nomadData.default.connectToData({\n \"dataSet\": \"users\",\n \"fetchType\": \"GET\",\n \"embedItem\": `?userName=${regUserName}`\n }).then(user => {\n console.log(user);\n user.forEach(x => {\n sessionStorage.setItem(\"userId\", x.id); //hides NOMAD heading\n\n $(\".t-border\").hide(); //hides the form\n\n $(\".form\").hide(); //displays navigatin bar\n\n _dashboard.default.createNavBar();\n\n let userId = sessionStorage.getItem(\"userId\"); //console.log verifying that credentials match and user is logged in\n\n console.log(\"logged in as\" + \" \" + x.userName);\n console.log(\"your user ID is: \" + userId);\n });\n }));\n }", "function getDataForCustomHtmlForm()\n{\n var sets = getHtmlFormSettings_();\n var data = {\n values: getDatatForHtmpFormSelect_(),\n header: sets.listName,\n listHeight: sets.listHeight\n }\n return data; \n}", "request_funds() {\n const fundForm = document.querySelector(\"#fund-form\");\n fundForm.addEventListener(\"submit\", function (e) {\n e.preventDefault();\n\n // get fund request form info\n const userName = fundForm[\"user-name\"].value;\n const userEmail = fundForm[\"user-email\"].value;\n const fundPurpose = fundForm[\"fund-purpose\"].value;\n const fundRequested = fundForm[\"fund-requested\"].value;\n //const fundBreakdown =\n });\n }", "function logData(){\n\tvar email = document.forms[\"newsletter\"][\"email\"].value;\n\tvar interest = document.forms[\"newsletter\"][\"interests\"].value;\n\tconsole.log(email,interest);\n}", "function setInfo() {\n var name = document.querySelector(\"#name_form_student\");\n name.value = local_user.name;\n var account_number = document.querySelector(\"#no_cuenta_form_student\");\n account_number.value = local_user.num_account;\n var career = document.querySelector(\"#carrer_form_student\");\n career.value = local_user.career;\n var email = document.querySelector(\"#email_form_student\");\n email.value = local_user.email;\n var semester = document.querySelector(\"#semester_form_student\");\n semester.value = local_user.semester;\n\n}", "function getValueofInput () {\n\tif (username) {\n\tconsole.log(username.value);\n\t}\n}", "function enterPersonalDetails() {\n // common.setHiddenButton(\"firstTime\", true)\n // personalInfo().presentForm;\n console.log(\"before Getfirsttime: \" + common.getFirstTime());\n common.setFirstTime(false);\n console.log(\"after Getfirsttime: \" + common.getFirstTime());\n console.log(\"before firstTIme hiddenbutton: \"+ common.hiddenButton.firstTime);\n common.setHiddenButton(\"firstTime\", true);\n console.log(\"after firstTIme hiddenbutton: \"+ common.hiddenButton.firstTime);\n personalDetails().startForm();\n }", "function readValuesFromPage() {\n\n var applicationConfig = {\n public: {},\n private: {}\n }\n\n var allInputs = document.querySelectorAll('input, select, textarea');\n\n for (let i = 0; i < allInputs.length; i++) {\n var fieldVisibility = allInputs[i].dataset.visibility;\n\n if (fieldVisibility !== undefined) {\n if (allInputs[i].tagName == \"INPUT\") {\n\n if (allInputs[i].type == 'checkbox' || allInputs[i].type == 'radio') {\n applicationConfig[fieldVisibility][allInputs[i].dataset.name] = String(allInputs[i].checked);\n }\n if (allInputs[i].type == 'text' || allInputs[i].type == 'number' || allInputs[i].type == 'date') {\n applicationConfig[fieldVisibility][allInputs[i].dataset.name] = allInputs[i].value;\n }\n }\n if (allInputs[i].tagName == \"SELECT\" || allInputs[i].tagName == \"TEXTAREA\") {\n applicationConfig[fieldVisibility][allInputs[i].dataset.name] = allInputs[i].value;\n }\n }\n }\n\n applicationConfig.public = JSON.stringify(applicationConfig.public);\n\n return applicationConfig;\n}", "function getRequisitionDetails(){\r\n\tparent.document.searchResultsForm.action = parent.requisitionActionURL;\r\n\tparent.document.searchResultsForm.processorName.value = 'OrderProcessor';\r\n\tparent.document.searchResultsForm.processorAction.value = 'searchRequisition';\r\n\tparent.document.searchResultsForm.isOrderSumPage.value = 'true';\r\n\tif(status ==\"Not Received\" && tubeExpCount == 0){\r\n\t\tparent.document.searchResultsForm.loadPage.value = \"reqDetailSourcePage\";\r\n\t}\r\n\telse {\r\n\t\tparent.document.searchResultsForm.loadPage.value = \"reqDetailPage\";\r\n\t}\r\n\tparent.document.searchResultsForm.reqNumber.value = requisitionVal;\r\n\tparent.document.searchResultsForm.submit();\r\n}", "function captureInput() {\n query = inputField.val();\n requestAPI();\n }", "function getValues(form) {\n processCheckbox(form);\n processSelect(form);\n processInput(form);\n processTextarea(form);\n setDateTime(helpData);\n if (helpData.kind === 'need') {\n getTime(form)\n }\n helpData.userName = $(\"#username\").val();\n return helpData;\n}", "function populateUserForm() {\n var cu = currentUser;\n enter.name.value = cu.name;\n enter.email.value = cu.email;\n enter.age.value = cu.age;\n enter.currentWeight.value = cu.currentWeight;\n enter.targetWeight.value = cu.targetWeight;\n}", "fill_the_mandatory_fields_for_registration(){\n Action.setValueInTextBox(this.lastName,\"Last Name\",faker.randomString(6));\n Action.setValueInTextBox(this.firstName,\"First Name\",faker.randomString(6));\n Action.selectDropdown(this.legalSex, \"Legal Sex\", 'Male', 'VisibleText');\n Action.setValueInTextBox(this.dob, \"DOB\", 't-20');\n Action.setValueInTextBox(this.homePhone, \"Home Phone\", faker.randomNumber(10));\n Action.setValueInTextBox(this.mobilePhone, \"Mobile Phone\", faker.randomNumber(10));\n Action.setValueInTextBox(this.patientEmail, \"Patient Email\", faker.randomMail());\n Action.selectRadioButton(this.consentToText, \"Consent To Text\", 'No');\n Action.selectDropdown(this.usualProvider, \"Usual Provider\", 'Carolan_M', 'VisibleText');\n Action.selectRadioButton(this.consentToCall, \"Consent To Call\", 'No');\n Action.selectDropdown(this.guarantorRelationship, \"Guarantor Relationship\", 'Self','VisibleText');\n }", "function fetchPreFilledFields() {\n if (!$scope.user.settings.email.email) {\n var email = $('[name=email]').val();\n if (email) {\n $scope.user.settings.email.email = Util.Formatters.email(email);\n }\n }\n if (!$scope.password) {\n var password = $('[name=password]').val();\n if (password) {\n $scope.password = password;\n }\n }\n }", "function getDataUserFromInput() {\n getDataUserMessage();\n setUserDataMediaDemo();\n}", "function prefillUserInfo() {\n fastspring.builder.recognize({\n 'email': userEmail,\n 'firstName': userFirstName,\n 'lastName': userLastName,\n 'company': userCompany\n });\n}", "function aboutForm() {\n //import data from the html form as varaibles\n var firstName = document.getElementById('first_name').value;\n var lastName = document.getElementById('last_name').value;\n var email = document.getElementById('email').value;\n var hearAbout = document.getElementById('about_choices').value;\n var message = document.getElementById('message').value;\n\n //prints each variable to the console with some text saying what each value is\n console.log(\"First Name: \" + firstName);\n console.log(\"Last Name: \" + lastName);\n console.log(\"Email: \" + email);\n console.log(\"How did you hear about us: \" + hearAbout);\n console.log(\"Message: \" + message);\n}", "function retrieveEmployeeInformation() {\n return input.value;\n}", "function getInputValues() {\n let usernameInput = document.querySelector(\".signup_form-username input\")\n .value;\n let emailInput = document.querySelector(\".signup_form-email input\").value;\n let passwordInput = document.querySelector(\".signup_form-password input\")\n .value;\n let countryInput = document.querySelector(\".signup_option_form-country\")\n .textContent;\n let ageInput = document.querySelector(\".signup_form-age input\").value;\n\n newUser.username = usernameInput;\n newUser.email = emailInput;\n newUser.password = passwordInput;\n newUser.country = countryInput;\n newUser.age = ageInput;\n\n postUser(newUser);\n}", "function getUserPreferences() {\n let formData = new FormData(document.forms[0]);\n minimumSpeed = Number(formData.get(\"MinimumSpeedSlider\"));\n maximumSpeed = Number(formData.get(\"MaximumSpeedSlider\"));\n minimumPrecision = Number(formData.get(\"MinimumPrecisionSlider\"));\n maximumPrecision = Number(formData.get(\"MaximumPrecisionSlider\"));\n teamAColor = formData.get(\"TeamAColorPicker\");\n teamBColor = formData.get(\"TeamBColorPicker\");\n }", "function value(request) {\n return document.getElementById(request).value;\n}", "function gatherFormData(){\n//the type of request the form submission is\nvar requestType = $(\".typeOfRequest.selected\").html();\n//the title of the sharepoint list item\nvar title = \"Windows Devices Group - Publishing Request (\"+requestType+\")\";\n//object containing the data to send to sharepoint\nvar itemData = {\n '__metadata': {'type': \"SP.Data.WDGIntakeFormListItem\"},\n 'RequestType1': requestType,\n 'Title': title,\n 'CurrentUser': currUser\n};\n//add all visible and valid input values to the object\n$(\"#intakeFormContainer .intakeFormSection:visible .formInput.valid\").each(function(){\n //ignore the attachements input and do not add it to the item object\n //due to how the api works, the attachemtns are sent to sharepoint AFTER the initial list item is created\n //because of this the attachemnts cannot be sent along with the rest of the data or sharepoint will throw an error\n if($(this).attr(\"data-property\")!== \"Attachments\"){\n //use the data-property attribute to set the correct property name in the itemData object\n //this property name cooresponds to which sharepoint list column the data should be added to\n //EX: data-property = Details means that input's data will be placed in the Details column on sharepoint\n itemData[$(this).attr(\"data-property\")] = $(this).val();\n }\n});\n\nreturn itemData;\n}", "function retrieve()\n{\n ajax.get('api/profile', { id: cookieGetLoggedUserID() }, function (response)\n {\n if (response !== null)\n {\n document.getElementById('firstname').value = response.split(\" \")[0];\n document.getElementById('lastname').value = response.split(\" \")[1];\n document.getElementById('git').value = response.split(\" \")[2];\n document.getElementById('fb').value = response.split(\" \")[3];\n }\n }); \n}", "function fetchUserDetails() {\n var lsUser = localStorage.getItem('wceUser');\n var user = JSON.parse(lsUser);\n\n if (isRealValue(user)){\n $('#user_event_first_name').val(user.first);\n $('#user_event_last_name').val(user.last);\n $('#user_event_user_email').val(user.email);\n }\n}", "function getUserData() {\n return customer = {\n 'fullname' : document.getElementById('firstname').value + \" \" + document.getElementById('lastname').value,\n 'addressline1' : document.getElementById('address').value,\n 'postalcode' : document.getElementById('zip').value,\n 'country' : document.getElementById('country').value\n }\n}", "function meta_input() {\n var valid = fetch_sample_names();\n\n if (valid) {\n // First, save and set the project.\n write_proj(function () {\n var target = 'cgi_request.php';\n var data = {\n id: proj_id,\n action: 'set_proj'\n };\n send_ajax_request(target, data, null, false);\n });\n\n $('#sample_names_modal').modal('hide');\n\n set_meta_input();\n\n show_meta_input();\n }\n}", "function getUserDetails(){\n var userId = document.getElementById(\"userViewSelect\").value;\n\n var method = \"GET\";\n var url = baseURL + \"User/\" + userId;\n var httpRequest = createHttpRequest(method, url);\n\n httpRequest.onreadystatechange = function(){\n if (httpRequest.readyState == 4 && httpRequest.status == 200) {\n var httpResponse = JSON.parse(httpRequest.response);\n var userForm = document.getElementById(\"admin-view-user\");\n\n // Fill User form with data\n for(var key in httpResponse){\n if(key==\"project\"){\n if(httpResponse[key].length > 0){\n userForm.projectName.value = \"\"; // Initialize\n for(var subkey in httpResponse[key]){\n if(subkey==0){\n userForm.projectName.value = httpResponse[key][subkey].projectName;\n } else {\n userForm.projectName.value = userForm.projectName.value + \", \" + httpResponse[key][subkey].projectName;\n }\n }\n } else {\n userForm.projectName.value = \"Free Resource\";\n }\n }\n //Ignore any other invalid key\n if(typeof userForm[key] === 'undefined' || !userForm[key]){\n continue;\n }\n // Assign all other values\n userForm[key].value = httpResponse[key];\n // Special case for Date\n if(key==\"dob\"){\n var dob = new Date(httpResponse[key]);\n userForm[key].value = ((dob.getFullYear())+ \"-\" + (dob.getMonth() + 1) + \"-\" + (dob.getDate()));\n }\n // Special case for Radio buttons\n if((key==\"isAdmin\") || (key==\"isManager\") || (key==\"isEnabled\")){\n if(httpResponse[key] == true){\n userForm[key][0].checked = true;\n } else {\n userForm[key][1].checked = true;\n }\n }\n }\n\n }\n }\n\n httpRequest.onerror = onError;\n sendHttpRequest(httpRequest, method, url, \"application/json\", null);\n}", "function getFormValues() {\n let emailV = $('#email').val();\n let firstNameV = $('#firstName').val();\n let lastNameV = $('#lastName').val();\n let textAreaV = $('#taMessage').val();\n setUsersData(emailV, firstNameV, lastNameV, textAreaV);\n}", "function prefill_form(){\ndocument.getElementById(\"ref\").value = localStorage.job1Ref;\ndocument.getElementById(\"jobtitle\").value = localStorage.joblTitles;\n//alert(localStorage.job1Ref);\n}", "_submitHandler(event) {\n event.preventDefault();\n const userData = this._getUserInput();\n if (!userData) {\n return this;\n }\n // Destructure the data\n const [title, desc, people] = userData;\n console.log(title, desc, people);\n this._clearInputs();\n return this;\n }", "function getInputValues() {\n\tfligherName = document.getElementById('name').value;\n\tconsole.log(fligherName);\n\tfligherEmail = document.getElementById('email').value;\n\tconsole.log(fligherEmail);\n\tairlineValue = document.getElementById('airline').value;\n\tconsole.log(airline);\n\tdestinationValue = document.getElementById('destination').value;\n\tconsole.log(destination);\n}", "function getFormVariables() {\n return [$(\"#art_name\").val(),\n $(\"#id_field\").val(),\n $(\"#birthyear\").val(),\n $(\"#img_url\").val()\n ]\n}", "function getWebformSubmission() {\n // auth = 'Basic' + new Buffer(\"admin:swladmin\").toString('base64');\n var purl = 'https://master-7rqtwti-bzrfe2fjw7z3k.eu-2.platformsh.site/user/login?_format=json'\n var coki = request.jar();\n var options = {\n url: purl,\n json: true,\n jar: coki, // adding cookie var\n body: {\n name: 'admin',\n pass: 'swladmin'\n }\n }\n\n request.post(options, (err, resp, body) => {\n if (err) {\n console.error (\"Error authenticating\", err);\n } else {\n console.log('Login output ', JSON.stringify(resp.body, null, 2));\n console.log('Coki ', JSON.stringify(coki, null, 2));\n var webfrm_url = 'https://master-7rqtwti-bzrfe2fjw7z3k.eu-2.platformsh.site/webform_rest/swl_create_service/submission/1?_format=json';\n var options_webfrm = {\n url: webfrm_url,\n headers: [{\n 'X-CSRF-Token': resp.body.csrf_token,\n 'cache-control': 'no-cache'\n }],\n json: true,\n jar: coki\n };\n request.get(options_webfrm, (err, resp, body) => {\n console.log('Form data ', JSON.stringify(resp.body, null, 2));\n });\n }\n });\n}", "function quest5(RequestStore, SessionID, callback) {\n RequestStore.post(\n {\n url:'https://store.steampowered.com/holidayquests/ajaxclaimitem/', \n form: { sessionid: SessionID, type: 1 }\n }, function (error, response, body){\n var data = JSON.parse(body);\n if(data.success){\n callback();\n }else{\n console.log('error getting free token');\n callback();\n }\n })\n}", "function getInputAuthor() {\n return document.querySelector('input[name=\"author\"]').value;\n}", "function Ready(){\n fname = document.getElementById('fname').value;\n lname = document.getElementById('lname').value;\n username = document.getElementById('username').value;\n pwd = document.getElementById('pwd').value;\n email = document.getElementById('email').value;\n phone = document.getElementById('phone').value;\n }", "function retrieveSubmittedAnswer() {\r\n\tuserAnswer = document.getElementById(\"userAnswer\").value;\r\n\treturn userAnswer;\r\n}", "function getFormValues() {\n\t\t// function to send first and last names\n\t\t// to an 'alert' message.\n\t\t\n\t\tvar fname= document.getElementById('fname').value;\n\t\tvar lname= document.getElementById('lname').value;\n\t\talert(\"First name: \" +fname+\" \"+\"Last name: \"+lname);\n\t\t \n\t}", "get form() {\n return this.internals.form;\n }", "get form() {\n return this.internals.form;\n }", "get form() {\n return this.internals.form;\n }", "_getUserInput() {\n // Validate the data\n const validationErrors = this._validate([\n { inputEl: this.elements.titleInput, required: true, minLength: 3, maxLength: 20 },\n { inputEl: this.elements.descriptionInput, required: true, minLength: 10, maxLength: 255 },\n { inputEl: this.elements.peopleInput, required: true, min: 1, max: 10 },\n ]);\n if (validationErrors.length > 0) {\n alert(`Invalid data: ${validationErrors.join(', ')}`);\n return;\n }\n return [\n this.elements.titleInput.value,\n this.elements.descriptionInput.value,\n +this.elements.peopleInput.value\n ];\n }", "populateForm() {\n let bodyData = {'email': localStorage.getItem('useremail') };\n let fetchData = {\n method: 'POST',\n body: JSON.stringify(bodyData),\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer ' + localStorage.getItem('token')\n }\n };\n return this.fetch(process.env.BackendUrl + '/user/', fetchData)\n .then((response) => response.json())\n .then((data) => {\n console.log('did I get a user or not?');\n console.log(data[0]);\n if (data[0] !== undefined) {\n document.getElementsByClassName('uprofFirstName')[0].value = data[0].first_name;\n document.getElementsByClassName('uprofLastName')[0].value = data[0].last_name;\n document.getElementsByClassName('uprofAff')[0].value = data[0].affiliation;\n document.getElementsByClassName('uprofOrganisms')[0].value = data[0].organisms;\n document.getElementsByClassName('uprofInterests')[0].value = data[0].interests;\n document.getElementsByClassName('uprofEmail')[0].value = data[0].email;\n this.uid = data[0]._id;\n document.getElementsByClassName('UserProfileForm')[0].style.display = 'block';\n } else {\n console.log('no user');\n document.getElementsByClassName('UserProfileForm')[0].style.display = 'none';\n window.location.href = process.env.FrontendUrl + '/';\n }\n });\n }", "requestToken(whose) {\n return irma\n .newPopup({\n session: {\n url: this.url,\n start: {\n url: (o) => `${o.url}/v1/request`,\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n attribute: {\n type: \"pbdf.sidn-pbdf.email.email\",\n value: whose,\n },\n }),\n },\n mapping: {\n sessionPtr: (r) => JSON.parse(r.qr),\n sessionToken: (r) => r.token,\n },\n result: false,\n },\n })\n .start()\n .then((map) => map.sessionToken);\n }", "function submitinvForm() {\n\t\t// var to reference Firebase db/PartList/~\n\t\tvar partRef = firebase.database().ref().child(\"PartList\");\n\n\t\t// Form push - Needs to pull current values and add inv submitted to them.\n\t\t\n\t}", "function submit() {\n saveForm(applicant)\n}", "function fetchStorage() {\n txtFName.value = localStorage.getItem(\"input-name\");\n txtLName.value = localStorage.getItem(\"input-lastname\");\n txtPhone.value = localStorage.getItem(\"input-phone\");\n txtEmail.value = localStorage.getItem(\"input-email\");\n }", "get form() {\n return this.internals_.form;\n }", "function interactiveSignIn() {\r\n }", "get form() {\n return this.internals_.form;\n }", "function getCodeFromUserInput() {\n return document.getElementById('verification-code').value;\n }", "getHouseNameFormData() {\n let newHouseName = document.getElementById('houseName').value;\n return newHouseName;\n }", "function storeFormData() {\n const formData = {\n name: formEl.name.value,\n phone: formEl.phone.value,\n email: formEl.email.value,\n url: formEl.website.value,\n password: formEl.password.value\n }\n\n console.log(formData);\n}", "getQuizTitle() {\n return document.getElementById('quiz_title').value;\n }", "function retrieveDataFromStorage() {\n var id, elm;\n\n // If HTML5 Storage is supported\n if (localStorage !== 'undefined' || sessionStorage !== 'undefined') {\n\n // If we got something stored in sessionStorage\n if (sessionStorage.formData) {\n formDataObj = JSON.parse(sessionStorage.getItem('formData'));\n updateFormElemWithStorage(formDataObj, elm);\n // If we got something stored in localStorage\n } else if (localStorage.formData) {\n formDataObj = JSON.parse(localStorage.getItem('formData'));\n updateFormElemWithStorage(formDataObj, elm);\n }\n }\n }", "meta(form_data, success_callback, failure_callback) {\n let url = \"/global/str/order/meta\";\n return WebClient.basicGet(form_data, url, success_callback, failure_callback);\n }", "function getUserNameValue() {\n return document.querySelector(\"#user-name\").value;\n}", "function fetchSelf() {\n client.user.fetchSelfInfo()\n console.log('fetched self -----', document.getElementById('userEmail').value);\n}", "populateForm() {\n document.getElementsByClassName('UserProfileForm')[0].style.display = 'block';\n const bodyData = { email: localStorage.getItem('userEmail') };\n const fetchData = {\n method: 'POST',\n body: JSON.stringify(bodyData),\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${localStorage.getItem('ndssl_id_token')}`\n }\n };\n return this.fetch(`${process.env.BackendUrl}/user/`, fetchData)\n .then(response => response.json())\n .then((data) => {\n this.fillInFields(data);\n }).catch((err) => {\n console.log(err);\n });\n }", "function readUserInput() {\n\tvar settings = {};\n\t//Plasmid Section\n\tsettings.plasmidname = readtxtField(\"txtPlasmidName\");\n\tsettings.plasmidnameon = readField(\"bolShowPlasmidName\");\n\tsettings.plasmidsize = readField(\"txtPlasmidSize\");\n\tsettings.plasmidsizeon = readField(\"bolShowPlasmidSize\");\n\tsettings.plasmidradius = readField(\"txtRadius\");\n\tsettings.bbwidth = readField(\"txtBackBoneWidth\");\n\tsettings.bbcolor = readField(\"optBackBoneColor\");\n\tsettings.bbon = readField(\"bolShowBackBone\");\n\t//Feature Section (General)\n\tsettings.fwidth = readField(\"txtFeatureWidth\");\n\tsettings.fstrokewidth = readField(\"txtFeatureStrokeWidth\");\n\tsettings.fstrokered = readField(\"txtStrokeRed\");\n\tsettings.fstrokegreen = readField(\"txtStrokeGreen\");\n\tsettings.fstrokeblue = readField(\"txtStrokeBlue\");\n\tsettings.farrowlength = readField(\"txtArrowHeadLength\");\n\tsettings.farrowwidth = readField(\"txtArrowHeadWidth\");\n\t//Text section\n\tsettings.txton = readField(\"bolShowText\");\n\tsettings.txtfamily = readField(\"optFontFamily\");\n\tsettings.txtsize = readField(\"txtFontSize\");\n\tsettings.txtcolor = readField(\"optFontColor\");\n\tsettings.txtbold = readField(\"bolTextBold\");\n\tsettings.txtloc = readField(\"optTextLocation\");\n\t//Canvas section\n\tsettings.cw = readField(\"txtCanvasWidth\");\n\tsettings.ch = readField(\"txtCanvasHeight\");\n\tsettings.error = 0;\n\tsettings.errmsg = \"\";\n\t//Calculated properties\n\tsettings.ox = settings.cw / 2;\n\tsettings.oy = settings.ch / 2;\n\tsettings.ri = settings.plasmidradius - settings.fwidth / 2;\n\tsettings.ro = settings.plasmidradius + settings.fwidth / 2;\n\tsettings.rim = settings.plasmidradius - settings.fwidth / 2 - settings.farrowwidth;\n\tsettings.rom = settings.plasmidradius + settings.fwidth / 2 + settings.farrowwidth;\n\treturn settings;\n}", "function step1() {\n\tpage.open('https://www.designernews.co/users/new', function() {\n\t\t// after the page fully loaded\n\t\topenPromise.then(function() {\n\t\t\tconsole.log('dom loaded on the reg form..');\n\t\t\t// fill in the form elements, than submit the form\n\t\t\tpage.evaluate(function(args) {\n\t\t\t\tdocument.querySelector('#user_email').value = args.username + '@mailinator.com';\n\t\t\t\tdocument.querySelector('#user_password').value = args.password;\n\t\t\t\tdocument.querySelector('#user_first_name').value = args.first_name;\n\t\t\t\tdocument.querySelector('#user_last_name').value = args.last_name;\n\t\t\t\tdocument.querySelector('#user_job').value = args.job_title + ' @ ' + args.company;\n\t\t\t\tdocument.querySelector('#user_receive_digest').click();\n\t\t\t\tdocument.querySelector('#new_user > input.create-account-button.yellow').click();\n\t\t\t}, args);\n\t\t});\n\t});\n}", "getUserInput() {\n return null;\n }", "function getLoginInputValues(){\n return { \n username: document.querySelector('.user-input').value,\n password: document.querySelector('.user-password').value\n }\n }", "function getUserInput() {\n return inquirer.prompt([\n {\n type: \"input\",\n name: \"name\",\n message: \"Your name:\"\n },\n {\n type: \"input\",\n name: \"githubUsername\",\n message: \"Your GitHub username:\"\n },\n {\n type: \"input\",\n name: \"githubURL\",\n message: \"Your GitHub profile url:\"\n },\n {\n type: \"input\",\n name: \"email\",\n message: \"Your email address:\"\n },\n {\n type: \"input\",\n name: \"title\",\n message: \"Project title:\"\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project description:\"\n },\n {\n type: \"input\",\n name: \"installation\",\n message: \"Project installation information:\"\n },\n {\n type: \"input\",\n name: \"usage\",\n message: \"Project usage information:\"\n },\n {\n type: \"list\",\n name: \"license\",\n message: \"Project license:\",\n choices: [\"MIT\", \"GNU_GPLv3\", \"Apache\", \"BSD_3clause\", \"ISC\", \"Artistic\", \"GNU_LGPLv3\", \"Unlicense\"]\n },\n {\n type: \"input\",\n name: \"contributing\",\n message: \"Information about contributing to this project:\"\n },\n {\n type: \"input\",\n name: \"tests\",\n message: \"Information about testing for this project:\"\n }\n ]);\n}", "getValues() {\n return {\n description: Form.description.value, \n amount: Form.amount.value,\n date: Form.date.value\n }\n }", "function getUserInput() {\n\tvar inputData = \"\";\n\tinputData += \"&uName=\" + document.getElementById(\"tUName\").value + \"&pass=\" + document.getElementById(\"tPass\").value;\n\treturn inputData;\n}", "function valSubmitted() {\n myName = document.querySelector('.input--user__name').value;\n if(myName) {\n updateLocalStorage();\n removeRegistrationOption();\n enableBtn();\n }\n }", "function submitOTP(){\n\n\tif(isValid()){\n\t\tvar OTP = document.getElementById(\"OTP\").value;\n\n\t\tvar body = {\n\t\t\t\"OTP\" : OTP\n\t\t};\n\t\tvar params = {};\n \t\tvar additionalParams = {};\n\n \t\tapigClient.wP2visitorPost(params, body, additionalParams)\n\t \t\t.then(function(result){\n\t \t\tconsole.log(result);\n\t \t\tlet returnMessage = result.data;\n\t \t\talert(returnMessage);\n\t \t}).catch( function(result){\n\t \t\tconsole.log(result);\n\t });\n\t}\n}", "function copyStorageToForm() {\n \"use strict\";\n // Set chosen hair type\n setFormHairType(sessionStorage.getItem(\"hair_type\"));\n\n // Set selected traits\n setFormTraits(sessionStorage.getItem(\"traits\"));\n}", "function get_matter_data(){\n var data = {};\n $('#open-form').serializeArray().map(function(x){\n data[x.name] = x.value;\n });\n setTimeout(function() {\n print_matter(data);\n }, 400);\n }", "getValues() {\n return {\n description: Form.description.value,\n amount: Form.amount.value,\n date: Form.date.value\n }\n }", "get principalInput() {\n return this._principal;\n }", "function getInputValue() {\n let question = $('textarea[name=\"mcq_question\"]');\n let optionA = $('input[name=\"optionA\"]');\n let optionB = $('input[name=\"optionB\"]');\n let optionC = $('input[name=\"optionC\"]');\n let optionD = $('input[name=\"optionD\"]');\n let solution = $('textarea[name=\"mcq_solution\"]');\n\n let answerchoice = $('input:radio[name=\"answerchoice\"]');\n\n let singleradio = $('input:radio[name=\"single-answer\"]:checked');\n let singleval = singleradio.val();\n let mcq = {\n ques: question.val(),\n options: [optionA.val(), optionB.val(), optionC.val(), optionD.val()],\n solution: solution.val(),\n level: _levelID,\n typeId: _typeId,\n correct: singleval\n };\n return mcq;\n}", "function getFormValues(){\n var form = document.getElementById (\"the_form\");\n var todo = form.elements.task.value;\n return {task: todo}; \n}", "getInput(_htmlId){\n let userInput = document.getElementById(_htmlId).value;\n return userInput;\n }", "get input_income(){\n return this.userApiValue('input_income');\n }", "function userInfo() {\n let userInput1 = document.getElementById(\"input-Prenom\").value;\n let userInput2 = document.getElementById(\"input-Nom\").value;\n let userInput3 = document.getElementById(\"input-email\").value;\n userQuery(userInput1, userInput2, userInput3);\n}", "function collectMealInfo()\n {\n alert(\"I'm heree\");\n //Getting all the data from the input fields and upload button\n console.log(\"Collect Meal Info under construction...\");\n //Array.from(document.querySelectorAll('#form-content input mealimage')).reduce((acc, input) => ({ ...acc, [input.id]: input.value}), {});\n\n }", "function showUserForm() {\n try {\n var user = JSON.parse(localStorage.getItem(\"user\"));\n } catch(e) {\n if (window.navigator.vendor === \"Google Inc.\") {\n if (e === DOMException.QUOTA_EXCEEDED_ERR) {\n alert(\"Error: Saving to local storage\");\n }\n } else if (e === QUOTA_EXCEEDED_ERR) {\n alert(\"Error: Saving to local storage.\");\n }\n \n console.log(e);\n }\n \n if(user != null) {\n $(\"#FirstName\").val(user.FirstName);\n $(\"#LastName\").val(user.LastName);\n $(\"#DOB\").val(user.DOB);\n $(\"#changePassword\").val(user.NewPassword);\n $(\"#height\").val(user.Height);\n $(\"#weight\").val(user.Weight);\n }\n }" ]
[ "0.5989421", "0.5983287", "0.5950469", "0.5925524", "0.58773524", "0.5843522", "0.5782031", "0.5744509", "0.57331765", "0.56285876", "0.5588915", "0.5582396", "0.555861", "0.5549467", "0.5530008", "0.55252934", "0.5504572", "0.5491119", "0.54569095", "0.54476523", "0.5426303", "0.54114974", "0.5390539", "0.53899294", "0.5381698", "0.53816205", "0.53635085", "0.5361828", "0.53614944", "0.5360628", "0.5352259", "0.5350161", "0.5348453", "0.534135", "0.5340728", "0.533816", "0.53223455", "0.5294941", "0.52941924", "0.5273984", "0.5273869", "0.5268134", "0.52592427", "0.52554774", "0.5255015", "0.5234323", "0.52295315", "0.5224145", "0.52229434", "0.5214626", "0.5197207", "0.5197057", "0.5195805", "0.51953876", "0.5187627", "0.518199", "0.51816267", "0.51804894", "0.5180079", "0.51795447", "0.5178113", "0.5178113", "0.5178113", "0.5176686", "0.51729184", "0.51715106", "0.51706934", "0.5162513", "0.5161711", "0.5153314", "0.5151813", "0.515006", "0.514483", "0.5143799", "0.51436675", "0.51417", "0.5139095", "0.51383483", "0.5133981", "0.5126853", "0.512222", "0.5115523", "0.5109612", "0.5109139", "0.51061565", "0.51005423", "0.5100341", "0.5092301", "0.50820524", "0.5079494", "0.5077969", "0.5075864", "0.507444", "0.50733113", "0.50728416", "0.50713104", "0.5066703", "0.5060699", "0.50603825", "0.5056985", "0.50556177" ]
0.0
-1
Pass the data required and let content.js handle how to input data and if rows need to be added or subtracted since it has access to the actual number of rows in the site DOM. Will also need to pass saved cpt info.
function fillFormHandler(siteObj, tabId) { var claimObj = getUserInput(siteObj); chrome.tabs.sendMessage( tabId, { message: "fillForm", siteObj: JSON.stringify(siteObj), claimObj: JSON.stringify(claimObj), }, function (response) { ResponseHandler(response); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadContent() {\r\n var contentsStored = localStorage.getItem('contents');\r\n if (contentsStored) {\r\n contents = JSON.parse(contentsStored);\r\n $.each(contents, function (index, content) {\r\n var row = $('<tr>');\r\n var html = '<td>' + content.invoicedate + '</td>' +\r\n '<td>' + content.itemid + '</td>' +\r\n '<td>' + content.itemname + '</td>' +\r\n '<td>' + content.itemdesc + '</td>' +\r\n '<td>' + content.itemquantity + '</td>' +\r\n '<td>' + content.ItemUnitPrice + '</td>' +\r\n '<td>' + content.ItemCost + '</td>' +\r\n\r\n '<td><a class=\"delete\" href=\"#\">delete</a></td>';\r\n\r\n row.data().contentId = content.id;\r\n\r\n row.append(html);\r\n $(mainElement).find('table tbody').append(row);\r\n\r\n Subtotal = Subtotal + (content.itemquantity * content.ItemUnitPrice);\r\n Shipping = .085 * Subtotal;\r\n Tax = .11 * Subtotal + Shipping;\r\n Total = Subtotal + Shipping + Tax;\r\n });\r\n\r\n loadtotal();\r\n }\r\n }", "function saveContentEdit(_data){\n var docu = new DOMParser().parseFromString('<content></content>', \"application/xml\")\n var newCDATA=docu.createCDATASection(_data);\n $(data).find(\"page\").eq(currentPage).find(\"content\").first().empty();\n $(data).find(\"page\").eq(currentPage).find(\"content\").first().append(newCDATA);\n sendUpdateWithRefresh();\n }", "function saveContentEdit(_data){\n var docu = new DOMParser().parseFromString('<content></content>', \"application/xml\")\n var newCDATA = docu.createCDATASection(_data);\n $(data).find(\"page\").eq(currentPage).find(\"content\").first().empty();\n $(data).find(\"page\").eq(currentPage).find(\"content\").first().append(newCDATA);\n sendUpdate();\n }", "function saveContentEdit(_data){\n var docu = new DOMParser().parseFromString('<content></content>', \"application/xml\")\n var newCDATA=docu.createCDATASection(_data);\n $(data).find(\"page\").eq(currentPage).children(\"branch\").eq(currentBranch).find(\"content\").first().empty();\n $(data).find(\"page\").eq(currentPage).children(\"branch\").eq(currentBranch).find(\"content\").first().append(newCDATA);\n sendUpdate();\n }", "function AddPRContent(row) {\n console.log($(\"#row\").val());\n var str = '-';\n var moldNum='';\n var _selPartModal = Number($('#_selPartModal').val());\n switch (_selPartModal) {\n case 1:\n moldNum = $('#MoldNum').val();\n break;\n case 2:\n moldNum = $('#HCClass').val();\n break;\n case 5:\n moldNum = $('#BKClass').val();\n break;\n }\n var prcID = $(\"#PRContentID\").val();\n if ( row == 0) {//$(\"#PRContentID\").val() == 0 ||\n var _tempID = Number($(\"#tempID\").val()) - 1;\n $(\"#tempID\").val(_tempID);\n data = {\n ID: 0,\n Name: $(\"#Name\").val(),\n Quantity: $(\"#Quantity\").val(),\n PartNumber: moldNum + str + $(\"#JobNo\").val(),\n Material: $(\"#MaterialID option:selected\").text().trim(),\n Hardness: $(\"#HardnessID option:selected\").text(),\n Specification: $(\"#Specification\").val(),\n BrandName: $(\"#Brand option:selected\").text() == \"-\" ? \"\" : $(\"#Brand option:selected\").text(),\n //SupplierName: $(\"#AvailableSuppliers option:selected\").text() == \"-\" ? \"\" : $(\"#AvailableSuppliers option:selected\").text(),\n SupplierName: $('#AvailableSuppliers').val(),\n Memo: $(\"#Memo\").val(),\n State: $(\"#State\").val(),\n RequireTime: $(\"#RequireDate\").val(),\n MoldNumber: moldNum,\n JobNo: $(\"#JobNo\").val(),\n PlanQty: $('#PlanQty').val(),\n PartID: $('#PartID').val(),\n };\n $(\"#PRContentGrid\").addRowData(_tempID, data, 0, 0);\n } else {\n var _rowno = $(\"#row\").val();\n var Material=$(\"#MaterialID option:selected\").text() == \"-\" ? \" \" : $(\"#MaterialID option:selected\").text();\n var Hardness=$(\"#HardnessID option:selected\").text() == \"-\" ? \" \" : $(\"#HardnessID option:selected\").text();\n var BrandName = $(\"#Brand option:selected\").text() == \"-\" ? \" \" : $(\"#Brand option:selected\").text();\n var SupplierName = $('#AvailableSuppliers').val();\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'Name', $(\"#Name\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'Quantity', $(\"#Quantity\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'Specification', $(\"#Specification\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'Material', Material);\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'Hardness', Hardness);\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'BrandName', BrandName);\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'SupplierName', SupplierName);\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'Memo', $(\"#Memo\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'EstimatePrice', $(\"#EstimatePrice\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'RequireTime', $(\"#RequireDate\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'MoldNumber', moldNum);\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'State', $(\"#State\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'JobNo', $(\"#JobNo\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'PartNumber', moldNum + str + $(\"#JobNo\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'PlanQty', $(\"#PlanQty\").val());\n $(\"#PRContentGrid\").jqGrid('setCell', _rowno, 'PartID', $(\"#PartID\").val());\n }\n}", "function addData() {\n // resets all info on the page\n resetTeamPage();\n // adds in images\n addImagesToPage();\n // adds in pit data\n addPitDataToPage();\n // adds in prescout data\n if (Object.keys(prescout_data).length !== 0) {\n addPrescoutDataToPage();\n }\n // adds in stand data\n addStandDataToPage();\n // adding average/mean/max to btn-div (non match-specific)\n addOverallStatsToPage();\n // adds in notes data\n addNotesToPage();\n // view data button functionality\n addDataToViewDataButton();\n // hides sensitive info if applicable\n displaySensitiveInfo();\n}", "function populateStepDiscussion() {\n\n\t\n // Empty content string\n var tableContent = '';\n \n \n var StepID = $(this).attr('rel');\n \n //var stepJSON = '{\"CurrentStepID\":\"' + StepID + '\",\"BlaBla\": \"Bla_Bla\"}';\n var stepJSON = '{\"CurrentStepID\": \"'+StepID+'\"}';\n \n localStorage.setItem('CurrentStepID',StepID);\n localStorage.setItem('CurrentStepJSON',stepJSON);\n \n var tableContent2 = '<template><x-custom StepID=\"'+StepID+'\" hidden$=\"[[!showSelection]]\" response-data={{responseData}} ></x-custom></template>'; \n\n \n \n \n var url = '/AppEngine/questsPostsList/' + StepID;\n \n $.getJSON( url, function( data ) { \n\n // For each item in our JSON, add a table row and cells to the content string\n $.each(data, function(){\n \n // Stick our user data array into a userlist variable in the global object\n \t\tQuestsRatingTable = data;\n \ttableContent += '<div class=\"PostContainer\">';\n tableContent += '<div class=\"Owner\">' + this.User + '</div>';\n tableContent += '<div class=\"TextBaloon\">' + this.Text + '</div>';\n tableContent += '<div class=\"LikeAction\">34</div>';\n tableContent += '<div class=\"LoveAction\">64</div>';\n tableContent += '<div class=\"HateAction\">94</div>';\n tableContent += '<div class=\"PostDate\">' + this.PostDate + '</div>';\n tableContent += '</div>';\n\n }); \n \n \n // Inject the whole content string into our existing HTML table\n $('#PageParameters ').html(tableContent2);\n\n\n\n }); \n \n}", "function savecontent() {\r\n var content = serializeForm();\r\n content.id = $.now();\r\n var row = $('<tr>');\r\n var html = '<td>' + content.invoicedate + '</td>' +\r\n '<td>' + content.itemid + '</td>' +\r\n '<td>' + content.itemname + '</td>' +\r\n '<td>' + content.itemdesc + '</td>' +\r\n '<td>' + content.itemquantity + '</td>' +\r\n '<td>' + content.ItemUnitPrice + '</td>' +\r\n '<td>' + content.ItemCost + '</td>' +\r\n '<td><a class=\"delete\" href=\"#\">delete</a></td>';\r\n row.data().contentId = content.id;\r\n row.append(html);\r\n store(content);\r\n $(mainElement).find('table tbody').append(row);\r\n $(mainElement).find('form :input[name]').val('');\r\n //Reloads page after execution\r\n location.reload();\r\n }", "function allocateContent()\n{\n\tfor(item in dataModel)\n\t{\n\t\t//[tile,minerals,tileImage]\n\t\tdataModel[item] = [\"grass\",0,\"g1\"];\n\t}\n\n\t\t//add features\n\t\tloadLayouts();\n}", "function manageDataCustomer() {\n $.ajax({\n dataType: 'json',\n url: '/customer/show',\n data:{page:page}\n }).done(function(data){\n manageRow(data.data);\n });\n }", "function getData() {\n\n $(parentID).css(\"min-height\", \"120px\");\n\n var submitItems = items2Submit;\n try {\n apex.server.plugin(\n ajaxID, {\n pageItems: submitItems\n }, {\n success: function (pData) {\n prepareData(parentID, pData, noDataFoundMessage, escapeRequired, configJSON)\n },\n error: function (d) {\n console.error(d.responseText);\n },\n dataType: \"json\"\n });\n } catch (e) {\n console.error(\"Error while try to get Data from APEX\");\n console.error(e);\n }\n\n }", "function displayData(p, rows) {\n console.log(\"page no.:\"+ p);\n console.log(\"row count:\"+ rows);\n $tbody.innerHTML = '';\n\n if (parseInt(Number(p)) == p)\n {\n data = filteredData.slice((p-1)*rows, (p*rows));\n console.log(data);\n }\n else\n {\n\t alert('Please click on Previous or Next to navigate the pages.');\n console.log('Sorry!! This is not hanlded :( Need some more time.');\n return;\n }\n\n for (var i = 0; i < data.length; i++) {\n var UFOData = data[i];\n var fields = Object.keys(UFOData);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the UFOData object, create a new cell at set its inner text to be the current value\n // at the current UFOData's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOData[field];\n }\n }\n}", "function manageDataWilayah() {\n $.ajax({\n dataType: 'json',\n url: '/wilayah/show',\n data:{page:page}\n }).done(function(data){\n manageRow(data.data);\n });\n }", "function manageRow(data) {\n\tvar\trows = '';\n\tvar srno = 1 ;\n\t$.each( data, function( key, value ) {\n\t \trows = rows + '<tr>';\n\t \trows = rows + '<td>'+(((page-1)*5)+srno)+'</td>';\n\t \trows = rows + '<td>'+value.catalouge_name+'</td>';\n\t\trows = rows + '<td data-id=\"'+value.id+'\">';\n rows = rows + '<button data-toggle=\"modal\" data-target=\"#edit-item\" class=\"btn edit-item\">Edit</button> ';\n\t\trows = rows + '<button class=\"btn remove-item\">Delete</button>';\n rows = rows + '</td>';\n\t \trows = rows + '</tr>';\n\t\tsrno++ ;\n\t});\n\n\t$(\"#catalouge_table\").html(rows);\n}", "function createContent(profolio){\n\n var content = [];\n\n // MedProfolio image\n content.push({\n image: 'medprofolioLogo',\n width: 500\n });\n\n // Name of user\n content.push({\n text: profolio.name,\n margin: [0,30,0,0],\n alignment: 'center',\n fontSize: 30,\n bold: true\n });\n\n // Certifications and licenses\n content.push({\n text: 'Certifications and Licenses',\n margin: [0,50,0,0],\n alignment: 'center',\n fontSize: 22\n });\n\n // Generated on [M/D/YYYY]\n var today = new Date();\n var d = today.getDate();\n var m = today.getMonth()+1;\n var yyyy = today.getFullYear();\n today = m+'/'+d+'/'+yyyy;\n content.push({\n text: '[Generated on ' + today + ']',\n alignment: 'center',\n fontSize: 18\n });\n\n // Table of Contents that lists all of the certifications\n\n console.log(profolio.certs.length);\n var tocBody = [];\n tocBody.push([{text: 'Title', style: 'tableHeader'}, { text: 'Expiration', style: 'tableHeader'}]);\n for(var i = 0; i < profolio.certs.length; i++){\n //console.log(profolio.certs[i].attributes.title);\n //console.log(profolio.certs[i].attributes.expiration);\n var expireString = \"\";\n if(profolio.certs[i].attributes.expiration) {\n var expire = new Date(profolio.certs[i].attributes.expiration);\n expireString = (expire.getMonth() +1) + '/' + expire.getDate() + '/' + expire.getFullYear();\n }\n tocBody.push([profolio.certs[i].attributes.title, expireString]);\n }\n\n var t = {\n align: 'center',\n margin: [0,20,0,0], // [left, top, right, bottom]\n table: {\n widths: [400, 100],\n headerRows: 1,\n body: tocBody\n }\n };\n\n content.push(t);\n\n // add each certificate\n for(var i = 0; i < profolio.certs.length; i++){\n\n // Title of Certificate\n content.push({\n text: profolio.certs[i].attributes.title,\n alignment: 'center',\n fontSize: 30,\n bold: true,\n underline: true,\n pageBreak: 'before',\n margin: [0,20,0,40] // [left, top, right, bottom]\n });\n\n // Image of Certificate\n\n if(profolio.certs[i].imageData) {\n content.push({\n image: profolio.certs[i].imageData,\n width: 400,\n alignment: 'center'\n });\n } else {\n content.push({\n text: 'No picture of ' + profolio.certs[i].attributes.title + ' was uploaded',\n alignment: 'center',\n fontSize: 20,\n italic: true\n });\n }\n\n // Issued, Expires, Notes\n var issuedString = \"\";\n if(profolio.certs[i].attributes.issued) {\n var issued = new Date(profolio.certs[i].attributes.issued);\n issuedString = (issued.getMonth() + 1) + '/' + issued.getDate() + '/' + issued.getFullYear();\n }\n\n var expireString = \"\";\n if(profolio.certs[i].attributes.expiration) {\n var expire = new Date(profolio.certs[i].attributes.expiration);\n expireString = (expire.getMonth() + 1) + '/' + expire.getDate() + '/' + expire.getFullYear();\n }\n\n content.push({\n margin: [20,20,20,0],\n table: {\n widths: [40,'auto'],\n body: [\n [ { text: 'Issued', bold: true}, issuedString ],\n [ { text: 'Expires:', bold: true}, expireString],\n [ { text: 'Notes:', bold: true}, profolio.certs[i].attributes.notes]\n ]\n },\n layout: 'noBorders'\n });\n }\n\n console.log('content created');\n return content;\n }", "function populateQuestsStepList() {\n\n\n // Empty content string\n var tableContent = '';\n\n var QuestID = localStorage.getItem('CurrentQuestID');\n \n var url = '/AppEngine/questsStepList/' + QuestID;\n \n $.getJSON( url, function( data ) {\n\n // For each item in our JSON, add a table row and cells to the content string\n $.each(data, function(){\n \n // Stick our user data array into a userlist variable in the global object\n \t\tQuestsRatingTable = data;\n \n\t\t\ttableContent += '<div>'\n tableContent += '<div>' + this.StepTitle + '</div>';\n tableContent += '<div><a href=\"#\" class=\"linkdeleteStep\" rel=\"' + this._id + '\">Delete</a></div>';\n tableContent += '<div><a href=\"#\" stepidData$=\"{{' + this._id + '}}\" class=\"linkOpenStep\" rel=\"' + this._id + '\">Discussion</a></div>';\n tableContent += '<paper-button on-click=\"dataFunction\" dataFunction=\"' + this._id + '\">ID</paper-button>';\n tableContent += '</div>'\n\n }); \n \n\n\n\n \n // Inject the whole content string into our existing HTML table\n //$('#userInfo table#questsStepList tbody').html(tableContent);\n $('#steplist').html(tableContent);\n\n }); \n \n}", "function injectContent(){\n s1 = $(\"#s1 .info-block-content\");\n s2 = $(\"#s2 .info-block-content\");\n s3 = $(\"#s3 .info-block-content\");\n s4 = $(\"#s4 .info-block-content\");\n s5 = $(\"#s5 .info-block-content\");\n s6 = $(\"#s6 .info-block-content\");\n s7 = $(\"#s7 .info-block-content\");\n s8 = $(\"#s8 .info-block-content\");\n s9 = $(\"#s9 .info-block-content\");\n s10 = $(\"#s10 .info-block-content\");\n s11 = $(\"#s11 .info-block-content\");\n\n s1.find(\"h2\").text(content.s1.head);\n \n s2.find(\"h3\").text(content.s2.head);\n s2.find(\"label[for='branches']\").text(content.s2.select1.label);\n s2.find(\"label[for='sales']\").text(content.s2.select2.label);\n s2.find(\"label[for='capability']\").text(content.s2.select3.label);\n s3.find(\"h3\").text(content.s3.head);\n\n s4.find(\"> p\").text(content.s4.head);\n s4.find(\".block-1 span\").text(content.s4.block1[0]);\n s4.find(\".block-1 p\").text(content.s4.block1[1]);\n s4.find(\".block-2 span\").text(content.s4.block2[0]);\n s4.find(\".block-2 p\").text(content.s4.block2[1]);\n s4.find(\".block-3 span\").text(content.s4.block3[0]);\n s4.find(\".block-3 p\").text(content.s4.block3[1]);\n s4.find(\".block-4 span\").text(content.s4.block4[0]);\n s4.find(\".block-4 p\").text(content.s4.block4[1]);\n\n s5.find(\".disclaimer\").text(content.s5.disclaimer);\n s5.find(\"h3\").text(content.s5.head);\n\n s6.find(\".block-1 p span\").first().text(content.s6.block1[0]);\n s6.find(\".block-1 p span\").last().text(content.s6.block1[1]);\n s6.find(\".block-1 .disclaimer\").text(content.s6.disclaimer);\n s6.find(\".row1 .lbl\").text(content.s6.chart.row1[0]);\n s6.find(\".row1 .val\").text(content.s6.chart.row1[1]);\n s6.find(\".row2 .lbl\").text(content.s6.chart.row2[0]);\n s6.find(\".row2 .val\").text(content.s6.chart.row2[1]);\n s6.find(\".row3 .lbl\").text(content.s6.chart.row3[0]);\n s6.find(\".row3 .val\").text(content.s6.chart.row3[1]);\n s6.find(\".row4 .lbl\").text(content.s6.chart.row4[0]);\n s6.find(\".row4 .val\").text(content.s6.chart.row4[1]);\n s6.find(\".row5 .lbl\").text(content.s6.chart.row5[0]);\n s6.find(\".row5 .val\").text(content.s6.chart.row5[1]);\n s6.find(\".title h5\").text(content.s6.chart.head);\n s6.find(\".span330 p\").text(content.s6.block2);\n\n s7.find(\"h3\").text(content.s7.head);\n \n s8.find(\".block-1 .intro\").text(content.s8.block1.intro);\n s8.find(\".block-1 .house span\").first().text(content.s8.block1.house[0]);\n s8.find(\".block-1 .house span\").last().text(content.s8.block1.house[1]);\n s8.find(\".block-1 .key span\").first().text(content.s8.block1.key[0]);\n s8.find(\".block-1 .key span\").last().text(content.s8.block1.key[1]);\n s8.find(\".span463 p\").text(content.s8.head);\n s8.find(\".row1 .lbl\").text(content.s8.chart.row1[0]);\n s8.find(\".row1 .val\").text(content.s8.chart.row1[1]);\n s8.find(\".row2 .lbl\").text(content.s8.chart.row2[0]);\n s8.find(\".row2 .val\").text(content.s8.chart.row2[1]);\n s8.find(\".title h5\").text(content.s8.chart.title);\n\n s9.find(\"h2\").text(content.s9.head);\n \n s10.find(\"#output\").text(table[1][3][3]);\n s10.find(\".span400 p\").text(content.s10.content);\n s10.find(\"> p\").html(content.s10.link);\n \n s11.find(\".disclaimer\").eq(0).text(content.s11.disclaimer1);\n s11.find(\".npv-text\").text(content.s11.disclaimer2);\n s11.find(\"#npv-value\").text(npvVal[1][3][3]);\n s11.find(\".link-1\").eq(0).html(content.s11.link1);\n}", "function renderData(data) {\n cachedData = data;\n\t\tlet self_links;\n\t\tconsole.log(data)\n\t\t\n\t\ttry{\n\t\t\tself_links = apiUrl + data[\"_links\"]['add'].href;\n\t\t}catch(e){\n\t\t\t//getResource( getCurrentHash() );\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tvar title = getCurrentHash();\n\n if (!data) {\n $contentData.html(`\n <h4>Operation succeeded</h4>\n <p>${createLink('', 'Reload client')}</p>\n `);\n $controlsData.html('');\n return;\n }\n\t\tvar html = `<h3>${ formatTitle(title) }</h3>`;\n\t\t\n\t\thtml += `<table><thead><tr> <th>Title</th> <th>Edit</th> <th>Delete</th> </tr></thead><tbody>`;\n\t\t\n\t\thtml += createItems(data['items']);\n\t\t\n\t\thtml += `</tbody></table>`;\n\t\t\n\t\thtml += `<br /> <button class=\"add-resource btn waves-effect waves-light\" type=\"submit\" data-href=\"${ self_links }\" data-href=\"POST\" name=\"action\">Add new\n\t\t\t\t\t<i class=\"material-icons right\">add</i>\n\t\t\t\t </button>`;\n\t\t$controlsData.html(\" \");\n $controlsData.html( html );\n\t\t$formData.html(\" \");\n\n if (Object.keys(data).length === 2) {\n $contentData.html(buildCollectionTable(data));\n } else {\n $contentData.html(buildSingleTable(data));\n }\n }", "function extendContent(id, project) {\n //The rows of the table are always from 1 - elementsPerPage\n //-> making sure it's within range\n if (id >= elementsPerPage) {\n id = id % elementsPerPage;\n if (id == 0) {\n id = elementsPerPage;\n }\n }\n //adding a row which spans over the whole table\n var table = document.getElementById(\"resultTable\").getElementsByTagName('tbody')[0];\n var newRow = table.insertRow(id);\n newRow.setAttribute(\"id\", \"extended-details\");\n var projectDetails = newRow.insertCell(0);\n projectDetails.colSpan = \"8\";\n //div container for the extra details\n var detailsContainer = document.createElement(\"div\");\n detailsContainer.className = \"details-container\";\n //owner container\n var ownerContainer = document.createElement(\"div\");\n ownerContainer.className = \"owner-container\";\n var ownerHeader = document.createElement(\"div\");\n ownerHeader.className = \"owner-header\";\n ownerHeader.innerHTML = \"Project owner:\";\n var ownerImage = document.createElement(\"img\");\n ownerImage.className = \"picture\";\n ownerImage.setAttribute(\"src\", project.owner.image);\n var ownerName = document.createElement(\"div\");\n ownerName.className = \"owner-name\";\n ownerName.innerHTML = project.owner.name;\n var ownerLink = document.createElement(\"a\");\n var lineBreak = document.createElement(\"br\");\n var ownerUrl = document.createElement(\"div\");\n ownerUrl.innerHTML = project.owner.url;\n //create clickable link for project owner url\n ownerLink.setAttribute('href', project.owner.url);\n ownerLink.appendChild(ownerUrl);\n ownerLink.className = \"owner-url\";\n ownerContainer.appendChild(ownerHeader);\n ownerContainer.appendChild(ownerImage);\n ownerContainer.appendChild(ownerName);\n ownerContainer.appendChild(lineBreak);\n ownerContainer.appendChild(ownerLink);\n //contributors container\n var contributorsContainer = document.createElement(\"div\");\n contributorsContainer.className = \"contributors-container\"\n var contributorsHeader = document.createElement(\"div\");\n contributorsHeader.innerHTML = \"Amount of contributors:\";\n contributorsHeader.className = \"contributors-header\";\n var contributorsElement = document.createElement(\"div\");\n if (typeof project.amount_contributors == \"undefined\") {\n contributorsElement.innerHTML = \"0\";\n } else {\n contributorsElement.innerHTML = project.amount_contributors;\n }\n contributorsElement.className = \"contributors\";\n contributorsContainer.appendChild(contributorsHeader);\n contributorsContainer.appendChild(contributorsElement);\n //homepage container\n var homepageContainer = document.createElement(\"div\");\n homepageContainer.className = \"homepageContainer\";\n var homepageHeader = document.createElement(\"div\");\n homepageHeader.innerHTML = \"External homepage:\";\n homepageHeader.className = \"homepage-header\";\n var homepageElement;\n var externalHomepage;\n if (project.external_homepage == null) {\n externalHomepage = document.createElement(\"div\");\n externalHomepage.innerHTML = \"-\";\n } else {\n externalHomepage = document.createElement('a');\n homepageElement = document.createElement(\"div\");\n homepageElement.innerHTML = project.external_homepage;\n //create clickable link for project homepage\n externalHomepage.setAttribute('href', project.external_homepage);\n externalHomepage.appendChild(homepageElement);\n }\n externalHomepage.className = \"homepage\";\n homepageContainer.appendChild(homepageHeader);\n homepageContainer.appendChild(externalHomepage);\n //adding the children and displaying\n detailsContainer.appendChild(ownerContainer);\n detailsContainer.appendChild(contributorsContainer);\n detailsContainer.appendChild(homepageContainer);\n projectDetails.appendChild(detailsContainer);\n isLoading = 0;\n}", "function LoadReportTable(DashboardContentId, divName, data, tableType, wrapperName, isReportTable) {\n \n $('#' + divName + DashboardContentId).html(data);\n var reportTableId = tableType + DashboardContentId;\n var defaultRows = $('#hdn_' + reportTableId).attr('defaultRows');\n var defaultSortColumn = $('#hdn_' + reportTableId).attr('defaultSortColumn');\n var defaultSortOrder = $('#hdn_' + reportTableId).attr('defaultSortOrder');\n if (defaultSortOrder != 'asc')\n defaultSortOrder = 'des';\n var ShowFooterRow = $('#hdn_' + reportTableId).attr('ShowFooterRow');\n\n $('#' + reportTableId + wrapperName).css('overflow-x', 'auto');\n $('#' + reportTableId + wrapperName).css('overflow-y', 'auto');\n $('#' + reportTableId + wrapperName).css('height', '100%');\n\n if (data.indexOf(reportTableId) > -1) {\n var mygrid = dhtmlXGridFromTable(reportTableId);\n\n $('#' + reportTableId + wrapperName).find('.objbox').find('table').attr('id', reportTableId + '_tbl');\n\n var tblTotal = $(mygrid.obj).find('.totalRow').clone();\n $(mygrid.obj).find('tbody').find('.totalRow').remove();\n\n if (ShowFooterRow == 'True') {\n var foot = $(mygrid.obj).find('tfoot');\n if (!foot.length) foot = $('<tfoot>').appendTo(mygrid.obj);\n foot.append($(tblTotal));\n }\n var columnCheckCount = 0;\n if (isReportTable)\n columnCheckCount = 1;\n $('#' + reportTableId).find('.objbox').find('table').find('tr').each(function (i, row) {\n $(row).find('td').each(function (j, cell) {\n if (j > columnCheckCount) {\n try {\n var originalValue = $(cell).text();\n \n $(cell).text(ME_number_format(originalValue,2, '.', ','));\n $(cell).attr('title', (ME_number_format(originalValue,2, '.', ',')));\n $(cell).addClass('north');\n $(cell).attr('title', $(cell).attr('data-original-title'));\n $(\".north\").tooltip({\n 'container': 'body',\n 'placement': 'bottom'\n });\n } catch (e) {\n }\n\n }\n });\n });\n\n mygrid.setEditable(false);\n mygrid.enableAutoHeight(true);\n if (isReportTable)\n mygrid.setColumnHidden(1, true);\n\n $('#' + reportTableId).find('tfoot').find('.totalRow').find('td').each(function (j, cell) { if (j == 1) $(this).css('display', 'none'); });\n $('#' + reportTableId).find('tfoot').find('.goalRow').find('td').each(function (j, cell) {\n if (j == 1) {\n $(this).css('display', 'none');\n }\n else {\n if ($(cell).text() == \"0\" || $(cell).text().trim() == \"\") {\n $(this).text('');\n $(this).removeAttr('data-toggle');\n $(this).removeAttr('data-original-title');\n $(this).removeAttr('data-sort');\n }\n }\n });\n\n mygrid.enableAutoWidth(true);\n\n var count = mygrid.getColumnsNum();\n for (var j = 0; j < count; j++) {\n mygrid.adjustColumnSize(j);\n }\n \n $('#' + reportTableId).css('margin', '0 auto');\n $('#' + reportTableId).css('width', '100%');\n $('#' + reportTableId).find('.xhdr').css('width', '100%');\n $('#' + reportTableId).find('.hdr').css('width', '100%');\n\n var widthArray = [];\n $('#' + reportTableId).find('.xhdr table' + ' tr:first').find('th').each(function (key, data) {\n $('#' + reportTableId).find('.objbox table' + ' tr:first').find('th').each(function (key1, data1) {\n if (key == key1) {\n var totalWt = $(data).width();\n widthArray.push(totalWt);\n }\n });\n });\n $('#' + reportTableId).find('.objbox table' + ' tr:first').find('th').each(function (j, data1) {\n for (var i = 0; i < widthArray.length; i++) {\n if (j == i) {\n mygrid.setColWidth(j, widthArray[i]);\n }\n }\n });\n\n mygrid.attachEvent(\"onMouseOver\", function () { return false; });\n $('#' + reportTableId).find('tfoot').find('.totalRow').css('display', 'table-row');\n\n var parenttblHeight = $('#' + reportTableId).find('.objbox').find('table').height();\n var childtblHeight = $('#' + reportTableId).find('.xhdr').find('table').height();\n $('#' + reportTableId).height(parenttblHeight + childtblHeight);\n\n mygrid.attachEvent(\"onAfterSorting\", function (index, type, direction) {\n $(mygrid.obj).find('tbody').find('.totalRow').remove();\n mygrid.setSortImgState(false);\n return true;\n });\n }\n}", "function loadColumnLatestContent(data) {\n if (isEmpty(data.Data)) {\n console.log('empty data');\n return;\n }\n\n var columnContent = $('#rovat .content');\n var articles = '';\n $.each(data.Data, function (index, item) {\n articles = articles + page.renderArticle(item);\n });\n columnContent.html(articles);\n\n bindingArticleClick();\n\n // save to cache\n Storage.setItem(app.getArticlesCacheKey(), JSON.stringify(data));\n}", "function createContent(data, templateNum) {\n $(document).ready(function() {\n //iterate through templates\n for (i = 0; i < templateList.length; i++) {\n let source = $(templateList[i][0]).html();\n let template = Handlebars.compile(source);\n let html = template(data);\n //write data into template\n $(templateList[i][1]).append(html);\n }\n\n contentLoaded();\n });\n}", "function fetchDataGrid(me) {\n\n if (ClickRaised) return;\n\n EECLog('EEC fetchDataGrid() checking mandatory properties for editable table..');\n\n var table = $(me).attr('data-dbTable');\n var FieldKey = $(me).attr('data-dbFieldKey');\n var FieldKeyType = $(me).attr('data-dbFieldKeyType');\n\n\n if (isnull(table)\n || isnull(FieldKey)\n || isnull(FieldKeyType)) {\n alert('attenzione. è stata trovata la classe table-extra-editable su un oggetto table ma mancano i requisiti minimi per fare il parsing di edit su grid. Devono essere specificati gli attributi di table data-dbTable con il nome della tabella sul db, data-dbFieldKey con il nome del campo chiave e data-dbFieldKeyType int o string con il tipo di chiave');\n return;\n }\n\n var tableId = $(me).attr('id');\n if (isnull(tableId)) tableId = ' without ID (set one)';\n EECLog('EEC id=' + tableId + ', data-dbTable=' + table + ',data-dbFieldKey=' + FieldKey + ',data-dbFieldKeyType=' + FieldKeyType);\n\n\n // su fld e type vengono assegnati i valori data-dbfield e data-dbtype delle righe di intestazione (th)\n // solitamente è una sola riga, e il secondo indice 1000 sono le colonne (td)\n // un massimo di 5 righe e 1000 colonne è piu che sufficiente a gestire la maggior parte dei casi.\n // se in intestazione ci fossero piu di 6 righe aumentare il primo indice\n var fld = [];\n var type = [];\n\n var row = 0;\n var cnt = 0;\n var i = 0;\n var cols = 0;\n $('.table-extra-editable tr:visible').each(function () {\n var col = [];\n\n var row = $(this).attr('data-row');\n if (isnull(row)) row = 0;\n\t\t\n\t\tEECLog('data-row=' + row);\n\t\t\n cnt++;\n \n\t\t// columns count\n $(this).children(\"th\").each(function (idx) {\n if (idx > cols) cols = idx;\n });\n\n $(this).children(\"th\").each(function (idx) {\n \n var f = $(this).attr('data-dbfield');\n var t = $(this).attr('data-dbtype');\n i = (row * cols) + (idx + 1);\n\n fld[i] = f;\n type[i] = t;\n \n // if (cnt < 6000) console.log('TH ' + row + ',' + idx + ' , ' + i + ' = ' + f);\n\n });\n\n\t\t\n\t\t//for every cell collects all information that is going to send to ajax\n $(this).children(\"td\").each(function (idx) {\n \n // console.log('loopcells ' +row+'\\\\'+idx +'\\\\' + fld[idx] + '\\\\' + $(this).attr('id') );\n\n i = (row * cols) + (idx + 1);\n\n // if (cnt < 6) console.log(row + ',' + idx + ' , ' + i + ' = ' + fld[i] + ',value =' + $(this).text());\n\n GridData.push({\n table: table, // table name\n row: row, // row index\n idx: idx, // index col within the row \n id: $(this).attr('id'), // unique id for the grid (ensure be unique)\n field: fld[i], \t\t // field database name\n type: type[i], \t\t // data type \n fieldkey: FieldKey, // database key field name\n fieldkeytype: FieldKeyType, // key data type\n value: $(this).text() // visible value of the cell \n });\n });\n\n });\n\n}", "function loadEditEmployeeGrid() {\n myLayout.cells(\"a\").setText('EMPLOYEE ROLL | <input type=\"button\" name=\"employeeEditBtn\" value=\"Update Changes\" onclick=\"myDataProcessor.sendData();\">');\n loadPageMenu(myLayout);\n myGrid = initMyGridNew(\"get_emp_data_xml.php\");\n myDataProcessor = initMydataProcessor(\"update_emp_data.php\", 0);\n myDataProcessor.setVerificator(0, not_empty);\n myDataProcessor.setVerificator(2, not_empty);\n myDataProcessor.setVerificator(3, not_empty);\n myDataProcessor.setVerificator(4, not_empty);\n myDataProcessor.setVerificator(5, not_empty);\n myDataProcessor.setVerificator(6, disableActiveFlg);\n myDataProcessor.setVerificator(7, not_empty);\n myDataProcessor.setVerificator(8, not_empty);\n myDataProcessor.init(myGrid);\n}", "function createDataTable(data, site, pagePath){\n\n var itemsPerPage = 999999999; // No paging support yet. Change to sensible number once we implement it.\n var isLargeColumn = true;\n window.gadgets = false;\n var tableDiv = $('#perc-gadget-comments-viewComments-container');\n statusTable = $(\"<table id='perc-gadget-comments-viewComments-table' cellspacing='0'>\");\n tableDiv.append(statusTable);\n\n var percData = [];\n\n $.PercCommentsGadgetService().getArticleDescription(site, pagePath, function(article, callbackOptions){\n\n var articleDesc = $('<div />').\n append(\n $('<div />').\n attr('id', 'perc-gadget-comments-viewComments-articleSummary').\n append(\n $('<span />').\n text(\n $('<div />').\n append(article.title).\n text()\n )\n ).append(\n $('<span />').\n text(\n $('<div />').\n append(article.summary).\n text()\n )\n )\n ).append(\n $('<div />').\n attr('id', 'perc-gadget-comments-viewComments-numComments').\n text(data.length + ((data.length>1)?' comments:':' comment:'))\n );\n\n var allModeration = newRejectApproveAllActions();\n\n var row =\n {\n rowContent: [\n [\n {content: articleDesc.prop(\"outerHTML\") }\n ],\n [\n {content: allModeration.prop(\"outerHTML\") }\n ]\n ]\n };\n\n percData.push(row);\n\n $.each(data, function(){\n var commentData = this;\n var commentTitle = $('<h2 />').addClass('perc-gadget-comments-viewComments-commentTitle').text($('<div />').append(commentData.title).text());\n var commentDateRaw = $.timeago.parse(commentData.createdDate);\n var dateParts = $.perc_utils.splitDateTime(commentData.createdDate);\n\n var commentDate = $('<span />').\n addClass('perc-gadget-comments-viewComments-commentDate').\n append(\n $.timeago(\n $('<span />').\n text(commentData.createdDate).\n attr('title', commentData.createdDate))\n ).append(\n $('<span />').\n text(\n\n ', ' + dateParts.date + \", \" + dateParts.time\n )\n );\n var commentAuthor = $('<span />').addClass('perc-gadget-comments-viewComments-commentAuthor').text($('<div />').append( ( commentData.username ? commentData.username : \"Anonymous\" ) ).text() + \" said...\");\n var commentText = $('<div />').addClass('perc-gadget-comments-viewComments-commentText').text($('<div />').append(commentData.text).text());\n\n var commentAggregate = $('<div />').addClass('perc-datatable-firstrow').append(commentDate).append(commentAuthor).append(commentText);\n\n var commentId = commentData.id;\n var rejectApproveActions = newRejectApproveActions(commentData.approvalState, commentId, site);\n\n var row = {rowContent: [[ {content: commentAggregate.prop(\"outerHTML\")}], [ {content: rejectApproveActions.prop(\"outerHTML\")} ]] };\n\n percData.push(row);\n });\n\n var dataTypeCols0 = [\n { bSortable: false, sClass : \"perc-datatable-cell-string perc-gadget-comments-viewComments-comment\" },\n { bSortable: false, sClass : \"perc-datatable-cell-action perc-gadget-comments-viewComments-action\" }\n ];\n var dataTypeCols1 = [\n { bSortable: false, sClass : \"perc-datatable-cell-string perc-gadget-comments-viewComments-comment\" },\n { bSortable: false, sClass : \"perc-datatable-cell-action perc-gadget-comments-viewComments-action\" }\n ];\n var dataTypeCols = isLargeColumn?dataTypeCols1:dataTypeCols0;\n\n var tableConfig = {\n iDisplayLength : itemsPerPage,\n aoColumns: dataTypeCols,\n percHeaderClasses : [\"perc-datatable-cell-string perc-gadget-comments-viewComments-comment\", \"perc-datatable-cell-string perc-gadget-comments-viewComments-action\"],\n percHeaders : [\"<span>Title</span>\", \"<span>Action</span>\"],\n percData : percData,\n oLanguage: {\"sZeroRecords\": \"No Comments Found\", \"sInfo\" : \"Showing _START_ to _END_ of _TOTAL_ total results\", \"sInfoEmpty\" : \"No results found\"},\n percColumnWidths : [[\"82%\", \"18%\"]],\n aaSorting : [],\n singlePage: true\n };\n\n statusTable.PercDataTable(tableConfig);\n\n console.log(statusTable);\n\n statusTable.on(\"click\", 'div.perc-gadget-comments-rejectAction-all', rejectAll);\n statusTable.on(\"click\", 'div.perc-gadget-comments-approveAction-all', approveAll);\n statusTable.on(\"click\", 'div.perc-gadget-comments-deleteAction-all', deleteAll);\n\n statusTable.on(\"click\", 'div.perc-gadget-comments-rejectAction', reject);\n statusTable.on(\"click\", 'div.perc-gadget-comments-approveAction', approve);\n statusTable.on(\"click\", 'div.perc-gadget-comments-deleteAction', deleteComment);\n\n // if the last row does not fill the bottom of the dialog\n // expand the height of the last row to the bottom of the dialog\n var container = $(\"#perc-gadget-comments-viewComments-container\");\n var containerHeight = container.height();\n var lastRow = $(\"td.perc-gadget-comments-viewComments-action:last\");\n var lastRowTop = lastRow.position().top;\n var lastRowHeight = lastRow.height();\n var lastRowNewHeight = containerHeight - lastRowTop;\n if(lastRowNewHeight > lastRowHeight)\n lastRow.height(lastRowNewHeight);\n\n $(window).trigger('perc-datatable-doneLoading');\n\n updateApproveRejectAllActions();\n }, {});\n }", "function editCellData(p_ht, p_row, p_col, p_content, p_can_alter) {\n\tvar v_edit_modal = document.getElementById('div_edit_content');\n\tif (!v_edit_modal) {\n\t\tv_edit_modal = document.createElement('div');\n\t\tv_edit_modal.setAttribute('id','div_edit_content');\n\t\tv_edit_modal.setAttribute('tabindex','-1');\n\t\tv_edit_modal.setAttribute('role','dialog');\n\t\tv_edit_modal.setAttribute('aria-hidden','true');\n\t\tv_edit_modal.classList = 'modal fade';\n\n\t\tdocument.body.append(v_edit_modal);\n\t}\n\n\tv_canEditContent = p_can_alter;\n\tvar v_save_btn_attr = '';\n\tif (!v_canEditContent) {\n\t\tv_save_btn_attr = ' disabled title=\"Unable to manually edit data without primary key\" ';\n\t}\n\tv_edit_modal.innerHTML =\n\t'<div id=\"modal_message_dialog\" class=\"modal-dialog\" role=\"document\" style=\"width: 1200px;max-width: 90vw;\">' +\n\t\t'<div class=\"modal-content\">' +\n\t\t\t'<div class=\"modal-header\">' +\n\t\t\t\t'<h4 class=\"mb-0\">Edit Data</h4>' +\n\t\t\t\t'<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\" onclick=\"cancelEditContent()\">' +\n\t\t\t\t\t'<span aria-hidden=\"true\">&times;</span>' +\n\t\t\t\t'</button>' +\n\t\t\t'</div>' +\n\t\t\t'<div id=\"modal_message_content\" class=\"modal-body\" style=\"white-space: pre-line;\">' +\n\t\t\t\t'<div id=\"txt_edit_content\" style=\"width: 100%; height: 70vh; font-size: 12px; border: 1px solid rgb(195, 195, 195);\">' +\n\t\t\t\t'</div>' +\n\t\t\t'</div>' +\n\t\t\t'<div class=\"modal-footer\">' +\n\t\t\t\t'<button ' + v_save_btn_attr + ' type=\"button\" class=\"btn omnidb__theme__btn--primary\" data-dismiss=\"modal\" onclick=\"saveEditContent()\">Save</button>' +\n\t\t\t\t'<button type=\"button\" class=\"btn omnidb__theme__btn--secondary\" data-dismiss=\"modal\" onclick=\"cancelEditContent()\">Cancel</button>' +\n\t\t\t'</div>' +\n\t\t'</div>' +\n\t'</div>';\n\n\tif (v_editContentObject!=null)\n\t\tif (v_editContentObject.editor!=null) {\n\t\t\t v_editContentObject.editor.destroy();\n\t\t\t document.getElementById('txt_edit_content').innerHTML = '';\n\t\t}\n\n\tvar langTools = ace.require(\"ace/ext/language_tools\");\n\tvar v_editor = ace.edit('txt_edit_content');\n\tv_editor.setTheme(\"ace/theme/\" + v_editor_theme);\n\tv_editor.session.setMode(\"ace/mode/text\");\n\tv_editor.$blockScrolling = Infinity;\n\n\tv_editor.setFontSize(Number(v_font_size));\n\n\tv_editor.setOptions({enableBasicAutocompletion: true});\n\n\tdocument.getElementById('txt_edit_content').onclick = function() {\n \t\tv_editor.focus();\n };\n\n\tif (p_content!=null)\n\t\tv_editor.setValue(String(p_content));\n\telse\n\t\tv_editor.setValue('');\n\n\tv_editor.clearSelection();\n\n\tif (p_can_alter)\n\t\tv_editor.setReadOnly(false);\n\telse\n\t\tv_editor.setReadOnly(true);\n\n\t//Remove shortcuts from ace in order to avoid conflict with omnidb shortcuts\n\tv_editor.commands.bindKey(\"Cmd-,\", null)\n\tv_editor.commands.bindKey(\"Ctrl-,\", null)\n\tv_editor.commands.bindKey(\"Cmd-Delete\", null)\n\tv_editor.commands.bindKey(\"Ctrl-Delete\", null)\n\n\tv_editContentObject = new Object();\n\tv_editContentObject.editor = v_editor;\n\tv_editContentObject.row = p_row;\n\tv_editContentObject.col = p_col;\n\tv_editContentObject.ht = p_ht;\n\n\t$('#div_edit_content').modal({\n backdrop: 'static',\n keyboard: false\n });\n\n}", "function loadColumnContent(data) {\n $('#rovat h1').text(data.Name);\n\n // save to cache\n Storage.setItem(app.getColumnCacheKey(), JSON.stringify(data));\n}", "function render_page_content( object ){\n\n // Function that decides whether or not to show the data table row (the one with 'tabs')\n should_show_data_table();\n\n // Hide all tabs so only one is shown at a time, or else the previous tab selection will be\n // showing\n $('#photos, #contacts, #photos, #site_links, #site_information, #lter_name').hide();\n\n $('#photos, #contacts, #photos, #site_links, #site_information, #lter_name').addClass( 'focus_table_background' );\n\n // Set all tab backgrounds to nothing\n $('.hover').removeClass('focus_hilight');\n\n // Show only the 'site_information' tab\n $(\"#site_information, #lter_name\").show();\n \n $('#table_content').addClass('table_content_border');\n\n // Set 'site info' tab to the same color as the highlight. Have to use inline css styling\n // rather than adding a class because it will not work properly in IE\n $('#site_info_tab').addClass('focus_hilight');\n\n // Inserting xml data into the html (The rest of the code in this function)\n ////////////////////////////////////\n\n // Insert site name into html \n $('#site_info').find('.site_name').html( object.attr('site_name') ); \n\n // Site Info Tab. Insert href location and target into html\n $('#site_content' ).find('.home_page').attr( { href: object.attr('home_page'), target: \"_blank\" } ); \n $('#site_content' ).find('.site_profile').attr( { href: 'http://www.lternet.edu/sites/' + object.attr('site_id').toLowerCase() , target: \"_blank\" } ); \n $('#site_content').find('.description').html( object.attr('description') ); \n\n // Photos tab. Insert image and href into html\n $('#site_content' ).find('.image').attr( { src: object.attr('image') , title: object.attr('site_id') + 'image' } ); \n $('#site_content' ).find('.gallery').attr( { href: 'http://www.lternet.edu/gallery/sites/' + object.attr('site_id') , target: \"_blank\"} ); \n\n // Contacts Tab. Insert into html\n $('#site_content' ).find('.principal').html( object.attr('principal') ); \n $('#site_content' ).find('.info_manager').html( object.attr('info_manager') ); \n $('#site_content' ).find('.primary_contact').html( object.attr('primary_contact') ); \n $('#site_content' ).find('.outreach').html( object.attr('education_contact') ); \n $('#site_content' ).find('.address1').html( object.attr('address1') ); \n $('#site_content' ).find('.address2').html( object.attr('address2') ); \n $('#site_content' ).find('.address3').html( object.attr('address3') ); \n $('#site_content' ).find('.city').html( object.attr('city') ); \n $('#site_content' ).find('.state').html( object.attr('state') ); \n $('#site_content' ).find('.zip').html( object.attr('zip') ); \n $('#site_content' ).find('.phone').html( object.attr('phone') ); \n $('#site_content' ).find('.fax').html( object.attr('fax') ); \n $('#site_content' ).find('.email').html( object.attr('email') ); \n\n // Site Links tab. Insert href and target info into html\n $('#site_content' ).find('.data_url').attr( { href: object.attr('data_url') , target: \"_blank\"} ); \n $('#site_content' ).find('.personnel_url').attr( { href: object.attr('personnel_url') , target: \"_blank\"} ); \n $('#site_content' ).find('.biblio_url').attr( { href: object.attr('biblio_url') , target: \"_blank\"} ); \n $('#site_content' ).find('.education_url').attr( { href: object.attr('education_url') , target: \"_blank\"} ); \n\n\n // Show the table data for each site. This needs to be here if we closing the table data div when a\n // user closes the associated infowindow \n $('#table_content').show();\n\n }", "function displayRow(e){\n\tvar totalcredit=0;\n\tfor(i=0;i<content.length;i++){\n\t\tcreditDetailAddRow(content[i].col1,content[i].col2,content[i].col3,+content[i].col4);\n\t\tvar totalcredit = parseFloat(content[i].col3)+ parseFloat(totalcredit);\n\t\tTitanium.App.Properties.setString('totalcredit', totalcredit);//write to persistent memory\n\t\t$.notes_textarea.data = {\"totalspent\":totalspent,\"totalcredit\":totalcredit,\"creditamount\":creditamount,\"bal\":bal,\"lastcredit\":lastcredit}; \n\t\t//$.credit_window.data.totalcredit = totalcredit;\t\n\t\t$.credit_window.data = {\"totalspent\":totalspent,\"totalcredit\":totalcredit,\"creditamount\":creditamount,\"bal\":bal,\"lastcredit\":lastcredit}; \n\t}\t\n\treturn totalcredit;\n}", "function createContentForTables () {\n //each column for TABLES will have it's template\n resetTableValuesBeforeRendering();\n var content_firstColumn =\n `<div class=\"col-12 col-lg-6 col-xl-3\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">Overall Status</span>` + returnRandomBMGBadge() + `</div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">RSS Status</span>` + returnRandomBMGBadge() + `</div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">Client RSS Status</span>` + returnRandomBMGBadge() + `</div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">Sticky Client Status</span>` + returnRandomBMGBadge() + `</div></div>\n <div class=\"card\"><div class=\"card-body\">\n <div><span class=\"c-card-title\">Interference Status - Overall</span>` + returnRandomBMGBadge() + `</div>\n <div><span class=\"c-card-title\">Interference Status Co- Channel</span>` + returnRandomBMGBadge() + `</div>\n <div><span class=\"c-card-title\">Interference Status - Adjecent</span>` + returnRandomBMGBadge() + `</div>\n </div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Interference</span>\n <div class=\"row c-small-text-for-cards\">\n <div class=\"col-6\">UniFi` + returnRandomBMGBadge() + `</div>\n <div class=\"col-6\">Home` + returnRandomBMGBadge() + `</div>\n </div>\n </div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">Retransmission Status</span>` + returnRandomBMGBadge() + `\n <div class=\"c-small-text-for-cards\">HGw Number of retransmissions\n <span class=\"float-right\">` + returnRandomNumberInRange(4500, 5300) + `</span>\n </div>\n </div></div>\n <div class=\"card\"><div class=\"card-body\">\n <div class=\"c-small-text-for-cards\">Total Number of Clients\n <span class=\"float-right\">` + returnRandomNumberInRange(5, 200) + `</span>\n </div>\n <div class=\"c-small-text-for-cards\">Max. number of concurent clients\n <span class=\"float-right\">` + returnRandomNumberInRange(1, 77) + `</span>\n </div> \n </div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Combined status</span>\n <div class=\"c-small-text-for-cards\">HGw Number of clients\n <span class=\"float-right\">` + returnRandomNumberInRange(10, 35) + `</span>\n </div>\n <div class=\"c-small-text-for-cards\">HGw Number of sticky clients\n <span class=\"float-right\">` + returnRandomNumberInRange(1, 5) + `</span>\n </div>\n <div class=\"c-small-text-for-cards\">Data transfered [GB]\n <span class=\"float-right\">` + returnRandomNumberInRange(3, 35) + `</span>\n </div> \n </div></div>\n </div>`;\n var content_secondColumn =\n `<div class=\"col-12 col-lg-6 col-xl-3\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Bitrate [Mbps]</span>` + returnKpiTable('Bitrate', true) + `</div></div>\n <div class=\"card\"><div class=\"card-body\">\n <div class=\"c-small-text-for-cards\">HGW total traffic [GB]\n <span class=\"float-right\">` + returnRandomNumberInRange(1, 17) + `</span>\n </div> \n </div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw RSS</span>` + returnKpiTable('RSS [dBm]', true) + `</div></div>\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Interference network RSS</span>` + returnKpiTable('RSS [dBm]', false) + `</div></div>\n </div>`;\n var content_thirdColumn =\n `<div class=\"col-12 col-lg-6 col-xl-3 mt-1 mt-xl-0\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">WiFi connected time</span>` + returnPieChartPlaceholder(['Percent of time with connected user (s)']) + `</div></div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\">\n <span class=\"c-card-title\">HGw Channel</span>\n <div class=\"c-small-text-for-cards c-xs\">Auto channel enabled: ` + returnYesNoIcon(selectedContractData.contractHgwInfo.autoChannelEnabled) +`</div>\n <div class=\"c-small-text-for-cards c-xs\">Current channel: ` + selectedContractData.contractHgwInfo.channel +`</div>\n <div class=\"c-small-text-for-cards c-xs\">No. of changes: ` + returnRandomNumberInRange(1,99) +`</div>\n <div>` + returnPieChartPlaceholder(['Auto: Yes', 'Auto: No']) + `</div>\n </div></div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw WiFi Usage</span>` + returnPieChartPlaceholder(['Low', 'Medium', 'High']) + `</div></div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Percent of time with Sticky Clients</span>` + returnPieChartPlaceholder(['Percent of time with sticky clients']) + `</div></div>\n </div> \n </div>\n </div>`;\n var content_fourthColumn =\n `<div class=\"col-12 col-lg-6 col-xl-3\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Interference</span>` + returnPieChartPlaceholder(['Low', 'Medium', 'High']) + `</div></div>\n </div> \n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Client's RSS Status</span>` + returnPieChartPlaceholder(['Good', 'Medium', 'Bad']) + `</div></div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw Interference Home</span>` + returnPieChartPlaceholder(['Low', 'Medium', 'High']) + `</div></div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card\"><div class=\"card-body\"><span class=\"c-card-title\">HGw RSS Status</span>` + returnPieChartPlaceholder(['Good', 'Medium', 'Bad']) + `</div></div>\n </div> \n </div>\n </div>`; \n /* since we created placeholder containers (returnPieChartPlaceholder), we will start checking when those elements are added to DOM\n we want to attach PieChart graphs when those elements are added to DOM\n */\n startCheckingForAddedPiePlaceholders();\n //\n return (content_firstColumn + content_secondColumn + content_thirdColumn + content_fourthColumn);\n }", "function processContent(data, request, response) {\n // Create template object for main content\n var contentTemplate = jsonTemplate.fromString(data);\n // Now expand the content template with the data\n pageData.content = contentTemplate.expand(pageData);\n \n\n // Now read the wrapper file\n // So we can pass the content into the wrapper\n fs.readFile(\n siteDir + '/' + templateDir + '/' + wrapperFile,\n 'ascii',\n function(err, data) {\n // If no error, process wrapper\n if(err) { console.warn(err); }\n else { processWrapper(data, request, response); }\n }\n )\n}", "function initFromData(replacements) {\n // put the data into the page\n forEach(replacements, appendRow);\n // make sure we have at least one row in the table\n for (var i = table.children.length; i <= 1; i++) {\n appendEmptyRow();\n }\n}", "function prepareData(pParentID, pData, pNoDataFound, pEscapeHTML, pConfigJSON) {\n /* empty container for new stuff */\n $(pParentID).empty();\n\n if (pData.row && pData.row.length > 0) {\n\n renderHTML(pParentID, pData.row, pEscapeHTML, pConfigJSON);\n } else {\n\n $(pParentID).css(\"min-height\", \"\");\n }\n }", "function table_load(data){\n \"use strict\"\n current_data_set = data;\n create_header(data,\"edit-table-head\");\n create_body_and_modal(data,\"edit-table-head\");\n\nfunction create_header(data, table_head_id){\n if (submitted === true){\n document.getElementById(\"edit-table-head\").innerText = \"\";\n }\n var i;\n var cols=[];\n cols.push('#'); // intial column to store the record number\n for(var key in data[0]){\n if (cols.indexOf(key) === -1) {\n cols.push(key);\n // console.log(key);\n }\n }\n var table_head = document.getElementById(\"edit-table-head\")\n var tr = table_head.insertRow(-1); // TABLE ROW.\n for (i = 0; i < cols.length; i++) {\n var th = document.createElement(\"th\"); // TABLE HEADER.\n th.innerHTML = cols[i];\n tr.appendChild(th);\n }\n }\n\nfunction create_body_and_modal(data, table_body_id){\n\n if (submitted === true){\n // if the data have been submitted before, reset the table\n document.getElementById(\"edit-table-body\").innerText = \"\";\n }\n\n var i;\n var cols=[]; // columns for the table\n\n // column-headers for both main table and modal\n // the first row of the data is a dictionary with all headers\n for(var key in data[0]){\n if (cols.indexOf(key) === -1) {\n cols.push(key);\n }\n }\n\n // create the body for the main table\n var table_body = document.getElementById(\"edit-table-body\");\n\n // for the modal table\n var div_form = document.createElement(\"div\");\n var button_modal_submit = document.getElementById(\"button_modal_submit\");\n var record_num = document.getElementById(\"record_num\");\n var input, label, form_group;\n\n for (i = 0; i < data.length; i++) {\n var tr = table_body.insertRow(-1); // create a row on the main table\n\n var div_step = document.createElement(\"div\"); // for each row create a div_step for the modal\n div_step.id = \"modal-step-\" + (parseInt(i));\n div_step.className = \"modal-step\";\n\n // add the first column for the record number\n var td = document.createElement(\"td\");\n td.innerHTML = i;\n td.id = \"id-col-#-\" + parseInt(i);\n tr.appendChild(td);\n\n for (key in data[i]) {\n if (cols.indexOf(key) !== -1) {\n\n // value of each cell\n td = document.createElement(\"td\");\n td.innerHTML = data[i][key];\n td.id = \"id-col-\"+ key + \"-\" + parseInt(i);\n\n // *********** modal template form start ****************************\n // form_group to group the label and input for the modal table\n form_group = document.createElement(\"div\");\n form_group.className = \"form-group\";\n form_group.style = \"overflow: auto;\"\n\n // label for the modal\n label = document.createElement(\"label\");\n label.className = \"control-label col-md-6 col-sm-6 col-xs-12\";\n\n // input fields for the modal\n input = document.createElement(\"input\");\n input.className = \"control-input col-md-6 col-sm-6 col-xs-12\";\n input.type = \"text\";\n\n // assign values to the label and input in the modal\n label.textContent = key;\n label.value = key;\n input.value = data[i][key];\n input.id = \"id-col-modal\" + key + parseInt(i);\n\n // event listener to record changes in the input fields for the modal table\n // event listener for the changes in the modal\n input.addEventListener('change', function() {\n this.style.border = '1px solid #01d28e';\n button_modal_submit.disabled = false;\n\n // on change save the entire record and save in a dictionary\n var div_step_changed = this.parentNode.parentElement;\n var rec_numbers = div_step_changed.getElementsByClassName(\"control-label\").length;\n var div_step_labels = div_step_changed.getElementsByClassName(\"control-label\");\n var div_step_inputs = div_step_changed.getElementsByClassName(\"control-input\");\n var record_number = parseInt(document.getElementById(\"record_num\").innerText);\n var record_changed = {};\n\n\n for(var k=0;k<rec_numbers;k++){\n record_changed[div_step_labels[k].innerHTML] = div_step_inputs[k].value;\n\n }\n record_changed_dict[record_number]=record_changed;\n\n });\n\n form_group.append(label);\n form_group.append(input);\n div_step.append(form_group);\n\n // double click event on each cell of the main table to open the modal in the current record\n // TODO: the ondblclick can be moved to be part of the row rather then the individual cells\n td.ondblclick = function(){\n var rowId = this.parentNode.rowIndex;\n record_num.innerText = rowId -1 ;\n\n // hide all steps\n\n var steps = document.getElementsByClassName(\"modal-step\");\n\n // hide all steps\n for(var k=0; k<steps.length;k++){\n steps[k].style.display = \"none\";\n }\n\n // show only selected step\n document.getElementById(\"modal-step-\"+ (rowId-1)).style.display = \"block\";\n\n\n $('#update-modal').modal('show');\n\n }\n\n\n tr.appendChild(td);\n }\n\n }\n\n div_step.style.display = \"none\";\n div_form.append(div_step);\n }\n $('#modal-body').html(div_form);\n\n}\n\n}", "function fn_tbl_AddLoadCase(cntCases) {\n var div_LoadsinLoadCases = $('#div_LoadsinLoadCases');\n var curCnt = div_LoadsinLoadCases.children().length;\n if (curCnt < cntCases) {\n var varString = '<div width=\"100%\" style=\"overflow-x: scroll;\">' +\n '<table width=\"100%\" class=\"grid bor0\" cellspacing=\"1\" cellpadding=\"4\">' +\n '<caption>Input for Load Case<span> ' + cntCases + '</span> </caption>' +\n '<thead>' +\n '<tr>' +\n '<td rowspan=\"3\"><strong>Load No</strong></td>' +\n '<td rowspan=\"3\"><strong>Type</strong></td>' +\n '<td rowspan=\"3\"><strong>Description</strong></td>' +\n '<td rowspan=\"3\"><strong>Values</strong></td>' +\n '<td rowspan=\"3\"><strong>Units</strong></td>' +\n '<td rowspan=\"2\"><strong>Distance X From Wall Face</strong></td>' +\n '<td rowspan=\"2\"><strong>Length (L) </strong></td>' +\n '<td colspan=\"10\"><strong>Design Considerations</strong></td>' +\n '<td rowspan=\"3\"><strong>Delete</strong></td>' +\n '</tr>' +\n '<tr>' +\n '<td colspan=\"2\"><strong>For Sliding Check</strong></td>' +\n '<td colspan=\"2\"><strong>For Overturning Check</strong></td>' +\n '<td colspan=\"2\"><strong>For Base Pressure Check</strong></td>' +\n '<td colspan=\"2\"><strong>For Baseslab Design</strong></td>' +\n '<td colspan=\"2\"><strong>For Wall Design</strong></td>' +\n '</tr>' +\n '<tr>' +\n '<td><strong>( m )</strong></td>' +\n '<td><strong>( m )</strong></td>' +\n '<td><strong>Consider?</strong></td>' +\n '<td><strong>Factor</strong></td>' +\n '<td><strong>Consider?</strong></td>' +\n '<td><strong>Factor</strong></td>' +\n '<td><strong>Consider?</strong></td>' +\n '<td><strong>Factor</strong></td>' +\n '<td><strong>Consider?</strong></td>' +\n '<td><strong>Factor</strong></td>' +\n '<td><strong>Consider?</strong></td>' +\n '<td><strong>Factor</strong></td>' +\n '</tr>' +\n '</thead>' +\n '<tbody>' +\n '<tr>' +\n '<td>1</td>' +\n '<td>' +\n '<select class=\"form-control inputs\"> ' +\n '<option value=\"0\" disabled=\"\" selected>Self Weight</option>' +\n '<option value=\"1\" disabled=\"\" >Soil Fill @ Back</option>' +\n '</select>' +\n '</td>' +\n '<td>Wall</td>' +\n '<td></td>' +\n '<td></td>' +\n '<td></td>' +\n '<td></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.0\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.0\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.0\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.5\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.5\" class=\"numericRightAlign\"></td>' +\n '<td></td>' +\n '</tr>' +\n '<tr>' +\n '<td>2</td>' +\n '<td>' +\n '<select class=\"form-control inputs\"> ' +\n '<option value=\"0\" disabled=\"\">Self Weight</option>' +\n '<option value=\"1\" disabled=\"\" selected>Soil Fill @ Back</option>' +\n '</select>' +\n '</td>' +\n '<td>Soil Backfilling</td>' +\n '<td><input type=\"text\" style=\"width:98%\" name=\"\" class=\"numericRightAlign\"></td>' +\n '<td>m</td>' +\n '<td></td>' +\n '<td></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.0\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.0\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.0\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.5\" class=\"numericRightAlign\"></td>' +\n '<td><select name=\"\" id=\"\" class=\"inputs\" style=\"width:98%\"><option>Yes</option><option>No</option></select></td>' +\n '<td><input type=\"text\" style=\"width:95%\" placeholder=\"1.5\" class=\"numericRightAlign\"></td>' +\n '<td>' +\n '<!--<button type=\"button\" class=\"btn btn-danger btn-outline-danger DeleteRow\" style=\"width:100%\" disabled=\"\"><span><i class=\"fa fa-trash-o\"></i></span></button> -->' +\n '</td>' +\n '</tr>' +\n '</tbody>' +\n '<tfoot>' +\n '<tr>' +\n '<td colspan=\"18\">' +\n '<button id=\"\" type=\"button\" class=\"confirmBTN addLoad\" style=\"float: left;\">+ Add Load</button>' +\n '</td>' +\n '</tr>' +\n '</tfoot>' +\n '</table>' +\n '</div>';\n div_LoadsinLoadCases.append(varString);\n }\n }", "function eDataDataTable(){\r\n\ttdType='3';\r\n\tvar url = 'productId.testobjectdata.attachments.list?productId='+productId+'&jtStartIndex=0&jtPageSize=10000';\r\n\tvar jsonObj = \t{\r\n\t\t\t\t\t\t\"Title\":\"EData\",\r\n\t\t\t\t\t\t\"url\":url,\r\n\t\t\t\t\t\t\"jtStartIndex\":0,\r\n\t\t\t\t\t\t\"jtPageSize\":1000,\r\n\t\t\t\t\t\t\"componentUsageTitile\":\"Test Data Plan\"\r\n\t\t\t\t\t};\r\n\tassignEDataDataTableValues(jsonObj);\r\n}", "function appendContent(ePage, sUrl) { \r\n\tvar pDiv = document.createElement(\"div\"); \r\n\tpDiv.id = \"portletDiv_\" + contentID;\r\n\tcontentID += 1;\r\n\tpDiv.style.align = \"left\";\r\n\tpDiv.style.valign = \"top\";\r\n\tpDiv.width = \"600\";\r\n\t\r\n\tvar tTable = document.createElement(\"table\");\r\n\tpDiv.appendChild(tTable);\r\n\tvar rRow = tTable.insertRow();\r\n\tvar cColum2 = rRow.insertCell();\r\n\t\t\r\n\tvar fIframe = document.createElement(\"iframe\");\r\n\tfIframe.id = \"portletFrame_\" + contentID;\r\n\tfIframe.width = \"580\";\t\r\n\tcColum2.appendChild(fIframe);\r\n\tfIframe.src=\"./html/\" + sUrl;\r\n\tfIframe.frameborder = 0;\r\n\r\n\tvar cColum1 = rRow.insertCell();\r\n\t\r\n\tvar mImg = document.createElement(\"img\");\r\n\tmImg.src = \"./img/closes.gif\";\r\n\tmImg.setAttribute(\"onclick\",\"delContent(\" + pDiv.id + \")\");\r\n\r\n\tcColum1.appendChild(mImg);\r\n\tcColum1.style.width=\"10\";\r\n\tcColum1.setAttribute(\"valign\",\"top\");\r\n\t\r\n\tePage.appendChild(pDiv);\r\n}", "function useData(data) {\n data = data || EMBED.getData();\n //debugger;\n var url_string = window.location.href; \n var url = new URL(url_string);\n SegmentActualId = url.searchParams.get(\"SegmentActualId\");\n updateGlobalVariable(SegmentActualId, \"SegmentActualId\", true, true);\n if (flagLoaded == false) {\n styleData();\n flagLoaded = true;\n }\n \n var ParsedPreparedLotsJson = returnParsedIfJson(data.PreparedLotsJson, \"PreparedLotsJson\");\n if (PreparedLotsJson == undefined || !deepEqual(PreparedLotsJson, returnParsedIfJson(data.PreparedLotsJson, \"PreparedLotsJson\"))) {\n PreparedLotsJson = ParsedPreparedLotsJson;\n \n }\n\n var ParsedProductDescriptionJson = returnParsedIfJson(data.ProductDescriptionJson, \"ProductDescriptionJson\");\n if (ProductDescriptionJson == undefined || !deepEqual(ProductDescriptionJson, returnParsedIfJson(data.ProductDescriptionJson, \"DataGridJsonData\"))) {\n ProductDescriptionJson = ParsedProductDescriptionJson;\n \n }\n PreparedLotsDataGrid();\n ProductDescriptionDatagrid();\n}", "function AddArticleLine(cpt_spreadsheet)\n{\n\tif(typeof AddArticleLine.counter == 'undefined')\n\t{\n\t\tAddArticleLine.counter = 1;\n\t}\n\t\n\tvar div_container = document.createElement(\"div\");\n\tdiv_container.id= \"container_row_article_\"+ cpt_spreadsheet + \"_\" + AddArticleLine.counter;\n\tdiv_container.className = \"new_row_article\";\n\tvar div_row1=document.createElement(\"div\");\n\tdiv_row1.setAttribute(\"class\", \"row form-group\");\n\t\n\tvar div_product=document.createElement(\"div\");\n\tdiv_product.setAttribute(\"class\",\t\"col-xs-12 col-lg-4\");\n\tvar div_price=document.createElement(\"div\");\n\tdiv_price.setAttribute(\"class\",\t\"col-xs-12 col-lg-4\");\n\tvar div_quantity=document.createElement(\"div\");\n\tdiv_quantity.setAttribute(\"class\",\t\"col-xs-12 col-lg-4\");\n\t\n\tvar input_product = document.createElement(\"input\");\n\tinput_product.id = \"form_set_article_product_\"+ cpt_spreadsheet + \"_\" + AddArticleLine.counter;\n\tinput_product.type=\"text\";\n\tinput_product.className = \"form-control\";\n\tinput_product.name = \"p_article[\"+ AddArticleLine.counter +\"][p_product]\";\n\tinput_product.title = \"Product\";\n\tinput_product.placeholder = \"Product\";\n\tvar input_price = document.createElement(\"input\");\n\tinput_price.id = \"form_set_article_price_\"+ cpt_spreadsheet + \"_\" + AddArticleLine.counter;\n\tinput_price.type=\"number\";\n\tinput_price.min=\"0\";\n\tinput_price.step=\"0.01\";\n\tinput_price.className = \"form-control\";\n\tinput_price.name = \"p_article[\"+ AddArticleLine.counter +\"][p_price]\";\n\tinput_price.title = \"Total Price\";\n\tinput_price.placeholder = \"Total Price\";\n\tvar input_quantity = document.createElement(\"input\");\n\tinput_quantity.id = \"form_set_article_quantity_\"+ cpt_spreadsheet + \"_\" + AddArticleLine.counter;\n\tinput_quantity.type=\"number\";\n\tinput_quantity.value=\"1\";\n\tinput_quantity.min=\"0\";\n\tinput_quantity.step=\"0.001\";\n\tinput_quantity.className = \"form-control\";\n\tinput_quantity.name = \"p_article[\"+ AddArticleLine.counter +\"][p_quantity]\";\n\tinput_quantity.title = \"Quantity/Parts\";\n\tinput_quantity.placeholder = \"Quantity\";\n\n\n\t//Set label\n\tvar label_product = document.createElement(\"Label\");\n\tlabel_product.setAttribute(\"for\", input_product.id);\n\tlabel_product.innerHTML = \"Product<span class='glyphicon glyphicon-asterisk red'></span>\";\n\tvar label_price = document.createElement(\"Label\");\n\tlabel_price.setAttribute(\"for\", input_price.id);\n\tlabel_price.innerHTML = \"Total Price<span class='glyphicon glyphicon-asterisk red'></span>\";\n\tvar label_quantity = document.createElement(\"Label\");\n\tlabel_quantity.setAttribute(\"for\", input_quantity.id);\n\tlabel_quantity.innerHTML=\"Quantity/Parts<span class='glyphicon glyphicon-asterisk red'></span>\";\n\t\n\t//Bootstrap add-on\n\tvar div_input_group_product = document.createElement(\"div\");\n\tdiv_input_group_product.className=\"input-group\";\n\tvar span_glyph_product = document.createElement(\"span\");\n\tspan_glyph_product.className=\"input-group-addon glyphicon glyphicon-tag\";\n\tvar div_input_group_price = document.createElement(\"div\");\n\tdiv_input_group_price.className=\"input-group\";\n\tvar span_glyph_price = document.createElement(\"span\");\n\tspan_glyph_price.className=\"input-group-addon glyphicon glyphicon-euro\";\n\tvar div_input_group_quantity = document.createElement(\"div\");\n\tdiv_input_group_quantity.className=\"input-group\";\n\tvar span_glyph_quantity = document.createElement(\"span\");\n\tspan_glyph_quantity.className=\"input-group-addon glyphicon glyphicon-scale\";\n\n\t//Parent div\n\tvar parent_div = document.getElementById('div_set_article_' + cpt_spreadsheet);\n\t\n\t//Title\n\tvar div_title = document.createElement(\"div\");\n\tdiv_title.className=\"row form-group\";\n\tdiv_title.style.overflow=\"hidden\";\n\tvar div_title_col = document.createElement(\"div\");\n\tdiv_title_col.className=\"col-xs-12 text-center\";\n\tdiv_title_col.style.overflow=\"hidden\";\n\tvar p_title = document.createElement(\"p\");\n\tp_title.className=\"padding_member\";\n\tp_title.style.display=\"inline-block\";\n\tp_title.style.paddingLeft=\"10px\";\n\tp_title.innerHTML = \"Additionnal article\"; \n\tvar button_trash = document.createElement(\"button\");\n\tbutton_trash.className = \"btn btn-default pull-right\";\n\tbutton_trash.title = \"Remove this submission\";\n\tbutton_trash.type = \"button\";\n\tbutton_trash.name = \"Remove this submission\";\n\tbutton_trash.onclick=function(){\n\t\tRemoveChild(parent_div, div_container);\n\t};\n\tvar span_trash = document.createElement(\"span\");\n\tspan_trash.className=\"glyphicon glyphicon-trash\";\n\tbutton_trash.appendChild(span_trash);\n\tdiv_title_col.appendChild(p_title);\n\tdiv_title_col.appendChild(button_trash);\n\tdiv_title.appendChild(div_title_col);\n\t//Add to container\n\t//Product\n\tdiv_product.appendChild(label_product);\n\tdiv_input_group_product.appendChild(input_product);\n\tdiv_input_group_product.appendChild(span_glyph_product);\n\tdiv_product.appendChild(div_input_group_product);\n\tdiv_row1.appendChild(div_product);\n\t//Quantity\n\tdiv_quantity.appendChild(label_quantity);\n\tdiv_input_group_quantity.appendChild(input_quantity);\n\tdiv_input_group_quantity.appendChild(span_glyph_quantity);\n\tdiv_quantity.appendChild(div_input_group_quantity);\n\tdiv_row1.appendChild(div_quantity);\n\t//Price\n\tdiv_price.appendChild(label_price);\n\tdiv_input_group_price.appendChild(input_price);\n\tdiv_input_group_price.appendChild(span_glyph_price);\n\tdiv_price.appendChild(div_input_group_price);\n\tdiv_row1.appendChild(div_price);\n\t//container\n//\tvar hr = document.createElement(\"hr\");\n//\thr.className=\"separator_payments\";\n//\tdiv_container.appendChild(hr);\n//\tdiv_container.appendChild(div_title);\n\tdiv_container.appendChild(div_row1);\n\t\n\t//Parent div\n\tparent_div.appendChild(div_container);\n\t\n AddArticleLine.counter ++;\n return false;\n}", "function generateNewDisplayRow(id, content) {\n\n const tempRow =\n `<li id=\"${id}\" class=\"row collection-item\">\n <div class=\"valign-wrapper col s1\">\n <a href=\"#!\"><i class=\"material-icons\">menu</i></a>\n </div>\n <div class=\"valign-wrapper col s10\"> \n <input name=\"source-${id}\" type=\"url\" value=\"${content}\" required=\"true\" \n class=\"external-input validate\"/>\n </div>\n <div class=\"row secondary-content col s1\">\n <div class=\"col s12\">\n <a class=\"icon-wrapper-link\" target=\"_blank\" href=\"${content}\">\n <i class=\"material-icons\">send</i></a> \n </div>\n <div class=\"col s12\">\n <a class=\"icon-wrapper-link\" onclick=\"deleteModalCollectionRow('${id}')\">\n <i class=\"material-icons\">delete</i></a> \n </div>\n </div> \n </li>`\n\n return tempRow;\n}", "function prepareContent(t,lk,pc){\n if (t == \"more\"){ \n switchMoreLess(lk,\"more\",pc);}\n else if (t == \"less\"){\n var cSize = $(lk).data('content-size');\n // substring limit set as 20 if not passed by user, else users limit\n var c = pc.substring(0, parseInt(cSize + 1));\n switchMoreLess(lk,\"less\",c);\n }\n}", "loadReportContent(output, record, insertContent) {\n const div = document.createElement(\"div\");\n div.className = \"admin__reports-view\";\n output = `\n <div class=\"admin__reports-view--num reportId\">\n ${record.reportID}\n </div>\n <div class=\"admin__reports-view--livesAffected\">\n ${record.livesAffected}\n </div>\n <div class=\"admin__reports-view--COD\">\n ${record.causeOfDiaster}\n </div>\n <div class=\"admin__reports-view--location\">\n ${record.location}\n </div>\n <div class=\"admin__reports-view--DOD\">\n ${record.dayNum} - ${record.month} - ${record.year}\n </div>\n <div class=\"admin__reports-view--operations\">\n <i class=\"fas fa-eye\"></i>\n <i class=\"fas fa-edit\"></i>\n <i class=\"fas fa-trash-alt delReport\"></i>\n </div>\n `;\n div.innerHTML = output;\n insertContent.appendChild(div);\n }", "function htmlData(docViewId, divContainerName, saveURL, isUserModified) //constructor\r\n{\r\n var _mDocViewId = \"\";\r\n var _mDivContainerName = \"\";\r\n var _mNotifySaveModifiedData = \"\"; //if set to false, user wont get the message for saving the modified data\r\n var _mHasUserModifiedData = \"\";\r\n var _mSaveURL = \"\";\r\n var _mChangedFields = \"\";\r\n var _mActionMethod = \"\";\r\n var _CHANGED_FIELDS_SEPERATOR = \"\";\r\n\r\n // com.tradestonesoftware.plm.utils.PLMUIHelper to be udpated if changed here\r\n this._CHANGED_FIELDS_SEPERATOR = \"@,\";\r\n\r\n this._mDocViewId = docViewId;\r\n this._mDivContainerName = divContainerName;\r\n this._mSaveURL = saveURL;\r\n\r\n this._mNotifySaveModifiedData = true;\r\n this._mHasUserModifiedData = false;\r\n this._mChangedFields = new Array();\r\n //Tracker#:14459 REGRESSION ISSUE WITH ADVANCED SEARCH - RESULTS ARE NOT RETURNED FOR SOME OF THE FIELDS WHEN THEY SH\r\n this._mAppendContainerData = false;\r\n\r\n this.getDocViewId = _getDocViewId;\r\n this.getDivContainerName = _getDivContainerName;\r\n this.getSaveURL = _getSaveURL;\r\n this.setSaveURL = _setSaveURL;\r\n this.hasUserModifiedData = _hasUserModifiedData;\r\n this.isDataModified = _isDataModified;\r\n this.setNotifySaveModifiedData = _setNotifySaveModifiedData;\r\n this.getChangeFields = _getChangeFields;\r\n this.getSaveChangeFields = _getSaveChangeFields;\r\n this.resetChangeFields = _resetChangeFields;\r\n this.addToChangedFields = _addToChangedFields;\r\n this.removeFromChangedFields = _removeFromChangedFields;\r\n this.checkForChanges = _checkForChanges;\r\n this.performSaveChanges = _performSaveChanges;\r\n //Tracker#:14459 REGRESSION ISSUE WITH ADVANCED SEARCH - RESULTS ARE NOT RETURNED FOR SOME OF THE FIELDS WHEN THEY SH\r\n this.getAppendContainerData = _getAppendContainerData;\r\n this.setAppendContainerData = _setAppendContainerData;\r\n\r\n this._appendAllContainerDataToRequest = _appendAllContainerDataToRequest;\r\n this.appendChangeFieldsCtrlInfoToRequest = _appendChangeFieldsCtrlInfoToRequest;\r\n\r\n this.setActionMethod = _setActionMethod;\r\n this.clone = _clone;\r\n this.addAllChangedFieldsData = _addAllChangedFieldsData;\r\n this.appendAllCustomContainerDataToRequest = _appendAllCustomContainerDataToRequest;\r\n this.removeAllCustomContainerChangeFields = _removeAllCustomContainerChangeFields;\r\n this._removeControlInfoFromChangeFields = _removeControlInfoFromChangeFields;\r\n this.resetForm = _resetForm;\r\n this.isFieldModified = _isFieldModified;\r\n\r\n if(typeof(isUserModified)!='undefined')\r\n {\r\n this._mHasUserModifiedData = isUserModified;\r\n }\r\n\r\n function _clone()\r\n {\r\n return new htmlData(this._mDocViewId, this._mDivContainerName, this._mSaveURL);\r\n }\r\n\r\n function _getDocViewId()\r\n {\r\n return this._mDocViewId;\r\n }\r\n\r\n function _getDivContainerName()\r\n {\r\n return this._mDivContainerName;\r\n }\r\n\r\n function _getSaveURL()\r\n {\r\n return this._mSaveURL;\r\n }\r\n\r\n function _setSaveURL(saveURL)\r\n {\r\n this._mSaveURL = saveURL;\r\n }\r\n\r\n function _hasUserModifiedData()\r\n {\r\n return this._mHasUserModifiedData;\r\n }\r\n\r\n //Tracker#:14095 ISSUE WITH SAVE PROMPT:'THERE ARE CHANGES ON THE SCREEN. DO YOU WANT TO SAVE..'\r\n //defined the function to identify the field data modified or not.\r\n function _isDataModified()\r\n {\r\n var dataMod = false;\r\n\r\n //alert(\"htmldata.js -> _isDataModified \\n chgFlds: \" + this._mChangedFields);\r\n for (var index = 0; index < this._mChangedFields.length; ++index)\r\n {\r\n var item = this._mChangedFields[index];\r\n var obj = getElemnt(item);\r\n\r\n // alert(obj.outerHTML + \" \\n \" + _isChangeFieldNotify(obj));\r\n\r\n if(obj && _isChangeFieldNotify(obj))\r\n {\r\n\r\n dataMod = true;\r\n break;\r\n }\r\n }\r\n //alert(\"isDataModified \" + dataMod);\r\n return dataMod;\r\n }\r\n\r\n ////Tracking#: 15106 - CANNOT OPEN ANY ROUNDS HIGHER THAN 1 ON SAMPLE EVALUATION\r\n /// method which reset the changefields to its original form\r\n function _resetForm()\r\n {\r\n //alert(\"htmldata.js -> _resetForm \\n chgFlds: \" + this._mChangedFields);\r\n\r\n for (var index = 0; index < this._mChangedFields.length; ++index)\r\n {\r\n var item = this._mChangedFields[index];\r\n var obj = getElemnt(item);\r\n\r\n if(obj)\r\n {\r\n //alert(obj.outerHTML + \" \\n obj.defaultValue = \" + obj.defaultValue + \"---\");\r\n\r\n //reset image association field if any\r\n var objImg = getElemnt(\"img_icon_\"+ obj.id );\r\n\r\n if(objImg)\r\n {\r\n //alert(\"objImg.defaultValue \" + objImg.defaultValue);\r\n objImg.src = objImg.defaultValue;\r\n }\r\n\r\n if(obj)\r\n {\r\n //alert(\"obj.type = \" + obj.type);\r\n //Tracker#: 15802 TECH SPEC OVERVIEW SHOULD ALWAYS WARN USER WHEN THEY MAKE A CHANGE AND DO NOT SAVE\r\n //ucheck the checked checkboxes once the form data is reset.\r\n if(obj.type && obj.type.toUpperCase()==\"CHECKBOX\")\r\n {\r\n //alert('obj.defaultValue ' + obj.defaultValue);\r\n if(obj.defaultValue && _isChangeFieldNotify(obj))\r\n {\r\n //alert(\"checked\");\r\n obj.checked=true;\r\n }\r\n else\r\n {\r\n //alert(\"-----unchecked-----\");\r\n obj.checked=false;\r\n }\r\n }\r\n //alert(\"setting value \" + obj.defaultValue);\r\n obj.value = obj.defaultValue;\r\n }\r\n\r\n //reset validation fields\r\n if(_isDescField(obj))\r\n {\r\n obj = getElemnt(obj.id + _FIELDS_SEPERATOR + \"desc\");\r\n\r\n if(obj)\r\n {\r\n obj.value = obj.defaultValue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function _setNotifySaveModifiedData(bShowSaveModifiedData)\r\n {\r\n this._mNotifySaveModifiedData = bShowSaveModifiedData;\r\n }\r\n\r\n //function to add the changed fields id to the\r\n function _addToChangedFields(obj)\r\n {\r\n if(obj && !(this.isFieldModified(obj.id)))\r\n {\r\n this._mChangedFields[this._mChangedFields.length] = obj.id;\r\n this._mHasUserModifiedData = true;\r\n }\r\n }\r\n\r\n function _removeFromChangedFields(obj)\r\n {\r\n if(obj)\r\n {\r\n for (var index = 0; index < this._mChangedFields.length; ++index)\r\n {\r\n var item = this._mChangedFields[index];\r\n if(item==obj.id)\r\n {\r\n //alert(\"_removeFromChangedFields : before deleting \\n \" + this._mChangedFields);\r\n this._mChangedFields.splice(index,1);\r\n //alert(\"_removeFromChangedFields : after deleting \\n \" + this._mChangedFields);\r\n }\r\n }\r\n\r\n if(this._mChangedFields.length==0)this._mHasUserModifiedData = false;\r\n }\r\n }\r\n\r\n //Tracker#:20816 exposed the method to individual object \r\n //to indentify the changed field for the particular object \r\n function _isFieldModified(objName)\r\n { \t\r\n \tif(objName==null)\r\n \t{\r\n \t\treturn false;\r\n \t}\r\n \t\r\n\t \tfor (var index = 0; index < this._mChangedFields.length; ++index)\r\n\t \t{\r\n\t \tvar item = this._mChangedFields[index];\r\n\t if(item==objName)\r\n\t {\r\n\t return true;\r\n\t }\r\n\t \t}\r\n\t \treturn false;\r\n }\r\n\r\n function _getChangeFields()\r\n {\r\n //Tracker#: 16147 REQUEST SAMPLE POP-UP SCREEN DOES NOT CLOSE AFTER CREATING SAMPLE(S) \r\n return this.getSaveChangeFields().split (this._CHANGED_FIELDS_SEPERATOR);\r\n }\r\n\r\n function _getSaveChangeFields()\r\n {\r\n //Tracker#:16391 THREADED MESSAGING NOT WORKING ON TECH SPEC\r\n //To append field separator at common place\r\n //Tracker#: 16147 REQUEST SAMPLE POP-UP SCREEN DOES NOT CLOSE AFTER CREATING SAMPLE(S)\r\n return this._mChangedFields.join(this._CHANGED_FIELDS_SEPERATOR);\r\n }\r\n\r\n function _resetChangeFields()\r\n {\r\n \tthis._mChangedFields = new Array();\r\n \tthis._mHasUserModifiedData = false;\r\n }\r\n\r\n function _checkForChanges()\r\n {\r\n //todo to add more logic in the future\r\n //can take method as param and check the action.\r\n return this._mHasUserModifiedData;\r\n }\r\n //Tracker#:14459 REGRESSION ISSUE WITH ADVANCED SEARCH - RESULTS ARE NOT RETURNED FOR SOME OF THE FIELDS WHEN THEY SH\r\n function _getAppendContainerData()\r\n {\r\n return this.mAppendContainerData;\r\n }\r\n\t//Tracker#:14459 REGRESSION ISSUE WITH ADVANCED SEARCH - RESULTS ARE NOT RETURNED FOR SOME OF THE FIELDS WHEN THEY SH\r\n function _setAppendContainerData(blnAppendOnlyChgFldData)\r\n {\r\n this.mAppendContainerData = blnAppendOnlyChgFldData;\r\n }\r\n\r\n function _performSaveChanges(callBackHandler, objHTMLAjaxparam)\r\n {\r\n //alert(\"htmldata.js->_performSaveChanges : \\n objHTMLAjaxparam \"+objHTMLAjaxparam);\r\n //if user has not modified then there is not point in saving\r\n //alert(this._mHasUserModifiedData);\r\n if(!this._mHasUserModifiedData)\r\n {\r\n //alert(\"user not changed\");\r\n return false;\r\n }\r\n //todo check for required field values\r\n if(!objHTMLAjaxparam)\r\n {\r\n //alert(\"creating object \\n this._mSaveURL \" + this._mSaveURL + \"\\nthis._mActionMethod \"+ this._mActionMethod);\r\n objHTMLAjax = new htmlAjax();\r\n objHTMLAjax.setActionURL(this._mSaveURL);\r\n objHTMLAjax.setActionMethod(this._mActionMethod);\r\n objHTMLAjax.setProcessHandler(callBackHandler);\r\n }\r\n else\r\n {\r\n objHTMLAjax = objHTMLAjaxparam;\r\n }\r\n\r\n //add all the changefields to\r\n if(this.getChangeFields()!=null)\r\n {\r\n //alert(\"objHTMLAjax.parameter() \" + objHTMLAjax.parameter());\r\n //alert(\"objHTMLAjax.parameter().count \" + objHTMLAjax.parameter().count());\r\n //objHTMLAjax.parameter().add(\"name\",\"value\");\r\n //alert(\"_performSaveChanges: user modified \\n\" + this.getChangeFields().join(this._CHANGED_FIELDS_SEPERATOR));\r\n objHTMLAjax.parameter().add(_screenChangeFileds, this.getSaveChangeFields());\r\n }\r\n //Tracker#:14459 REGRESSION ISSUE WITH ADVANCED SEARCH - RESULTS ARE NOT RETURNED FOR SOME OF THE FIELDS WHEN THEY SH\r\n if(this.mAppendContainerData==true)\r\n {\r\n //alert(\"here\");\r\n this._appendAllContainerDataToRequest(objHTMLAjax);\r\n }\r\n else\r\n {\r\n //Tracker#:14293 BOM PERFORMANCE BASED ON ATTACHED DOCUMENT\r\n //send only the changefield data within that container to the server side\r\n this.appendChangeFieldsCtrlInfoToRequest(objHTMLAjax, this.getChangeFields());\r\n }\r\n\r\n //alert(\"sending\");\r\n objHTMLAjax.sendRequest();\r\n \r\n return objHTMLAjax;\r\n\r\n }\r\n\r\n ///Tracker#:12867 - OUTSTANDING TECH SPEC>MASS REPLACE ISSUES\r\n /// defined the functions to remove the changelist information\r\n /// from the given div container\r\n function _removeAllCustomContainerChangeFields(divContainerID)\r\n {\r\n var objCnt = getElemnt(divContainerID);\r\n\r\n if(objCnt)\r\n {\r\n //alert(\"_appendAllCustomContainerDataToRequest: inside container\");\r\n //todo\r\n this._removeControlInfoFromChangeFields(objCnt, \"INPUT\");\r\n this._removeControlInfoFromChangeFields(objCnt, \"SELECT\");\r\n this._removeControlInfoFromChangeFields(objCnt, \"TEXTAREA\");\r\n }\r\n }\r\n\r\n function _removeControlInfoFromChangeFields(objCnt, tagName)\r\n {\r\n var objColl = objCnt.getElementsByTagName(tagName);\r\n\r\n if(objColl && objColl.length>0)\r\n {\r\n var cnt = objColl.length;\r\n\r\n for(var i=0;i<cnt;i++)\r\n {\r\n var objItm = objColl.item(i);\r\n\r\n if(objItm)\r\n {\r\n this.removeFromChangedFields(objItm);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function _appendAllCustomContainerDataToRequest(objHTMLAjax, divContainerID)\r\n {\r\n //alert(\"_appendAllCustomContainerDataToRequest \\n divContainerID\"+divContainerID);\r\n var objCnt = getElemnt(divContainerID);\r\n\r\n if(objCnt)\r\n {\r\n //alert(\"_appendAllCustomContainerDataToRequest: inside container\");\r\n //todo\r\n _appendControlInfoToRequest(objHTMLAjax, objCnt, \"INPUT\");\r\n _appendControlInfoToRequest(objHTMLAjax, objCnt, \"SELECT\");\r\n _appendControlInfoToRequest(objHTMLAjax, objCnt, \"TEXTAREA\");\r\n }\r\n }\r\n //since 2009R4 aug 30 fixpack Tracker#:12564\r\n //added the parameter divName, which is the custom container div name\r\n // which will send all the data within that container to the server side\r\n function _appendAllContainerDataToRequest(objHTMLAjax, divName)\r\n {\r\n var objCnt = getElemnt(this._mDivContainerName);\r\n\r\n if(typeof(divName)!='undefined')\r\n {\r\n objCnt = getElemnt(divName);\r\n }\r\n\r\n if(objCnt)\r\n {\r\n //todo\r\n _appendControlInfoToRequest(objHTMLAjax, objCnt, \"INPUT\");\r\n _appendControlInfoToRequest(objHTMLAjax, objCnt, \"SELECT\");\r\n _appendControlInfoToRequest(objHTMLAjax, objCnt, \"TEXTAREA\");\r\n }\r\n }\r\n\r\n function _appendControlInfoToRequest(objHTMLAjax, objCnt, tagName)\r\n {\r\n var objColl = objCnt.getElementsByTagName(tagName);\r\n\r\n if(objColl && objColl.length>0)\r\n {\r\n var cnt = objColl.length;\r\n\r\n for(var i=0;i<cnt;i++)\r\n {\r\n var objItm = objColl.item(i);\r\n\r\n if(objItm)\r\n {\r\n //if(showmsg==true)alert(objItm.id +\" = \" +objItm.value);\r\n objHTMLAjax.parameter().add(objItm.id, objItm.value);\r\n }\r\n }\r\n }\r\n }\r\n\r\n //Tracker#:14293 BOM PERFORMANCE BASED ON ATTACHED DOCUMENT\r\n //defined the function to send only the changefield data\r\n //within that container to the server side\r\n function _appendChangeFieldsCtrlInfoToRequest(objHTMLAjax)\r\n {\r\n //alert(\"_appendChangeFieldsCtrlInfoToRequest \\n chgFlds: \" + this._mChangedFields);\r\n for (var index = 0; index < this._mChangedFields.length; ++index)\r\n {\r\n var item = this._mChangedFields[index];\r\n var obj = getElemnt(item);\r\n if(obj)\r\n {\r\n //alert( \" adding to params \" + item + \" = \" + obj.value);\r\n objHTMLAjax.parameter().add(item, obj.value);\r\n }\r\n }\r\n }\r\n\r\n function _setActionMethod(act)\r\n {\r\n this._mActionMethod =act;\r\n }\r\n\r\n function _addAllChangedFieldsData(objHTMLAjax)\r\n {\r\n //try{\r\n if(this.hasUserModifiedData()==true)\r\n {\r\n //alert(\"_addAllChangedFieldsData : user modified \\n\" + this.getChangeFields().join(this._CHANGED_FIELDS_SEPERATOR));\r\n\r\n objHTMLAjax.parameter().add(_screenChangeFileds, this.getSaveChangeFields());\r\n var chgFlds = this.getChangeFields();\r\n\r\n if((chgFlds.length!=\"undefined\") && chgFlds.length>0)\r\n {\r\n var cnt = chgFlds.length;\r\n\r\n for (num = 0; num < cnt; num++)\r\n {\r\n var obj = getElemnt(chgFlds[num]);\r\n if(obj)objHTMLAjax.parameter().add(obj.id, obj.value);\r\n }\r\n }\r\n /*else if(chgFlds)\r\n {\r\n var obj = getElemnt(chgFlds);\r\n if(obj)objHTMLAjax.parameter().add(obj.id, obj.value);\r\n } */\r\n }\r\n //}catch(e){alert(\"_addAllChangedFieldsData : \\n\" + e.description);}\r\n }\r\n}", "commitAddedRows() {\n var d = new latte.DataSet();\n var indexes = [];\n this.endCellEdit();\n // Add dataset columns\n //d.columns.addCollection(this.columns);\n for (var i = 0; i < this.columns.count; i++) {\n d.columns.add(this.columns.item(i));\n }\n // Collect new row indexes\n this.table.find('tr.insertable-row').each(function () {\n var tr = $(this);\n // Remove * symbol\n tr.find('th').text(tr.data('rowIndex') + 1);\n // push index into array\n indexes.push(tr.data('rowIndex'));\n // Remove insertable-row class\n tr.removeClass('insertable-row').addClass('pendent pendent-insert');\n });\n for (var i = 0; i < indexes.length; i++) {\n d.rows.add(this.rows.item(indexes[i]));\n }\n // Notify added rows\n this.onRowsAdded(d);\n }", "function dispOperationsData(){\n //console.log(localStorage.getItem('formData'));\n let {uname,email,fname, lname, roles, pwd} = JSON.parse(localStorage.getItem('formData'));//destructuring\n var optable = document.getElementById(\"optable\");\n var row = optable.insertRow();\n var cell1 = row.insertCell();\n var cell2 = row.insertCell();\n var cell3 = row.insertCell();\n var cell4 = row.insertCell();\n var cell5 = row.insertCell();\n var cell6 = row.insertCell();\n cell1.innerHTML= `${uname}`;\n cell2.innerHTML= `${email}`;\n cell3.innerHTML=`${fname}`;\n cell4.innerHTML=`${lname}`;\n cell5.innerHTML=`${roles}`;\n cell6.innerHTML=`${pwd}`;\n }", "function mushroomProductionGrid() {\n myLayout.cells(\"a\").setText('MUSHROOM PRODUCTION | <input id=\"box\" type=\"text\" value=\"\" placeholder=\"Datepicker\"> | <input type=\"button\" name=\"addMushroomProdBtn\" value=\" Add New\" onclick=\"addMushroomProdNew();\"> | <input type=\"button\" name=\"mushroomProductionUpdtBtn\" value=\"Update Changes\" onclick=\"myDataProcessor.sendData();\">');\n loadPageMenu(myLayout);\n setDatePickerDateToToday();\n myGrid = initMyGridNew(\"get_mushroom_prod_data_xml.php\");\n\n var myCalendar = new dhtmlXCalendarObject(\"box\");\n myCalendar.setSensitiveRange(\"2017-01-01\", new Date());\n myCalendar.attachEvent(\"onClick\", function (d) {\n document.getElementById(\"box\").value = get_currentDate_by_obj(d).date2;\n myGrid.clearAll();\n myGrid.load(\"functions/get_mushroom_prod_data_xml.php?date=\" + get_currentDate_by_obj(d).date1, function () {});\n\n });\n myCalendar.attachEvent(\"onHide\", function (d) {});\n\n myDataProcessor = initMydataProcessor(\"update_mushroom_prod_data.php\", 0);\n myDataProcessor.setVerificator(0, not_empty);\n myDataProcessor.setVerificator(1, not_empty);\n myDataProcessor.setVerificator(1, greaterThanZero);\n myDataProcessor.setVerificator(2, not_empty);\n myDataProcessor.setVerificator(2, greaterThanZero);\n myDataProcessor.setVerificator(3, not_empty);\n myDataProcessor.setVerificator(3, greaterThanZero);\n\n myDataProcessor.init(myGrid);\n}", "function AddDataFunct(funct) {\n var Intern_TableHtml = '';\n if (funct !== undefined && funct !== null && funct !== \"\") {\n // This else statement or route is for when the data needs to be added to the table with some extra ordering or processing.\n funct();\n }\n else if (Intern_ArrayOfValues.length === 0) {\n Intern_TableHtml = Intern_TableHtml + '<table class=\"tableCls\">';\n Intern_TableHtml = Intern_TableHtml + '<thead>';\n Intern_TableHtml = Intern_TableHtml + '<tr id=\"' + Intern_InstanceName + 'trHeaders\">';\n if (Intern_TableFieldDispNames === undefined || Intern_TableFieldDispNames === null)\n Intern_TableFieldDispNames = Intern_TableFieldIDs;\n $.each(Intern_TableFieldDispNames, function (index, value) {\n Intern_TableHtml = Intern_TableHtml + '<th class=\"tableHeadCls\">';\n Intern_TableHtml = Intern_TableHtml + value;\n Intern_TableHtml = Intern_TableHtml + '</th>';\n });\n if (Setting_IncludeUpDown || Setting_IncludeEdit || Setting_IncludeDelete) {\n Intern_TableHtml = Intern_TableHtml + '<th class=\"tableHeadCls\">';\n Intern_TableHtml = Intern_TableHtml + Disp_OperationsTitle;\n Intern_TableHtml = Intern_TableHtml + '</th>';\n }\n Intern_TableHtml = Intern_TableHtml + '</tr>';\n Intern_TableHtml = Intern_TableHtml + '</thead>';\n\n Intern_ArrayOfValues[Intern_ArrayOfValues.length] = {};\n Intern_TableHtml = Intern_TableHtml + '<tbody>';\n Intern_TableHtml = Intern_TableHtml + '<tr id=\"' + Intern_InstanceName + 'tableRow_0\">';\n Intern_TableHtml = Intern_TableHtml + GenerateTableLine(0);\n Intern_TableHtml = Intern_TableHtml + '</tr>';\n Intern_TableHtml = Intern_TableHtml + '</tbody>';\n Intern_TableHtml = Intern_TableHtml + '</table>';\n\n Intern_TableDivElem.html(Intern_TableHtml);\n AddEvents(0);\n }\n else {\n // This else statement or route is for when the data needs to be added to the table without any extra ordering.\n Intern_ArrayOfValues[Intern_ArrayOfValues.length] = {};\n Intern_TableHtml = Intern_TableHtml + '<tr id=\"' + Intern_InstanceName + 'tableRow_' + (Intern_ArrayOfValues.length - 1) + '\">';\n Intern_TableHtml = Intern_TableHtml + GenerateTableLine(Intern_ArrayOfValues.length - 1);\n Intern_TableHtml = Intern_TableHtml + '</tr>';\n\n if (Setting_AddToTop)\n $(\"#\" + Intern_TableDivName + \" tbody\").prepend(Intern_TableHtml);\n else\n $(\"#\" + Intern_TableDivName + \" tbody\").append(Intern_TableHtml);\n AddEvents(Intern_ArrayOfValues.length - 1);\n }\n\n ClearAllInputs();\n if (Intern_InputFieldElems.length !== 0)\n Intern_InputFieldElems[0].focus();\n }", "function buildContent(data, $this, template) {\n\t\tvar newURL;\n\t\tvar html;\n\t\t/* A check to see if this is a Grid SEO page */\n\t\tvar seoPage = Boolean($('#skjpsp_ops').val() === '1');\n\t\tvar hasCorrectURL = checkForCorrectURLStructure(data);\n\n\t\t// Checks to see if this is a SEO page and if the URL is correct in the JSON\n\t\t// We then push the updated SEO URL if it's a ContentView Page, if not it does nothing\n\t\tif (seoPage && !hasCorrectURL) {\n\t\t\tnewURL = data.url.split('=');\n\t\t\t// self refferencing but...\n\t\t\tdata.url = (newURL[0].split('?')[0] === 'ContentView') ? '/c/' + newURL[1] : data.url;\n\t\t}\n\n\t\t// Build out and append our template(s)\n\t\thtml = mustache.to_html(mustacheTemplates[template], data);\n\t\t$(html).appendTo($this);\n\t}", "function buildPage(input){\n document.getElementById(\"ufo-table\").getElementsByTagName('tbody')[0].innerHTML = \"\";\n input.forEach((element,index)=>{\n\n // Peruse the dataset to filter all elements with id=\"ufo-table\":\n let table = document.getElementById(\"ufo-table\").getElementsByTagName('tbody')[0];\n let row = table.insertRow(index);\n let cell1 = row.insertCell(0);\n let cell2 = row.insertCell(1);\n let cell3 = row.insertCell(2);\n let cell4 = row.insertCell(3);\n let cell5 = row.insertCell(4);\n let cell6 = row.insertCell(5);\n let cell7 = row.insertCell(6);\n\n // Add HTML contents of the corresponding elements:\n cell1.innerHTML = element.datetime;\n cell2.innerHTML = element.city;\n cell3.innerHTML = element.state;\n cell4.innerHTML = element.country;\n cell5.innerHTML = element.shape;\n cell6.innerHTML = element.durationMinutes;\n cell7.innerHTML = element.comments;\n\n index++;\n });\n}", "function accountCurrentData() {\n\n osapi.http.get({\n href: jiveBaseUrl + \"/getAccountProvisioningFile\",\n 'refreshInterval': 0,\n format: 'json',\n 'authz': 'signed',\n 'headers': {\n 'Content-Type': ['application/json']\n }\n\n }).execute(function (res) {\n\n var currentData = res.content.accountData;\n\n // console.log(currentData);\n if (currentData.length) {\n\n\n //Account Fields\n if (accountConditionFlag == 0) {\n if (currentData[0].condition.length > 2) {\n\n\n for (var i = 2; i < currentData[0].condition.length; i++) {\n var table = document.getElementById(\"main\");\n var new_row = table.rows[1].cloneNode(true);\n\n var len = table.rows.length;\n new_row.cells[0].innerHTML = len;\n\n var inp1 = new_row.cells[1].getElementsByTagName('select')[0];\n\n\n // console.log(new_row.children[4]);\n\n new_row.children[5].style.display = \"block\";\n for (var i = 1; i < table.tBodies[0].children.length; i++) {\n table.tBodies[0].children[i].children[0].innerHTML = i + 1;\n }\n\n\n table.tBodies[0].appendChild(new_row);\n table.tBodies[0].children[len - 1].children[1].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[2].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[3].children[0].value = \"\";\n\n }\n }\n accountConditionFlag = 1;\n }\n\n\n for (var j = 0; j < currentData[0].condition.length; j++) {\n\n var tBodyChildren = document.getElementById('main').tBodies[0].children;\n var trChild = tBodyChildren[j].children;\n // console.log(currentData[0].condition[j].field);\n trChild[1].children[0].value = currentData[0].condition[j].field;\n trChild[2].children[0].value = currentData[0].condition[j].operator;\n trChild[3].children[0].value = currentData[0].condition[j].value;\n\n\n }\n\n document.getElementById(\"filter\").value = currentData[0].filterLogic;\n\n // Mapping Fields\n if (accountMappingFlag == 0) {\n if (currentData[0].mapping.length > 2) {\n\n for (var i = 2; i < currentData[0].mapping.length; i++) {\n\n\n var table = document.getElementById(\"mapping\");\n// var tbody = document.getElementById(\"ProfileSync1\");\n var new_row = table.rows[2].cloneNode(true);\n // console.log(new_row);\n var len = table.rows.length;\n new_row.cells[0].innerHTML = len;\n\n var inp1 = new_row.cells[1].getElementsByTagName('select')[0];\n //new_row.id = \"row\" + len;\n //inp1.id += len;\n// inp1.value = '';\n// console.log(new_row.children[4]);\n new_row.children[3].style.display = \"block\";\n for (var i = 1; i < table.tBodies[0].children.length; i++) {\n table.tBodies[0].children[i].children[0].innerHTML = i + 1;\n }\n\n\n table.tBodies[0].appendChild(new_row);\n table.tBodies[0].children[len - 1].children[1].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[2].children[0].value = \"\";\n table.tBodies[0].children[len - 1].children[3].children[0].value = \"\";\n }\n\n }\n accountMappingFlag = 1;\n\n }\n\n\n for (var map = 0; map < currentData[0].mapping.length; map++) {\n\n\n var tBodyChildren = document.getElementById('mapping').tBodies[0].children;\n var trChild = tBodyChildren[map].children;\n //console.log(currentData[0].condition[map].field);\n trChild[1].children[0].value = currentData[0].mapping[map].salesforceField;\n trChild[2].children[0].value = currentData[0].mapping[map].jiveField;\n\n\n var mappingChildren = document.getElementById('mapping').tBodies[0].children;\n var mapChild = mappingChildren[map].children;\n // console.log(currentData[0].mapping[map].salesforceField)\n mapChild[1].children[0].value = currentData[0].mapping[map].salesforceField;\n mapChild[2].children[0].value = currentData[0].mapping[map].jiveField;\n\n\n }\n\n //Navigation\n\n var nav = document.getElementById('navigation');\n if (currentData[0].navigation == \"0\") {\n nav.children[0].checked = true;\n }\n else if (currentData[0].navigation == \"1\") {\n nav.children[2].checked = true;\n }\n else if (currentData[0].navigation == \"2\") {\n nav.children[4].checked = true;\n }\n\n\n //Frequency\n var freq = document.getElementById('frequency');\n // if(currentData[0].frequency==\"0\"){\n // freq.children[0].checked = true;\n // }\n if (currentData[0].frequency == \"1\") {\n freq.children[0].checked = true;\n }\n else if (currentData[0].frequency == \"2\") {\n freq.children[2].checked = true;\n }\n\n //Place Type\n\n var freq = document.getElementById('placeType');\n // if(currentData[0].frequency==\"0\"){\n // freq.children[0].checked = true;\n // }\n if (currentData[0].placeType == \"group\") {\n freq.children[0].checked = true;\n }\n else if (currentData[0].placeType == \"space\") {\n freq.children[2].checked = true;\n }\n else if (currentData[0].placeType == \"project\") {\n freq.children[4].checked = true;\n var projectField = document.getElementById('projectField');\n projectField.style.display = \"block\";\n document.getElementById('parentBox').value = currentData[0].parent;\n document.getElementById('startDate').value = currentData[0].startDate;\n document.getElementById('dueDate').value = currentData[0].dueDate;\n\n }\n\n\n gadgets.window.adjustHeight();\n\n\n }\n })\n\n\n}", "function refreshRenderAddContent(){\n _model.render(function(htmlContent){\n window.frames[_iframe.attr(\"id\")].jQuery('body').empty().append(htmlContent).ready(function(){\n _layoutFunctions.afterRender(function(){\n if(reactivateInspectionToolCallback)\n {\n reactivateInspectionToolCallback();\n }\n });\n\n // If splittedRegionContent array is available - iterate over the array and replace the sample content with actual content\n if (splittedRegionContent.length > 0) {\n assignWidgetContent();\n }\n });\n });\n }", "function updateContent() {\n \tvar decisions = response.decisions,\n location = '',\n option = {},\n optionName = '',\n properties = [],\n item;\n\n //console.log('updateContent', this, arguments, response)\n\n // For each location get all the options and create the html string from its properties\n // Then insert the html string into the location on the page\n if (decisions && decisions.length > 0){\n \tfor(var d = 0; d < decisions.length; d++){\n\t\t\t\tlocation = decisions[d].location;\n\t\t\t\toption = decisions[d].option;\n\t\t\t\tconsole.log('decisions', this, arguments, location, option);\n\t\t\t\tproperties = option.properties;\n\t\t\t\toptionName = option.name;\n\t\t\t\t\n\t\t\t\tvar adbox = document.getElementById(location);\n\t\t\t\tif(properties.length==0) {\n\t\t\t\t\tif(optionName!=null)\n\t\t\t\t\t\tadbox.src='./images/'+optionName+'.jpg';\t\n\t\t\t\t} else {\t\t\n\t\t\t\tfor(var p = 0; p < properties.length; p++){\n\t\t\t\t\tif(properties[p].value != null) {\n\t\t\t\t\t\n\t\t\t\t\t\tif(adbox!=null){\n\t\t\t\t\t\t\tconsole.log('RTP Content Decision:', properties[p].value);\n\t\t\t\t\t\t\tadbox.innerHTML = properties[p].value;\n\t\t\t\t\t\t\tadbox.firstChild.removeAttribute('height');\n\t\t\t\t\t\t\tadbox.firstChild.removeAttribute('width');\n\t\t\t\t \n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar custid = getCustId();\n\t\t\t\t\t\tvar custidContent = document.getElementById('custid').innerHTML;\n\t\t\t\t\t\tdocument.getElementById('custid').innerHTML = custidContent + ' ('+custid+')';\n\t\t\t\t\t}\n\t\t\t\t}\t\t\n\t\t\t\t}\t\n \t}\n \t}\n\t}", "function createTable(data){\n const table = document.getElementById('orders-table');\n const tableContent = document.createDocumentFragment();\n let cols = getData('columns');\n //let nrows = data.length;\n\n deleteTableContent(table);\n\n data.forEach(rowData => {\n let row = document.createElement('tr');\n for(let col of cols) {\n let cell = document.createElement('td');\n switch(col){\n case 'total':\n //Set two decimal\n cell.textContent = `$ ${rowData[col].toFixed(2)}`;\n break;\n \n case 'order': \n // Create the link to Orders\n let link = rowData['order_link'];\n let order_number = rowData[col];\n let a = create_link(link, order_number);\n cell.append(a);\n break;\n\n case 'date':\n //Print the Date in Locale Format\n cell.textContent = rowData[col].toLocaleString();\n break;\n \n case 'status':\n let status = create_status(rowData[col]);\n cell.append(status);\n break;\n \n default:\n cell.textContent = rowData[col];\n break;\n }\n row.appendChild(cell);\n }\n tableContent.appendChild(row);\n })\n \n //Add the tableContent Fragment to Table Body\n table.tBodies[0].append(tableContent);\n\n //Show the table\n showTable(table, 1);\n\n //Return the link to Order Number\n function create_link(link, number) {\n let a = document.createElement('a');\n \n a.setAttribute('href', link);\n a.setAttribute('target', 'blank');\n a.innerHTML = `# ${number.toString().padStart(5, '0')}`;\n\n return a;\n }\n //Return a span element to status order\n function create_status(status) {\n let elem = document.createElement('span');\n elem.classList.add(status.toLowerCase(), 'status-order');\n elem.textContent = status.toUpperCase();\n\n return elem;\n }\n}", "function launchSiteData() {\n\n /**\n * first i access the table \"bodys\" i.e the area the info will be displayed.\n * Then i create a table row and clone 5 times so each body has its own row.\n */\n let launchBody1 = document.getElementById(\"tab-one-body\"),\n launchBody2 = document.getElementById(\"tab-two-body\"),\n launchBody3 = document.getElementById(\"tab-three-body\"),\n launchBody4 = document.getElementById(\"tab-four-body\"),\n launchBody5 = document.getElementById(\"tab-five-body\"),\n launchBody6 = document.getElementById(\"tab-six-body\"),\n tableRow1 = document.createElement(\"tr\"),\n tableRow2 = tableRow1.cloneNode(false),\n tableRow3 = tableRow1.cloneNode(false),\n tableRow4 = tableRow1.cloneNode(false),\n tableRow5 = tableRow1.cloneNode(false),\n tableRow6 = tableRow1.cloneNode(false);\n\n /** append all rows to the table body */\n launchBody1.appendChild(tableRow1);\n launchBody2.appendChild(tableRow2);\n launchBody3.appendChild(tableRow3);\n launchBody4.appendChild(tableRow4);\n launchBody5.appendChild(tableRow5);\n launchBody6.appendChild(tableRow6);\n\n /** HTML content for each launch site */\n tableRow1.innerHTML = `<td class=\"launch-item\">${launchData[0].status}</td>\n <td class=\"launch-item\">${launchData[0].location.name}</td>\n <td class=\"launch-item\">${launchData[0].vehicles_launched[0]}</td>\n <td class=\"launch-item\">${launchData[0].attempted_launches}</td>\n <td class=\"launch-item\">${launchData[0].successful_launches}</td>\n <td class=\"launch-item\"><a href=\"${launchData[0].wikipedia}\" target=\"_blank\">Click Here!</a></td>\n <td class=\"launch-item\">${launchData[0].details}</td>`;\n\n tableRow2.innerHTML = `<td class=\"launch-item\">${launchData[1].status}</td>\n <td class=\"launch-item\">${launchData[1].location.name}</td>\n <td class=\"launch-item\">${launchData[1].vehicles_launched[0]}</td>\n <td class=\"launch-item\">${launchData[1].attempted_launches}</td>\n <td class=\"launch-item\">${launchData[1].successful_launches}</td>\n <td class=\"launch-item\"><a href=\"${launchData[1].wikipedia}\" target=\"_blank\">Click Here!</a></td>\n <td class=\"launch-item\">${launchData[1].details}</td>`;\n\n tableRow3.innerHTML = `<td class=\"launch-item\">${launchData[2].status}</td>\n <td class=\"launch-item\">${launchData[2].location.name}</td>\n <td class=\"launch-item\">${launchData[2].vehicles_launched[0]}</td>\n <td class=\"launch-item\">${launchData[2].attempted_launches}</td>\n <td class=\"launch-item\">${launchData[2].successful_launches}</td>\n <td class=\"launch-item\"><a href=\"${launchData[2].wikipedia}\" target=\"_blank\">Click Here!</a></td>\n <td class=\"launch-item\">${launchData[2].details}</td>`;\n\n tableRow4.innerHTML = `<td class=\"launch-item\">${launchData[3].status}</td>\n <td class=\"launch-item\">${launchData[3].location.name}</td>\n <td class=\"launch-item\">${launchData[3].vehicles_launched[0]}</td>\n <td class=\"launch-item\">${launchData[3].attempted_launches}</td>\n <td class=\"launch-item\">${launchData[3].successful_launches}</td>\n <td class=\"launch-item\"><a href=\"${launchData[3].wikipedia}\" target=\"_blank\">Click Here!</a></td>\n <td class=\"launch-item\">${launchData[3].details}</td>`;\n\n tableRow5.innerHTML = `<td class=\"launch-item\">${launchData[4].status}</td>\n <td class=\"launch-item\">${launchData[4].location.name}</td>\n <td class=\"launch-item\">${launchData[4].vehicles_launched[0]}</td>\n <td class=\"launch-item\">${launchData[4].attempted_launches}</td>\n <td class=\"launch-item\">${launchData[4].successful_launches}</td>\n <td class=\"launch-item\"><a href=\"${launchData[4].wikipedia}\" target=\"_blank\">Click Here!</a></td>\n <td class=\"launch-item\">${launchData[4].details}</td>`;\n\n tableRow6.innerHTML = `<td class=\"launch-item\">${launchData[5].status}</td>\n <td class=\"launch-item\">${launchData[5].location.name}</td>\n <td class=\"launch-item\">${launchData[5].vehicles_launched[0]}</td>\n <td class=\"launch-item\">${launchData[5].attempted_launches}</td>\n <td class=\"launch-item\">${launchData[5].successful_launches}</td>\n <td class=\"launch-item\"><a href=\"${launchData[5].wikipedia}\" target=\"_blank\">Click Here!</a></td>\n <td class=\"launch-item\">${launchData[5].details}</td>`;\n\n}", "function contentRow (data) {\n var subtitle = i18n(data.isReply ? 'commented_by' : 'created_by').escape();\n var blockButton = (canBlock ? ' | <a class=\"rda-block\" href=\"/wiki/Special:Block/' + data.userNameEncoded + '\">' + i18n('block').escape() + '</a>' : '');\n var talk = {\n link: ['User_talk', 'Message_Wall'],\n text: [i18n('talk').escape(), i18n('wall').escape()],\n css: ['rda-talk', 'rda-wall']\n };\n var i = (wallsEnabled ? 1 : 0);\n var row =\n '<tr>' +\n '<td>' +\n '<img src=\"' + data.avatarURL + '/scale-to-width-down/50\" width=\"30\" height=\"30\" class=\"avatar rda-avatar\" alt=\"' + data.userName + '\">' +\n '</td>' +\n '<td>' +\n '<p>' +\n '<cite>' +\n '<span class=\"subtle\">' + subtitle + '</span>' +\n ' <a class=\"real-name rda-username\" href=\"/d/u/' + data.userID + '\">' + data.userName + '</a> (<a class=\"' + talk.css[i] + '\" href=\"/wiki/' + talk.link[i] + ':' + data.userNameEncoded + '\">' + talk.text[i] + '</a> | <a class=\"rda-contribs\" href=\"/wiki/Special:Contributions/' + data.userNameEncoded + '\">' + i18n('contribs').escape() + '</a>' + blockButton + ')' +\n ' <a class=\"subtle rda-time\" href=\"/d/p/' + data.threadID + '/r/' + data.messageID + '\">' + data.time + '</a>' +\n '</cite>' +\n '</p>' +\n '<p>' +\n '<span class=\"rda-content\">' + data.text + '</span>' +\n '</p>' +\n '</td>' +\n '</tr>';\n\n return row;\n }", "function loadColumnLatestContent(data) {\n if (isEmpty(data.Data)) {\n console.log('empty data');\n return;\n }\n\n var articles = '';\n $.each(data.Data, function (index, item) {\n articles = articles + renderColumnArticles(item);\n });\n $(document.getElementById('rovatok-' + app.Column)).find('ul').html(articles);\n\n // save to cache\n Storage.setItem(app.getArticlesCacheKey(), JSON.stringify(data));\n}", "loadUserReportContent(output, record, insertContent) {\n const div = document.createElement(\"div\");\n div.className = \"admin__reports-view\";\n output = `\n <div class=\"admin__reports-view--num reportId\">\n ${record.reportID}\n </div>\n <div class=\"admin__reports-view--livesAffected\">\n ${record.livesAffected}\n </div>\n <div class=\"admin__reports-view--COD\">\n ${record.causeOfDiaster}\n </div>\n <div class=\"admin__reports-view--location\">\n ${record.location}\n </div>\n <div class=\"admin__reports-view--DOD\">\n ${record.dayNum} - ${record.month} - ${record.year}\n </div>\n <div class=\"admin__reports-view--operations\">\n <i class=\"fas fa-eye\"></i>\n <i class=\"fas fa-edit\"></i>\n </div>\n `;\n div.innerHTML = output;\n insertContent.appendChild(div);\n }", "function gotContent(data){\r\n let page = data.query.pages; \r\n //console.log(page);\r\n let pageID = Object.keys(data.query.pages)[0];\r\n console.log(pageID);\r\n\r\n let content = page[pageID].revisions[0][\"*\"];\r\n startOfContentChar = \"'''\"\r\n startCharIndex = content.search(startOfContentChar) + 3;\r\n console.log(startCharIndex);\r\n endCharIndex = startCharIndex + 200 + 1;\r\n description = content.substring(startCharIndex, endCharIndex) + '...'\r\n document.getElementById('contentDisplay').innerHTML =description;\r\n //console.log(content); \r\n // access summary brute force \r\n //let summary = page[pageID].revisions[0][\"*\"][10];\r\n //console.log('SUMMARY' + summary);\r\n }", "function loaddata(x){\n\tvar obj={};\n\tobj.Data=[];\n\tobj.Data=x;\n\tvar table = document.getElementById(\"main-table\");\n\tvar temp=\"\";\n\tvar rowCount=table.rows.length;\n\tfor(i=1;i<rowCount;i++){\n\t\ttable.deleteRow(1);\n\t}\n\tfor(i=0;i<obj.Data.length;i++){\n\t\tvar row = table.insertRow(i+1);\n\t var x=row.insertCell(0);\n\t\tif(obj.Data[i].Order==\"Done\"){\n\t\t\tx.innerHTML='<img src=\"Resources/Tick.png\" style=\"height:20px;\">';\n\t\t}\n\t\telse if(obj.Data[i].Order==\"In Progress\"){\n\t\t\tx.innerHTML=\"\";\n\t\t}\n\t\telse if(obj.Data[i].Order==\"Cancelled\"){\n\t\t\tx.innerHTML='<img src=\"Resources/Cancel.png\" style=\"height:20px;\">';\n\t\t}\n\t\tx=row.insertCell(1);\n\t\tx.innerHTML=obj.Data[i].Name!=\"\"? obj.Data[i].Name: \"NOT ON FILE\";\n\t\tx=row.insertCell(2);\n\t\tx.innerHTML=obj.Data[i].Technician!=\"\"? obj.Data[i].Technician: \"NOT ON FILE\";;\n\t\tx=row.insertCell(3);\n\t\tx.innerHTML=obj.Data[i].Order_Date!=\"\"? obj.Data[i].Order_Date: \"NOT ON FILE\";;\n\t\tx=row.insertCell(4);\n\t\tx.innerHTML=obj.Data[i].Type!=\"\"? obj.Data[i].Type: \"NOT ON FILE\";;\n\t\tx=row.insertCell(5);\n\t\tx.innerHTML=obj.Data[i].Cell_Number!=\"\"? obj.Data[i].Cell_Number: \"NOT ON FILE\";;\n\t\tx=row.insertCell(6);\n\t\tx.innerHTML=obj.Data[i].Email!=\"\"? obj.Data[i].Email: \"NOT ON FILE\";;\n\t\tx=row.insertCell(7);\n\t\tif(obj.Data[i].Order==\"Done\"){\n\t\t\ttemp=\"<select class='list' name='status' onchange='updateTable(this)'>\"+\n\t\t\t\t\t\t\"<datalist id='browsers'>\"+ \n\t\t\t\t\t\t\"<option selected value='Done'>Done</option>\"+ \n\t\t\t\t\t\t\"<option value='In Progress'>In Progress</option>\"+\n\t\t\t\t\t\t\"<option value='Cancelled'>Cancelled</option>\"\n\t\t\t\t \"</select>\";\n\t\t\trow.className='done';\n\t\t}\n\t\telse if(obj.Data[i].Order==\"In Progress\"){\n\t\t\ttemp=\"<select class='list' name='status' onchange='updateTable(this)'>\"+ \n\t\t\t\t\t\t\"<option value='Done'>Done</option>\"+ \n\t\t\t\t\t\t\"<option selected value='In Progress'>In Progress</option>\"+\n\t\t\t\t\t\t\"<option value='Cancelled'>Cancelled</option>\"\n\t\t\t\t \"</select>\";\n\t\t\trow.className='progress';\n\t\t}\n\t\telse if(obj.Data[i].Order==\"Cancelled\"){\n\t\t\t temp=\"<select class='list' name='status' onchange='updateTable(this)'>\"+\n\t\t\t\t\t\t\"<datalist id='browsers'>\"+ \n\t\t\t\t\t\t\"<option value='Done'>Done</option>\"+ \n\t\t\t\t\t\t\"<option value='In Progress'>In Progress</option>\"+\n\t\t\t\t\t\t\"<option selected value='Cancelled'>Cancelled</option>\"\n\t\t\t\t \"</select>\";\n\t\t\trow.className='cancelled';\n\t\t}\n\t\tx.innerHTML=temp;\n\t\t\n\t\t\n\t}\t\n}", "function editTable(rowData){\n\n\t// Get edit div at home.handlebars\n\tvar editMain = document.getElementById(\"editWorkout\");\n\n\tif(editMain.firstChild != null){\n\t\teditMain.removeChild(editMain.firstChild);\n\t}\n\n\t// Create form\n\tvar form = document.createElement(\"form\");\n\tform.name = \"editForm\";\n\tform.onsubmit = \"return false\";\n\tvar fieldset = document.createElement(\"fieldset\");\n\tvar legend = document.createElement(\"legend\");\n\n\tlegend.textContent = \"Edit Exercise\";\n\n\t// Create hidden id input\n\tvar idDiv = document.createElement(\"div\");\n\tvar idInput = document.createElement(\"input\");\n\tidInput.type = \"hidden\";\n\tidInput.name = \"id\";\n\tidInput.id = \"editID\";\n\tidInput.value = rowData[0].id;\n\tidDiv.appendChild(idInput);\n\n\t// Create name div\n\tvar nameDiv = document.createElement(\"div\");\n\tvar nameLabel = document.createElement(\"label\");\n\tnameLabel.for = \"name\";\n\tnameLabel.textContent = \"Name\";\n\tvar nameInput = document.createElement(\"input\");\n\tnameInput.type = \"text\";\n\tnameInput.name = \"name\";\n\tnameInput.id = \"editName\";\n\tnameInput.value = rowData[0].name;\n\t//nameInput.placeholder = this.value;\n\tnameDiv.appendChild(nameLabel);\n\tnameDiv.appendChild(nameInput);\n\n\t// Create reps div\n\tvar repsDiv = document.createElement(\"div\");\n\tvar repsLabel = document.createElement(\"label\");\n\trepsLabel.for = \"reps\";\n\trepsLabel.textContent = \"Reps (#):\";\n\tvar repsInput = document.createElement(\"input\");\n\trepsInput.type = \"number\";\n\trepsInput.name = \"reps\";\n\trepsInput.id = \"editReps\";\n\trepsInput.value = rowData[0].reps;\n\trepsInput.placeholder = this.value;\n\trepsDiv.appendChild(repsLabel);\n\trepsDiv.appendChild(repsInput);\n\n\t// Create weight div\n\tvar weightDiv = document.createElement(\"div\");\n\tvar weightLabel = document.createElement(\"label\");\n\tweightLabel.for = \"weight\";\n\tweightLabel.textContent = \"Weight (#):\";\n\tvar weightInput = document.createElement(\"input\");\n\tweightInput.type = \"number\";\n\tweightInput.name = \"weight\";\n\tweightInput.id = \"editWeight\";\n\tweightInput.value = rowData[0].weight;\n\tweightInput.placeholder = this.value;\n\tweightDiv.appendChild(weightLabel);\n\tweightDiv.appendChild(weightInput);\n\n\t// Create date div\n\tvar dateDiv = document.createElement(\"div\");\n\tvar dateLabel = document.createElement(\"label\");\n\tdateLabel.for = \"date\";\n\tdateLabel.textContent = \"Date:\";\n\tvar dateInput = document.createElement(\"input\");\n\tdateInput.type = \"date\";\n\tdateInput.name = \"date\";\n\tdateInput.id = \"editDate\";\n\tdateInput.value = rowData[0].date;\n\tdateInput.placeholder = this.value;\n\tdateDiv.appendChild(dateLabel);\n\tdateDiv.appendChild(dateInput);\n\n\t// Create lbs div\n\tvar lbsDiv = document.createElement(\"div\");\n\tvar lbsLabel = document.createElement(\"label\");\n\tlbsLabel.for = \"lbs\";\n\tlbsLabel.textContent = \"Unit:\";\n\tvar lbsInput = document.createElement(\"input\");\n\tlbsInput.type = \"radio\";\n\tlbsInput.name = \"lbs\";\n\tlbsInput.id = \"editUnitLbs\";\n\tlbsInput.value = \"1\";\n\tlbsInput.innerHTML = \"lbs\";\n\tvar lbsLabel2 = document.createElement(\"label\");\n\tlbsLabel2.textContent = \"lbs\";\n\tvar kgsInput = document.createElement(\"input\");\n\tkgsInput.type = \"radio\";\n\tkgsInput.name = \"lbs\";\n\tkgsInput.id = \"editUnitKgs\";\n\tkgsInput.value = \"0\";\n\tkgsInput.innerHTML = \"kgs\";\n\tvar kgsLabel = document.createElement(\"kgs\");\n\tkgsLabel.textContent = \"kgs\";\n\tif(rowData[0].lbs == 1){\n\t\tlbsInput.checked = \"checked\";\n\t}\n\telse{\n\t\tkgsInput.checked = \"checked\";\n\t}\n\tlbsDiv.appendChild(lbsLabel);\n\tlbsDiv.appendChild(lbsInput);\n\tlbsDiv.appendChild(lbsLabel2);\n\tlbsDiv.appendChild(kgsInput);\n\tlbsDiv.appendChild(kgsLabel);\n\n\t// Create submit div \n\tvar submitDiv = document.createElement(\"div\");\n\tvar submitInput = document.createElement(\"input\");\n\tsubmitInput.type = \"submit\";\n\tsubmitInput.name = \"submit edit\";\n\tsubmitInput.id = \"editExercise\";\n\tsubmitInput.addEventListener('click', updateExercise, false);\n\tsubmitDiv.appendChild(submitInput);\n\n\t// Append divs to form\n\tfieldset.appendChild(legend);\n\tfieldset.appendChild(idDiv);\n\tfieldset.appendChild(nameDiv);\n\tfieldset.appendChild(repsDiv);\n\tfieldset.appendChild(weightDiv);\n\tfieldset.appendChild(dateDiv);\n\tfieldset.appendChild(lbsDiv);\n\tfieldset.appendChild(submitDiv);\n\tform.appendChild(fieldset);\n\n\t// Append form to mainForm\n\teditMain.appendChild(form);\n\n}", "function AddRow(data, name, description) {\n searchAction = false;\n $(\"tr.warning\").hide();\n // Add to Lst\n AddList(Column, lst, ascSort , data , name , description);\n // Check Lst \n if (lst.length > 0 ) {\n $(\"#pagination\").twbsPagination('destroy');\n }\n // Check for go to new page ? \n total_Pages = (lst.length % itemPerPage == 1) ?( total_Pages + 1) : total_Pages;\n // Load page after add \n LoadPage(1, total_Pages, itemPerPage, lst.length ,lst);\n // Focus Row after add\n FocusRow(lst, data) ; \n \n}", "function updateContent(transport) {\n var subtab = false;\n var sampleIdList = null;\n var sampleNameList = null;\n var skillModelsNotCachedList = null;\n var cachedFileStatusList = null;\n var samplesThatRequireCachingList = null;\n\n if (transport) {\n\n var json = transport.responseText.evalJSON(true);\n subtab = json.subtab;\n sampleIdList = json.lstSampleId;\n sampleNameList = json.lstSampleName;\n skillModelsNotCachedList = json.lstSkillModelsNotCached;\n cachedFileStatusList = json.lstCachedFileStatus;\n samplesThatRequireCachingList = json.lstSamplesThatRequireCaching;\n selectedSkillModelList = json.lstSelectedSkillModels;\n displaySampleCachedFileInfo(sampleIdList,\n sampleNameList,\n skillModelsNotCachedList,\n cachedFileStatusList,\n samplesThatRequireCachingList);\n }\n\n if (!subtab) {\n subtab = getSelectedSubtab();\n } else {\n selectSubtab(subtab);\n }\n if (subtab == \"byStudentStep\") {\n //theHelpWindow.updateContent($(\"help-export-step\"));\n $('cached_export_selection_div').show();\n $('stepExportNav').show();\n //Nudge here prevents all nav box margins from collapsing in IE8\n $('samples').setStyle({\n marginBottom: '0.5em'\n });\n if ($F('exportStepIncludeNoKCs') || $F('exportStepIncludeAllKCs')) {\n $('skills').hide();\n } else {\n $('skills').show();\n }\n\n $('kcModelNavHeader').hide();\n $('primary_kc_model_label').hide();\n\n studentStepSkillModelInit(selectedSkillModelList);\n $('students').show();\n $('problems').show();\n\n resetKCMHeader();\n if ($('contentSetName')) {\n $('contentSetName').show();\n }\n if ($('contentSetNameModified')) {\n $('contentSetNameModified').show();\n }\n\n requestByStudentStep();\n showExportFileStatus();\n updateExportFileStatus();\n\n }\n}", "function glueMainPageData(data) {\n console.log(typeof data);\n life = data.Life;\n console.assert(life !== undefined, \"Life is undefined.\");\n resolutionUnit = data.ResolutionUnit;\n if(life.Notes == null){\n life.Notes = [];\n }\n lifeService.datifyLifeObject(life);\n console.log(\"life\");\n console.log(life);\n visibleNotes = life.Notes;\n //createMomentsFromDataAttrs(); // Done here in the beginning so only need to create Moments once (performance problems).\n updateLifeComponents();\n zoomLifeCalendar();\n refreshDragSelectObject();\n}", "function PageProcess() {\n\n var temp1 = getURLParam('package');\n if (temp1 != \"\") {\n currentpackage = temp1;\n }\n\n var queryParame = {\n PackageName: currentpackage,\n pageSize: defaultpagesize,\n pageNumber: defaultpage\n };\n\n\n InitDatagrid(queryParame);\n InitSearch(queryParame);\n InitAddDiaglog();\n InitUpdateDiaglog(queryParame);\n LoadDatagrid(queryParame);\n\n\n }", "function addingRows(data) {\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createDescripRow(data[i]));\n }\n // console.log(rowsToAdd);\n }", "function render(data, container, selected, template) {\n var start = 0, end = 9;\n\n // remove items from only current container being rendered\n container.find('.kb-import-items').remove();\n\n if (data.length == 0){\n container.append('<div class=\"kb-import-items text-muted\">No data found</div>');\n return\n } else if (data.length-1 < end)\n end = data.length;\n\n var rows = buildMyRows(data, start, end, template);\n container.append(rows);\n events(container, selected);\n\n // infinite scroll\n container.unbind('scroll');\n container.on('scroll', function() {\n if($(this).scrollTop() + $(this).innerHeight() >= this.scrollHeight) {\n var rows = buildMyRows(data, start, end, template);\n container.append(rows);\n }\n events(container, selected);\n });\n }", "addDataToFront(data) {}", "function showCruise(id) {\n\n var content = \"\";\n var title = \"\";\n var cruise_dates = \"\";\n var summary_html = \"\";\n var dataAccess_html = \"\";\n var GISTools_html = \"\";\n var pub_html = \"\";\n var eem_html = \"\";\n\n var tc = new dijit.layout.TabContainer({ doLayout:false,\n style: \"width:100%; height:500px; color:#000000; background-image:none; background-color:transparent;\"\n }, dojo.create(\"div\"));\n\n csvStore.fetchItemByIdentity({identity: id, onItem: function(item) {\n // retrieve information based on graphic click\n var year = csvStore.getValue(item,\"Year\");\n var project_principals = csvStore.getValue(item,\"Project Principals\");\n var cruise = csvStore.getValue(item,\"Cruise\");\n var vessel = csvStore.getValue(item,\"Vessel\");\n var months = csvStore.getValue(item,\"Cruise Dates\");\n var summary = csvStore.getValue(item,\"Summary\");\n var oe_link = csvStore.getValue(item,\"OE_Link\");\n var oe_image = csvStore.getValue(item,\"OE_Link_Image\");\n //var atlas_image = csvStore.getValue(item,\"Atlas_image\");\n var soo_link = csvStore.getValue(item, \"SOO\");\n var overview_link = csvStore.getValue(item,\"Overview\");\n var archive_link = csvStore.getValue(item,\"Archive\");\n var direct_link = csvStore.getValue(item,\"Direct\");\n var dive_link = csvStore.getValue(item,\"Dive\");\n var atlas_link = csvStore.getValue(item,\"NCDDC_Link\");\n var cruise_id = csvStore.getValue(item,\"CruiseID\");\n var gis_link = csvStore.getValue(item,\"GISMapLayers\");\n var eem = csvStore.getValue(item,\"EEM\");\n var emc = csvStore.getValue(item,\"EMC\");\n var lesson_plans = csvStore.getValue(item,\"Lesson_Plans\");\n var educ_focus = csvStore.getValue(item,\"Educ_Focus\");\n var pub_link = csvStore.getValue(item,\"Publications\");\n var metadata_link = csvStore.getValue(item,\"Metadata\");\n\n title += '<center><b>'+cruise+' - '+year+'</b></center>';\n if (vessel != undefined) {\n cruise_dates += '<b>Dates:</b>&nbsp;&nbsp;'+months+'&nbsp;&nbsp;<b>Vessel:</b>&nbsp;&nbsp;'+vessel;\n }\n else {\n cruise_dates += '<b>Dates:</b>&nbsp;&nbsp;'+months;\n }\n\n // determine contents of summary tab\n if (summary == undefined) summary_html = \"\";\n if (oe_link == undefined) {\n if (metadata_link == undefined) {\n if (project_principals != undefined) {\n if (oe_image == undefined) {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Project Principals</b><br/>'+project_principals+'<p/><b>Description</b><br/>'+summary+'</div>';\n }\n else {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Project Principals</b><br/>'+project_principals+'<p/><b>Description</b><br/>'+summary+'<p><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n }\n else {\n if (oe_image == undefined) {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Description</b><br/>'+summary+'</div>';\n }\n else {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Description</b><br/>'+summary+'<p><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n }\n }\n else {\n if (project_principals != undefined) {\n if (oe_image == undefined) {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Project Principals</b><br/>'+project_principals+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+metadata_link+'\" target=\"_new\"><u><b>Expedition Metadata</b></u></center></a></div>';\n }\n else {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Project Principals</b><br/>'+project_principals+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+metadata_link+'\" target=\"_new\"><u><b>Expedition Metadata</b></u></center></a><p><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n }\n else {\n if (oe_image == undefined) {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+metadata_link+'\" target=\"_new\"><u><b>Expedition Metadata</b></u></center></a></div>';\n }\n else {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+metadata_link+'\" target=\"_new\"><u><b>Expedition Metadata</b></u></center></a><p><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n }\n }\n }\n else {\n if (metadata_link == undefined) {\n if (project_principals != undefined) {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Project Principals</b><br/>'+project_principals+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+oe_link+'\" target=\"_new\"><u><b>Expedition Web Site</b></u></center></a><p><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n else {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+oe_link+'\" target=\"_new\"><u><b>Expedition Web Site</b></u></center></a><p/><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n }\n else {\n if (project_principals != undefined) {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p/><b>Project Principals</b><br/>'+project_principals+'<p/><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+oe_link+'\" target=\"_new\"><u><b>Expedition Web Site</b></u></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"'+metadata_link+'\" target=\"_new\"><u><b>Expedition Metadata</b></u></center></a><p/><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n else {\n summary_html += '<div class=\"OEinfoWindow\">'+cruise_dates+'<p><b>Description</b><br/>'+summary+'<p/><center><a href=\"'+oe_link+'\" target=\"_new\"><u><b>Expedition Web Site</b></u></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"'+metadata_link+'\" target=\"_new\"><u><b>Expedition Metadata</b></u></center></a><p/><center><img src=\"images/oe/'+oe_image+'\" width=\"108\" height=\"71\"></center></div>';\n }\n }\n }\n var cp1 = new dijit.layout.ContentPane({title: \"Summary\", content: summary_html});\n tc.addChild(cp1);\n\n // determine if data access tab must be added\n if ((overview_link != undefined) || (archive_link != undefined) || (direct_link != undefined) || (dive_link != undefined) || (soo_link != undefined)) {\n dataAccess_html += '<p>';\n //dataAccess_html += '<div class=\"OEinfoWindow\">Our goal is to fully document OER data collections and to make the information easily accessible. Self-service information is linked below. If you need assistance, contact the OER Information Management Team (<a href=\"mailto:[email protected]\" title=\"Email OER IMT\"><font color=\"black\"><u>[email protected]</u></a></font>).<p>';\n dataAccess_html += '<div class=\"OEinfoWindow\">Self service information is linked below. If you do not find what you are looking for, please fill out this <a href=\"javascript:SubmissionForm();\"><font color=\"red\"><u>form</u></font></a>.<p>';\n dataAccess_html += '<p/>';\n dataAccess_html += '<table class=\"smallText3\" colspan=\"2\" align=\"left\" border=\"1\">';\n if (overview_link != undefined) {\n dataAccess_html += '<tr bgcolor=\"yellow\"><td width=\"350\"><b>Cruise Summary Products</b></td><td></td></tr>';\n if (overview_link.indexOf(\"|\") != -1) {\n arrayOfCollections = overview_link.split(\"|\");\n for (var i=0;i<arrayOfCollections.length;i++) {\n arrayOfEntries = arrayOfCollections[i].split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n else {\n arrayOfEntries = overview_link.split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n } \n if (archive_link != undefined) {\n dataAccess_html += '<tr bgcolor=\"yellow\"><td width=\"350\"><b>Archived Collections</b></td><td></td></tr>';\n if (archive_link.indexOf(\"|\") != -1) {\n arrayOfCollections = archive_link.split(\"|\");\n for (var i=0;i<arrayOfCollections.length;i++) {\n arrayOfEntries = arrayOfCollections[i].split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n else {\n arrayOfEntries = archive_link.split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n if (direct_link != undefined) {\n dataAccess_html += '<tr bgcolor=\"yellow\"><td width=\"350\"><b>Selected Data Sets</b></td><td></td></tr>';\n if (direct_link.indexOf(\"|\") != -1) {\n arrayOfCollections = direct_link.split(\"|\");\n for (var i=0;i<arrayOfCollections.length;i++) {\n arrayOfEntries = arrayOfCollections[i].split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n else {\n arrayOfEntries = direct_link.split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n if (dive_link != undefined) {\n dataAccess_html += '<tr bgcolor=\"yellow\"><td width=\"350\"><b>Dive Information</b></td><td></td></tr>';\n if (dive_link.indexOf(\"|\") != -1) {\n arrayOfCollections = dive_link.split(\"|\");\n for (var i=0;i<arrayOfCollections.length;i++) {\n arrayOfEntries = arrayOfCollections[i].split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n else {\n arrayOfEntries = dive_link.split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n if (soo_link != undefined) {\n dataAccess_html += '<tr bgcolor=\"yellow\"><td width=\"350\"><b>Surveys of Opportunity</b></td><td></td></tr>';\n if (soo_link.indexOf(\"|\") != -1) {\n arrayOfCollections = soo_link.split(\"|\");\n for (var i=0;i<arrayOfCollections.length;i++) {\n arrayOfEntries = arrayOfCollections[i].split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n else {\n arrayOfEntries = soo_link.split(\";\");\n dataAccess_html += '<tr><td width=\"350\">'+arrayOfEntries[0]+'</td><td width=\"75\"><a href=\"javascript:launchDataLink(\\''+arrayOfEntries[3]+'\\')\" title=\"'+arrayOfEntries[2]+'\"><font color=\"blue\"><u>'+arrayOfEntries[1]+'</u></a></font></td></tr>';\n }\n }\n //dataAccess_html += '<tr bgcolor=\"gray\"><td width=\"350\" height=\"10\"></td><td></td></tr>';\n dataAccess_html += '</table>';\n dataAccess_html += '</div>';\n }\n if (dataAccess_html.length != 0) {\n var cp2 = new dijit.layout.ContentPane({title: \"Data Access\", content: dataAccess_html});\n tc.addChild(cp2);\n }\n\n // determine if GIS Tools tab needs to be created\n if ((atlas_link != undefined) || (gis_link != undefined)) {\n GISTools_html += '<p>';\n GISTools_html += '<div class=\"OEinfoWindow\">';\n if (navigator.appVersion.indexOf(\"MSIE\") != -1) {\n if (gis_link != undefined) {\n GISTools_html += '<table class=\"smallText3\" colspan=\"4\" align=\"left\">';\n //findMapService = gis_link.split(\";\");\n //mapService = \"&#39;\" + findMapService[1] + \"&#39;\";\n GISTools_html += '<tr><td width=\"75\"><b>Data Sets:</b></td><td></td><td></td><td width=\"100\" align=\"right\"><button dojotype=\"dijit.form.Button\" type=\"button\" name=\"add gis data\" onClick=\"plotDataToMap();showCruisePoint('+id+');\">Plot on Map</button></td></tr>';\n if (gis_link.indexOf(\"|\") != -1) {\n arrayOfGISLayers = gis_link.split(\"|\");\n for (var i=0;i<arrayOfGISLayers.length;i++) {\n arrayOfDatasets = arrayOfGISLayers[i].split(\";\");\n GISTools_html += '<tr><td align=\"right\"><input type=\"checkbox\" class=\"list_item\" id=\"'+arrayOfDatasets[2]+'\" name=\"'+arrayOfDatasets[0]+'\" value='+arrayOfDatasets[1]+'></td><td width=\"100\">'+arrayOfDatasets[0]+'</td><td align=\"left\" valign=\"center\" width=\"75\"><img src=\"images/GISsymbols/'+arrayOfDatasets[3]+'\"></td><td></td></tr>';\n }\n }\n else {\n arrayOfDatasets = gis_link.split(\";\");\n GISTools_html += '<tr><td align=\"right\"><input type=\"checkbox\" class=\"list_item\" id=\"'+arrayOfDatasets[2]+'\" name=\"'+arrayOfDatasets[0]+'\" value='+arrayOfDatasets[1]+'></td><td width=\"100\">'+arrayOfDatasets[0]+'</td><td align=\"left\" valign=\"center\" width=\"75\"><img src=\"images/GISsymbols/'+arrayOfDatasets[3]+'\"></td><td></td></tr>';\n }\n GISTools_html += '</table>';\n GISTools_html += '<p>';\n }\n if (atlas_link != undefined) {\n if (cruise.indexOf(\"AUV\") != -1) {\n GISTools_html += '<table class=\"smallText3\" colspan=\"2\" align=\"left\">';\n GISTools_html += '<tr><td width=\"250\"><b>In-depth Map:</b></td><td width=\"100\" align=\"right\"><button dojotype=\"dijit.form.Button\" type=\"button\" name=\"add map\" onClick=\"launchGoogleMap(\\''+atlas_link+'\\')\">Launch</button></td></tr>';\n GISTools_html += '</table>';\n GISTools_html += '</div>';\n }\n if (cruise.indexOf(\"Okeanos Explorer\") != -1) {\n GISTools_html += '<table class=\"smallText3\" colspan=\"2\" align=\"left\">';\n GISTools_html += '<tr><td width=\"250\"><b>In-depth Map:</b></td><td width=\"100\" align=\"right\"><button dojotype=\"dijit.form.Button\" type=\"button\" name=\"add EX map\" onClick=\"launchOEGoogleMap(\\''+atlas_link+'\\')\">Launch</button></td></tr>';\n GISTools_html += '</table>';\n }\n }\n }\n else {\n if (gis_link != undefined) {\n GISTools_html += '<table class=\"smallText3\" colspan=\"4\" align=\"left\">';\n //findMapService = gis_link.split(\";\");\n //mapService = \"&apos;\" + findMapService[1] + \"&apos;\";\n GISTools_html += '<tr><td width=\"75\"><b>Data Sets:</b></td><td></td><td></td><td width=\"100\" align=\"right\"><button dojotype=\"dijit.form.Button\" type=\"button\" name=\"add gis data\" onClick=\"plotDataToMap();showCruisePoint('+id+');\">Plot on Map</button></td></tr>';\n if (gis_link.indexOf(\"|\") != -1) {\n arrayOfGISLayers = gis_link.split(\"|\");\n for (var i=0;i<arrayOfGISLayers.length;i++) {\n arrayOfDatasets = arrayOfGISLayers[i].split(\";\");\n GISTools_html += '<tr><td align=\"right\"><input type=\"checkbox\" class=\"list_item\" id=\"'+arrayOfDatasets[2]+'\" name=\"'+arrayOfDatasets[0]+'\" value='+arrayOfDatasets[1]+'></td><td width=\"100\">'+arrayOfDatasets[0]+'</td><td align=\"left\" valign=\"center\" width=\"75\"><img src=\"images/GISsymbols/'+arrayOfDatasets[3]+'\"></td><td></td></tr>';\n }\n }\n else {\n arrayOfDatasets = gis_link.split(\";\");\n GISTools_html += '<tr><td align=\"right\"><input type=\"checkbox\" class=\"list_item\" id=\"'+arrayOfDatasets[2]+'\" name=\"'+arrayOfDatasets[0]+'\" value='+arrayOfDatasets[1]+'></td><td width=\"100\">'+arrayOfDatasets[0]+'</td><td align=\"left\" valign=\"center\" width=\"75\"><img src=\"images/GISsymbols/'+arrayOfDatasets[3]+'\"></td><td></td></tr>';\n }\n GISTools_html += '</table>';\n GISTools_html += '<p>';\n }\n if (atlas_link != undefined) {\n if (cruise.indexOf(\"AUV\") != -1) {\n GISTools_html += '<table class=\"smallText3\" colspan=\"2\" align=\"left\">';\n GISTools_html += '<tr><td width=\"250\"><b>In-depth Map:</b></td><td width=\"100\" align=\"right\"><button dojotype=\"dijit.form.Button\" type=\"button\" name=\"add map\" onClick=\"launchGoogleMap(\\''+atlas_link+'\\')\">Launch</button></td></tr>';\n GISTools_html += '</table>';\n GISTools_html += '</div>';\n }\n if (cruise.indexOf(\"Okeanos Explorer\") != -1) {\n GISTools_html += '<table class=\"smallText3\" colspan=\"2\" align=\"left\">';\n GISTools_html += '<tr><td width=\"250\"><b>In-depth Map:</b></td><td width=\"100\" align=\"right\"><button dojotype=\"dijit.form.Button\" type=\"button\" name=\"add EX map\" onClick=\"launchOEGoogleMap(\\''+atlas_link+'\\')\">Launch</button></td></tr>';\n GISTools_html += '</table>';\n }\n }\n }\n GISTools_html += '</div>';\n }\n if (GISTools_html.length != 0) {\n var cp3 = new dijit.layout.ContentPane({title: \"GIS Tools\", content: GISTools_html});\n tc.addChild(cp3);\n }\n\n // determine if Publication tab needs to be created\n if (pub_link != undefined) {\n pub_html += '<p>';\n pub_html += '<div class=\"OEinfoWindow\">The NOAA Central Library is developing a bibliography of the peer-reviewed journal articles from cruises sponsored by NOAA&apos;s Office of Ocean Exploration and Research. The publications resulting from this cruise can be found below.<p>';\n pub_html += '<table class=\"smallText3\" colspan=\"2\" align=\"left\">';\n pub_html += '<tr><td width=\"200\"><b>Find Publication:</b></td><td><a href=\"javascript:launchPublications(\\''+pub_link+'\\')\"> <u>Click to Access</u></a></td></tr>';\n pub_html += '</table></div>';\n }\n if (pub_html.length != 0) {\n var cp4 = new dijit.layout.ContentPane({title: \"Publications\", content: pub_html});\n tc.addChild(cp4);\n }\n\n // determine if Education tab needs to be created\n if ((emc != undefined) || (eem != undefined) || (lesson_plans != undefined) || (educ_focus != undefined)) {\n var iYear = parseInt(year);\n if (iYear < 2006) {\n if (emc != undefined) {\n eem_html += '<p>';\n eem_html += '<div class=\"OEinfoWindow\">';\n eem_html += 'Educators and scientists worked with NOAA to develop a series of lesson plans for students in Grades 5 - 12 that share the excitement of daily at-sea discoveries and the science behind NOAA&apos;s major ocean exploration expeditions. All lessons are correlated to the National Science Education Standards.<p>';\n eem_html += '<b>Link to the Education page for this mission:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+emc+'\\')\"><u>Click to Access</u></a>';\n }\n if (lesson_plans != undefined) {\n eem_html += '<p>';\n eem_html += '<b>Link to Lesson Plans for Grades 5-12 in this EEM:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+lesson_plans+'\\')\"><u>Click to Access</u></a>';\n eem_html += '<p>';\n }\n if (educ_focus != undefined) {\n eem_html += '<p>';\n eem_html += 'For additional information and lessons about deep-sea ecology in the Gulf of Mexico, see <b>Lessons from the Deep: Exploring the Gulf of Mexico\\'s Deep-Sea Ecosystems Education Materials Collection (EMC).</b><p>';\n eem_html += '<b>Link to Gulf of Mexico EMC:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+educ_focus+'\\')\"><u>Click to Access</u></a>';\n }\n eem_html += '</div>';\n }\n else {\n if (cruise.indexOf(\"Okeanos Explorer\") != -1) {\n eem_html += '<div class=\"OEinfoWindow\">';\n if (eem != undefined) {\n eem_html += '<b>Ocean Explorer Expedition Education Modules (EEM)</b> are education resources that share the excitement of daily at-sea discoveries and the science behind NOAA\\'s major ocean exploration expeditions. Each module includes background information about the expedition, lesson plans, Multimedia Discovery Missions, OceanAGE Career Connections, and a list of additional resources and links.<p>';\n eem_html += '<b>Link to EEM:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+eem+'\\')\"><u>Click to Access</u></a>';\n eem_html += '<p>';\n }\n if (lesson_plans != undefined) {\n eem_html += '<p>';\n eem_html += '<b>Link to Lesson Plans for Grades 5-12 in this EEM:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+lesson_plans+'\\')\"><u>Click to Access</u></a>';\n eem_html += '<p>';\n }\n if (emc != undefined) {\n eem_html += '<b>The <i>Okeanos Explorer</i> Education Materials Collection (EMC)</b> was developed to encourage educators and students to become personally involved with the voyages and discoveries of the <i>Okeanos Explorer</i>. This collection of standards-based lessons, activities, and background information is being presented in two volumes: Volume 1: Why Do We Explore?, Volume 2: How Do We Explore?<p>';\n eem_html += '<b>Link to <i>Okeanos Explorer</i> EMC:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+emc+'\\')\"><u>Click to Access</u></a>';\n eem_html += '<p>';\n }\n if (educ_focus != undefined) {\n eem_html += 'For additional information and lessons about deep-sea ecology in the Gulf of Mexico, see <b>Lessons from the Deep: Exploring the Gulf of Mexico\\'s Deep-Sea Ecosystems Education Materials Collection (EMC).</b><p>';\n eem_html += '<b>Link to Gulf of Mexico EMC:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+educ_focus+'\\')\"><u>Click to Access</u></a>';\n }\n eem_html += '</div>';\n }\n else {\n eem_html += '<div class=\"OEinfoWindow\">';\n if (eem != undefined) {\n eem_html += '<b>Ocean Explorer Expedition Education Modules (EEM)</b> are education resources that share the excitement of daily at-sea discoveries and the science behind NOAA\\'s major ocean exploration expeditions. Each module includes background information about the expedition, lesson plans, Multimedia Discovery Missions, OceanAGE Career Connections, and a list of additional resources and links.<p>';\n eem_html += '<b>Link to EEM:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+eem+'\\')\"> <u>Click to Access</u></a>';\n }\n if (lesson_plans != undefined) {\n eem_html += '<p>';\n eem_html += '<b>Link to Lesson Plans for Grades 5-12 in this EEM:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+lesson_plans+'\\')\"><u>Click to Access</u></a>';\n }\n if (educ_focus != undefined) {\n eem_html += '<p>';\n eem_html += 'For additional information and lessons about deep-sea ecology in the Gulf of Mexico, see <b>Lessons from the Deep: Exploring the Gulf of Mexico\\'s Deep-Sea Ecosystems Education Materials Collection (EMC).</b><p>';\n eem_html += '<b>Link to Gulf of Mexico EMC:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+educ_focus+'\\')\"><u>Click to Access</u></a>';\n }\n if (emc != undefined) {\n eem_html += '<p>';\n eem_html += 'Educators and scientists worked with NOAA to develop a series of lesson plans for students in Grades 5 - 12 that share the excitement of daily at-sea discoveries and the science behind NOAA&apos;s major ocean exploration expeditions. All lessons are correlated to the National Science Education Standards.<p>';\n eem_html += '<b>Link to the Education page for this mission:</b>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:launchEEM(\\''+emc+'\\')\"><u>Click to Access</u></a>';\n }\n eem_html += '</div>';\n }\n }\n }\n\n if (eem_html.length != 0) {\n var cp5 = new dijit.layout.ContentPane({title: \"Education\", content: eem_html});\n tc.addChild(cp5);\n }\n tc.domNode;\n }\n });\n dojo.some(dataLayer.graphics, function(graphic) {\n if (graphic.attributes.id === id) {\n selectedCruise = graphic;\n }\n });\n // remove any previously plotted GIS layers\n var layersOnMap = map.layerIds.length;\n if (layersOnMap > 1) {\n map.removeAllLayers();\n map.addLayer(basemap);\n map.addLayer(basemapReference);\n map.addLayer(hoverTextLayer);\n map.addLayer(highlightLayer);\n map.addLayer(dataLayer);\n map.addLayer(listHighlightLayer);\n }\n if (hoverTextLayer != undefined) hoverTextLayer.clear();\n if (highlightLayer != undefined) highlightLayer.clear();\n if (listHighlightLayer != undefined) listHighlightLayer.clear();\n map.infoWindow.hide();\n // must calculate an offset in x and y in order for the infoWindow to popup within the map\n var xPt = selectedCruise.geometry.x + 1250000;\n var yPt = selectedCruise.geometry.y + 750000;\n //alert(\"xPt: \" + xPt + \" yPt: \" + yPt);\n var newCenterPoint = new esri.geometry.Point(xPt, yPt, new esri.SpatialReference({wkid: 3857}));\n map.centerAndZoom(newCenterPoint, 5);\n var sp = map.toScreen(selectedCruise.geometry);\n map.infoWindow.resize(475,400);\n map.infoWindow.setTitle(title);\n map.infoWindow.setContent(tc.domNode);\n map.infoWindow.setFixedAnchor(esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT);\n map.infoWindow.show(selectedCruise.geometry, esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT);\n }", "function updateMainDataTable(currDataCell){\n $(\"#main_data_content\")\n .append($(\"<tr/>\")\n .append($(\"<td/>\", {text: currDataCell.Name}))\n .append($(\"<td/>\", {text: currDataCell.Title}))\n .append($(\"<td/>\", {text: currDataCell.Remuneration}))\n .append($(\"<td/>\", {text: currDataCell.Department}))\n .append($(\"<td/>\", {text: currDataCell.Expenses})));\n }", "function inline_collect_data(formname, data, rowindex) {\n\n // Retain the original record ID\n var rows = data['data'];\n var original = rows[rowindex];\n var row = {};\n if (typeof original != 'undefined') {\n var record_id = original['_id'];\n if (typeof record_id != 'undefined') {\n row['_id'] = record_id;\n }\n }\n\n // Collect the input data\n var fields = data['fields'];\n var fieldname;\n var element;\n var value;\n for (var i=0; i<fields.length; i++) {\n fieldname = fields[i]['name'];\n element = '#sub_' +\n formname + '_' + formname + '_' +\n fieldname + '_edit_' + rowindex;\n value = $(element).val();\n row[fieldname] = value;\n }\n\n // Add the defaults\n var defaults = data['defaults'];\n for (fieldname in defaults) {\n if (!row.hasOwnProperty(fieldname)) {\n value = defaults[fieldname]['value'];\n row[fieldname] = value;\n }\n }\n\n // Return the row object\n return row;\n }", "function loadExistingData() {\n existingData = lbs.limeDataConnection.ActiveInspector.Controls.GetValue('creditinfo')\n if (existingData) {\n existingData = lbs.loader.xmlToJSON(existingData, 'creditdata');\n if (moment().diff(existingData.creditdata.ratingData.ratingDate, 'days') < self.config.maxAge) {\n viewModel.ratingValue(existingData.creditdata.ratingData.ratingValue);\n viewModel.ratingText(existingData.creditdata.ratingData.ratingText);\n viewModel.ratingDate(existingData.creditdata.ratingData.ratingDate);\n }\n }else if(viewModel.inline){\n existingData = viewModel.inline;\n viewModel.ratingValue('?');\n viewModel.ratingText('Ingen kreditrating tagen');\n viewModel.loadText('Ta kreditkontroll');\n }\n }", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "scopeOfWorkPopulate(){\n \n $.each(proposal_data.scope_of_work, function(section_index, section){\n \n // Create the section from the template\n var new_section = $('#scope-of-work-template .scope-of-work-section').clone();\n var new_section_tbody = new_section.find('tbody');\n var new_section_tr_template = new_section_tbody.find('tr');\n \n // Sets the section title\n new_section.find('.scope-of-work-section-title').html(section['section-title']);\n \n $.each( section['section-items'], function( index, item ){\n var new_section_tr = new_section_tr_template.clone();\n var _item = $('<div>'+item+'</div>');\n _item.find('[style]').removeAttr('style');\n // Sets the section items\n new_section_tr.find('.scope-of-work-item').html( _item.html() );\n // Adds to the tbody\n new_section_tbody.append(new_section_tr);\n } );\n // Prepends the scope of work to the table\n $('#scope-of-work').append(new_section);\n \n // Remove the template\n new_section_tr_template.remove();\n \n });\n \n }", "function populateCourse() {\r\n// Empty content string\r\n var tableContent = '';\r\n var query = {};\r\n var year;\r\n var deptID;\r\n year = $('#course-year').val();\r\n deptID = $('#course-dept').val();\r\n console.log('deptID:' + deptID);\r\n console.log('year:' + year);\r\n\r\n if (year !== 'all') {\r\n var yearQuery = {'offer.year': year};\r\n $.extend(query, yearQuery);\r\n }\r\n if (deptID !== 'all' && deptID !== null) {\r\n\r\n var deptQuery = {'dept.deptID': deptID};\r\n $.extend(query, deptQuery);\r\n\r\n }\r\n var url = '/courses/courselist';\r\n $.ajax({\r\n type: 'POST',\r\n data: query,\r\n url: url,\r\n dataType: 'JSON'\r\n }).done(function (data) {\r\n couseListData = data;\r\n $.each(data, function () {\r\n var thisID = this._id;\r\n var courseID = this.courseid;\r\n tableContent += '<tr>';\r\n tableContent += '<td><a href=\"#\" class=\"linkshowuser\" rel=\"' + this._id + '\" title=\"Show Details\">' + this.courseid + '</a></td>';\r\n tableContent += '<td>' + this.title + '</td>';\r\n tableContent += '<td>' + this.level + '</td>';\r\n tableContent += '<td>' + this.dept.deptName + '</td>';\r\n tableContent += '<td><a href=\"#\" class=\"courseUpdate\" rel=\"' + thisID + '\"><span class=\"glyphicon glyphicon-pencil\" aria-hidden=\"true\"></span> Edit</a></td>';\r\n tableContent += '<td><a href=\"#\" class=\"courseDelete\" rel=\"' + thisID + '\"><span class=\"glyphicon glyphicon-trash\" aria-hidden=\"true\"></span> Delete</a></td>';\r\n tableContent += '<td><a href=\"#\" class=\"courseEnroll\" data-dept-name=\"' + this.dept.deptName + '\" data-dept-id=\"' + this.dept.deptID + '\" data-obj-id=\"' + thisID + '\" data-courseID=\"' + courseID + '\"><span class=\"glyphicon glyphicon-plus-sign\" aria-hidden=\"true\"></span> Add year</a></td>';\r\n var offerCount = 0;\r\n var thisTitle = this.title;\r\n var thisDeptID = this.dept.deptID;\r\n var thisDeptName = this.dept.deptName;\r\n\r\n $.each(this.offer, function () {\r\n var thisOffer = [];\r\n thisOffer = this;\r\n var enrolledStudent;\r\n enrolledStudent = 0;\r\n if (thisOffer.enrolled) {\r\n enrolledStudent = thisOffer.enrolled.length;\r\n }\r\n ;\r\n\r\n if (thisOffer.year === year || $('#course-year').val() === 'all') {\r\n if (offerCount > 0) {\r\n tableContent += '</tr><tr><td colspan=\"7\"></td>';\r\n }\r\n tableContent += '<td>' + thisOffer.year + '</td>';\r\n tableContent += '<td><a href=\"#\" class=\"studentEnrolled overlayLink\" data-overlay=\"studentEnrolled\" data-offer-year=\"' + thisOffer.year + '\" data-id=\"' + courseID + '\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>' + enrolledStudent + '</a></td>';\r\n\r\n var availablePercent = parseInt(((thisOffer.classSize - thisOffer.available) / thisOffer.classSize) * 100);\r\n var progressCSS = \"success\";\r\n if (availablePercent > 75) {\r\n progressCSS = \"warning\";\r\n } else if (availablePercent > 90) {\r\n progressCSS = \"danger\";\r\n }\r\n tableContent += '<td><div class=\"progress\">';\r\n tableContent += '<div class=\"progress-bar progress-bar-' + progressCSS + '\" style=\"width: ' + availablePercent + '%\" aria-valuenow=\"' + (thisOffer.classSize - thisOffer.available) + '\" aria-valuemin=\"0\" aria-valuemax=\"' + thisOffer.classSize + '\"></div></div>';\r\n tableContent += '<div>' + thisOffer.available + '/' + thisOffer.classSize + '</div></td>';\r\n tableContent += '<td><a href=\"#\" class=\"courseUpdate\" data-offer-year=\"' + thisOffer.year + '\" rel=\"' + thisID + '\"><span class=\"glyphicon glyphicon-pencil\" aria-hidden=\"true\"></span> Edit</a></td>';\r\n tableContent += '<td><a href=\"#\" class=\"courseDelete\" data-offer-year=\"' + thisOffer.year + '\" rel=\"' + thisID + '\"><span class=\"glyphicon glyphicon-trash\" aria-hidden=\"true\"></span> Delete</a></td>';\r\n tableContent += '<td><a href=\"#\" class=\"courseEnroll\" data-course-title=\"' + thisTitle + '\" data-offer-year=\"' + thisOffer.year + '\" data-dept-name=\"' + thisDeptName + '\" data-dept-id=\"' + thisDeptID + '\" data-obj-id=\"' + thisID + '\" data-courseID=\"' + courseID + '\"><span class=\"glyphicon glyphicon-plus-sign\" aria-hidden=\"true\"></span> Enroll</a></td>';\r\n offerCount++;\r\n }\r\n });\r\n tableContent += '</tr>';\r\n });\r\n $('#courseList table tbody').html(tableContent);\r\n });\r\n}", "function addContent(id){\n \n document.getElementById('InBigDivision').style.display=\"block\";\n \n/**** This method will call the data from JSON file */\n $.getJSON('JS/plantsData.json',data =>{\n $(document).ready(function(){\n \n let info = document.getElementById('contentInfoID');\n let name = document.getElementById('headContent');\n let type = document.getElementById('contentTypeID');\n let i = 0\n \n while(i<data.plants.length){\n if(id == i){\n console.log(data.plants[i].name + \"id number:\" + id);\n info.innerHTML = data.plants[i].information + `<input type=\"button\" value=\"Hide\" name='Hide' onclick=\"removeRow()\" />`;\n name.innerHTML = data.plants[i].name;\n type.innerHTML = data.plants[i].type;\n document.getElementById('imgID').setAttribute(\"src\",data.plants[i].image);\n \n }\n \n i++;\n \n }\n \n }); \n \n });\n\n\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // for google chrome\n\n\n}", "function renderAdminCourselist(data_url,add_url,edit_url,del_url) {\r\n\r\n data_url = \"../php/admin_course.php\";\r\n add_url = \"../php/add_course.php\";\r\n edit_url = \"../php/update_course.php\";\r\n del_url = \"../php/del_course.php\";\r\n\r\n\r\n var namelist = [\"ctitle\",\"cid\",\"days\",\"weeks\",\"cover\",\"home\",\"syl\",\"mod\"];\r\n var typelist = [\"text\",\"number\",\"text\",\"number\",\"file\",\"file\",\"file\",\"file\"];\r\n var classlist = [\"text\",\"number\",\"text\",\"number\",\"file\",\"file\",\"file\",\"file\"];\r\n\r\n loadDataCourseList(data_url);\r\n function loadDataCourseList(data_url) {\r\n let xmlHttp = new XMLHttpRequest();\r\n xmlHttp.onreadystatechange = function () {\r\n if (xmlHttp.readyState===4 && xmlHttp.status===200)\r\n {\r\n let data=xmlHttp.responseText;\r\n console.log(data);\r\n data = JSON.parse(data);\r\n createCourseList(data);\r\n }\r\n }\r\n xmlHttp.open(\"GET\",data_url+\"?action=get_course_list\",true);\r\n xmlHttp.send();\r\n }\r\n function createCourseList(data) {\r\n /*data json*/\r\n for(var i in data){\r\n if(data.hasOwnProperty(i)){\r\n let course = data[i];\r\n let clname = course.ctitle;\r\n let cluid = course.cid;\r\n let cldays = course.weekdays;\r\n let clweeks = course.end;\r\n let clcover = course.cover_url;\r\n let clhome = course.home_url;\r\n let clsyl = course.syllabus_url;\r\n let clmod = course.modles_url;\r\n let clquiz = course.quiz;/*link*/\r\n\r\n let course_list = [];\r\n course_list.push(\"\" +\r\n \"<tr id=\\\"\"+cluid+\"-row\\\">\\n\" +\r\n \" <th class=\\\"course-name text-sm my-editable my-editable-text\\\">\" +\r\n clname +\r\n \" </th>\\n\" +\r\n \" <td class=\\\"course-id my-editable my-editable-text\\\">\" +\r\n cluid +\r\n \" </td>\" +\r\n \" <td class=\\\"course-days my-editable my-editable-text\\\">\" +\r\n cldays +\r\n \" </td>\" +\r\n \" <td class=\\\"course-weeks my-editable my-editable-text\\\">\" +\r\n clweeks +\r\n \" </td>\" +\r\n \" <td class=\\\"cover my-editable my-editable-file\\\">\" +\r\n clcover +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"home my-editable my-editable-file\\\">\" +\r\n clhome +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"syllabus my-editable my-editable-file\\\">\" +\r\n clsyl +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"modules my-editable my-editable-file\\\">\" +\r\n clmod +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"quiz\\\">\\n\" +\r\n \" <a href=\\\"Admin_Course_Quiz.html\\\" id=\\\"c\"+cluid+\"\\\">link</a>\\n\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"edit-container\\\" style=\\\"width: 15rem\\\">\\n\" +\r\n \" <button id=\\\"\"+cluid+\"-edt-btn\\\" type=\\\"button\\\" class=\\\"btn btn-sm bg-blue px-3 text-white my-edt-btn\\\">Edit</button>\\n\" +\r\n \" <button id=\\\"\"+cluid+\"-del-btn\\\" type=\\\"button\\\" class=\\\"btn btn-sm bg-red px-3 text-white my-del-btn\\\">Delete</button>\\n\" +\r\n \" </td>\\n\" +\r\n \"</tr>\");\r\n $(\"#course-list-add-btn-row\").before(course_list);\r\n $(\".quiz a\").on('click',function () {\r\n setCookie('cid',this.id.slice(1));\r\n });\r\n }\r\n }\r\n\r\n /*全局设定*/\r\n $(\"#course-list-form .my-edt-btn\").on(\"click\",function () {\r\n let id = this.id.slice(0,-8);\r\n console.log(id);\r\n if($(this).html()===\"Edit\"){\r\n $(\"#\"+id+\"-row .my-editable\").each(function (i) {\r\n var value = $(this).html();\r\n $(this).html(\"\" +\r\n \"<input type='\"+typelist[i]+\"' name=\\\"\"+ namelist[i] +\"\\\" class=\"+classlist[i]+\" value=\"+ value +\" required='required'>\"\r\n );\r\n });\r\n $(\"#\"+id+\"-row input[name='days']\").attr(\"pattern\",\"([1-9]\\\\d*,)*[1-9]\\\\d*\");\r\n $(\"#\"+id+\"-row input[name='ctitle']\").attr(\"readonly\",true);\r\n $(\"#\"+id+\"-row input[name='cid']\").attr(\"readonly\",true);\r\n $(\"#\"+id+\"-row .my-del-btn\").hide();\r\n $(this).html(\"Save\").toggleClass(\"bg-orange\");\r\n }\r\n else {\r\n if(!validForm(\"course-list-form\")){\r\n alert(\"Please complete the form\");\r\n return;\r\n }\r\n let fd = new FormData();\r\n fd.append(\"uid\",getCookie(\"uid\"));\r\n $.each($(\"#\"+id+\"-row .my-editable.my-editable-text\"), function (i, item) {\r\n let input = item.children[0];\r\n fd.append(input.getAttribute(\"name\"),input.value);\r\n });\r\n $.each($(\"#\"+id+\"-row .my-editable.my-editable-file\"), function (i, item) {\r\n let input = item.children[0];\r\n fd.append(input.getAttribute(\"name\"),input.files[0]);\r\n // console.log(input.value);\r\n });\r\n $.ajax({\r\n url:edit_url+\"?action=edit_course_list\",\r\n type:\"POST\",\r\n processData: false,\r\n contentType: false,\r\n data: fd,\r\n success:function(data){\r\n alert(\"success\");\r\n $.each($(\"#\"+id+\"-row .my-editable\"), function (i, item) {\r\n let input = item.children[0];\r\n item.innerHTML=(input.value);\r\n });\r\n $(\"#\"+id+\"-row .my-edt-btn\").html(\"Edit\").toggleClass(\"bg-orange\");\r\n $(\"#\"+id+\"-row .my-del-btn\").show();\r\n console.log(data);\r\n console.log(\"submited\");\r\n },\r\n error:function(){\r\n alert(\"Connection error, item cannot be update ,please try again later\");\r\n }\r\n });\r\n console.log(fd);\r\n }\r\n });\r\n $(\"#course-list-form .my-del-btn\").on(\"click\",function () {\r\n let id = this.id.slice(0,-8);\r\n console.log(\"deleting \"+id);\r\n $.ajax({\r\n url:del_url+\"?action=delete_course_list&cid=\"+id,\r\n type:\"GET\",\r\n success:function(data){\r\n alert(\"success\");\r\n $(\"#\"+id+\"-row\").remove();\r\n console.log(data);\r\n console.log(\"submited\");\r\n },\r\n error:function(){\r\n alert(\"Connection error, item cannot be deleted, please try again later\");\r\n }\r\n });\r\n });\r\n $(\"#course-list-add-btn\").on(\"click\",function () {\r\n if(!validForm(\"course-list-form\")){\r\n alert(\"Please complete the form first\");\r\n return;\r\n }\r\n $(\"#course-list-add-btn-row\").before(\"\" +\r\n \"<tr id=\\\"new-row\\\">\\n\" +\r\n \" <th class=\\\"course-name text-sm my-editable my-editable-text\\\">\\n\" +\r\n \" <input type=\\\"text\\\" name=\\\"ctitle\\\" class=\\\"text\\\" required='required'>\\n\" +\r\n \" </th>\\n\" +\r\n \" <td class=\\\"course-id my-editable my-editable-text\\\">\\n\" +\r\n \" <input type=\\\"number\\\" name=\\\"cid\\\" class=\\\"text\\\" required='required'>\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"course-days my-editable my-editable-text\\\">\" +\r\n \" <input type=\\\"text\\\" name=\\\"days\\\" class=\\\"text\\\" required='required' pattern='([1-9]\\\\d*,)*[1-9]\\\\d*'>\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"course-weeks my-editable my-editable-text\\\">\" +\r\n \" <input type=\\\"number\\\" name=\\\"weeks\\\" class=\\\"text\\\" required='required'>\" +\r\n \" </td>\"+\r\n \" <td class=\\\"cover my-editable my-editable-file\\\">\\n\" +\r\n \" <input type=\\\"file\\\" name=\\\"cover\\\" class=\\\"file\\\" required='required'>\\n\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"home my-editable my-editable-file\\\">\\n\" +\r\n \" <input type=\\\"file\\\" name=\\\"home\\\" class=\\\"file\\\" required='required'>\\n\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"syllabus my-editable my-editable-file\\\">\\n\" +\r\n \" <input type=\\\"file\\\" name=\\\"syl\\\" class=\\\"file\\\" required='required'>\\n\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"modules my-editable my-editable-file\\\">\\n\" +\r\n \" <input type=\\\"file\\\" name=\\\"mod\\\" class=\\\"file\\\" required='required'>\\n\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"quiz\\\">\\n\" +\r\n \" <a href=\\\"Admin_Course_Quiz.html\\\">link</a>\\n\" +\r\n \" </td>\\n\" +\r\n \" <td class=\\\"edit-container\\\" style=\\\"width: 15rem\\\">\\n\" +\r\n \" <button id=\\\"new-edt-btn\\\" type=\\\"button\\\" class=\\\"btn btn-sm bg-blue px-3 text-white my-edt-btn bg-orange\\\">Save</button>\\n\" +\r\n \" <button id=\\\"new-del-btn\\\" type=\\\"button\\\" class=\\\"btn btn-sm bg-red px-3 text-white my-del-btn\\\" style=\\\"display: none;\\\">Delete</button>\\n\" +\r\n \" </td>\\n\" +\r\n \"</tr>\");\r\n let newRow = $(\"#new-row\");\r\n let newSaveBtn = $(\"#new-edt-btn\");\r\n let id = \"new\";\r\n $(\"#\"+id+\"-del-btn\").on(\"click\",function () {\r\n let id = this.id.slice(0,-8);\r\n console.log(\"deleting \"+id);\r\n $.ajax({\r\n url:del_url+\"?action=delete_course_list&cid=\"+id,\r\n type:\"GET\",\r\n success:function(data){\r\n alert(\"success\");\r\n $(\"#\"+id+\"-row\").remove();\r\n console.log(data);\r\n console.log(\"submited\");\r\n },\r\n error:function(){\r\n alert(\"Connection error, item cannot be deleted, please try again later\");\r\n }\r\n });\r\n });\r\n $(\"#\"+id+\"-edt-btn\").on(\"click\",function () {\r\n id = newRow.find(\"[name='cid']\")[0].value;\r\n console.log(id);\r\n newRow.attr(\"id\",\"\"+id+\"-row\");\r\n $(this).attr(\"id\",\"\"+id+\"-edt-btn\");\r\n $(this).next().attr(\"id\",\"\"+id+\"-del-btn\");\r\n console.log(\"asdasdasd\");\r\n {\r\n let id = this.id.slice(0,-8);\r\n console.log(id);\r\n if($(this).html()===\"Edit\"){\r\n $(\"#\"+id+\"-row .my-editable\").each(function (i) {\r\n var value = $(this).html();\r\n $(this).html(\"\" +\r\n \"<input type='\"+typelist[i]+\"' name=\\\"\"+ namelist[i] +\"\\\" class=\"+classlist[i]+\" value=\"+ value +\" required='required'>\"\r\n // \"<input type='\"+typelist[i]+\"' name=\\\"\"+ namelist[i] +\"\\\" class=\"+classlist[i]+\" value=\"+ value +\">\"\r\n );\r\n });\r\n $(\"#\"+id+\"-row input[name='days']\").attr(\"pattern\",\"([1-9]\\\\d*,)*[1-9]\\\\d*\");\r\n $(\"#\"+id+\"-row input[name='ctitle']\").attr(\"readonly\",true);\r\n $(\"#\"+id+\"-row input[name='cid']\").attr(\"readonly\",true);\r\n $(\"#\"+id+\"-row .my-del-btn\").hide();\r\n $(this).html(\"Save\").toggleClass(\"bg-orange\");\r\n }\r\n else {\r\n if(!validForm(\"course-list-form\")){\r\n alert(\"Please complete the form\");\r\n return;\r\n }\r\n let fd = new FormData();\r\n fd.append(\"uid\",getCookie(\"uid\"));\r\n $.each($(\"#\"+id+\"-row .my-editable.my-editable-text\"), function (i, item) {\r\n let input = item.children[0];\r\n fd.append(input.getAttribute(\"name\"),input.value);\r\n });\r\n $.each($(\"#\"+id+\"-row .my-editable.my-editable-file\"), function (i, item) {\r\n let input = item.children[0];\r\n fd.append(input.getAttribute(\"name\"),input.files[0]);\r\n // console.log(input.value);\r\n });\r\n\r\n $.ajax({\r\n url:add_url+\"?action=add_course_list\",\r\n type:\"POST\",\r\n processData: false,\r\n contentType: false,\r\n data: fd,\r\n success:function(data){\r\n alert(\"success\");\r\n $.each($(\"#\"+id+\"-row .my-editable\"), function (i, item) {\r\n let input = item.children[0];\r\n item.innerHTML=(input.value);\r\n });\r\n $(\"#\"+id+\"-row .my-edt-btn\").html(\"Edit\").toggleClass(\"bg-orange\");\r\n $(\"#\"+id+\"-row .my-del-btn\").show();\r\n console.log(data);\r\n console.log(\"submited\");\r\n },\r\n error:function(){\r\n alert(\"Connection error, item cannot be update ,please try again later\");\r\n }\r\n });\r\n console.log(fd);\r\n }\r\n }\r\n $(\"#\"+id+\"-edt-btn\").off(\"click\");\r\n $(\"#\"+id+\"-edt-btn\").on(\"click\",function () {\r\n let id = this.id.slice(0,-8);\r\n console.log(id);\r\n if($(this).html()===\"Edit\"){\r\n $(\"#\"+id+\"-row .my-editable\").each(function (i) {\r\n var value = $(this).html();\r\n $(this).html(\"\" +\r\n \"<input type='\"+typelist[i]+\"' name=\\\"\"+ namelist[i] +\"\\\" class=\"+classlist[i]+\" value=\"+ value +\" required='required'>\"\r\n );\r\n });\r\n $(\"#\"+id+\"-row input[name='days']\").attr(\"pattern\",\"([1-9]\\\\d*,)*[1-9]\\\\d*\");\r\n $(\"#\"+id+\"-row input[name='ctitle']\").attr(\"readonly\",true);\r\n $(\"#\"+id+\"-row input[name='cid']\").attr(\"readonly\",true);\r\n $(\"#\"+id+\"-row .my-del-btn\").hide();\r\n $(this).html(\"Save\").toggleClass(\"bg-orange\");\r\n }\r\n else {\r\n if(!validForm(\"course-list-form\")){\r\n alert(\"Please complete the form\");\r\n return;\r\n }\r\n let fd = new FormData();\r\n fd.append(\"uid\",getCookie(\"uid\"));\r\n $.each($(\"#\"+id+\"-row .my-editable.my-editable-text\"), function (i, item) {\r\n let input = item.children[0];\r\n fd.append(input.getAttribute(\"name\"),input.value);\r\n });\r\n $.each($(\"#\"+id+\"-row .my-editable.my-editable-file\"), function (i, item) {\r\n let input = item.children[0];\r\n fd.append(input.getAttribute(\"name\"),input.files[0]);\r\n // console.log(input.value);\r\n });\r\n $.ajax({\r\n url:edit_url+\"?action=edit_course_list\",\r\n type:\"POST\",\r\n processData: false,\r\n contentType: false,\r\n data: fd,\r\n success:function(data){\r\n alert(\"success\");\r\n $.each($(\"#\"+id+\"-row .my-editable\"), function (i, item) {\r\n let input = item.children[0];\r\n item.innerHTML=(input.value);\r\n });\r\n $(\"#\"+id+\"-row .my-edt-btn\").html(\"Edit\").toggleClass(\"bg-orange\");\r\n $(\"#\"+id+\"-row .my-del-btn\").show();\r\n console.log(data);\r\n console.log(\"submited\");\r\n },\r\n error:function(){\r\n alert(\"Connection error, item cannot be update ,please try again later\");\r\n }\r\n });\r\n console.log(fd);\r\n }\r\n });\r\n $(\"#\"+id+\"-del-btn\").on(\"click\",function () {\r\n let id = this.id.slice(0,-8);\r\n console.log(\"deleting \"+id);\r\n $.ajax({\r\n url:del_url+\"?action=delete_course_list&cid=\"+id,\r\n type:\"GET\",\r\n success:function(data){\r\n alert(\"success\");\r\n $(\"#\"+id+\"-row\").remove();\r\n console.log(data);\r\n console.log(\"submited\");\r\n },\r\n error:function(){\r\n alert(\"Connection error, item cannot be deleted, please try again later\");\r\n }\r\n });\r\n });\r\n });\r\n\r\n });\r\n $(\".quiz a\").on('click',function () {\r\n // alert(this.id);\r\n setCookie('cid',this.id.slice(1));\r\n });\r\n }\r\n}", "function loadData() {\n\tvar camlQuery = new SP.CamlQuery();\n\t\n\tvar query = '<View><Query><OrderBy><FieldRef Name=\"Created\" Ascending=\"False\"></FieldRef></OrderBy></Query>'+\n\t\t\t\t'<ViewFields><FieldRef Name=\"SprintProgress\"/></ViewFields><RowLimit>'+ sprintHistoryLimit +'</RowLimit></view>';\n\tcamlQuery.set_viewXml(query);\n\tcollListItem = listReference.getItems(camlQuery);\n\n\tclientContext.load(collListItem);\n\tclientContext.executeQueryAsync(\n\tFunction.createDelegate(this, this.pageInit),\n\tFunction.createDelegate(this, this.showDataError));\n}", "function loadTable(list) {\n let len = list.length;\n // let Sr = 1;\n // console.log(list);\n workstepTablebody.empty();\n\n // let rows = list.map((ob, index) => {\n // let action= `<button class=\"btn btn-sm btn-outline-light setdata\" data-toggle=\"modal\" data-target=\"#viewModalCenter\" data-workstep-id='${ob.workstep_id}' data-row-id='${ob.row_id}'> <i class=\"fa fa-upload\"></i>\n // </button>`\n // // console.log(ob);\n // let row = [\n // (index + 1),\n // ob.process_description,\n // ob.sub_process_description,\n // ob.risk_description,\n // ob.risklevel, \n // ob.control_description, \n // ob.control_objectives,\n // ob.step_description,\n // ob.observations,\n // ob.root_cause,\n // ob.recommendation,\n // ob.management_action_plan,\n // ob.timeline_for_action_plan,\n // ob.responsibility_for_implementation,\n // ob.files,\n // action];\n // return row;\n // });\n\n // myTable.DataTable({\n // data: rows,\n // scrollY: '50vh',\n // scrollX: true\n\n // });\n\n\n for (let i = 0; i < len; i++) {\n let row = $(` <tr>\n <td class=\"content\">${list[i].row_id}</td>\n <td style=\"width:100px \">${list[i].process_description}</td>\n <td style=\"width:376px !important;\">${list[i].sub_process_description}</td>\n <td style=\"width:414px\">${list[i].risk_description}</td>\n <td>${list[i].risklevel}</td>\n <td style=\"width:363px\">${list[i].control_description}</td>\n <td>${list[i].control_objectives}</td>\n <td class=\"content\">${list[i].step_description}</td>\n <td contenteditable=\"true\" class=\"observations\">${list[i].observations}</td>\n <td contenteditable=\"true\" class=\"root-cause\">${list[i].root_cause}</td>\n <td contenteditable=\"true\" class=\"recommendation\">${list[i].recommendation}</td>\n <td contenteditable=\"true\" class=\"management-action-plan\">${list[i].management_action_plan}</td>\n <td class=\"date\" style=\"width:100px\"> <input class=\"timeline-for-action-plan\" value=\"${list[i].timeline_for_action_plan}\"/> </td>\n <td contenteditable=\"true\" class=\"responsibility-for-implementation\">${list[i].responsibility_for_implementation}</td>\n <td class=\"files\">${list[i].files}</td>\n <td style=\"width:38px\">\n <button class=\"btn btn-sm btn-outline-light setdata\" data-toggle=\"modal\" data-target=\"#viewModalCenter\" data-workstep-id='${list[i].workstep_id}' data-row-id='${list[i].row_id}'> \n <i class=\"fa fa-upload\"></i>\n </button>\n </td>\n </tr>`);\n\n\n\n\n // appending rows \n // TOTALROWS=row;\n workstepTablebody.append(row);\n\n let uploadFile = row.find('.uploadfile');\n uploadFile.data(\"id\", list[i].row_id);\n uploadFile.click(uploadFileKey);\n\n\n let observationsText = row.find('.observations');\n observationsText.data(\"id\", list[i].row_id);\n observationsText.data(\"item_key\", 'observations');\n observationsText.keyup(cellKeyUP);\n\n let rootCause = row.find('.root-cause');\n rootCause.data(\"id\", list[i].row_id);\n rootCause.data(\"item_key\", 'root_cause');\n rootCause.keyup(cellKeyUP);\n\n let recommendation = row.find('.recommendation');\n recommendation.data(\"id\", list[i].row_id);\n recommendation.data(\"item_key\", 'recommendation');\n recommendation.keyup(cellKeyUP);\n\n let managementActionPlan = row.find('.management-action-plan');\n managementActionPlan.data(\"id\", list[i].row_id);\n managementActionPlan.data(\"item_key\", 'management_action_plan');\n managementActionPlan.keyup(cellKeyUP);\n\n let timelineForactionplan = row.find('.timeline-for-action-plan');\n timelineForactionplan.data(\"id\", list[i].row_id);\n timelineForactionplan.data(\"item_key\", 'timeline_for_action_plan');\n timelineForactionplan.blur(onChange);\n timelineForactionplan.datepicker({\n format: 'dd/mm/yyyy'\n });\n\n let responsibilityForImplementation = row.find('.responsibility-for-implementation');\n responsibilityForImplementation.data(\"id\", list[i].row_id);\n responsibilityForImplementation.data(\"item_key\", 'responsibility_for_implementation');\n responsibilityForImplementation.keyup(cellKeyUP);\n\n }\n\n\n\n\n // myTable.on( 'click', 'tbody td', function () {\n // myTable.cell( this ).edit( {\n // blur: 'submit'\n // } );});\n }", "function populateStepDiscussionAjax() {\n\n\n // Empty content string\n var tableContent = '';\n \n $('div#secDiscussionHeader').css(\"display\", \"block\");\n \n var StepID = localStorage.getItem('CurrentStepID');\n \n \n \n var url = '/AppEngine/questsPostsList/' + StepID;\n \n $.getJSON( url, function( data ) { \n\n // For each item in our JSON, add a table row and cells to the content string\n $.each(data, function(){\n \n // Stick our user data array into a userlist variable in the global object\n \t\tQuestsRatingTable = data;\n \ttableContent += '<div class=\"PostContainer\">';\n tableContent += '<div class=\"Owner\">' + this.User + '</div>';\n tableContent += '<div class=\"TextBaloon\">' + this.Text + '</div>';\n tableContent += '<div class=\"LikeAction\">34</div>';\n tableContent += '<div class=\"LoveAction\">64</div>';\n tableContent += '<div class=\"HateAction\">94</div>';\n tableContent += '<div class=\"PostDate\">' + this.PostDate + '</div>'; \n tableContent += '</div>';\n }); \n \n \n // Inject the whole content string into our existing HTML table\n //$('#questsPostList').html(tableContent);\n\n }); \n \n}", "dataRefresh() {\n pluginName = new domObject('IDpluginName');\n pluginURI = new domObject('IDpluginURI');\n version = new domObject('IDversion');\n Author = new domObject('IDAuthor');\n authorURI = new domObject('IDauthorURI');\n license = new domObject('IDlicense');\n textDomain = new domObject('IDtextDomain');\n\n let pluginInfoData = \"Plugin Name: \" + pluginName.object.value +\n \"\\nPlugin URI: \" + pluginURI.object.value +\n \"\\nVersion: \" + version.object.value +\n \"\\nAuthor: \" + Author.object.value +\n \"\\nAuthor URI: \" + authorURI.object.value +\n \"\\nLicense: \" + license.object.value +\n \"\\nText Domain: \" + textDomain.object.value + \"\\n\";\n\n pluralName = new domObject('IDpluralName');\n nameSingular = new domObject('IDnameSingular');\n description = new domObject('IDdescription');\n textDomainCPT = new domObject('IDtextDomainCPT');\n\n let plgStr = pluginStr(pluralName.object.value, nameSingular.object.value, description.object.value, textDomainCPT.object.value);\n self.newEditor.setValue('<?php\\n' + '/*\\n' + pluginInfoData + '*/\\n' + plgStr + '?>');\n\n jsonData = {\n pluginName: pluginName.object.value,\n pluginURI: pluginURI.object.value,\n version: version.object.value,\n author: Author.object.value,\n authorURI: authorURI.object.value,\n license: license.object.value,\n textDomain: textDomain.object.value,\n\n pluralName: pluralName.object.value,\n nameSingular: nameSingular.object.value,\n description: description.object.value,\n textDomainCPT: textDomainCPT.object.value,\n dataArr: elementList\n }\n\n let strfy = JSON.stringify(jsonData);\n }", "function onLoadNYTData(data) {\n // Increment page index for future calls.\n addItems(data);\n}", "renderGUI(data) {\n\n let controller = this;\n\n /* Get the html template for table rows */\n let staticHtml = $(\"#activity-row-template\").html();\n\n /* Bind obj data to the template, then append to table body */\n $.each(data, function (index, obj) {\n let row = staticHtml;\n row = row.replace(/{Id}/ig, obj.id);\n row = row.replace(/{Area}/ig, obj.area);\n row = row.replace(/{Type}/ig, obj.type);\n row = row.replace(/{EstimatedTime}/ig, obj.estim_time);\n\n row = row.replace()\n $('#activity-rows').append(row);\n\n });\n\n /* When empty address-book */\n if (data.length === 0) {\n $(\"tfoot :first-child\").hide();\n $(\"tfoot\").html('<tr><th colspan=\"6\">No records</th></tr>');\n }\n\n\n }", "function howtoUseFetch() {\n window.content = \"\";\n getData(function (i) {\n console.log(i);\n window.content += printTemplate(i.employee_name, i.employee_age, i.employee_salary);\n });\n console.log(window.content);\n}", "function AirlineParameterTab()\n{\n $('#Txt1AirlineName').remove();\n if (pageType.toUpperCase() == 'READ') {\n $(\"#tblAirlineParameterTrans\").before(\"<div id='Txt1AirlineName' class='k-content k-state-active' style='display: block;'><table><tr><td style='font-weight:bold;'>Airline Name : </td><td>\" + $('#ApplicationTabs-1 table tr').find('#AirlineName').text() + \"</td></tr></table></div>\");\n\n }\n else if (pageType.toUpperCase() == 'EDIT') {\n $(\"#tblAirlineParameterTrans\").before(\"<div id='Txt1AirlineName' class='k-content k-state-active' style='display: block;'><table><tr><td style='font-weight:bold;'>Airline Name : </td><td>\" + $('#AirlineName').val() + \"</td></tr></table></div>\");\n }\n var dbtableName = \"AirlineParameterTrans\";\n $(\"#tbl\" + dbtableName).appendGrid({\n tableID: \"tbl\" + dbtableName,\n contentEditable: pageType == 'EDIT',\n masterTableSNo: $(\"#htmlkeysno\").val(),\n currentPage: 1,\n itemsPerPage: 10,\n whereCondition: null,\n rowUpdateExtraFunction: onAppendGridLoaded,\n dataLoaded: null,\n sort: \"\",\n isGetRecord: true,\n servicePath: \"./Services/Master/AirlineService.svc\",\n getRecordServiceMethod: \"GetAirlineParameterRecord\",\n createUpdateServiceMethod: \"CreateUpdateAirlineParameter\",\n caption: \"Airline Parameter\",\n deleteServiceMethod: \"DeleteAirlineParameter\",\n initRows: 1,\n columns: [{ name: \"SNo\", type: \"hidden\", value: 0 },\n { name: \"SeqNo\", type: \"hidden\", value: 0 },\n { name: 'AirlineSNo', type: 'hidden', value: $(\"#htmlkeysno\").val() },\n { name: \"AirlineParameterText\", display: \"Airline Parameter Text\", type: \"text\", ctrlCss: { width: '300px', height: '25px' }, ctrlAttr: { maxlength: 100, controltype: \"alphanumericupper\" }, isRequired: true },\n { name: \"ParameterType\", display: \"Type\", type: \"select\", ctrlOptions: { 0: '--Select--', 1: 'Number', 2: 'Decimal', 3: 'Text' , 4 : \"IP\" }, ctrlCss: { width: '150px', height: '25px' }, ctrlAttr: { maxlength: 35, controltype: \"alphanumericupper\", onchange: \"return changeType(event);\" }, isRequired: true },\n { name: \"AirlineParameterValue\", display: \"Airline Parameter Value\", type: \"text\", ctrlAttr: { maxlength: 100, controltype: \"default\", onkeypress: \"return checkvalue(event);\", onblur: \"return blurcheckvalue(event);\" }, ctrlCss: { width: \"300px\", height: '25px' }, isRequired: false },\n { name: \"ParameterRemarks\", display: \"Remarks\", type: \"textarea\", ctrlAttr: { maxlength: 400, controltype: \"default\", onkeypress: \"return checkvalue(event);\", onblur: \"return OnBlur(this);\" }, ctrlCss: { width: \"300px\", height: '25px' }, isRequired: false },\n { name: pageType == \"EDIT\" ? \"IsVisible\" : \"Visible\", display: \"Visible\", type: \"radiolist\", ctrlOptions: { 0: \"No\", 1: \"Yes\" }, selectedIndex: 1 },\n { name: pageType == \"EDIT\" ? \"IsActive\" : \"Active\", display: \"Active\", type: \"radiolist\", ctrlOptions: { 0: \"No\", 1: \"Yes\" }, selectedIndex: 1 },\n { name: 'Insert', display: 'Action', type: 'button', ctrlClass: 'btn btn-success', ctrlAttr: { maxlength: 100 }, value: 'Update', ctrlCss: { width: '55px', height: '20px' }, onClick: function (e, i) { } }\n ],\n hideButtons: { updateAll: true, append: userContext.GroupName.toUpperCase() == \"SUPER ADMIN\" ? false : true, insert:true, remove: true, removeLast: userContext.GroupName.toUpperCase() == \"SUPER ADMIN\" ? false : true, },\n isPaging: true\n });\n \n \n //$(\"button[id^=tblAirlineParameterTrans_Insert_]\").click(function (event) {\n // debugger;\n // var Id = event.currentTarget.id.split('Insert_')[1];\n // var Remarks = $(\"input[id=tblAirlineParameterTrans_ParameterRemarks_\" + Id + \"]\").val()\n // var pV = $('#tblAirlineParameterTrans_AirlineParameterValue_' + Id).val();\n // var pType = $('#tblAirlineParameterTrans_ParameterType_' + Id + ' :selected').text().toUpperCase()\n\n\n // if (pV == \"\") {\n // ShowMessage('warning', 'Warning - Airline Parameter.', \"Please Enter Airline Parameter Value \");\n // // window.stop();\n // event.stopPropagation();\n // return ;\n // }\n // else if (pType != \"DAYS\" || pType != \"PERCENTAGE\" || pType != \"ACTIVE\") {\n // ShowMessage('warning', 'Warning - Airline Parameter.', \"Please Select Airline Parameter Type \");\n // // window.stop();\n // event.stopPropagation();\n // return \n // }\n // else if (Remarks == \"\") {\n // ValidateTxtbox(Id)\n // // ShowMessage('warning', 'Warning - Airline Parameter.', \"Please Enter Remarks\");\n\n // return;\n // alert('helo');\n // }\n //})\n //$(document).on('blur', '[id^=tblAirlineParameterTrans_AirlineParameterText],[id^=tblAirlineParameterTrans_AirlineParameterValue],[id^=tblAirlineParameterTrans_ParameterRemarks]', function (e) {\n // var id = e.target.id;\n // var idNo = e.target.id.split('_')[2];\n // ValidateTxtbox(idNo)\n // if ($('#tblAirlineParameterTrans_ParameterType_' + idNo).val() == \"0\" && (id.indexOf('ParameterRemarks_') != -1 || id.indexOf('ParameterValue_') != -1)) {\n // ShowMessage('warning', 'Warning - Airline Parameter.', \"Kindly Select Type !\");\n // }\n //});\n}", "function changeData(){\n document.getElementById(\"content\").value = \"\";\n $(\".date\").text(today);\n dataIndex = $(\".date\").text().replace(/-/g,\"\");\n document.getElementById(\"content\").value = loadOrDefault(dataIndex);\n}", "function appendData(data) {\r\n\r\n number.innerHTML = `Number : ${data.number}`\r\n sect_tamil.innerHTML = `Section : ${data.sect_tam}`\r\n chapgrp_tam.innerHTML = `Chapter : ${data.chapgrp_tam}`\r\n chap_tam.innerHTML = `Adhigaram : ${data.chap_tam}`\r\n line1.innerHTML = data.line1\r\n line2.innerHTML = data.line2\r\n tam_exp.innerHTML = `Tamil Explanation : ${data.tam_exp}`\r\n}", "function fnc_grid_lista_setear_campos_child_post(row_data) {\n\tfr_row_data_cb = row_data;\n\n\tif ($(Obj_Col(fc_frm_cb, 'cstock_min')).val() !== '') {$(Obj_Col(fc_frm_cb, 'cstock_min')).val(fnc_formatear_saldo_inventario($(Obj_Col(fc_frm_cb, 'cstock_min')).val()));}\n\tif ($(Obj_Col(fc_frm_cb, 'cstock_max')).val() !== '') {$(Obj_Col(fc_frm_cb, 'cstock_max')).val(fnc_formatear_saldo_inventario($(Obj_Col(fc_frm_cb, 'cstock_max')).val()));}\n\n\t// IGV\n\tif ($(Obj_Col(fc_frm_cb, 'ntasa_imp_igv')).val() !== '' && parseInt($(Obj_Col(fc_frm_cb, 'ntasa_imp_igv')).val()) !== 0)\n\t{\n\t\t$(Obj_Col(fc_frm_cb, 'ntasa_imp_igv')).val(fnc_formatear_importe($(Obj_Col(fc_frm_cb, 'ntasa_imp_igv')).val()).toString() + ' %');\n\t}\n\telse\n\t{\n\t\t$(Obj_Col(fc_frm_cb, 'ntasa_imp_igv')).val('');\n\t}\n\t\n\t// ISC\n\tif ($(Obj_Col(fc_frm_cb, 'ntasa_imp_isc')).val() !== '' && parseInt($(Obj_Col(fc_frm_cb, 'ntasa_imp_isc')).val()) !== 0)\n\t{\n\t\t$(Obj_Col(fc_frm_cb, 'ntasa_imp_isc')).val(fnc_formatear_importe($(Obj_Col(fc_frm_cb, 'ntasa_imp_isc')).val()).toString() + ' %');\n\t}\n\telse\n\t{\n\t\t$(Obj_Col(fc_frm_cb, 'ntasa_imp_isc')).val('');\n\t}\n\n\t// Percepcion\n\tif ($(Obj_Col(fc_frm_cb, 'ntasa_imp_per')).val() !== '' && parseInt($(Obj_Col(fc_frm_cb, 'ntasa_imp_per')).val()) !== 0)\n\t{\n\t\t$(Obj_Col(fc_frm_cb, 'ntasa_imp_per')).val(fnc_formatear_importe($(Obj_Col(fc_frm_cb, 'ntasa_imp_per')).val()).toString() + ' %');\n\t}\n\telse\n\t{\n\t\t$(Obj_Col(fc_frm_cb, 'ntasa_imp_per')).val('');\n\t}\n\n\t// Rows\n\tmb_bloquear_process = true;\n\tfnc_add_rows_um();\n\tmb_bloquear_process = false;\n\tfnc_frm_objs_habilitar(fc_frm_cb + ' [data-rows]', 'v');\n}", "function addNewDataRow() {\n\n var rowCount = $('#mp-data-tb tr').length;\n // set maximum number of rows as 3\n if (rowCount > 3)\n return;\n\n rowtext = \"\";\n $('#mp-data-tb tr:last td').map(function() {\n rowtext += $(this).text();\n })\n\n if (rowtext.trim() == \"\") {\n return;\n } else {\n totalDataNum += 1;\n dataNumLast = totalDataNum - 1;\n \n $('#mp-data-tb tr:last').after(\"<tr style='height:20px;'><td onclick='addDataCellByEditor(\\\"evRelationship\\\",\" + dataNumLast + \", true);'></td><td onclick='addDataCellByEditor(\\\"participants\\\",\" + dataNumLast + \", true);'> </td><td onclick='addDataCellByEditor(\\\"dose1\\\",\" + dataNumLast + \", true);'> </td><td onclick='addDataCellByEditor(\\\"dose2\\\",\" + dataNumLast + \", true);'></td><td onclick='addDataCellByEditor(\\\"auc\\\",\" + dataNumLast + \", true);'></td><td onclick='addDataCellByEditor(\\\"cmax\\\",\" + dataNumLast + \", true);'></td><td onclick='addDataCellByEditor(\\\"clearance\\\",\" + dataNumLast + \", true);'></td><td onclick='addDataCellByEditor(\\\"halflife\\\",\" + dataNumLast + \", true);'><td onclick='addDataCellByEditor(\\\"studytype\\\",\" + dataNumLast + \", true);'></td></tr>\");\n }\n}", "function fill_table_content(a_table, info, component_type, is_supplier) {\n // clear the current table content\n a_table.find(\"tr\").remove();\n if (info.length > 0) {\n quantity_unit = info[0].unit;\n currency = info[0].currency;\n currency_value_per_unit = info[0].currency_value_per_unit;\n a_table.append('<thead><tr class=\"table-info\"><th>名称</th><th>数值每年(单位:'+ quantity_unit +')</th><th>单位成本(' + currency_value_per_unit + ')</th><th>年成本(单位:'+ currency +')</th></tr></thead>');\n// $table.children('tr:first').addClass('table-info');\n var tblbody = a_table.get(0).appendChild(document.createElement('tbody'));\n for (var i = 0; i < info.length; ++i) {\n var an_item = info[i];\n add_a_table_row(tblbody,\n [an_item.name, an_item.quantity, an_item.value_per_unit, an_item.annual_value],\n [false, false, true, false],\n [an_item.id, '', 'value_per_unit_' + an_item.id, ''],\n component_type, is_supplier\n );\n }\n }\n}", "function createContent(){\n var content = \"\";\n for (var i = 0; i < data.products.length; i++) {\n if(data.products[i].category_id === 1){ // assign the department\n var department = data2.categories[0].name;\n }else if(data.products[i].category_id === 2){\n department = data2.categories[1].name;\n }else{\n department = data2.categories[2].name;\n }\n var price = data.products[i].price;\n if(discount > 0){ // keeps original price if there is no discount\n var num = price - (price * discount); // claculates the discount\n var discountPrice = Math.round(num * 100) / 100; // rounds to decimal places\n }else{\n discountPrice = price; // if no discount, keeps original price\n }\n content += `<div class=\"box col-sm-4\">\n <h3>${data.products[i].name}</h3>\n <h4>$${discountPrice}</h4>\n <h5>Located in ${department}</h5>\n </div>`\n document.getElementById(\"putDataHere\").innerHTML = content; // publishes HTML\n }\n}", "add_row(row, title) {\r\n // add row\r\n $(\"#page\").append('\\\r\n <div class=\"row_block\">\\\r\n <h2 class=\"page-header\" id=\"title_row_'+row+'\">\\\r\n <center>\\\r\n <span id=\"title_text_row_'+row+'\" class=\"no_edit_page_item\">'+title+'</span> \\\r\n <input id=\"title_input_row_'+row+'\" type=\"text\" value=\"'+title+'\" class=\"edit_page_item d-none\" placeholder=\"give this row a title...\">\\\r\n <button class=\"btn btn-default d-none btn-sm edit_page_item\" id=\"delete_row_'+row+'\"><i class=\"fas fa-trash-alt\"></i> Delete Row</button>\\\r\n <button class=\"btn btn-default btn-sm edit_page_item d-none sortable_row\" style=\"cursor: move;\"><i class=\"fas fa-arrows-alt\"></i> Move Row</button>\\\r\n <button class=\"btn btn-default btn-sm edit_page_item d-none\" id=\"add_widget_row_'+row+'\"><i class=\"fas fa-plus\"></i> Add Widget</button>\\\r\n </center>\\\r\n </h2>\\\r\n <div class=\"row connected_widgets\" id=\"row_'+row+'\"></div>\\\r\n </div>\\\r\n ')\r\n // keep in sync section text and input\r\n $(\"#title_input_row_\"+row).unbind().keyup(function(this_class, row) {\r\n return function (e) {\r\n var value = $(\"#title_input_row_\"+row).val()\r\n $(\"#title_text_row_\"+row).html(value)\r\n };\r\n }(this, row));\r\n // configure delete row button\r\n $(\"#delete_row_\"+row).unbind().click(function(this_class, row) {\r\n return function () {\r\n gui.confirm(\"Do you really want to delete the row and all its the widgets?\", function(result){ \r\n if (! result) return\r\n // remove both the title and the entire row\r\n $(\"#title_row_\"+row).remove()\r\n $(\"#row_\"+row).remove()\r\n })\r\n };\r\n }(this, row));\r\n // configure add widget button\r\n $(\"#add_widget_row_\"+row).unbind().click(function(this_class, row) {\r\n return function () {\r\n this.widget_wizard = new Widget_wizard(\"widget_wizard\", null, this_class)\r\n this.widget_wizard.draw(row)\r\n };\r\n }(this, row));\r\n // make the widgets in the row sortable\r\n var this_class = this\r\n $(\"#row_\"+row).sortable({\r\n placeholder: 'sort-highlight',\r\n connectWith: '.connected_widgets',\r\n handle: '.sortable_widget',\r\n tolerance: 'pointer',\r\n distance: 0.5,\r\n forcePlaceholderSize: false,\r\n cancel: '',\r\n dropOnEmpty: true,\r\n zIndex: 999999,\r\n })\r\n }", "function renderData() {\n tableBody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n var data = tableData[i];\n var rows = Object.keys(data);\n var input = tableBody.insertRow(i);\n for (var j = 0; j < rows.length; j++) {\n var field = rows[j];\n var cell = input.insertCell(j);\n cell.innerText = data[field];\n }\n }\n}", "function getContent() {\n var helpTabUrl = 'https://api.cividesk.com/helptab/index.php';\n var getcontent = helpTabUrl + '?action=getContent';\n cj.ajax(getcontent, {\n type: 'post',\n dataType: 'json',\n data: {sid : cividesk_key, ver : civicrm_version, context: civicrm_contex },\n error: function() {\n alert('Could not retrieve data from HelpTab');\n },\n success: function(response) {\n var container = cj('.helptab-container');\n cj(\"#helptab-count\").hide();\n cj('#helptab-map-legend').animate({width: 468, padding: 12}, 1000);\n if(response.counts > 0){\n cj(\"#helptab-count\").text(response.counts).css({'margin-top':'-12px'}).show('slow');\n }\n cj.each(response.result, function(i, obj) {\n //@todo - temporary url for tracking of logging info, which will something like - 'http://api.cividesk.com/redirect.php?itemId=XXX';\n var redirectUrl = helpTabUrl + '?action=redirect&itemId=' + obj.item_id ;\n //var viewData = '<h3><a target=\"_blank\" class=\"helptab-title\" style=\"font-weight: normal;font-size: 1em;\" href=\"' + redirectUrl + '\">' + obj.title + '</a></h3><div class=\"helptab-context\">' + obj.text + '</div>';\n var helptab_iconId = '';\n if(obj.source !== null && obj.source.length > 0){\n var source = obj.source.toLowerCase();\n var helptab_iconId = \"helptab-icon-\"+source;\n }\n \n var viewData = '<h3 class=\"help-tab-title-h3\"><span class=\"helptab_iconClass\" id=\"'+ helptab_iconId +'\" title=\"'+ obj.text +'\"></span><a target=\"_blank\" class=\"helptab-title\" style=\"font-weight: normal;font-size: 1em;\" href=\"' + redirectUrl + '\">' + obj.title + '</a></h3>';\n container.append(viewData)\n });\n if (response.result.length == 0 ) {\n cj('#helptab-map-legend').empty().append('<div style=\"text-align:center;vertical-align: middle;padding-top:100px;\">Help content not available.</div>');\n }\n //cj('#total_record').html(response.total);\n \n //Implemented listing show-hide using jquery UI\n cj(\"#helptab-accordion\").accordion({\n event: \"click hoverintent\",\n heightStyle: \"content\"\n });\n\n //Js custom scroll bar\n cj('.jScrollbar4').jScrollbar();\n\n //Hide scrollbar for short records - set height as per set in css to 209\n var contentHeight = cj(\".jScrollbar_mask\").height();\n if (contentHeight < 209) {\n cj('.jScrollbar_draggable').hide();\n }\n\n //Handle click event for head tag in accordion\n cj(\".helptab-title\").on(\"click\", function(e) {\n\n e.preventDefault();\n //keep track of logging \n //setLogs(cj(this).attr('url'), cj(this).attr('href'), civicrm_contex);\n window.open(cj(this).attr('href') +'&sid='+cividesk_key +'&context='+civicrm_contex +'&ver='+ civicrm_version , '_blank');\n });\n }\n });\n}", "function build_table(data_type, data_content, page_size){\n var data_source = data_content.data_source,\n formatted_table_data = format_data(data_content, data_source),\n table_data_holder = {};\n if(data_type === 'arrests' || data_type === 'incidents' || data_type === 'accidents' || data_type === 'citations') {\n formatted_table_data.data = formatted_table_data.data.map(function(row) { \n if(row[row.length-1].indexOf('pdf') !== -1) {\n //this builds a link to the pdf file\n //we replace the server path with a base url and make it into a link\n var pdf_url = row[row.length-1].replace('[YOUR SERVER PATH HERE]','');\n row[row.length-1] = '<a href=\"[YOUR BASE URL HERE]' + pdf_url + '\" target=\"_blank\">Report</a>';\r\n }\n return row; \n });\n }\n \n var rows = $('.row');\n var table_width = ($(rows[0]).width() - 50) + 'px';\n page_size = page_size || 20;\n var data = new google.visualization.DataTable();\n formatted_table_data.headings.forEach( function(heading) {\n var heading_type = heading_types[heading] || 'string';\n data.addColumn(heading_type,heading);\n });\n data.addRows(formatted_table_data.data);\n var options = {page:'enable',pageSize: page_size, allowHtml: true};\n var table_div_id = 'data-table-' + data_type;\n var viz_click_btn = table_div_id + '-btn';\n var table_div = '<div><h2 style=\"text-transform: capitalize; display:inline\">' + data_type.replace('estate',' estate') + ': ' + data_content.data.length + ' records</h2> <button type=\"button\" style=\"margin-left: 3em; margin-bottom: 1em;\" id=\"' + viz_click_btn + '\" class=\"btn btn-default\" data-which=\"' + table_div_id + '\">Create visualization</button></div><div style=\"width:100%\" id=\"' + table_div_id + '\"></div>';\n $('#data-tables').append(table_div);\n \n//Google data tables don't seem to retain events if tables are sorted or when paging through.\n//Maybe they get redrawn every time? In any case, we need to make specific items clickable if any\n//of these things occur. \n var table = new google.visualization.Table(document.getElementById(table_div_id));\n google.visualization.events.addListener(table, 'ready', function(){\n \n make_items_clickable(data_source);\n google.visualization.events.addListener(table, 'sort', function(){\n make_items_clickable(data_source);\n });\n google.visualization.events.addListener(table, 'page', function(){\n make_items_clickable(data_source);\n });\n });\n table_data_holder[table_div_id] = data;\n table.draw(data,options);\n \n $('#' + viz_click_btn).click(function(e) {\n e.preventDefault();\n var which_data = $(this).data('which');\n var data = table_data_holder[which_data];\n show_widget_wizard(data.toJSON(), data_type, county);\n });\n }", "function buildList(){\n\t\t\tvar wrapper = document.getElementById('list-wrapper')\n\t\t\t//wrapper.innerHTML = ''\n\n\t\t\t//fetching data from backend\n\t\t\tvar url = 'http://127.0.0.1:8000/mydocuments/task-list/'\n\t\t\tvar urledit = 'http://127.0.0.1:8000/mydocuments/edit/'\n\n\t\t\tfetch(url)\n\t\t\t.then((resp) => resp.json())\n\t\t\t.then(function(data){\n\t\t\t\tconsole.log('Data001:', data) //display at console\n // render the data into the document\n\t\t\t\tvar list = data\n\t\t\t\tfor (var i in list){\n\n // check for exceptions\n\t\t\t\t\ttry{\n\t\t\t\t\t\tdocument.getElementById(`data-row-${i}`).remove()\n\t\t\t\t\t}catch(err){\n\n\t\t\t\t\t}\n\n\n // render title\n\n\t\t\t\t\tvar title = `<span class=\"title\">${list[i].title}</span>`\n\t\t\t\t\tvar type = `<span class=\"type\">${list[i].type}</span>`\n\t\t\t\t\tvar list_date = `<span class=\"list_date\">${list[i].list_date.substring(0,10)}</span>`\n var check01\n\n /*\n if (list[i].is_published == true){\n\t\t\t\t\t\ttitle = `<strike class=\"title\">${list[i].title}</strike>`\n\t\t\t\t\t}*/\n\n\n //console.log('** item =',list[i].title, list[i].is_published );\n\t\t\t\t\tif (list[i].is_published == true){\n\n\t\t\t\t\t\tcheck01 = `<input type=\"checkbox\" name=\"name-${i}\" id=\"${i}\" checked><span><label for=\"${i}\"></label></span>`\n }\n else{\n check01 = `<input type=\"checkbox\" name=\"name-${i}\" id=\"${i}\"><span><label for=\"${i}\"></label></span>`\n }\n\n // console.log('item =',i,list[i].is_published);\n\n\t\t\t\t\t// render individual items\n\t\t\t\t\tvar item = `\n\t\t\t\t\t\t<div id=\"data-row-${i}\" class=\"task-wrapper flex-wrapper\">\n\n\n <!-- display title -->\n\t\t\t\t\t\t\t<div style=\"flex:7\">${title}</div>\n\n <!-- display type -->\n\t\t\t\t\t\t\t<div style=\"flex:6\">${type}</div>\n\n <!-- display list_date -->\n\t\t\t\t\t\t\t<div style=\"flex:5\">${list_date}</div>\n\n <!-- display switch -->\n\t\t\t\t\t\t\t<div id=\"switch-row-${i}\" style=\"flex:3\">\n\t\t\t\t\t\t\t <div class=\"switch-button switch-button-xs\">\n\t\t\t\t\t\t\t ${check01}\n </div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div style=\"flex:2\">\n\t\t\t\t\t\t\t <!-- <a href=\"${urledit}${list[i].id}\" class=\"badge badge-pill badge-success\">Edit</a> -->\n <a href=\"${urledit}${list[i].id}\" class=\"btn btn-sm btn-outline-dark edit\">Edit</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div style=\"flex:1\">\n\t\t\t\t\t\t\t\t<button class=\"btn btn-sm btn-outline-dark delete\">Delete</button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t`\n\t\t\t\t\twrapper.innerHTML += item\n\t\t\t\t}\n\n\nif (list_snapshot.length > list.length){\n\t\t\t\t\tfor (var i = list.length; i < list_snapshot.length; i++){\n\t\t\t\t\t\tdocument.getElementById(`data-row-${i}`).remove()\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlist_snapshot = list\n\n\n\t\t\t\tfor (var i in list){\n\t\t\t\t\tvar deleteBtn = document.getElementsByClassName('btn btn-sm btn-outline-dark delete')[i]\n\t\t\t\t\tvar publishSwitch = document.getElementById(`switch-row-${i}`)\n\t\t\t\t\tvar title = document.getElementsByClassName('title')[i]\n\n\t\t\t\t\tdeleteBtn.addEventListener('click', (function(item){\n\t\t\t\t\t\treturn function(){\n\t\t\t\t\t\t\tdeleteItem(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t})(list[i]))\n\n\t\t\t\t\tpublishSwitch.addEventListener('click', (function(item){\n\t\t\t\t\t\treturn function(){\n\t\t\t\t\t\t\tchangePublishItem(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t})(list[i]))\n\n\t\t\t\t\ttitle.addEventListener('click', (function(item){\n\t\t\t\t\t\treturn function(){\n\t\t\t\t\t\t\tclickTitleItem(item)\n\t\t\t\t\t\t}\n\t\t\t\t\t})(list[i]))\n\n\n\t\t\t\t}\n\nfunction deleteItem(item){\n\t\t\tconsole.log('Delete clicked item =', item)\n\n\t\t\tfetch(`http://127.0.0.1:8000/mydocuments/task-delete/${item.id}/`,\n\t\t\t{\n\t\t\t\tmethod:'DELETE',\n\t\t\t\theaders:{\n\t\t\t\t\t'Content-type':'application/json',\n\t\t\t\t\t'X-CSRFToken':csrftoken,\n\t\t\t\t}\n\t\t\t}).then((response) => {\n\t\t\t\tbuildList()\n\t\t\t})\n}\n\nfunction clickTitleItem(item){\n\t\t\tconsole.log('clicked item =', item.is_published)\n\t\t}\n\n\n\nfunction changePublishItem(item){\n //console.log('item =>', item)\n\t\t\tconsole.log('1. item.id =>', item.id)\n\t\t\tconsole.log('2. item.is_published =>', item.is_published)\n\n var new_ispublished = !item.is_published\n\t\t\t//item.is_published = !item.is_published\n\t\t\tconsole.log('3. new_ispublished =>', new_ispublished)\n\n\n\n\n\t\t\tfetch(`http://127.0.0.1:8000/mydocuments/task-update/${item.id}/`,\n\t\t\t{\n\t\t\t\tmethod:'POST',\n\t\t\t\theaders:{\n\t\t\t\t\t'Content-type':'application/json',\n\t\t\t\t\t'X-CSRFToken':csrftoken,\n\t\t\t\t},\n\t\t\t\tbody:JSON.stringify({'title':item.title, 'is_published':new_ispublished})\n\t\t\t}).then((response) => {\n\t\t\t\tbuildList()\n\t\t\t})\n\n\n\n\t\t}\n\n})\n}", "function editableCells(){\n var numOrders =0\n var numOrdersInNew=0\n var numOrdersInAR=0\n var numOrdersInGVP=0\n var numOrdersInDDR=0\n var numOrdersInCD=0\n var numOrdersInDP=0\n var numOrdersInCompleted=0\n table.rows().every( function(rowIdx, tableLoop, rowLoop){\n numOrders+=1\n var rowData = this.data()\n var qNum =rowData[dataNames['qNum']]\n var rowStatus=rowData[dataNames['status']]\n var isQueried = rowData[dataNames['isQueried']]\n var rowReg=rowData[dataNames['regNum']]\n var rowChassis=rowData[dataNames['chassis']]\n var rowADD=rowData[dataNames['deliveryDate']]\n var rowDoR=rowData[dataNames['dateOfRegistration']]\n var rowAFRL=rowData[dataNames['afrl']]\n var rowInvoice=rowData[dataNames['invoice']]\n var rowDeliveryNote=rowData[dataNames['deliveryNote']]\n var rowOrderForm = rowData[dataNames['moreInfo']]\n\n var todayDate = new Date()\n var orderDateSplit = rowData[dataNames['orderDate']].split(\"/\") //as it cannot convert dd/mm/yyyy to a date\n var orderDate= new Date(orderDateSplit[2],orderDateSplit[1]-1,orderDateSplit[0])\n var dateDifference =(todayDate-orderDate)/(1000*3600*24) //how old the order is in days\n\n \n table.cell(rowIdx,moreInfoIndex).data(\"<button onclick='displayOrderForm(\\\"\"+qNum+\"\\\",\\\"\"+rowOrderForm+\"\\\")'>Order Form</button>\")\n if(rowData[dataNames['orderNum']]==null){\n table.cell(rowIdx, orderNumIndex).data(\"<input placeholder='Enter Order Number' onchange='editOrderNum(\\\"\"+qNum +\"\\\",this.value,\\\"\"+rowIdx+\"\\\")'></input>\")\n }\n if(rowStatus==statusNames['new']){\n numOrdersInNew+=1\n if (dateDifference>=1){ //if order is more than one day old\n $('tbody tr').eq(rowLoop).find('td').eq(0).addClass('overdue')\n }\n table.cell(rowIdx, etaIndex).data(\"<input onblur='changeETA(\\\"\"+qNum +\"\\\",this.value)' type='date'></input>\")\n \n table.cell(rowIdx,isQueriedIndex).data(\"<button onclick='displayQueryScreen(\\\"\"+qNum+\"\\\")'>Add/Show Queries</button>\")\n if(isQueried){\n table.cell(rowIdx, confirmOrderIndex).data('Curremtly Queried')\n } else{\n table.cell(rowIdx, confirmOrderIndex).data(\"<button onclick='confirmOrder(\\\"\"+qNum +\"\\\",\\\"\"+rowIdx+\"\\\")'>Confirm</button>\")\n }\n \n //remove the line below\n // table.cell(rowIdx, confirmOrderIndex).data(\"<button onclick='confirmOrder(\\\"\"+qNum +\"\\\",\\\"\"+rowIdx+\"\\\")'>Confirm</button>\")\n\n //highlight cells red\n $('tbody tr').eq(rowLoop).find('td').eq(confirmOrderIndex).addClass('incomplete')\n }\n else if (rowStatus == statusNames['AR']){\n numOrdersInAR+=1\n if(rowReg==\"\"){\n table.cell(rowIdx, regNumIndex).data(\"<input placeholder='Enter Registration' onchange='changeReg(\\\"\"+qNum +\"\\\",this.value,\\\"\"+rowIdx+\"\\\")'></input>\")\n //highlight cell red\n $('tbody tr').eq(rowLoop).find('td').eq(regNumIndex).addClass('incomplete')\n }\n else{\n //highlight cell green\n $('tbody tr').eq(rowLoop).find('td').eq(regNumIndex).addClass('complete')\n }\n \n if(rowChassis==undefined){\n table.cell(rowIdx, chassisIndex).data(\"<input placeholder='Enter Chassis' onchange='changeChassis(\\\"\"+qNum +\"\\\",this.value,\\\"\"+rowIdx+\"\\\")'></input>\")\n //highlight cell red\n $('tbody tr').eq(rowLoop).find('td').eq(chassisIndex).addClass('incomplete')\n //once both chassis and reg are uploaded, status should change to delivery date requested\n }\n else{\n //highlight cell green\n $('tbody tr').eq(rowLoop).find('td').eq(chassisIndex).addClass('complete')\n }\n }\n else if(rowStatus==statusNames['GVP']){\n numOrdersInGVP+=1\n }\n else if (rowStatus==statusNames['DDR']){\n numOrdersInDDR+=1\n table.cell(rowIdx, deliveryDateIndex).data(\"<input onblur='addADD(\\\"\"+qNum +\"\\\",this.value)' type='date' style='width: 100px'></input><button onclick='confirmADD(\\\"\"+qNum+\"\\\",\\\"\"+rowIdx+\"\\\")'>Ok</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(deliveryDateIndex).addClass('incomplete')\n table.cell(rowIdx, deliveryDetailsIndex).data(\"<button onclick='viewDeliveryDetails(\\\"\"+qNum+\"\\\")'>View Delivery Details</button>\")\n table.cell(rowIdx, atpIndex).data(\"<button onclick='viewATP(\\\"\"+qNum+\"\\\")'>View ATP</button>\")\n }\n else if (rowStatus==statusNames['CD']){\n numOrdersInCD+=1\n if(rowDoR==false){\n table.cell(rowIdx, dateOfRegistrationIndex).data(\"<input onblur='addDoR(\\\"\"+qNum +\"\\\",this.value)' type='date'></input><button onclick='confirmDoR(\\\"\"+qNum+\"\\\",\\\"\"+rowIdx+\"\\\")'>Ok</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(dateOfRegistrationIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(dateOfRegistrationIndex).addClass('complete')\n }\n if(rowAFRL==false){\n //table.cell(rowIdx, afrlIndex).data(\"<input type='file' onchange='uploadAFRL(\\\"\"+qNum+\"\\\",event)'></input>\")\n table.cell(rowIdx, afrlIndex).data(\"<button onclick='uploadFile(\\\"AFRL\\\",\\\"\"+qNum+\"\\\")'>Upload AFRL</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(afrlIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(afrlIndex).addClass('complete')\n table.cell(rowIdx, afrlIndex).data('<i class=\"fas fa-check\"></i>')\n }\n if(rowInvoice==false){\n //table.cell(rowIdx, invoiceIndex).data(\"<input type='file' onchange='uploadInvoice(\\\"\"+qNum+\"\\\",event)'></input>\")\n table.cell(rowIdx, invoiceIndex).data(\"<button onclick='uploadFile(\\\"Invoice\\\",\\\"\"+qNum+\"\\\")'>Upload Invoice</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(invoiceIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(invoiceIndex).addClass('complete')\n table.cell(rowIdx, invoiceIndex).data('<i class=\"fas fa-check\"></i>')\n }\n if(rowDeliveryNote==\"\"){\n //table.cell(rowIdx, 16).data(\"<input type='file' onchange='uploadDN(\\\"\"+qNum+\"\\\",event)'</input>\")\n table.cell(rowIdx, deliveryNoteIndex).data(\"<button onclick='uploadFile(\\\"Delivery Note\\\",\\\"\"+qNum+\"\\\")'>Upload Delivery Note</button>\")\n $('tbody tr').eq(rowLoop).find('td').eq(deliveryNoteIndex).addClass('incomplete')\n }\n else{\n $('tbody tr').eq(rowLoop).find('td').eq(deliveryNoteIndex).addClass('complete')\n table.cell(rowIdx, deliveryNoteIndex).data('<i class=\"fas fa-check\"></i>')\n }\n table.cell(rowIdx, deliveryDetailsIndex).data(\"<button onclick='viewDeliveryDetails(\\\"\"+qNum+\"\\\")'>View Delivery Details</button>\")\n \n }\n else if(rowStatus==statusNames['DP']){\n numOrdersInDP+=1\n table.cell(rowIdx, deliveryDetailsIndex).data(\"<button onclick='viewDeliveryDetails(\\\"\"+qNum+\"\\\")'>View Delivery Details</button>\")\n }\n else if (rowStatus==statusNames['completed']){\n numOrdersInCompleted+=1\n }\n })\n $('#tabNum0').text(numOrders)\n $('#tabNum1').text(numOrdersInNew)\n $('#tabNum2').text(numOrdersInAR)\n $('#tabNum3').text(numOrdersInGVP)\n $('#tabNum4').text(numOrdersInDDR)\n $('#tabNum5').text(numOrdersInCD)\n $('#tabNum6').text(numOrdersInDP)\n $('#tabNum7').text(numOrdersInCompleted)\n}", "function displayData()\n{\n \n createTable(dataBase)\n}", "function ContentRender(parent, serviceLocator) {\n var _this = this;\n this.rows = [];\n this.freezeRows = [];\n this.movableRows = [];\n this.freezeRowElements = [];\n this.isLoaded = true;\n this.drop = function (e) {\n _this.parent.notify(columnDrop, { target: e.target, droppedElement: e.droppedElement });\n remove(e.droppedElement);\n };\n this.rafCallback = function (args) {\n var arg = args;\n return function () {\n _this.ariaService.setBusy(_this.getPanel().firstChild, false);\n if (_this.parent.isDestroyed) {\n return;\n }\n var rows = _this.rows.slice(0);\n if (_this.parent.getFrozenColumns() !== 0) {\n rows = args.isFrozen ? _this.freezeRows : _this.movableRows;\n }\n _this.parent.notify(contentReady, { rows: rows, args: arg });\n if (_this.isLoaded) {\n _this.parent.trigger(dataBound, {});\n if (_this.parent.allowTextWrap) {\n _this.parent.notify(freezeRender, { case: 'textwrap' });\n }\n if (_this.parent.getFrozenColumns() !== 0 && !_this.parent.allowTextWrap) {\n _this.parent.notify(freezeRender, { case: 'refreshHeight' });\n }\n }\n if (arg) {\n var action = (arg.requestType || '').toLowerCase() + '-complete';\n _this.parent.notify(action, arg);\n if (args.requestType === 'batchsave') {\n args.cancel = false;\n _this.parent.trigger(actionComplete, args);\n }\n }\n if (_this.isLoaded) {\n _this.parent.hideSpinner();\n }\n };\n };\n this.parent = parent;\n this.serviceLocator = serviceLocator;\n this.ariaService = this.serviceLocator.getService('ariaService');\n this.generator = this.getModelGenerator();\n if (this.parent.isDestroyed) {\n return;\n }\n if (!this.parent.enableColumnVirtualization && !this.parent.enableVirtualization) {\n this.parent.on(columnVisibilityChanged, this.setVisible, this);\n }\n this.parent.on(colGroupRefresh, this.colGroupRefresh, this);\n this.parent.on(uiUpdate, this.enableAfterRender, this);\n }", "function loadOrderInfoFromRow() {\n const order_num = document.getElementById(\"input_order_text\").value;\n if (order_num == 1 || order_num == \"\") {\n return;\n }\n getOrder(\n {\n spreadsheetId: spreadsheetId,\n row: order_num\n },\n (err, res) => {\n if (err) {\n console.log(err);\n displayErrorPopUp(err);\n } else {\n const order_data = res.data.values[0];\n store.set(\"order_num\", order_num);\n document.getElementById(\"order_num_disp\").style.display =\n \"inline-block\";\n store.set(\"first_name_text\", order_data[2] || \"\");\n store.set(\"last_name_text\", order_data[3] || \"\");\n store.set(\"email_text\", order_data[4] || \"\");\n store.set(\"phone_number_text\", order_data[5] || \"\");\n store.set(\"type\", order_data[6] || \"\");\n store.set(\"color\", order_data[7] || \"\");\n store.set(\"size\", order_data[8] || \"\");\n store.set(\"front_text\", order_data[9] || \"\");\n store.set(\"left_arm_text\", order_data[10] || \"\");\n store.set(\"right_arm_text\", order_data[11] || \"\");\n store.set(\"back_text\", order_data[12] || \"\");\n store.set(\"hood_text\", order_data[13] || \"\");\n store.set(\"comment_text\", order_data[14] || \"\");\n console.log(\"set store:\");\n console.log(store.store);\n setFromStore();\n goToNextSection();\n }\n }\n );\n}", "function insertContent(res) {\n $(options.pagerNav).removeClass('ac-in-progress');\n toogleLoader();\n status.page++;\n setUrl($(options.link, res));\n\n var nextContent = $(options.content, res);\n if (nextContent.length) {\n var tags = $(options.appendTo, res).closest('.ac-pager-ajax').find('.tag-sortings a');\n if (tags.length) {\n\n var filter = $(options.appendTo).closest('.ac-pager-ajax').find('.tag-sortings li'),\n tagsArr = extractCurrentTags($('a', filter)),\n prepend = filter.last();\n\n $.each(tags, function(){\n if ($.inArray($(this).attr('data-filter') + \"\", tagsArr) ==-1) {\n $(this).insertBefore(prepend).wrap('<li />');\n }\n });\n }\n nextContent.hide().appendTo(options.appendTo);\n Drupal.attachBehaviors(nextContent);\n Drupal.attachBehaviors($(nextContent).closest('.ac-portfolio').find('.filter'));\n var container = $(nextContent).closest('.p-items');\n if (container.is('.ac-appearance-multigrid')){\n imagesLoaded(nextContent, function() {\n $(nextContent).fadeIn();\n var elH = parseInt(container.attr(\"data-gplus_height\")) ? parseInt(container.attr(\"data-gplus_height\")) : 350;\n //$(nextContent).css('height', elH);\n container.collage();\n });\n }else if (jQuery().isotope) {\n imagesLoaded(nextContent, function() {\n $(nextContent).fadeIn();\n $(nextContent).closest('.ac-appearance-masonry').isotope('appended', $(nextContent));\n $(nextContent).find('.ac-fluid-video').fitVids();\n $(nextContent).closest('.ac-appearance-masonry').isotope('reLayout');\n });\n };\n\n status.content = nextContent.filter(':last');\n }\n\n // No more data\n if (!status.nextUrl && options.pager) {\n $(options.pagerNav).text(Drupal.t(options.doneText));\n }\n\n status.active = false;\n }", "function loadPageData() {\n\tvar cC = '#mw-content-text';\n\t$(cC).load(location.href + \" \" + cC + \" &gt; *\", function (data) {\n\t\tif (doRefresh) {\n\t\t\tajaxTimer = setTimeout(loadPageData, ajaxRefresh);\n\t\t}\n\t});\n}" ]
[ "0.6060781", "0.59772605", "0.59444344", "0.5851095", "0.5725794", "0.5696893", "0.5666809", "0.5634667", "0.56222713", "0.5585665", "0.5485791", "0.5483372", "0.54724514", "0.5434234", "0.54341686", "0.5424243", "0.54157287", "0.5407757", "0.5403134", "0.537869", "0.5377995", "0.5363822", "0.5362455", "0.5360289", "0.5352334", "0.53469896", "0.534479", "0.5335719", "0.53328466", "0.53312165", "0.53222424", "0.52813095", "0.52759767", "0.5275954", "0.5272177", "0.52699065", "0.5269862", "0.52664614", "0.52648443", "0.52573496", "0.52555996", "0.5254342", "0.524937", "0.524933", "0.52414864", "0.5233302", "0.5231761", "0.52198064", "0.5217536", "0.521101", "0.5210483", "0.5196013", "0.51951164", "0.5185455", "0.5180531", "0.51783764", "0.5176639", "0.5170366", "0.5162078", "0.5161873", "0.5161711", "0.516073", "0.5148505", "0.51483774", "0.51480144", "0.51455826", "0.51392627", "0.5136949", "0.5134893", "0.51347345", "0.5130662", "0.51284444", "0.512553", "0.5125338", "0.5124924", "0.5122269", "0.51215845", "0.51136416", "0.51090944", "0.5104041", "0.5103805", "0.5097587", "0.5095594", "0.5094666", "0.5089452", "0.50867295", "0.5085577", "0.50853777", "0.5084338", "0.50840276", "0.5076501", "0.507415", "0.5073711", "0.50724715", "0.5058009", "0.50549674", "0.5049488", "0.5049144", "0.50478023", "0.5047443", "0.5047192" ]
0.0
-1
Removes empty properties from object and returns new object with occupied properties Disabling this for now, easier to work with objects with empty properties than to test for properties
function objectTrimmer(o) { j = {}; for (p in o) { if (o[p]) { j[p] = o[p]; } } return j; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cleanObject(obj) {\n const result = Object.assign(obj)\n for (const propName in result) {\n if (result[propName] === null || result[propName] === undefined) {\n delete result[propName];\n }\n }\n\n return result\n}", "function purgeEmptyFields(obj) {\n Object.keys(obj).forEach(key => {\n const val = obj[key];\n if (val === '' || val === false || val === undefined || val === null) {\n delete obj[key];\n }\n });\n return obj;\n}", "function deleteEmptyProperties(obj) {\n for (const i in obj) {\n if (i === 'missingValues') continue\n if (obj[i] === undefined || obj[i] === '' || obj[i].length === 0) {\n delete obj[i]\n } else if (typeof obj[i] === 'object') {\n deleteEmptyProperties(obj[i])\n }\n }\n}", "remove_props(obj, props = []) {\n if (!this.is_object(obj)) return false;\n for (var key in obj) {\n if (!obj.hasOwnProperty(key))\n continue;\n if (typeof obj[key] === 'object' && obj[key] !== null)\n obj[key] = this.remove_props(obj[key], props);\n else\n if (props.includes(key)) \n delete obj[key];\n }\n return obj;\n }", "function compactObject(data) {\n if (!isObject(data)) {\n return data;\n }\n\n return Object.keys(data).reduce(function (accumulator, key) {\n var isObj = isObject(data[key]);\n var value = isObj ? compactObject(data[key]) : data[key];\n var isEmptyObject = isObj && !Object.keys(value).length;\n\n if (value === undefined || isEmptyObject) {\n return accumulator;\n }\n\n return Object.assign(accumulator, _defineProperty({}, key, value));\n }, {});\n }", "function remove_falsy_values(obj) {\n var new_obj = {};\n for (var key in obj) {\n if (obj[key]) {\n new_obj[key] = obj[key];\n }\n }\n return new_obj;\n}", "function filterNullInObject(object) {\n let newObject = {};\n\n let keys = Object.keys(object);\n\n for (var key of keys) {\n if (object[key] || object[key] == false) {\n newObject[key] = object[key];\n }\n }\n\n return newObject;\n}", "function clean(obj) {\n var res = {};\n\n _underscoreWrapper.default.each(obj, function (value, key) {\n if (!_underscoreWrapper.default.isNull(value)) {\n res[key] = value;\n }\n });\n\n return res;\n}", "static stripUndefinedProperties(options) {\n return Object.keys(options).reduce((object, key) => {\n if (options[key] !== undefined) {\n object[key] = options[key];\n }\n return object;\n }, {});\n }", "cleanJson (json, properties) {\n let cleanedJson = {}\n cleanedJson = object.assign(cleanedJson, object.pick(json, properties))\n return cleanedJson\n }", "function isEmptyProperties( props ) {\n for (var k in props) {\n if (!props.hasOwnProperty(k)) {\n continue;\n }\n return false;\n }\n return true;\n}", "function clean_obj(obj) {\n Object.keys(obj).forEach(function(key) {\n if (obj[key].length) obj[key] = obj[key][0];\n });\n}", "function clearEmpties(obj) {\n for (var key in obj) {\n if (!obj[key] || typeof obj[key] !== 'object') {\n continue;\n }\n\n clearEmpties(obj[key]);\n if (Object.keys(obj[key]).length === 0) {\n delete obj[key];\n }\n }\n return obj;\n}", "function cleanObj(obj) {\n return Object.keys(obj).reduce(function (newObj, key) {\n if (typeof obj[key] !== 'undefined') {\n newObj[key] = obj[key];\n }\n\n return newObj;\n }, {});\n}", "_emptyProp (propName) {\n return !this[propName] || (typeof this[propName] === 'object' && Object.keys(this[propName]).length === 0)\n }", "function clean(obj) {\n for (var propName in obj) { \n if (obj[propName] === null || obj[propName] === undefined || obj[propName] === \"\") {\n delete obj[propName];\n }\n }\n }", "function clean(obj) {\n for (var propName in obj) { \n if (obj[propName] === null || obj[propName] === undefined || obj[propName] === \"\") {\n delete obj[propName];\n }\n }\n }", "truncateObject(obj) {\n\t\tconst visibleObject = this.copyObject(obj);\n\t\tconst setObject = (obj) => {\n\t\t\tObject.keys(obj).forEach(key => {\n\t\t\t\tif(key.charAt(0) === '_') delete obj[key];\n\t\t\t\tif (typeof obj[key] === 'object' && obj[key] !== null) {\n\t\t\t\t\tsetObject(obj[key]);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tsetObject(visibleObject);\n\t\treturn visibleObject;\n\t}", "function makeEmptyObject() {\n return new Object();\n}", "function gmaps_remove_empty_values(obj) {\n for(var key in obj) {\n\n // value is empty string\n if(obj[key] === '') {\n delete obj[key];\n }\n\n // value is array with only emtpy strings\n if(obj[key] instanceof Array) {\n var empty = true;\n for(var i = 0; i < obj[key].length; i++) {\n if(obj[key][i] !== '') {\n empty = false;\n break;\n }\n }\n\n if(empty)\n delete obj[key];\n }\n\n // value is object with only empty strings or arrays of empty strings\n if(typeof obj[key] === \"object\") {\n obj[key] = gmaps_remove_empty_values(obj[key]);\n\n var hasKeys = false;\n for(var objKey in obj[key]) {\n hasKeys = true;\n break;\n }\n\n if(!hasKeys)\n delete obj[key];\n }\n }\n\n return obj;\n}", "clean() {\n let clone = {};\n Object.assign(clone, this);\n\n for (const i in clone) {\n if (typeof clone[i] === 'undefined') {\n delete clone[i];\n }\n }\n\n return clone;\n }", "function isEmptyObject(obj) {\n let ret = new Object();\n ret.isValid = true;\n ret.message = '';\n ret.phoneNumbers = [];\n if (!Object.keys(obj).length)\n { \n ret.isValid = false;\n ret.message = 'empty body';\n }\n return ret;\n}", "function clearData(obj) {\n var newObj = {};\n Object.getOwnPropertyNames(obj).forEach(function (name) {\n if (obj[name]) {\n newObj[name] = obj[name];\n }\n });\n return newObj;\n}", "function removeProperties(obj, keys) {\n var clone = _extends({}, obj);\n\n keys.forEach(function (key) {\n delete clone[key];\n });\n return clone;\n}", "function hasEmptyProperties(target) {\n for (var member in target) {\n if(member == \"index\" || member == \"formatted\"){\n continue;\n }\n if (target[member] == \"\"){\n return true;\n }\n }\n return false;\n }", "function without_fields(obj, fields) {\n var newObj = {}\n for (var key in obj) {\n if (!fields || fields.indexOf(key) < 0) {\n newObj[key] = obj[key];\n }\n }\n return newObj;\n}", "function Object$empty() {\n return {};\n }", "function Object$empty() {\n return {};\n }", "function makeSafeObject(dirty, properties) {\n\tlet safe = {};\n\tproperties.forEach((prop) => {\n\t\tlet parts = prop.split('.');\n\t\tlet source = dirty;\n\t\tlet target = safe;\n\t\tfor (let i=0; i < parts.length - 1; i++) {\n\t\t\tif (!source[parts[i]]) return; // Source doesn't have property\n\t\t\tif (!target[parts[i]]) target[parts[i]] = {};\n\t\t\tsource = source[parts[i]];\n\t\t\ttarget = target[parts[i]];\n\t\t}\n\t\tif (!source[parts[parts.length-1]]) return; // Source doesn't have property\n\t\ttarget[parts[parts.length-1]] = source[parts[parts.length-1]];\n\t});\n\treturn safe;\n}", "function myOmit(oneObject, propertyToDelete) {\n\tlet result = {};\n\tfor (let key in oneObject) { // Key= a, b, c\n\t\tfor (let i=0; i<propertyToDelete.length; i++) {\n\t\t\tif (key === propertyToDelete[i]) {\n\t\t\t\tdelete oneObject[propertyToDelete[i]];\n\t\t\t}\n\t\t}\n\t}\n\treturn oneObject;\n}", "removeEmpty(obj){\n Object.keys(obj).forEach(key => {\n if (obj[key] && typeof obj[key] === 'object'){ \n this.removeEmpty(obj[key]);\n }\n else if (obj[key] == null){\n delete obj[key];\n } \n });\n return obj;\n }", "function Common_removeEmptyStrings(obj){\n\t switch(typeof obj){\n\t\t case 'object':\n\t\t\t for(let key in obj){\n\t\t\t\t obj[key] = Common_removeEmptyStrings(obj[key]);\n\t\t\t }\n\t\t\tbreak;\n\t\t case 'string':\n\t\t\t if(obj.length <= 0){\n\t\t\t\t obj = null;\n\t\t\t }\n\t\t\tbreak;\n\t }\n\n\t return obj;\n}", "function stripProps(obj) {\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n if (\n // Strip leading $ marks, from angular\n prop.indexOf('$')===0 ||\n // Strip leading underscores, for convenience attributes\n prop.indexOf('_')===0 ||\n // Strip trailing underscores, for instance-prototype binding\n prop.indexOf('_')===prop.length-1) {\n delete(obj[prop]);\n }\n // Recursion: All the items in an array\n else if (Array.isArray(obj[prop])) {\n for (var i in obj[prop]) {\n stripProps(obj[prop][i]);\n }\n }\n // Recursion: All the properties of an object\n else if (typeof(obj[prop])==='object') {\n stripProps(obj[prop]);\n }\n }\n }\n }", "function extendRemove(target, props) {\r\n\t$.extend(target, props);\r\n\tfor (var name in props)\r\n\t\tif (props[name] == null)\r\n\t\t\ttarget[name] = null;\r\n\treturn target;\r\n}", "function _nullAllProperties(obj) {\n _.forEach(obj, (value, key) => {\n if (_.isObject(value)) {\n _nullAllProperties(value);\n obj[key] = value;\n }\n else {\n obj[key] = null;\n }\n });\n}", "function toEmptyObject() {\n return function () {\n return {};\n };\n}", "function rmprop(prop, obj) {\n delete obj[prop];\n return obj;\n}", "function clean_userObj() {\n userObj.id = undefined;\n userObj.email = undefined;\n userObj.nick = undefined;\n userObj.name = undefined;\n userObj.role = undefined;\n}", "static getNewProperties() {\n return {};\n }", "function removeProperties(object, array) {\n \n // let newObj = {...object};\n \n // for (let key of array) {\n \n // if (newObj[key]) delete newObj[key];\n \n // }\n \n // return newObj;\n \n for (let prop of array) {\n if (object.hasOwnProperty(prop)) delete object[prop];\n }\n\n}", "function myFunction(obj) {\n let ret = {};\n Object.keys(obj).forEach( key => {\n if (obj[key] === '' || obj[key] === ' ' ) {\n console.log(obj[key]);\n ret[key] = null;\n } else {\n ret[key] = obj[key];\n }\n })\n return ret\n}", "function blankedObject (obj, defaultValue) {\n defaultValue = defaultValue === undefined ? '' : defaultValue\n return _.reduce(obj, function (result, value, key) {\n result[key] = defaultValue\n return result\n }, {})\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = null;\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = null;\n\t\t}\n\t}\n\treturn target;\n}", "function DatasetElement_objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }", "censor_props(obj, props = ['apikey', 'secret']) {\n if (!this.is_object(obj)) return false;\n for (var key in obj) {\n if (!obj.hasOwnProperty(key))\n continue;\n if (props.includes(key)) \n obj[key] = '**********'\n else \n if (typeof obj[key] === 'object' && obj[key] !== null)\n obj[key] = this.censor_props(obj[key], props);\n }\n return obj;\n }", "static cleanObject(obj) {\n const validObj = (o) =>\n (Object.keys(o).length || (Array.isArray(o) && o.length)) && o;\n const itemToBool = (item) => {\n return typeof item !== 'object' || item === null\n ? item\n : // eslint-disable-next-line no-use-before-define\n validObj(clean(item));\n };\n\n const clean = (o) =>\n validObj(\n Array.isArray(o)\n ? o.map(itemToBool).filter(Boolean)\n : Object.entries(o).reduce((a, [key, val]) => {\n const newVal = itemToBool(val);\n if (\n // Here is the magic check null, undefined and type change (=> undefined recursively)\n newVal !== undefined &&\n newVal !== null &&\n typeof val === typeof newVal\n )\n a[key] = newVal;\n return a;\n }, {})\n );\n\n return clean(obj);\n }", "function empty() {\n\treturn Object.create(null);\n}", "function correctPlistBlanks (obj) {\n for (var key in obj) {\n var val = obj[key]\n if (!val) obj[key] = ''\n }\n\n return obj\n }", "function clean(t) {\n for (const prop in t) {\n if (t[prop] === undefined) {\n delete t[prop];\n }\n }\n return t;\n}", "function copyWithoutUrlOrConfig(props){\n const result = {};\n for(const k in props){\n if(k !== 'url' && k !== 'config'){\n result[k] = props[k];\n }\n }\n return result;\n}", "function extendRemove(target, props) {\r\n\t$.extend(target, props);\r\n\tfor (var name in props) {\r\n\t\tif (props[name] == null) {\r\n\t\t\ttarget[name] = props[name];\r\n\t\t}\r\n\t}\r\n\treturn target;\r\n}", "missing_props(obj, props = []) {\n if (!this.is_object(obj)) return false;\n if (!this.is_array(props)) props = [props];\n var obj = this.lower_props(obj);\n var result = [];\n for (var i = 0; i < props.length; i++) {\n var prop = props[i].toLowerCase();\n if (!obj.hasOwnProperty(prop)) {\n result.push(props);\n }\n }\n return result;\n }", "static validate(obj, props) {\n let isValid = true;\n const missingProps = [];\n const propsWithoutValue = [];\n props.forEach((prop) => {\n let propHasValue;\n const propFound = (Object.prototype.hasOwnProperty.call(obj, prop));\n if (propFound) {\n propHasValue = (obj[prop] !== '' && (obj[prop].trim().length !== 0));\n }\n if (!propFound) {\n missingProps.push(prop);\n isValid = false;\n }\n if (propFound && !propHasValue) {\n propsWithoutValue.push(prop);\n isValid = false;\n }\n });\n return { isValid, missingProps, propsWithoutValue };\n }", "function cloneSimpleProps(obj, props) {\n var dup = {};\n\n props.forEach(function(prop) {\n if (obj.hasOwnProperty(prop)) {\n dup[prop] = obj[prop];\n }\n });\n return dup;\n}", "function extendRemove(target, props) {\n $.extend(target, props);\n for (var name in props) {\n if (props[name] == null) {\n target[name] = props[name];\n }\n }\n return target;\n }", "async function removeEmptyKeys(obj) {\n\tObject.keys(obj).forEach((key) => {\n\t\tif (obj[key].length === 0) {\n\t\t\tdelete obj[key];\n\t\t}\n\t\tif (obj === 'Falso') {\n\t\t\tdelete obj[key];\n\t\t}\n\t});\n\treturn obj;\n}", "function empty_obj(obj) {\n for (var key in obj) {\n if (hasOwnProperty.call(obj, key)) return false;\n }\n return true;\n}", "filter() {\n let new_attr = {}\n\n Object.entries(this.attr).forEach(([key, value]) => {\n if (value.length > 0) {\n new_attr[key] = value\n }\n })\n\n return new_attr\n }", "function omit(obj, props) {\n var copy = duplicate(obj);\n props.forEach(function (prop) {\n delete copy[prop];\n });\n return copy;\n}", "function _isEmpty(obj) {\n for(var prop in obj) {\n if(obj.hasOwnProperty(prop))\n return false;\n }\n return true;\n }", "function correctPlistBlanks(obj) {\n for (const key in obj) {\n const val = obj[key];\n if (!val) obj[key] = \"\";\n }\n\n return obj;\n }", "cleanedItem(item) {\n var newItem = JSON.parse(JSON.stringify(item));\n for (var propName in newItem) {\n if (newItem[propName] == null || !newItem[propName] || newItem[propName] == 0 || newItem[propName] == \"\") {\n delete newItem[propName];\n }\n }\n\n return newItem;\n }", "function extendRemove(target, props) {\r\n $.extend(target, props);\r\n for (var name in props) {\r\n if (props[name] == null) {\r\n target[name] = props[name];\r\n }\r\n }\r\n return target;\r\n }", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props) {\n\t\tif (props[name] == null) {\n\t\t\ttarget[name] = props[name];\n\t\t}\n\t}\n\treturn target;\n}", "function extendRemove(target, props) {\n\t\t$.extend(target, props);\n\t\tfor (var name in props) {\n\t\t\tif (props[name] == null) {\n\t\t\t\ttarget[name] = props[name];\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t}", "function extendRemove(target, props) {\n\t\t$.extend(target, props);\n\t\tfor (var name in props) {\n\t\t\tif (props[name] == null) {\n\t\t\t\ttarget[name] = props[name];\n\t\t\t}\n\t\t}\n\t\treturn target;\n\t}", "function extendRemove(target, props) {\n $.extend(target, props);\n for (var name in props)\n if (props[name] == null || props[name] == undefined)\n target[name] = props[name];\n return target;\n}", "skipProperties() {\n return [];\n }", "function cleanProps(props: Object) {\n /* eslint-disable no-unused-vars */\n const {\n analyticsId,\n analyticsData,\n delegateAnalyticsEvent,\n fireAnalyticsEvent,\n firePrivateAnalyticsEvent,\n getParentAnalyticsData,\n ...cleanedProps\n } = props;\n /* eslint-enable no-unused-vars */\n return cleanedProps;\n}", "function undeletablePropertiesStrict() {\n 'use strict';\n delete Object.prototype; // throws type error in strict\n}", "function removeProperties(object, array) {\n for(var i in array){\n var x = array[i];\n delete object[x];\n }\n return object;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n}", "function omit(obj, props) {\n var copy = Object.assign({}, obj);\n\n var _iterator4 = _createForOfIteratorHelper(props),\n _step4;\n\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var prop = _step4.value;\n delete copy[prop];\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n\n return copy;\n }", "function getProperties() { return $.extend(true, {}, properties); }", "function mergeObjectProperties(a, b) {\n for (var key in b) {\n if (b[key] === null && a[key]) {\n // remove any values in a if new b value is null\n delete a[key];\n } else {\n a[key] = b[key];\n }\n }\n return a;\n }" ]
[ "0.67853415", "0.67459047", "0.6604225", "0.6583351", "0.6503944", "0.6476513", "0.6452959", "0.6398747", "0.63503855", "0.6339403", "0.63083804", "0.63070136", "0.6280458", "0.62798095", "0.62455827", "0.6212427", "0.6212427", "0.61969453", "0.61932194", "0.6159141", "0.61584747", "0.61160445", "0.61116564", "0.609088", "0.60732424", "0.6072751", "0.6045589", "0.6045589", "0.6014756", "0.60014206", "0.5997805", "0.59829974", "0.5953974", "0.5928915", "0.5923691", "0.59084886", "0.5898977", "0.589741", "0.5890136", "0.5878195", "0.5876518", "0.58691204", "0.5866506", "0.5866506", "0.58584344", "0.5848574", "0.5837186", "0.5818717", "0.5802737", "0.5791171", "0.57843095", "0.57820815", "0.57818514", "0.5777713", "0.57764083", "0.5768506", "0.57681173", "0.5756551", "0.57534", "0.57505316", "0.57501185", "0.5748381", "0.5747135", "0.5740346", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732406", "0.5732191", "0.5732191", "0.5732124", "0.5730184", "0.5726895", "0.57097125", "0.57058406", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5704141", "0.5702631", "0.5700738", "0.57006353" ]
0.0
-1
When the form is submitted, use the API.saveBook method to save the book data Then reload books from the database
function addBook(book) { setLoading(true); setVisible(true); API.saveBook(book) .then(res => { setLoading(false); }) .catch(err => { setLoading(false); setError(true); console.log(err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupBookForm() {\n\n\t$('form').submit(event => {\n\t\t\n\t\tconsole.log(\"Form submitted\");\n\t\tevent.preventDefault(); // prevents default form behaviour (reloads the page)\n\n\t\tconst book = {\n\t\t\ttitle: $('#title').val(),\n\t\t\tauthor: $('#author').val(),\n\t\t\tnumPages: parseInt($('#pages').val())\n\t\t};\n\n\t\taxios\n\t\t\t.post(apiBooksUrl, book)\n\t\t\t.then(response => response.data) // turns to a promise of book\n\t\t\t.then(addedBook => {\n\t\t\t\tconsole.log(\"Added book\", addedBook);\n\t\t\t\tloadAndDisplayBooks(); // to refresh list\n\t\t\t})\n\t\t\t.catch(error => console.error(\"Error adding book!\", error));\n\t});\n}", "function updateBook() {\n let id = $('#updatebookId').text();\n let title = $('#updatebookTitle').val();\n let author = $('#updatebookAuthor').val();\n let isbn = $('#updatebookIsbn').val();\n\n let book = { title, author, isbn };\n request.put(id, JSON.stringify(book), updateCurrentBookInList, onError);\n\n $('#updatebookId').text('');\n $('#updatebookTitle').val('');\n $('#updatebookAuthor').val('');\n $('#updatebookIsbn').val('');\n\n showAddForm();\n}", "function submitForm(e) {\n e.preventDefault();\n \n let newBook = new Book(bookTitle.value, bookPages.value, bookAuthor.value);\n newBook.isRead = isChecked.checked;\n myLabrary.push(newBook);\n saveBookToLocal(bookTitle.value);\n // displayData();\n // remoFromLocal();\n form.reset();\n}", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title && formObject.author) {\n API.saveBook({\n title: formObject.title,\n author: formObject.author,\n synopsis: formObject.synopsis,\n })\n .then((res) => loadBooks())\n .catch((err) => console.log(err));\n }\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n API.googleBook(formObject.title)\n .then((res) => {\n console.log(res.data.items);\n setGoogleBooks(res.data.items);\n })\n .catch((err) => console.log(err));\n }", "function saveBook(event) {\n event.preventDefault();\n let currentTitle = this.querySelector('[name=title-x]').value;\n let currentAuthor = this.querySelector('[name=author-x]').value;\n let currentPages = this.querySelector('[name=pages-x]').value;\n const userBook = new Book(currentTitle, currentAuthor, currentPages);\n addBookToLibrary(userBook);\n document.querySelector(\".modal\").style.display = 'none';\n formatBookObject();\n}", "function handleFormSubmit(event) {\n event.preventDefault();\n if (bookName) {\n API.getGoogleBooks(bookName)\n .then(res => {\n setGoogleBooks(res.data.items.map(({ volumeInfo }) => {\n return {\n title: volumeInfo.title,\n description: volumeInfo.description,\n authors: volumeInfo.authors,\n image: volumeInfo.imageLinks.thumbnail,\n link: volumeInfo.infoLink\n }\n }))\n })\n .catch(err => console.log(err));\n }\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n\n console.log(formObject.title);\n loadBooks(formObject.title)\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n console.log(formObject.title)\n if (formObject.title) {\n API.googleBooks(formObject.title)\n .then(res => loadBooks(res))\n .catch(err => console.log(err));\n }\n }", "function saveBook(e) {\n var newAuthor;\n var index;\n\n // loop to find the book object id that matches the id of the save button clicked\n for (var i=0; i<books.length; i++) {\n if ( books[i].id === e.target.id ) {\n index = i;\n break;\n }\n }\n\n // check if there are authors returned from google\n if(!books[index].volumeInfo.authors) {\n // if no authors, save a text string\n newAuthor = \"No Author provided.\";\n }\n // check if multiple authors, then join them together as one string to save\n else if(books[index].volumeInfo.authors.length > 1) {\n newAuthor = books[index].volumeInfo.authors.join(\", \");\n }\n // only a single author to save\n else {\n newAuthor = books[index].volumeInfo.authors[0];\n };\n // save the index of the book save button clicked\n bookIndex = books[index].id;\n // call save book route to save the book to database\n API.saveBook({\n title: books[index].volumeInfo.title,\n // sometimes no thumbnail image returned from google and need to handle this\n image: books[index].volumeInfo.imageLinks ? books[index].volumeInfo.imageLinks.thumbnail : \"https://dummyimage.com/128x206/c4bfb2/051421.jpg&text=No+Image+\",\n link: books[index].volumeInfo.infoLink,\n // sometimes no book description returned from google and need to handle this\n synopsis: books[index].volumeInfo.description ? books[index].volumeInfo.description : \"No description available for this book.\",\n author: newAuthor\n })\n .then(res => {\n // call update books to remove the just saved book from page\n updateBooks(bookIndex);\n })\n .catch(err => console.log(err));\n }", "function submit() {\r\n if (title.value==null || title.value==\"\" || author.value==null || author.value==\"\" || pages.value==null || pages.value==\"\") {\r\n alert (\"Please fill all fields!\");\r\n return false;\r\n }\r\n else {\r\n let book = new Book (title.value, author.value, pages.value, check.checked);\r\n myLibrary.push(book);\r\n localStorage.setItem('myLibrary', JSON.stringify(myLibrary));\r\n render();\r\n }\r\n}", "function addBook(newBook) {\n $.ajax({\n url: 'http://127.0.0.1:8000/book/',\n method: 'POST',\n data: newBook,\n dataType: 'json'\n }).done(function (response) {\n getBooks();\n clearInputs();\n })\n }", "function addBook(title, author) {\n $.post(\"/api/addnew\", {\n title: title,\n author: author\n });\n location.reload();\n }", "function generateData(e) {\n e.preventDefault();\n const newBook = addBooks(bookName.value, bookAuthor.value, bookYear.value);\n generateBooks(newBook);\n bookYear.value = \"\";\n bookName.value = \"\";\n bookAuthor.value = \"\";\n}", "onClick() {\n this.service.postBook(this.bookName.value, this.selectedAuthor.authorId, this.numPages.value, this.price.value);\n this.bookName.setValue('');\n this.numPages.setValue('');\n this.price.setValue('');\n this.selectedAuthor = null;\n }", "function updateBook(e){\n\n\t// let gather our data\n\tvar editbuffer= {\n\t\t\tname: $.name.value,\n\t\t\tisbn: $.isbn.value,\n\t\t\tauthor: $.author.value,\n\t\t\tgenre: $.genre.value\n\t};\n\n\t// New Book opton\n\tif(!mybook){\n\t\tvar book = Alloy.createModel('PeppaBook'); \n\t\tbooks.add(book);\n\t\tbook.save( editbuffer,{\n\t\t\n\t\t\tsuccess: function(){\n\t\t\t\talert('You book details have been recorded');\n\t\t\t\t$.trigger('save');\n\t\t\t},\n\t\t\n\t\t\terror: function(){\n\t\t\t\talert('There was an error saving your book details');\n\t\t\t\t$.trigger('save');\n\t\t\t}\n\t\t});\n\t}\n\telse{\n\t\tmybook.set(editbuffer).save({},{\n\t\t\t\t\t\n\t\t\terror: function(){\n\t\t\t\talert('There was an error updating your book details');\n\t\t\t}\t\t\t\n\t\t});\n\t}\n\n\t\n}", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title) {\n API.searchBooks(formObject.title)\n .then(res => {\n setBooks(res.data.items.map(book => (\n {\n \"id\": book.id,\n \"title\": book.volumeInfo.title,\n \"author\": book.volumeInfo.authors,\n \"description\": book.volumeInfo.description || \"\",\n \"image\": book.volumeInfo.imageLinks.thumbnail,\n \"link\": book.volumeInfo.infoLink\n }\n )))\n })\n .catch(err => console.log(err));\n }\n }", "function addBookToLibrary(e) {\n e.preventDefault();\n let title = document.getElementById('title-in').value\n let author = document.getElementById('author-in').value\n let genre = document.getElementById('genre-in').value\n let numPages = document.getElementById('pages-in').value\n let book = new Book(title, author, genre, numPages)\n\n library.push(book) \n console.log(library[library.length - 1].getInfo())\n form.reset()\n form.style.visibility = 'hidden'\n createBookDiv(book)\n}", "function libraryFormSubmit(event) {\n\n let title = document.getElementById('title').value;\n let author = document.getElementById('author').value;\n let getGenres = document.getElementsByName('genre');\n let genre\n Array.from(getGenres).forEach(element => {\n if (element.checked) {\n genre = element.value;\n }\n });\n let newBook = new Book(title, author, genre);\n\n if (newBook.validate()) {\n newBook.addBook();\n Display.show('success', 'Book added successfully');\n } else {\n Display.show('danger', 'Sorry enter a valid book');\n }\n Display.clear();\n event.preventDefault();\n}", "function addBookToLibrary() {\n if (titleInput.value === \"\" || authorInput.value === \"\") { //making sure we have these required inputs filled out\n alert(\"Please fill out all required inputs to submit your book\");\n } else {\n let formData = new FormData(form); /* learned this from this thread https://stackoverflow.com/questions/41431322/how-to-convert-formdatahtml5-object-to-json*/\n let obj = Object.fromEntries(formData);\n let book = new Book(obj.title, obj.author, obj.readstatus, obj.rating); //using object destructuring to pull our form data object property values to pass as arguments to our constructor function\n myLibrary.push(book); //pushing our newly created book object into the myLibrary array\n }\n setStorage(myLibrary);\n getScore(myLibrary);\n}", "function addBookToLibrary() {\n // Stays on the same page for the form after submitting\n const myForm = document.getElementById(\"form\");\n myForm.addEventListener(\"submit\", (e) => {\n e.preventDefault();\n });\n const author = document.getElementById(\"author\");\n const title = document.getElementById(\"title\");\n const pages = document.getElementById(\"pages\");\n const getSelectedValue = document.querySelector( \n 'input[name=\"read\"]:checked');\n const read = getSelectedValue.value;\n const newBook = new Book(title.value, author.value, pages.value, read);\n myLibrary.push(newBook);\n}", "function addBook(e){\n //Get form values\n const title = document.getElementById('title'),\n author = document.getElementById('author'),\n isbn = document.getElementById('isbn');\n \n const book = new Book(title.value, author.value, isbn.value);\n\n //Required field validators\n if((title.value && author.value && isbn.value) === ''){\n // Show error message\n ui.showMessage('Please fill in all fields', 'error');\n } else {\n ui.addBookToList(book);\n ui.clearInputs(title , author, isbn);\n \n // Show success message\n ui.showMessage('Book is succefully added to the library', 'success');\n };\n\n e.preventDefault();\n}", "function addBookBtn() {\n if (formAuthor.value && formTitle.value && formPages.value) {\n let newBook = new Book();\n newBook.author = formAuthor.value;\n newBook.title = formTitle.value;\n newBook.pages = formPages.value;\n newBook.read = returnReadOption();\n myLibrary.push(newBook);\n formTitle.value = \"\";\n formAuthor.value = \"\";\n formPages.value = \"\";\n notRead.checked = true;\n toggleModal();\n loadLibrary();\n } else {\n alert(\"Please fill out the form\")\n }\n}", "function addBookToLibrary(e) {\n\te.preventDefault();\n\n\tif($title.value == '' || $author.value =='' || $pages.value == '' ){\n\t\talert('please input');\n\n\t}else{\n\t\tconst newTitle = $title.value;\n\t\tconst newAuthor = $author.value;\n\t\tconst newPages = $pages.value;\n\t\tconst newRead = getReadStatus();\n\t\tconst newBook = new Book(newTitle,newAuthor,newPages,newRead);\n\t\tmyLibrary.push(newBook)\n\t\tupdateLocalStorage(myLibrary);\n\t\tclearForm();\n\t\tdisplayLibrary();\n\t\ttoggleForm();\n\t}\n\n\t\n}", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title) {\n API.searchBooks(formObject.title)\n .then(res => setBooks(res.data.items))\n .catch(err => console.log(err))\n }\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title) {\n API.searchBook(formObject.title)\n .then((res) => {\n setBooks(res.data.items);\n })\n .catch((err) => console.log(err));\n }\n }", "function createBook (){\n let titleInput = document.getElementById('titleInput').value\n let authorInput = document.getElementById('authorInput').value\n let pagesInput = document.getElementById('pagesInput').value\n let readInput = document.getElementById('readInput').value\n\n let book = new Book(titleInput, authorInput, pagesInput, readInput)\n\n document.getElementById('titleInput').value = ''\n document.getElementById('authorInput').value = ''\n document.getElementById('pagesInput').value = ''\n document.getElementById('readInput').value = 'No'\n\n pushBookToLibrary(book)\n}", "function createNewBook() {\n const book = new Book(\n document.querySelector(\"#name\").value,\n document.querySelector(\"#author\").value,\n document.querySelector(\"#pages\").value,\n document.querySelector(\"#read\").value == \"true\" ? true : false\n );\n addBookToLibrary(book);\n updateLocalStorage(myLibrary);\n displayBook(book);\n toggleForm();\n}", "function bookForm() {\n\n var c = [];\n\n c.push(\" <form class='w3-container w3-border w3-border-amber'>\");\n c.push(\"<br><span style='width: 8em; display: inline-block' class='w3-amber'>Title : </span><input type='text' required id='currentTitle' size='50' ><br>\");\n c.push(\"<span style='width: 8em; display: inline-block' class='w3-amber'>Author : </span><input type='text' required id='currentAuthor' size='50' ><br>\");\n c.push(\"<span style='width: 8em; display: inline-block' class='w3-amber'>Category : </span><input type='text' required id='currentCategory' size='50' ><br>\");\n c.push(\"<span style='width: 8em; display: inline-block' class='w3-amber'>Format : </span><input type='text' required id='currentFormat' size='50' ><br><br>\");\n c.push(\"<button type='button' id='add' class='w3-button w3-xlarge w3-border w3-border-amber w3-round-xxlarge'>Add book</button><br><br>\");\n c.push(\"</form>\");\n c.push(\"<br><p id='message' class='w3-amber w3-large'></p>\");\n\n\n $('#book').html(c.join(\"\"));\n\n document.getElementById(\"add\").onclick = function () {\n addBook();\n };\n\n }", "function addBook(bookToAdd) {\n if ($('#title').val() === '' || $('#author').val() === '' ) {\n alert('All fields are required');\n } else {\n $.ajax({\n type: 'POST',\n url: '/books',\n data: bookToAdd,\n }).then(function (response) {\n console.log('Response from server.', response);\n refreshBooks();\n $('input').val('');\n }).catch(function (error) {\n console.log('Error in POST', error)\n alert('Unable to add book at this time. Please try again later.');\n });\n }\n}", "function handleModalAccept() {\r\n var newBook = getNewBookValsFromModal();\r\n insertNewBook(newBook.id, newBook.title, newBook.author, newBook.subject, newBook.photoURL, newBook.vendorURL, newBook.favorite);\r\n window.location.reload(false);\r\n storeBook(newBook.title, newBook.author, newBook.photoURL, newBook.subject, newBook.vendorURL, newBook.favorite);\r\n hideAddBookModal();\r\n}", "function addNewBook(e){\n e.preventDefault();\n\n let books = getBooks();\n\n // fetch input from user\n let title = addBookForm.querySelector(\"#title\").value;\n let author = addBookForm.querySelector(\"#author\").value;\n let genre = addBookForm.querySelector(\"#genre\").value;\n \n\n // validate values \n if (title === \"\" || author === \"\" || genre == \"\"){\n //show alert for invalid details\n showAlert(\"Please enter valid details\", \"danger\");\n\n } else {\n let book = {\n title: title,\n author: author,\n genre: genre,\n }\n\n //set to localstorage\n books.push(book);\n localStorage.setItem(\"books\", JSON.stringify(books));\n\n // display books\n displayBooks();\n\n //clear input fields\n addBookForm.reset();\n\n // show alert of success\n showAlert(`${title} successfully added.`, \"success\");\n }\n}", "function addBookToLibrary() {\n let addTitle = document.getElementById(\"new-title\").value;\n let addAuthor = document.getElementById(\"new-author\").value;\n let addPages = document.getElementById(\"new-pages\").value;\n let radios = document.getElementsByName(\"new-read\");\n\n radios.forEach(function (radio) {\n if (radio.checked) addStatus = radio.value;\n });\n\n let newBook = new Book(addTitle, addAuthor, addPages, addStatus);\n myLibrary.push(newBook);\n saveLocalAndRender();\n}", "function fillEditForm() {\n let selectedBook = document.getElementById('selected-book')\n let titleInput = document.getElementById('title-edit-in')\n let authorInput = document.getElementById('author-edit-in')\n let genreInput = document.getElementById('genre-edit-in')\n let pagesInput = document.getElementById('pages-edit-in')\n let i = selectedBook.dataset.index\n\n titleInput.value = library[i].title\n authorInput.value = library[i].author\n genreInput.value = library[i].genre\n pagesInput.value = library[i].numPages \n}", "postEditBook(evt) {\n console.log(\"Updating\", this.bookForm);\n\n fetch('api/books/update.php', {\n method:'POST',\n body: JSON.stringify(this.bookForm),\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\"\n }\n })\n .then( response => response.json() )\n .then( json => {\n console.log(\"Returned from post:\", json);\n this.books = json;\n // RESET\n this.resetBookForm();\n });\n }", "function addBookToLibrary() {\n const title = document.querySelector('#title-input').value;\n const author = document.querySelector('#author-input').value;\n const pages = document.querySelector('#pages-input').value;\n let read = document.querySelector('#read-input').checked;\n if (read == true) {\n read = \"read\";\n } else {\n read = \"unread\";\n } ;\n addForm.reset();\n addForm.hidden = true;\n addBtn.hidden = false;\n submitBtn.hidden = true;\n myLibrary.push(new Book(title, author, pages, read));\n clearTable();\n displayBooks();\n}", "onSubmit(e) {\n e.preventDefault();\n const newEditedbook = {\n book_title: this.state.book_title,\n book_author: this.state.book_author,\n book_publishdate: this.state.book_publishdate,\n book_content: this.state.book_content,\n };\n console.log(newEditedbook);\n\n // This will send a post request to update the data in the database.\n axios\n .post(\n \"http://localhost:5000/update/\" + this.props.match.params.id,\n newEditedbook\n )\n .then((res) => console.log(res.data));\n\n this.props.history.push(\"/\");\n }", "onClick() {\n this.service.postAuthor(this.authorName.value);\n this.authorName.setValue('');\n let aBC = new _AddBookComponent__WEBPACK_IMPORTED_MODULE_3__[\"AddBookComponent\"](this.service2, this.service);\n aBC.loadAuthors();\n }", "function addBookToLibrary() {\n library.push(new Book(form.elements[0].value, //title\n form.elements[1].value, //author\n parseInt(form.elements[2].value), //pages\n form.elements[3].checked)) //read \n clearLibrary()\n sortLibrary()\n createStoredCards()\n saveLocal()\n}", "function postBook() {\n event.preventDefault();\n\n var book = {};\n\n $.each($('#book-form').serializeArray(), function(i, field) {\n book[field.name] = field.value;\n });\n\n $.ajax({\n type: 'POST',\n url: '/books',\n data: book,\n success: function() {\n console.log('POST /books works!');\n $('#genreSelect').empty();\n $('#book-list').empty();\n getBooks();\n getSearchItems();\n },\n\n error: function(response) {\n console.log('POST /books does not work...');\n },\n });\n}", "function handleFormSubmit(event) {\n\t\tevent.preventDefault();\n\t\tif (formObject.title) {\n\t\t\tAPI.searchTitle(formObject.title)\n\t\t\t\t.then((res) => {\n\t\t\t\t\tconsole.log('TESTING2: ', res);\n\t\t\t\t\tsetBooks(res.data.items);\n\t\t\t\t})\n\t\t\t\t.catch((err) => console.log(err));\n\t\t}\n\t}", "function handleSaveBook(bookData) {\n \n console.log(\"Save Book Data: \", bookData);\n\n API.saveBook({\n title: bookData.title,\n authors: bookData.authors,\n description: bookData.description,\n image: bookData.image,\n link: bookData.link,\n id: bookData.id\n })\n .then(window.alert(\"Thank you, your book has been saved!\"))\n .catch(err => console.log(err));\n }", "function main(){\n fetchBooks()\n createFormListener()\n}", "function pushBook() {\n bookTitle = document.querySelector('#bookName').value;\n bookAuthor = document.querySelector('#bookAuthor').value;\n bookPages = document.querySelector('#bookPages').value;\n bookRead = document.querySelector('#bookRead').checked;\n\n if (bookTitle === '' || bookAuthor === '' || bookPages === '') {\n alert('Please fill all fields.');\n } else {\n addBookToLibrary(bookTitle, bookAuthor, bookPages, bookRead);\n }\n}", "addBookLibrary() {\n const bookStatus = readBtn.innerText;\n const bookItem = new Book(bookId, authorForm.value, titleForm.value, pagesForm.value, bookStatus);\n bookId++;\n myLibrary.push(bookItem);\n this.storage.saveData();\n\n this.renderElem.clearForm();\n this.renderElem.render();\n }", "saveBook(event) {\n const bookInfo = event.target;\n API.saveBook({\n title: bookInfo.dataset.title,\n authors: bookInfo.dataset.authors,\n description: bookInfo.dataset.description,\n image: bookInfo.dataset.image,\n link: bookInfo.dataset.link\n })\n .then(res => console.log('Saved!'))\n //SEND OUT A MODAL WHEN YOU GET A CHANCE\n .catch(err => console.log(err));\n }", "postBook(evt) {\n if (this.selectedBook === null) {\n this.postNewBook(evt);\n } else {\n this.postEditBook(evt);\n }\n }", "function addNewBook() {\n\n //get details from the html form and create JSON\n var params = {\n \"title\": document.getElementById(\"title\").value,\n \"series\": document.getElementById(\"series\").value,\n \"author\": document.getElementById(\"author\").value,\n \"img\": document.getElementById(\"image\").value,\n \"rating\": document.getElementById(\"rating\").value,\n \"description\": document.getElementById(\"desc\").value,\n \"genre\": $('#genre').val(),\n \"language\": document.getElementById(\"language\").value,\n \"link\": document.getElementById(\"external\").value,\n \"online\": document.getElementById(\"online\").checked\n };\n\n if (validity(document.getElementById(\"title\")) && \n validity(document.getElementById(\"rating\")) &&\n validity(document.getElementById(\"image\"))) {\n\n\n let urlText = 'http://localhost:3000/'+writtenText.toLowerCase(writtenText)+'/';\n xhttp.open('POST', urlText);\n xhttp.setRequestHeader('Content-type', 'application/json');\n xhttp.send(JSON.stringify(params));\n xhttp.onload = function(){\n if(this.readyState == 4 && this.status == 200){\n url = JSON.parse(this.responseText);\n\n //resetting values of the modal form\n document.getElementById(\"title\").value = '';\n document.getElementById(\"series\").value = '';\n document.getElementById(\"author\").value = '';\n document.getElementById(\"image\").value = '';\n document.getElementById(\"rating\").value = '';\n document.getElementById(\"desc\").value = '';\n $('#genre').val([]);\n document.getElementById(\"language\").value = '';\n document.getElementById(\"external\").value = '';\n document.getElementById(\"online\").checked = false;\n\n mainPage();\n } \n }\n\n }\n\n \n}", "async function HandleUpload() {\n /*let newBook={id:bookId, title, genre, sinopsis, coverImageData:imageData, price, author, comments};\n let books=await AsyncStorage.getItem('books');\n books=JSON.parse(books);\n const index=books.findIndex(book=>book.id===bookId);\n books[index]=newBook;\n books=JSON.stringify(books);\n await AsyncStorage.setItem('books', books);*/\n var book=new Book(title, sinopsis, author, genre, price, imageData, comments, bookId);\n var result=await book.Update();\n if(result) {\n ClearFields();\n navigation.navigate('Store');\n }\n else {\n Alert.alert(\"Error:\", \"Couldn't Save the edits to the book...\");\n }\n }", "function createBook() {\n //Create JSON object\n var book = {\n isbn: +$(\"#bookIsbn\").val(),\n title: $(\"#bookTitle\").val(),\n author: $(\"#bookAuthor\").val(),\n edition: $(\"#bookEdition\").val()\n };\n\n\n //Create book\n SDK.Book.create(book, function(err, data){\n if(err) throw JSON.stringify(err);\n\n alert(\"Du har nu oprettet følgende bog: \" + book.title +\" med ISBN: \" + book.isbn);\n window.location.href = \"admin.html\";\n\n $(\"#newBookModal\").modal(\"hide\");\n });\n\n }", "postNewBook(evt) {\n console.log(\"Creating!\", this.bookForm);\n\n fetch('api/books/create.php', {\n method:'POST',\n body: JSON.stringify(this.bookForm),\n headers: {\n \"Content-Type\": \"application/json; charset=utf-8\"\n }\n })\n .then( response => response.json() )\n .then( json => {\n console.log(\"Returned from post:\", json);\n // TODO: test a result was returned!\n this.books = json;\n // Reset the form\n this.bookForm = {};\n });\n }", "function saveNewBook(working) {\n\n if (working==null) working = '';\n var service = working + '/book/add';\n var digitPat = /\\d+/;\n var floatPat = /\\d+\\.\\d{0}/;\n\n var title = document.getElementById(\"title\").value;\n var desc = document.getElementById(\"desc\").value;\n var isbn = document.getElementById(\"isbn\").value;\n\n var raw = document.getElementById(\"pages\").value;\n var pages;\n if (digitPat.test(raw)) {\n pages = parseInt(raw);\n } else {\n alert('Pages must be number');\n return;\n }\n\n var price;\n raw = document.getElementById(\"price\").value;\n if (floatPat.test(raw)) {\n price = parseFloat(raw);\n } else {\n alert('Price must be real');\n return;\n }\n var Book = {\n \"id\":null,\n \"title\":title,\n \"price\":price,\n \"description\":desc,\n \"isbn\":isbn,\n \"pages\":pages\n };\n\n var json = JSON.stringify(Book);\n var xmlHttp = new XMLHttpRequest();\n xmlHttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n okStateNote(this.responseText);\n } else {\n errorState(this.responseText);\n }\n };\n\n xmlHttp.open(\"POST\", service, true);\n xmlHttp.send(json);\n}", "function addBookToLibrary(){\n let bookTitle = document.getElementById(\"book-title\").value;\n let bookAuthor = document.getElementById(\"book-author\").value;\n let bookPages = document.getElementById(\"book-pages\").value;\n let booksLibrary = document.getElementById(\"library\");\n let error;\n let readOrNot;\n let inputText = document.querySelectorAll(\".book-info\");\n let readCheck = document.getElementById(\"have-read-check\").checked;\n if(readCheck === true){\n readOrNot = \"Read\";\n }else{\n readOrNot = \"Not Read\";\n }\n //checks to make sure all fields are filled\n if(bookPages < 1 || bookTitle === \"\" || bookAuthor === \"\" || bookPages === \"\"){\n error = document.querySelector(\"#error\"); \n error.textContent =\"Please fill in all fields!\";\n setInterval(function(){\n error.textContent = \" \";\n }, 2800)\n\n }else{\n aNewBook = new Book(inputText[0].value,inputText[1].value,inputText[2].value,inputText[3].value,readOrNot);\n myLibrary.push(aNewBook);\n let eachBookDiv = document.createElement(\"div\");\n let currentBook = myLibrary[myLibrary.length - 1];\n let deleteButton = document.createElement(\"button\");\n deleteButton.textContent = \"Delete\";\n deleteButton.setAttribute(\"data-index\", myLibrary.length - 1);\n deleteButton.classList.add(\"delete-button\");\n deleteButton.addEventListener(\"click\",function(){\n let index = deleteButton.getAttribute(\"data-index\");\n let divToRemove = document.querySelector(`[data-index = \"${index}\"]`);\n divToRemove.remove();\n });\n\n eachBookDiv.classList.add(\"book-div\");\n console.log(currentBook);\n//adds book to display\n inputText.forEach(function(el){\n let para = document.createElement(\"p\");\n para.textContent = el.value;\n para.classList.add(\"book\");\n eachBookDiv.setAttribute(\"data-index\", myLibrary.length - 1);\n eachBookDiv.appendChild(para);\n booksLibrary.appendChild(eachBookDiv);\n eachBookDiv.appendChild(deleteButton);\n })\n form.reset();\n }\n \n }", "function closeForm() {\n const form = document.querySelector('#form')\n let title = document.querySelector('#formTitle').value;\n let author = document.querySelector('#formAuthor').value;\n let pages = document.querySelector('#formPage').value;\n let read = document.querySelector('#formRead').value;\n let newBook = new book(title, author, pages, read);\n debugger\n console.log(newBook);\n form.style.display = 'block';\n //form grabs data but disapears????\n}", "function handleSave(bookID) {\n console.log(bookID);\n\n let savedBook = searchResult.find((book) => book._id === bookID);\n API.saveBook(savedBook)\n .then(() => {\n console.log(\"Storing book\");\n })\n .catch((err) => console.error(err));\n\n let filteredBooks = searchResult.filter((book) => book._id !== bookID);\n setSearchResult(filteredBooks);\n }", "function addBookToLibrary(event) {\n event.preventDefault();\n const title = document.getElementById(\"title\").value;\n const author = document.getElementById(\"author\").value;\n const pages = document.getElementById(\"pages\").value;\n //const read = document.querySelector(\"#read\").checked;\n let newBook = new book(title, author, pages);\n myLibrary.push(newBook);\n displayLibrary();\n}", "static addBookToList(book) {\n // get the all the books from local-storage\n let storedBooks = JSON.parse(localStorage.getItem('Books'))\n // check if the stored-books is not null\n storedBooks = storedBooks ? storedBooks : []\n // then push a new book to the list\n storedBooks.push(book)\n // finally rewrite the Books in local-storage with a new added book\n localStorage.setItem('Books', JSON.stringify(storedBooks))\n // and clear the form input fields\n document.getElementById('book-form').reset()\n }", "function saveBooks(bookData) {\n\n\n API.saveBook({bookData})\n .then(console.log(bookData))\n .catch(err => console.log(err));\n }", "function register_books(e){\n\t\te.preventDefault();\n\n\t\tvar _self = this;\n\t\tvar data = new FormData(this);\n\t\t\n\t\tconnect('POST', 'index.php?q=/books', data)\n\t\t\t.done(function(responsse){\n\t\t\t\tnotify_success('Livro cadastrado com sucesso');\n\t\t\t\t$(_self).trigger('reset');\n\t\t\t\tload_books();\n\t\t\t})\n\t\t\t.fail(notify_error);\n\t}", "function handleFormSubmit() {\n API.saveReviews(formObject)\n .then((data) => {\n console.log(data);\n console.log(\"I hit the route\");\n })\n .catch((err) => console.log(err));\n }", "handleSubmit(e){\n e.preventDefault();\n //create url based on search and filter parameters\n let url = '';\n if (this.state.filter !== '' && this.state.type !== ''){\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&filter=${this.state.filter}&printType=${this.state.type}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n } else if (this.state.filter !== '' && this.state.type === ''){\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&filter=${this.state.filter}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n } else if (this.state.type !== '' && this.state.filter === ''){\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&printType=${this.state.type}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n } else {\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n }\n \n const options = {\n method: 'GET'\n }\n //call google books API\n fetch(url, options)\n .then(res => {\n if(!res.ok){\n throw new Error('something went wrong');\n }\n return res.json()\n })\n .then(data => {\n this.setState({\n books: data,\n error: null\n })\n console.log(data);\n //update books array in App.js with new data\n this.props.updateInfo(data);\n })\n .catch(err => {\n this.setState({\n error: err.message\n })\n })\n }", "function saveBook() {\n let name = $('#title');\n let author = $('#author');\n let year = $('#year');\n let publishingHouse = $('#publishingHouse');\n let qtyOfPages = $('#qtyOfPages');\n let qtyOfBooks = $('#qtyOfBooks');\n\n if (name.val().length === 0) {\n $('#title').css('border', '1px solid red');\n return false;\n } else {\n $('#title').css('border', '1px solid black');\n }\n\n if (author.val().length === 0) {\n $('#author').css('border', '1px solid red');\n return false;\n } else {\n $('#author').css('border', '1px solid black');\n }\n\n if (year.val().length === 0 || Number(year.val()) < 0 || isNaN(year.val())) {\n $('#year').css('border', '1px solid red');\n return false;\n } else {\n $('#year').css('border', '1px solid black');\n }\n\n if (publishingHouse.val().length === 0) {\n $('#publishingHouse').css('border', '1px solid red');\n return false;\n } else {\n $('#publishingHouse').css('border', '1px solid black');\n }\n\n if (\n qtyOfPages.val().length === 0 ||\n Number(qtyOfPages.val()) < 0 ||\n isNaN(qtyOfPages.val())\n ) {\n $('#qtyOfPages').css('border', '1px solid red');\n return false;\n } else {\n $('#qtyOfPages').css('border', '1px solid black');\n }\n\n if (\n qtyOfBooks.val().length === 0 ||\n Number(qtyOfBooks.val()) < 0 ||\n isNaN(qtyOfBooks.val())\n ) {\n $('#qtyOfBooks').css('border', '1px solid red');\n return false;\n } else {\n $('#qtyOfBooks').css('border', '1px solid black');\n }\n\n let tempObj = JSON.parse(localStorage.getItem('dataOfBooks'));\n\n let currentId;\n\n let arrId = [];\n\n for (let i = 0; i < tempObj.length; i++) {\n arrId.push(tempObj[i].id);\n }\n\n if (arrId.length === 0) {\n currentId = 1;\n } else {\n currentId = Math.max(...arrId) + 1;\n }\n\n let tmp = {\n id: currentId,\n name: name.val(),\n author: author.val(),\n year: year.val(),\n namePublishingHouse: publishingHouse.val(),\n qtyOfPages: qtyOfPages.val(),\n qtyOfBooks: qtyOfBooks.val(),\n rating: 0,\n };\n\n tempObj.push(tmp);\n\n localStorage.setItem('dataOfBooks', JSON.stringify(tempObj));\n\n $('#exampleModal').modal('hide');\n\n getHtml();\n\n tmp = {};\n}", "function submitClick () {\n\n readInput();\n booking.id = null;\n submitInput();\n\n}", "async function editBookAdded() {\n\n\n const bookId = document.querySelector('#bookId').value\n const data = {\n \"isbn\": document.querySelector(\"#isbn\").value,\n \"title\": document.querySelector(\"#title\").value,\n \"overdueFee\": document.querySelector(\"#overdueFeeid\").value,\n \"publisher\": document.querySelector(\"#publisherid\").value,\n \"datePublished\": document.querySelector(\"#datePublishedid\").value\n };\n console.log(data)\n const response = await fetch(`https://elibraryrestapi.herokuapp.com/elibrary/api/book/update/${bookId}`, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(data)\n });\n const json = await response.json();\n document.querySelector(\"#updateDisp\").style.display = 'block';\n setTimeout(() => {\n fetchBook();\n }, 3000)\n\n}", "save() {\n try {\n this._toggleSaveThrobber();\n this._readFromForm();\n this.dao.save();\n\n // make sure the edit input is showing the correct id, reload data from server\n document.getElementById('edit_id').value = this.dao.id;\n this.read();\n \n } catch(e) {\n console.log(e);\n alert(e);\n }\n this._toggleSaveThrobber();\n }", "function handleSearchFormSubmit(event) {\n event.preventDefault();\n\n API.getBooks(formObject.title)\n .then(res => {\n let myBooksArray = res.data.items;\n let myNewBooksArray = [];\n\n for (let i = 0; i < myBooksArray.length; i++) {\n let myBookObj = {\n key: myBooksArray[i].id,\n id: myBooksArray[i].id\n }\n \n if (!(myBooksArray[i].volumeInfo.title) || (myBooksArray[i].volumeInfo.title === undefined)) {\n myBookObj.title = \"Title coming soon...\";\n } else {\n myBookObj.title = myBooksArray[i].volumeInfo.title;\n }\n\n if (!(myBooksArray[i].volumeInfo.description) || (myBooksArray[i].volumeInfo.description === undefined)) {\n myBookObj.description = \"Description coming soon...\";\n } else {\n myBookObj.description = myBooksArray[i].volumeInfo.description;\n }\n\n if (!(myBooksArray[i].volumeInfo.infoLink) || (myBooksArray[i].volumeInfo.infoLink === undefined)) {\n myBookObj.infoLink = \"#\";\n } else {\n myBookObj.infoLink = myBooksArray[i].volumeInfo.infoLink;\n } \n\n if (!(myBooksArray[i].volumeInfo.imageLinks) || (myBooksArray[i].volumeInfo.imageLinks === undefined)) {\n myBookObj.image = \"https://via.placeholder.com/300\";\n } else {\n myBookObj.image = myBooksArray[i].volumeInfo.imageLinks.thumbnail;\n } \n\n if (!(myBooksArray[i].volumeInfo.authors) || (myBooksArray[i].volumeInfo.authors === undefined)) {\n myBookObj.authors = [\"Anonymous, Not Listed\"];\n } else {\n myBookObj.authors = myBooksArray[i].volumeInfo.authors;\n } \n myNewBooksArray.push(myBookObj);\n }\n setBooks(myNewBooksArray);\n })\n .catch(err => console.log(err));\n }", "function addBook(bookToAdd) {\n $.ajax({\n type: 'POST',\n url: '/books',\n data: bookToAdd,\n }).then(function(response) {\n console.log('Response from server.');\n refreshBooks();\n }).catch(function(error) {\n console.log('Error in POST', error)\n });\n}", "function addNewBookToBookList(e) {\n\te.preventDefault();\n\n\t// Add book book to global array\n let newBookForm = e.target.children;\n let bookName = newBookForm[0].value;\n let bookAuthor = newBookForm[1].value;\n let bookGenre = newBookForm[2].value;\n let newBook = new Book(bookName, bookAuthor, bookGenre);\n\n // -- this also works --\n // let newBookName = document.querySelector('#newBookName').value;\n // let newBookAuthor = document.querySelector('#newBookAuthor').value;\n // let newBookGenre = document.querySelector('#newBookGenre').value;\n // let newBook = new Book(newBookName, newBookAuthor, newBookGenre);\n\n // add book to library\n libraryBooks.push(newBook);\n\n\t// Call addBookToLibraryTable properly to add book to the DOM\n addBookToLibraryTable(newBook);\n\n}", "function addBookToLibrary() {\n\n\n const title = document.getElementById('booktitle').value\n const author = document.getElementById('author').value\n const pages = document.getElementById('pages').value\n const alreadyRead = document.getElementById('alreadyread').checked\n const book = new Book(title, author, pages, alreadyRead)\n myLibrary.push(book)\n updateTable()\n\n\n\n\n\n}", "handleEditBook(event)\n {\n let text = event.toElement.id.replace(\"adminEdit\", \"\");\n $(\"#editBookFormISBN\").val(text);\n $(\"#editBookFormID\").submit();\n }", "static async updateBooking(form) {\n return api.post('/update-booking/', form).then((response) => {\n return response.data.map((b) => new Booking(b));\n });\n }", "function editBookInLibrary(e) {\n e.preventDefault();\n let selectedBook = document.getElementById('selected-book')\n let i = selectedBook.dataset.index\n let p = document.querySelector(`div[data-index='${i}'] > p`)\n\n library[i].title = editForm.querySelector('#title-edit-in').value\n library[i].author = editForm.querySelector('#author-edit-in').value\n library[i].genre = editForm.querySelector('#genre-edit-in').value\n library[i].numPages = editForm.querySelector('#pages-edit-in').value\n\n p.innerHTML = createBookDivText(library[i]) \n\n exitEditBookForm()\n exitSelectedBook()\n}", "function submitNewCard(event) {\n //preventing from submitting a form right away\n event.preventDefault();\n let book = Object.create(Book.prototype);\n\n book.title = event.target.elements['title'].value;\n book.author = event.target.elements['author'].value;\n book.pages = event.target.elements['pages'].value;\n book.read = event.target.elements['read'].checked;\n \n addBookToLibrary(book);\n clearForm(event);\n openForm();\n}", "function GetBook () {\n /**\n * Two constant that has been defined.\n * id stores the id that the user want to get\n * item stores the information of the searching Book that returned by the API\n */\n const [id, setId] = useState(\"\");\n const [item, setBook] = useState([]);\n return (\n <div>\n <Form>\n <Form.Field>\n <Input\n placeholder=\"Book Id\"\n value={id}\n onChange={e => setId(e.target.value)}\n />\n </Form.Field>\n <Form.Field>\n <Button onClick={ async () => {\n let data_array = []\n // call the API\n fetch('/api/book?id=' + id).then(response =>\n response.json()).then(data => {\n console.log(data)\n if (data === undefined) {\n data_array.push(data)\n } else {\n for (let i = 0; i < data.length; i++) {\n data_array.push(data[i]);\n }\n }\n }).then(() => setBook(data_array))\n }\n }>\n Get Book\n </Button>\n <ol>\n {item.map(item => (\n // show the information of the book\n <li key={item.book_id}>\n BookId: {item.book_id} | BookName: {item.title} | ISBN: {item.ISBN} | BookAuthor: {item.author} | BookRating: {item.rating}\n </li>\n ))}\n </ol>\n </Form.Field>\n </Form>\n \n </div>\n )\n}", "function updatesHandler() {\n let apiKey = localStorage.getItem(\"apiKey\");\n // include @bookId\n let title = document.getElementById(titleFieldId).value;\n let author = document.getElementById(authorFieldId).value;\n let category = document.getElementById(categoryFieldId).value;\n let file = document.getElementById(fileFieldId).files;\n\n}", "function addBookToLibrary() {\n let title = document.querySelector('#titleinput').value\n let author = document.querySelector('#authorinput').value\n let pages = document.querySelector('#pagesinput').value\n let read = document.querySelector('#modal-check').checked\n let newBook = new Book(title, author, pages, read)\n myLibrary.push(newBook)\n document.querySelector('#modal').classList.remove('active') \n document.querySelector('#overlay').classList.remove('active')\n document.querySelectorAll(\"input\").forEach(input => {\n input.value = \"\"\n }) \n clear()\n refresh() \n}", "function createForm() {\n let form = document.createElement(\"form\");\n form.id = \"formBook\";\n form.className = \"bookForm\"\n\n let title = document.createElement(\"input\")\n title.setAttribute(\"type\", \"text\")\n title.setAttribute(\"name\", \"booktitle\")\n title.setAttribute(\"placeholder\", \"Buchtitel\")\n form.appendChild(title)\n form.appendChild(br.cloneNode());\n\n let author = document.createElement(\"input\")\n author.setAttribute(\"type\", \"text\")\n author.setAttribute(\"name\", \"author\")\n author.setAttribute(\"placeholder\", \"Autor\")\n form.appendChild(author)\n form.appendChild(br.cloneNode())\n\n let pages = document.createElement(\"input\")\n pages.setAttribute(\"type\", \"text\")\n pages.setAttribute(\"name\", \"amountPages\")\n pages.setAttribute(\"placeholder\", \"Seitenzahl\")\n form.appendChild(pages)\n form.appendChild(br.cloneNode())\n\n let read = document.createElement(\"input\")\n read.setAttribute(\"type\", \"text\")\n read.setAttribute(\"name\", \"read\")\n read.setAttribute(\"placeholder\", \"Schon gelesen? true or false\")\n form.appendChild(read)\n form.appendChild(br.cloneNode())\n\n let submit = document.createElement(\"input\")\n submit.setAttribute(\"type\", \"submit\")\n submit.setAttribute(\"value\", \"submit\")\n submit.onclick = function(e) {\n const formID = document.querySelectorAll(\".bookForm\")\n e.preventDefault();\n bookFromForm(formID[0][0].value, formID[0][1].value, formID[0][2].value, formID[0][3].value);\n delAll();\n showBooks();\n }\n\n form.appendChild(submit)\n form.appendChild(br.cloneNode());\n formCont.appendChild(form)\n}", "function addBook() {\n let title = $('#bookTitle').val();\n let author = $('#bookAuthor').val();\n let isbn = $('#bookIsbn').val();\n\n if (!title || !author || !isbn) {\n return;\n }\n\n let data = { title: title, author: author, isbn: isbn };\n console.log(data);\n\n request.post(JSON.stringify(data), appendBook, onError);\n}", "function submitBook(e){\n //prevent the default submit behavior (Reloading the page)\n e.preventDefault();\n\n //If either field is empty, notify the user then break out of the function\n if (title.value == \"\" || author.value == \"\") {\n \n error.textContent = \"Please complete the form\";\n errorMsg.appendChild(error);\n return;\n }\n\n //create element\n const li = document.createElement('li');\n const bookName = document.createElement('span');\n const authorName = document.createElement('p'); \n const deleteBtn = document.createElement('span');\n\n //add content\n deleteBtn.textContent = 'delete';\n bookName.textContent = title.value;\n authorName.textContent = author.value;\n\n //add styling\n deleteBtn.classList.add('delete');\n bookName.classList.add('name');\n authorName.classList.add('author');\n\n //append items \n li.appendChild(bookName);\n li.appendChild(deleteBtn);\n li.appendChild(authorName);\n list.appendChild(li);\n\n \n\n //reset the field values\n title.value=\"\";\n author.value=\"\";\n errorMsg.textContent = \"\";\n}", "function addBookToLibrary() { \r\n myLibrary.push(new Book(formImg.value, formTitle.value, formAuthor.value, formPages.value, formRead.value));\r\n}", "function updatePlaybook() {\n playbookDataService.updatePlaybook(vm.current.details.id, vm.current.details)\n .then(function (data) {\n vm.info = 'Playbook was saved successfully';\n $timeout(function () {\n vm.info = null;\n vm.ownerForm.submitted = false;\n }, 1500);\n getPlaybook(vm.current.details.id);\n getPlaybookList(vm.assessment.id);\n })\n .catch(function (error) {\n vm.message = 'There was an error saving the playbook. Please try again.';\n });\n }", "function formSubmitHandler(event) {\n event.preventDefault();\n const newBookmark = {\n title: $('#bookmark-title').val(),\n url: $('#bookmark-url').val(),\n description: $('#bookmark-description').val(),\n rating: $('#bookmark-rating').val(),\n expanded: false,\n }\n console.log(newBookmark);\n api.createNewBookmark(newBookmark).then(response=>{\n STORE.push(response)\n displayResults(\"all\");\n });\n //STORE.push(newBookmark);\n //displayResults(\"all\");\n}", "selectBookToEdit(o) {\n this.selectedBook = o;\n this.bookForm = Object.assign({}, this.selectedBook);\n }", "function AddUnavailableBook() {\r\n\t//sets a default photo for unavailable books\r\n\tconst defaultThumbnail =\r\n\t\t'https://images.unsplash.com/photo-1575709527142-a93ed587bb83?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=700&q=80';\r\n\tconst { currentUser } = useContext(UserContext);\r\n\tconst [ formData, setFormData ] = useState({\r\n\t\ttitle: '',\r\n\t\tauthors: '',\r\n\t\tdescription: '',\r\n\t\tpersonalreview: '',\r\n\t\tcategroy: '',\r\n\t\tthumnnail: ''\r\n\t});\r\n\tconst [ formErrors, setFormErrors ] = useState([]);\r\n\tconst history = useHistory();\r\n\r\n\tconsole.debug('formData=', formData, 'formErrors=', formErrors);\r\n\r\n\tasync function handleSubmit(evt) {\r\n\t\tevt.preventDefault();\r\n\r\n\t\tlet bookData = {\r\n\t\t\ttitle: formData.title,\r\n\t\t\tauthors: formData.authors,\r\n\t\t\tdescription: formData.description,\r\n\t\t\tpersonalreview: formData.personalreview,\r\n\t\t\tcategory: formData.category,\r\n\t\t\tthumbnail: formData.thumbnail ? formData.thumnnail : defaultThumbnail,\r\n\t\t\tusername: currentUser.username\r\n\t\t};\r\n\r\n\t\ttry {\r\n\t\t\tawait BookWormApi.saveBook(bookData);\r\n\t\t\thistory.push('/booksearch');\r\n\t\t} catch (errors) {\r\n\t\t\tsetFormErrors(errors);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsetFormData((f) => ({\r\n\t\t\ttitle: '',\r\n\t\t\tauthors: '',\r\n\t\t\tdescription: '',\r\n\t\t\tpersonalreview: '',\r\n\t\t\tcategroy: '',\r\n\t\t\tthumnnail: ''\r\n\t\t}));\r\n\t\tsetFormErrors([]);\r\n\t}\r\n\r\n\t/** Handle form data changing */\r\n\tfunction handleChange(evt) {\r\n\t\tconst { name, value } = evt.target;\r\n\t\tsetFormData((f) => ({\r\n\t\t\t...f,\r\n\t\t\t[name]: value\r\n\t\t}));\r\n\t\tsetFormErrors([]);\r\n\t}\r\n\r\n\tfunction cancel() {\r\n\t\thistory.push('/books');\r\n\t}\r\n\r\n\treturn (\r\n\t\t<div className=\"col-md-6 col-lg-4 offset-md-3 offset-lg-4\">\r\n\t\t\t<h3>Book</h3>\r\n\t\t\t<div className=\"card\">\r\n\t\t\t\t<div className=\"card-body\">\r\n\t\t\t\t\t<form>\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label>Title</label>\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tname=\"title\"\r\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\r\n\t\t\t\t\t\t\t\tvalue={formData.title}\r\n\t\t\t\t\t\t\t\tonChange={handleChange}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label>Authors</label>\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tname=\"authors\"\r\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\r\n\t\t\t\t\t\t\t\tvalue={formData.authors}\r\n\t\t\t\t\t\t\t\tonChange={handleChange}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label>Description</label>\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tname=\"description\"\r\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\r\n\t\t\t\t\t\t\t\tvalue={formData.description}\r\n\t\t\t\t\t\t\t\tonChange={handleChange}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label>Personal Review</label>\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tname=\"personalreview\"\r\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\r\n\t\t\t\t\t\t\t\tvalue={formData.personalreview}\r\n\t\t\t\t\t\t\t\tonChange={handleChange}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label>Category</label>\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tname=\"category\"\r\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\r\n\t\t\t\t\t\t\t\tvalue={formData.category}\r\n\t\t\t\t\t\t\t\tonChange={handleChange}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"form-group\">\r\n\t\t\t\t\t\t\t<label>Cover</label>\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\tname=\"thumbnail\"\r\n\t\t\t\t\t\t\t\tclassName=\"form-control\"\r\n\t\t\t\t\t\t\t\tvalue={formData.thumbnail}\r\n\t\t\t\t\t\t\t\tonChange={handleChange}\r\n\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t<p>To get a photo URL, right click on a picture and select \"copy image address\"</p>\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t{formErrors.length ? <Alert type=\"danger\" messages={formErrors} /> : null}\r\n\r\n\t\t\t\t\t\t<button className=\"btn btn-secondary btn-block mt-4\" onClick={handleSubmit}>\r\n\t\t\t\t\t\t\tAdd Book\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t<button className=\"btn btn-secondary btn-block mt-4\" onClick={cancel}>\r\n\t\t\t\t\t\t\tCancel\r\n\t\t\t\t\t\t</button>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t);\r\n}", "function addBookToPage(book) {\n let newBook = bookTemplate.clone(true, true);\n newBook.attr('data-id', book.id);\n newBook.find('.book-img').attr('src', book.image_url);\n newBook.find('.bookTitle').text(book.title);\n newBook.find('.bookDesc').text(book.description);\n if (book.borrower_id) {\n newBook.find('.bookBorrower').val(book.borrower_id);\n }\n bookTable.append(newBook);\n}", "function watchSubmit() {\n $(\"form\").submit(function (event) {\n event.preventDefault();\n let num = $(this).find(\"#inputISBN\").val();\n if (INVENTORY[num]) {\n alert(\"This book has already been added.\");\n } else {\n addBook({\n Title: $(this).find(\"#inputTitle\").val().trim(),\n Year: parseInt($(this).find(\"#inputYear\").val(), 10),\n AuthorLastName: $(this).find(\"#inputAuthorLast\").val().trim(),\n AuthorFirstName: $(this).find(\"#inputAuthorFirst\").val().trim(),\n ISBN: $(this).find(\"#inputISBN\").val().trim()\n }, $(this).find(\"#inputQty\").val().trim());\n $(\".inputBook form input\").val(\"\").blur();\n }\n });\n}", "render() {\n return (\n <div>\n <h3 align=\"center\">Update Book</h3>\n <form onSubmit={this.onSubmit}>\n <div className=\"form-group\" align=\"center\">\n <input\n type=\"submit\"\n value=\"Update book\"\n className=\"btn btn-primary\"\n />\n </div>\n <div className=\"form-group\">\n <label>Book title: </label>\n <input\n type=\"text\"\n className=\"form-control\"\n value={this.state.book_title}\n onChange={this.onChangeBookTitle}\n />\n </div>\n <div className=\"form-group\">\n <label>Author: </label>\n <input\n type=\"text\"\n className=\"form-control\"\n value={this.state.book_author}\n onChange={this.onChangeBookAuthor}\n />\n </div>\n <div className=\"form-group\">\n <label>Content: </label>\n <ManualEditor\n content={this.state.book_content}\n onChange={this.onChangeBookContent.bind(this)}\n />\n </div>\n </form>\n </div>\n );\n }", "function addBookToLibrary() {\r\n //Dynamically generated UI for adding books to Library\r\n let compassingForm = document.getElementById(\"addform\");\r\n let divForm = document.createElement(\"div\");\r\n compassingForm.appendChild(divForm);\r\n divForm.style.position = \"relative\";\r\n divForm.style.width = \"1500px\";\r\n let formBackground = document.createElement(\"img\");\r\n formBackground.src = \"addform.png\"\r\n divForm.appendChild(formBackground)\r\n\r\n let bookForm = document.createElement(\"form\");\r\n\r\n let titleForm = document.createElement(\"input\");\r\n let titleText = document.createElement(\"h3\");\r\n titleText.innerHTML = \"Title\";\r\n titleText.style.left = \"20px\";\r\n titleForm.style.left = \"20px\";\r\n titleForm.style.width = \"550px\";\r\n\r\n let authorForm = document.createElement(\"input\");\r\n let authorText = document.createElement(\"h3\");\r\n authorText.innerHTML = \"Author\";\r\n authorText.style.left = \"600px\"\r\n authorForm.style.left = \"600px\"\r\n authorForm.style.width = \"260px\";\r\n\r\n let genreForm = document.createElement(\"input\");\r\n let genreText = document.createElement(\"h3\");\r\n genreText.innerHTML = \"Genre\";\r\n genreText.style.left = \"885px\"\r\n genreForm.style.left = \"885px\"\r\n genreForm.style.width = \"200px\";\r\n\r\n let yearForm = document.createElement(\"input\");\r\n let yearText = document.createElement(\"h3\");\r\n yearText.innerHTML = \"Year\";\r\n yearText.style.left = \"1115px\"\r\n yearForm.style.left = \"1115px\"\r\n yearForm.style.width = \"70px\"\r\n\r\n let readForm = document.createElement(\"input\");\r\n readForm.setAttribute(\"type\", \"checkbox\")\r\n let checkText = document.createElement(\"h3\");\r\n checkText.innerHTML = \"Read?\"\r\n checkText.style.left = \"1230px\";\r\n readForm.style.left = \"1230px\";\r\n\r\n let labels = [titleText, authorText, genreText, yearText, checkText]\r\n let forms = [titleForm, authorForm, genreForm, yearForm, readForm]\r\n for (let i = 0; i < forms.length; i++) {\r\n bookForm.appendChild(forms[i])\r\n bookForm.appendChild(labels[i])\r\n labels[i].style.color = \"white\";\r\n labels[i].style.position = \"absolute\";\r\n forms[i].style.position =\"absolute\";\r\n labels[i].style.bottom = \"50px\";\r\n forms[i].style.bottom = \"30px\";\r\n }\r\n divForm.appendChild(bookForm);\r\n\r\n let buttonAdd = document.createElement(\"img\");\r\n buttonAdd.src = \"add_button_static.png\";\r\n buttonAdd.style.bottom = \"30px\";\r\n buttonAdd.style.position = \"absolute\";\r\n buttonAdd.style.left = \"1370px\";\r\n buttonAdd.style.width = \"100px\";\r\n buttonAdd.style.height = \"50px\";\r\n divForm.appendChild(buttonAdd)\r\n buttonAdd.addEventListener(\"click\", () => {\r\n \r\n book = new Book(titleForm.value, authorForm.value, genreForm.value, yearForm.value, readForm.checked)\r\n library.push(book)\r\n loopBooks(book);\r\n compassingForm.removeChild(divForm);\r\n })\r\n buttonAdd.addEventListener(\"mouseover\", function(event) {\r\n event.target.src = \"add_button_animation.gif\";\r\n })\r\n buttonAdd.addEventListener(\"mouseout\", function(event) {\r\n event.target.src = \"add_button_static.png\";\r\n })\r\n}", "function bookUpdate(book) {\n\t $.ajax({\n\t url: \"http://localhost:8080/books/\" + book.id,\n\t type: 'PUT',\n\t contentType: \"application/json;charset=utf-8\",\n\t data: JSON.stringify(book),\n\t success: function(book) {\n\t bookUpdateSuccess(book);\n\t },\n\t error: function(request, message, error) {\n\t handleException(request, message, error);\n\t }\n\t });\n\t}", "function addBook(bookToAdd) {\n $.ajax({\n type: 'POST',\n url: '/books',\n data: bookToAdd,\n }).then(function(response) {\n console.log('Response from server.', response);\n refreshBooks();\n }).catch(function(error) {\n console.log('Error in POST', error)\n alert('Unable to add book at this time. Please try again later.');\n });\n}", "function addBook(bookToAdd) {\n $.ajax({\n type: 'POST',\n url: '/books',\n data: bookToAdd,\n }).then(function(response) {\n console.log('Response from server.', response);\n refreshBooks();\n }).catch(function(error) {\n console.log('Error in POST', error)\n alert('Unable to add book at this time. Please try again later.');\n });\n}", "onSubmit(e) {\n // Prevent default submission\n e.preventDefault();\n\n // Create center object to save\n const center = {\n centerName: this.state.centerName,\n description: this.state.description,\n hours: this.state.hours,\n cost: this.state.cost,\n numCourts: this.state.numCourts,\n addressLink: this.state.addressLink,\n mapLink: this.state.mapLink,\n image: this.state.image,\n };\n\n // Send to back-end, look at routes/books.js\n axios\n .post(`${API_URL}/update/${this.props.match.params.id}`, center)\n .then(res => console.log(res.data))\n .catch(err => console.log(err));\n\n // Clear the fields\n this.setState({\n centerName: '',\n description: '',\n hours: '',\n cost: true,\n numCourts: 1,\n addressLink: '',\n mapLink: '',\n image: '',\n });\n }", "function addBook(bookToAdd) {\n $.ajax({\n type: 'POST',\n url: '/books',\n data: bookToAdd,\n })\n .then(function (response) {\n console.log('Response from server.', response);\n refreshBooks();\n })\n .catch(function (error) {\n console.log('Error in POST', error);\n alert('Unable to add book at this time. Please try again later.');\n });\n}", "function saveBook(id) {\n const bookToSave = results.filter(result => result.id === id);\n const [ bookObj ] = bookToSave;\n const [ authors ] = bookObj.volumeInfo.authors;\n \n API.saveBook({\n title: bookObj.volumeInfo.title,\n authors: authors,\n description: bookObj.volumeInfo.description,\n image: bookObj.volumeInfo.imageLinks.smallThumbnail,\n link: bookObj.volumeInfo.infoLink\n })\n .then(alert(\"The book has been saved!\"))\n .catch(err => console.log(err));\n }", "function saveBookToLocal() {\n const key = bookTitle.value.toLowerCase();\n localStorage.setItem(key, JSON.stringify(myLabrary));\n location.reload();\n \n}", "function bookAdd(book) {\n\t $.ajax({\n\t url: \"http://localhost:8080/books\",\n\t type: 'POST',\n\t contentType: \"application/json;\",\n\t data: JSON.stringify(book),\n\t success: function(book) {\n\t bookAddSuccess(book);\n\t },\n\t error: function(request, message, error) {\n\t handleException(request, message, error);\n\t }\n\t });\n\t}", "async function addBook(){\n\n // here we add a book\n let body = {}\n\n let author = document.getElementById(\"author\").value;\n let genre = document.getElementById(\"genre\").value;\n let pub_id = document.getElementById(\"pub_id\").value;\n let num_of_pages = document.getElementById(\"num_of_pages\").value;\n let price = document.getElementById(\"price\").value;\n // let isbn = document.getElementById(\"isbn\").value;\n let title = document.getElementById(\"title\").value;\n let percent = document.getElementById(\"percent\").value;\n let pub_name = document.getElementById(\"pub_name\").value;\n let quantity = document.getElementById(\"quantity\").value;\n\n body.author = author;\n body.genre = genre;\n body.pub_id = pub_id;\n body.num_of_pages = num_of_pages;\n body.price = price;\n // body.isbn = isbn;\n body.title = title;\n body.percent = percent;\n body.pub_name = pub_name;\n body.quantity = quantity;\n\n let success;\n\n try {\n success = await fetch (\"http://localhost:3000/addBook\", {\n method:\"POST\",\n headers:{\n \"content-type\":\"application/json\"\n },\n body:JSON.stringify(body)\n })\n\n success = await success.json()\n\n console.log(\"Success of books addition was a \" + success.success);\n\n if (success.success){\n alert(\"Book was added nicely\")\n } else {\n alert(\"There appears to be an issue\")\n }\n\n } catch (e) {\n console.log(\"ISSUE catch e\" + e);\n }\n\n}", "createBook(book) {\n return this.ajaxCall(\"POST\", `libraries/${this.libraryID}/books`, {book});\n }", "function bookFromForm(title, author, pages, read){\n myLibrary.push(new Book(title, author, pages, read))\n\n}", "function addNewBook() {\n\n title = document.getElementById(\"inputTitle\").value;\n document.getElementById(\"inputTitle\").value = \"\";\n author = document.getElementById(\"inputAuthor\").value;\n document.getElementById(\"inputAuthor\").value = \"\";\n publisher = document.getElementById(\"inputPublisher\").value;\n document.getElementById(\"inputPublisher\").value = \"\";\n isRead = document.getElementById(\"inputRead\").checked;\n document.getElementById(\"inputRead\").checked = false;\n\n myLibrary.push({title,author,publisher,isRead});\n\n document.getElementById(\"formContainer\").style.visibility = \"hidden\";\n \n organize();\n total();\n store();\n\n\n}" ]
[ "0.77916396", "0.75272894", "0.7506747", "0.7442989", "0.73871773", "0.7373677", "0.73676205", "0.7308689", "0.7187482", "0.7170315", "0.7122147", "0.6948661", "0.6941686", "0.6914476", "0.688373", "0.68745273", "0.68709236", "0.6798974", "0.6782425", "0.67492574", "0.6721678", "0.6707923", "0.6706924", "0.66668254", "0.6666399", "0.6637163", "0.66363937", "0.6628793", "0.6628431", "0.65975857", "0.65932405", "0.65900886", "0.657356", "0.65373874", "0.6526042", "0.65081894", "0.6500887", "0.6498927", "0.64850646", "0.647619", "0.64550906", "0.64410937", "0.64337885", "0.6413271", "0.6395673", "0.63876086", "0.63875026", "0.63869435", "0.6379978", "0.637475", "0.6362069", "0.63535213", "0.6349556", "0.6332495", "0.6326315", "0.63180715", "0.6314835", "0.63119066", "0.63116276", "0.6306337", "0.62996197", "0.62864625", "0.6282385", "0.6274323", "0.62733716", "0.6267787", "0.6266006", "0.6237692", "0.6233429", "0.62313545", "0.62271863", "0.62243056", "0.6219266", "0.62116104", "0.6207879", "0.6207219", "0.61970264", "0.61961037", "0.61847955", "0.6181659", "0.6180678", "0.6167572", "0.6165588", "0.61558676", "0.615527", "0.6152859", "0.6150755", "0.61494195", "0.61267173", "0.61140394", "0.61140394", "0.6112556", "0.61092734", "0.6104624", "0.6103428", "0.610154", "0.60983586", "0.608935", "0.6088608", "0.6069282" ]
0.6462441
40
Search bookwhen search button is clicked, the searchBook axios function is called
function searchBook(e) { e.preventDefault(); API.searchBook({searchRequest:searchTerm}) .then(res => { setBooks(res.data); }) .catch(err => { console.log(err); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleBookSearch () {\n // console.log(\"googleKey\", googleKey);\n axios.get(\"https://www.googleapis.com/books/v1/volumes?q=intitle:\" + book + \"&key=\" + googleKey + \"&maxResults=40\")\n .then(data => {\n const result = data.data.items[0];\n setResults(result);\n setLoad(true);\n setLoaded(false);\n })\n .catch(err => {\n console.log('Couldnt reach API', err);\n });\n }", "function handleSearch(event) {\n event.preventDefault();\n\n let query = event.target.search.value;\n API.searchBooks(query)\n .then(({ data }) => {\n console.log(data);\n let newArray = data.items.map((book) => ({\n _id: book.id,\n title: book.volumeInfo.title,\n authors: book.volumeInfo.authors || \"No authors listed\",\n description: book.volumeInfo.description || \"No description listed\",\n image:\n book.volumeInfo.imageLinks?.thumbnail || \"No thumbnail included\",\n link: book.volumeInfo.infoLink,\n }));\n setSearchResult(newArray);\n })\n .catch((err) => console.log(err));\n }", "searchBook(search) {\n this.jsonLog('searchBook sending data', search);\n this.setState({waitingSearch: true});\n this.bookCtrl.searchBook(search, (err, resp) => {\n if (err) {this.error(err);}\n else {\n var searchResults = resp.items;\n this.log('searchBook with ' + search + ' response OK');\n this.log('items.length ' + resp.items.length);\n this.setState({\n searchResults: searchResults,\n waitingSearch: false\n });\n }\n });\n }", "searchBooks() {\n\t\tif (this.state.query === '' || this.state.query === undefined) {\n\t\t\treturn this.setState({ searchResults: [] })\n\t\t}\n\t\tBooksAPI.search(this.state.query.trim()).then(matches => {\n\t\t\tif (matches.error) {\n\t\t\t\treturn this.setState({ searchResults: [] })\n\t\t\t} else {\n\t\t\t\t// If book already on a shelf, update shelf status in search results\n\t\t\t\tmatches.forEach(b => {\n\t\t\t\t\tconst listBook = this.state.books.filter(myBook => myBook.id === b.id)\n\t\t\t\t\tif (listBook.length) {\n\t\t\t\t\t\tb.shelf = listBook[0].shelf\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\treturn this.setState({ searchResults: matches })\n\t\t}})\n\t}", "@action\n getBooks(currentSearchText) {\n ApiService.getBooks()\n .then((res) => {\n if (!res) throw res.error;\n let searchItems = [];\n console.log(currentSearchText);\n console.log(res.items);\n for (let i=0; i < res.items.length; i++) {\n let title = res.items[i].volumeInfo.title;\n\n if (title.toLowerCase().indexOf(currentSearchText) !== -1) {\n searchItems.push(res.items[i]);\n }\n }\n console.log(searchItems);\n this.booksInfo = res.items;\n if (searchItems.length > 0) {\n this.searchResult = searchItems;\n this.isFoundResult = true;\n this.book = {};\n } else {\n this.searchResult = {};\n this.book = {};\n this.isFoundResult = false;\n }\n })\n .catch((e) => {\n new ErrorHandler(e);\n });\n }", "handleSearch() {\n this.props.searchBeerApi(this.state.term);\n }", "handleAdvancedSearch(event) { \n this.closeModal();\n var searchParameters = [\"subject\", \"rights\", \"title\", \"format\", \"collection\", \"state\", \"university\", \"language\", \"creator\", \"date\"];\n var searchType;\n var userInput;\n var formData = {\n subject: \"\",\n rights: \"\",\n title: \"\",\n format: \"\",\n collection: \"\",\n state: \"\",\n university: \"\",\n language: \"\",\n creator: \"\",\n date: \"\",\n page_size: \"30\",\n page: \"1\"\n };\n \n for (var i = 0; i < searchParameters.length; i++)\n {\n searchType = searchParameters[i]\n userInput = this.state[searchType]; \n this.setState({ [searchType]: '' });\n if (userInput !== \"\" && userInput !== undefined && userInput !== 'ALL')\n formData[searchType] = userInput;\n }\n \n var results = ApiWrapper.makeCall({subject: formData.subject, \n rights: formData.rights, \n title: formData.title, \n format: formData.format, \n collection: formData.collection, \n state: formData.state, \n university: formData.university,\n language: formData.language, \n creator: formData.creator,\n date: formData.date, \n page_size: formData.page_size,\n page: formData.page,\n });\n \n ReactDOM.render(<Books view=\"componentView\" results={results} pageSize= \"30\" />, document.getElementById('root')); \n event.preventDefault();\n }", "function Search(){\n\n const url = \"https://www.googleapis.com/books/v1/volumes?q=isbn\";\n const [firstInput, setTyping] = useState(\"\");\n const [showData, setResultList] = useState([]);\n \n\n const showResult =() => {\n axios.get(url+\": \"+firstInput).then(response =>{\n let rest = response.data\n console.log(rest);\n let json = JSON.stringify(rest);\n setResultList(json);\n })\n }\n\n\n\n return(\n <>\n <h1>Search for books by ISBN</h1>\n <div class=\"container\">\n <div className=\"t_c\">\n <input type = \"text-box\" className =\"in_txt\" placeholder = \"Type here...\" onChange = {event => {setTyping(event.target.value)}}/>\n <input type = \"button\" className =\"btn btn-success float-right\" value = \"Search\" onClick={showResult}/>\n </div><br></br>\n <h5>You can see the result below...</h5>\n </div><br></br>\n <div class=\"container content\" >{showData}</div>\n {/* <Display display={showData}/> */}\n </>\n );\n\n}", "searchToClick() {\n\n\n\n this.axiosSearch(\"movie\");\n this.axiosSearch(\"tv\");\n\n }", "function searchGoogleBooksAPI(query) {\n API.searchBook(query)\n .then(res => {\n console.log(\"API - Results:\", res.data.items)\n setBooks(res.data.items);\n })\n .catch(err => console.log(err));\n }", "function searchBook() {\n setSearchTerm(searchValue.current.value)\n }", "function handleSearch(event) {\n event.preventDefault();\n if (formSearch) {\n searchGoogleBooksAPI(formSearch.search);\n }\n\n }", "function handleSearchFormSubmit(event) {\n event.preventDefault();\n\n API.getBooks(formObject.title)\n .then(res => {\n let myBooksArray = res.data.items;\n let myNewBooksArray = [];\n\n for (let i = 0; i < myBooksArray.length; i++) {\n let myBookObj = {\n key: myBooksArray[i].id,\n id: myBooksArray[i].id\n }\n \n if (!(myBooksArray[i].volumeInfo.title) || (myBooksArray[i].volumeInfo.title === undefined)) {\n myBookObj.title = \"Title coming soon...\";\n } else {\n myBookObj.title = myBooksArray[i].volumeInfo.title;\n }\n\n if (!(myBooksArray[i].volumeInfo.description) || (myBooksArray[i].volumeInfo.description === undefined)) {\n myBookObj.description = \"Description coming soon...\";\n } else {\n myBookObj.description = myBooksArray[i].volumeInfo.description;\n }\n\n if (!(myBooksArray[i].volumeInfo.infoLink) || (myBooksArray[i].volumeInfo.infoLink === undefined)) {\n myBookObj.infoLink = \"#\";\n } else {\n myBookObj.infoLink = myBooksArray[i].volumeInfo.infoLink;\n } \n\n if (!(myBooksArray[i].volumeInfo.imageLinks) || (myBooksArray[i].volumeInfo.imageLinks === undefined)) {\n myBookObj.image = \"https://via.placeholder.com/300\";\n } else {\n myBookObj.image = myBooksArray[i].volumeInfo.imageLinks.thumbnail;\n } \n\n if (!(myBooksArray[i].volumeInfo.authors) || (myBooksArray[i].volumeInfo.authors === undefined)) {\n myBookObj.authors = [\"Anonymous, Not Listed\"];\n } else {\n myBookObj.authors = myBooksArray[i].volumeInfo.authors;\n } \n myNewBooksArray.push(myBookObj);\n }\n setBooks(myNewBooksArray);\n })\n .catch(err => console.log(err));\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n if (searchState.trim().length > 0) {\n API.searchBooks(searchState.trim())\n .then(res => \n setSearchedBooks(res.data.items)\n )\n .catch(err => console.log(err));\n }\n }", "function search() {\n console.log(\"search \", search);\n const ingredientsList = ingredients.join(\",\");\n const url = `http://localhost:8888/api?i=${ingredientsList}&q=${inputValue}&p=1`;\n axios\n .get(url)\n .then((res) => {\n console.log(\"res \", res);\n setResults(res.data.results);\n })\n .catch((err) => {\n console.log(\"err \", err);\n });\n }", "findBook(searchBook) {\n return this.state.books.find(book => book.id === searchBook.id);\n }", "handleSearchBar()\n {\n this._page = 1;\n this._searchBar = $(\"#searchBar\").val();\n this.getBooks();\n }", "function search() {\r\n let searchTerm = id(\"search-term\").value.trim();\r\n if (searchTerm !== \"\") {\r\n id(\"home\").disabled = false;\r\n loadBooks(\"&search=\" + searchTerm);\r\n }\r\n }", "function searchForBooks() {\n let search = document.querySelector('#search-bar').value; // save value of search bar\n const URL = 'https://www.googleapis.com/books/v1/volumes/?q='; // URL to search\n const maxResults = '&maxResults=10';\n let searchGBooks = `${URL}${search}${maxResults}`; // google books api + search value\n\n // set up JSON request\n let request = new XMLHttpRequest();\n request.open('GET', searchGBooks, true);\n\n request.onload = function() {\n if (request.status >= 200 && request.status < 400) {\n let data = JSON.parse(request.responseText); // Success! here is the JSON data\n render(data);\n } else {\n showError('No matches meet your search. Please try again'); // reached the server but it returned an error\n }\n };\n request.onerror = function() {\n // There was a connection error of some sort\n };\n request.send();\n}", "function handleSearch() {\n searchNews();\n async function searchNews() {\n console.log(search);\n const res = await Axios.get(\n `https://api.nytimes.com/svc/search/v2/articlesearch.json?q=${search}&api-key=3U4bhB5mL3M3foeQ8G4TT3ok5NNBZ8I8`\n );\n setSearchData(res.data.response.docs);\n console.log(res.data.response.docs);\n setLoadingTwo(false);\n setLoading(true);\n }\n setSearch(\"\");\n }", "search(e) {\n //NOTE You dont need to change this method\n e.preventDefault();\n _showLoading()\n try {\n SongService.getMusicByQuery(e.target.query.value);\n } catch (error) {\n console.error(error);\n }\n }", "function getDataFromAPI() {\r\n\r\n $(\"#searchWindow\").removeClass('d-none');\r\n\r\n $(\"#resultBody\").html(``);\r\n let searchData = $(\"#searchField\").val();\r\n // Handle Empty field\r\n if (searchData === \"\" || searchData === null) {\r\n alert(\"Please Search For Something\");\r\n }\r\n else {\r\n getBooks(searchData, 0);\r\n }\r\n // Inicializa o primeiro livro\r\n //updateCurrentBook('0');\r\n\r\n}", "function postSearchResults(request, response) {\n // get api url\n let url = 'https://www.googleapis.com/books/v1/volumes?q='\n\n\n let query = request.body.search[0];\n let titleOrAuthor = request.body.search[1];\n\n if (titleOrAuthor === 'title') {\n url += `+intitle:${query}`;\n } else if (titleOrAuthor === 'author') {\n url += `+inauthor:${query}`;\n }\n\n // grab data from api\n superagent.get(url)\n .then(results => {\n // loop through results and construct new book object each iteration\n let books = results.body.items.map(val => {\n return new Book(val);\n });\n // console.log(results.body.items[0]);\n response.render('pages/searches/show.ejs', {\n searchResults: books\n });\n }).catch(err => error(err, response));\n}", "getSearchResults(query) {\n //if search_query is not empty\n if(query !== \"\" || this.props.searchQuery){\n BooksAPI.search(query, 10).then((found) => {\n if(found.length && this.props.searchQuery) {\n //set book shelf attribute to search resutl\n this.props.onUpdateNewBooks(found.map((book) => {\n //if does not include remove it from search result\n book.shelf = this.getShelf(book)\n return book\n })//.map\n )\n } else {\n searchComesUpWithNothing = \"We could not find any books for you with this parameters\"\n this.props.onUpdateNewBooks(null)\n }\n })//.then\n } else {\n this.props.onUpdateNewBooks(null)\n }//if else\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title) {\n API.searchBook(formObject.title)\n .then((res) => {\n setBooks(res.data.items);\n })\n .catch((err) => console.log(err));\n }\n }", "function search(data){\n setSearch(data); \n }", "function ContentCard(props) {\n\n const [books, setBooks] = useState([]);\n\n const [formObject, setFormObject] = useState({});\n\n const search = [];\n\n useEffect(() => {\n if (props.search === \"false\") {\n loadBooks();\n }\n }, [])\n\n function loadBooks() {\n API.getBooks()\n .then( (book) => setBooks(book.data))\n .catch( (err) => console.log(err));\n }\n\n function handleInputChange(event) {\n const { value } = event.target;\n setFormObject({ book: value })\n }\n\n function handleFormSubmit(event) {\n event.preventDefault();\n API.searchBook(formObject.book)\n .then( (books) => {\n books.data.items.forEach( (book) => { \n search.push({\n _id: book.id,\n title: book.volumeInfo.title,\n author: book.volumeInfo.authors,\n info: book.volumeInfo.description,\n link: book.volumeInfo.infoLink, \n img: book.volumeInfo.imageLinks.smallThumbnail\n });\n });\n setBooks(search);\n })\n .catch( (err) => console.log(\"Sorry your book might be blocked in your country. \" + err));\n }\n\n return (\n <ElemContainer addClasses=\"elemContainer col s12\">\n <h4>{props.subtitle}</h4>\n <form className={\"row \" + props.search}>\n <Input onChange={handleInputChange}\n name=\"book\"\n addClasses=\"col s6 push-s3\"\n />\n <FormBtn disabled={!formObject.book}\n onClick={handleFormSubmit}\n addClasses=\"col s3\"\n >\n Search\n </FormBtn>\n </form>\n {books.length ? (\n <div>\n {books.map( (book) => {\n let authorList = \"\";\n if (book.author) {\n book.author.forEach( (author) => {\n authorList += author + \", \";\n });\n authorList = authorList.replace(/(, )$/,\"\");\n } else {\n authorList = \"Unkown.\"\n }\n return (\n <BookCard key={book._id}\n apiHref={book._id}\n bookName={book.title}\n author={authorList}\n link={book.link}\n info={book.info}\n img={book.img}\n search={props.search}\n loadBooks={loadBooks}\n />\n );\n })}\n </div>\n ) : (<div><h3 id={props.search}>No Books Saved.</h3></div>)}\n </ElemContainer>\n );\n}", "function SearchContainer() {\n // Setting state to save and set search results from Google API.\n const [searchResult, setSearchResult] = useState([]);\n\n // Function to handle the search.\n function handleSearch(event) {\n event.preventDefault();\n\n let query = event.target.search.value;\n API.searchBooks(query)\n .then(({ data }) => {\n console.log(data);\n let newArray = data.items.map((book) => ({\n _id: book.id,\n title: book.volumeInfo.title,\n authors: book.volumeInfo.authors || \"No authors listed\",\n description: book.volumeInfo.description || \"No description listed\",\n image:\n book.volumeInfo.imageLinks?.thumbnail || \"No thumbnail included\",\n link: book.volumeInfo.infoLink,\n }));\n setSearchResult(newArray);\n })\n .catch((err) => console.log(err));\n }\n\n // Function to handle a save request from the user.\n function handleSave(bookID) {\n console.log(bookID);\n\n let savedBook = searchResult.find((book) => book._id === bookID);\n API.saveBook(savedBook)\n .then(() => {\n console.log(\"Storing book\");\n })\n .catch((err) => console.error(err));\n\n let filteredBooks = searchResult.filter((book) => book._id !== bookID);\n setSearchResult(filteredBooks);\n }\n\n return (\n <React.Fragment>\n <SearchForm handleSearch={handleSearch} />\n <section className=\"container\" id=\"search\">\n <div className=\"row\">\n <div className=\"results col-12\">\n <h2>Results</h2>\n <hr />\n {searchResult.map((book) => (\n <SearchCard key={book._id} {...book} handleSave={handleSave} />\n ))}\n </div>\n </div>\n </section>\n </React.Fragment>\n );\n}", "onActionClickSearchBar() {\n this.search(this.state.search)\n }", "onSubmitSearch(event) {\n event.preventDefault();\n axios\n .get(\n `https://api.thenewsapi.com/v1/news/all?api_token=${process.env.NEWS_API_KEY}&language=en&limit=3&search=${this.state.searchBar}`\n )\n .then((res) => {\n this.setState({\n displayedNews: res.data.data,\n });\n })\n .catch( err => {\n if (err) console.error(err);\n })\n }", "runSearch() {\n this.books = this.service.getBooks(this.searchValue).subscribe(books => this.books = books);\n this.searchValue.setValue('');\n this.test = true;\n this.searched = true;\n }", "onSearch(e) {\n e.preventDefault();\n this.setState({ searchTerm: e.target.value });\n\n // TODO refactor this and just call a search method in a 'Products' service that handles all the API calls\n if (e.target.value && e.target.value.length > 2) {\n fetch(`http://localhost:3035/products?q=${e.target.value}`)\n .then(res => res.json())\n .then(searchResults => {\n this.setState({ searchResults })\n });\n } else {\n this.setState({ searchResults: {items: [], total: 0} });\n }\n }", "onConfirmSearchBar() {\n //this.search(this.state.search)\n }", "function handleSearchButton(event) {\n event.preventDefault();\n let city = document.querySelector(\".form-control\");\n let apiKey = \"a05f0202382b8935188265308a3e5140\";\n let apiUnits = \"metric\";\n let apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city.value}&APPID=${apiKey}&units=${apiUnits}`;\n axios.get(apiUrl).then(showTemperature);\n let forecastApiURL = `https://api.openweathermap.org/data/2.5/forecast?q=${city.value}&APPID=${apiKey}&units=${apiUnits}`;\n axios.get(forecastApiURL).then(displayForecast);\n}", "SearchRecipe(e){\n console.log(\"Searching for a recipe\")\n e.preventDefault();\n axios.get('http://localhost:4000/api/recipes/' + this.props.recipe._id)\n .then(()=>{\n //this.props.ReloadDataMethod();\n })\n .catch();\n \n }", "function handleSearchClick(){\r\n var temp = document.getElementById('searchText').value;\r\n fetchRecipesBySearch(temp);\r\n }", "function search() {\n return axios.get(BASEURL);\n}", "search(term) {\n axios.get(baseUrl + \"/search.json\", {\n params: {\n q: term\n }\n })\n .then((response) => {\n this.setState({ results: response.data });\n })\n .catch((error) => {\n console.log(error);\n });\n }", "componentDidMount() {\n const parsed = queryString.parse(this.props.location.search);\n const searchTerm = parsed.search;\n BooksAPI.search(searchTerm)\n .then((result) => {\n if (result.error !== \"empty query\") {\n this.setState({\n isLoaded: true,\n books: result\n });\n }\n })\n .catch((result) => {\n this.setState({\n isLoaded: false\n });\n })\n }", "searchBucket(e) {\n\t\tlet search = e.target.value\n\t\tlet auth_token = sessionStorage.auth_token // Get the auth_token from the session storage.\n\n\t\taxios({\n\t\t\tmethod: \"GET\",\n\t\t\turl: BaseUrl + \"bucketlists/?q=\" + search + \"&page=\" + this.state.page + \"&rows=\" + this.state.rows,\n\t\t\theaders: { \"Authorization\": auth_token }\n\t\t}).then(function (response) {\n\t\t\tvar data = response.data\n\n\t\t\tthis.setState({\n\t\t\t\tbuckets: data.buckets,\n\t\t\t})\n\t\t}.bind(this))\n\t}", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title) {\n API.searchBooks(formObject.title)\n .then(res => setBooks(res.data.items))\n .catch(err => console.log(err))\n }\n }", "search() {\n let location = ReactDOM.findDOMNode(this.refs.Search).value;\n if (location !== '') {\n let path = `/search?location=${location}`;\n makeHTTPRequest(this.props.updateSearchResults, path);\n }\n }", "onSearch() {\n const {\n onBarsSearch,\n location\n } = this.props;\n onBarsSearch(location);\n }", "searchFor(query) {\n return BooksAPI.search(query).then(results => results && !results.error ? results : []).then((results) => {\n return results.map(book => {\n const shelvedBookIndex = this.state.books.findIndex(shelvedBook => shelvedBook.id===book.id)\n var shelf;\n if (shelvedBookIndex === -1) {\n shelf = 'none';\n } else shelf = this.state.books[shelvedBookIndex].shelf;\n return Object.assign({shelf}, book);\n }) \n })\n }", "function findBook(req, res) {\n\n let url = 'https://www.googleapis.com/books/v1/volumes?q=';\n\n if (req.body.search[1] === 'title') { url += `+intitle:${req.body.search[0]}`; }\n\n if (req.body.search[1] === 'author') { url += `+inauthor:${req.body.search[0]}`; }\n\n superagent.get(url)\n\n .then(data => {\n // console.log('data >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', data.body.items[0].volumeInfo);\n\n let books = data.body.items.map(value => {\n return new Book(value);\n });\n // console.log(books);\n res.render('pages/searches/show', { book: books });\n }).catch(error => console.log(error));\n\n}", "async function getBooksWithSearch(type, date) {\n try{\n let result = await MyBooklistApi.bookSearch(type, date, user.username);\n setBooks(result);\n return true;\n }\n catch(e){\n return e;\n }\n }", "filterBooksBySearch(key,value) {\n //update state by search parameters passed from search module to actions to store\n this.setState({\n key: key,\n query: value.toLowerCase()\n });\n }", "function searchBook() {\n if (bookInStore !== null) {\n bookArray = bookInStore;\n } else {\n bookArray = [];\n }\n var t_body = \"\";\n var count = 1;\n var searchItem = search.value.toLowerCase();\n var search_Result = bookInStore.filter(\n (book) => book.BookName.toLowerCase() == searchItem\n );\n\n if (search_Result.length == 0) {\n search_Result = bookInStore.filter(\n (book) => book.Company.toLowerCase() == searchItem\n );\n if (search_Result.length == 0) {\n alert(\"The book you search doesnt exist in our store\");\n } else {\n t_body = `\n <tr>\n <td>${count}</td>\n <td>${search_Result[0][\"Number Of Pages\"]}</td>\n <td>${search_Result[0][\"Name Of Author\"]}</td>\n <td>${search_Result[0].BookName}</td>\n <td>${search_Result[0][\"Company\"]}</td>\n <td>${search_Result[0][\"Year\"]}</td>\n </tr>\n\n`;\n\n tableBody.innerHTML = t_body;\n }\n } else {\n t_body = `\n <tr>\n <td>${count}</td>\n <td>${search_Result[0][\"Number Of Pages\"]}</td>\n <td>${search_Result[0][\"Name Of Author\"]}</td>\n <td>${search_Result[0].BookName}</td>\n <td>${search_Result[0][\"Company\"]}</td>\n <td>${search_Result[0][\"Year\"]}</td>\n </tr>\n \n `;\n\n tableBody.innerHTML = t_body;\n }\n}", "function Search() {\n\n let bookies = [];\n const [books, setBooks] = useState([]);\n\n function submitHandler() {\n // need a better way to grab the search value\n const query = document.getElementById(\"search\").value\n console.log(query)\n Axios.get(`https://www.googleapis.com/books/v1/volumes?q=${query}`)\n .then(res =>\n setBooks(res.data.items[0].volumeInfo)\n )\n .catch(err => {\n console.log(err)\n })\n }\n \n // post to saved collection to be handled here\n function bookPost () {\n console.log(books)\n // axios.post(/*data from specific card below by :id*/)\n };\n\n useEffect(() => {\n //Not an ideal method\n submitHandler()\n }, [])\n\n return (\n\n <>\n <Navbar />\n\n <div className=\"container\">\n <h2 class=\"jumbotron\">Book Search</h2>\n <form className=\"form-group\" onSubmit={() => submitHandler}>\n <div>\n <label>search by title</label>\n <br></br>\n <input id=\"search\" name=\"search\" value=\"the road\" />\n <button type=\"submit\">Search</button>\n </div>\n </form>\n </div>\n {/* Was trying to get this to loop through an array and send props to the BookCard component, but was unable to pull \n the response arrays correctly and instead only pulled one array so just did it this way for now. Ideally need to make\n this whole page a class component to update 'search' with state, correctly grab response, loop, and import component. */}\n <div className=\"container\">\n <div className=\"card\">\n <img src={books.imageLinks} className=\"card-img-top\" alt=\"book\" />\n <div className=\"card-body\">\n <h5 className=\"card-title\">{books.title}</h5>\n <p className=\"card-text\">{books.authors}</p>\n <p className=\"card-text\">{books.description}</p>\n <a href={books.canonicalVolumeLink} className=\"btn btn-primary\" target=\"blank\">Go to Googlebooks</a>\n <button onClick={()=>bookPost()} className=\"btn\">Save</button>\n </div>\n </div>\n \n {/* This is where the intended card and loop was set to be */}\n {/* {books.length > 0 \n ? (books.map(book => {\n return (\n <BookCard\n title={book.title}\n authors={books.authors}\n description={book.description}\n canonicalVolumeLink={book.canonicalVolumeLink}\n imageLinks={book.imageLinks}\n />\n );\n })\n ) : (\n <h3>Search to see books</h3>\n )\n } */}\n\n </div>\n </>\n )\n}", "renderBooks() {\n if (this.state.error) {\n /*handles search not found*/\n return (\n <CardSection>\n <Text style={{fontWeight: 'bold', alignSelf: 'center'}}>\n Nothing found for {this.state.searchTerm}\n </Text>\n <Text style={{marginBottom: 60}}>\n Try the full book's name. The search is case insensitive.\n </Text>\n <Button\n title=\"See full list\"\n onPress={() =>this.setState({error: false, book: null})}\n />\n </CardSection>\n )\n }\n if (this.state.book) {\n /*if search is good, show result*/\n var book = this.state.book;\n return (\n <SearchResult book={ book } searchTerm={ this.state.searchTerm } />\n )\n } else {\n /*show the full list of books*/\n var data = this.props.booksQuery;\n if (data.loading) {\n return (<Text>Loading list...</Text>);\n } else {\n return data.books.map(book => { \n return (\n <TouchableOpacity\n key={ book._id }\n onPress={ () => this.props.navigation.navigate('BookDetail', { book }) }>\n <BookListInfo\n book={ book }\n />\n </TouchableOpacity>\n )\n });\n }\n }\n }", "renderAddBooks() {\n var searchResults = this.state.searchResults;\n return (\n <div className='search-view'>\n <p>Search for books to add to your profile.</p>\n <AddBook\n onClickAdd={this.addBook}\n onClickSearch={this.searchBook}\n searchResults={searchResults}\n waitingSearch={this.state.waitingSearch}\n />\n </div>\n );\n }", "search(e) {\n //NOTE You dont need to change this method\n e.preventDefault();\n try {\n SongsService.getMusicByQuery(e.target.query.value);\n } catch (error) {\n console.error(error);\n }\n }", "componentDidMount() {\n let url = `${API_URL}/books/?` +\n `api_key=${API_KEY}&` +\n `limit=${this.limit}&` +\n `after-id=0`;\n // console.log(`main url: ${url}`);\n axios.get(url)\n .then(response => {\n let data = response.data;\n this.handleSearchData(data, url, 'search');\n })\n .catch(error => {\n console.error(error);\n });\n }", "search() {\n axios\n .get(this.moviesUrl + this.querySearch)\n .then(resp => {\n this.response = resp.data;\n this.moviesRes = this.response.results;\n })\n }", "function handleSearch(event) {\n event.preventDefault();\n let city = document.querySelector(\".form-control\");\n let apiKey = \"a05f0202382b8935188265308a3e5140\";\n let apiUnits = \"metric\";\n let apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city.value}&APPID=${apiKey}&units=${apiUnits}`;\n axios.get(apiUrl).then(showTemperature);\n axios.get(apiUrl).then(showIcon);\n let forecastApiURL = `https://api.openweathermap.org/data/2.5/forecast?q=${city.value}&APPID=${apiKey}&units=${apiUnits}`;\n axios.get(forecastApiURL).then(displayForecast);\n}", "function createSearch(request, response) {\n let url = 'https://www.googleapis.com/books/v1/volumes';\n // add the search query to the URL\n const searchBy = request.body.searchBy;\n const searchValue = request.body.search;\n const queryObj = {};\n if (searchBy === 'title') {\n queryObj['q'] = `+intitle:${searchValue}`;\n } else if (searchBy === 'author') {\n queryObj['q'] = `+inauthor:${searchValue}`;\n }\n // send the URL to the servers API\n superagent.get(url).query(queryObj).then(apiResponse => {\n return apiResponse.body.items.map(bookResult => new Book(bookResult.volumeInfo))\n }).then(results => {\n response.render('pages/searches/show', { searchResults: bookArray })\n });\n}", "function searchBook(title) {\n const bookData = getListOfBook();\n const searchResult = [];\n for (let data of bookData) {\n if (data.title.includes(title)) {\n searchResult.unshift(data);\n }\n }\n renderBookList(true, searchResult);\n}", "search(e) {\n //NOTE You dont need to change this method\n e.preventDefault();\n try {\n songService.getMusicByQuery(e.target.query.value);\n } catch (error) {\n console.error(error);\n }\n }", "function search(_event) {\r\n let inputName = document.getElementById(\"searchname\");\r\n let inputMatrikel = document.getElementById(\"searchmatrikel\");\r\n let query = \"command=search\";\r\n query += \"&nameSearch=\" + inputName.value;\r\n query += \"&matrikelSearch=\" + inputMatrikel.value;\r\n console.log(query);\r\n sendRequest(query, handleSearchResponse);\r\n }", "handleSubmit(e){\n e.preventDefault();\n //create url based on search and filter parameters\n let url = '';\n if (this.state.filter !== '' && this.state.type !== ''){\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&filter=${this.state.filter}&printType=${this.state.type}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n } else if (this.state.filter !== '' && this.state.type === ''){\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&filter=${this.state.filter}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n } else if (this.state.type !== '' && this.state.filter === ''){\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&printType=${this.state.type}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n } else {\n url = `https://www.googleapis.com/books/v1/volumes?q=${this.state.query}&key=AIzaSyCQ5Aw6z5Wu_U8hewE6rVR6WDvnNYw08cI`;\n }\n \n const options = {\n method: 'GET'\n }\n //call google books API\n fetch(url, options)\n .then(res => {\n if(!res.ok){\n throw new Error('something went wrong');\n }\n return res.json()\n })\n .then(data => {\n this.setState({\n books: data,\n error: null\n })\n console.log(data);\n //update books array in App.js with new data\n this.props.updateInfo(data);\n })\n .catch(err => {\n this.setState({\n error: err.message\n })\n })\n }", "render () {\n const { query } = this.state\n const { searchedBooks, onUpdateShelf } = this.props\n console.log('SearchBooks - searchedBooks', searchedBooks)\n\n return (\n <div className='search-books'>\n <div className='search-books-bar'>\n <Link \n className='close-search'\n to='/'>\n Close\n </Link>\n <div className='search-books-input-wrapper'>\n <input\n className='search-books-input'\n type='text'\n placeholder='Search by title or author'\n value={query}\n onChange={ (event) => { if (event.target.value === '') {\n this.clearQuery()\n } else {\n this.updateQuery(event.target.value)\n }\n }\n }\n />\n </div>\n </div>\n \n <div className='search-books-results'>\n <div className='showing-books'> \n <span> Now showing {searchedBooks.length} books </span>\n <button onClick={this.clearQuery}>Clear query</button>\n </div>\n <ol className='books-grid'> \n {searchedBooks.map((book) => (\n <li key={book.id} className='book-list-item'>\n < Book \n book={book}\n onUpdateShelf={onUpdateShelf}\n query={query}\n />\n </li>\n ))}\n </ol>\n </div> \n </div>\n )\n }", "handleSubmit(event){\n event.preventDefault()\n this.setState({loading: true})\n axios.get(`https://itunes.apple.com/search?term=${this.state.artist}`)\n .then(res =>{\n this.setState({data: res.data.results, loading: false})\n })\n }", "handleSearchClick(e) {\n e.preventDefault();\n //empties input field after search\n this.formRef.reset();\n //change movieCard display to change back to original search display\n this.setState({ giveMoodButtons: false });\n axios\n .get('/search', { params: { title: this.state.movie } })\n .then(response => {\n this.setState({ movies: response.data });\n this.setState({ showMovie: true });\n })\n .catch(err => console.error(err));\n }", "function searchGoogleBooks(query) {\n API.search(query)\n .then(res => setResults(res.data.items))\n .catch(err => console.log(err));\n }", "function chargeMovies(e) {\n e.preventDefault();\n const textSearch = document.getElementById('search').value;\n consultApi(textSearch);\n}", "search() {\n this.send('searchWithParams', this.buildSearchQuery());\n }", "function getInput(event){\n event.preventDefault();\n var searchQuery;\n searchQuery = ($(searchBox).val());\n console.log(searchQuery);\n var ytUrl =`https://youtube.googleapis.com/youtube/v3/search?type=video&part=snippet&maxResults=25&q=${searchQuery}\\\\+'+travel'+'&key=AIzaSyDD9MbkIVSzT2a3sOv97OecaqhyGdF174c`;\n searchVideos(ytUrl);\n\n var key = `AIzaSyDWNMiooGhkXMAhnoTL8pudTR83im36YPo`;\n \n var bookUrl = `https://www.googleapis.com/books/v1/volumes?q=${searchQuery}\\\\+travel+guide&key=${key}`;\n searchBooks(bookUrl);\n}", "function buttonListenerSearch(){\n let button = document.getElementById(\"button-search\");\n console.log(button);\n button.addEventListener('click', ()=>{\n const searchField = document.getElementById(\"bookSearch\").value;\n console.log(searchField);\n //add to the GET url the input of the search field.\n const urlSearch = \"http://localhost:5000/books/search=\" + searchField;\n if(searchField){\n //get the page\n window.location.href = urlSearch;\n }\n })\n\n\n}", "function search(e) {\n e.preventDefault();\n\n // documentation: https://dictionaryapi.dev/\n const apiUrl = `https://api.dictionaryapi.dev/api/v2/entries/en_US/${keyword}`;\n axios.get(apiUrl).then(handleDictionaryResponse);\n\n // pexels API call\n const pexelsApiKey = process.env.REACT_APP_PEXELS_API_KEY;\n const pexelsApiUrl = `https://api.pexels.com/v1/search?query=${keyword}&per_page=12`;\n const headers = { Authorization: `Bearer ${pexelsApiKey}` };\n axios.get(pexelsApiUrl, { headers: headers }).then(handlePexelsResponse);\n }", "function search(event) {\n event.preventDefault();\n let searchInput = document.querySelector(\"#search\");\n\n let city = document.querySelector(\"#search-city\");\n if (searchInput.value) {\n city.innerHTML = `${searchInput.value}`;\n } else {\n alert(\"Please write a location to search\");\n }\n let apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${searchInput.value}&units=metric&appid=${apiKey}`;\n axios.get(apiUrl).then(tempCitySearched);\n}", "async function getBooks(){\n if(!books){\n let result = await MyBooklistApi.bookSearch(\"fiction\", getCurrentDate(), user.username);\n setBooks(result);\n }\n }", "searching(id){\n return axios.put(DETAILS_URL+'/searching/'+id);\n }", "handleClickSearch(event) {\n if (!this.state.value.length) {\n Swal.fire(\"Search Data Missing!\", \"\", \"warning\");\n } else {\n event.preventDefault();\n this.setState({ isLoaded: false });\n this.getData();\n }\n }", "function createSearch(request, response) {\n let url = \"https://www.googleapis.com/books/v1/volumes?q=\";\n\n console.log(request.body);\n console.log(request.body.search);\n\n if (request.body.search[1] === \"title\") {\n url += `+intitle:${request.body.search[0]}`;\n }\n if (request.body.search[1] === \"author\") {\n url += `+inauthor:${request.body.search[0]}`;\n }\n\n // WARNING: won't work as is. Why not?\n // superagent.get(url)\n // .then(apiResponse => console.log(util.inspect(apiResponse.body.items, {showhidden: false, depth: null})))\n // .then(results => response.render('pages/searches/show', {searchResults: results})\n // )}\n superagent\n .get(url)\n .then(apiResponse =>\n apiResponse.body.items.map(bookResult => new Book(bookResult.volumeInfo))\n )\n .then(results =>\n response.render(\"pages/searches/show\", { searchResults: results })\n );\n}", "async handleTextSearch(evento) {\n const search = evento.target.value;\n const res = await api.get(\n `${process.env.REACT_APP_BASE_URL}?${\n this.isChecked ? `tags_like=${search}` : `q=${search}`\n }`\n );\n this.setState({\n notes: res.data,\n });\n console.log(\"search\", res.data);\n }", "searchMovieAndSeries() {\n if ( this.userSearch != '' ) {\n axios\n .get( 'https://api.themoviedb.org/3/search/multi' , {\n params: {\n api_key: this.apiKey,\n query: this.userSearch\n }\n })\n .then( (response) => {\n const result = response.data;\n this.searchedMoviesAndSeries = result.results;\n });\n }\n }", "getSearchRequest() {\n var genre = document.getElementById('genreSearch').value;\n var searchCh = document.getElementById('searchchar').value;\n var genreApi = 'https://api.jikan.moe/v3/search/' + genre + \"?q=\" + searchCh + \"&page=1\";\n console.log(genreApi)\n\n axios.get(genreApi)\n .then(function (response) {\n console.log(response.data.results)\n\n // handle success\n return response\n })\n .catch(function (error) {\n // handle error\n console.log(error);\n })\n .finally(function () {\n // always executed\n });\n\n\n }", "handleSearch(event) {\n axios.get(BASE_URL + '/bucketlist'+'?q='+ event.target.value,\n {\n headers: {\n \"Authorization\": localStorage.getItem('token'),\n \"content-Type\":'application/json'\n }}\n ).then(response => {\n this.setState({\n bucketlists :response.data.bucketlist\n });\n });\n }", "getSearchedProducts() {\n axios.get(`/api/search?search_box_text=${this.state.search_box_text}`).then( response => {\n if(!response.data[0]) {\n this.setState({\n search_name_header: `Your search for \"${this.state.search_box_text}\" did not yield any results.`,\n search_performed: true\n })\n }\n if(response.data[0]) {\n this.setState({\n search_name_header: `Your search for \"${this.state.search_box_text}\" revealed the following:`,\n search_results: response.data,\n search_performed: true\n })\n }\n })\n }", "function search(event) {\n event.preventDefault();\n let searchInput = document.querySelector(\"#inlineFormInputName2\");\n let searchCity = `${searchInput.value}`;\n let apiEndpoint = \"https://api.openweathermap.org/data/2.5/weather?\";\n let apiKey = \"f8789029e0a5277fb2e5a66c29f35e2c\";\n let apiUrl = `${apiEndpoint}q=${searchCity}&appid=${apiKey}&units=metric`;\n axios.get(apiUrl).then(localWeather);\n\n apiUrl = `https://api.openweathermap.org/data/2.5/forecast?q=${searchCity}&appid=${apiKey}&units=metric`;\n axios.get(apiUrl).then(displayForecast);\n}", "function handleSearchKeystroke(event) {\r\n searchText = document.getElementById('search').value.toLowerCase().trim();\r\n let matchingBooks = allBooks.filter(book => book.title.toLowerCase().includes(searchText) || book.author.toLowerCase().includes(searchText));\r\n removeBooksFromDOM();\r\n matchingBooks.forEach(function (book) {\r\n insertNewBook(book.id, book.title, book.author, book.subject, book.photoURL, book.vendorURL, book.favorite);\r\n });\r\n applyEventListeners();\r\n}", "function Search() {\n\n // setting up state for the searched books\n const [books, setBooks] = useState([]);\n\n // useRef allows us to get the value of the input from the user and search with that value\n const inputRef = useRef(\"\");\n\n // getBook function uses the API get book function that uses the Google Books API and searches with the useRef value that the user sets\n const getBook = (query) => {\n API.getBook(query)\n .then(res => setBooks(res.data.items))\n .catch(err => console.log(err));\n }\n\n // Once the submit button is pressed, the handle submit function is triggered, it calls the getbook function with UseRefs value as parameters\n const handleSubmit = () => {\n getBook(inputRef.current.value)\n }\n\n return(\n <React.Fragment>\n <div className=\"row searchBox\">\n <div className=\"col-12\">\n <h5 className=\"bookSearch\">Book Search</h5>\n <h6>Book:</h6>\n <SearchInput ref={inputRef}/>\n <SearchBtn onClick={handleSubmit}/>\n </div>\n </div>\n <Results books={books} />\n </React.Fragment>\n )\n}", "function createSearch(request, response) {\n let url = 'https://www.googleapis.com/books/v1/volumes?q=';\n\n if (request.body.search[1] === 'title') { url += `+intitle:${request.body.search[0]}`; }\n if (request.body.search[1] === 'author') { url += `+inauthor:${request.body.search[0]}`; }\n\n superagent.get(url)\n .then(apiResponse => apiResponse.body.items.map(bookResult => new Book(bookResult.volumeInfo)))\n .then(results => response.render('pages/searches/show', { results: results }))\n .catch(err => handleError(err, response));\n}", "search(e){\n this.setState({search: e.target.value}, this.searchSportsFromApi.bind(this));\n }", "function bookSearch(){\n ...\n\n $.AJAX({\n url: \"https://www.googleapis.com/books/v1/volumes?q=\" + search,\n dataType: \"json\",\n\n success: function(data) {\n console.log(data)\n },\n type: 'GET'\n });\n }", "searchEnter() {\n\n //Movie Api Call\n axios\n .get('https://api.themoviedb.org/3/search/movie', {\n params: {\n api_key: 'a21d6a53ae3ba4432e6ec0b5967e1ce3',\n query: this.userSearch,\n language: 'it'\n }\n })\n .then( (response) => {\n\n const resultDataMovie = response.data.results;\n\n this.userSearch ='';\n\n resultDataMovie.forEach(element => {\n\n axios\n .get('https://api.themoviedb.org/3/movie/' + element.id, {\n params: {\n api_key: 'a21d6a53ae3ba4432e6ec0b5967e1ce3',\n append_to_response: 'credits'\n }\n })\n .then( (response) => {\n\n // element.genre = response.data.genres.slice(0, 2);\n //element.cast = response.data.credits.cast.slice(0, 5);\n Vue.set(element, 'genre', response.data.genres.slice(0, 2));\n\n Vue.set(element, 'cast', response.data.credits.cast.slice(0, 5));\n\n\n this.searchedMovie.push(element)\n })\n this.searchedMovie = [];\n });\n })\n\n //Tv Series Api Call\n axios\n .get('https://api.themoviedb.org/3/search/tv', {\n params: {\n api_key: 'a21d6a53ae3ba4432e6ec0b5967e1ce3',\n query: this.userSearch,\n language: 'it'\n }\n })\n .then( (response) => {\n\n const resultDataTv = response.data.results;\n\n this.userSearch ='';\n\n resultDataTv.forEach(element => {\n\n axios\n .get('https://api.themoviedb.org/3/tv/' + element.id, {\n params: {\n api_key: 'a21d6a53ae3ba4432e6ec0b5967e1ce3',\n append_to_response: 'credits'\n }\n })\n .then( (response) => {\n\n\n // element.genre = response.data.genres.slice(0, 2);\n //element.cast = response.data.credits.cast.slice(0, 5);\n Vue.set(element, 'genre', response.data.genres.slice(0, 2));\n\n Vue.set(element, 'cast', response.data.credits.cast.slice(0, 5));\n\n this.searchedTv.push(element);\n })\n this.searchedTv = [];\n\n });\n\n })\n\n }", "function handleSearchEvent() {\n const newData = filterStudents(searchValue);\n showPage(newData, 1);\n addPagination(newData);\n}", "render() {\n const { query } = this.state\n const { books } = this.props\n console.warn('The shelf is: ' + this.state.searchedBooks.shelf)\n console.warn(books.shelf)\n \n return(\n <div className=\"search-books\">\n <div className=\"search-books-bar\">\n <Link className=\"close-search\" to='/'>Close</Link>\n \n <div className=\"search-books-input-wrapper\">\n\n <input type=\"text\" placeholder=\"Search by title or author\"\n\t\t\tvalue={query}\n\t\t\tonChange={this.getBooks}\n\t\t\t/>\n </div>\n </div>\n <div className=\"search-books-results\">\n <ol className=\"books-grid\">\n\n {this.state.searchedBooks.filter((book =>\n book.shelf !== \"wantToRead, currentlyReading, read\"\n \n )).map((book) => \n <Book \n book={book} \n key={book.id}\n shelf={book.shelf} \n onUpdate={(shelf) => {this.update_book(book, shelf)}} \n />)}\n\t\t\t</ol>\n </div>\n\n </div>\n\n )\n }", "handleSearch(event) {\n this.props.searchYelp(this.state.term, this.state.location, this.state.sortBy);\n event.preventDefault();\n }", "doSearch(term){\n \n let self = this;\n let type = 'term';\n this.page = 1; // reset page num\n \n\t let url = `${API.search_api}${API.app_id}${API.posts_per_page}&page=${this.page}&query=${this.search_term}`;\t \n\t \n\t // Search by ID\n\t // allow users to search by photo by prepending id:{photo_id} to search terms\n\t let search_type = term.substring(0, 3);\t \n\t if(search_type === 'id:'){\t\t \n\t\t type = 'id';\n\t\t term = term.replace('id:', '');\n \t url = `${API.photo_api}/${term}${API.app_id}`; \t \n\t }\n\n let input = document.querySelector('#photo-search');\n \n\t fetch(url)\n\t .then((data) => data.json())\n .then(function(data) { \n \n // Term Search\n if(type === 'term'){\n\t \n \t self.total_results = data.total;\n \t \n \t // Check for returned data\n \t self.checkTotalResults(data.results.length);\n \t \n \t // Update Props\n \t self.results = data.results;\n \t self.setState({ results: self.results }); \t \n\t \n\t }\n\t \n\t // Search by photo ID\n\t if(type === 'id' && data){\n \t \n \t // Convert return data to array \t \n \t let photoArray = []; \t \n \t \n \t if(data.errors){ // If error was returned\n\t \t \n\t \t self.total_results = 0; \n\t \t self.checkTotalResults('0');\n\t \t \n\t \t } else { // No errors, display results\n\t\t \t \n\t \t photoArray.push(data);\n\t \t \n\t \t self.total_results = 1; \t \n\t \t self.checkTotalResults('1');\n\t \t \n \t }\n \t \n \t self.results = photoArray;\n \t self.setState({ results: self.results });\n }\n\t \n\t input.classList.remove('searching');\t\n\t \t\t \n\t })\n\t .catch(function(error) {\n console.log(error);\n self.isLoading = false;\n });\n\t\t \n }", "handleClickEvent() {\n this.props.fetchSearch(this.state.search)\n }", "searchClicked(_) {\n flikrSearch(this.state.term).fork(this.showError,this.updateResults)\n }", "function handleSearch(e){\n setSearch(()=>e.target.value)\n e.preventDefault()\n search && fetch(search_api+search)\n .then((res)=>res.json())\n .then((data)=>{setMovies((pv)=>pv=data.results)}) \n if(e.target.value==='' ||e.target.value===undefined ){\n setTrending(!trending)\n }\n if(movies===undefined){\n setTxt('')\n }\n}", "function getBooksData(searchTerm)\n{\n const settings = {\n url: BOOKS_SEARCH_URL,\n data: {\n q: `${searchTerm}`,\n maxResults: 6,\n startIndex: 0\n },\n dataType: 'json',\n type: 'GET',\n success: displayData\n };\n\n $.get(settings);\n}", "submitSearch(){\n const { selectedGenre, year, rating } = this.state;\n\n axios.get(`https://api.themoviedb.org/3/discover/movie?api_key=126293cbe36ad88482598ec4e7595380`\n + `&certification_country=US&sort_by=popularity.desc`\n + `&with_genres=${selectedGenre}`\n + `&primary_release_date.gte=${year.value.min}-01-01&primary_release_date.lte=${year.value.max}-12-31`\n + `&vote_average.gte=${rating.value.min}`\n + `&vote_average.lte=${rating.value.max}`)\n .then(response => { \n this.setState({ \n resultList: response.data.results \n });\n });\n }", "searchMovie() {\n axios\n .get('https://api.themoviedb.org/3/search/multi', {\n params: {\n \"api_key\": '6c5e72b5c6b0f7602a85d01cf04bc5cd',\n \"query\": this.movieName\n }\n }) \n .then((response) => {\n const result = response.data.results;\n this.movies = result;\n this.filteredMovies = [];\n this.movies.forEach((element) => {\n if(element.media_type == 'movie' || element.media_type == 'tv') {\n this.filteredMovies.push(element);\n }\n })\n this.movieName = '';\n\n // Faccio un loop per convertire in numeri da 1 a 5 il voto\n this.movies.forEach(element => {\n element.vote_average = element.vote_average / 2;\n element.vote_average = Math.round(element.vote_average);\n \n \n });\n this.selectGenre = '';\n this.homePage = false;\n });\n }", "search() {\n\t\tthis.props.onSearch(this.state.term);\n\t}", "newSearch(){\r\n fetch('/books')\r\n .then(res => res.json())\r\n .then(data => this.setState({data}, () => console.log('info fetched...', data)))\r\n }", "function handleFormSubmit(event) {\n event.preventDefault();\n if (formObject.title) {\n API.searchBooks(formObject.title)\n .then(res => {\n setBooks(res.data.items.map(book => (\n {\n \"id\": book.id,\n \"title\": book.volumeInfo.title,\n \"author\": book.volumeInfo.authors,\n \"description\": book.volumeInfo.description || \"\",\n \"image\": book.volumeInfo.imageLinks.thumbnail,\n \"link\": book.volumeInfo.infoLink\n }\n )))\n })\n .catch(err => console.log(err));\n }\n }", "clickSearch() {\n this.set('loading', true);\n this.elasticSearch.setFilterString(\"\");\n this.elasticSearch.clearUserSearch();\n this.elasticSearch.queryUsers();\n }" ]
[ "0.80293226", "0.78242433", "0.7710823", "0.7531888", "0.732654", "0.7155331", "0.7145036", "0.7118016", "0.71113783", "0.7004863", "0.69973826", "0.6993979", "0.6958667", "0.69534", "0.692687", "0.6922229", "0.6920562", "0.69113564", "0.6908385", "0.6897781", "0.68962806", "0.6883247", "0.68652797", "0.68620104", "0.68602467", "0.685321", "0.6850255", "0.6848597", "0.6839126", "0.6819498", "0.6794831", "0.6790589", "0.6785619", "0.67849624", "0.6784682", "0.67612946", "0.6759848", "0.675364", "0.67529005", "0.672329", "0.67050934", "0.67015165", "0.6678888", "0.66770494", "0.66733044", "0.6661808", "0.6657322", "0.6656144", "0.66523856", "0.6651485", "0.6647724", "0.66294533", "0.6612889", "0.66059685", "0.6602328", "0.66004264", "0.65983343", "0.6594927", "0.65942353", "0.65926266", "0.65795183", "0.657238", "0.6566468", "0.6564072", "0.6554054", "0.6552268", "0.6550395", "0.65486526", "0.65323067", "0.651498", "0.64952487", "0.64878184", "0.64769554", "0.64724123", "0.64723796", "0.6471746", "0.6470463", "0.6464585", "0.6462144", "0.645614", "0.6455016", "0.64549595", "0.64462733", "0.644122", "0.64396876", "0.643627", "0.6436112", "0.642201", "0.64212656", "0.64170545", "0.64166963", "0.6413485", "0.64134556", "0.6412242", "0.6397575", "0.6392847", "0.6392403", "0.63906467", "0.63870096", "0.6386133" ]
0.8781384
0
Returns a boolean if the list is empty or not
isEmpty() { return this.head == null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isEmpty() {\n return this._list.length == 0 ? true : false;\n }", "isEmpty() {\n return this.list.length === 0;\n }", "isEmpty() {\n\t\treturn this.items.length === 0;\n\t}", "isEmpty() {\n\t\treturn this.items == 0;\n\t}", "isEmpty() {\n\t\treturn this.items.isEmpty();\n\t}", "function isEmpty(list) {\n if (Object.keys(list).length === 0 && list.constructor === Object) {\n return true\n }\n return false;\n}", "function isEmpty(list) {\n return list === nil;\n}", "isEmpty() {\n return this.items.isEmpty();\n }", "isEmpty() {\r\n\t\treturn size() == 0;\r\n\t}", "empty(){ return this.list.isEmpty(); }", "isEmpty() {\n\t\treturn Object.keys(this.items).length == 0\n\t}", "isEmpty() {\r\n\t\treturn this.size == 0;\r\n\t}", "isEmpty() {\n\t\treturn this.size === 0;\n\t}", "isEmpty() {\n return !this.items.length;\n }", "isEmpty(){\n // All we want to do is return a boolean for whether or not the list is empty, so here's 2 ways\n\n // Method 1: The 'thorough' way\n\n // If the head is null, it means the list is empty\n if(this.head == null) {\n // so return true\n return true;\n } else {\n // otherwise, return false!\n return false;\n }\n\n // Method 2: The 'slick' way\n\n return this.head === null;\n }", "isEmpty() {\n return this.size == 0;\n }", "isEmpty() {\n return this.items.length == 0\n }", "empty() {\n\t\tif (this.size() === 0) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "isEmpty() {\n return (this._size === 0);\n }", "isEmpty() {\n return this.items.length === 0;\n }", "isEmpty() {\n if (this.size == 0) {\n return true;\n }\n return false;\n }", "isEmpty() {\n return (this.elements > 0) ? false : true;\n }", "isEmpty() {\n return (this.elements > 0) ? false : true;\n }", "isEmpty() {\n return this._size === 0;\n }", "isEmpty() {\n\t\treturn this._length === 0;\n\t}", "isEmpty() {\n\t\tif (this.head == null) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "isEmpty() {\n\t\tif (this.head == null) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "isEmpty(){\n return this.items.length == 0;\n }", "isEmpty () {\n\t\treturn (this.length === 0);\n\t}", "isEmpty() {\n return this.items.length === 0; // return true if the queue is empty.\n }", "isEmpty() {\n return _size == 0;\n }", "isEmpty() {\n if (this.#size == 0) {\n return true;\n } else {\n return false;\n }\n }", "isEmpty(){\n if(this.items.length == 0){\n return true;\n }\n else{\n return false;\n }\n }", "isEmpty() {\r\n // An empty list in its most simplified form is a list\r\n // with a head that is null.\r\n\r\n // So what this does, it it grabs the boolean for head == null, and returns that.\r\n return this.head == null;\r\n\r\n // Alternative:\r\n if (this.head==null) {\r\n return true;\r\n }\r\n return false;\r\n }", "isEmpty() {\n return this.size() === 0; \n }", "isEmpty(){\n if(this.items.length === 0){\n return true;\n }\n return false;\n }", "isEmpty() {\n if (this.head) {\n return true;\n } else {\n return false;\n }\n }", "isEmpty() {\n if (this.head) {\n return true;\n } else {\n return false;\n }\n }", "isEmpty() { \n return this.size == 0; \n }", "isEmpty() {\n return this.size() < 1;\n }", "isEmpty() {\n return this.length === 0;\n }", "isEmpty() {\n return this.length === 0;\n }", "function isEmpty(xs) { return Z.size (xs) === 0; }", "empty() {\n\n // no todos?\n return this.data.length === 0;\n }", "isEmpty() \n { \n return this.items.length == 0; \n }", "isEmpty() {\n return (this.length === 0);\n }", "isEmpty() {\n return (this.length === 0);\n }", "isEmpty(){\n return this.items.length == 0; \n }", "isEmpty() {\n try {\n const diff = this._head - this._length\n if(diff >= 0) {\n this._revertToOriginal()\n }\n return diff >= 0 ? true : false\n } catch(err) {\n throw new Error(err)\n }\n }", "isEmpty() {\n return this.head ? false : true\n }", "isEmpty() \n { \n return this.size == 0; \n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.size === 0;\n }", "isEmpty() {\n return this.length==0;\n }", "isEmpty() {\n if (this.head == null && this.tail == null){\n return true;\n }\n else {\n return false;\n }\n }", "isEmpty() {\n return this.count === 0;\n }", "isEmpty() {\n return this.count === 0;\n }", "isEmpty() {\n return this.length === 0;\n }", "isEmpty() {\n return this.length === 0;\n }", "empty () { return this.length === 0 }", "function is_empty_list(xs) {\n if (array_test(xs)) {\n if (xs.length === 0) {\n return true;\n } else if (xs.length === 2) {\n return false;\n } else {\n throw new Error(\"is_empty_list(xs) expects empty list \" +\n \"or pair as argument xs, but encountered \"+xs);\n }\n } else {\n return false;\n }\n}", "@action(\"empty <List>\", { types: [ List ] })\n\tstatic empty(list) {\n\t\tif (!(list instanceof List)) return false\n\t\tlist.items = []\n\t\treturn true\n\t}", "isEmpty() {\n \n if (this.head == null){\n return true\n }\n else {\n return false\n }\n\n }", "isEmpty(){\n return this.items.length == 0;\n }", "isEmpty() {\n return this.length() === 0;\n }", "isEmpty() {\n return (this.collection.length === 0);\n }", "isEmpty() {\n return (this.collection.length === 0);\n }", "isEmpty() {\n if (this._storage.head === null) {\n return true;\n }\n return false;\n }", "function isEmpty(info_list){\n for(var i = 0; i < info_list.length; i++){\n if(info_list[i] == \"\"){\n return true;\n }\n }\n return false;\n}", "isEmpty() {\n if (this.length < 1) {\n return true;\n }\n return false;\n }", "isEmpty() {\n if (this.length < 1) {\n return true;\n }\n return false;\n }", "isEmpty() {\n if (this.head == this.tail) return true;\n return false;\n }", "isEmpty () {\n return Boolean(this.queue.length === 0)\n }", "isEmpty() {\n return this.queue.size() === 0;\n }", "function isEmpty(){\n return (queue.length === 0);\n }", "isEmpty() {\n return this.data.length === 0;\n }", "isEmpty() {\n return (this.data.length===0);\n }", "isEmpty() {\r\n if (this.items.length == 0){\r\n\r\n console.log(\"true\");\r\n }else{\r\n console.log(\"false\");\r\n }\r\n }", "function isEmpty(collection) {\n return collection.size === 0;\n}", "function isEmpty(collection) {\n return collection.size === 0;\n}", "isEmpty(){\n if(this.head == null){\n return true;\n }\n else{\n return false;\n }\n }", "isEmpty() {\n if (this.queue.length) {\n return false;\n }\n return true;\n }", "function isEmpty() {\n return this.toString().length === 0;\n }", "empty(){\r\n return this.size == 0;\r\n }", "isEmpty() {\r\n return this.data.isEmpty();\r\n }", "isEmpty() {\r\n return this.data.isEmpty();\r\n }", "isEmpty() {\n return this.head === null;\n }", "isEmpty() {\n return this.head === null;\n }", "isEmpty(){\n let isEmpty = true;\n for(let i=0; i<this.data.length; i++){\n if(typeof this.data[i] !== \"undefined\"){\n isEmpty = false;\n }\n }\n return isEmpty;\n }", "isEmpty() {\n\t\tlet current = this.head;\n\t\tif (current === null) {\n\t\t\tconsole.log('The list is empty');\n\t\t\treturn;\n\t\t} else {\n\t\t\tthis.printListData();\n\t\t}\n\t}", "isEmpty(){ return this.size == 0; }", "function ArrayListIsNull(lstArr) {\n if (typeof lstArr != \"undefined\" && lstArr != null && lstArr.length > 0) {\n return false;\n } else {\n return true;\n }\n}", "isEmpty() {\n return this.storage.length === 0;\n }", "isEmpty() {\n if (this.collection.length === 0) return true\n else return false\n }", "isEmpty(){\n return this.size==0;\n }", "empty () {\n return !(this.length >= 1);\n }", "isEmpty() {\n return this.collection.length === 0;\n }" ]
[ "0.8775787", "0.84373957", "0.8101944", "0.80702233", "0.79909503", "0.7913101", "0.7898488", "0.78753054", "0.78437", "0.7834908", "0.78166986", "0.7798622", "0.7787578", "0.77678066", "0.7734837", "0.7734568", "0.7722334", "0.77094054", "0.7707432", "0.7706778", "0.77016026", "0.7699879", "0.7699879", "0.7681461", "0.7662474", "0.76351035", "0.76351035", "0.7613189", "0.7603399", "0.76018083", "0.7582108", "0.7552961", "0.7549343", "0.7546029", "0.75445575", "0.7535624", "0.7479742", "0.7479742", "0.747577", "0.7475429", "0.74732214", "0.74732214", "0.745927", "0.7440749", "0.742434", "0.7422858", "0.7422858", "0.7400535", "0.73935264", "0.73896474", "0.7374662", "0.73738855", "0.73738855", "0.73738855", "0.73738855", "0.73738855", "0.7363048", "0.73549414", "0.73531365", "0.73531365", "0.7350683", "0.7350683", "0.7347034", "0.73332226", "0.73100585", "0.7308668", "0.72927845", "0.7289299", "0.7285572", "0.7285572", "0.7265207", "0.72492975", "0.7242124", "0.7242124", "0.72382736", "0.7232541", "0.7221229", "0.7218433", "0.7160557", "0.71603817", "0.7149178", "0.71474326", "0.71474326", "0.7140262", "0.71330607", "0.71212995", "0.7107201", "0.7093186", "0.7093186", "0.707594", "0.707594", "0.70748645", "0.7050667", "0.70474607", "0.7028195", "0.7026981", "0.7024059", "0.7018481", "0.7017743", "0.7014084" ]
0.74802655
36
Returns the size of the list
size() { return this.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function length() {\n\treturn this.listSize;\n}", "sizeOfList() {\r\n\t\treturn this.size;\r\n\t}", "sizeOfList() {\n return this.size;\n }", "sizeOfList() {\n return this.size;\n }", "function listLength(){\n return list.length;\n}", "size_of_list() {\n console.log(_size);\n }", "function listLength(){\n\treturn item.length;\n}", "function listLength() {\n return listItems.length;\n}", "@expression(\"length of <List>\", {\n\t\talias: [\"size of <List>\", \"number of items (of|in) <List>\"]\n\t\ttypes: [ List ],\n\t\treturns: Integer\n\t})\n\tstatic length(list) {\n\t\tif (!(list instanceof List)) return undefined\n\t\treturn list.items.length\n\t}", "function listLength() {\n return item.length;\n}", "listSize() {\n return this.size;\n }", "sizeOfList() {\n console.log(\"list size: \", this.size);\n }", "get length() {\n this._update();\n return this._list.length;\n }", "function listLength() {\n\tconsole.log(listItems.length);\n\treturn listItems.length;\n}", "size_of_list() {\n console.log(this.size);\n }", "size() {\n let current = this.head;\n let counter = 0;\n while (current) {\n counter++;\n current = current.next;\n }\n return counter;\n }", "function getSize(list) {\n if (list.head === null)\n return 0;\n let n = list.head;\n let size = 1;\n while (n.next !== null) {\n size++;\n n = n.next;\n }\n return size;\n}", "size() {\n\t\treturn this.items.length();\n\t}", "length_list() {\r\n var temp = this.head\r\n let length = 0\r\n while (temp.next != null) {\r\n length++\r\n temp = temp.next\r\n }\r\n return length\r\n }", "size () {\n\t\tlet count = 0;\n\t\tlet node = this.head;\n\n\t\twhile (node) {\n\t\t\tcount++;\n\t\t\tnode = node.next;\n\t\t}\n\n\t\treturn count;\n\t}", "size () {\n\t\tlet count = 0;\n\t\tlet node = this.head;\n\n\t\twhile (node) {\n\t\t\tcount++;\n\t\t\tnode = node.next;\n\t\t}\n\n\t\treturn count;\n\t}", "size () {\n\t\tlet count = 0;\n\t\tlet node = this.head;\n\n\t\twhile (node) {\n\t\t\tcount++;\n\t\t\tnode = node.next;\n\t\t}\n\n\t\treturn count;\n\t}", "getLength() {\r\n\t\tlet len = 0;\r\n\t\tlet itr = this.head;\r\n\t\twhile (itr) {\r\n\t\t\tlen++;\r\n\t\t\titr = itr.next;\r\n\t\t}\r\n\t\treturn len;\r\n\t}", "get length() {\n return this.list.size;\n }", "function size(llist) {\n let currNode = llist.head;\n let counter = 0;\n while (currNode !== null) {\n currNode = currNode.next;\n counter++;\n }\n console.log(\"This list has \" + counter + \" items\");\n}", "size() {\n\t\treturn this.items.length;\n\t}", "getSize () {\n let counter = 1;\n let curr = head;\n while (curr.next !== null) {\n counter++;\n }\n return counter;\n }", "size() {\n let count = 0;\n let node = this.head;\n\n // Iterate through the linked list nodes\n // Increase counter for every node found in the linked list\n while (node) {\n count++;\n node = node.next;\n }\n return count;\n }", "size_of_list() \n { \n console.log(this.size); \n }", "size() {\n return this.items.length();\n }", "get length() {\n return this._list.length;\n }", "size() {\r\n\t\treturn this.items.length;\r\n\t}", "function size() {\n\t return n;\n\t }", "size() {\n if (this.isEmpty()){\n return 0;\n }\n\n var size = 1;\n var runner = this.head;\n while (runner.next != null) {\n runner = runner.next;\n size ++;\n }\n return size;\n }", "size() {\n let len = 0;\n let runner = this.head;\n\n while (runner) {\n len += 1;\n runner = runner.next;\n }\n return len;\n }", "size() {\n let current, counter;\n [current, counter] = [this.head, 0];\n while (current) {\n counter++;\n current = current.next;\n }\n return counter;\n }", "size() {\r\n let count = 0;\r\n let runner = this.data.head;\r\n while(runner != null) {\r\n runner = runner.next;\r\n count++;\r\n }\r\n return count;\r\n }", "size () {\n if (!this.head) {\n return 0 \n }\n\n let current = this.head;\n let count = 0; \n\n while(current) {\n count++\n current = current.next\n }\n\n return count\n }", "function size() {\n return n;\n }", "size() {\n\n return this.items.length;\n }", "size() {\r\n let runner = this.data.head;\r\n let count = 0;\r\n while(runner != null) {\r\n runner = runner.next;\r\n count++;\r\n }\r\n return count;\r\n }", "function size() {\n return this.toArray().length;\n }", "function size(lst){\n let currentNode = lst.head;\n let lstSize = 0;\n if(currentNode) {\n lstSize = 1;\n }\n while (currentNode.next !== null) {\n currentNode = currentNode.next;\n lstSize++;\n }\n console.log(lstSize);\n return lstSize;\n}", "size() {\n let count = 0;\n let node = this.head; // Declare a node variable initialize to this.head\n // While the node exist\n while (node) {\n count++; // Increment count variable\n node = node.next; // reinitialize node to next node (if node.next is null the loop will break)\n }\n return count; // return count (which is the size)\n }", "function getNumberOfObjs() {\n\t\treturn this.list.length;\n\t}", "function nbItems(list){\n var count = list.length;\n for (var i = 0; i < list.length; i++) {\n count += list[i].users.length;\n }\n return count;\n }", "function getNameListLength(){\r\n var len = getNameLength();\r\n return len;\r\n}", "function length(list) {\n /**\n * A byte sequence’s length is the number of bytes it contains.\n */\n return list.length;\n}", "size() {\n\t\tvar runner = this.head;\n\t\tvar counter = 0;\n\n\t\twhile (runner != null) {\n\t\t\tcounter += 1;\n\t\t\trunner = runner.next;\n\t\t}\n\t\treturn counter;\n\t}", "size() {\n\t\tvar runner = this.head;\n\t\tvar counter = 0;\n\n\t\twhile (runner != null) {\n\t\t\tcounter += 1;\n\t\t\trunner = runner.next;\n\t\t}\n\t\treturn counter;\n\t}", "size() {\n\t\treturn this.count;\n\t}", "size() {\n\n var count = 0\n\n if (this.head == null) {\n return count\n }\n else {\n var runner = this.head\n while (runner != null){\n count += 1;\n runner = runner.next;\n }\n return count\n }\n \n }", "size() {\n return this.items.length;\n }", "size() {\n let counter = 0;\n let node = this.head;\n\n while (node) {\n counter++;\n node = node.next;\n }\n\n return counter;\n }", "get size() {\n\t\treturn this._l;\n\t}", "get size() {\n\t\treturn this._l;\n\t}", "get size() {\n\t\treturn this._l;\n\t}", "get length() {\n return this.list.length;\n }", "function size(ll) {\n let current = ll.head;\n let next = current.next;\n let count = 0;\n while (next !== null && next.value !== null) {\n count++;\n current = next;\n next = next.next;\n }\n console.log(count + 1);\n}", "size()\r\n {\r\n return this.#count;\r\n }", "count(){\n\t\treturn this.size;\n\t}", "count () {\n\t\treturn this[DISPLAY_LIST].length;\n\t}", "sizeOf() {\n return this.size;\n }", "function length(list) {\r\n if(isEmpty(list)) {\r\n return 0;\r\n } else {\r\n return 1 + length(rest(list));\r\n }\r\n}", "get length() {\n let entry = this.first;\n let length = 0;\n while (entry) {\n ++length;\n entry = entry.next;\n }\n return length;\n }", "size() {\n return this.tail - this.head;\n }", "get length() {\n return this.items.size;\n }", "size() {\n return Math.abs(this.tail - this.head);\n }", "get length() {\n\t\treturn this.items.length;\n\t}", "count() {\n let sum = this.items.length;\n return sum;\n }", "size() {\n let count = 0;\n let node = this.head;\n while (node) {\n count++;\n node = node.both.next;\n }\n return count;\n }", "function getLength( list ) {\n if( list == \"ids\" ){\n return ids.length\n }else if( list == \"titles\" ) {\n return titles.length\n }else if( list == \"types\" ) {\n return types.length\n }else if( list == \"uris\" ) {\n return uris.length\n }else if( list == \"thumbUris\" ) {\n return thumbUris.length\n }else {\n console.log( \"list \" + list + \" unknown.\" )\n return -1\n }\n}", "function size(collection) {\n return collection.length;\n}", "get length () {\n return this.list.length\n }", "function size() {\n return members.length;\n }", "function checkListLen() {\n return ul.children.length;\n}", "length(){\n let len = 0;\n let runner = this.head;\n while (runner){\n len++;\n runner = runner.next;\n }\n return len;\n }", "length(){\n let len = 0;\n let runner = this.head;\n while (runner){\n len++;\n runner = runner.next;\n }\n return len;\n }", "function size() {\r\n var counter = 0;\r\n for (var i = 0; i < this.PriorityQueueContents.length; i++) {\r\n counter += this.PriorityQueueContents[i].ids.length;\r\n }\r\n return counter;\r\n }", "size() {\n return this.items.length\n }", "size() {\n return this.count;\n }", "size() {\n return this.count;\n }", "function length(xs){\r\n return xs.length;\r\n}", "size() {\n return this._size;\n }", "size(){\n return this.items.length;\n }", "get arraySize() {}", "size() {\n return this.n;\n }", "function listLength(head) {\n let count = 0;\n\n for (let node = head; node != null; node = node.next) {\n count += 1;\n }\n // (...)\n\n return count;\n}", "get size() {}", "function countItemsInList(list) {\n var count = 0;\n if (list.length === 0) return count;\n return (count += 1 + countItemsInList(list.slice(1)));\n}", "size(){\n // Object.keys returns an array of all the properties of a given obj...\n return Object.keys(this.items).length;\n\n \n // OR, iterate thru object and increase counter for each (this does the same thing as Object.keys does under the hood)\n // var count = 0;\n // for (var key in this.items){\n // if (this.items.hasOwnProperty(key)){\n // count++;\n // }\n // }\n // return count;\n \n }", "size() {\n return this._size;\n }", "size() {\n return this._size;\n }", "size() {\n return this._size;\n }", "size() {\n return this.count;\n }", "size() {\n return this.count;\n }", "size() {\n return this.count;\n }", "get length() {\n let node = this.head;\n let count = 0;\n while (node !== null) {\n count++;\n node = node.next;\n }\n return count;\n }", "get size() {\n return this._array.length\n }", "size() {\n return this.sizeNum;\n }", "size(){\n return this.items.length;\n\n }" ]
[ "0.8625435", "0.8377767", "0.82152945", "0.82152945", "0.820825", "0.82018113", "0.81429094", "0.8127189", "0.80983436", "0.80377424", "0.8025926", "0.8000182", "0.7976032", "0.7887398", "0.7873033", "0.77376676", "0.77184117", "0.7716017", "0.77030385", "0.7669951", "0.7669951", "0.7669951", "0.76335037", "0.756976", "0.75650644", "0.75541925", "0.75510675", "0.7525182", "0.7509325", "0.7508865", "0.7507414", "0.7507008", "0.7502464", "0.74944764", "0.7490219", "0.74589896", "0.7452095", "0.7424615", "0.7401192", "0.73861927", "0.73797745", "0.7372617", "0.73124754", "0.7299814", "0.72979236", "0.7293328", "0.729109", "0.7285073", "0.7280681", "0.7280681", "0.7276253", "0.7269758", "0.724989", "0.7233729", "0.72229975", "0.72229975", "0.72229975", "0.7201226", "0.71987516", "0.71761155", "0.71758866", "0.71564347", "0.71562755", "0.70973146", "0.706011", "0.7058266", "0.7020105", "0.70192724", "0.70025873", "0.69979763", "0.69894063", "0.69792026", "0.69790906", "0.6964789", "0.6946709", "0.6936439", "0.6930303", "0.6930303", "0.6928291", "0.6917329", "0.69150203", "0.69150203", "0.6912018", "0.69011635", "0.68977094", "0.68868464", "0.688272", "0.68466073", "0.68464303", "0.6832077", "0.6825933", "0.68125534", "0.68125534", "0.68125534", "0.6808649", "0.6808649", "0.6808649", "0.6802865", "0.6782491", "0.67808557", "0.6773322" ]
0.0
-1
Adds an object to the end of the list Returns true if the object is added successfully
add(object) { let newLink = new Link(object); if(this.isEmpty()) this.head = newLink; else { this.tail.next = newLink; newLink.prev = this.tail; } this.tail = newLink; this.length++; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addLast(object) {\n let newLink = new Link(object);\n if(this.isEmpty()) \n this.head = newLink;\n else {\n this.tail.next = newLink;\n newLink.prev = this.tail;\n }\n this.tail = newLink;\n this.length++;\n return true;\n }", "add(element) {\n if (!this.has(element)) {\n this.collection.push(element)\n return true\n }\n return false\n }", "add(obj) {\n const d = this._dummy;\n const n = new Node(obj, d, d.prev);\n\n d.prev.next = n;\n d.prev = n;\n ++this._size;\n\n return true;\n }", "function addObjectInList(list, object) {\n if (object) {\n list.push(object);\n }\n }", "addAtIndex(index, object) {\n let newLink = new Link(object);\n if(this.isEmpty()) {\n this.head = newLink;\n this.tail = newLink;\n this.length++;\n return true;\n }\n let current = this.head;\n let i = i;\n while(i < index && current != null) {\n current = current.next;\n i++;\n if(!current)\n return false;\n }\n newLink.next = current;\n current.prev.next = newLink;\n newLink.prev = current.prev;\n current.prev = newLink;\n this.length++;\n return true;\n }", "add(item) {\n\t\t// limit items added to queue\n\t\tif (this.items.length === this.itemLimit) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.items.push(item);\n\t}", "add(value) {\n if (!this.has(value)) {\n this.collection.push(value);\n return true;\n }\n return false;\n }", "function add(obj){\n let allData = getAll();\n\n if (_.isObject(obj) && !_.isEmpty(obj)){\n allData.push(obj);\n saveData(allData);\n } else {\n console.error(`Add: ${obj} is not a valid object`);\n }\n \n }", "addFirst(object) {\n let newLink = new Link(object);\n if(this.isEmpty())\n this.tail = newLink;\n else\n this.head.prev = newLink;\n newLink.next = this.head;\n this.head = newLink;\n this.length++;\n return true;\n }", "add(element){\n this.addLast(element);\n }", "add(object) {\n return this.addWithID(object, Juggler.getNextID())\n }", "add(value){\n if (!this.has(value)){\n this.items[value] = value;\n // also return true when successful\n return true;\n }\n // otherwise return false if set already contains the value...\n return false;\n }", "addObject(obj){\n this.objects.push(obj);\n }", "function addItem(item){\n if (isFull() === true){\n console.log(`${item} cannot be added, basket is full. Returning false.`);\n return false\n } else {\n basket.push(item);\n console.log(`${item} successfully added to basket. Returning true`)\n return true;\n }\n}", "onAddItem () {\n const newItem = this.get('bunsenModel').items.type === 'object' ? {} : ''\n const items = this.get('items')\n const index = items.length\n\n items.pushObject(newItem)\n this.notifyParentOfNewItem(newItem, index)\n }", "function addItem(item) {\n if (isFull(basket) === true) {\n console.log(`Basket is currently full. Could not add ${item}`);\n return false;\n } else {\n basket.push(item);\n return true;\n }\n}", "test(item) {\n const list = this._list\n let i = this._len\n\n if (list[i] === item) {\n list.pop()\n return true\n }\n\n while (i !== 0) {\n i--\n if (item === list[i]) {\n list.splice(i, 1)\n return true\n }\n }\n\n list.push(item)\n this._len++\n return false\n }", "function addItem(item) {\n basket.push(item);\n return true;\n}", "addFriend(newFriend){\n var i;\n for (i = 0; i < this._friends.length; i++) {\n if (this._friends[i] === newFriend){\n console.log(newFriend + \" is already in list\");\n return;\n }\n }\n this._friends.push(newFriend);\n }", "add(data) {\n // check if data was already in the array\n if (this.dataStore.indexOf(data) < 0) {\n this.dataStore.push(data);\n return true;\n } else {\n return false;\n }\n }", "append() {\n errors.throwNotImplemented(\"appending element to collection\");\n }", "function addItem(list, item) {\n\n let tempItem = list.find(itemIn => {\n\n return getValue(itemIn) === getValue(item);\n });\n\n if(!tempItem) {\n list.push(item);\n return true;\n } else {\n return false;\n }\n}", "async addChild(graphicObj) {\n if (graphicObj.group) {\n console.error(\"Can't add an object to more than one group\");\n return false;\n }\n graphicObj.group = null; //top level's group will be null\n if (this.children.length > 0) {\n console.error(\"Top level can only have one object\")\n return false;\n }\n this.children.push(graphicObj);\n await graphicObj.draw(this.ctx);\n return true;\n }", "add(value) { \n if (!this.has(value))\n this.collection.push(value); \n }", "addItem(userItem) {\n for(var i=0; i<this._userItemList.length; i++){\n // if not check the list for a new userItem and add it to the userItemList\n if(this.userItemList[i]._item._itemCode === userItem._item._itemCode){\n console.log('ERROR: Duplicate Save');\n } else {\n var newUserItem = new UserItem(\n userItem._item,\n userItem._category,\n userItem._rating,\n userItem._madeIt\n );\n // Add item to the userItems\n this._userItemList.push(newUserItem);\n console.log('UPDATE: Item Added')\n }\n return this._userItemList;\n }\n\n }", "function check_add_last(list) {\n if(list.children('.list__add').is(\":last-child\")) {\n return;\n } else {\n list.children().last().insertBefore(list.children('.list__add'));\n }\n}", "canAdd() {\n return this.addable().length > 0;\n }", "add(data) {\n this.processed = null;\n let added = false;\n if (Array.isArray(data)) {\n for (const item of data) {\n const res = this.add_item(item);\n if (!added) {\n added = res;\n }\n }\n }\n else {\n return this.add_item(data);\n }\n return added;\n }", "addEvent(event) {\n let newEvent = event;\n let isExists = this.eventList.forEach((event) => {\n return newEvent.id == event.id;\n });\n\n if (!isExists) {\n this.eventList.push(newEvent);\n this.renderEvents();\n return true;\n\n }\n return false;\n }", "add(string, object) {\n this.array.push(object)\n this.string += string\n this.modified = true\n }", "placeObject(object) {\n this.objects.add(object)\n }", "function addItemToStore(object) {\n // Push new item object to datastore\n STORE.push(object);\n}", "function addNewItem() {\n //Adds a new item to the array then updates the list\n let newItem = document.getElementById(\"new-item-input\").value;\n let exitFuncton = false;\n //Stops adding more than one of the same item, not sure if there's a simplar method but it works!\n shoppingList.forEach((item) => {\n if (item.ingredients === newItem) {\n exitFuncton = true;\n return;\n }\n });\n if (exitFuncton) {\n return;\n }\n let newListObject = { ingredients: newItem, acquired: false };\n shoppingList.push(newListObject);\n addListItem(newListObject);\n}", "addEntity(entity) {\n if (!Util.contains(this._entities, entity) && this.matches(entity)) {\n this._entities.push(entity);\n this.notifyAll(new AddedEntity(entity));\n }\n }", "addItem(item) {\r\n this.list.push(item);\r\n }", "function addAtLast() {\r\n value = document.getElementById('element').value;\r\n if(value) {\r\n array = getArray();\r\n if (!array.length) {\r\n alert('Linked List not exists \\n create first..')\r\n }\r\n else {\r\n array.push(new Node(value, null));\r\n setArray(array);\r\n arrayStatus(true, 'Linked List: ');\r\n }\r\n }\r\n else {\r\n alert('field must be fill..');\r\n }\r\n}", "function addIfComplete(aNode) {\n if (complete[aNode.id]) {\n return true;\n }\n \n if (incomplete[aNode.id]) {\n return false;\n }\n \n var isComplete = !!allPotentialObjects[aNode.id];\n \n if (isComplete && aNode.parents) {\n $.each(aNode.parents, function (key, parentNode) {\n if (!addIfComplete(parentNode)) {\n isComplete = false;\n return false;\n }\n });\n }\n \n if (!isComplete) {\n incomplete[aNode.id] = aNode;\n return false;\n } else {\n complete[aNode.id] = aNode;\n ret.push(aNode);\n return true;\n }\n }", "addEvent(event){\n if (this.events.includes(event.id)) {\n return false;\n } else {\n this.events.push(event.id);\n return true;\n }\n }", "addPointer (pointer) {\n \n if ((this.pointers.length > 0) && (this.isMember(pointer.id) || (!this.isInProximity(pointer))))\n return false;\n \n// this.pointers.push(new Pointer(pointer.e, pointer.lastPos, pointer.currentTime, pointer.lastTime));\n this.pointers.push(pointer);\n return true;\n }", "function add(animals, animal){ //checks if the animal to be added is\n if(animal.name && animal.species){ // valid and not already in the array\n for(let i = 0; i < animals.length; i++){\n if(animals[i].name === animal.name){\n return true;\n }else if(i === animals.length - 1){ //only adds if the loop \n animals.push(animal); //makes it to the end of the array\n } \n }\n }\n}", "function add() {\n if (desc) {\n let newObjects = [...props.objects];\n newObjects.push({ description: desc, checked: false, date: date });\n props.setObjects(newObjects);\n setDesc(\"\");\n }\n }", "push(value) {\n \n if(!value) {\n console.log(\"invalid value:\"+value)\n return false\n }\n \n this.array.unshift(value)\n return true\n }", "add(type, id) {\n if (this.typesSet.has(type)) {\n const wasInStorage = this.has(type, id);\n\n this.storage[type].add(id);\n\n // Inverse, since if id was not in storage we add this id successfully\n return !wasInStorage;\n }\n return false;\n }", "add(value) {\n if (this.isEmpty()) {\n this.first = new Node(value);\n this.size++;\n return true;\n }\n let currntNode = this.first;\n while (currntNode.next) {\n currntNode = currntNode.next;\n }\n currntNode.next = new Node(value);\n this.size++;\n return true;\n }", "function appendItem(obj) {\n todo_list.insertBefore(getTodoItem(obj), todo_list.firstChild);\n }", "addUser (user) {\n if (this.players.length < this.maxPlayers) {\n if (this.players.findIndex(player => player.name === user.name) === -1) {\n this.players.push(user)\n user.join(this.name)\n user.room = this\n console.log('user ' + user.name + ' joined room ' + this.name)\n return true\n } else {\n console.log('user ' + user.name + ' tried to join room ' + this.name + ' but a player in that room already had that name')\n return false\n }\n } else {\n return false\n }\n }", "addUser(user) {\n let foundUser = false;\n for (let i = 0; i < this.chatUsersDB.length; i++) {\n if (this.chatUsersDB[i].username === user.username) {\n foundUser = true;\n break;\n }\n }\n\n if (!foundUser) {\n user.hoursInChatroom = 0;\n this.chatUsersDB.push(user);\n return true;\n }\n else {\n return false;\n }\n }", "add(element)\n {\n if (!this.has(element))\n this.elements.push(element);\n }", "addChild(graphicObj) {\n if (graphicObj.group) {\n console.error(\"Can't add an object to more than one group\");\n return false;\n }\n graphicObj.group = null; //top level's group will be null\n if (this.children.length > 0) {\n console.error(\"Top level can only have one object\")\n return false;\n }\n this.children.push(graphicObj);\n graphicObj.draw(this.ctx);\n return true;\n }", "function addObject(toAdd) {\n objects.push(toAdd);\n toAdd.calcCorners();\n for(let line of toAdd.hitboxLines) sceneHitboxLines.push(line);\n for(let line of toAdd.visibleLines) sceneVisibleLines.push(line);\n}", "addItem(itemStack){\n //Check if the given object is an ItemStack.\n if(!itemStack instanceof ItemStack){\n console.log(\"ERROR: given object is not an ItemStack.\");\n }\n\n //First try to add the items to existing item stacks.\n var stackWithSpace = this.itemStacks.find(tryStack => tryStack.itemID == itemStack.itemID && !tryStack.reachedCapacity());\n if(stackWithSpace != null){\n if(stackWithSpace.amount + itemStack.amount <= itemStack.item.stackMax){\n stackWithSpace.amount += itemStack.amount;\n return true;\n }else{\n var delta = itemStack.item.stackMax - stackWithSpace.amount;\n stackWithSpace.amount = itemStack.item.stackMax;\n itemStack.amount = delta;\n return this.addItem(itemStack);\n }\n }\n\n //Then create a new item stack.\n if(this.itemStacks.length <= this.maxStacks){\n this.itemStacks.push(itemStack);\n return true;\n }else{\n return false;\n }\n }", "add(element) {\n if (!this.has(element)) {\n this.dictionary[element] = element;\n this.length++;\n return true;\n }\n return false;\n }", "addItem(name) {\n if ( !(this.items.all.includes(name))) {\n console.log(\"Adding new item, \" + name)\n this.items.all.push(name)\n }\n }", "putAfter(item, location){\n if (item instanceof LinkItem || item instanceof LinkList){\n if (this.contains(location)){\n if (location.next == null || location == this.end){\n this.push(item)\n }else if(location.last == null || location == this.start){\n this.queue(item)\n }else{\n if (this.contains(item)){\n throw `Error calling putAfter:\\nCannot put an item contained inside this list`\n return\n }\n if (item instanceof LinkItem){\n this.length++;\n let next = location.next;\n location.link(item);\n item.link(next);\n }else{\n this.length += item.length;\n let next = location.next;\n location.link(item.start);\n item.end.link(next);\n }\n }\n }else{\n throw `Error calling putAfter:\\nThe location is not in the linked list`\n }\n }else{\n throw `Error calling putAfter:\\nThe item given is not a LinkList or LinkItem`\n }\n }", "function addItem (item) {\n if (listPeople.length == 0) getPeopleList()\n\n // busco si ya existe para no agregarlo nuevamente\n for (var i = 0; i < listPeople.length; i++) {\n if (item.name === listPeople[i].name) {\n return\n }\n }\n\n listPeople.push(item)\n\n setPeopleList()\n}", "add(element) {\n if (!this.has(element)) {\n this.dictionary[element] = true;\n this.length++;\n return true;\n }\n\n return false;\n }", "function add(pokemon) {\n // Validation of item\n if (typeof pokemon === 'object') {\n pokemonList.push(pokemon);\n } else alert('not possible');\n }", "addItem(newItem) {\n for (let index in this.items) {\n let item = this.items[index];\n if (item.id === newItem.id) {\n item.quantity += newItem.quantity;\n this.updateTotal();\n return;\n }\n }\n\n this.items.push(newItem);\n this.updateTotal();\n }", "function insert(element, after){\n var insertPos = this.find(element)\n if(insert > -1){\n this.dataStore.splice(insertPos+1, 0, element)\n ++this.listSize\n return true\n }\n return false\n}", "function addFriend (name, object) {\nobject.friends.push(name); //pushes name in the object.friends array\nreturn object; //returns the updated object\n}", "add(value){\n if(!this.has(value)){\n this.members.push(value);\n }\n }", "push(value){\n this.items.push(value);\n return this.items.length;\n }", "add(value) {\n if (!this.has(value)) {\n this.set.push(value);\n }\n }", "function addToMylist() { return changeMylistState('add',this); }", "add(collection, obj) {\n this.db.get(collection).push(obj).last().value();\n }", "addAt(index) {\n var node = new Node(element);\n var currentNode = this.head;\n var previousNode;\n var currentIndex = 0;\n\n if(index > this.length){\n return false;\n }\n\n if(index === 0){\n node.next = currentNode;\n this.head = node;\n } else {\n while(currentIndex < index){\n currentIndex++;\n previousNode = currentNode;\n currentNode = currentNode.next;\n }\n node.next = currentNode;\n previousNode.next = node;\n }\n this.length++;\n }", "addOneIfEmpty() {\n if (this.childrenCount === 0) {\n this.addOne()\n this.initRemove()\n }\n }", "function addData(obj) {\n listData.push(obj);\n renderList();\n}", "add(model) {\n if (!model) {\n return new Error(\"Collection.add method requires a model as a parameter\");\n } else if (!model.id) {\n return new Error(\"The model being added has no id\");\n } else {\n this.collection[model.id] = model;\n return true;\n }\n }", "add()\n {\n this.list.add((this.list.size) + \"\");\n }", "push(element){\n this.list.add(element);\n this.top = this.list.peekLast();\n }", "function addObject(obj) {\n obj.mapX = Math.max(0, Math.min(objectMapMaxIndex, Math.floor(obj.x / Constants.MAP_OBJ_GRID_SIZE)));\n obj.mapY = Math.max(0, Math.min(objectMapMaxIndex, Math.floor(obj.y / Constants.MAP_OBJ_GRID_SIZE)));\n objectMap[obj.mapX][obj.mapY][0]++;\n obj.mapPos = objectMap[obj.mapX][obj.mapY][0];\n objectMap[obj.mapX][obj.mapY].push(obj);\n\n// console.log(\"add obj:\" + obj.id + \" \" + obj.mapPos + \" \" + objectMap[obj.mapX][obj.mapY][obj.mapPos]);\n}", "add(slug) {\n\n console.log(\"favoritesList add\");\n // First see if recipe is already present\n let item = this.getItem(slug)\n\n if (item) {\n // Recipe is in favoritesList already; don't do anything\n\n } else {\n // Recipe not in favoritesList, add as new item\n this.items.push({\n slug: slug\n });\n }\n\n this.update();\n }", "addFriend(id, name, device, pfp){\n let possibleIDs = [{id : this.id}, ...this.friends];\n if (possibleIDs.some((elem) => (id === elem.id))) {\n return false;\n }\n\n this.friends.push(new Friend(id, name, device, pfp));\n return true;\n }", "add(element) { \n // adding element to the queue \n this.items.push(element); \n }", "function add(){\n console.log('adding...');\n var checkFlag = false;\n if (self.ustOwner.length > 0 || self.custOwner.length > 0) {\n if(self.ustOwner.length > 0)\n $rootScope.owners.ust = self.ustOwner[0].id;\n if (self.custOwner.length > 0)\n $rootScope.owners.customer = self.custOwner[0].id;\n }\n else{\n $rootScope.newUserId = self.contacts[0].id;\n if (self.selectedType == 1) {\n $rootScope.ownerType = \"ustOwner\";\n }\n else if (self.selectedType == 2) {\n $rootScope.ownerType = \"customerOwner\";\n }\n }\n \n }", "addNew(data) {\n\t\tlet db = this.db;\n\n\t\treturn new Promise((resolve, reject)=>{\n\t\t\tif (db.find({ id: data.id }).has(\"id\").value()) {\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\tdb.push(data).write();\n\t\t\t\tresolve(true);\n\t\t\t}\n\t\t});\n\t}", "add(item) {\n this.data.push(item);\n }", "function add(item) {\n data.push(item);\n console.log('Item Added...');\n }", "function insert(element, after) {\n var insertPosition = this.find(after);\n if (insertPosition > -1) {\n this.dataStore.splice(insertPosition + 1, 0, element);\n ++this.listSize;\n return true;\n }\n\n return false;\n}", "function JSBridgeObj_AddObject(id, obj) {\n var result = JSBridgeObj_AddObjectAuxiliar(id, obj);\n if (result != \"\") {\n if (this.objectJson != \"\") {\n this.objectJson += \", \";\n }\n this.objectJson += result;\n }\n}", "append(item) {\n }", "add(element)\r\n {\r\n let node = new Node(element); //creates new node\r\n let current; //to store current node\r\n //if this list is empty add the element & make it head\r\n if(this.head === null)\r\n {\r\n this.head = node;\r\n }\r\n else \r\n {\r\n current = this.head;\r\n //iterate through end of list\r\n while(current.next){\r\n current = current.next;\r\n }\r\n\r\n // add node\r\n current.next = node;\r\n }\r\n this.size++;\r\n }", "addWallToObject() {\n this.object.add(this.wall);\n }", "nextObject () {\n if (this.currentObjectIndex < this.objects.length - 1) {\n this.currentObjectIndex++\n this.objects[this.currentObjectIndex].begin()\n } else {\n this.state = TransferStates.Completed\n }\n }", "add (o) {\n if (this.isBreedSet())\n this.baseSet.add(o)\n else\n o.id = this.ID++\n this.push(o)\n return o\n }", "addItem(newItemData, listId){\n \n \n let list = _store.State.lists.find(list => list.id == listId)\n\n console.log(_store.State.lists)\n list.items.push(newItemData)\n _store.saveState()\n }", "contains(object) {\n return this.indexOf(object) !== -1;\n }", "function addSongToPlayList(obj){\r\n PlayList.push(obj);\r\n ShowSongs(obj);\r\n}", "addItem() {\n\t\tif (this.checklistItem) {\n\t\t\tthis.company.checklist.push(this.checklistItem);\n\t\t\tthis.checklistItem = null;\n\t\t}\n\t}", "function addFriend (name, object) {\n object.friends.push(name);\n return object;\n\n}", "function insert(element, after) {\n\tvar insertPos = this.find(after);\n\tif(insertPos > -1) {\n\t\tthis.dataStore.splice(insertPos + 1, 0, element);\n\t\t++this.listSize;\n\t\treturn true;\n\t}\n\treturn false;\n}", "addRow(row_data_obj) {\n\t\tlet current_item_keys = Object.keys(this.current_page_array);\n\t\tlet must_add_row = true;\n\t\tcurrent_item_keys.forEach(function(key) {\n\t\t\tif (this.current_page_array[key][\"Id\"] === row_data_obj[\"Id\"]) {must_add_row = false;}\n\t\t}.bind(this));\n\t\tif (!must_add_row) {return;}\n\t\tthis.current_page_array.push(row_data_obj);\n\n\t\tgetComponentElementById(this,\"DataList\").append(this.getRowHtml(row_data_obj));\n\t}", "addUserToGroup(new_user){\n var user_exists = this.userExists(new_user);\n var current_no_users = this.groupUsers.length;\n var MaxNoOfUsers = this.getNoOfUsersFrmStrategy();\n\n if(user_exists || (current_no_users >= MaxNoOfUsers))\n return false;//later will throw relevant error like Error User Exists or Error(maximum num of users reached)\n\n this.groupUsers.add(new_user);\n\n if(MaxNoOfUsers == this.groupUsers.length) {\n this.status = GROUP_STATUS.ACTIVE; //is the group able to expand or work at an absolute minimum\n //TODO: notify users that everthing is ready for them to start\n //TODO: move to the next stage\n }\n return true; //TODO: is it ok to return groupUsers or return status of the group\n }", "function addObject(objectData) {\n var currentTitle = objectData.objectName;\n var currentArtist = objectData.artistDisplayName;\n var currentDate = objectData.objectBeginDate;\n var imgUrl = objectData.objectUrl;\n var index = myArray.length;\n \n // myArray[index] = {};\n // myArray[index][\"title\"] = currentTitle;\n // myArray[index][\"artist\"] = currentArtist;\n // myArray[index][\"date\"] = currentDate;\n // myArray[index][\"url\"] = imgUrl;\n\n \n myArray.push({\n title: objectData.objectName, \n artist: objectData.artistDisplayName,\n date: objectData.objectBeginDate,\n url: objectData.objectUrl\n })\n \n console.log(\"object at index\", index, myArray[index]);\n}", "addLocal(object) {\n return new Promise((resolve, reject) => {\n chrome.storage.sync.get(this.name, (res) => {\n for (var key in object) {\n object[key] = JSON.stringify(object[key]);\n }\n if (res[this.name] != undefined) {\n res[this.name].push(object);\n chrome.storage.sync.set({ [this.name]: res[this.name] }, () => {\n resolve(true);\n });\n }\n else {\n reject(`Error finding collection ${this.name}`);\n }\n });\n });\n }", "function insert(element,after) {\n var insertPos = this.find(after);\n if (insertPos > -1) {\n this.dataStore.splice(insertPos+1,0,element);\n ++this.listSize;\n return true;\n }\n return false;\n}", "function addFriend (name, object) {\n \n // Should take a name and an object and add the name to the object's friends array then return the object\n \n if (object.friends) { // check if object has friends property\n \n object.friends.push(name);\n return object;\n \n }\n\n}", "insertLast(item) {\n //check to see if the list is empty\n if (this.head === null) {\n this.insertFirst(item);\n }\n else {\n //create a new node item\n let tempNode = this.head;\n //start at the begining of the list and move thrrough til end\n while (tempNode.next !== null) {\n tempNode = tempNode.next;\n }\n //set the node's next pointer to the new node and give it the next pointer\n //of null, indicating that it is the last item in the list\n tempNode.next = new _Node(item, null)\n }\n }", "add(element) {\n if(this.has(element)) {\n return false;\n }\n this.dictionary[element] = true;\n return true;\n }" ]
[ "0.7072153", "0.6905208", "0.6696507", "0.6610833", "0.65806806", "0.65022784", "0.64733577", "0.6449853", "0.63729787", "0.63306546", "0.63013434", "0.6221054", "0.6204332", "0.61923397", "0.6178056", "0.61680704", "0.6109896", "0.6109336", "0.60723406", "0.60541624", "0.605085", "0.598437", "0.5963471", "0.59565264", "0.5938226", "0.59253687", "0.5908625", "0.5907139", "0.58965105", "0.5891697", "0.5869221", "0.5811195", "0.58094513", "0.5792833", "0.57861245", "0.5780244", "0.5762947", "0.5743195", "0.5729849", "0.5728646", "0.5718539", "0.57111394", "0.5697737", "0.5693281", "0.5683806", "0.56806445", "0.56631875", "0.56611145", "0.56584406", "0.5642233", "0.56283754", "0.56271636", "0.5615849", "0.5607794", "0.55972815", "0.55961084", "0.5595308", "0.5578666", "0.5571128", "0.5567994", "0.5563527", "0.55594707", "0.5551539", "0.55337524", "0.5516827", "0.5509153", "0.54964626", "0.5488135", "0.54841316", "0.54839486", "0.5481077", "0.54687554", "0.54636055", "0.54624456", "0.5459277", "0.54526776", "0.5448085", "0.54395", "0.5438547", "0.54361725", "0.54308915", "0.5421691", "0.54148895", "0.5407815", "0.5400395", "0.53977937", "0.5388609", "0.5385186", "0.53830904", "0.5382814", "0.53720874", "0.536527", "0.53647465", "0.5363355", "0.53598845", "0.5357585", "0.5356133", "0.5337454", "0.5336581", "0.5334542" ]
0.70558774
1
Adds an object to the front of the list Returns true if the object is added successfully
addFirst(object) { let newLink = new Link(object); if(this.isEmpty()) this.tail = newLink; else this.head.prev = newLink; newLink.next = this.head; this.head = newLink; this.length++; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addObjectInList(list, object) {\n if (object) {\n list.push(object);\n }\n }", "add(element) {\n if (!this.has(element)) {\n this.collection.push(element)\n return true\n }\n return false\n }", "add(object) {\n let newLink = new Link(object);\n if(this.isEmpty()) \n this.head = newLink;\n else {\n this.tail.next = newLink;\n newLink.prev = this.tail;\n }\n this.tail = newLink;\n this.length++;\n return true;\n }", "add(obj) {\n const d = this._dummy;\n const n = new Node(obj, d, d.prev);\n\n d.prev.next = n;\n d.prev = n;\n ++this._size;\n\n return true;\n }", "addAtIndex(index, object) {\n let newLink = new Link(object);\n if(this.isEmpty()) {\n this.head = newLink;\n this.tail = newLink;\n this.length++;\n return true;\n }\n let current = this.head;\n let i = i;\n while(i < index && current != null) {\n current = current.next;\n i++;\n if(!current)\n return false;\n }\n newLink.next = current;\n current.prev.next = newLink;\n newLink.prev = current.prev;\n current.prev = newLink;\n this.length++;\n return true;\n }", "add(value) {\n if (!this.has(value)) {\n this.collection.push(value);\n return true;\n }\n return false;\n }", "push(value) {\n \n if(!value) {\n console.log(\"invalid value:\"+value)\n return false\n }\n \n this.array.unshift(value)\n return true\n }", "function addItem(list, item) {\n\n let tempItem = list.find(itemIn => {\n\n return getValue(itemIn) === getValue(item);\n });\n\n if(!tempItem) {\n list.push(item);\n return true;\n } else {\n return false;\n }\n}", "function appendItem(obj) {\n todo_list.insertBefore(getTodoItem(obj), todo_list.firstChild);\n }", "addObject(obj){\n this.objects.push(obj);\n }", "test(item) {\n const list = this._list\n let i = this._len\n\n if (list[i] === item) {\n list.pop()\n return true\n }\n\n while (i !== 0) {\n i--\n if (item === list[i]) {\n list.splice(i, 1)\n return true\n }\n }\n\n list.push(item)\n this._len++\n return false\n }", "addTrack(track) {\n let playlistTracks = this.state.playlistTracks;\n if (playlistTracks.find(savedTrack => savedTrack.id === track.id)) {\n return;\n }\n playlistTracks.unshift(track);\n this.setState({ playlistTracks: playlistTracks });\n }", "push(element){\n this.list.add(element);\n this.top = this.list.peekLast();\n }", "add(value){\n if (!this.has(value)){\n this.items[value] = value;\n // also return true when successful\n return true;\n }\n // otherwise return false if set already contains the value...\n return false;\n }", "insert(index, element) {\n if (index < 0 || index > this.count) return false;\n if (index === this.count) return !!this.push(element);\n if (index === 0) return !!this.unshift(element);\n\n const node = new Node(element);\n let prevNode = this.get(index - 1);\n let nextNode = prevNode.next;\n\n prevNode.next = node, node.prev = prevNode;\n node.next = nextNode, nextNode.prev = node;\n\n this.count++;\n\n return true;\n }", "add(item){\n if(!this.group.includes(item)){\n this.group.unshift(item);\n }\n }", "addLast(object) {\n let newLink = new Link(object);\n if(this.isEmpty()) \n this.head = newLink;\n else {\n this.tail.next = newLink;\n newLink.prev = this.tail;\n }\n this.tail = newLink;\n this.length++;\n return true;\n }", "addFront(val) {\n this.size++;\n this.items.unshift(val);\n this.peekFront();\n }", "placeObject(object) {\n this.objects.add(object)\n }", "add(value) { \n if (!this.has(value))\n this.collection.push(value); \n }", "bringChildToFront(child) {\n for (let i = 0; i < this.children.length; i++) {\n if (this.children[i] == child) {\n this.children.splice(i, 1);\n this.addChild(child);\n return true\n }\n }\n return false\n }", "insert(index, value) {\n if (index < 0 || index > this.length) {\n return false;\n }\n if (index === this.length) {\n return !!this.push(value);\n }\n else if (index === 0) {\n return !!this.unshift(value);\n } else {\n let prev = this.get(index - 1);\n let newNode = new Node(value);\n newNode.next = prev.next;\n prev.next = newNode;\n }\n this.length++;\n return true;\n }", "insert(index, val) {\n // if the index is not in the list\n if (index < 0 || index > this.length) return false;\n // if the index is at the beginning add it to the front\n if (index === 0) return !!this.unshift(val);\n // if the index is at the end add it to the end\n if (index === this.length) return !!this.push(val);\n\n // create the newNode\n const newNode = new Node(val);\n // find the node before the given index\n const prevNode = this.get(index - 1);\n // set the next index on the newNode to the next node on the prevNode\n newNode.next = prevNode.next;\n // set the prev node on the newNode to the prevNode\n newNode.prev = prevNode;\n // set the next node on the prevNode to the newNode\n prevNode.next = newNode;\n // increase the length\n this.length++;\n return true;\n }", "addToFront(value) {\n var new_node = new ListNode(value);\n\n // if nothing is in the list\n if (this.head == null && this.tail == null) {\n this.head = new_node;\n this.tail = new_node;\n }\n\n else {\n new_node.next = this.head;\n this.head = new_node;\n }\n }", "insert(position, element){\n if (position >= 0 && position < this.length){\n var node = new Node(element);\n var current = this.head;\n var previous;\n var counter = 0;\n // if adding element at the beginning of the list...\n if (position === 0){\n // push back the 1st element...\n node.next = current;\n // point head to inserted node\n this.head = node;\n } else {\n // loop thru til we reach the desired position...\n while (counter++ < position){\n previous = current;\n current = current.next;\n }\n // when finally bust out of the loop, CURRENT is referencing element after the position we would like to insert... (want to add new item b/w prev and current)\n // point previous.next to node && point node.next to current\n // make a link b/w the new item and current\n node.next = current;\n // change link b/w previous and current\n previous.next = node;\n }\n this.length++;\n return true;\n } else {\n return false;\n }\n }", "addOneIfEmpty() {\n if (this.childrenCount === 0) {\n this.addOne()\n this.initRemove()\n }\n }", "function add(obj){\n let allData = getAll();\n\n if (_.isObject(obj) && !_.isEmpty(obj)){\n allData.push(obj);\n saveData(allData);\n } else {\n console.error(`Add: ${obj} is not a valid object`);\n }\n \n }", "pushFront(value) {\n if (this.size == 0) {\n this.front = new LinkedListNode(value);\n this.back = this.front;\n } else {\n const nextToFront = this.front;\n this.front = new LinkedListNode(value);\n this.front.next = nextToFront;\n }\n this.size++;\n }", "insert(index, value) {\n //if index is less than zero or greater than the length of the list, return false\n if (index < 0 || index > this.length) return false;\n //if the index is the same as the length of the list, use push method to add a new node to the end of the list\n // double bang (double negation)\n if (index === this.length) return !!this.push(value);\n //if the index is 0, use the unshift method to add a new node to the beginning of the list\n if (index === 0) return !!this.unshift(value);\n //otherwise, using the get method, access the node at (index - 1) meaning we are getting the index\n //at the position left of where we are adding the new node\n const previousNode = this.get(index - 1);\n //instanstiate a new Node\n const newNode = new Node(value);\n //set that new Node's next property to the old node that previousNode was pointing to\n //(can also create intermediate variable that holds the value of previousNode.next and set newNode.next to it)\n newNode.next = previousNode.next\n //then set previousNode's next property to the new Node\n previousNode.next = newNode;\n //increment the length of the list\n this.length++\n //return true\n return true;\n }", "onAddItem () {\n const newItem = this.get('bunsenModel').items.type === 'object' ? {} : ''\n const items = this.get('items')\n const index = items.length\n\n items.pushObject(newItem)\n this.notifyParentOfNewItem(newItem, index)\n }", "insert(index, value) {\n\t\tif (index < 0 || index > this.length) return false;\n\t\tif (index === this.length) {\n\t\t\tthis.push(value);\n\t\t\treturn true;\n\t\t}\n\t\tif (index === 0) {\n\t\t\tthis.unshift(value);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst newNode = new Node(value);\n\t\tconst prev = this.get(index - 1);\n\t\tconst curr = this.get(index);\n\t\tnewNode.next = curr;\n\t\tprev.next = newNode;\n\t\tthis.length++;\n\t\treturn true;\n\t}", "function suggest(list, item, insertAtHead) {\n if (list.indexOf(item) === -1) {\n if (insertAtHead) {\n list.unshift(item);\n }\n else {\n list.push(item);\n }\n return true;\n }\n return false;\n }", "add(item) {\n\t\t// limit items added to queue\n\t\tif (this.items.length === this.itemLimit) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.items.push(item);\n\t}", "insert(index, value) { // adding a node by a certain position\n if (index < 0 || index > this.length) return false\n if (index === 0) this.unshift(value)\n if (index === this.length) this.push(value)\n\n let node = new Node(value)\n let prevNode = this.get(index - 1)\n let nextNode = prevNode.next\n\n prevNode.next = node\n node.prev = prevNode\n node.next = nextNode\n nextNode.prev = node\n\n this.length++\n return true\n }", "addFriend(newFriend){\n var i;\n for (i = 0; i < this._friends.length; i++) {\n if (this._friends[i] === newFriend){\n console.log(newFriend + \" is already in list\");\n return;\n }\n }\n this._friends.push(newFriend);\n }", "add(value) {\n if (this.isEmpty()) {\n this.first = new Node(value);\n this.size++;\n return true;\n }\n let currntNode = this.first;\n while (currntNode.next) {\n currntNode = currntNode.next;\n }\n currntNode.next = new Node(value);\n this.size++;\n return true;\n }", "function addItem(item) {\n basket.push(item);\n return true;\n}", "addToFront(value) {\r\n // This one is pretty simple! The case for an empty list vs\r\n // a non-empty list is exactly the same!\r\n \r\n // Create the new node\r\n let newNode = new SLNode(value);\r\n // Then set the new node's .next to the current head.\r\n // IF THE LIST IS EMPTY! newNode.next will be null. Which is what it should be\r\n // anyway if there's nothing after it.\r\n // IF THE LIST IS NOT EMPTY! newNode.next will be the current head of the list,\r\n // which is exactly what we want!\r\n newNode.next = this.head;\r\n\r\n // Now, we just set the head of the list to be our new node and call it a day!\r\n this.head = newNode;\r\n return this;\r\n\r\n\r\n }", "insert(index, val) {\n\n //if index is less than zero or greater than the length return false;\n if (index < 0 || index > this.length) return false;\n //if index is equal to the length of the list call push(val)\n if (index === this.length) {\n this.push(val);\n return true;\n }\n //if index is equal to zero call unshift(val)\n else if (index === 0) {\n this.unshift(val);\n return true;\n }\n else {\n //creating new node with the value\n let node = new Node(val);\n let pre = this.get(index - 1); // getting previous elemnt \n node.next = pre.next;// setting new node next property to the previous element next property\n pre.next = node; //setting previous element next property to new node\n this.length++; //incrementing the length by 1\n return true;\n }\n\n }", "insertFirst(item) {\n this.head = new _Node(item, this.head)\n }", "insertFirst(item) {\n this.head = new _Node(item, this.head)\n }", "add(object) {\n return this.addWithID(object, Juggler.getNextID())\n }", "addTrack(track) {\n let tracks = this.state.playlistTracks;\n if(tracks.find( savedTrack => \n savedTrack.id === track.id)) {\n return;\n } \n\n tracks.push(track);\n this.setState({ playlistTracks: tracks });\n }", "addItem(item) {\r\n this.list.push(item);\r\n }", "push(value) {\n if (!this.head) {\n this.head = new Node(value);\n this.head.forward = this.head;\n this.head.back = this.head;\n } else if (this.head.back.value < value) {\n let temp = this.head.back;\n\n temp.forward = new Node(value);\n temp.forward.back = temp;\n temp.forward.forward = this.head;\n\n this.head.back = temp.forward;\n } else {\n return false;\n }\n\n this.size++;\n return true;\n }", "function check_add_last(list) {\n if(list.children('.list__add').is(\":last-child\")) {\n return;\n } else {\n list.children().last().insertBefore(list.children('.list__add'));\n }\n}", "insert(index, value) {\n if (index < 0 || index > this.length) return false;\n if (index == this.length) return !!this.push(value);\n if (index == 0) return !!this.unshift(value);\n let newNode = new Node(value);\n let prevNode = this.get(index - 1);\n newNode.next = prevNode.next;\n prevNode.next = newNode;\n this.length++;\n return true;\n }", "add(element){\n this.addLast(element);\n }", "add(slug) {\n\n console.log(\"favoritesList add\");\n // First see if recipe is already present\n let item = this.getItem(slug)\n\n if (item) {\n // Recipe is in favoritesList already; don't do anything\n\n } else {\n // Recipe not in favoritesList, add as new item\n this.items.push({\n slug: slug\n });\n }\n\n this.update();\n }", "function pushIfNotPresent(item, list) {\n for (var j = 0; j < list.length; j++) {\n if (item === list[j]) {\n return;\n }\n }\n list.push(item);\n}", "addFront(item) {\n if (this.isFull()) {\n console.log(\"Queue overflow\");\n return;\n }\n if (this.front == -1) {\n this.front = 0;\n this.rear = 0;\n }\n else if (this.front == 0) {\n this.front = this.arr.length - 1;\n }\n else {\n this.front--;\n }\n this.arr[this.front] = item;\n }", "function add() {\n if (desc) {\n let newObjects = [...props.objects];\n newObjects.push({ description: desc, checked: false, date: date });\n props.setObjects(newObjects);\n setDesc(\"\");\n }\n }", "insertFirst(item) {\n this.head = new _Node(item, this.head);\n }", "insert(element, position) {\n // check for out-of-bounds values\n if(index >= 0 && index <= this.count) { \n const node = new Node(element);\n // change the head reference to node and add a new element to the list\n if(index === 0) { \n node.next = current; \n this.head = node;\n // to loop through the list until the desired position\n } else {\n const previous = this.getElementAt(index - 1);\n node.next = previous.next; // to link the new node and the current\n previous.next = node; \n }\n this.count++;\n return true;\n }\n return false;\n }", "add(record) {\n this.data.unshift(record);\n }", "addToFront(node) {\n node.next = this.head; // set the new node's next to the head\n this.head = node; // move the head to the new node\n }", "addToFront(data) {\n if(this._head === null) {\n this._head = new Node(data, null);\n } else {\n let oldHead = this._head;\n\n this._head = new Node(data, oldHead);\n }\n\n this.size++;\n }", "insertAt(element, index){\n // fail safe to prevent adding element where\n // specified index is greater than size of list\n if (index > 0 && index > this.size){\n return false;\n } \n else {\n // creates a new node\n var node = new Node(element)\n var curr, prev;\n\n //whatever list head is at this moment\n curr = this.head;\n\n // add the element to the first index\n if (index == 0){\n\n //create pointer to next node which is null\n node.next = null;\n\n //head of node is specified element\n this.head = node;\n\n } else {\n \n curr = this.head;\n var iterate = 0;\n\n // iterate over list to find\n // the position to insert\n\n while (iterate < index){\n iterate++;\n prev = curr;\n curr = curr.next;\n }\n // adding an element\n node.next = curr;\n prev.next = node;\n }\n this.size++;\n }\n }", "addEvent(event) {\n let newEvent = event;\n let isExists = this.eventList.forEach((event) => {\n return newEvent.id == event.id;\n });\n\n if (!isExists) {\n this.eventList.push(newEvent);\n this.renderEvents();\n return true;\n\n }\n return false;\n }", "insert(index, value) {\n if (index < 0 || index > this.length) return false;\n if (index === this.length) return !!this.push(value);\n if (index === 0) return !!this.unshift(value);\n let newNode = new Node(value);\n let prev = this.get(index - 1);\n const temp = prev.next;\n prev.next = newNode;\n newNode.next = temp;\n this.length++;\n return true;\n }", "addItem(value){\n this.first.addValue(value); // ? addValue is method called from stack\n }", "add(data) {\n // check if data was already in the array\n if (this.dataStore.indexOf(data) < 0) {\n this.dataStore.push(data);\n return true;\n } else {\n return false;\n }\n }", "insert(index, val){\n if(index < 0 || index > this.length){\n return false;\n }\n if(index === this.length){\n // !! convert it to boolean\n return !!this.push(val);\n }\n if(index === 0){\n return !!this.unshift(val);\n }\n \n let newNode = new Node(val);\n let foundNode = this.getByIndex(index - 1);\n let temp = foundNode.next;\n foundNode.next = newNode;\n newNode.next = temp;\n this.length++;\n return true;\n }", "insertFirst(item) {\n //create a new node item, point the head to that node \n this.head = new _Node(item, this.head);\n }", "function addToMylist() { return changeMylistState('add',this); }", "function addCardToList(card) {\n listOfCards.length === 0 ? ($(\".open\").addClass(\"noDuplicate\"), listOfCards.push(card)) : listOfCards.push(card);\n}", "addPointer (pointer) {\n \n if ((this.pointers.length > 0) && (this.isMember(pointer.id) || (!this.isInProximity(pointer))))\n return false;\n \n// this.pointers.push(new Pointer(pointer.e, pointer.lastPos, pointer.currentTime, pointer.lastTime));\n this.pointers.push(pointer);\n return true;\n }", "function addItem (item) {\n if (listPeople.length == 0) getPeopleList()\n\n // busco si ya existe para no agregarlo nuevamente\n for (var i = 0; i < listPeople.length; i++) {\n if (item.name === listPeople[i].name) {\n return\n }\n }\n\n listPeople.push(item)\n\n setPeopleList()\n}", "function moveToCompletedList(newItem){\n completedList.prepend(newItem);\n}", "addToFront(value){\n var new_node = new ListNode(value);\n\n if (this.head == null) {\n this.head = new_node;\n this.tail = new_node;\n }\n\n else {\n new_node.next = this.head;\n this.head = new_node;\n }\n }", "insertFront(data) {\n const newNode = new Node(data)\n\n // Case 1: empty list\n if (this.size === 0) {\n this.head = newNode\n this.tail - newNode\n } \n \n // Case 2: non-empty list\n else {\n newNode.next = head\n head.prev = newNode\n head = newNode\n }\n }", "function addObject(toAdd) {\n objects.push(toAdd);\n toAdd.calcCorners();\n for(let line of toAdd.hitboxLines) sceneHitboxLines.push(line);\n for(let line of toAdd.visibleLines) sceneVisibleLines.push(line);\n}", "function addNewItem() {\n //Adds a new item to the array then updates the list\n let newItem = document.getElementById(\"new-item-input\").value;\n let exitFuncton = false;\n //Stops adding more than one of the same item, not sure if there's a simplar method but it works!\n shoppingList.forEach((item) => {\n if (item.ingredients === newItem) {\n exitFuncton = true;\n return;\n }\n });\n if (exitFuncton) {\n return;\n }\n let newListObject = { ingredients: newItem, acquired: false };\n shoppingList.push(newListObject);\n addListItem(newListObject);\n}", "add(element)\n {\n if (!this.has(element))\n this.elements.push(element);\n }", "function addSongToPlayList(obj){\r\n PlayList.push(obj);\r\n ShowSongs(obj);\r\n}", "prepend(item) {\n }", "function appendBefore(list, item) {\n remove(item);\n item._idlePrev = list._idlePrev;\n list._idlePrev._idleNext = item;\n item._idleNext = list;\n list._idlePrev = item;\n }", "unshift(val) {\n\n // create a new node.\n let newNode = new Node(val);\n\n // if list is empty. \n if (this.length === 0) {\n this.head = newNode;\n this.tail = newNode; \n } else {\n newNode.next = this.head;\n this.head = newNode; \n }\n\n ++this.length;\n }", "addAt(index) {\n var node = new Node(element);\n var currentNode = this.head;\n var previousNode;\n var currentIndex = 0;\n\n if(index > this.length){\n return false;\n }\n\n if(index === 0){\n node.next = currentNode;\n this.head = node;\n } else {\n while(currentIndex < index){\n currentIndex++;\n previousNode = currentNode;\n currentNode = currentNode.next;\n }\n node.next = currentNode;\n previousNode.next = node;\n }\n this.length++;\n }", "insert(index_num, value){\n if(index_num<0 || index_num>this.length){\n console.log(\"INSERT - false\");\n return false;\n }\n if(index_num===0){\n this.unshift(value);\n console.log(\"INSERT using UNSHIFT - true\");\n return true;\n } \n if(index_num===this.length){\n this.push(value);\n console.log(\"INSERT using PUSH - true\");\n return true;\n } \n let newNode = new Node(value);\n let before_position = this.get(index_num-1); // 1. we neet to find item at the position one before!!\n let needed_position = before_position.next;\n before_position.next = newNode;\n newNode.next = needed_position;\n this.length +=1;\n console.log(\"INSERT - true\");\n return true;\n }", "insert(index, val) {\n if (index < 0 || index > this.length) return false\n if (index === this.length) return this.push(val)\n if (index === 0) return this.unshift(val);\n\n let node = new Node(val)\n let beforeNode = this.get(index - 1);\n node.next = beforeNode.next;\n beforeNode.next = node\n this.length++\n return true\n }", "addToFront(node) {}", "insert(index, val) {\n if(index < 0 || index > this.length) return false;\n if (index === this.length) return !!this.push(val); //returns true\n if(index === 0) return !!this.unshift(val); //returns true\n \n var newNode = new Node(val);\n var prev = this.get(index - 1);\n var temp = prev.next; //temp is used to store prev.next because if \n //we dont and change prev.next, \n //the value will be deleted\n prev.next = newNode;\n newNode.next = temp;\n this.length++;\n return true;\n\n }", "enqueue(item) {\n queue.unshift(item);\n }", "enqueue(item) {\n queue.unshift(item);\n }", "insert(index, val) {\n // check if the index less than zero ang greater than the length.\n if(index < 0 || index > this.length) {\n return false;\n }\n // if the index is the same as length use push.\n if(index === this.length){\n this.push(val);\n return true;\n }\n // if the index is zero use unshift. \n if(index === 0) {\n this.unshift(val);\n return true;\n }\n // get the node at the target position\n let targetNode = this.get(index);\n // find the node before the target index.\n let beforeTargetNode = this.get(index - 1);\n // Create new Node with val. \n let newNode = new Node(val);\n // set the next prop on the node be the new node. \n newNode.next = targetNode;\n // set the before target node next prop to the new Node. \n beforeTargetNode.next = newNode;\n // increment the length\n this.length++;\n\n // return true.\n return true;\n }", "addFront(data){\n let n = new Node(data);\n if (!this.head){\n this.head = n;\n } else {\n n.next = this.head;\n this.head = n;\n }\n return this;\n }", "insert(index, val) {\n if (index > this.length || index < 0) {\n return false;\n }\n\n if (index === this.length) {\n return this.push(val);\n }\n\n if (index === 0) {\n return this.unshift(val);\n }\n\n const newNode = new Node(val);\n const prev = this.get(index - 1);\n const temp = prev.next;\n prev.next = newNode;\n newNode.next = temp;\n return true;\n }", "prepend(value) {\n // if list is empty\n if (!this.head) {\n this.head = new Node(value);\n }\n let oldHead = this.head;\n this.head = new Node(value);\n this.head.next = oldHead;\n }", "function addToFront(arr, element) {\n\t// your code here\n\t// return arr unshift the element\n\tarr.unshift(element);\n\treturn arr;\n}", "function prepend(value) {\n if (find(value)) return null\n\n const node = createNode(value, null, list.tail)\n\n if (list.tail) {\n list.tail.prev = node\n } else {\n list.head = node\n }\n\n list.tail = node\n }", "addChild(graphicObj) {\n if (graphicObj.group) {\n console.error(\"Can't add an object to more than one group\");\n return false;\n }\n graphicObj.group = null; //top level's group will be null\n if (this.children.length > 0) {\n console.error(\"Top level can only have one object\")\n return false;\n }\n this.children.push(graphicObj);\n graphicObj.draw(this.ctx);\n return true;\n }", "add(value){\n if(!this.has(value)){\n this.members.push(value);\n }\n }", "async addChild(graphicObj) {\n if (graphicObj.group) {\n console.error(\"Can't add an object to more than one group\");\n return false;\n }\n graphicObj.group = null; //top level's group will be null\n if (this.children.length > 0) {\n console.error(\"Top level can only have one object\")\n return false;\n }\n this.children.push(graphicObj);\n await graphicObj.draw(this.ctx);\n return true;\n }", "insert(index, val) {\n if (index < 0 || index > this.length) return false;\n\n if (index === 0) this.unshift(val);\n else if (index === this.length) this.push(val);\n else {\n let beforeNode = this.get(index - 1);\n let newNode = new Node(val);\n let afterNode = beforeNode.next;\n\n beforeNode.next = newNode;\n newNode.previous = beforeNode;\n newNode.next = afterNode;\n afterNode.previous = newNode;\n this.length++;\n }\n\n return true;\n }", "function addItem(item){\n if (isFull() === true){\n console.log(`${item} cannot be added, basket is full. Returning false.`);\n return false\n } else {\n basket.push(item);\n console.log(`${item} successfully added to basket. Returning true`)\n return true;\n }\n}", "insert(index, val) {\n if (index < 0 || index > this.length) return false\n if (index === this.length) return !!this.push(val)\n if (index === 0) return !!this.unshift(val)\n\n let newNode = new Node(val)\n let prevNode = this.get(index - 1)\n let nextNode = prevNode.next\n prevNode.next = newNode\n newNode.prev = prevNode\n newNode.next = nextNode\n nextNode.prev = newNode\n this.length++\n return true\n }", "prependTo(gameObject)\n {\n this.parent = gameObject;\n this.parent.gameObjects.unshift(this);\n return this;\n }", "addTrack(track)\n {if (this.state.playlistTracks.find(savedTrack =>\n savedTrack.id === track.id)) {return;}\n else { this.state.playlistTracks.push(track) };\n let playlistTracks = this.state.playlistTracks;\n this.setState({playlistTracks:playlistTracks});\n}", "addToFront(value) {\n // The edge case was a trick! Whether or not the list is empty doesn't impact\n // anything for this one!\n\n\n let newNode = new SLNode(value); // Let's first create our new node\n newNode.next = this.head; // then set its .next to the head of the SLL\n this.head = newNode; // and then set the head to our new node\n return this; // and finally, return this\n\n }" ]
[ "0.6551418", "0.6483231", "0.6383406", "0.63541275", "0.6135264", "0.6091673", "0.6063098", "0.60403967", "0.60127825", "0.5966089", "0.59324896", "0.592034", "0.5907519", "0.59066945", "0.5905003", "0.58957547", "0.58876604", "0.5881739", "0.5881193", "0.5865925", "0.5844874", "0.58316195", "0.58276325", "0.58122873", "0.58062506", "0.58060753", "0.58030957", "0.57908756", "0.578377", "0.57717043", "0.57714254", "0.5762922", "0.57530266", "0.5748234", "0.57289124", "0.57214737", "0.5706702", "0.5705958", "0.57048076", "0.5682727", "0.5682727", "0.56775165", "0.56750816", "0.5674285", "0.56740725", "0.566198", "0.56552154", "0.5651946", "0.5648933", "0.5645862", "0.56412363", "0.5639996", "0.5639723", "0.5636488", "0.5633869", "0.56297314", "0.56211394", "0.5616212", "0.5614073", "0.5614013", "0.56036806", "0.5595289", "0.55942994", "0.55909675", "0.5589843", "0.5584201", "0.55829877", "0.5575538", "0.5565591", "0.5563567", "0.55617946", "0.5560608", "0.55534697", "0.5543473", "0.5543311", "0.55413336", "0.55302256", "0.5527761", "0.5526115", "0.55234", "0.55229044", "0.55199", "0.55169785", "0.551573", "0.551573", "0.5511206", "0.5510691", "0.55101377", "0.55070883", "0.55019796", "0.5498008", "0.54854167", "0.548308", "0.5481446", "0.54721713", "0.5467525", "0.546702", "0.54602015", "0.5457062", "0.54556924" ]
0.68832463
0
Adds an object to the end of the list Returns true if the object is added successfully
addLast(object) { let newLink = new Link(object); if(this.isEmpty()) this.head = newLink; else { this.tail.next = newLink; newLink.prev = this.tail; } this.tail = newLink; this.length++; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "add(object) {\n let newLink = new Link(object);\n if(this.isEmpty()) \n this.head = newLink;\n else {\n this.tail.next = newLink;\n newLink.prev = this.tail;\n }\n this.tail = newLink;\n this.length++;\n return true;\n }", "add(element) {\n if (!this.has(element)) {\n this.collection.push(element)\n return true\n }\n return false\n }", "add(obj) {\n const d = this._dummy;\n const n = new Node(obj, d, d.prev);\n\n d.prev.next = n;\n d.prev = n;\n ++this._size;\n\n return true;\n }", "function addObjectInList(list, object) {\n if (object) {\n list.push(object);\n }\n }", "addAtIndex(index, object) {\n let newLink = new Link(object);\n if(this.isEmpty()) {\n this.head = newLink;\n this.tail = newLink;\n this.length++;\n return true;\n }\n let current = this.head;\n let i = i;\n while(i < index && current != null) {\n current = current.next;\n i++;\n if(!current)\n return false;\n }\n newLink.next = current;\n current.prev.next = newLink;\n newLink.prev = current.prev;\n current.prev = newLink;\n this.length++;\n return true;\n }", "add(item) {\n\t\t// limit items added to queue\n\t\tif (this.items.length === this.itemLimit) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.items.push(item);\n\t}", "add(value) {\n if (!this.has(value)) {\n this.collection.push(value);\n return true;\n }\n return false;\n }", "function add(obj){\n let allData = getAll();\n\n if (_.isObject(obj) && !_.isEmpty(obj)){\n allData.push(obj);\n saveData(allData);\n } else {\n console.error(`Add: ${obj} is not a valid object`);\n }\n \n }", "addFirst(object) {\n let newLink = new Link(object);\n if(this.isEmpty())\n this.tail = newLink;\n else\n this.head.prev = newLink;\n newLink.next = this.head;\n this.head = newLink;\n this.length++;\n return true;\n }", "add(element){\n this.addLast(element);\n }", "add(object) {\n return this.addWithID(object, Juggler.getNextID())\n }", "add(value){\n if (!this.has(value)){\n this.items[value] = value;\n // also return true when successful\n return true;\n }\n // otherwise return false if set already contains the value...\n return false;\n }", "addObject(obj){\n this.objects.push(obj);\n }", "function addItem(item){\n if (isFull() === true){\n console.log(`${item} cannot be added, basket is full. Returning false.`);\n return false\n } else {\n basket.push(item);\n console.log(`${item} successfully added to basket. Returning true`)\n return true;\n }\n}", "onAddItem () {\n const newItem = this.get('bunsenModel').items.type === 'object' ? {} : ''\n const items = this.get('items')\n const index = items.length\n\n items.pushObject(newItem)\n this.notifyParentOfNewItem(newItem, index)\n }", "function addItem(item) {\n if (isFull(basket) === true) {\n console.log(`Basket is currently full. Could not add ${item}`);\n return false;\n } else {\n basket.push(item);\n return true;\n }\n}", "test(item) {\n const list = this._list\n let i = this._len\n\n if (list[i] === item) {\n list.pop()\n return true\n }\n\n while (i !== 0) {\n i--\n if (item === list[i]) {\n list.splice(i, 1)\n return true\n }\n }\n\n list.push(item)\n this._len++\n return false\n }", "function addItem(item) {\n basket.push(item);\n return true;\n}", "addFriend(newFriend){\n var i;\n for (i = 0; i < this._friends.length; i++) {\n if (this._friends[i] === newFriend){\n console.log(newFriend + \" is already in list\");\n return;\n }\n }\n this._friends.push(newFriend);\n }", "add(data) {\n // check if data was already in the array\n if (this.dataStore.indexOf(data) < 0) {\n this.dataStore.push(data);\n return true;\n } else {\n return false;\n }\n }", "append() {\n errors.throwNotImplemented(\"appending element to collection\");\n }", "function addItem(list, item) {\n\n let tempItem = list.find(itemIn => {\n\n return getValue(itemIn) === getValue(item);\n });\n\n if(!tempItem) {\n list.push(item);\n return true;\n } else {\n return false;\n }\n}", "async addChild(graphicObj) {\n if (graphicObj.group) {\n console.error(\"Can't add an object to more than one group\");\n return false;\n }\n graphicObj.group = null; //top level's group will be null\n if (this.children.length > 0) {\n console.error(\"Top level can only have one object\")\n return false;\n }\n this.children.push(graphicObj);\n await graphicObj.draw(this.ctx);\n return true;\n }", "add(value) { \n if (!this.has(value))\n this.collection.push(value); \n }", "addItem(userItem) {\n for(var i=0; i<this._userItemList.length; i++){\n // if not check the list for a new userItem and add it to the userItemList\n if(this.userItemList[i]._item._itemCode === userItem._item._itemCode){\n console.log('ERROR: Duplicate Save');\n } else {\n var newUserItem = new UserItem(\n userItem._item,\n userItem._category,\n userItem._rating,\n userItem._madeIt\n );\n // Add item to the userItems\n this._userItemList.push(newUserItem);\n console.log('UPDATE: Item Added')\n }\n return this._userItemList;\n }\n\n }", "function check_add_last(list) {\n if(list.children('.list__add').is(\":last-child\")) {\n return;\n } else {\n list.children().last().insertBefore(list.children('.list__add'));\n }\n}", "canAdd() {\n return this.addable().length > 0;\n }", "add(data) {\n this.processed = null;\n let added = false;\n if (Array.isArray(data)) {\n for (const item of data) {\n const res = this.add_item(item);\n if (!added) {\n added = res;\n }\n }\n }\n else {\n return this.add_item(data);\n }\n return added;\n }", "addEvent(event) {\n let newEvent = event;\n let isExists = this.eventList.forEach((event) => {\n return newEvent.id == event.id;\n });\n\n if (!isExists) {\n this.eventList.push(newEvent);\n this.renderEvents();\n return true;\n\n }\n return false;\n }", "add(string, object) {\n this.array.push(object)\n this.string += string\n this.modified = true\n }", "placeObject(object) {\n this.objects.add(object)\n }", "function addItemToStore(object) {\n // Push new item object to datastore\n STORE.push(object);\n}", "function addNewItem() {\n //Adds a new item to the array then updates the list\n let newItem = document.getElementById(\"new-item-input\").value;\n let exitFuncton = false;\n //Stops adding more than one of the same item, not sure if there's a simplar method but it works!\n shoppingList.forEach((item) => {\n if (item.ingredients === newItem) {\n exitFuncton = true;\n return;\n }\n });\n if (exitFuncton) {\n return;\n }\n let newListObject = { ingredients: newItem, acquired: false };\n shoppingList.push(newListObject);\n addListItem(newListObject);\n}", "addEntity(entity) {\n if (!Util.contains(this._entities, entity) && this.matches(entity)) {\n this._entities.push(entity);\n this.notifyAll(new AddedEntity(entity));\n }\n }", "addItem(item) {\r\n this.list.push(item);\r\n }", "function addAtLast() {\r\n value = document.getElementById('element').value;\r\n if(value) {\r\n array = getArray();\r\n if (!array.length) {\r\n alert('Linked List not exists \\n create first..')\r\n }\r\n else {\r\n array.push(new Node(value, null));\r\n setArray(array);\r\n arrayStatus(true, 'Linked List: ');\r\n }\r\n }\r\n else {\r\n alert('field must be fill..');\r\n }\r\n}", "function addIfComplete(aNode) {\n if (complete[aNode.id]) {\n return true;\n }\n \n if (incomplete[aNode.id]) {\n return false;\n }\n \n var isComplete = !!allPotentialObjects[aNode.id];\n \n if (isComplete && aNode.parents) {\n $.each(aNode.parents, function (key, parentNode) {\n if (!addIfComplete(parentNode)) {\n isComplete = false;\n return false;\n }\n });\n }\n \n if (!isComplete) {\n incomplete[aNode.id] = aNode;\n return false;\n } else {\n complete[aNode.id] = aNode;\n ret.push(aNode);\n return true;\n }\n }", "addEvent(event){\n if (this.events.includes(event.id)) {\n return false;\n } else {\n this.events.push(event.id);\n return true;\n }\n }", "addPointer (pointer) {\n \n if ((this.pointers.length > 0) && (this.isMember(pointer.id) || (!this.isInProximity(pointer))))\n return false;\n \n// this.pointers.push(new Pointer(pointer.e, pointer.lastPos, pointer.currentTime, pointer.lastTime));\n this.pointers.push(pointer);\n return true;\n }", "function add(animals, animal){ //checks if the animal to be added is\n if(animal.name && animal.species){ // valid and not already in the array\n for(let i = 0; i < animals.length; i++){\n if(animals[i].name === animal.name){\n return true;\n }else if(i === animals.length - 1){ //only adds if the loop \n animals.push(animal); //makes it to the end of the array\n } \n }\n }\n}", "function add() {\n if (desc) {\n let newObjects = [...props.objects];\n newObjects.push({ description: desc, checked: false, date: date });\n props.setObjects(newObjects);\n setDesc(\"\");\n }\n }", "push(value) {\n \n if(!value) {\n console.log(\"invalid value:\"+value)\n return false\n }\n \n this.array.unshift(value)\n return true\n }", "add(type, id) {\n if (this.typesSet.has(type)) {\n const wasInStorage = this.has(type, id);\n\n this.storage[type].add(id);\n\n // Inverse, since if id was not in storage we add this id successfully\n return !wasInStorage;\n }\n return false;\n }", "add(value) {\n if (this.isEmpty()) {\n this.first = new Node(value);\n this.size++;\n return true;\n }\n let currntNode = this.first;\n while (currntNode.next) {\n currntNode = currntNode.next;\n }\n currntNode.next = new Node(value);\n this.size++;\n return true;\n }", "function appendItem(obj) {\n todo_list.insertBefore(getTodoItem(obj), todo_list.firstChild);\n }", "addUser (user) {\n if (this.players.length < this.maxPlayers) {\n if (this.players.findIndex(player => player.name === user.name) === -1) {\n this.players.push(user)\n user.join(this.name)\n user.room = this\n console.log('user ' + user.name + ' joined room ' + this.name)\n return true\n } else {\n console.log('user ' + user.name + ' tried to join room ' + this.name + ' but a player in that room already had that name')\n return false\n }\n } else {\n return false\n }\n }", "addUser(user) {\n let foundUser = false;\n for (let i = 0; i < this.chatUsersDB.length; i++) {\n if (this.chatUsersDB[i].username === user.username) {\n foundUser = true;\n break;\n }\n }\n\n if (!foundUser) {\n user.hoursInChatroom = 0;\n this.chatUsersDB.push(user);\n return true;\n }\n else {\n return false;\n }\n }", "add(element)\n {\n if (!this.has(element))\n this.elements.push(element);\n }", "addChild(graphicObj) {\n if (graphicObj.group) {\n console.error(\"Can't add an object to more than one group\");\n return false;\n }\n graphicObj.group = null; //top level's group will be null\n if (this.children.length > 0) {\n console.error(\"Top level can only have one object\")\n return false;\n }\n this.children.push(graphicObj);\n graphicObj.draw(this.ctx);\n return true;\n }", "function addObject(toAdd) {\n objects.push(toAdd);\n toAdd.calcCorners();\n for(let line of toAdd.hitboxLines) sceneHitboxLines.push(line);\n for(let line of toAdd.visibleLines) sceneVisibleLines.push(line);\n}", "addItem(itemStack){\n //Check if the given object is an ItemStack.\n if(!itemStack instanceof ItemStack){\n console.log(\"ERROR: given object is not an ItemStack.\");\n }\n\n //First try to add the items to existing item stacks.\n var stackWithSpace = this.itemStacks.find(tryStack => tryStack.itemID == itemStack.itemID && !tryStack.reachedCapacity());\n if(stackWithSpace != null){\n if(stackWithSpace.amount + itemStack.amount <= itemStack.item.stackMax){\n stackWithSpace.amount += itemStack.amount;\n return true;\n }else{\n var delta = itemStack.item.stackMax - stackWithSpace.amount;\n stackWithSpace.amount = itemStack.item.stackMax;\n itemStack.amount = delta;\n return this.addItem(itemStack);\n }\n }\n\n //Then create a new item stack.\n if(this.itemStacks.length <= this.maxStacks){\n this.itemStacks.push(itemStack);\n return true;\n }else{\n return false;\n }\n }", "add(element) {\n if (!this.has(element)) {\n this.dictionary[element] = element;\n this.length++;\n return true;\n }\n return false;\n }", "addItem(name) {\n if ( !(this.items.all.includes(name))) {\n console.log(\"Adding new item, \" + name)\n this.items.all.push(name)\n }\n }", "putAfter(item, location){\n if (item instanceof LinkItem || item instanceof LinkList){\n if (this.contains(location)){\n if (location.next == null || location == this.end){\n this.push(item)\n }else if(location.last == null || location == this.start){\n this.queue(item)\n }else{\n if (this.contains(item)){\n throw `Error calling putAfter:\\nCannot put an item contained inside this list`\n return\n }\n if (item instanceof LinkItem){\n this.length++;\n let next = location.next;\n location.link(item);\n item.link(next);\n }else{\n this.length += item.length;\n let next = location.next;\n location.link(item.start);\n item.end.link(next);\n }\n }\n }else{\n throw `Error calling putAfter:\\nThe location is not in the linked list`\n }\n }else{\n throw `Error calling putAfter:\\nThe item given is not a LinkList or LinkItem`\n }\n }", "function addItem (item) {\n if (listPeople.length == 0) getPeopleList()\n\n // busco si ya existe para no agregarlo nuevamente\n for (var i = 0; i < listPeople.length; i++) {\n if (item.name === listPeople[i].name) {\n return\n }\n }\n\n listPeople.push(item)\n\n setPeopleList()\n}", "add(element) {\n if (!this.has(element)) {\n this.dictionary[element] = true;\n this.length++;\n return true;\n }\n\n return false;\n }", "function add(pokemon) {\n // Validation of item\n if (typeof pokemon === 'object') {\n pokemonList.push(pokemon);\n } else alert('not possible');\n }", "addItem(newItem) {\n for (let index in this.items) {\n let item = this.items[index];\n if (item.id === newItem.id) {\n item.quantity += newItem.quantity;\n this.updateTotal();\n return;\n }\n }\n\n this.items.push(newItem);\n this.updateTotal();\n }", "function insert(element, after){\n var insertPos = this.find(element)\n if(insert > -1){\n this.dataStore.splice(insertPos+1, 0, element)\n ++this.listSize\n return true\n }\n return false\n}", "function addFriend (name, object) {\nobject.friends.push(name); //pushes name in the object.friends array\nreturn object; //returns the updated object\n}", "add(value){\n if(!this.has(value)){\n this.members.push(value);\n }\n }", "push(value){\n this.items.push(value);\n return this.items.length;\n }", "add(value) {\n if (!this.has(value)) {\n this.set.push(value);\n }\n }", "function addToMylist() { return changeMylistState('add',this); }", "add(collection, obj) {\n this.db.get(collection).push(obj).last().value();\n }", "addAt(index) {\n var node = new Node(element);\n var currentNode = this.head;\n var previousNode;\n var currentIndex = 0;\n\n if(index > this.length){\n return false;\n }\n\n if(index === 0){\n node.next = currentNode;\n this.head = node;\n } else {\n while(currentIndex < index){\n currentIndex++;\n previousNode = currentNode;\n currentNode = currentNode.next;\n }\n node.next = currentNode;\n previousNode.next = node;\n }\n this.length++;\n }", "addOneIfEmpty() {\n if (this.childrenCount === 0) {\n this.addOne()\n this.initRemove()\n }\n }", "function addData(obj) {\n listData.push(obj);\n renderList();\n}", "add(model) {\n if (!model) {\n return new Error(\"Collection.add method requires a model as a parameter\");\n } else if (!model.id) {\n return new Error(\"The model being added has no id\");\n } else {\n this.collection[model.id] = model;\n return true;\n }\n }", "add()\n {\n this.list.add((this.list.size) + \"\");\n }", "push(element){\n this.list.add(element);\n this.top = this.list.peekLast();\n }", "function addObject(obj) {\n obj.mapX = Math.max(0, Math.min(objectMapMaxIndex, Math.floor(obj.x / Constants.MAP_OBJ_GRID_SIZE)));\n obj.mapY = Math.max(0, Math.min(objectMapMaxIndex, Math.floor(obj.y / Constants.MAP_OBJ_GRID_SIZE)));\n objectMap[obj.mapX][obj.mapY][0]++;\n obj.mapPos = objectMap[obj.mapX][obj.mapY][0];\n objectMap[obj.mapX][obj.mapY].push(obj);\n\n// console.log(\"add obj:\" + obj.id + \" \" + obj.mapPos + \" \" + objectMap[obj.mapX][obj.mapY][obj.mapPos]);\n}", "add(slug) {\n\n console.log(\"favoritesList add\");\n // First see if recipe is already present\n let item = this.getItem(slug)\n\n if (item) {\n // Recipe is in favoritesList already; don't do anything\n\n } else {\n // Recipe not in favoritesList, add as new item\n this.items.push({\n slug: slug\n });\n }\n\n this.update();\n }", "addFriend(id, name, device, pfp){\n let possibleIDs = [{id : this.id}, ...this.friends];\n if (possibleIDs.some((elem) => (id === elem.id))) {\n return false;\n }\n\n this.friends.push(new Friend(id, name, device, pfp));\n return true;\n }", "add(element) { \n // adding element to the queue \n this.items.push(element); \n }", "function add(){\n console.log('adding...');\n var checkFlag = false;\n if (self.ustOwner.length > 0 || self.custOwner.length > 0) {\n if(self.ustOwner.length > 0)\n $rootScope.owners.ust = self.ustOwner[0].id;\n if (self.custOwner.length > 0)\n $rootScope.owners.customer = self.custOwner[0].id;\n }\n else{\n $rootScope.newUserId = self.contacts[0].id;\n if (self.selectedType == 1) {\n $rootScope.ownerType = \"ustOwner\";\n }\n else if (self.selectedType == 2) {\n $rootScope.ownerType = \"customerOwner\";\n }\n }\n \n }", "addNew(data) {\n\t\tlet db = this.db;\n\n\t\treturn new Promise((resolve, reject)=>{\n\t\t\tif (db.find({ id: data.id }).has(\"id\").value()) {\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\tdb.push(data).write();\n\t\t\t\tresolve(true);\n\t\t\t}\n\t\t});\n\t}", "add(item) {\n this.data.push(item);\n }", "function add(item) {\n data.push(item);\n console.log('Item Added...');\n }", "function insert(element, after) {\n var insertPosition = this.find(after);\n if (insertPosition > -1) {\n this.dataStore.splice(insertPosition + 1, 0, element);\n ++this.listSize;\n return true;\n }\n\n return false;\n}", "function JSBridgeObj_AddObject(id, obj) {\n var result = JSBridgeObj_AddObjectAuxiliar(id, obj);\n if (result != \"\") {\n if (this.objectJson != \"\") {\n this.objectJson += \", \";\n }\n this.objectJson += result;\n }\n}", "append(item) {\n }", "add(element)\r\n {\r\n let node = new Node(element); //creates new node\r\n let current; //to store current node\r\n //if this list is empty add the element & make it head\r\n if(this.head === null)\r\n {\r\n this.head = node;\r\n }\r\n else \r\n {\r\n current = this.head;\r\n //iterate through end of list\r\n while(current.next){\r\n current = current.next;\r\n }\r\n\r\n // add node\r\n current.next = node;\r\n }\r\n this.size++;\r\n }", "addWallToObject() {\n this.object.add(this.wall);\n }", "nextObject () {\n if (this.currentObjectIndex < this.objects.length - 1) {\n this.currentObjectIndex++\n this.objects[this.currentObjectIndex].begin()\n } else {\n this.state = TransferStates.Completed\n }\n }", "add (o) {\n if (this.isBreedSet())\n this.baseSet.add(o)\n else\n o.id = this.ID++\n this.push(o)\n return o\n }", "addItem(newItemData, listId){\n \n \n let list = _store.State.lists.find(list => list.id == listId)\n\n console.log(_store.State.lists)\n list.items.push(newItemData)\n _store.saveState()\n }", "contains(object) {\n return this.indexOf(object) !== -1;\n }", "addItem() {\n\t\tif (this.checklistItem) {\n\t\t\tthis.company.checklist.push(this.checklistItem);\n\t\t\tthis.checklistItem = null;\n\t\t}\n\t}", "function addSongToPlayList(obj){\r\n PlayList.push(obj);\r\n ShowSongs(obj);\r\n}", "function addFriend (name, object) {\n object.friends.push(name);\n return object;\n\n}", "function insert(element, after) {\n\tvar insertPos = this.find(after);\n\tif(insertPos > -1) {\n\t\tthis.dataStore.splice(insertPos + 1, 0, element);\n\t\t++this.listSize;\n\t\treturn true;\n\t}\n\treturn false;\n}", "addUserToGroup(new_user){\n var user_exists = this.userExists(new_user);\n var current_no_users = this.groupUsers.length;\n var MaxNoOfUsers = this.getNoOfUsersFrmStrategy();\n\n if(user_exists || (current_no_users >= MaxNoOfUsers))\n return false;//later will throw relevant error like Error User Exists or Error(maximum num of users reached)\n\n this.groupUsers.add(new_user);\n\n if(MaxNoOfUsers == this.groupUsers.length) {\n this.status = GROUP_STATUS.ACTIVE; //is the group able to expand or work at an absolute minimum\n //TODO: notify users that everthing is ready for them to start\n //TODO: move to the next stage\n }\n return true; //TODO: is it ok to return groupUsers or return status of the group\n }", "addRow(row_data_obj) {\n\t\tlet current_item_keys = Object.keys(this.current_page_array);\n\t\tlet must_add_row = true;\n\t\tcurrent_item_keys.forEach(function(key) {\n\t\t\tif (this.current_page_array[key][\"Id\"] === row_data_obj[\"Id\"]) {must_add_row = false;}\n\t\t}.bind(this));\n\t\tif (!must_add_row) {return;}\n\t\tthis.current_page_array.push(row_data_obj);\n\n\t\tgetComponentElementById(this,\"DataList\").append(this.getRowHtml(row_data_obj));\n\t}", "function addObject(objectData) {\n var currentTitle = objectData.objectName;\n var currentArtist = objectData.artistDisplayName;\n var currentDate = objectData.objectBeginDate;\n var imgUrl = objectData.objectUrl;\n var index = myArray.length;\n \n // myArray[index] = {};\n // myArray[index][\"title\"] = currentTitle;\n // myArray[index][\"artist\"] = currentArtist;\n // myArray[index][\"date\"] = currentDate;\n // myArray[index][\"url\"] = imgUrl;\n\n \n myArray.push({\n title: objectData.objectName, \n artist: objectData.artistDisplayName,\n date: objectData.objectBeginDate,\n url: objectData.objectUrl\n })\n \n console.log(\"object at index\", index, myArray[index]);\n}", "addLocal(object) {\n return new Promise((resolve, reject) => {\n chrome.storage.sync.get(this.name, (res) => {\n for (var key in object) {\n object[key] = JSON.stringify(object[key]);\n }\n if (res[this.name] != undefined) {\n res[this.name].push(object);\n chrome.storage.sync.set({ [this.name]: res[this.name] }, () => {\n resolve(true);\n });\n }\n else {\n reject(`Error finding collection ${this.name}`);\n }\n });\n });\n }", "function insert(element,after) {\n var insertPos = this.find(after);\n if (insertPos > -1) {\n this.dataStore.splice(insertPos+1,0,element);\n ++this.listSize;\n return true;\n }\n return false;\n}", "function addFriend (name, object) {\n \n // Should take a name and an object and add the name to the object's friends array then return the object\n \n if (object.friends) { // check if object has friends property\n \n object.friends.push(name);\n return object;\n \n }\n\n}", "insertLast(item) {\n //check to see if the list is empty\n if (this.head === null) {\n this.insertFirst(item);\n }\n else {\n //create a new node item\n let tempNode = this.head;\n //start at the begining of the list and move thrrough til end\n while (tempNode.next !== null) {\n tempNode = tempNode.next;\n }\n //set the node's next pointer to the new node and give it the next pointer\n //of null, indicating that it is the last item in the list\n tempNode.next = new _Node(item, null)\n }\n }", "add(element) {\n if(this.has(element)) {\n return false;\n }\n this.dictionary[element] = true;\n return true;\n }" ]
[ "0.7055321", "0.6906338", "0.6696683", "0.66108924", "0.6579725", "0.6502238", "0.647387", "0.6449675", "0.63728106", "0.6330283", "0.6301664", "0.62215346", "0.62051207", "0.61926144", "0.6178815", "0.6167984", "0.6110496", "0.61093026", "0.607326", "0.60541385", "0.6051252", "0.5984717", "0.5963708", "0.59573793", "0.59396374", "0.59245706", "0.59092104", "0.59074265", "0.5897971", "0.5891715", "0.58695877", "0.5810956", "0.5810111", "0.5793312", "0.57866836", "0.577969", "0.5763104", "0.5744477", "0.573014", "0.5728696", "0.5719146", "0.57112116", "0.5697788", "0.5693336", "0.5683715", "0.56811583", "0.56639117", "0.56620824", "0.5658889", "0.56420356", "0.5629151", "0.56278193", "0.5616778", "0.5606884", "0.55973244", "0.55968493", "0.55955994", "0.5579251", "0.5570808", "0.55684763", "0.5564279", "0.55593526", "0.555225", "0.5534776", "0.5516567", "0.55087113", "0.54979885", "0.5487467", "0.5484382", "0.54838556", "0.548167", "0.5468833", "0.5464513", "0.5462709", "0.54603356", "0.5453628", "0.544878", "0.5439368", "0.54381216", "0.5435647", "0.54301775", "0.54217845", "0.5415392", "0.5408258", "0.5399349", "0.5398697", "0.53889364", "0.53860044", "0.53842425", "0.5383521", "0.53724277", "0.53648275", "0.5364721", "0.5364423", "0.53593147", "0.53590035", "0.53556937", "0.53374493", "0.53360826", "0.5335549" ]
0.7070671
0