_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q13500 | Schema | train | function Schema(config, data) {
const controllers = data.controllers;
const length = controllers.length;
this.FullyTyped = FullyTyped;
// apply controllers to this schema
for (let i = 0; i < length; i++) controllers[i].call(this, config);
// add additional properties
if (config._extension... | javascript | {
"resource": ""
} |
q13501 | build | train | function build(base, config) {
var result = resolver(base);
Object.keys(config).forEach(function (key) {
var value = config[key];
if (typeof value === "string") {
result[key] = resolver(result(value, true));
} else if (Array.isArray(value) && value.length === 2 &&
typeof value[0] === "stri... | javascript | {
"resource": ""
} |
q13502 | populateApiFromInterface | train | function populateApiFromInterface(api, iface) {
Object.keys(iface).forEach(function | javascript | {
"resource": ""
} |
q13503 | router | train | function router(rpc, handlers, req, res) {
var $ = rpc.$;
var api = rpc.api;
var request = api.handle(req.method, req.url);
var dom = domain.create();
// the request handler doesn't exit
// TODO: hoist response logic
if (!request) {
res.statusCode = 404;
res.end();
return;
}
... | javascript | {
"resource": ""
} |
q13504 | addSimpleMethod | train | function addSimpleMethod(name, msg, failureIsError) {
LockdClient.prototype[name] = function(objName, cb) {
var self = this;
self.transport.request(util.format(msg, objName), 1, function(err, lines) {
| javascript | {
"resource": ""
} |
q13505 | runSingleBrowser | train | function runSingleBrowser(location, remote, platform, options) {
var capabilities = {};
Object.keys(platform).forEach(function (key) {
capabilities[key] = platform[key];
});
var extraCapabilities = typeof options.capabilities === 'function' ?
options.capabilities(platform) :
(options.capabilitie... | javascript | {
"resource": ""
} |
q13506 | Cache | train | function Cache (cache, options) {
if (arguments.length === 1) {
if (cache.hasOwnProperty('normalizeKey') || cache.hasOwnProperty('transform')) {
options = cache;
cache = {};
}
}
options = options || {};
this.cache = cache || {};
this.normalizeKey | javascript | {
"resource": ""
} |
q13507 | train | function(attrs) {
attrs = attrs || {};
attrs.state = attrs.state || {};
// Build our class name
var cName = cfgClasses("mdl-button--", ["raised", "fab", "mini-fab", "icon", "colored", "primary", "accent"], attrs.state) +
| javascript | {
"resource": ""
} | |
q13508 | train | function(ctrl, attrs) {
attrs = mButton.attrs(attrs);
// If there is a href, we assume this is a link button
return m(attrs.cfg.href? 'a': 'button', attrExclude(attrs.cfg, ['text']),
| javascript | {
"resource": ""
} | |
q13509 | train | function(attrs) {
attrs = attrs || {};
attrs.state = attrs.state || {};
return attrsConfig({
| javascript | {
"resource": ""
} | |
q13510 | tlid__xtro | train | function
tlid__xtro(str) {
var r = new Object();
r.tlid = "-1";
r.src = str;
r.txt = "";
// r.deco = "";
if (tlid__has(str)) {
r.tlid = tlid__xtr(str);
r.txt = str.replace(r.tlid + " ", "") // try to clear out the double | javascript | {
"resource": ""
} |
q13511 | train | function (obj, fn) {
for (var i in obj) {
if (typeof obj[i] === 'object') {
obj[i] = parse(obj[i], fn);
} else {
| javascript | {
"resource": ""
} | |
q13512 | changeKeys | train | function changeKeys (src, dest) {
for (var i in src) {
if (typeof src[i] === 'object') {
dest[escapedSingleQuotes + i +
escapedSingleQuotes] = {};
changeKeys(src[i], dest[escapedSingleQuotes + i +
... | javascript | {
"resource": ""
} |
q13513 | errorsMiddleware | train | function errorsMiddleware(req, res, next) {
var errors = [];
res.addError = function(location, name, description) {
if (["body", "header", "url", "querystring"].indexOf(location) === -1) {
throw new Error('"' + location + '" is not a valid location. ' +
'Should be one of "header", "b... | javascript | {
"resource": ""
} |
q13514 | train | function (internalInstance, transaction, updateBatchNumber) {
if (internalInstance._updateBatchNumber !== updateBatchNumber) {
// The component's enqueued batch number should always be the current
// batch or the following one.
process.env.NODE_ENV !== 'production' ? warning(internalInstance._upda... | javascript | {
"resource": ""
} | |
q13515 | train | function (publicInstance, completeState, callback) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
}
internalInstance._pendingStateQueue = [completeState];
internalInstance._pendingReplaceState = true;
// Futur... | javascript | {
"resource": ""
} | |
q13516 | cps | train | function cps(fun) {
/**
* @param {...*} args
* @param {Function} callback
*/
return function () {
var args = Array.prototype.slice.call(arguments);
var callback = args.pop();
var result;
| javascript | {
"resource": ""
} |
q13517 | setIceServers | train | function setIceServers()
{
if(stunServers)
{
for(var num = 0; num < stunServers.length; num++)
{
| javascript | {
"resource": ""
} |
q13518 | iceCandidateCallback | train | function iceCandidateCallback(e)
{
if(e.candidate != null)
{
if(scope.onIceCandidate)
{
| javascript | {
"resource": ""
} |
q13519 | onStateChange | train | function onStateChange(e)
{
if(scope._conn)
{
if(scope._conn.iceConnectionState == "connected")
{
if(scope.onConnected)
{
scope.onConnected(scope);
}
}
if(scope._conn.iceConnectionStat... | javascript | {
"resource": ""
} |
q13520 | remoteStreamCallback | train | function remoteStreamCallback(e)
{
scope.remoteStream = e.stream;
if(scope.onRemoteStream)
{ | javascript | {
"resource": ""
} |
q13521 | ondatachannel | train | function ondatachannel(e)
{
if(e)
{
scope._data = e.channel;
}
else
{
scope._data = scope._conn.createDataChannel("data");
}
scope._data.onopen = function()
{
if(scope._data)
{
if(scope._... | javascript | {
"resource": ""
} |
q13522 | expandSmartyPathAttr | train | function expandSmartyPathAttr(content, tagName, attrName, file) {
var attrReg = new RegExp('((?:^|\\s)' +
her.util.pregQuote(attrName) +
'\\s*=\\s*)(([\"\']).*?\\3)', 'ig');
content = tagFilter.filterTag(content,
tagName, smarty_left_delimiter, smarty_right_delimiter,
function (outter, attr... | javascript | {
"resource": ""
} |
q13523 | deserializeParameter | train | function deserializeParameter(server, name, value, schema) {
if (!schema) return value;
const type = schemaType(schema);
if (!type) server.log('req-params', 'Indeterminate schema type for parameter ' + name, schema);
if (type === 'array') {
const format = schema.hasOwnProperty('collectionForma... | javascript | {
"resource": ""
} |
q13524 | schemaType | train | function schemaType(schema) {
let type;
if (schema.hasOwnProperty('type')) {
type = schema.type;
} else if (schema.hasOwnProperty('properties') || schema.hasOwnProperty('allOf') || schema.hasOwnProperty('additionalProperties')) {
type = 'object';
} else if (schema.hasOwnProperty('items')... | javascript | {
"resource": ""
} |
q13525 | ObjectId | train | function ObjectId(bytes) {
if (Buffer.isBuffer(bytes)) {
if (bytes.length != 12) throw new Error("Buffer-based ObjectId must be 12 bytes")
this.bytes = bytes
} else if (typeof bytes == 'string') {
if (bytes.length != 24) throw new Error("String-based ObjectId must be 24 bytes")
i... | javascript | {
"resource": ""
} |
q13526 | train | function( path ) {
var parts = path.split( rpathsplit ), ns = munit.ns, assert;
// Grep for nested path module
munit.each( parts, function( part ) {
if ( assert = ns[ part ] ) {
ns = assert.ns;
}
else {
throw | javascript | {
"resource": ""
} | |
q13527 | train | function( name, options, callback ) {
var ns = munit.ns,
parts = name.split( rpathsplit ),
finalPart = parts.pop(),
opts = munit.extend( true, {}, munit.defaults.settings ),
assert = null,
path = '';
// Filter through all parents
parts.forEach(function( mod ) {
// Update the path
if ( path.l... | javascript | {
"resource": ""
} | |
q13528 | train | function( name, depends, callback ) {
if ( ( ! munit.isString( depends ) && ! munit.isArray( depends ) | javascript | {
"resource": ""
} | |
q13529 | train | function( name, handle ) {
if ( munit.isObject( name ) ) {
return munit.each( name, function( fn, method ) {
munit.custom( method, fn );
});
}
// Ensure that name can be used
if ( munit.customReserved.indexOf( name ) > -1 ) {
throw new Error( "'" + name + "' is a reserved name and cannot be added ... | javascript | {
"resource": ""
} | |
q13530 | train | function( time ) {
var h, m, s;
if ( time > TIME_MINUTE ) {
m = parseInt( time / TIME_MINUTE, 10 );
s = ( time % TIME_MINUTE ) / TIME_SECOND;
return m + 'mins, ' + s + 's';
| javascript | {
"resource": ""
} | |
q13531 | train | function( string ) {
return ( string || '' ).replace( ramp, "&" )
.replace( rquote, """ )
.replace( rsquote, "'" | javascript | {
"resource": ""
} | |
q13532 | train | function( code, e, message ) {
var callback = munit.render.callback;
// Force a numeric code for the first parameter
if ( ! munit.isNumber( code ) ) {
throw new Error( "Numeric code parameter required for munit.exit" );
}
// Allow code, message only arguments
if ( message === undefined && munit.isStrin... | javascript | {
"resource": ""
} | |
q13533 | AssertionError | train | function AssertionError( message, startFunc ) {
var self = this;
self.name = 'Assertion Error';
self.message = message;
| javascript | {
"resource": ""
} |
q13534 | buildFromString | train | function buildFromString({ declaration, name, mapActionType }) {
if (typeof declaration === 'string') {
return arg => ({
type: | javascript | {
"resource": ""
} |
q13535 | buildFromArray | train | function buildFromArray({ declaration, name, mapActionType }) {
if (Array.isArray(declaration)) {
return (...args) => declaration.reduce(
(result, key, index) => Object.assign(
| javascript | {
"resource": ""
} |
q13536 | buildFromObject | train | function buildFromObject({ declaration, name, mapActionType }) {
if (typeof declaration === 'object') {
return () | javascript | {
"resource": ""
} |
q13537 | train | function () {
var html = template();
var div = document.createElement('div');
div.innerHTML = html.trim();
var searchBar = this.applySearcbarEvents(div.firstChild);
| javascript | {
"resource": ""
} | |
q13538 | train | function (searchbar) {
var that = this;
var button = searchbar.querySelector('button[type=submit]');
var search = searchbar.querySelector('input[type=search]');
if (typeof button === 'undefined') {
return searchbar;
| javascript | {
"resource": ""
} | |
q13539 | render | train | function render(code, data) {
var js = '```js' + code + '```'
return `<div class="vomit-snippet"><div class="column">${marked(js)}</div><div class="column"><script>
(function() | javascript | {
"resource": ""
} |
q13540 | route | train | function route(name, titleToken, options) {
var path, match;
if (name instanceof RouteMeta) {
return name;
}
if (name) {
match = name.match(/^([^@]+)(?:@(.*))?$/);
name = match[1];
path = match[2];
if (path === undefined) {
path = name === 'index' ? '/' : name;
}
else if (path ... | javascript | {
"resource": ""
} |
q13541 | train | function (target) {
if (this.get('isResource') && !this.get('indexChild')) {
// add index route if it does not exist
this._route('index');
}
this.get('children').forEach(function (meta) {
var args, methodName, isResource;
args = [meta.get('name'), {path: meta.get('path')}];
met... | javascript | {
"resource": ""
} | |
q13542 | train | function (name, titleToken, options) {
var child;
if (!this.get('isResource')) {
this.set('isResource', true);
}
child = route(name, titleToken, options, this);
| javascript | {
"resource": ""
} | |
q13543 | train | function () {
var routes = Array.prototype.slice.call(arguments);
if (routes.length) {
Ember.A(routes).forEach(function (child) {
this._route(child);
}, this);
}
else {
| javascript | {
"resource": ""
} | |
q13544 | train | function (options) {
var Router, args;
if (this.get('parent')) {
throw new Error('Only the root route may be exported as an Ember router.');
}
args = slice.call(arguments);
if (!args.length || args[args.length - 1] instanceof Ember.Mixin) {
args.push(options = {});
}
else {
... | javascript | {
"resource": ""
} | |
q13545 | fuf | train | function fuf(target, source, options = {}) {
return new Promise((resolve, reject) => {
if (!target) {
return reject(new Error('the target path is required'))
}
if (!source) {
return reject(new Error('the source path is required'))
}
if (options && MATCHES.indexOf(options.match) ==... | javascript | {
"resource": ""
} |
q13546 | pglob | train | function pglob(pattern, options) {
return new Promise((resolve, reject) => {
glob(pattern, options, (error, files) => {
if (error) {
| javascript | {
"resource": ""
} |
q13547 | chrootSpawn | train | function chrootSpawn(command, argv, opts, callback)
{
argv = [opts.uid, opts.gid, command].concat(argv)
const options =
{
cwd: opts.cwd,
env: opts.env, | javascript | {
"resource": ""
} |
q13548 | mkdirMountInfo | train | function mkdirMountInfo(info, callback)
{
utils.mkdirMount(info.path, | javascript | {
"resource": ""
} |
q13549 | create | train | function create(upperdir, callback)
{
var workdir = upperdir.split('/')
var user = workdir.pop()
var workdir = workdir.join('/')+'/.workdirs/'+user
mkdirp(workdir, '0100', function(error)
{
if(error && error.code !== 'EEXIST') return callback(error)
// Craft overlayed filesystem
var type = ... | javascript | {
"resource": ""
} |
q13550 | clas | train | function clas(elem, className) {
/**
* @param {boolean} [val]
* @returns {boolean|undefined}
*/
return function() {
if (arguments.length) {
| javascript | {
"resource": ""
} |
q13551 | formatStr | train | function formatStr(str, values) {
values = values || {};
if (typeof str !== 'string') {
return str;
}
| javascript | {
"resource": ""
} |
q13552 | train | function( keyCode, strokesPerSnapshotExceeded ) {
var keyGroup = UndoManager.getKeyGroup( keyCode ),
// Count of keystrokes in current a row.
// Note if strokesPerSnapshotExceeded will be exceeded, it'll be restarted.
strokesRecorded = this.strokesRecorded[ keyGroup ] + 1;
strokesPerSnapshotExc... | javascript | {
"resource": ""
} | |
q13553 | train | function() {
// Stack for all the undo and redo snapshots, they're always created/removed
// in consistency.
this.snapshots = [];
// Current snapshot history index.
this.index = -1;
| javascript | {
"resource": ""
} | |
q13554 | train | function( onContentOnly, image, autoFireChange ) {
var editor = this.editor;
// Do not change snapshots stack when locked, editor is not ready,
// editable is not ready or when editor is in mode difference than 'wysiwyg'.
if ( this.locked || editor.status != 'ready' || editor.mode != 'wysiwyg' )
re... | javascript | {
"resource": ""
} | |
q13555 | train | function( isUndo ) {
var snapshots = this.snapshots,
currentImage = this.currentImage,
image, i;
if ( currentImage ) {
if ( isUndo ) {
for ( i = this.index - 1; i >= 0; i-- ) {
image = snapshots[ i ];
if ( !currentImage.equalsContent( image ) ) {
image.index = i;
... | javascript | {
"resource": ""
} | |
q13556 | train | function( newImage ) {
// Do not change snapshots stack is locked.
if ( this.locked )
return;
if ( !newImage )
newImage = new Image( this.editor );
var i = this.index,
snapshots = this.snapshots;
// Find all previous snapshots made for the same content (which differ
// only ... | javascript | {
"resource": ""
} | |
q13557 | train | function() {
if ( this.locked ) {
// Decrease level of lock and check if equals 0, what means that undoM is completely unlocked.
if ( !--this.locked.level ) {
var update = this.locked.update;
this.locked = null;
// forceUpdate was passed to lock().
if ( update === true )
... | javascript | {
"resource": ""
} | |
q13558 | onTypingStart | train | function onTypingStart( undoManager ) {
// It's safe to now indicate typing state.
undoManager.typing = true;
// Manually mark snapshot | javascript | {
"resource": ""
} |
q13559 | train | function( evt ) {
// Block undo/redo keystrokes when at the bottom/top of the undo stack (#11126 and #11677).
if ( CKEDITOR.tools.indexOf( keystrokes, evt.data.getKeystroke() ) > -1 ) {
evt.data.preventDefault();
return;
}
// Cleaning tab functional keys.
this.keyEventsStack.cleanUp( evt... | javascript | {
"resource": ""
} | |
q13560 | train | function() {
// Input event is ignored if paste/drop event were fired before.
if ( this.ignoreInputEvent ) {
// Reset flag - ignore only once.
this.ignoreInputEvent = false;
return;
}
var lastInput = this.keyEventsStack.getLast();
// Nothing in key events stack, but input event call... | javascript | {
"resource": ""
} | |
q13561 | train | function( evt ) {
var undoManager = this.undoManager,
keyCode = evt.data.getKey(),
totalInputs = this.keyEventsStack.getTotalInputs();
// Remove record from stack for provided key code.
this.keyEventsStack.remove( keyCode );
// Second part of the workaround for IEs functional keys bug. We ... | javascript | {
"resource": ""
} | |
q13562 | train | function( skipContentCompare ) {
var undoManager = this.undoManager;
// We attempt to save content snapshot, if content didn't change, we'll
// only amend selection.
if ( skipContentCompare || !undoManager.save( true, null, | javascript | {
"resource": ""
} | |
q13563 | train | function() {
var editor = this.undoManager.editor,
editable = editor.editable(),
that = this;
// We'll create a snapshot here (before DOM modification), because we'll
// need unmodified content when we got keygroup toggled in keyup.
editable.attachListener( editable, 'keydown', function( evt... | javascript | {
"resource": ""
} | |
q13564 | train | function( keyCode ) {
if ( typeof keyCode != 'number' ) {
return this.stack.length - 1; // Last index or -1.
} else {
var i = this.stack.length;
| javascript | {
"resource": ""
} | |
q13565 | train | function( keyCode ) {
if ( typeof keyCode == 'number' ) {
var last = this.getLast( keyCode );
if ( !last ) { // %REMOVE_LINE%
throw new Error( 'Trying to reset inputs count, but could not found by keyCode: ' + keyCode + '.' ); // %REMOVE_LINE%
| javascript | {
"resource": ""
} | |
q13566 | train | function() {
var i = this.stack.length,
total = 0;
| javascript | {
"resource": ""
} | |
q13567 | train | function () {
$.fn.mediumInsert.settings.enabled = false;
| javascript | {
"resource": ""
} | |
q13568 | train | function () {
$.fn.mediumInsert.settings.enabled = true;
| javascript | {
"resource": ""
} | |
q13569 | train | function (addon) {
var editor = $.fn.mediumInsert.settings.editor,
buttonLabels = (editor && editor.options) ? editor.options.buttonLabels : '';
var buttons;
if($.fn.mediumInsert.settings.enabled) {
buttons = '<div class="mediumInsert-buttons">'+
'<a class="mediumInsert-buttonsShow">+</a>'+
... | javascript | {
"resource": ""
} | |
q13570 | update | train | function update(item, model, data, funcParams) {
var working = [];
var definedByData = [];
_.forEach(data, function(value, key) {
if (_.isFunction(value)) {
working.push(Promise.resolve(value()).then(function(val) {
item[key] = val;
}));
} else item[k... | javascript | {
"resource": ""
} |
q13571 | serverProperties | train | function serverProperties(item, model, props) {
var result = {};
var toRefresh = [];
_.forEach(props || item, function(val, key) {
if (val == null) return;
if (val._isModelItem) {
result[key] = val.id;
toRefresh.push(val);
} else if (_.isArray(val)) {
... | javascript | {
"resource": ""
} |
q13572 | create | train | function create(item, model, data) {
var serverProps = serverProperties(item, model, data).properties;
return utils.socketPut(model.io, model.url + '/create/', serverProps).then(function(response) {
_.merge(serverProps, response);
return update(item, model, serverProps);
}).then(function() {... | javascript | {
"resource": ""
} |
q13573 | modelItem | train | function modelItem(data, model) {
var res = {};
utils.defineProperties(res, {
_isModelItem: { value: true },
model: { value: model.value },
update: { value: function(data, sync) {
if (sync == null) sync = true;
return update(res, model, data).then(function() {... | javascript | {
"resource": ""
} |
q13574 | train | function(name, opt_path) {
var path = opt_path || "/";
/**
* Sets the cookie
* @param {string} value value for cookie
* @param {number?} opt_days number of days until cookie
* expires. Default = none
*/
this.set = function(value, opt_days) {
if (value === undefined) {
... | javascript | {
"resource": ""
} | |
q13575 | SimpleLogger | train | function SimpleLogger() {
/* This class is a singleton */
if (arguments.callee._singletonInstance) {
return arguments.callee._singletonInstance;
}
arguments.callee._singletonInstance = this;
EventEmitter.call(this);
// First, some basic loglevels. These can be overridden b... | javascript | {
"resource": ""
} |
q13576 | activate | train | function activate () {
if (_active) return node
_active = true
debug('activated')
if (!external) {
_masterBroker.bind()
| javascript | {
"resource": ""
} |
q13577 | deactivate | train | function deactivate () {
if (!_active || _deactivating) return node
debug('deactivating')
if (external) {
_active = false
_subConnection.disconnect()
_pubConnection.disconnect()
node.emit('deactivated')
} else {
_deactivating = true
let ensuredMaster = Promise.resolv... | javascript | {
"resource": ""
} |
q13578 | publish | train | function publish (channel, ...args) {
if (!isString(channel)) throw new TypeError(`${_debugStr}: .publish(channel, [...args]) channel MUST be a string`)
if (~internalChannels.indexOf(channel)) {
| javascript | {
"resource": ""
} |
q13579 | unsubscribe | train | function unsubscribe (channels) {
if (!isArray(channels)) channels = [channels]
if (!every(channels, isString)) throw new TypeError(`${_debugStr}: .unsubscribe([channels]) channels must be represented by strings`)
channels.forEach(channel => {
if (~internalChannels.indexOf(channel)) | javascript | {
"resource": ""
} |
q13580 | _validateSettings | train | function _validateSettings (settings) {
let {
host,
external,
voteTimeout,
electionPriority,
coordinationPort
} = settings
if (!host || !isString(host)) throw new TypeError(ctorMessage('host is mandatory and should be a string.'))
if (!isInteger(coordinationPort) || coordinationPort <= 0) ... | javascript | {
"resource": ""
} |
q13581 | findAll | train | function findAll (tree, test) {
var found = test(tree) ? [tree] : []
if (isNode(tree)) {
if (tree.children.length > 0) {
tree.children.forEach(function (child) {
| javascript | {
"resource": ""
} |
q13582 | quote | train | function quote(string) {
var _Object$assign
var quoteChar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '"'
if (quoteChar.length > 1 && process.env.NODE_ENV !== 'production') {
console.error('quote: `quoteChar` is | javascript | {
"resource": ""
} |
q13583 | cloneValue | train | function cloneValue(value, traversedValues) {
if (!(value instanceof Object)) {
return value
}
if (value instanceof Boolean) {
return new Boolean(value.valueOf())
}
if (value instanceof Number) {
return new Number(value.valueOf())
}
if (value instanceof String) {
return new String(v... | javascript | {
"resource": ""
} |
q13584 | cloneArray | train | function cloneArray(source, traversedValues) {
let clone = []
traversedValues.set(source, clone)
cloneStructure(
source.keys(),
key => source[key], | javascript | {
"resource": ""
} |
q13585 | cloneMap | train | function cloneMap(source, traversedValues) {
let clone = new Map()
traversedValues.set(source, clone)
cloneStructure(
source.keys(),
key => source.get(key), | javascript | {
"resource": ""
} |
q13586 | cloneSet | train | function cloneSet(source, traversedValues) {
let clone = new Set()
traversedValues.set(source, clone)
cloneStructure(
source.values(),
entry => | javascript | {
"resource": ""
} |
q13587 | cloneObject | train | function cloneObject(source, traversedValues) {
let clone = {}
traversedValues.set(source, clone)
cloneStructure(
Object.keys(source),
key => source[key],
| javascript | {
"resource": ""
} |
q13588 | cloneStructure | train | function cloneStructure(keys, getter, setter, traversedValues) {
for (let key of keys) {
let value = getter(key)
let keyClone
if (key instanceof Object) {
if (traversedValues.has(key)) {
keyClone = traversedValues.get(key)
} else {
keyClone = cloneValue(key, traversedValue... | javascript | {
"resource": ""
} |
q13589 | getStagedFiles | train | function getStagedFiles(callback) {
const options = [ 'diff', '--cached', '--name-only', '--diff-filter=ACM' ]
execFile('git', options, (err, stdout) => {
if (err) return callback(err)
const stagedFiles = stdout
| javascript | {
"resource": ""
} |
q13590 | lintFiles | train | function lintFiles(files) {
const eslint = new CLIEngine()
const report = eslint.executeOnFiles(files)
| javascript | {
"resource": ""
} |
q13591 | isSupportedElement | train | function isSupportedElement( element, mode ) {
if ( mode == CKEDITOR.ELEMENT_MODE_INLINE )
return element.is( CKEDITOR.dtd.$editable ) || element.is( 'textarea' );
else if | javascript | {
"resource": ""
} |
q13592 | initComponents | train | function initComponents( editor ) {
// Documented in dataprocessor.js.
editor.dataProcessor = new CKEDITOR.htmlDataProcessor( editor | javascript | {
"resource": ""
} |
q13593 | updateEditorElement | train | function updateEditorElement() {
var element = this.element;
// Some editor creation mode will not have the
// associated element.
if ( element && this.elementMode != CKEDITOR.ELEMENT_MODE_APPENDTO ) {
var data = this.getData();
if ( this.config.htmlEncodeOutput )
| javascript | {
"resource": ""
} |
q13594 | train | function( commandName, data ) {
var command = this.getCommand( commandName );
var eventData = {
name: commandName,
commandData: data,
command: command
};
if ( command && command.state != CKEDITOR.TRISTATE_DISABLED ) {
if ( this.fire( 'beforeCommandExec', eventData ) !== false ) {
even... | javascript | {
"resource": ""
} | |
q13595 | train | function() {
var keystrokes = this.keystrokeHandler.keystrokes,
newKeystrokes = CKEDITOR.tools.isArray( arguments[ 0 ] ) ? arguments[ 0 ] : [ [].slice.call( arguments, 0 ) ],
keystroke, behavior;
for ( var i = newKeystrokes.length; i--; ) {
keystroke = newKeystrokes[ i ];
behavior = 0;
// It... | javascript | {
"resource": ""
} | |
q13596 | transform | train | function transform() {
for (var _len = arguments.length, matrices = Array(_len), _key = 0; _key < _len; _key++) {
matrices[_key] = arguments[_key];
}
matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;
var multiply = function multiply(m1, m2) {
return {
a: m1.a ... | javascript | {
"resource": ""
} |
q13597 | correctQuestionMarkAndAnd | train | function correctQuestionMarkAndAnd(url) {
var baseURL = url;
// Remove && mistake
baseURL = baseURL.replace(new RegExp('&&', 'g'), '&');
// Ends width ?
if (new RegExp('[\?]$').test(baseURL)) {
// Do nothing
} else {
// Does not end on ?
// Contains ?
if (baseURL.includes('?')) {
// Ends width &
i... | javascript | {
"resource": ""
} |
q13598 | removeParameters | train | function removeParameters(url) {
var baseURL = url;
// Iterate over all parameters
for (var int = 0; int | javascript | {
"resource": ""
} |
q13599 | determineBaseURL | train | function determineBaseURL(url) {
var baseURL;
// Check if url is set
if (url) {
// Remove whitespace
baseURL = url.trim();
baseURL = correctHttpAndHttps(baseURL);
baseURL = correctQuestionMarkAndAnd(baseURL);
baseURL = | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.