_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q64700
test
function(prop, value) { var me = this, dom = me.dom, hooks = me.styleHooks, style = dom.style, valueFrom = Ext.valueFrom, name, hook; // we don't promote the 2-arg form to object-form to avoid the overhead... if (typeof prop == 'string...
javascript
{ "resource": "" }
q64701
test
function() { //<debug warn> Ext.Logger.deprecate("Ext.dom.Element.getViewSize() is deprecated", this); //</debug> var doc = document, dom = this.dom; if (dom == doc || dom ==
javascript
{ "resource": "" }
q64702
test
function(prop) { //<debug warn> Ext.Logger.deprecate("Ext.dom.Element.isTransparent() is deprecated", this); //</debug>
javascript
{ "resource": "" }
q64703
printCounter
test
function printCounter(indicator) { counter++; process.stdout.write(indicator); if (counter === filesLength || counter % lineLength === 0) { process.stdout.write(lineSpacing.slice(-1 * ((lineLength - counter) % lineLength)) + " ");
javascript
{ "resource": "" }
q64704
encode
test
function encode(string) { function hex(code) { var hex_code = code.toString(16).toUpperCase(); if (hex_code.length < 2) { hex_code = 0 + hex_code; } return '%' + hex_code; } string = string + ''; var reserved_chars = /[ :\/?#\[\]@!$&'()*+,;=<>"{}|\\`\^%\r\n\u...
javascript
{ "resource": "" }
q64705
decode
test
function decode(string) { return string.replace(/%[a-fA-F0-9]{2}/ig, function (match) {
javascript
{ "resource": "" }
q64706
getNonce
test
function getNonce(key_length) { function rand() { return Math.floor(Math.random() * chars.length); } key_length = key_length || 64; var key_bytes = key_length / 8; var value = ''; var key_iter = key_bytes / 4; var key_remainder = key_bytes % 4; var i; var chars = ['20', '21...
javascript
{ "resource": "" }
q64707
toHeaderString
test
function toHeaderString(params, realm) { var arr = []; var i; for (i in params) { if (typeof params[i] !== 'object' && params[i] !== '' && params[i] !== undefined) { arr.push(encode(i) + '="' + encode(params[i]) + '"'); }
javascript
{ "resource": "" }
q64708
toSignatureBaseString
test
function toSignatureBaseString(method, url, header_params, query_params) { var arr = []; var i; for (i in header_params) { if (header_params[i] !== undefined && header_params[i] !== '') { arr.push([encode(i), encode(header_params[i] + '')]); } } for (i in query_params) ...
javascript
{ "resource": "" }
q64709
test
function (application_secret, token_secret, signature_base) { var passphrase; var signature; application_secret = encode(application_secret);
javascript
{ "resource": "" }
q64710
test
function(values, animated) { var me = this, slots = me.getInnerItems(), ln = slots.length, key, slot, loopSlot, i, value; if (!values) { values = {}; for (i = 0; i < ln; i++) { //set the value to false so the slot will return n...
javascript
{ "resource": "" }
q64711
test
function(useDom) { var values = {}, items = this.getItems().items, ln = items.length, item, i; if (useDom) { for (i = 0; i < ln; i++)
javascript
{ "resource": "" }
q64712
addTranslation
test
function addTranslation(translations, locale) { if (typeof translations !== 'object') { return; } // add translations with format like // { // en: {}, // fr: {}, // } if (locale === undefined) { for (var key in translations) { addTranslation(translations[key], key); } return; }...
javascript
{ "resource": "" }
q64713
test
function() { var me = this, pressedButtons = [], ln, i, item, items; //call the parent first so the items get converted into a MixedCollection me.callParent(arguments); items = this.getItems(); ln = items.length; for (i = 0; i < ln; i++) {
javascript
{ "resource": "" }
q64714
test
function(newButtons, oldButtons) { var me = this, items = me.getItems(), pressedCls = me.getPressedCls(), events = [], item, button, ln, i, e; //loop through existing items and remove the pressed cls from them ln = items.length; if (old...
javascript
{ "resource": "" }
q64715
test
function() { var me = this, record; if (me.getAutoSelect()) { var store = me.getStore(); record = (me.originalValue) ? me.originalValue : store.getAt(0); } else { var usePicker
javascript
{ "resource": "" }
q64716
RPC
test
function RPC (contact, options) { assert(this instanceof RPC, 'Invalid instance supplied') assert(contact instanceof Contact, 'Invalid contact was supplied') events.EventEmitter.call(this) options = options || {} if (options.replyto) { assert(options.replyto instanceof Contact, 'Invalid contact was sup...
javascript
{ "resource": "" }
q64717
Channel
test
function Channel (id, exchange) { var self = this; events.EventEmitter.call(this); this.id = id; this.exchange = exchange; this.exchange.on(this.id, function
javascript
{ "resource": "" }
q64718
continuable
test
function continuable(func, context) { ensureFunc(func, 'function'); if (context) {
javascript
{ "resource": "" }
q64719
extractDescription
test
function extractDescription (d) { if (!d) return; if (d === "ERROR: No README data found!") return; // the first block of text before the first heading //
javascript
{ "resource": "" }
q64720
addComment
test
function addComment(type, value, start, end, loc) { var comment; assert(typeof start === 'number', 'Comment must have valid position'); // Because the way the actual token is scanned, often the comments // (if any) are skipped twice during the lexical analysis. ...
javascript
{ "resource": "" }
q64721
expectKeyword
test
function expectKeyword(keyword, contextual) { var token = lex(); if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||
javascript
{ "resource": "" }
q64722
parseArrayInitialiser
test
function parseArrayInitialiser() { var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true, marker = markerCreate(); expect('['); while (!match(']')) { if (lookahead.value === 'for' && lookahead.typ...
javascript
{ "resource": "" }
q64723
parsePropertyFunction
test
function parsePropertyFunction(options) { var previousStrict, previousYieldAllowed, previousAwaitAllowed, params, defaults, body, marker = markerCreate(); previousStrict = strict; previousYieldAllowed = state.yieldAllowed; state.yieldAllowed = options...
javascript
{ "resource": "" }
q64724
parsePostfixExpression
test
function parsePostfixExpression() { var marker = markerCreate(), expr = parseLeftHandSideExpressionAllowCall(), token; if (lookahead.type !== Token.Punctuator) { return expr; } if ((match('++') || match('--')) && !...
javascript
{ "resource": "" }
q64725
parseUnaryExpression
test
function parseUnaryExpression() { var marker, token, expr; if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) { return parsePostfixExpression(); } if (match('++') || match('--')) { marker = markerCreate()...
javascript
{ "resource": "" }
q64726
reinterpretAsAssignmentBindingPattern
test
function reinterpretAsAssignmentBindingPattern(expr) { var i, len, property, element; if (expr.type === Syntax.ObjectExpression) { expr.type = Syntax.ObjectPattern; for (i = 0, len = expr.properties.length; i < len; i += 1) { property = ex...
javascript
{ "resource": "" }
q64727
parseExpressionStatement
test
function parseExpressionStatement() { var marker = markerCreate(), expr = parseExpression(); consumeSemicolon();
javascript
{ "resource": "" }
q64728
parseReturnStatement
test
function parseReturnStatement() { var argument = null, marker = markerCreate(); expectKeyword('return'); if (!state.inFunctionBody) { throwErrorTolerant({}, Messages.IllegalReturn); } // 'return' followed by a space and an identi...
javascript
{ "resource": "" }
q64729
extend
test
function extend(object, properties) { var entry, result = {}; for (entry in object) { /* istanbul ignore else */ if (object.hasOwnProperty(entry)) { result[entry] = object[entry]; } } for (entry...
javascript
{ "resource": "" }
q64730
reflowText
test
function reflowText (text, width, gfm) { // Hard break was inserted by Renderer.prototype.br or is // <br /> when gfm is true var splitRe = gfm ? HARD_RETURN_GFM_RE : HARD_RETURN_RE, sections = text.split(splitRe), reflowed = []; sections.forEach(function (section) { ...
javascript
{ "resource": "" }
q64731
isAbsolute
test
function isAbsolute(fp) { if (typeof fp !== 'string') { throw new TypeError('isAbsolute expects a string.'); } if (!isWindows()
javascript
{ "resource": "" }
q64732
repeat
test
function repeat(str, num) { if (typeof str !== 'string') { throw new TypeError('repeat-string expects a string.'); } if (num === 1) return str; if (num === 2) return str + str; var max = str.length * num;
javascript
{ "resource": "" }
q64733
uniqSet
test
function uniqSet(arr) { var seen = new Set(); return arr.filter(function (el) { if (!seen.has(el)) {
javascript
{ "resource": "" }
q64734
error
test
function error(msg, _continue) { if (state.error === null) state.error = ''; state.error += state.currentCmd + ': ' + msg + '\n'; if (msg.length > 0) log(state.error);
javascript
{ "resource": "" }
q64735
wrap
test
function wrap(cmd, fn, options) { return function() { var retValue = null; state.currentCmd = cmd; state.error = null; try { var args = [].slice.call(arguments, 0); if (options && options.notUnix) { retValue = fn.apply(this, args); ...
javascript
{ "resource": "" }
q64736
writeableDir
test
function writeableDir(dir) { if (!dir || !fs.existsSync(dir)) return false; if (!fs.statSync(dir).isDirectory()) return false;
javascript
{ "resource": "" }
q64737
mkdirSyncRecursive
test
function mkdirSyncRecursive(dir) { var baseDir = path.dirname(dir); // Base dir exists, no recursion necessary if (fs.existsSync(baseDir)) { fs.mkdirSync(dir, parseInt('0777', 8)); return; } // Base dir
javascript
{ "resource": "" }
q64738
splitPath
test
function splitPath(p) { for (i=1;i<2;i++) {} if (!p) return []; if (common.platform === 'win')
javascript
{ "resource": "" }
q64739
updateStdout
test
function updateStdout() { if (options.silent || !fs.existsSync(stdoutFile)) return; var stdoutContent = fs.readFileSync(stdoutFile, 'utf8'); // No changes since last time? if (stdoutContent.length <= previousStdoutContent.length) return;
javascript
{ "resource": "" }
q64740
formatArgs
test
function formatArgs() { var args = arguments; var useColors = this.useColors; var name = this.namespace; if (useColors) { var c = this.color; args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m' +
javascript
{ "resource": "" }
q64741
GNTP
test
function GNTP(type, opts) { opts = opts || {}; this.type = type; this.host = opts.host || 'localhost';
javascript
{ "resource": "" }
q64742
Growly
test
function Growly() { this.appname = 'Growly'; this.notifications = undefined; this.labels = undefined; this.count = 0;
javascript
{ "resource": "" }
q64743
Command
test
function Command(name) { this.commands = []; this.options = [];
javascript
{ "resource": "" }
q64744
baseDifference
test
function baseDifference(array, values) { var length = array ? array.length : 0, result = []; if (!length) { return result; } var index = -1, indexOf = baseIndexOf, isCommon = true, cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? crea...
javascript
{ "resource": "" }
q64745
peek
test
function peek(p) { var i = p || 0, j = 0, t; while (j <= i) { t = lookahead[j]; if (!t) { t = lookahead[j] = lex.token(); } j += 1; }
javascript
{ "resource": "" }
q64746
identifier
test
function identifier(fnparam, prop) { var i = optionalidentifier(fnparam, prop, false); if (i) { return i; } // parameter destructuring with rest operator if (state.tokens.next.value === "...") { if (!state.option.esnext) { warning("W119", stat...
javascript
{ "resource": "" }
q64747
destructuringAssignOrJsonValue
test
function destructuringAssignOrJsonValue() { // lookup for the assignment (esnext only) // if it has semicolons, it is a block, so go parse it as a block // or it's not a block, but there are assignments, check for undeclared variables var block = lookupBlockType(); if (block...
javascript
{ "resource": "" }
q64748
shouldGetter
test
function shouldGetter() { if (this instanceof String || this instanceof Number || this instanceof Boolean ) { return new Assertion(this.valueOf(),
javascript
{ "resource": "" }
q64749
isA
test
function isA(object, value) { if (_isFunction2['default'](value)) return object instanceof value;
javascript
{ "resource": "" }
q64750
test
function(bin, opt) { cmd = bin; if ( opt.testing !== 'undefined') { opt.dryRun = opt.testing; } if (typeof opt.testSuite === 'undefined') { opt.testSuite = ''; } if (typeof opt.verbose === 'undefined') { opt.verbose = ''; } if (typeof opt.dryRun === 'undefined') ...
javascript
{ "resource": "" }
q64751
eatNargs
test
function eatNargs (i, key, args) { var toEat = checkAllAliases(key, opts.narg) if (args.length - (i + 1) < toEat) error = Error(__('Not enough arguments following: %s', key))
javascript
{ "resource": "" }
q64752
setConfig
test
function setConfig (argv) { var configLookup = {} // expand defaults/aliases, in-case any happen to reference // the config.json file. applyDefaultsAndAliases(configLookup, aliases, defaults) Object.keys(flags.configs).forEach(function (configKey) { var config...
javascript
{ "resource": "" }
q64753
extendAliases
test
function extendAliases (obj) { Object.keys(obj || {}).forEach(function (key) { aliases[key] = [].concat(opts.alias[key] || []) // For "--option-name", also set argv.optionName aliases[key].concat(key).forEach(function (x) { if (/-/.test(x)) { var c = camel...
javascript
{ "resource": "" }
q64754
checkAllAliases
test
function checkAllAliases (key, flag) { var isSet = false var toCheck = [].concat(aliases[key] || [], key) toCheck.forEach(function (key)
javascript
{ "resource": "" }
q64755
guessType
test
function guessType (key, flags) { var type = 'boolean' if (flags.strings &&
javascript
{ "resource": "" }
q64756
maxWidth
test
function maxWidth (table) { var width = 0 // table might be of the form [leftColumn], // or {key: leftColumn}} if (!Array.isArray(table)) { table = Object.keys(table).map(function (key) { return [table[key]] }) } table.forEach(fun...
javascript
{ "resource": "" }
q64757
normalizeAliases
test
function normalizeAliases () { var demanded = yargs.getDemanded() var options = yargs.getOptions() ;(Object.keys(options.alias) || []).forEach(function (key) { options.alias[key].forEach(function (alias) { // copy descriptions. if (descriptions[alias]) self...
javascript
{ "resource": "" }
q64758
defaultString
test
function defaultString (value, defaultDescription) { var string = '[' + __('default:') + ' ' if (value === undefined && !defaultDescription) return null if (defaultDescription) { string += defaultDescription } else { switch (typeof value) { case ...
javascript
{ "resource": "" }
q64759
find_attr_value
test
function find_attr_value(attrForms, attrName) { var attrVal; var attrPos = -1; if(attrForms && Array.isArray(attrForms)) { attrKey = attrForms.find(function (form, i) { attrPos = i; return (i % 2 === 1) && form.value === attrName; })
javascript
{ "resource": "" }
q64760
test
function(options) { options = options || {} if ( this.passports && this.passports.every(t => t instanceof app.orm['Passport']) && options.reload !== true ) { return Promise.resolve(this) } else { ...
javascript
{ "resource": "" }
q64761
write
test
function write(path, str) { fs.writeFileSync(path,
javascript
{ "resource": "" }
q64762
mkdir
test
function mkdir(path, silent) { if(!exists(path)) { fs.mkdirSync(path, 0755);
javascript
{ "resource": "" }
q64763
isEmptyDirectory
test
function isEmptyDirectory(path) { var files; try { files = fs.readdirSync(path); if(files.length > 0)
javascript
{ "resource": "" }
q64764
test
function(config,callback,scope) { // Ext.data.utilities.check('DatabaseDefinition', 'constructor', 'config', config, ['key','database_name','generation','system_name','replica_number']);
javascript
{ "resource": "" }
q64765
test
function() { var actions = this.getActions(), previousAction = actions[actions.length - 2]; if (previousAction) { actions.pop(); previousAction.getController().getApplication().redirectTo(previousAction.getUrl());
javascript
{ "resource": "" }
q64766
GrelRequest
test
function GrelRequest(grel) { var authString; if (grel.token) { authString = grel.token + ':'; } else { authString = grel.user + ':' + grel.password; } this.headers = { 'Authorization': 'Basic ' + new Buffer(authString).toString('base64'),
javascript
{ "resource": "" }
q64767
handleResponse
test
function handleResponse(res, data, callback) { // HTTP 204 doesn't have a response var json = data && JSON.parse(data) || {}; if ((res.statusCode >= 200) && (res.statusCode <= 206)) { // Handle a few known responses switch (json.message) { case 'Bad credentials':
javascript
{ "resource": "" }
q64768
splitHeader
test
function splitHeader(content) { // New line characters need to handle all operating systems. const lines = content.split(/\r?\n/); if (lines[0] !== '---') { return {}; } let i = 1; for (; i < lines.length - 1; ++i) {
javascript
{ "resource": "" }
q64769
test
function(x, y, animation) { if (this.isDestroyed) { return this; } //<deprecated product=touch since=2.0> if (typeof x != 'number' && arguments.length === 1) { //<debug warn> Ext.Logger.deprecate("Calling scrollTo() with an object argument is deprecat...
javascript
{ "resource": "" }
q64770
test
function(animation) { var size = this.getSize(), cntSize = this.getContainerSize();
javascript
{ "resource": "" }
q64771
test
function(x, y, animation) { var position = this.position; x = (typeof x == 'number') ? x + position.x : null; y = (typeof y
javascript
{ "resource": "" }
q64772
test
function(config) { var element; this.extraConstraint = {}; this.initialConfig = config; this.offset = { x: 0, y: 0 }; this.listeners = { dragstart: 'onDragStart', drag : 'onDrag', dragend : 'onDragEnd', ...
javascript
{ "resource": "" }
q64773
addActions
test
function addActions(actions) { if (typeof actions === 'string') { add(actions); } else if (Array.isArray(actions)) { actions.forEach(addActions); }
javascript
{ "resource": "" }
q64774
test
function(pattern, count, sep) { for (var buf = [], i = count; i--; ) { buf.push(pattern);
javascript
{ "resource": "" }
q64775
test
function(config) { var options = new FileUploadOptions(); options.fileKey = config.fileKey || "file"; options.fileName = this.path.substr(this.path.lastIndexOf('/') + 1); options.mimeType = config.mimeType || "image/jpeg"; options.params = ...
javascript
{ "resource": "" }
q64776
test
function(config) { var fileTransfer = new FileTransfer(); fileTransfer.download( encodeURI(config.source),
javascript
{ "resource": "" }
q64777
test
function(property, value, anyMatch, caseSensitive) { // Support for the simple case of filtering by property/value if (property) { if (Ext.isString(property)) { this.addFilters({ property : property, value : value, ...
javascript
{ "resource": "" }
q64778
test
function(fn, scope) { var keys = this.keys, items = this.items,
javascript
{ "resource": "" }
q64779
test
function(fn, scope) { var me = this, newCollection = new this.self(), keys = me.keys, items = me.all, length = items.length, i; newCollection.getKey = me.getKey; for (i = 0; i
javascript
{ "resource": "" }
q64780
test
function(item) { var index = this.items.indexOf(item); if (index === -1) { Ext.Array.remove(this.all, item); if (typeof this.getKey == 'function') {
javascript
{ "resource": "" }
q64781
test
function(items) { if (items) { var ln = items.length, i;
javascript
{ "resource": "" }
q64782
test
function(item) { if (this.dirtyIndices) { this.updateIndices(); } var index =
javascript
{ "resource": "" }
q64783
test
function(item) { var key = this.getKey(item); if (key) { return this.containsKey(key); } else {
javascript
{ "resource": "" }
q64784
test
function(start, end) { var me = this, items = me.items, range = [], i; if (items.length < 1) { return range; } start = start || 0; end = Math.min(typeof end == 'undefined' ?
javascript
{ "resource": "" }
q64785
test
function(fn, scope, start) { var me = this, keys = me.keys, items = me.items, i = start || 0, ln = items.length; for (; i < ln; i++) {
javascript
{ "resource": "" }
q64786
test
function() { var me = this, copy = new this.self(), keys = me.keys, items = me.items, i = 0, ln = items.length;
javascript
{ "resource": "" }
q64787
test
function(newMonthText, oldMonthText) { var innerItems = this.getInnerItems, ln = innerItems.length, item, i; //loop through each of the current items and set the title on the correct slice if (this.initialized) { for (i = 0; i < ln; i++) { ite...
javascript
{ "resource": "" }
q64788
test
function(yearText) { var innerItems = this.getInnerItems, ln = innerItems.length, item, i; //loop through each of the current items and set the title on the correct slice if (this.initialized) { for (i = 0; i < ln; i++) {
javascript
{ "resource": "" }
q64789
test
function() { var me = this, slotOrder = me.getSlotOrder(), yearsFrom = me.getYearFrom(), yearsTo = me.getYearTo(), years = [], days = [], months = [], reverse = yearsFrom > yearsTo, ln, i, days...
javascript
{ "resource": "" }
q64790
test
function(name, days, months, years) { switch (name) { case 'year': return { name: 'year', align: 'center', data: years, title: this.getYearText(), flex: 3 }; ...
javascript
{ "resource": "" }
q64791
test
function(user) { if (user) { if (!!~this.roles.indexOf('*')) { return true; } else { for (var userRoleIndex in user.roles) { for (var roleIndex in this.roles) { if
javascript
{ "resource": "" }
q64792
test
function() { var text = this.backButtonStack[this.backButtonStack.length - 2], useTitleForBackButtonText = this.getUseTitleForBackButtonText();
javascript
{ "resource": "" }
q64793
test
function(element) { var ghost, x, y, left, width; ghost = element.dom.cloneNode(true); ghost.id = element.id + '-proxy'; //insert it into the toolbar element.getParent().dom.appendChild(ghost); //set the x/y ghost = Ext.get(ghost);
javascript
{ "resource": "" }
q64794
plugin
test
function plugin(options) { options = options || {}; options.key = options.key || 'untemplatized'; return function(files, metalsmith, done){ setImmediate(done); Object.keys(files).forEach(function(file){ debug('checking file: %s', file); var data
javascript
{ "resource": "" }
q64795
defaultMapFn
test
function defaultMapFn(data) { return Object.keys(data).slice(0,
javascript
{ "resource": "" }
q64796
scheduleJob
test
function scheduleJob(trigger, jobFunc, jobData) { const job = Job.createJob(trigger, jobFunc, jobData); const excuteTime = job.excuteTime(); const id = job.id; map[id] = job; const element = { id: id, time: excuteTime };
javascript
{ "resource": "" }
q64797
defineType
test
function defineType(type, validator) { var typeDef; var regKey; if (type instanceof Function) { validator = _customValidator(type); type = type.name; //console.log("Custom type", typeof type, type, validator); } else if (!(validator instanceof Function)) { throw TypeException('Validator must b...
javascript
{ "resource": "" }
q64798
undefineType
test
function undefineType(type) { var validator; var typeDef = parseTypeDef(type); var regKey = typeDef.name.toLocaleLowerCase(); if (primitives[regKey]) { throw TypeException('Cannot undefine primitive type `{{type}}`', null, null, { type: typeDef.name });
javascript
{ "resource": "" }
q64799
checkType
test
function checkType(type, value, previous, attributeName) { var typeDef = parseTypeDef(type); var regKey = typeDef.name.toLocaleLowerCase(); validator = primitives[regKey] || (registry[regKey] && registry[regKey].validator); if (!validator) { throw TypeException('Unknown type `{{type}}`', null, [ attribute...
javascript
{ "resource": "" }