_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q20700
convertAndMergeHiddenQueryProps
train
function convertAndMergeHiddenQueryProps(model, json, omitProps, builder) { const queryProps = model[QUERY_PROPS_PROPERTY]; if (!queryProps) { // The model has no query properties. return json; } const modelClass = model.constructor; const keys = Object.keys(queryProps); for (let i = 0, l = keys....
javascript
{ "resource": "" }
q20701
queryPropToKnexRaw
train
function queryPropToKnexRaw(queryProp, builder) { if (!queryProp) { return queryProp; } if (queryProp.isObjectionQueryBuilderBase) { return buildObjectionQueryBuilder(queryProp, builder); } else if (isKnexRawConvertable(queryProp)) { return buildKnexRawConvertable(queryProp, builder); } else { ...
javascript
{ "resource": "" }
q20702
Layer
train
function Layer(path, methods, middleware, opts) { this.opts = opts || {}; this.name = this.opts.name || null; this.methods = []; this.paramNames = []; this.stack = Array.isArray(middleware) ? middleware : [middleware]; methods.forEach(function(method) { var l = this.methods.push(method.toUpperCase()); ...
javascript
{ "resource": "" }
q20703
debug
train
function debug(e, template, line, file) { file = file || "<template>"; var lines = template.split("\n"), start = Math.max(line - 3, 0), end = Math.min(lines.length, line + 3), context = lines.slice(start, end); var c; for (var i = 0, len = context.length; i < len; ++i) { ...
javascript
{ "resource": "" }
q20704
lookup
train
function lookup(name, stack, defaultValue) { if (name === ".") { return stack[stack.length - 1]; } var names = name.split("."); var lastIndex = names.length - 1; var target = names[lastIndex]; var value, context, i = stack.length, j, localStack; while (i) { localStack = stack.s...
javascript
{ "resource": "" }
q20705
_compile
train
function _compile(template, options) { var args = "view,partials,stack,lookup,escapeHTML,renderSection,render"; var body = parse(template, options); var fn = new Function(args, body); // This anonymous function wraps the generated function so we can do // argument coercion, setup some variables, an...
javascript
{ "resource": "" }
q20706
addDetected
train
function addDetected(app, pattern, type, value, key) { app.detected = true; // Set confidence level app.confidence[`${type} ${key ? `${key} ` : ''}${pattern.regex}`] = pattern.confidence === undefined ? 100 : parseInt(pattern.confidence, 10); // Detect version number if (pattern.version) { const version...
javascript
{ "resource": "" }
q20707
getOption
train
function getOption(name, defaultValue = null) { return new Promise(async (resolve, reject) => { let value = defaultValue; try { const option = await browser.storage.local.get(name); if (option[name] !== undefined) { value = option[name]; } } catch (error) { wappalyzer.log...
javascript
{ "resource": "" }
q20708
setOption
train
function setOption(name, value) { return new Promise(async (resolve, reject) => { try { await browser.storage.local.set({ [name]: value }); } catch (error) { wappalyzer.log(error.message, 'driver', 'error'); return reject(error.message); } return resolve(); }); }
javascript
{ "resource": "" }
q20709
openTab
train
function openTab(args) { browser.tabs.create({ url: args.url, active: args.background === undefined || !args.background, }); }
javascript
{ "resource": "" }
q20710
post
train
async function post(url, body) { try { const response = await fetch(url, { method: 'POST', body: JSON.stringify(body), }); wappalyzer.log(`POST ${url}: ${response.status}`, 'driver'); } catch (error) { wappalyzer.log(`POST ${url}: ${error}`, 'driver', 'error'); } }
javascript
{ "resource": "" }
q20711
train
function (it, S) { if (!_isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !_isObject...
javascript
{ "resource": "" }
q20712
isEmpty
train
function isEmpty(data) { if (Array.isArray(data)) { return data.length === 0; } return Object.keys(data).length === 0; }
javascript
{ "resource": "" }
q20713
forOwn
train
function forOwn(object, iteratee) { Object.keys(object).forEach(function (key) { return iteratee(object[key], key, object); }); }
javascript
{ "resource": "" }
q20714
map
train
function map(object, iteratee) { return Object.keys(object).map(function (key) { return iteratee(object[key], key, object); }); }
javascript
{ "resource": "" }
q20715
orderBy
train
function orderBy(collection, keys, directions) { var index = -1; var result = collection.map(function (value) { var criteria = keys.map(function (key) { return value[key]; }); return { criteria: criteria, index: ++index, value: value }; }); return baseSortBy(result, function (object, oth...
javascript
{ "resource": "" }
q20716
groupBy
train
function groupBy(collection, iteratee) { return collection.reduce(function (records, record) { var key = iteratee(record); if (records[key] === undefined) { records[key] = []; } records[key].push(record); return records; }, {}); }
javascript
{ "resource": "" }
q20717
Type
train
function Type(model, value, mutator) { var _this = _super.call(this, model) /* istanbul ignore next */ || this; /** * Whether if the attribute can accept `null` as a value. */ _this.isNullable = false; _this.value = value; _this.mutator = mutator; return...
javascript
{ "resource": "" }
q20718
Attr
train
function Attr(model, value, mutator) { var _this = _super.call(this, model, value, mutator) /* istanbul ignore next */ || this; _this.value = value; return _this; }
javascript
{ "resource": "" }
q20719
HasOne
train
function HasOne(model, related, foreignKey, localKey) { var _this = _super.call(this, model) /* istanbul ignore next */ || this; _this.related = _this.model.relation(related); _this.foreignKey = foreignKey; _this.localKey = localKey; return _this; }
javascript
{ "resource": "" }
q20720
HasManyBy
train
function HasManyBy(model, parent, foreignKey, ownerKey) { var _this = _super.call(this, model) /* istanbul ignore next */ || this; _this.parent = _this.model.relation(parent); _this.foreignKey = foreignKey; _this.ownerKey = ownerKey; return _this; }
javascript
{ "resource": "" }
q20721
HasManyThrough
train
function HasManyThrough(model, related, through, firstKey, secondKey, localKey, secondLocalKey) { var _this = _super.call(this, model) /* istanbul ignore next */ || this; _this.related = _this.model.relation(related); _this.through = _this.model.relation(through); _this.firstKey = firstK...
javascript
{ "resource": "" }
q20722
MorphTo
train
function MorphTo(model, id, type) { var _this = _super.call(this, model) /* istanbul ignore next */ || this; _this.id = id; _this.type = type; return _this; }
javascript
{ "resource": "" }
q20723
denormalizeImmutable
train
function denormalizeImmutable(schema, input, unvisit) { return Object.keys(schema).reduce(function (object, key) { // Immutable maps cast keys to strings on write so we need to ensure // we're accessing them using string keys. var stringKey = '' + key; if (object.has(stringKey)) { return object...
javascript
{ "resource": "" }
q20724
Query
train
function Query(state, entity) { /** * Primary key ids to filter records by. It is used for filtering records * direct key lookup when a user is trying to fetch records by its * primary key. * * It should not be used if there is a logic which prevents index usage, for...
javascript
{ "resource": "" }
q20725
train
function (context, payload) { var state = context.state; var entity = state.$name; return context.dispatch(state.$connection + "/insertOrUpdate", __assign({ entity: entity }, payload), { root: true }); }
javascript
{ "resource": "" }
q20726
train
function (state, payload) { var entity = payload.entity; var data = payload.data; var options = OptionsBuilder.createPersistOptions(payload); var result = payload.result; result.data = (new Query(state, entity)).create(data, options); }
javascript
{ "resource": "" }
q20727
Schema
train
function Schema(model) { var _this = this; /** * List of generated schemas. */ this.schemas = {}; this.model = model; var models = model.database().models(); Object.keys(models).forEach(function (name) { _this.one(models[name]); }); }
javascript
{ "resource": "" }
q20728
encodeEntities
train
function encodeEntities(value) { return value. replace(/&/g, '&amp;'). replace(surrogatePairRegexp, function(value) { var hi = value.charCodeAt(0), low = value.charCodeAt(1); return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x1...
javascript
{ "resource": "" }
q20729
train
function(value, token) { var score, pos; if (!value) return 0; value = String(value || ''); pos = value.search(token.regex); if (pos === -1) return 0; score = token.string.length / value.length; if (pos === 0) score += 0.5; return score; }
javascript
{ "resource": "" }
q20730
train
function(a, b) { if (typeof a === 'number' && typeof b === 'number') { return a > b ? 1 : (a < b ? -1 : 0); } a = asciifold(String(a || '')); b = asciifold(String(b || '')); if (a > b) return 1; if (b > a) return -1; return 0; }
javascript
{ "resource": "" }
q20731
train
function(self, types, fn) { var type; var trigger = self.trigger; var event_args = {}; // override trigger method self.trigger = function() { var type = arguments[0]; if (types.indexOf(type) !== -1) { event_args[type] = arguments; } else { return trigger.apply(self, arguments); } }; ...
javascript
{ "resource": "" }
q20732
train
function($from, $to, properties) { var i, n, styles = {}; if (properties) { for (i = 0, n = properties.length; i < n; i++) { styles[properties[i]] = $from.css(properties[i]); } } else { styles = $from.css(); } $to.css(styles); }
javascript
{ "resource": "" }
q20733
train
function() { var self = this; var field_label = self.settings.labelField; var field_optgroup = self.settings.optgroupLabelField; var templates = { 'optgroup': function(data) { return '<div class="optgroup">' + data.html + '</div>'; }, 'optgroup_header': function(data, escape) { retur...
javascript
{ "resource": "" }
q20734
train
function() { var key, fn, callbacks = { 'initialize' : 'onInitialize', 'change' : 'onChange', 'item_add' : 'onItemAdd', 'item_remove' : 'onItemRemove', 'clear' : 'onClear', 'option_add' : 'onOptionAdd', 'option_remove' : 'onOptionRemove', 'opt...
javascript
{ "resource": "" }
q20735
train
function(e) { var self = this; var defaultPrevented = e.isDefaultPrevented(); var $target = $(e.target); if (self.isFocused) { // retain focus by preventing native handling. if the // event target is the input it should not be modified. // otherwise, text selection within the input won't work....
javascript
{ "resource": "" }
q20736
train
function(e) { var value, $target, $option, self = this; if (e.preventDefault) { e.preventDefault(); e.stopPropagation(); } $target = $(e.currentTarget); if ($target.hasClass('create')) { self.createItem(null, function() { if (self.settings.closeAfterSelect) { self.close(); ...
javascript
{ "resource": "" }
q20737
train
function(e) { var self = this; if (self.isLocked) return; if (self.settings.mode === 'multi') { e.preventDefault(); self.setActiveItem(e.currentTarget, e); } }
javascript
{ "resource": "" }
q20738
train
function(value) { var $input = this.$control_input; var changed = $input.val() !== value; if (changed) { $input.val(value).triggerHandler('update'); this.lastValue = value; } }
javascript
{ "resource": "" }
q20739
train
function(value, silent) { var events = silent ? [] : ['change']; debounce_events(this, events, function() { this.clear(); this.addItems(value, silent); }); }
javascript
{ "resource": "" }
q20740
train
function($item, e) { var self = this; var eventName; var i, idx, begin, end, item, swap; var $last; if (self.settings.mode === 'single') return; $item = $($item); // clear the active selection if (!$item.length) { $(self.$activeItems).removeClass('active'); self.$activeItems = []; ...
javascript
{ "resource": "" }
q20741
train
function() { var self = this; self.setTextboxValue(''); self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000}); self.isInputHidden = true; }
javascript
{ "resource": "" }
q20742
train
function() { var self = this; if (self.isDisabled) return; self.ignoreFocus = true; self.$control_input[0].focus(); window.setTimeout(function() { self.ignoreFocus = false; self.onFocus(); }, 0); }
javascript
{ "resource": "" }
q20743
train
function(query) { var i, value, score, result, calculateScore; var self = this; var settings = self.settings; var options = this.getSearchOptions(); // validate user-provided result scoring function if (settings.score) { calculateScore = self.settings.score.apply(this, [query]); if (typ...
javascript
{ "resource": "" }
q20744
train
function(data) { var key = hash_key(data[this.settings.optgroupValueField]); if (!key) return false; data.$order = data.$order || ++this.order; this.optgroups[key] = data; return key; }
javascript
{ "resource": "" }
q20745
train
function(id, data) { data[this.settings.optgroupValueField] = id; if (id = this.registerOptionGroup(data)) { this.trigger('optgroup_add', id, data); } }
javascript
{ "resource": "" }
q20746
train
function(value, data) { var self = this; var $item, $item_new; var value_new, index_item, cache_items, cache_options, order_old; value = hash_key(value); value_new = hash_key(data[self.settings.valueField]); // sanity checks if (value === null) return; if (!self.options.hasOwnProperty(va...
javascript
{ "resource": "" }
q20747
train
function(value, silent) { var self = this; value = hash_key(value); var cache_items = self.renderCache['item']; var cache_options = self.renderCache['option']; if (cache_items) delete cache_items[value]; if (cache_options) delete cache_options[value]; delete self.userOptions[value]; delete s...
javascript
{ "resource": "" }
q20748
train
function() { var self = this; self.loadedSearches = {}; self.userOptions = {}; self.renderCache = {}; self.options = self.sifter.items = {}; self.lastQuery = null; self.trigger('option_clear'); self.clear(); }
javascript
{ "resource": "" }
q20749
train
function(value, $els) { value = hash_key(value); if (typeof value !== 'undefined' && value !== null) { for (var i = 0, n = $els.length; i < n; i++) { if ($els[i].getAttribute('data-value') === value) { return $($els[i]); } } } return $(); }
javascript
{ "resource": "" }
q20750
train
function(values, silent) { var items = $.isArray(values) ? values : [values]; for (var i = 0, n = items.length; i < n; i++) { this.isPending = (i < n - 1); this.addItem(items[i], silent); } }
javascript
{ "resource": "" }
q20751
train
function(input, triggerDropdown) { var self = this; var caret = self.caretPos; input = input || $.trim(self.$control_input.val() || ''); var callback = arguments[arguments.length - 1]; if (typeof callback !== 'function') callback = function() {}; if (typeof triggerDropdown !== 'boolean') { tr...
javascript
{ "resource": "" }
q20752
train
function() { var invalid, self = this; if (self.isRequired) { if (self.items.length) self.isInvalid = false; self.$control_input.prop('required', invalid); } self.refreshClasses(); }
javascript
{ "resource": "" }
q20753
train
function() { var self = this; var isFull = self.isFull(); var isLocked = self.isLocked; self.$wrapper .toggleClass('rtl', self.rtl); self.$control .toggleClass('focus', self.isFocused) .toggleClass('disabled', self.isDisabled) .toggleClass('required', self.isRequired) .toggl...
javascript
{ "resource": "" }
q20754
train
function() { var self = this; if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return; self.focus(); self.isOpen = true; self.refreshState(); self.$dropdown.css({visibility: 'hidden', display: 'block'}); self.positionDropdown(); self.$dropdown.css({visibil...
javascript
{ "resource": "" }
q20755
train
function() { var $control = this.$control; var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position(); offset.top += $control.outerHeight(true); this.$dropdown.css({ width : $control.outerWidth(), top : offset.top, left : offset.left }); }
javascript
{ "resource": "" }
q20756
train
function($el) { var caret = Math.min(this.caretPos, this.items.length); if (caret === 0) { this.$control.prepend($el); } else { $(this.$control[0].childNodes[caret]).before($el); } this.setCaret(caret + 1); }
javascript
{ "resource": "" }
q20757
train
function(i) { var self = this; if (self.settings.mode === 'single') { i = self.items.length; } else { i = Math.max(0, Math.min(self.items.length, i)); } if(!self.isPending) { // the input must be moved by leaving it in place and moving the // siblings, due to the fact that focus canno...
javascript
{ "resource": "" }
q20758
train
function() { var self = this; self.$input.prop('disabled', true); self.$control_input.prop('disabled', true).prop('tabindex', -1); self.isDisabled = true; self.lock(); }
javascript
{ "resource": "" }
q20759
train
function() { var self = this; self.$input.prop('disabled', false); self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex); self.isDisabled = false; self.unlock(); }
javascript
{ "resource": "" }
q20760
train
function() { var self = this; var eventNS = self.eventNS; var revertSettings = self.revertSettings; self.trigger('destroy'); self.off(); self.$wrapper.remove(); self.$dropdown.remove(); self.$input .html('') .append(revertSettings.$children) .removeAttr('tabindex') .removeCla...
javascript
{ "resource": "" }
q20761
train
function(input) { var self = this; if (!self.settings.create) return false; var filter = self.settings.createFilter; return input.length && (typeof filter !== 'function' || filter.apply(self, [input])) && (typeof filter !== 'string' || new RegExp(filter).test(input)) && (!(filter instanceof RegE...
javascript
{ "resource": "" }
q20762
train
function (e) { var el = $(e.target); var date = moment(el.val(), this.format); if (!date.isValid()) return; var startDate, endDate; if (el.attr('name') === 'daterangepicker_start') { startDate = date; endDate = this.endDate; ...
javascript
{ "resource": "" }
q20763
train
function( element, method ) { return $( element ).data( "msg" + method[ 0 ].toUpperCase() + method.substring( 1 ).toLowerCase() ) || $( element ).data("msg"); }
javascript
{ "resource": "" }
q20764
train
function( name, method ) { var m = this.settings.messages[name]; return m && (m.constructor === String ? m : m[method]); }
javascript
{ "resource": "" }
q20765
compareAscending
train
function compareAscending(a, b) { var ac = a.criteria, bc = b.criteria, index = -1, length = ac.length; while (++index < length) { var value = ac[index], other = bc[index]; if (value !== other) { if (value > other || typeof value == 'undefined') { ...
javascript
{ "resource": "" }
q20766
slice
train
function slice(array, start, end) { start || (start = 0); if (typeof end == 'undefined') { end = array ? array.length : 0; } var index = -1, length = end - start || 0, result = Array(length < 0 ? 0 : length); while (++index < length) { result[index] = array[start + index...
javascript
{ "resource": "" }
q20767
createAggregator
train
function createAggregator(setter) { return function(collection, callback, thisArg) { var result = {}; callback = createCallback(callback, thisArg, 3); var index = -1, length = collection ? collection.length : 0; if (typeof length == 'number') { while (++index < length) { ...
javascript
{ "resource": "" }
q20768
invert
train
function invert(object) { var index = -1, props = keys(object), length = props.length, result = {}; while (++index < length) { var key = props[index]; result[object[key]] = key; } return result; }
javascript
{ "resource": "" }
q20769
isBoolean
train
function isBoolean(value) { return value === true || value === false || value && typeof value == 'object' && toString.call(value) == boolClass || false; }
javascript
{ "resource": "" }
q20770
isString
train
function isString(value) { return typeof value == 'string' || value && typeof value == 'object' && toString.call(value) == stringClass || false; }
javascript
{ "resource": "" }
q20771
values
train
function values(object) { var index = -1, props = keys(object), length = props.length, result = Array(length); while (++index < length) { result[index] = object[props[index]]; } return result; }
javascript
{ "resource": "" }
q20772
where
train
function where(collection, properties, first) { return (first && isEmpty(properties)) ? undefined : (first ? find : filter)(collection, properties); }
javascript
{ "resource": "" }
q20773
defer
train
function defer(func) { if (!isFunction(func)) { throw new TypeError; } var args = slice(arguments, 1); return setTimeout(function() { func.apply(undefined, args); }, 1); }
javascript
{ "resource": "" }
q20774
result
train
function result(object, key) { if (object) { var value = object[key]; return isFunction(value) ? object[key]() : value; } }
javascript
{ "resource": "" }
q20775
template
train
function template(text, data, options) { var _ = lodash, settings = _.templateSettings; text = String(text || ''); options = defaults({}, options, settings); var index = 0, source = "__p += '", variable = options.variable; var reDelimiters = RegExp( (options.escape |...
javascript
{ "resource": "" }
q20776
train
function (rowMode, types) { this.command = null this.rowCount = null this.oid = null this.rows = [] this.fields = [] this._parsers = [] this._types = types this.RowCtor = null this.rowAsArray = rowMode === 'array' if (this.rowAsArray) { this.parseRow = this._parseRowAsArray } }
javascript
{ "resource": "" }
q20777
arrayString
train
function arrayString (val) { var result = '{' for (var i = 0; i < val.length; i++) { if (i > 0) { result = result + ',' } if (val[i] === null || typeof val[i] === 'undefined') { result = result + 'NULL' } else if (Array.isArray(val[i])) { result = result + arrayString(val[i]) }...
javascript
{ "resource": "" }
q20778
SanitizeCtx
train
function SanitizeCtx(ctx) { let r = {}; for (const key in ctx) { if (!key.startsWith('_')) { r[key] = ctx[key]; } } return r; }
javascript
{ "resource": "" }
q20779
Load
train
function Load(pgn) { let chess = null; if (Chess.Chess) { chess = new Chess.Chess(); } else { chess = new Chess(); } chess.load_pgn(pgn); return chess; }
javascript
{ "resource": "" }
q20780
doLogin
train
function doLogin() { // Request the login page. let res = http.get(baseURL + "/user/login"); check(res, { "title is correct": (res) => res.html("title").text() == "User account | David li commerce-test", }); // TODO: Add attr() to k6/html! // Extract hidden input fields. let formBuildID = res.body.match('name...
javascript
{ "resource": "" }
q20781
doCategory
train
function doCategory(category) { check(http.get(category.url), { "title is correct": (res) => res.html("title").text() == category.title, }); for (prodName in category.products) { if (Math.random() <= category.products[prodName].chance) { group(prodName, function() { doProductPage(category.products[prodName])...
javascript
{ "resource": "" }
q20782
doProductPage
train
function doProductPage(product) { let res = http.get(product.url); check(res, { "title is correct": (res) => res.html("title").text() == product.title, }); if (Math.random() <= product.chance) { let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1]; let formID = res.body.match('name="form_i...
javascript
{ "resource": "" }
q20783
addProductToCart
train
function addProductToCart(url, productID, formID, formBuildID, formToken) { let formdata = { product_id: productID, form_id: formID, form_build_id: formBuildID, form_token: formToken, quantity: 1, op: "Add to cart", }; let headers = { "Content-Type": "application/x-www-form-urlencoded" }; let res = http...
javascript
{ "resource": "" }
q20784
doLogout
train
function doLogout() { check(http.get(baseURL + "/user/logout"), { "logout succeeded": (res) => res.body.includes('<a href="/user/login">Log in') }) || fail("logout failed"); }
javascript
{ "resource": "" }
q20785
hashNumber
train
function hashNumber(n) { if (n !== n || n === Infinity) { return 0; } let hash = n | 0; if (hash !== n) { hash ^= n * 0xffffffff; } while (n > 0xffffffff) { n /= 0xffffffff; hash ^= n; } return smi(hash); }
javascript
{ "resource": "" }
q20786
getIENodeHash
train
function getIENodeHash(node) { if (node && node.nodeType > 0) { switch (node.nodeType) { case 1: // Element return node.uniqueID; case 9: // Document return node.documentElement && node.documentElement.uniqueID; } } }
javascript
{ "resource": "" }
q20787
getTypePropMap
train
function getTypePropMap(def) { var map = {}; def && def.extends && def.extends.forEach(e => { var superModule = defs.Immutable; e.name.split('.').forEach(part => { superModule = superModule && superModule.module && superModule.module[part]; }); var superInterface = ...
javascript
{ "resource": "" }
q20788
resizeCanvas
train
function resizeCanvas() { // When zoomed out to less than 100%, for some very strange reason, // some browsers report devicePixelRatio as less than 1 // and only part of the canvas is cleared then. var ratio = Math.max(window.devicePixelRatio || 1, 1); // This part causes the canvas to be cleared canvas.w...
javascript
{ "resource": "" }
q20789
logIOS
train
async function logIOS() { const rawDevices = execFileSync( 'xcrun', ['simctl', 'list', 'devices', '--json'], {encoding: 'utf8'}, ); const {devices} = JSON.parse(rawDevices); const device = findAvailableDevice(devices); if (device === undefined) { logger.error('No active iOS device found'); ...
javascript
{ "resource": "" }
q20790
printHelpInformation
train
function printHelpInformation(examples, pkg) { let cmdName = this._name; if (this._alias) { cmdName = `${cmdName}|${this._alias}`; } const sourceInformation = pkg ? [`${chalk.bold('Source:')} ${pkg.name}@${pkg.version}`, ''] : []; let output = [ chalk.bold(`react-native ${cmdName}`), thi...
javascript
{ "resource": "" }
q20791
copyBinaryFile
train
function copyBinaryFile(srcPath, destPath, cb) { let cbCalled = false; // const {mode} = fs.statSync(srcPath); const readStream = fs.createReadStream(srcPath); const writeStream = fs.createWriteStream(destPath); readStream.on('error', err => { done(err); }); writeStream.on('error', err => { done(e...
javascript
{ "resource": "" }
q20792
copyToClipBoard
train
function copyToClipBoard(content) { switch (process.platform) { case 'darwin': { const child = spawn('pbcopy', []); child.stdin.end(Buffer.from(content, 'utf8')); return true; } case 'win32': { const child = spawn('clip', []); child.stdin.end(Buffer.from(content, 'utf8')); ...
javascript
{ "resource": "" }
q20793
upgradeProjectFiles
train
function upgradeProjectFiles(projectDir, projectName) { // Just overwrite copyProjectTemplateAndReplace( path.dirname(require.resolve('react-native/template')), projectDir, projectName, {upgrade: true}, ); }
javascript
{ "resource": "" }
q20794
styleDocument
train
function styleDocument () { var headElement, styleElement, style; // Bail out if document has already been styled if (getRemarkStylesheet()) { return; } headElement = document.getElementsByTagName('head')[0]; styleElement = document.createElement('style'); styleElement.type = 'text/css'; // Set t...
javascript
{ "resource": "" }
q20795
getRemarkStylesheet
train
function getRemarkStylesheet () { var i, l = document.styleSheets.length; for (i = 0; i < l; ++i) { if (document.styleSheets[i].title === 'remark') { return document.styleSheets[i]; } } }
javascript
{ "resource": "" }
q20796
getPageRule
train
function getPageRule (stylesheet) { var i, l = stylesheet.cssRules.length; for (i = 0; i < l; ++i) { if (stylesheet.cssRules[i] instanceof window.CSSPageRule) { return stylesheet.cssRules[i]; } } }
javascript
{ "resource": "" }
q20797
train
function ($node, relation) { if (!$node || !($node instanceof $) || !$node.is('.node')) { return $(); } if (relation === 'parent') { return $node.closest('.nodes').parent().children(':first').find('.node'); } else if (relation === 'children') { return $node.closest('tr')....
javascript
{ "resource": "" }
q20798
train
function ($node) { var $upperLevel = $node.closest('.nodes').siblings(); if ($upperLevel.eq(0).find('.spinner').length) { $node.closest('.orgchart').data('inAjax', false); } // hide the sibling nodes if (this.getNodeState($node, 'siblings').visible) { this.hideSiblings($nod...
javascript
{ "resource": "" }
q20799
train
function ($node) { // just show only one superior level var $upperLevel = $node.closest('.nodes').siblings().removeClass('hidden'); // just show only one line $upperLevel.eq(2).children().slice(1, -1).addClass('hidden'); // show parent node with animation var $parent = $upperLevel.eq...
javascript
{ "resource": "" }