_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 27
233k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q64600 | test | function( table ) {
table = $( table )[ 0 ];
var overallWidth, percent, $tbodies, len, index,
c = table.config,
$colgroup = c.$table.children( 'colgroup' );
// remove plugin-added colgroup, in case we need to refresh the widths
if ( $colgroup.length && $colgroup.hasClass( ts.css.colgroup ) ) {
$colgroup.remove();
}
if ( c.widthFixed && c.$table.children( 'colgroup' ).length === 0 ) {
$colgroup = $( '<colgroup class="' + ts.css.colgroup + '">' );
overallWidth = c.$table.width();
// only add col for visible columns - fixes #371
| javascript | {
"resource": ""
} |
|
q64601 | test | function( str ) {
str = ( str || '' ).replace( ts.regex.spaces, ' ' ).replace( ts.regex.shortDateReplace, '/' );
| javascript | {
"resource": ""
} |
|
q64602 | checkCallExpression | test | function checkCallExpression(node) {
var callee = node.callee;
if (callee.type === 'Identifier' && callee.name === 'require') {
var pathNode = node.arguments[0];
if (pathNode.type === 'Literal') {
var p = | javascript | {
"resource": ""
} |
q64603 | test | function(event, listener){
switch (event) {
case "log":
bus.subscribe(EVENT_BUSLINE, {
onRemoteLogReceived: function(logObj){
| javascript | {
"resource": ""
} |
|
q64604 | createGitRepository | test | function createGitRepository(basePath, options) {
if (typeof (options) === "undefined")
options = defaultRepositoryOptions; | javascript | {
"resource": ""
} |
q64605 | recoverPubKey | test | function recoverPubKey(curve, e, signature, i) {
assert.strictEqual(i & 3, i, 'Recovery param is more than two bits')
var n = curve.n
var G = curve.G
var r = signature.r
var s = signature.s
assert(r.signum() > 0 && r.compareTo(n) < 0, 'Invalid r value')
assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value')
// A set LSB signifies that the y-coordinate is odd
var isYOdd = i & 1
// The more significant bit specifies whether we should use the
// first or second candidate key.
var isSecondKey = i >> 1
// 1.1 Let x = r + jn
var x = isSecondKey ? r.add(n) : r
var R = curve.pointFromX(isYOdd, x)
// 1.4 Check that nR is at infinity
| javascript | {
"resource": ""
} |
q64606 | calcPubKeyRecoveryParam | test | function calcPubKeyRecoveryParam(curve, e, signature, Q) {
for (var i = 0; i < 4; i++) {
var Qprime = recoverPubKey(curve, e, signature, i)
// 1.6.2 Verify Q
if (Qprime.equals(Q)) | javascript | {
"resource": ""
} |
q64607 | test | function (permissions) {
_.merge(this.permissions, permissions, function (a, b) {
| javascript | {
"resource": ""
} |
|
q64608 | test | function (roles) {
if (!Array.isArray(roles)) {
roles = [roles];
}
this.permissions = _.reduce(this.permissions, function (result, actions, key) {
if (roles.indexOf(key) === -1) {
| javascript | {
"resource": ""
} |
|
q64609 | DAOImplementation | test | function DAOImplementation(config) {
let basePath = config.basePath || 'backend/persistence/catalog/';
let isDBloaded = true;
if (config.filename) {
config.filename = basePath + config.filename;
}
if (config.schema) {
this.schema = fs.readJSON(path.join(appRoot.toString(),
basePath, config.schema));
} else {
this.schema = {};
}
let | javascript | {
"resource": ""
} |
q64610 | Model | test | function Model(attributes) {
// Set events hash now to prevent proxy trap
this._events = {};
// Call super constructor
EventEmitter.call(this);
attributes = attributes || {};
// Separator for change events
this._separator = ':';
// Internal Object for storing attributes
this.attributes = {};
// Attributes that have changed since the last `change` was called.
this._changed = {};
// Hash of attributes that have changed silently since the last `change`
// was called.
this._silent = {};
// Hash of changed attributes that have changed since the last `change`
// call began.
this._pending = {};
// Set initial attributes silently | javascript | {
"resource": ""
} |
q64611 | ProxiedModel | test | function ProxiedModel(attributes) {
var model;
if (attributes instanceof Model) {
// Use existing model
model = attributes;
}
else {
// Create a new Model
| javascript | {
"resource": ""
} |
q64612 | createModelProxy | test | function createModelProxy(model) {
// Create a Proxy handle
var handle = {
getOwnPropertyDescriptor: function(target, name) {
return ObjProto.getOwnPropertyDescriptor.call(model.attributes, name);
},
getOwnPropertyNames: function(target) {
return ObjProto.getOwnPropertyNames.call(model.attributes);
},
defineProperty: function(name, propertyDescriptor) {
return Object.defineProperty(model.attributes, name, propertyDescriptor);
},
// Get an attribute from the Model. This will first check for Model properties before
// checking the Model's internal attributes map.
get: function(target, name, reciever) {
// Check for direct properties to satisfy internal attribute and function calls
if (model[name]) {
return model[name];
}
// It's not a property, check for internal attribute value
return model.get(name);
},
set: function(target, name, value, receiver) {
return | javascript | {
"resource": ""
} |
q64613 | test | function(target, name, reciever) {
// Check for direct properties to satisfy internal attribute and function calls
if (model[name]) {
return model[name];
| javascript | {
"resource": ""
} |
|
q64614 | detectDestType | test | function detectDestType(dest) {
if (grunt.util._.endsWith(dest, '/')) {
return cnst.directory;
| javascript | {
"resource": ""
} |
q64615 | test | function() {
return {
r: Math.floor(Math.random() * 256),
g: Math.floor(Math.random() * 256),
| javascript | {
"resource": ""
} |
|
q64616 | test | function(fn) {
for (var y = 0; y < this.getHeight(); y++) {
for (var x = 0; x < this.getWidth(); x++) {
| javascript | {
"resource": ""
} |
|
q64617 | test | function(x, y) {
var i = this._getIndex(x, y);
return {
r: this._png.data[i + 0],
g: this._png.data[i + 1],
| javascript | {
"resource": ""
} |
|
q64618 | test | function(x, y, rgba) {
var i = this._getIndex(x, y);
var prev = this.getColor(x, y);
this._png.data[i + 0] = is_num(rgba.r) ? to_rgba_int(rgba.r): prev.r;
this._png.data[i + 1] = is_num(rgba.g) ? to_rgba_int(rgba.g): prev.g;
this._png.data[i | javascript | {
"resource": ""
} |
|
q64619 | test | function(factor) {
factor = clamp(to_int(factor), 1);
var width = this.getWidth() * factor;
var height = this.getHeight() * factor;
var buf = new buffer(width, height);
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
| javascript | {
"resource": ""
} |
|
q64620 | test | function(fn) {
fn = fn || console.log.bind(console);
var buffers = [];
var base64 = new Stream();
base64.readable = base64.writable = true;
base64.write = function(data) {
buffers.push(data);
};
base64.end | javascript | {
"resource": ""
} |
|
q64621 | test | function(fn) {
fn = fn || console.log.bind(console);
return this.toBase64(function(str) {
| javascript | {
"resource": ""
} |
|
q64622 | deepest | test | function deepest(a, b, ca, cb) {
if (a === b) {
return true;
}
else if (typeof a !== 'object' || typeof b !== 'object') {
return false;
}
else if (a === null || b === null) {
return false;
}
else if (Buffer.isBuffer(a) && Buffer.isBuffer(b)) {
if (fastEqual) {
return fastEqual.call(a, b);
}
else {
if (a.length !== b.length) return false;
for (var i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
return true;
}
}
else if (a instanceof Date && b instanceof Date) {
return a.getTime() === b.getTime();
}
else if (isArguments(a) || isArguments(b)) {
if (!(isArguments(a) && isArguments(b))) return false;
var slice = Array.prototype.slice;
return deepest(slice.call(a), slice.call(b), ca, cb);
}
else {
if (a.constructor !== b.constructor) return false;
var pa = Object.getOwnPropertyNames(a);
var pb = Object.getOwnPropertyNames(b);
if (pa.length !== pb.length) return false;
var cal = ca.length;
while (cal--) if (ca[cal] === a) return | javascript | {
"resource": ""
} |
q64623 | assertParasite | test | function assertParasite(fn) {
return function _deeperAssert() {
if (this._bailedOut) return;
var | javascript | {
"resource": ""
} |
q64624 | getIgnored | test | function getIgnored(filepath) {
for (var i in options.ignore) {
if (filepath.indexOf(options.ignore[i]) !== -1) {
| javascript | {
"resource": ""
} |
q64625 | renderInputPrompt | test | function renderInputPrompt() {
process.stdout.write(prefix);
| javascript | {
"resource": ""
} |
q64626 | calculateFieldColor | test | function calculateFieldColor(selectedColor, nonSelectedColor, focusedColor, index, out)
{
if(selected.indexOf(index) !== -1 && focused == index)
return chalk.bold.rgb(selectedColor.r, selectedColor.g, selectedColor.b)(out);
if(selected.indexOf(index) !== -1) | javascript | {
"resource": ""
} |
q64627 | render | test | function render(errors) {
if (!errors) { return ''; };
return errors.map(function(error) {
return error.line + ':' + error.column + ' ' +
| javascript | {
"resource": ""
} |
q64628 | test | function(url) {
let request = parseRequest(url);
let resource = getRequestedResource(request);
return resource.get(request)
| javascript | {
"resource": ""
} |
|
q64629 | test | function(url, data) {
let request = parseRequest(url, data);
let resource = getRequestedResource(request);
return resource.put(request) | javascript | {
"resource": ""
} |
|
q64630 | mapPrune | test | function mapPrune(input, schema) {
var result = {};
_.forOwn(schema, function (value, key) {
if (_.isPlainObject(value)) {
// Recursive.
result[key] = mapPrune(input[key] || {}, value);
| javascript | {
"resource": ""
} |
q64631 | createYamlSchema | test | function createYamlSchema(customTypes) {
var yamlTypes = [];
_.each(customTypes, function(resolver, tagAndKindString) {
var tagAndKind = tagAndKindString.split(/\s+/),
yamlType = new yaml.Type(tagAndKind[0], {
| javascript | {
"resource": ""
} |
q64632 | loadYamlFile | test | function loadYamlFile(filepath) {
try {
return yaml.safeLoad(
fs.readFileSync(filepath), {
schema: yamlSchema,
| javascript | {
"resource": ""
} |
q64633 | loadTheme | test | function loadTheme(props) {
var relPath = '/' + props.join('/') + '.yml',
defaultsPath = path.resolve(base + '/scss/themes/default' + relPath),
customPath = (custom) ? custom + relPath : null,
defaultVars = {},
customVars = null,
result = {};
// Try loading a custom theme file
| javascript | {
"resource": ""
} |
q64634 | luiTheme | test | function luiTheme(props) {
var propsS = (_.isArray(props)) ? props.join('.') : props,
propsA = (_.isString(props)) ? props.split('.') : props,
objectVars,
objectPath = [];
objectVars = _.result(theme, propsS);
// If object is already cached in theme, return it
if (objectVars) {
return objectVars;
// Else load it from file
} else {
// Find the object fromp build file
_.each(propsA, function(prop) {
if | javascript | {
"resource": ""
} |
q64635 | write | test | function write(destination, data, callback) {
// Create directories if needs be
mkdirp(path.dirname(destination), null, (err, made) => {
if (err) {
console.error(err);
| javascript | {
"resource": ""
} |
q64636 | init | test | function init(_options) {
// Build global options
var options = _.merge(defaults, _options);
// Store paths
base = options.base;
custom = options.custom;
// Retrieve build definition
build = options.build = (typeof options.build | javascript | {
"resource": ""
} |
q64637 | redact | test | function redact(_options, callback) {
var imports = [], // List of scss to import
output = '', // The scss output
errors = []; // List of errors encountered
// Build core
theme['core'] = {};
_.each(_options.build.core, function(objects, family) {
theme['core'][family] = {};
_.each(objects, function(objectName) {
luiTheme('core.' + family + '.' + objectName);
imports.push('core/' + family + '/' + objectName);
});
});
// Build plugins
if (_options.build.plugins) { | javascript | {
"resource": ""
} |
q64638 | test | function(_options, callback) {
var options = init(_options); | javascript | {
"resource": ""
} |
|
q64639 | test | function(map) {
return '(' + Object.keys(map).map(function (key) {
return key + ': | javascript | {
"resource": ""
} |
|
q64640 | objectToSass | test | function objectToSass(object) {
return Object.keys(object).map(function (key) {
return '$' + key | javascript | {
"resource": ""
} |
q64641 | parseValue | test | function parseValue(value) {
if (_.isArray(value))
return converters.list(value);
else if (_.isPlainObject(value)) | javascript | {
"resource": ""
} |
q64642 | domSafeRandomGuid | test | function domSafeRandomGuid() {
var _arguments = arguments;
var _again = true;
_function: while (_again) {
numberOfBlocks = output = num = undefined;
var s4 = function s4() {
return Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);
};
_again = false;
var numberOfBlocks = _arguments[0] === undefined ? 4 : _arguments[0];
var output = '';
var num = numberOfBlocks;
while (num > 0) {
output += s4();
| javascript | {
"resource": ""
} |
q64643 | objectProperty | test | function objectProperty (obj, indentLength = 1, inArray = 0) {
if (Object.keys(obj).length === 0) {
return ' {}';
}
let str = '\n';
const objectPrefix = getPrefix(indentLength, indentChars);
Object
.keys(obj)
.forEach((name) => {
const value = obj[name];
const type = typeOf(value);
const inArrayPrefix = getPrefix(inArray, ' ');
const afterPropsIndent = NO_INDENT_TYPES.includes(type) ? '' : ' ';
| javascript | {
"resource": ""
} |
q64644 | arrayProperty | test | function arrayProperty (values, indentLength = 1, inArray = 0) {
if (values.length === 0) {
return ' []';
}
let str = '\n';
const arrayPrefix = getPrefix(indentLength, indentChars);
values
.forEach((value) => {
const type = typeOf(value);
const inArrayPrefix = getPrefix(inArray, ' ');
const valueString = checkCircular(value) ? '[Circular]' : typifiedString(type, value, indentLength, inArray + 1) | javascript | {
"resource": ""
} |
q64645 | RESTResponse | test | function RESTResponse(url, method, body) {
/** The original request. */
this.request = {
url: url,
method: method
};
/** The body of the response. | javascript | {
"resource": ""
} |
q64646 | test | function (map, receive) {
var entries = mapEntries.call(map);
var next;
do {
next | javascript | {
"resource": ""
} |
|
q64647 | test | function(component) {
var id = component.getId();
// <debug>
if (this.map[id]) {
Ext.Logger.warn('Registering a component with a id (`' + id + '`) which has already been used. Please ensure the existing component | javascript | {
"resource": ""
} |
|
q64648 | test | function(component, defaultType) {
if (component.isComponent) {
return component;
}
else if (Ext.isString(component)) {
return Ext.createByAlias('widget.' + component);
}
else { | javascript | {
"resource": ""
} |
|
q64649 | rns | test | function rns() {
let jargv = _.$('env.jargv')
let key = _.get(jargv, '_[0]')
let prop = key ? _.get(snapptop, key) : null
if(!_.isFunction(prop)) return _.log(`\nApi.Method ${key || 'NO KEY'} not found\n`)
_.log(`\nRunnng test: ${key}\n`)
_.log(jargv)
_.log()
| javascript | {
"resource": ""
} |
q64650 | test | function (node) {
var result = '',
i, n, attr, child;
if (node.nodeType === document.TEXT_NODE) {
return node.nodeValue;
}
result += '<' + node.nodeName;
if (node.attributes.length) {
for (i = 0, n = node.attributes.length; i < n; i++) {
| javascript | {
"resource": ""
} |
|
q64651 | test | function(name, namespace) {
var dom = this.dom;
return dom.getAttributeNS(namespace, name) || dom.getAttribute(namespace + | javascript | {
"resource": ""
} |
|
q64652 | test | function (rules) {
this._instantiatedDate = new Date();
this._instanceCount = 0;
this._propertyCount = 0;
this._collatedInstances = null;
| javascript | {
"resource": ""
} |
|
q64653 | test | function(sorters, defaultDirection) {
var currentSorters = this.getSorters();
return | javascript | {
"resource": ""
} |
|
q64654 | test | function(index, sorters, defaultDirection) {
// We begin by making sure we are dealing with an array of sorters
if (!Ext.isArray(sorters)) {
sorters = [sorters];
}
var ln = sorters.length,
direction = defaultDirection || this.getDefaultSortDirection(),
sortRoot = this.getSortRoot(),
currentSorters = this.getSorters(),
newSorters = [],
sorterConfig, i, sorter, currentSorter;
if (!currentSorters) {
// This will guarantee that we get the collection
currentSorters = this.createSortersCollection();
}
// We first have to convert every sorter into a proper Sorter instance
for (i = 0; i < ln; i++) {
sorter = sorters[i];
sorterConfig = {
direction: direction,
root: sortRoot
};
// If we are dealing with a string we assume it is a property they want to sort on.
if (typeof sorter === 'string') {
currentSorter = currentSorters.get(sorter);
if (!currentSorter) {
sorterConfig.property = sorter;
} else {
if (defaultDirection) {
currentSorter.setDirection(defaultDirection);
} else {
// If we already have a sorter for this property we just toggle its direction.
currentSorter.toggle();
}
continue;
}
}
// If it is a function, we assume its a sorting function.
else if (Ext.isFunction(sorter)) {
sorterConfig.sorterFn = sorter;
}
// If we are dealing with an object, we assume its a Sorter configuration. In this case
// we create an instance of Sorter passing this configuration.
| javascript | {
"resource": ""
} |
|
q64655 | test | function(sorters) {
// We begin by making sure we are dealing with an array of sorters
if (!Ext.isArray(sorters)) {
sorters = [sorters];
}
var ln = sorters.length,
currentSorters = this.getSorters(),
i, sorter;
for (i = 0; i < ln; i++) {
sorter = sorters[i];
if (typeof sorter === 'string') {
currentSorters.removeAtKey(sorter);
}
else if (typeof sorter === 'function') {
currentSorters.each(function(item) {
| javascript | {
"resource": ""
} |
|
q64656 | test | function(items, item, sortFn, containsItem) {
var start = 0,
end = items.length - 1,
sorterFn = sortFn || this.getSortFn(),
middle,
comparison;
while (start < end || start === end && !containsItem) {
middle = (start + end) >> 1;
var middleItem = items[middle];
if (middleItem === item) {
start = middle;
break;
}
| javascript | {
"resource": ""
} |
|
q64657 | test | function(attribute, newValue) {
var input = this.input;
if (!Ext.isEmpty(newValue, true)) {
input.dom.setAttribute(attribute, newValue);
| javascript | {
"resource": ""
} |
|
q64658 | test | function() {
var el = this.input,
checked;
if (el) {
checked = el.dom.checked;
| javascript | {
"resource": ""
} |
|
q64659 | test | function() {
var me = this,
el = me.input;
if (el && el.dom.focus) {
| javascript | {
"resource": ""
} |
|
q64660 | test | function() {
var me = this,
el = this.input;
if (el && el.dom.blur) {
| javascript | {
"resource": ""
} |
|
q64661 | test | function() {
var me = this,
el = me.input;
if (el && | javascript | {
"resource": ""
} |
|
q64662 | test | function(date, format) {
if (utilDate.formatFunctions[format] == null) {
utilDate.createFormat(format);
}
var | javascript | {
"resource": ""
} |
|
q64663 | test | function(date, interval, value) {
var d = Ext.Date.clone(date);
if (!interval || value === 0) return d;
switch(interval.toLowerCase()) {
case Ext.Date.MILLI:
d= new Date(d.valueOf() + value);
break;
case Ext.Date.SECOND:
d= new Date(d.valueOf() + value * 1000);
break;
case Ext.Date.MINUTE:
d= new Date(d.valueOf() + value * 60000);
break;
case Ext.Date.HOUR:
d= new Date(d.valueOf() + value * 3600000);
break;
case Ext.Date.DAY:
d= new Date(d.valueOf() + value * 86400000);
break;
case Ext.Date.MONTH:
var day = date.getDate();
| javascript | {
"resource": ""
} |
|
q64664 | test | function (min, max, unit) {
var ExtDate = Ext.Date, est, diff = +max - min;
switch (unit) {
case ExtDate.MILLI:
return diff;
case ExtDate.SECOND:
return Math.floor(diff / 1000);
case ExtDate.MINUTE:
return Math.floor(diff / 60000);
case ExtDate.HOUR:
return Math.floor(diff / 3600000);
case ExtDate.DAY:
return Math.floor(diff / 86400000);
| javascript | {
"resource": ""
} |
|
q64665 | test | function (date, unit, step) {
var num = new Date(+date);
switch (unit.toLowerCase()) {
case Ext.Date.MILLI:
return num;
break;
case Ext.Date.SECOND:
num.setUTCSeconds(num.getUTCSeconds() - num.getUTCSeconds() % step);
num.setUTCMilliseconds(0);
return num;
break;
case Ext.Date.MINUTE:
num.setUTCMinutes(num.getUTCMinutes() - num.getUTCMinutes() % step);
num.setUTCSeconds(0);
num.setUTCMilliseconds(0);
return num;
break;
case Ext.Date.HOUR:
num.setUTCHours(num.getUTCHours() - num.getUTCHours() % step);
num.setUTCMinutes(0);
| javascript | {
"resource": ""
} |
|
q64666 | getOptions | test | function getOptions(messageType) {
const options = Object.assign({}, _defaults);
if (messageType in _options) {
| javascript | {
"resource": ""
} |
q64667 | parse | test | function parse(messageType, args) {
const options = getOptions(messageType);
/** Interpreter */
if (typeof options.interpreter === "function") {
for (const index in args) {
/** Let string be without additional ' ' */
if (typeof args[index] === "string") {
continue;
}
args[index] = options.interpreter(args[index]);
}
}
/** Label */
| javascript | {
"resource": ""
} |
q64668 | stdout | test | function stdout(messageType) {
return (...args) => {
const options = getOptions(messageType);
let message = parse(messageType, args);
/** Add trace to console.trace */
if (messageType === "trace") {
message += `\n${getTrace()}`;
}
/** Stdout to console */
if (!options.fileOnly) {
_console.log(message);
| javascript | {
"resource": ""
} |
q64669 | assignOptions | test | function assignOptions(defaults, userDefined) {
for (const optionKey in userDefined) {
if (defaults.hasOwnProperty(optionKey)) {
defaults[optionKey] = userDefined[optionKey];
}
| javascript | {
"resource": ""
} |
q64670 | test | function (pagesPath, allPartials) {
if (options.verbose) {
grunt.log.writeln('- using pages path: %s', pagesPath);
}
var allPages = {};
// load fileGlobals from file in [src]/globals.json
if (grunt.file.exists(options.src + '/globals.json')) {
fileGlobals = grunt.file.readJSON(options.src + '/globals.json');
gruntGlobals = mergeObj(gruntGlobals, fileGlobals);
}
// for all files in dir
grunt.file.recurse(pagesPath, function (absPath, rootDir, subDir, fileName) {
// file extension does not match - ignore
if (!fileName.match(tplMatcher)) {
if (options.verbose) {
grunt.log.writeln('-- ignoring file: %s', fileName);
}
return;
}
var pageName = absPath.replace(rootDir, '').replace(tplMatcher, '').substring(1),
pageSrc = grunt.file.read(absPath),
pageJson = {},
dataPath = absPath.replace(tplMatcher, '.json'),
compiledPage = Hogan.compile(pageSrc); | javascript | {
"resource": ""
} |
|
q64671 | test | function(result) {
// Write result to file if it was opened
if (fd && result.slice(0, 3) !== '[D]' && result.match(/\u001b\[/g) === null) {
fs.writeSync(fd, result);
}
| javascript | {
"resource": ""
} |
|
q64672 | test | function(cb, param) {
return function() {
var args = Array.prototype.slice.call(arguments, 1);
if(typeof param !== 'undefined') {
| javascript | {
"resource": ""
} |
|
q64673 | test | function(callback) {
if (tunnel) {
return callback(null);
}
grunt.log.debug('checking if selenium is running');
var options = {
host: capabilities.host || 'localhost',
port: capabilities.port || 4444,
path: '/wd/hub/status'
};
http.get(options, function() {
| javascript | {
"resource": ""
} |
|
q64674 | test | function(callback) {
if (tunnel || isSeleniumServerRunning) {
return callback(null);
}
grunt.log.debug('installing driver if needed');
| javascript | {
"resource": ""
} |
|
q64675 | test | function() {
var callback = arguments[arguments.length - 1];
grunt.log.debug('init WebdriverIO instance');
GLOBAL.browser.init(function(err) {
/**
| javascript | {
"resource": ""
} |
|
q64676 | test | function(callback) {
grunt.log.debug('run mocha tests');
/**
* save session ID
*/
| javascript | {
"resource": ""
} |
|
q64677 | test | function(result, callback) {
grunt.log.debug('end selenium session');
// Restore grunt exception handling
unmanageExceptions();
// | javascript | {
"resource": ""
} |
|
q64678 | test | function(result) {
var callback = arguments[arguments.length - 1];
if (!options.user && !options.key && !options.updateSauceJob) {
return callback(null, result);
}
grunt.log.debug('update job on Sauce Labs');
var sauceAccount = new SauceLabs({
username: options.user,
password: options.key
| javascript | {
"resource": ""
} |
|
q64679 | test | function(result) {
var callback = arguments[arguments.length - 1];
grunt.log.debug('finish grunt task');
if (isLastTask) {
// close the file if it was opened
if (fd) {
fs.closeSync(fd);
}
| javascript | {
"resource": ""
} |
|
q64680 | render | test | function render (req, res, body) {
var response = {};
var parsedURL = parseURL(req.url);
// Append URL properties
for (var prop in parsedURL)
response[prop] = parsedURL[prop];
// Append select `req` properties
['method', 'url'].forEach(function (prop) {
response[prop] = req[prop];
| javascript | {
"resource": ""
} |
q64681 | test | function (val, key) {
const optVal = _M._option.getIn(key);
//check for init key match
if (optVal !== null) {
if (_.isObject(optVal)) {
//merge in option to the defaults
_M._option.mergeIn(key, _.defaultsDeep(val, _M._option.getIn(key)));
| javascript | {
"resource": ""
} |
|
q64682 | test | function (optionObj) {
//@hacky fix for #388
if (_.hasIn(optionObj, ['transitionDefault'])) {
_M._option.updateTransDefault(optionObj.transitionDefault);
delete optionObj.transitionDefault;
}
//cycle to | javascript | {
"resource": ""
} |
|
q64683 | test | function (key, keyType, funk, passKey = true) {
//test from list, check out the util
if (_H.util.regularExp.keyTest(key, keyType)) {
//checks for use key
const data = self.doNotUse(objectArgs.get(key), keyType);
| javascript | {
"resource": ""
} |
|
q64684 | test | function (sourceObj) {
//processing object - loop de loop
for (const property in sourceObj) {
if (sourceObj.hasOwnProperty(property)) {
if (_.isPlainObject(sourceObj[property])) {
const use = _.get(sourceObj[property], 'use');
if (useIsFalse(use)) {
sourceObj = _.omit(sourceObj, property);
}else {
if (useIsTrue(use)) {
| javascript | {
"resource": ""
} |
|
q64685 | add | test | function add(reducers, scope, defaultState) {
if (scope === undefined) scope = "general";
// Add combine reducer
_combines[scope] !== undefined || defineReducer(scope);
// Add data
var scopeReducers = _reducers[scope] || {};
for (var type in reducers) {
var reducer = reducers[type];
if (typeof reducer === 'function') {
if (scopeReducers[type] === undefined) {
| javascript | {
"resource": ""
} |
q64686 | remove | test | function remove(scope, type) {
if (scope === undefined) scope = "general";
if (type === undefined) {
delete _combines[scope]; | javascript | {
"resource": ""
} |
q64687 | replace | test | function replace(reducers, scope, defaultState) {
remove(scope); | javascript | {
"resource": ""
} |
q64688 | toInteger | test | function toInteger(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
| javascript | {
"resource": ""
} |
q64689 | writeError | test | function writeError(type, file, line, message) {
if (!messages[type]) {
messages[type] = [];
}
messages[type].push({
type | javascript | {
"resource": ""
} |
q64690 | flushMessages | test | function flushMessages() {
Object.keys(messages)
.forEach(function(type) {
messages[type].forEach(function(msg) {
writeLine(msg.type + " error: | javascript | {
"resource": ""
} |
q64691 | getConfig | test | function getConfig(file) {
var config = {},
subConfig;
try {
config = JSON.parse(fs.readFileSync(file, "utf8"));
if (config.extends) {
subConfig = JSON.parse(fs.readFileSync(config.extends, "utf8"));
| javascript | {
"resource": ""
} |
q64692 | isIgnored | test | function isIgnored(file) {
return ignorePatterns.some(function(pattern) {
return minimatch(file, pattern, {
| javascript | {
"resource": ""
} |
q64693 | extractStyles | test | function extractStyles(src) {
var isInBlock = false,
lines = [];
src.replace(/\r/g, "").split("\n").forEach(function(l) {
// we're at the end of the style tag
if (l.indexOf("</style") > -1) {
lines[lines.length] = "";
isInBlock = false;
return;
}
if (isInBlock) {
lines[lines.length] = l;
} else | javascript | {
"resource": ""
} |
q64694 | read | test | function read() {
var filename = process.argv[2],
src = fs.readFileSync(process.argv[3], "utf8");
// attempt to modify any src passing through the pre-commit hook
try {
src = require(path.join(process.cwd(), | javascript | {
"resource": ""
} |
q64695 | loadFileCheckerPlugins | test | function loadFileCheckerPlugins() {
var checkers = {};
try {
fs.readdirSync(path.join(process.cwd(), ".git-hooks/pre-commit-plugins/plugins"))
.forEach(function(file) {
| javascript | {
"resource": ""
} |
q64696 | test | function(oldName, newName, prefix, suffix) {
if (!oldName && !newName) {
return this;
}
oldName = oldName || [];
newName = newName || [];
if (!this.isSynchronized) {
this.synchronize();
}
if (!suffix) {
suffix = '';
}
var dom = this.dom,
map = this.hasClassMap,
classList = this.classList,
SEPARATOR = this.SEPARATOR,
i, ln, name;
prefix = prefix ? prefix + SEPARATOR : '';
suffix = suffix ? SEPARATOR + suffix : '';
if (typeof oldName == 'string') {
oldName = oldName.split(this.spacesRe);
}
if (typeof newName == 'string') {
newName = newName.split(this.spacesRe);
}
for (i = 0, ln = oldName.length; i < ln; i++) {
name = prefix + oldName[i] + suffix;
| javascript | {
"resource": ""
} |
|
q64697 | test | function(className) {
var map = this.hasClassMap,
i, ln, name;
if (typeof className == 'string') {
className = className.split(this.spacesRe);
}
| javascript | {
"resource": ""
} |
|
q64698 | test | function(width, height) {
if (Ext.isObject(width)) {
// in case of object from getSize()
height = width.height;
width = width.width;
| javascript | {
"resource": ""
} |
|
q64699 | test | function(prop) {
var me = this,
dom = me.dom,
hook = me.styleHooks[prop],
cs, result;
if (dom == document) {
return null;
}
if (!hook) {
me.styleHooks[prop] = hook = { name: Ext.dom.Element.normalize(prop) };
}
if (hook.get) {
return hook.get(dom, me);
}
cs = window.getComputedStyle(dom, '');
// why the dom.style lookup? It is not true that "style == computedStyle" as
// well as the fact that 0/false are valid answers...
result | javascript | {
"resource": ""
} |