_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q13800
train
function(n) { return function chunk(arg) { if ( Array.isArray(arg) ) { return arg.reduce((acc,_,i,a) => { return i % n === 0 ? acc.concat( [a.slice(i, i + n)] ) : acc; }, []); } else if ( typeof arg === 'string' ) { return arg.match( new RegExp('.{1,' + n + '}', 'g') ) || []; } else throw new TypeError('Incorrect type. Passed in value should be an array or string.'); } }
javascript
{ "resource": "" }
q13801
train
function(fn1, fn2) { return function composed() { return fn1.call(null, fn2.apply(null, arguments)); } }
javascript
{ "resource": "" }
q13802
train
function(fn) { return function curried() { var gatheredArgs = [].slice.call(arguments); if ( gatheredArgs.length >= fn.length ) { return fn.apply(null, gatheredArgs); } return function(innerArg) { var newArgs = [].concat(gatheredArgs, innerArg); return curried.apply(null, newArgs); } } }
javascript
{ "resource": "" }
q13803
train
function(value, times) { if (Array.fill) { return new Array(times).fill(value); } return Array.apply(null, Array(+times)).map(function() { return value; }); }
javascript
{ "resource": "" }
q13804
train
function(x, fn) { if (Array.isArray(x) ) { return x.reduce(function(acc, curr) { return acc.concat( funcifyr.flatMap(curr, fn) ); }, []); } return fn(x); }
javascript
{ "resource": "" }
q13805
train
function(key) { return function group(arr) { return arr.reduce(function(obj, item) { (obj[item[key]] = obj[item[key]] || []).push(item); return obj; }, {}); } }
javascript
{ "resource": "" }
q13806
train
function(collection, fn) { if ( Array.isArray(collection) ) { var result = []; for (var i = 0; i < collection.length; i++) { result[i] = fn(collection[i], i, collection); } return result; } else if ( Object.prototype.toString.call(collection) === '[object Object]' ) { var result = {}; for (var key in collection) { if ( collection.hasOwnProperty(key) ) { result[key] = fn(collection[key]); } } return result; } else throw new TypeError('Invalid type. First argument must be an array or an object.'); }
javascript
{ "resource": "" }
q13807
train
function(fn1, fn2) { return function orified(arg) { return fn1.call(null, arg) || fn2.call(null, arg); } }
javascript
{ "resource": "" }
q13808
train
function(/*fns*/) { var fns = [].slice.call(arguments); return function piped(/*args*/) { var args = [].slice.call(arguments); fns.forEach(function(fn) { args = [fn.apply(null, args)]; }); return args[0]; }; }
javascript
{ "resource": "" }
q13809
train
function(start, stop, step) { if (arguments.length === 1) return funcifyr.range(1, start, 1); if (arguments.length === 2) return funcifyr.range(start, stop, 1); var result = []; for (var i = start; i <= stop; i += step) { result.push(i); } return result; }
javascript
{ "resource": "" }
q13810
train
function(str, times) { if (String.prototype.repeat) return str.repeat(times); return Array.apply(null, new Array(times)).map(function() { return str; }).join(''); }
javascript
{ "resource": "" }
q13811
train
function(arr) { for (var i = 0; i < arr.length; i++) { var randIndex = Math.floor(Math.random() * arr.length); var temp = arr[randIndex]; arr[randIndex] = arr[i]; arr[i] = temp; } return arr; }
javascript
{ "resource": "" }
q13812
train
function(prop) { return function tallied(arrayOfObjects) { return arrayOfObjects.reduce(function(acc, curr) { acc[curr[prop]] = (acc[curr[prop]] || 0) + 1; return acc; }, {}); } }
javascript
{ "resource": "" }
q13813
train
function(value) { return { value: value, then: function(fn) { this.value = fn(this.value); return this; }, end: function() { return this.value; } }; }
javascript
{ "resource": "" }
q13814
train
function(arr) { if (Array.prototype.from) return Array.from(new Set(arr)); return arr.filter(function(v,i,a) { return i === a.indexOf(v); }); }
javascript
{ "resource": "" }
q13815
typePaths
train
function typePaths(config) { var out = [ "node_modules/@types", ]; var paths = (config.compilerOptions && config.compilerOptions.paths) || {}; Object.keys(paths).forEach( function eachEntry(k) { // paths may contain a /*, eliminate it paths[k].forEach(function eachPath(a) { var p = a.split("/\*")[0]; if (out.indexOf(p) < 0) { out.push(p); } }); }); debug("type paths", out); return out; }
javascript
{ "resource": "" }
q13816
train
function ( config, callback ) { var self = this; var db = Array(), diff = Array(), first = true; for( var c = 0; c < 2; ++c ) { db[ c ] = Array(); for( var d = 0; d < 2; ++d ) { db[ c ][ d ] = Array(); } } var query = util.format( 'USE %s; SHOW FULL TABLES', config.database ); this.runSql( query, null, { useArray: true } ) .on( 'result', function ( res ) { res.on( 'data', function ( row ) { if ( row[ 0 ] && row[ 1 ] === 'VIEW' ) db[ 0 ][ 1 ].push( row[ 0 ] ); else if ( row[ 0 ] && row[ 0 ] !== 'migrations' ) db[ 0 ][ 0 ].push( row[ 0 ] ); } ); } ) .on( 'end', function () { if ( config.diffDump ) first = false; else callback( db ); } ); if ( config.diffDump ) { query = util.format( 'USE %s; SHOW FULL TABLES', config.database_diff ); this.runSql( query, null, { useArray: true } ) .on( 'result', function ( res ) { res.on( 'data', function ( row ) { if ( row[ 0 ] && row[ 1 ] === 'VIEW' ) db[ 1 ][ 1 ].push( row[ 0 ] ); else if ( row[ 0 ] && row[ 0 ] !== 'migrations' ) db[ 1 ][ 0 ].push( row[ 0 ] ); } ); } ) .on( 'end', function () { while ( first ) { deasync.sleep( 100 ); } callback( db ); } ); } }
javascript
{ "resource": "" }
q13817
train
function ( config, callback ) { var self = this; var db = Array(), diff = Array(), first = true; db[ 0 ] = Array(); db[ 1 ] = Array(); diff[ 0 ] = Array(); diff[ 1 ] = Array(); var query = 'SELECT name, modified, type FROM mysql.proc WHERE db = ?'; this.runSql( query, [ config.database ] ) .on( 'result', function ( res ) { res.on( 'data', function ( row ) { if ( row.type === 'FUNCTION' ) db[ 0 ].push( [ row.name, row.modified ] ); else if ( row.type === 'PROCEDURE' ) db[ 1 ].push( [ row.name, row.modified ] ); } ); } ) .on( 'end', function () { if ( config.diffDump ) first = false; else callback( db ); } ); if ( config.diffDump ) { var query = 'SELECT name, modified, type FROM mysql.proc WHERE db = ?'; this.runSql( query, [ config.database_diff ], false ) .on( 'result', function ( res ) { res.on( 'data', function ( row ) { if ( row.type === 'FUNCTION' ) diff[ 0 ].push( [ row.name, row.modified ] ); else if ( row.type === 'PROCEDURE' ) diff[ 1 ].push( [ row.name, row.modified ] ); } ); } ) .on( 'end', function () { while ( first ) { deasync.sleep( 100 ); } callback( db, diff ); } ); } }
javascript
{ "resource": "" }
q13818
train
function ( config, tables, context, callback ) { var self = this; var db = Array(), counter = 0, query = 'SHOW INDEX FROM %s.%s;'; db[ 0 ] = Array(); db[ 1 ] = Array(); var len = ( tables.tables[ 0 ].length > tables.tables[ 1 ].length ) ? tables.tables[ 0 ].length : tables.tables[ 1 ].length; for ( var i = 0; i < len; ++i ) { var q = '', stmt = 0; if ( tables.tables[ 0 ][ i ] ) q = util.format( query, config.database, tables.tables[ 0 ][ i ] ); else ++stmt; if ( tables.tables[ 1 ][ i ] ) q += util.format( query, config.database_diff, tables.tables[ 1 ][ i ] ); //scoping stmt and interator to event ( function ( stmt, i ) { self.runSql( q, null, { useArray: true } ) .on( 'result', function ( res ) { var local = stmt++; res.on( 'data', function ( row ) { row[ 0 ] = row[ 2 ]; //replace table by key name row[ 1 ] = row[ 1 ] === '0'; row.splice( 2, 1 ); //delete moved key name //<-- Seq_in_index has now moved one index lower row.splice( 4, 4 ); //delete until null info row[ 4 ] = ( row[ 4 ] === 'YES' ) ? true : false; //Comment and Index_comment will be simply ignored //Maybe I'm going to implement them later, but not for now. if ( !db[ local ][ tables.tables[ local ][ i ] ] ) db[ local ][ tables.tables[ local ][ i ] ] = Array(); db[ local ][ tables.tables[ local ][ i ] ].push( row ); } ); } ) .on( 'end', function () { if ( ++counter >= len ) callback( context, db ); } ); } )( stmt, i ); } }
javascript
{ "resource": "" }
q13819
train
function ( config, tables, context, callback ) { var self = this, db = Array(), counter = 0; db[ 0 ] = Array(); db[ 1 ] = Array(); var len = ( tables.tables[ 0 ].length > tables.tables[ 1 ].length ) ? tables.tables[ 0 ].length : tables.tables[ 1 ].length; var query = [ 'SELECT const.CONSTRAINT_NAME, const.CONSTRAINT_SCHEMA,const.TABLE_NAME,', 'const.REFERENCED_TABLE_NAME,const.UPDATE_RULE,const.DELETE_RULE,', 'const_keys.COLUMN_NAME,const_keys.POSITION_IN_UNIQUE_CONSTRAINT,', 'const_keys.REFERENCED_COLUMN_NAME,const_keys.REFERENCED_TABLE_SCHEMA', 'FROM information_schema.REFERENTIAL_CONSTRAINTS const', 'INNER JOIN information_schema.KEY_COLUMN_USAGE const_keys ON ( ', 'const_keys.CONSTRAINT_SCHEMA = const.CONSTRAINT_SCHEMA', 'AND const_keys.CONSTRAINT_NAME = const.CONSTRAINT_NAME )', 'WHERE const.CONSTRAINT_SCHEMA = ?', 'AND const.TABLE_NAME = ?;' ] .join( ' ' ); for ( var i = 0; i < len; ++i ) { var q = '', params = Array(), stmt = 0; if ( tables.tables[ 0 ][ i ] ) { q = query; params.push( config.database ); params.push( tables.tables[ 0 ][ i ] ); } else ++stmt; if ( tables.tables[ 1 ][ i ] ) { q += query; params.push( config.database_diff ); params.push( tables.tables[ 1 ][ i ] ); } //scoping stmt and interator to event ( function ( stmt, i ) { self.runSql( q, params, { useArray: true } ) .on( 'result', function ( res ) { var local = stmt++; res.on( 'data', function ( row ) { constraint = Array(); if ( !db[ local ][ tables.tables[ local ][ i ] ] ) db[ local ][ tables.tables[ local ][ i ] ] = Array(); constraint[ 0 ] = row[ 0 ]; //constraint_name constraint[ 1 ] = row[ 6 ]; //column_name constraint[ 2 ] = row[ 9 ]; //referenced_table_schema constraint[ 3 ] = row[ 3 ]; //referenced_table_name constraint[ 4 ] = row[ 8 ]; //referenced_column_name constraint[ 5 ] = row[ 7 ]; //position_in_unique_constraint constraint[ 6 ] = row[ 4 ]; //on_update constraint[ 7 ] = row[ 5 ]; //on_delete db[ local ][ tables.tables[ local ][ i ] ].push( constraint ); } ); } ) .on( 'end', function () { if ( ++counter >= len ) callback( context, db ); } ); } )( stmt, i ); } }
javascript
{ "resource": "" }
q13820
train
function (wholeMatch, match, left, right) { // unescape match to prevent double escaping match = htmlunencode(match); return left + hljs.highlightAuto(match).value + right; }
javascript
{ "resource": "" }
q13821
HashThrough
train
function HashThrough (createHash) { const hashThrough = new Transform() const hash = createHash() hashThrough._transform = function (chunk, encoding, cb) { setImmediate(_ => { try { hash.update(chunk) cb(null, chunk) } catch (err) { cb(err) } }) } // bind the digest function to hash object hashThrough.digest = format => hash.digest(format) return hashThrough }
javascript
{ "resource": "" }
q13822
Logger
train
function Logger(level) { if (_.isString(level) && _.has(LogLevel, level)) { this.level = LogLevel[level]; } else if (_.isNumber(level) && level >= 0 && level <= 4) { this.level = level; } else { this.level = LogLevel.info; } }
javascript
{ "resource": "" }
q13823
localSearchFactory
train
function localSearchFactory($http, $timeout, NG_PAGES) { console.log('Using Local Search Index'); // Create the lunr index var index = lunr(function() { this.ref('path'); this.field('titleWords', {boost: 50}); this.field('members', { boost: 40}); this.field('keywords', { boost : 20 }); }); // Delay building the index by loading the data asynchronously var indexReadyPromise = $http.get('js/search-data.json').then(function(response) { var searchData = response.data; // Delay building the index for 500ms to allow the page to render return $timeout(function() { // load the page data into the index angular.forEach(searchData, function(page) { index.add(page); }); }, 500); }); // The actual service is a function that takes a query string and // returns a promise to the search results // (In this case we just resolve the promise immediately as it is not // inherently an async process) return function(q) { return indexReadyPromise.then(function() { var hits = index.search(q); var results = []; angular.forEach(hits, function(hit) { results.push(NG_PAGES[hit.ref]); }); return results; }); }; }
javascript
{ "resource": "" }
q13824
webWorkerSearchFactory
train
function webWorkerSearchFactory($q, $rootScope, NG_PAGES) { console.log('Using WebWorker Search Index') var searchIndex = $q.defer(); var results; var worker = new Worker('js/search-worker.js'); // The worker will send us a message in two situations: // - when the index has been built, ready to run a query // - when it has completed a search query and the results are available worker.onmessage = function(oEvent) { $rootScope.$apply(function() { switch(oEvent.data.e) { case 'index-ready': searchIndex.resolve(); break; case 'query-ready': var pages = oEvent.data.d.map(function(path) { return NG_PAGES[path]; }); results.resolve(pages); break; } }); }; // The actual service is a function that takes a query string and // returns a promise to the search results return function(q) { // We only run the query once the index is ready return searchIndex.promise.then(function() { results = $q.defer(); worker.postMessage({ q: q }); return results.promise; }); }; }
javascript
{ "resource": "" }
q13825
queue
train
function queue (job, value, put) { var ts = timestamp() var key = toKey(job, ts) var id = hash(job+':'+value) if(pending[id]) return null //this job is already queued. pending[id] = Date.now() if(put === false) { //return the job to be queued, to include it in a batch insert. return { type: 'put', key: Buffer.isBuffer(key) ? key : new Buffer(key), value: Buffer.isBuffer(key) ? value : new Buffer(value) } } else { db.put(key, value) } }
javascript
{ "resource": "" }
q13826
skew
train
function skew(ax, ay) { return { a: 1, c: tan(ax), e: 0, b: tan(ay), d: 1, f: 0 }; }
javascript
{ "resource": "" }
q13827
skewDEG
train
function skewDEG(ax, ay) { return skew(ax * Math.PI / 180, ay * Math.PI / 180); }
javascript
{ "resource": "" }
q13828
ObjectID
train
function ObjectID(id) { // Duck-typing to support ObjectId from different npm packages if (id instanceof ObjectID) return id; if (!(this instanceof ObjectID)) return new ObjectID(id); this._bsontype = 'ObjectID'; // The most common usecase (blank id, new objectId instance) if (id == null || typeof id === 'number') { // Generate a new id this.id = this.generate(id); // If we are caching the hex string if (ObjectID.cacheHexString) this.__id = this.toString('hex'); // Return the object return; } // Check if the passed in id is valid var valid = ObjectID.isValid(id); // Throw an error if it's not a valid setup if (!valid && id != null) { throw new Error( 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' ); } else if (valid && typeof id === 'string' && id.length === 24 && hasBufferType) { return new ObjectID(new Buffer(id, 'hex')); } else if (valid && typeof id === 'string' && id.length === 24) { return ObjectID.createFromHexString(id); } else if (id != null && id.length === 12) { // assume 12 byte string this.id = id; } else if (id != null && id.toHexString) { // Duck-typing to support ObjectId from different npm packages return id; } else { throw new Error( 'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters' ); } if (ObjectID.cacheHexString) this.__id = this.toString('hex'); }
javascript
{ "resource": "" }
q13829
init
train
function init(masterPassword, map) { var fileContents = JSON.stringify(map); var encryptedFileContents = encryption.encrypt(fileContents, masterPassword); file.writeToFile(encryptedFileContents); }
javascript
{ "resource": "" }
q13830
getContents
train
function getContents(masterPassword) { var encryptedContents = file.readFile(); try { var contents = encryption.decrypt(encryptedContents, masterPassword); return JSON.parse(contents); } catch(err) { console.log(err); throw new Error("Error reading file contents. This most likely means the provided password is wrong."); } }
javascript
{ "resource": "" }
q13831
getKey
train
function getKey(key, masterPassword) { var contents = getContents(masterPassword); if (contents[key] != undefined) return contents[key]; else throw new Error(`Unable to find key '${key}' in password safe.`); }
javascript
{ "resource": "" }
q13832
writeKey
train
function writeKey(key, value, masterPassword) { var contents = getContents(masterPassword); contents[key] = value; var fileContents = JSON.stringify(contents); var encryptedFileContents = encryption.encrypt(fileContents, masterPassword); file.writeToFile(encryptedFileContents); }
javascript
{ "resource": "" }
q13833
removeKey
train
function removeKey(key, masterPassword) { var contents = getContents(masterPassword); if (contents[key] != undefined) delete contents[key]; var fileContents = JSON.stringify(contents); var encryptedFileContents = encryption.encrypt(fileContents, masterPassword); file.writeToFile(encryptedFileContents); }
javascript
{ "resource": "" }
q13834
changePassword
train
function changePassword(masterPassword, newPassword1, newPassword2) { if (newPassword1 !== newPassword2) throw new Error("New passwords must match."); else { var contents = getContents(masterPassword); init(newPassword1, contents); } }
javascript
{ "resource": "" }
q13835
train
function(total, timeout) { events.EventEmitter.call(this); if (! isPositiveInteger(total)) { throw new Error('`total` must be a positive integer'); } if (timeout && ! isPositiveInteger(timeout)) { throw new Error('`timeout` must be a positive integer'); } this.destroyed = false; this.total = total; this.fired = 0; if (timeout) { this.timer = setTimeout(function() { this.onTimeout(); }.bind(this), timeout); } }
javascript
{ "resource": "" }
q13836
_join
train
function _join(arr1, arr2) { var len = arr1.length > arr2 ? arr1.length : arr2.length var joinedArr = [] while(len --) { joinedArr.push(arr1.shift()) joinedArr.push(arr2.shift()) } // merge remains return joinedArr.concat(arr1).concat(arr2) }
javascript
{ "resource": "" }
q13837
callCompat
train
function callCompat(obj) { if(obj) { obj = obj.prototype || obj; PIXI.EventTarget.mixin(obj); } }
javascript
{ "resource": "" }
q13838
train
function () { var ikConstraints = this.ikConstraints; var ikConstraintsCount = ikConstraints.length; var arrayCount = ikConstraintsCount + 1; var boneCache = this.boneCache; if (boneCache.length > arrayCount) boneCache.length = arrayCount; for (var i = 0, n = boneCache.length; i < n; i++) boneCache[i].length = 0; while (boneCache.length < arrayCount) boneCache[boneCache.length] = []; var nonIkBones = boneCache[0]; var bones = this.bones; outer: for (var i = 0, n = bones.length; i < n; i++) { var bone = bones[i]; var current = bone; do { for (var ii = 0; ii < ikConstraintsCount; ii++) { var ikConstraint = ikConstraints[ii]; var parent = ikConstraint.bones[0]; var child= ikConstraint.bones[ikConstraint.bones.length - 1]; while (true) { if (current == child) { boneCache[ii].push(bone); boneCache[ii + 1].push(bone); continue outer; } if (child == parent) break; child = child.parent; } } current = current.parent; } while (current); nonIkBones[nonIkBones.length] = bone; } }
javascript
{ "resource": "" }
q13839
asyncifyFunctions
train
function asyncifyFunctions(forms) { // for each subexpression form... forms.forEach(function(form) { if (sl.isList(form)) { if(sl.typeOf(form[0]) === 'symbol' && sl.valueOf(form[0]) === 'function' && asyncNeeded(form)) { form.unshift(sl.atom("async")); asyncifyFunctions(form); } else { asyncifyFunctions(form); } } }); }
javascript
{ "resource": "" }
q13840
on
train
function on(event, fn) { if (typeof event !== 'string') { throw new Error('"event" not a string'); } if (!(fn instanceof Function)) { throw new Error('"fn" not a Function'); } if (hasListener(event, fn)) { return false; } if (!hasListeners(event)) { listeners[event] = []; } listeners[event].push(fn); return true; }
javascript
{ "resource": "" }
q13841
off
train
function off(event, fn) { if (typeof event !== 'string') { throw new Error('"event" not a string'); } if (fn !== undefined && !(fn instanceof Function)) { throw new Error('"fn" not a Function'); } if (fn) { // do we event have this listener if (!hasListener(event, fn)) { return false; } // unregistering a specific listener for the event listeners[event] = listeners[event].filter(function(l) { return l !== fn; }); if (listeners[event].length === 0) { delete listeners[event]; } } else { // do we have any listeners for this event? if (!hasListeners(event)) { return false; } // unregistering all listeners for the event delete listeners[event]; } return true; }
javascript
{ "resource": "" }
q13842
fire
train
function fire(event) { if (typeof event !== 'string') { throw new Error('"event" not a string'); } // any listeners registered? if (!hasListeners(event)) { return triggerObject; } // get optional arguments var args = Array.prototype.slice.call(arguments, 1); // invoke listener functions listeners[event].slice(0).forEach(function(fn) { fn.apply(global, args); }); return triggerObject; }
javascript
{ "resource": "" }
q13843
fireAsync
train
function fireAsync(event) { var args = Array.prototype.slice.call(arguments); setTimeout(function() { fire.apply(triggerObject, args); }, 0); return triggerObject; }
javascript
{ "resource": "" }
q13844
hasListener
train
function hasListener(event, fn) { return listeners[event] ? listeners[event].some(function(l) { return l === fn; }) : false; }
javascript
{ "resource": "" }
q13845
validCorsPreflight
train
function validCorsPreflight(request) { if (request.method === 'OPTIONS' && request.headers.has('access-control-request-headers')) { return request.headers.get('access-control-request-headers').split(',').map(function (header) { return header.trim(); }).includes('authorization'); } else { return false; } }
javascript
{ "resource": "" }
q13846
getTokenFromHeader
train
function getTokenFromHeader(request) { if (!request.headers || !request.headers.has('authorization')) { throw new UnauthorizedError('No authorization header present'); } const parts = request.headers.get('authorization').split(" "); if (parts.length === 2) { const scheme = parts[0]; const credentials = parts[1]; if (/^Bearer$/i.test(scheme)) { return credentials; } else { throw new UnauthorizedError('Bad Authorization header format. Format is "Authorization: Bearer token"'); } } else { throw new UnauthorizedError('Bad Authorization header format. Format is "Authorization: Bearer token"'); } }
javascript
{ "resource": "" }
q13847
myParser
train
function myParser (size) { if (typeof size !== 'number') throw new Error('Invalid block size: ' + size) function isEnd () { return atok.ending ? atok.length - atok.offset : -1 } atok .trim() .addRule(size, function (data) { self.emit('data', data) }) .addRule('', isEnd, function (data) { var len = data.length if (typeof data === 'string') { var lastBlock = data + new Array(size - len + 1).join('0') } else { var lastBlock = new Buffer(size) lastBlock.fill(0, len) data.copy(lastBlock, 0) } self.emit('data', lastBlock) }) .on('end', function () { self.emit('end') }) }
javascript
{ "resource": "" }
q13848
getArrayFromRange
train
function getArrayFromRange(l, h, s) { var a = []; s = s || 1; for(var i = l; i < h; i += s) { a.push(i); } return a; }
javascript
{ "resource": "" }
q13849
handleMasterPayload
train
function handleMasterPayload (payload) { // Parse and validate received payload. if ((payload = utils.parsePayload(payload)) === null) return // Notify all workers except the worker who emitted the event. sendPayload.call(this, payload) }
javascript
{ "resource": "" }
q13850
handleWorkerPayload
train
function handleWorkerPayload (payload) { // Parse and validate received payload. if ((payload = utils.parsePayload(payload)) === null) return // If the master is configured to echo events to its own master, the event // emitted by the worker should be echoed to the master. if (this.__echoEvents === true) { const echoPayload = JSON.parse(JSON.stringify(payload)) // Update PID as if the payload is originating from this process, the master // is in. If this is not done, the master of this process, will resend the // payload since the PID is different. echoPayload[fields.pid] = process.pid process.send(echoPayload) } // Unmarshal args. payload[fields.args] = marshaller.unmarshal(payload[fields.args]) // Notify instance listeners. events.prototype.emit.call(this, payload[fields.event], ...payload[fields.args]) // Notify all workers except the worker who emitted the event. sendPayload.call(this, payload) }
javascript
{ "resource": "" }
q13851
getModels
train
function getModels(done) { if (models) { return done(models); } return orm.initialize(ormConfig, function(err, m) { if (err) { throw err; } // make the models available as soon as possible for other functions models = m; // ignore error if groups already created let catcher = (createErr) => { if (createErr && createErr.code !== "E_VALIDATION") { throw createErr; } }; // create the administrators group createGroup("admin", catcher); // create the public group createGroup("public", catcher); return done(models); }); }
javascript
{ "resource": "" }
q13852
createGroup
train
function createGroup(name, done) { return getModels(function(m) { return m.collections.group.create({ name }, done); }); }
javascript
{ "resource": "" }
q13853
getGroup
train
function getGroup(name, done) { return getModels(function(m) { return m.collections.group.findOne({ name }) .populate("members").populate("leaders").exec(done); }); }
javascript
{ "resource": "" }
q13854
getGroups
train
function getGroups(done) { return getModels(function(m) { return m.collections.group.find().exec(done); }); }
javascript
{ "resource": "" }
q13855
deleteGroup
train
function deleteGroup(name, done) { return getGroup(name, function(getGroupErr, group) { if (getGroupErr) { return done(getGroupErr); } if (!group) { return done(new Error(`group '${name}' not found`)); } return group.destroy(done); }); }
javascript
{ "resource": "" }
q13856
composeAddRemoveGroupMember
train
function composeAddRemoveGroupMember({ action="add", roles="members" }) { /** * Add/Remove user from group * * @param {String} username * @param {String} groupname * @param {Function} done - done(err) */ return function(username, groupname, done) { return getGroup(groupname, function(getGroupErr, group) { if (getGroupErr) { return done(getGroupErr); } if (!group) { return done(new Error(`group '${groupname}' not found`)); } return getUser(username, function(getUserErr, user) { if (getUserErr) { return done(getUserErr); } if (!user) { return done(new Error(`user '${username}' not found`)); } group[roles][action](user.id); return group.save(done); }); }); }; }
javascript
{ "resource": "" }
q13857
getUser
train
function getUser(username, done) { return getModels(function(m) { return m.collections.user.findOne({ username }) .populate("tokens") .populate("groups") .populate("leading") .exec(done); }); }
javascript
{ "resource": "" }
q13858
deleteUser
train
function deleteUser(username, done) { return getUser(username, function(getUserErr, user) { if (getUserErr) { return done(getUserErr); } if (!user) { return done(new Error(`user '${username}' not found`)); } user.tokens.forEach((token) => token.destroy()); user.groups.forEach((group) => { group.members.remove(user.id); group.save(); }); user.leading.forEach((group) => { group.leaders.remove(user.id); group.save(); }); user.destroy(done); }); }
javascript
{ "resource": "" }
q13859
getUsers
train
function getUsers(done) { return getModels(function(m) { return m.collections.user.find().exec(done); }); }
javascript
{ "resource": "" }
q13860
hashToken
train
function hashToken(token, done) { return bcrypt.genSalt(10, function(genSaltErr, salt) { if (genSaltErr) { return done(genSaltErr); } bcrypt.hash(token, salt, done); }); }
javascript
{ "resource": "" }
q13861
createToken
train
function createToken(username, done) { return getUser(username, function(getUserErr, user) { if (getUserErr) { return done(getUserErr); } if (!user) { return done(new Error(`user '${username}' not found`)); } const token = uuid.v4(); return hashToken(token, function(cryptErr, hash) { if (cryptErr) { return done(cryptErr); } return getModels(function(m) { m.collections.token.create({ uuid: hash, owner: user.id, }, function(createTokenErr) { if (createTokenErr) { return done(createTokenErr); } return done(null, token); }); // m.collections.token.create }); // getModels }); // hashToken }); // getUser }
javascript
{ "resource": "" }
q13862
getTokenHashes
train
function getTokenHashes(username, done) { return getUser(username, function(getUserErr, user) { if (getUserErr) { return done(getUserErr); } if (!user) { return done(new Error(`user '${username}' not found`)); } return done(null, user.tokens); }); }
javascript
{ "resource": "" }
q13863
tokenExists
train
function tokenExists(username, token, done) { return getTokenHashes(username, function(getTokensErr, hashes) { if (getTokensErr) { return done(getTokensErr); } if (!hashes || !hashes.length) { return done(null, false); } let index = 0; let found = false; async.until(() => found || (index >= hashes.length), function(next) { bcrypt.compare(token, hashes[index++].uuid, function(err, match) { found = match; return next(err); }); }, (err) => done(err, found ? hashes[index - 1] : undefined)); }); }
javascript
{ "resource": "" }
q13864
deleteToken
train
function deleteToken(username, token, done) { return tokenExists(username, token, function(existsErr, tokenObj) { if (existsErr) { return done(existsErr); } if (!tokenObj) { return done(new Error(`token '${token}' not found`)); } return tokenObj.destroy(done); }); }
javascript
{ "resource": "" }
q13865
_onInboxMessage
train
function _onInboxMessage (sender, _, msgBuffer) { let message = JSON.parse(msgBuffer) masterBroker.setIP(message.toAddress) switch (message.type) { case 'voteRequest': debug(`sending vote to ${node.name === message.from ? 'myself' : message.from}`) _inbox.send([sender, _, JSON.stringify({ id: _advertiseId || node.id, name: node.name, endpoints: masterBroker.endpoints, isMaster: masterBroker.isMaster, candidate: !_advertiseId })]) break case 'masterRequest': let connectedMaster = node.master if (connectedMaster) { debug(`sending master coordinates to ${message.from}`) _inbox.send([sender, _, JSON.stringify(connectedMaster)]) } else { debug(`unable to send master coordinates to ${message.from}`) _inbox.send([sender, _, JSON.stringify(false)]) } break case 'masterElected': _inbox.send([sender, _, '']) debug(`received notice of master election: ${message.data.name}`) resolver.emit('newmaster', message.data) } }
javascript
{ "resource": "" }
q13866
_broadcastMessage
train
function _broadcastMessage (type, data) { data = data || {} let message = {type, data} let { host, coordinationPort } = node.settings dns.resolve4(host, (err, addresses) => { if (err) { debug(`cannot resolve host '${host}'. Check DNS infrastructure.`) return } debug(`broadcasting message '${type}' to '${host}' nodes: ${addresses}`) addresses.forEach(address => { let messenger = zmq.socket('req') messenger.connect(`tcp://${address}:${coordinationPort}`) messenger.send(JSON.stringify({ ...message, toAddress: address })) let _end = false function closeSocket () { if (_end) return _end = true messenger.close() } messenger.on('message', closeSocket) setTimeout(closeSocket, 300) }) }) }
javascript
{ "resource": "" }
q13867
_requestVotes
train
function _requestVotes () { let { host, coordinationPort } = node.settings let message = { type: 'voteRequest', data: {} } return new Promise((resolve, reject) => { let resolveStart = Date.now() dns.resolve4(host, (err, addresses) => { if (err) { debug(`cannot resolve host '${host}'. Check DNS infrastructure.`) return reject(err) } debug(`resolved ${addresses.length} IP(s) for host '${host}' in ${Date.now() - resolveStart} ms`) debug(`requesting votes from ${addresses.length} nodes`) Promise.all( addresses.map(address => new Promise((resolve, reject) => { let voteRequestTime = Date.now() let messenger = zmq.socket('req') messenger.connect(`tcp://${address}:${coordinationPort}`) messenger.send(JSON.stringify({ ...message, toAddress: address, from: node.name })) let _resolved = false function onEnd (candidateBuffer) { if (_resolved) return _resolved = true messenger.removeListener('message', onEnd) messenger.close() let candidate = candidateBuffer && JSON.parse(candidateBuffer) if (candidate) { let elapsed = Date.now() - voteRequestTime candidate.candidate && debug(`received vote by ${candidate.name === node.name ? 'myself' : candidate.name}${candidate.isMaster ? ' (master)' : ''} in ${elapsed} ms`) } else { debug(`missed vote by peer at ${address}`) } resolve(candidate) } messenger.on('message', onEnd) setTimeout(onEnd, node.settings.voteTimeout) })) ) .then(nodes => compact(nodes)) .then(nodes => resolve(nodes.filter(({candidate}) => candidate))) }) }) }
javascript
{ "resource": "" }
q13868
bind
train
function bind () { _inbox.bindSync(`tcp://0.0.0.0:${node.settings.coordinationPort}`) _inbox.on('message', _onInboxMessage) return resolver }
javascript
{ "resource": "" }
q13869
unbind
train
function unbind () { _inbox.unbindSync(`tcp://0.0.0.0:${node.settings.coordinationPort}`) _inbox.removeListener('message', _onInboxMessage) return resolver }
javascript
{ "resource": "" }
q13870
electMaster
train
function electMaster (advertiseId) { _advertiseId = advertiseId || null if (_electingMaster) return _electingMaster _electingMaster = _requestVotes() .then(nodes => { _electingMaster = false _advertiseId = null const masterNodes = nodes.filter( ({isMaster}) => isMaster) nodes = masterNodes.length ? masterNodes : nodes const electedMaster = sortBy(nodes, ({id}) => id)[0] if (!electedMaster) throw new Error('could not elect a master') debug(`elected master: ${electedMaster.name} ${JSON.stringify(electedMaster.endpoints)}`) _broadcastMessage('masterElected', electedMaster) return electedMaster }) _electingMaster.catch(() => { _electingMaster = false _advertiseId = null }) return _electingMaster }
javascript
{ "resource": "" }
q13871
millerRabin
train
function millerRabin(x,b) { var i,j,k,s; if (mr_x1.length!=x.length) { mr_x1=dup(x); mr_r=dup(x); mr_a=dup(x); } copy_(mr_a,b); copy_(mr_r,x); copy_(mr_x1,x); addInt_(mr_r,-1); addInt_(mr_x1,-1); //s=the highest power of two that divides mr_r /* k=0; for (i=0;i<mr_r.length;i++) for (j=1;j<mask;j<<=1) if (x[i] & j) { s=(k<mr_r.length+bpe ? k : 0); i=mr_r.length; j=mask; } else k++; */ /* http://www.javascripter.net/math/primes/millerrabinbug-bigint54.htm */ if (isZero(mr_r)) return 0; for (k=0; mr_r[k]==0; k++); for (i=1,j=2; mr_r[k]%j==0; j*=2,i++ ); s = k*bpe + i - 1; /* end */ if (s) rightShift_(mr_r,s); powMod_(mr_a,mr_r,x); if (!equalsInt(mr_a,1) && !equals(mr_a,mr_x1)) { j=1; while (j<=s-1 && !equals(mr_a,mr_x1)) { squareMod_(mr_a,x); if (equalsInt(mr_a,1)) { return 0; } j++; } if (!equals(mr_a,mr_x1)) { return 0; } } return 1; }
javascript
{ "resource": "" }
q13872
bigInt2str
train
function bigInt2str(x,base) { var i,t,s=""; if (s6.length!=x.length) s6=dup(x); else copy_(s6,x); if (base==-1) { //return the list of array contents for (i=x.length-1;i>0;i--) s+=x[i]+','; s+=x[0]; } else { //return it in the given base while (!isZero(s6)) { t=divInt_(s6,base); //t=s6 % base; s6=floor(s6/base); s=digitsStr.substring(t,t+1)+s; } } if (s.length==0) s="0"; return s; }
javascript
{ "resource": "" }
q13873
dup
train
function dup(x) { var i, buff; buff=new Array(x.length); copy_(buff,x); return buff; }
javascript
{ "resource": "" }
q13874
copyInt_
train
function copyInt_(x,n) { var i,c; for (c=n,i=0;i<x.length;i++) { x[i]=c & mask; c>>=bpe; } }
javascript
{ "resource": "" }
q13875
pathParser
train
function pathParser(root, extname, subPath, paths) { var dirPath = path.resolve(subPath || root); var files; paths = paths || {}; try { files = fs.readdirSync(dirPath); } catch(e) { files = []; } files.forEach(function(file) { file = path.join(dirPath, '/', file); if (fs.statSync(file).isFile()) { if (~extname.split('|').indexOf(path.extname(file).substr(1))) { var rootPath = '^' + path.join(path.resolve(root), '/'); rootPath = rootPath.replace(/\\/g, '\\\\') + '(.*)\.(' + extname + ')$'; paths[file.match(new RegExp(rootPath))[1].toLowerCase()] = file; } } else if (fs.statSync(file).isDirectory()) { pathParser(root, extname, file, paths); } }); return paths; }
javascript
{ "resource": "" }
q13876
TypedBoolean
train
function TypedBoolean (config) { const boolean = this; // define properties Object.defineProperties(boolean, { strict: { /** * @property * @name TypedBoolean#strict * @type {boolean} */ value: config.hasOwnProperty('strict') ? !!config.strict : false, writable: false } }); return boolean; }
javascript
{ "resource": "" }
q13877
duration
train
function duration (time) { var number = parseFloat(time) switch (unit(time)) { case null: case 'ms': return number case 's': return number * 1000 case 'm': return number * 60000 case 'h': return number * 3600000 case 'd': return number * 86400000 case 'w': return number * 604800000 default: return null } }
javascript
{ "resource": "" }
q13878
mergeTags
train
function mergeTags(base, addition) { Array.prototype.push.apply(base, addition); return base; }
javascript
{ "resource": "" }
q13879
logLevelLabel
train
function logLevelLabel(logLevel) { switch (logLevel) { case exports.LOG_EMERGENCY: return 'emergency'; case exports.LOG_ALERT: return 'alert'; case exports.LOG_CRITICAL: return 'critical'; case exports.LOG_ERROR: return 'error'; case exports.LOG_WARNING: return 'warning'; case exports.LOG_NOTICE: return 'notice'; case exports.LOG_INFORMATIONAL: return 'info'; case exports.LOG_DEBUG: return 'debug'; default: return ''; } }
javascript
{ "resource": "" }
q13880
hasLogLevel
train
function hasLogLevel(tags, searchLogLevels) { var logLevel = tags.filter(function (tag) { return searchLogLevels.indexOf(tag) !== -1; }); return logLevel.length ? logLevel[0] : ''; }
javascript
{ "resource": "" }
q13881
train
function (scope, iAttrs, newValue) { 'use strict'; var ngModelArr = iAttrs.ngModel.split('.'); // console.log(JSON.stringify(ngModelArr, null, 2)); switch (ngModelArr.length) { case 1: scope.$apply(function () {scope[ngModelArr[0]] = newValue;}); break; case 2: scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]] = newValue;}); break; case 3: scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]] = newValue;}); break; case 4: scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]] = newValue;}); break; case 5: scope.$apply(function () {scope[ngModelArr[0]][ngModelArr[1]][ngModelArr[2]][ngModelArr[3]][ngModelArr[4]] = newValue;}); break; default: scope.$apply(function () {scope[iAttrs.ngModel] = newValue;}); } }
javascript
{ "resource": "" }
q13882
get
train
function get(path) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var config = assignConfig_1.default(option, path); return globElements_1.default(config).then(readElements_1.default(config)).then(optimize_1.default()); }
javascript
{ "resource": "" }
q13883
jxh
train
function jxh(obj, indentStr = ' ', indentLevel = 0) { let html = ''; switch (getType(obj)) { case 'array': for (let item of obj) { html += jxh(item, indentStr, indentLevel); } break; case 'object': for (let tag in obj) { let content = obj[tag]; html += routeTags(tag, content, indentStr, indentLevel); } break; default: objTypeError(obj); break; } return html; }
javascript
{ "resource": "" }
q13884
routeTags
train
function routeTags(tag, content, indentStr, indentLevel) { if (COMPONENT.test(tag)) { return jxh(content, indentStr, indentLevel); } else { let attrs = getType(content)==='object' ? getAttributes(content) : ''; switch (getType(content)) { case 'null': case 'undefined': case 'NaN': case 'string': case 'number': case 'boolean': return renderElement(tag, attrs, content, indentStr, indentLevel); break; case 'array': return parseArray(tag, attrs, content, indentStr, indentLevel); break; case 'object': return parseObject(tag, attrs, content, indentStr, indentLevel); break; default: objTypeError(content); break; } } }
javascript
{ "resource": "" }
q13885
execCmd
train
function execCmd(c, gcr) { return shell.exec(gcr ? c.replace(regexGitCmd, gcr) : c, { silent : true }); }
javascript
{ "resource": "" }
q13886
BSONRegExp
train
function BSONRegExp(pattern, options) { if (!(this instanceof BSONRegExp)) return new BSONRegExp(); // Execute this._bsontype = 'BSONRegExp'; this.pattern = pattern || ''; this.options = options || ''; // Validate options for (var i = 0; i < this.options.length; i++) { if ( !( this.options[i] === 'i' || this.options[i] === 'm' || this.options[i] === 'x' || this.options[i] === 'l' || this.options[i] === 's' || this.options[i] === 'u' ) ) { throw new Error('the regular expression options [' + this.options[i] + '] is not supported'); } } }
javascript
{ "resource": "" }
q13887
createWatcher
train
function createWatcher(inPath, callback) { if (!inPath) { throw new Error('Input path argument is required'); } if (!callback) { throw new Error('Callback argument is required'); } return function watcher() { watch(inPath, callback); }; }
javascript
{ "resource": "" }
q13888
stopAll
train
function stopAll(socket) { if (_.isEmpty(this.consumers)) { return; } _.forOwn(this.consumers[socket.id].routingKeys, function (consumer, routingKey) { if (routingKey == '#') { // this must be done to prevent infinite stop loop routingKey = '##'; } this.stopConsume(socket, {routingKey: routingKey}); }.bind(this)); }
javascript
{ "resource": "" }
q13889
train
function(array, property, searchTerm) { for (var i = 0, len = array.length; i < len; ++i) { var value = array[i][property]; if (value === searchTerm || value.indexOf(searchTerm) !== -1) { return i }; } return -1; }
javascript
{ "resource": "" }
q13890
sendHelperMessage
train
function sendHelperMessage(msg) { var port = chrome.runtime.connect({ name: 'popup' }); port.postMessage(msg); port.onMessage.addListener(function (response) { console.log('Got response message: ', response); }); }
javascript
{ "resource": "" }
q13891
Client
train
function Client(key, secret, scope) { this.key = key; this.secret = secret; this.scope = scope != null ? scope : "read write"; this._request = __bind(this._request, this); this._delete = __bind(this._delete, this); this._put = __bind(this._put, this); this._post = __bind(this._post, this); this._postAsForm = __bind(this._postAsForm, this); this._get = __bind(this._get, this); this.info = __bind(this.info, this); this.deleteApp = __bind(this.deleteApp, this); this.updateApp = __bind(this.updateApp, this); this.app = __bind(this.app, this); this.createApp = __bind(this.createApp, this); this.appsForOrganization = __bind(this.appsForOrganization, this); this.deleteOrganization = __bind(this.deleteOrganization, this); this.createOrganization = __bind(this.createOrganization, this); this.updateOrganization = __bind(this.updateOrganization, this); this.organization = __bind(this.organization, this); this.organizations = __bind(this.organizations, this); this.organizationsForUser = __bind(this.organizationsForUser, this); this.updateUser = __bind(this.updateUser, this); this.createUser = __bind(this.createUser, this); this.updateMe = __bind(this.updateMe, this); this.me = __bind(this.me, this); this.authenticate = __bind(this.authenticate, this); this.setAccessToken = __bind(this.setAccessToken, this); if (!(this.key && this.secret)) { throw new Error("You need to pass a key and secret"); } }
javascript
{ "resource": "" }
q13892
train
function (message) { if (this.isEnabled(Level.LOG)) { console.log.apply(console, logArgs(Level.LOG, this.category, arguments)); } }
javascript
{ "resource": "" }
q13893
train
function (message) { if (this.isEnabled(Level.INFO)) { console.info.apply(console, logArgs(Level.INFO, this.category, arguments)); } }
javascript
{ "resource": "" }
q13894
train
function (message) { if (this.isEnabled(Level.WARN)) { console.warn.apply(console, logArgs(Level.WARN, this.category, arguments)); } }
javascript
{ "resource": "" }
q13895
train
function() { annotationsDiv.children().remove(); container.find('.kelmu-arrow-handle').remove(); container.children('svg').first().remove(); container.find('audio.kelmu-annotation-sound').each(function() { try { this.pause(); } catch (err) { // Ignore if stopping sounds raised any errors } }); }
javascript
{ "resource": "" }
q13896
train
function(event) { event.preventDefault(); if ((window.kelmu.data[id].definitions['step' + window.kelmu.data[id].stepNumber] || [null]).length - 1 === window.kelmu.data[id].subStepNumber) { // Move to next step clearAnnotations(); window.kelmu.data[id].stepNumber += 1; window.kelmu.data[id].subStepNumber = 0; if (window.kelmu.data[id].actions.updateEditor) { window.kelmu.data[id].actions.updateEditor(true, true); } originalStep(event); // If the animator is not able to report when the animation is ready, // create the annotations for the next step after a delay if (!window.kelmu.data[id].animationReadyAvailable) { setTimeout(function() { createAnnotations(); if (window.kelmu.data[id].actions.updateEditor) { window.kelmu.data[id].actions.updateEditor(true, true); } }, window.kelmu.data[id].settings.animationLength); } } else { // Move to next substep window.kelmu.data[id].subStepNumber += 1; window.kelmu.data[id].actions.setSubstep(window.kelmu.data[id].subStepNumber); if (window.kelmu.data[id].actions.updateEditor) { window.kelmu.data[id].actions.updateEditor(true, true); } } if (window.kelmu.data[id].stepsToRun === 0) { // Add the current state to the undo stack if there are no more steps to run window.kelmu.data[id].undoStack.splice(window.kelmu.data[id].undoStackPointer + 1, window.kelmu.data[id].undoStack.length); window.kelmu.data[id].undoStack.push([window.kelmu.data[id].stepNumber, window.kelmu.data[id].subStepNumber]); window.kelmu.data[id].undoStackPointer += 1; } }
javascript
{ "resource": "" }
q13897
train
function(event) { event.preventDefault(); if (window.kelmu.data[id].undoStackPointer < window.kelmu.data[id].undoStack.length - 1) { var sp = window.kelmu.data[id].undoStackPointer; if (window.kelmu.data[id].undoStack[sp + 1][0] !== window.kelmu.data[id].stepNumber) { originalRedo(event); } window.kelmu.data[id].undoStackPointer += 1; sp = window.kelmu.data[id].undoStackPointer; window.kelmu.data[id].stepNumber = window.kelmu.data[id].undoStack[sp][0]; window.kelmu.data[id].subStepNumber = window.kelmu.data[id].undoStack[sp][1]; createAnnotations(); if (window.kelmu.data[id].actions.updateEditor) { window.kelmu.data[id].actions.updateEditor(true, true); } } }
javascript
{ "resource": "" }
q13898
train
function(event) { event.preventDefault(); if (window.kelmu.data[id].undoStack[0][0] !== window.kelmu.data[id].stepNumber) { originalBegin(event); } window.kelmu.data[id].undoStackPointer = 0; window.kelmu.data[id].stepNumber = 0; window.kelmu.data[id].subStepNumber = 0; createAnnotations(); if (window.kelmu.data[id].actions.updateEditor) { window.kelmu.data[id].actions.updateEditor(true, true); } }
javascript
{ "resource": "" }
q13899
train
function(event, showAction) { var data = window.kelmu.data[id]; var count = Math.max(+showAction.parameter || 1, 1); var action = function() { forward(event); }; if (!data.animationReadyAvailable) { for (var i = 0; i < count; i++) { setTimeout(action, i * (data.settings.animationLength + 300)); } } else { data.stepEvent = event; data.stepsToRun = count - 1; if (data.stepsToRun > 0) { // Notify the animator that we are running multiple steps that should be combined into a single step window.kelmu.sendMessage(id, 'showSequence'); } forward(event); } }
javascript
{ "resource": "" }