_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6800 | train | function(urls){
if(this.hCards.length > -1){
// remove all organisational hCards using fn = org.organization-name pattern
var i = this.hCards.length;
while (i--) {
if(this.hCards[i].org && this.hCards[i].org[0]['organization-name']){
if( this.hCards[i].fn === this.hCards[i].org[... | javascript | {
"resource": ""
} | |
q6801 | train | function(){
var i = filters.length,
x = 0,
urlObj = url.parse(this.url, parseQueryString=false);
while (x < i) {
if(filters[x].domain === | javascript | {
"resource": ""
} | |
q6802 | winnow | train | function winnow( elements, qualifier, not ) {
if ( isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
return !!qualifier.call( elem, i, elem ) !== not;
} );
}
// Single element
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qu... | javascript | {
"resource": ""
} |
q6803 | train | function( data ) {
// For mutual compressibility with _default, replace `this` access with a local var.
// `|| data` is dead code meant only to preserve the variable through minification.
var el = this || data;
// Claim the first handler
if ( rcheckableType.test( el.type ) &&
el.click && node... | javascript | {
"resource": ""
} | |
q6804 | finalPropName | train | function finalPropName( name ) {
var final = jQuery.cssProps[ name ] || vendorProps[ name ];
if ( final ) {
return final;
}
if ( name in emptyStyle ) { | javascript | {
"resource": ""
} |
q6805 | train | function( element, set ) {
var i = 0, length = set.length;
for ( ; i < length; i++ ) {
if ( set[ i ] !== null ) {
| javascript | {
"resource": ""
} | |
q6806 | train | function( element ) {
var placeholder,
cssPosition = element.css( "position" ),
position = element.position();
// Lock in margins first to account for form elements, which
// will change margin if you explicitly set height
// see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=10738... | javascript | {
"resource": ""
} | |
q6807 | RestAPI | train | function RestAPI() {
this.models = {};
this.router = | javascript | {
"resource": ""
} |
q6808 | hasRole | train | function hasRole(user = null, role = | javascript | {
"resource": ""
} |
q6809 | decodeStr | train | function decodeStr(s, decoder) {
try {
return decoder(s);
} catch (e) {
| javascript | {
"resource": ""
} |
q6810 | smartquotes | train | function smartquotes(context) {
if (typeof document !== 'undefined' && typeof context === 'undefined') {
listen.runOnReady(() => element(document.body));
return smartquotes;
| javascript | {
"resource": ""
} |
q6811 | omit | train | function omit (obj, props) {
props = Array.prototype.slice.call(arguments, 1);
var keys = Object.keys(obj);
var newObj = {};
for (var i = 0; i < keys.length; i++) {
| javascript | {
"resource": ""
} |
q6812 | Output | train | function Output(native) {
this.native = native;
this.id = native.id;
this.manufacturer = native.manufacturer;
| javascript | {
"resource": ""
} |
q6813 | typeOf | train | function typeOf (value) {
var type = {
hasValue: false,
isArray: false,
isPOJO: false,
isNumber: false,
};
if (value !== undefined && value !== null) {
type.hasValue = true;
var typeName = typeof value;
if (typeName === 'number') {
type.isNumber = !isNaN(value);
}
else ... | javascript | {
"resource": ""
} |
q6814 | _registerProxy | train | function _registerProxy(eventChannel) {
if (eventChannel && "function" === typeof eventChannel.registerProxy) {
eventChannel.registerProxy({
trigger: function () {
| javascript | {
"resource": ""
} |
q6815 | _initializeSerialization | train | function _initializeSerialization(options) {
this.useObjects = false === options.useObjects ? options.useObjects : _getUseObjectsUrlIndicator();
if ("undefined" === typeof this.useObjects) {
// Defaults to true
this.useObjects = true;
... | javascript | {
"resource": ""
} |
q6816 | _initializeCommunication | train | function _initializeCommunication(options) {
var mapping;
var onmessage;
// Grab the event channel and initialize a new mapper
this.eventChannel = options.eventChannel || new Channels({
events: options.events,
comma... | javascript | {
"resource": ""
} |
q6817 | _initializeCache | train | function _initializeCache(options) {
this.callbackCache = new Cacher({
max: PostMessageUtilities.parseNumber(options.maxConcurrency, DEFAULT_CONCURRENCY),
| javascript | {
"resource": ""
} |
q6818 | _initializeFailFast | train | function _initializeFailFast(options) {
var messureTime = PostMessageUtilities.parseNumber(options.messureTime, DEFAULT_MESSURE_TIME);
this.circuit = new CircuitBreaker({
timeWindow: messureTime,
slidesNumber: Math.ceil(messureTime / 100),
... | javascript | {
"resource": ""
} |
q6819 | _postMessage | train | function _postMessage(args, name) {
return this.circuit.run(function (success, failure, timeout) {
var message = _prepare.call(this, args, name, timeout);
if (message) {
try {
var initiated = this.messageChannel... | javascript | {
"resource": ""
} |
q6820 | _returnMessage | train | function _returnMessage(message, target) {
return this.circuit.run(function (success, failure) {
try {
var initiated = this.messageChannel.postMessage.call(this.messageChannel, message, target);
| javascript | {
"resource": ""
} |
q6821 | _prepare | train | function _prepare(args, name, ontimeout) {
var method;
var ttl;
var id = PostMessageUtilities.createUniqueSequence(MESSAGE_PREFIX + name + PostMessageUtilities.SEQUENCE_FORMAT);
args.unshift(id, name);
if (_isTwoWay(name)) {
... | javascript | {
"resource": ""
} |
q6822 | _handleTimeout | train | function _handleTimeout(id, callback) {
// Handle timeout
if (id && "function" === typeof callback) {
try {
callback.call(null, new Error("Callback: Operation Timeout!"));
}
catch (ex) {
... | javascript | {
"resource": ""
} |
q6823 | _handleReturnMessage | train | function _handleReturnMessage(id, method) {
var callback = this.callbackCache.get(id, true);
var args = method && method.args;
if ("function" === typeof callback) {
// First try to parse the first parameter in case the error is an object
... | javascript | {
"resource": ""
} |
q6824 | reportFile | train | function reportFile (filepath, data) {
var lines = []
// Filename
lines.push(colors.magenta.underline(path.relative(appRoot.path, filepath)))
// Loop file specific error/warning messages
data.results.forEach(function (file) {
file.messages.forEach(function (msg) {
var context = color... | javascript | {
"resource": ""
} |
q6825 | readFileSync | train | function readFileSync (args) {
var file = args.file;
var config = args.config;
var error, response;
safeCall(sendRequest, false, file.url, config, function handleResponse (err, res) {
error = err;
response = res;
});
if (error) | javascript | {
"resource": ""
} |
q6826 | readFileAsync | train | function readFileAsync (args) {
var file = args.file;
var config = args.config;
var next = args.next;
safeCall(sendRequest, false, file.url, config, function handleResponse (err, res) {
if (err) {
| javascript | {
"resource": ""
} |
q6827 | sendRequest | train | function sendRequest (async, url, config, callback) {
var req = new XMLHttpRequest();
req.open('GET', url, async);
req.onerror = handleError;
req.ontimeout = handleError;
req.onload = handleResponse;
setXHRConfig(req, config);
req.send();
function handleResponse () {
var res = {
status: ge... | javascript | {
"resource": ""
} |
q6828 | setXHRConfig | train | function setXHRConfig (req, config) {
try {
req.withCredentials = config.http.withCredentials;
}
catch (err) {
// Some browsers don't allow `withCredentials` to be set for synchronous requests
}
try {
req.timeout = config.http.timeout;
}
catch (err) {
// Some browsers don't allow `timeout... | javascript | {
"resource": ""
} |
q6829 | parseResponseHeaders | train | function parseResponseHeaders (headers) {
var parsed = {};
if (headers) {
headers.split('\n').forEach(function (line) {
var separatorIndex = line.indexOf(':');
var key = line.substr(0, separatorIndex).trim().toLowerCase();
var | javascript | {
"resource": ""
} |
q6830 | validateConfig | train | function validateConfig (config) {
var type = typeOf(config);
if (type.hasValue | javascript | {
"resource": ""
} |
q6831 | encodeHeader | train | function encodeHeader(header) {
var cursor = new BufferCursor(new buffer.Buffer(6));
cursor.writeUInt16BE(header.getFileType());
cursor.writeUInt16BE(header._trackCount);
| javascript | {
"resource": ""
} |
q6832 | isSecure | train | function isSecure(url) {
if (typeof url !== 'string') {
return false;
}
var parts = url.split('://');
if | javascript | {
"resource": ""
} |
q6833 | __fallbackChecks | train | function __fallbackChecks(err) {
if ((self.config.uri_fallback) && (host !== 'webfist.org') && (uri_index !== URIS.length - 1)) { // we have uris left to try
uri_index = uri_index + 1;
return __call();
} else if ((!self.config.tls_only) && (protocol === 'https')) { // try normal http
... | javascript | {
"resource": ""
} |
q6834 | _wrapCalls | train | function _wrapCalls(options){
return function(){
var api;
options.func.apply(options.context, Array.prototype.slice.call(arguments, 0));
for (var i = 0; i < externalAPIS.length; i++) {
api = externalAPIS[i];
if (api[op... | javascript | {
"resource": ""
} |
q6835 | callAsyncPlugin | train | function callAsyncPlugin (pluginHelper, methodName, args, callback) {
var plugins = pluginHelper.filter(filterByMethod(methodName));
args.schema = pluginHelper[__internal].schema;
args.config = | javascript | {
"resource": ""
} |
q6836 | getNodeVaue | train | function getNodeVaue(path, obj) {
// Gets a value from a JSON object
// vcard[0].url[0]
var output = null;
try {
var arrayDots = path.split(".");
for (var i = 0; i < arrayDots.length; i++) {
if (arrayDots[i].indexOf('[') > -1) {
// Reconstructs and adds access... | javascript | {
"resource": ""
} |
q6837 | getIdentity | train | function getIdentity(urlStr, urlTemplates, www) {
var identity = {};
urlObj = urlParser.parse(urlStr);
// Loop all the urlMappings for site object
for(var y = 0; y <= urlTemplates.length-1; y++){
urlTemplate = urlTemplates[y];
// remove http protocol
urlTemplat... | javascript | {
"resource": ""
} |
q6838 | endsWith | train | function endsWith(str,test){
var lastIndex = str.lastIndexOf(test); | javascript | {
"resource": ""
} |
q6839 | isUrl | train | function isUrl (obj) {
if(isString(obj)){
if((obj.indexOf('http://') > -1 || obj.indexOf('https://') > -1)
&& obj.indexOf('.') > -1)
| javascript | {
"resource": ""
} |
q6840 | encodeTrack | train | function encodeTrack(track) {
var events = track.getEvents(), data = [],
length = events.length, i,
runningStatus = null, result;
for (i = | javascript | {
"resource": ""
} |
q6841 | AnalyzeSourceCodeMiddleware | train | function AnalyzeSourceCodeMiddleware (context)
{
var grunt = context.grunt;
//--------------------------------------------------------------------------------------------------------------------
// PUBLIC API
//----------------------------------------------------------------------------------------------------... | javascript | {
"resource": ""
} |
q6842 | resolveURL | train | function resolveURL (args) {
var from = args.from;
var to = args.to;
var next = args.next;
if (protocolPattern.test(from) || protocolPattern.test(to)) {
// It's a URL, not a filesystem path, so let some other plugin resolve it
return next();
}
if (from) {
// The `from` path n... | javascript | {
"resource": ""
} |
q6843 | readFileSync | train | function readFileSync (args) {
var file = args.file;
var next = args.next;
if (isUnsupportedPath(file.url)) {
// It's not a | javascript | {
"resource": ""
} |
q6844 | inferFileMetadata | train | function inferFileMetadata (file) {
file.mimeType = lowercase(mime.lookup(file.url) || null);
| javascript | {
"resource": ""
} |
q6845 | validatePlugins | train | function validatePlugins (plugins) {
var type = typeOf(plugins);
if (type.hasValue) {
if (type.isArray) {
// Make sure all the items in the array are valid plugins
plugins.forEach(validatePlugin);
| javascript | {
"resource": ""
} |
q6846 | generate | train | function generate (opts) {
var options = opts || {},
genCount = Math.abs(options.count) >>> 0,
// min/max word count in a sentence
minCount = Math.abs(options.minCount) || 5,
maxCount = Math.abs(options.maxCount) || 20,
formater = options.format == '\\uXXXX' ? formatOutput : ... | javascript | {
"resource": ""
} |
q6847 | getCharAt | train | function getCharAt (index) {
var code = this.charCodeAt(index);
// BMP
if (code < 0xD800 || code > 0xDFFF) {
return String.fromCharCode(code);
}
// high surrogate
if (code < 0xDC00) {
// access the low surrogate
var nextCode = this.charCodeAt(index + 1);
| javascript | {
"resource": ""
} |
q6848 | File | train | function File (schema) {
/**
* The {@link Schema} that this file belongs to.
*
* @type {Schema}
*/
this.schema = schema;
/**
* The file's full (absolute) URL, without any hash
*
* @type {string}
*/
this.url = '';
/**
* The file's data. This can be any data type, including a string... | javascript | {
"resource": ""
} |
q6849 | authNeeded | train | function authNeeded () {
if (args.write === true) {
return true
}
if (args.channel.indexOf('private-') === 0) {
return true
}
| javascript | {
"resource": ""
} |
q6850 | BuildForeignScriptsMiddleware | train | function BuildForeignScriptsMiddleware (context)
{
//--------------------------------------------------------------------------------------------------------------------
// PUBLIC API
//--------------------------------------------------------------------------------------------------------------------
this.ana... | javascript | {
"resource": ""
} |
q6851 | parseHeader | train | function parseHeader(cursor) {
var chunk, fileType, trackCount, timeDivision;
try {
chunk = parseChunk('MThd', cursor);
} catch (e) {
if (e instanceof error.MIDIParserError) {
throw new error.MIDINotMIDIError();
}
}
fileType = chunk.readUInt16BE();
trackCount... | javascript | {
"resource": ""
} |
q6852 | File | train | function File(data, callback) {
stream.Duplex.call(this);
this._header = new Header();
| javascript | {
"resource": ""
} |
q6853 | defaultFormatter | train | function defaultFormatter (message) {
return `team: ${message.team} channel: ${message.channel} | javascript | {
"resource": ""
} |
q6854 | MakeReleaseBuildMiddleware | train | function MakeReleaseBuildMiddleware (context)
{
var options = context.options.releaseBuild;
/**
* Grunt's verbose output API.
* @type {Object}
*/
var verboseOut = context.grunt.log.verbose;
/** @type {string[]} */
var traceOutput = [];
//------------------------------------------------------------... | javascript | {
"resource": ""
} |
q6855 | outputModuleDefinitions | train | function outputModuleDefinitions (module, headWasOutput)
{
for (var i = 0, m = module.bodies.length; i < m; ++i) {
var bodyPath = module.bodyPaths[i];
if (!bodyPath)
console.log (module.name, i, module.bodies.length, module.bodyPaths);
// Skip bodies who's corresponding file was already ... | javascript | {
"resource": ""
} |
q6856 | conditionalIndent | train | function conditionalIndent (result)
{
return result.status === STAT.INDENTED ? result.data | javascript | {
"resource": ""
} |
q6857 | warnAboutGlobalCode | train | function warnAboutGlobalCode (sandbox, path)
{
var msg = csprintf ('yellow', 'Incompatible code found on the global scope!'.red + NL +
(path ? reportErrorLocation (path) : '') +
getExplanation (
'This kind of code will behave differently between release and debug builds.' + NL +
'You s... | javascript | {
"resource": ""
} |
q6858 | scanForOptimization | train | function scanForOptimization (context)
{
var module, verboseOut = context.grunt.log.verbose;
// Track repeated files to determine which modules can be optimized.
Object.keys (context.modules).forEach (function (name)
{
if (context.modules.hasOwnProperty (name)) {
module = context.modules[name];
... | javascript | {
"resource": ""
} |
q6859 | scan | train | function scan (moduleName, first)
{
var module = context.modules[moduleName];
if (!module)
throw new Error (sprintf ("Module '%' was not found.", moduleName));
// Ignore the module if it's external.
if (module.external)
return false;
if (!module.optimize) {
if (first)
mod... | javascript | {
"resource": ""
} |
q6860 | validatePriority | train | function validatePriority (priority) {
var type = typeOf(priority);
if (type.hasValue && !type.isNumber) {
| javascript | {
"resource": ""
} |
q6861 | deepAssign | train | function deepAssign (target, source) {
var keys = Object.keys(source);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var oldValue = target[key];
| javascript | {
"resource": ""
} |
q6862 | deepClone | train | function deepClone (value, oldValue) {
var type = typeOf(value);
var clone;
if (type.isPOJO) {
var oldType = typeOf(oldValue);
if (oldType.isPOJO) {
// Return a merged clone of the old POJO and the new POJO
clone = deepAssign({}, oldValue);
return deepAssign(clone, value);
}
els... | javascript | {
"resource": ""
} |
q6863 | crawl | train | function crawl (obj, file) {
var type = typeOf(obj);
if (!type.isPOJO && !type.isArray) {
return;
}
if (type.isPOJO && isFileReference(obj)) {
// We found a file reference, so resolve it
resolveFileReference(obj.$ref, file);
}
// Crawl this POJO or Array, looking for nested JSON References
... | javascript | {
"resource": ""
} |
q6864 | getBitbucketId | train | function getBitbucketId (text) {
text = 'markdown-header-' + text
.toLowerCase()
.replace(/\\(.)/g, (_m, c) => c.charCodeAt(0)) // add escaped chars with their charcode
.normalize('NFKD').replace(/[\u0300-\u036f]/g, '')
.replace(/[^\w\s-]/g, '')
.replace(/\s+/g, '-') | javascript | {
"resource": ""
} |
q6865 | getPandocId | train | function getPandocId (text) {
text = text
.replace(emojiRegex(), '') // Strip emojis
.toLowerCase()
.trim()
.replace(/%25|%/ig, '') // remove single % signs
.replace(RE_ENTITIES, '') // remove xml/html entities
| javascript | {
"resource": ""
} |
q6866 | getMarkedId | train | function getMarkedId (text) {
return entities.decode(text)
.toLowerCase()
| javascript | {
"resource": ""
} |
q6867 | getMarkDownItAnchorId | train | function getMarkDownItAnchorId (text) {
text = text
.replace(/^[<]|[>]$/g, '') // correct markdown format bold/url
text = entities.decode(text)
| javascript | {
"resource": ""
} |
q6868 | slugger | train | function slugger (header, mode) {
mode = mode || 'marked'
let replace
switch (mode) {
case MODE.MARKED:
replace = getMarkedId
break
case MODE.MARKDOWNIT:
return getMarkDownItAnchorId(header)
case MODE.GITHUB:
replace = getGithubId
break
case MODE.GITLAB:
replac... | javascript | {
"resource": ""
} |
q6869 | registerHelpListener | train | function registerHelpListener (controller, helpInfo) {
controller.hears('^help ' + helpInfo.command + '$', 'direct_mention,direct_message', (bot, message) => {
let replyText = helpInfo.text
if (typeof helpInfo.text === 'function') {
| javascript | {
"resource": ""
} |
q6870 | toEvent | train | function toEvent(message) {
if (message) {
if (message.error) {
PostMessageUtilities.log("Error on message: " + message.error, "ERROR", "PostMessageMapper");
return function() {
return message;
};
| javascript | {
"resource": ""
} |
q6871 | toMessage | train | function toMessage(id, name) {
return {
method: {
id: id,
name: name,
| javascript | {
"resource": ""
} |
q6872 | _getMappedMethod | train | function _getMappedMethod(message) {
var method = message && message.method;
var name = method && method.name;
var args = method && method.args;
var eventChannel = this.eventChannel;
return function() {
if (eventChannel && eventChannel[name]) ... | javascript | {
"resource": ""
} |
q6873 | train | function( numberOfOptions ) {
var visualCaptchaSession = this.session[ this.namespace ],
imageValues = [];
// Avoid the next IF failing if a string with a number is sent
numberOfOptions = parseInt( numberOfOptions, 10 );
// If it's not a valid number, default to 5
i... | javascript | {
"resource": ""
} | |
q6874 | train | function( response, fileType ) {
var fs = require( 'fs' ),
mime = require( 'mime' ),
audioOption = this.getValidAudioOption(),
audioFileName = audioOption ? audioOption.path : '',// If there's no audioOption, we set the file name as empty
audioFilePath = __dirname... | javascript | {
"resource": ""
} | |
q6875 | train | function( index, response, isRetina ) {
var fs = require( 'fs' ),
imageOption = this.getImageOptionAtIndex( index ),
imageFileName = imageOption ? imageOption.path : '',// If there's no imageOption, we set the file name as empty
imageFilePath = __dirname + '/images/' + imageF... | javascript | {
"resource": ""
} | |
q6876 | connect | train | async function connect(address) {
const running = await isRunning(address) | javascript | {
"resource": ""
} |
q6877 | walk | train | function walk(obj, path, initializeMissing = false) {
let newObj = obj;
if (path) {
const ar = path.split('.');
while (ar.length) {
const k = ar.shift();
if (initializeMissing && obj[k] == null) {
newObj[k] = {};
newObj = newObj[k];
} else if | javascript | {
"resource": ""
} |
q6878 | getSlackbotConfig | train | function getSlackbotConfig (config) {
return _.defaults(config.botkit, {debug: | javascript | {
"resource": ""
} |
q6879 | formatConfig | train | function formatConfig (config) {
_.defaults(config, {debug: false, plugins: []})
config.debugOptions = config.debugOptions || {}
config.connectedTeams = new Set()
if (!Array.isArray(config.plugins)) {
config.plugins = [config.plugins]
}
config.scopes = _.chain(config.plugins)
.map('scopes')
.... | javascript | {
"resource": ""
} |
q6880 | lerpW | train | function lerpW(a, wa, b, wb) {
var d = wb - wa
var t = -wa / d
if(t < 0.0) {
t = 0.0
} else if(t > 1.0) | javascript | {
"resource": ""
} |
q6881 | connect | train | function connect() {
return new Promise(function (resolve, reject) {
navigator.requestMIDIAccess().then(function (access) {
resolve(new Driver(access));
| javascript | {
"resource": ""
} |
q6882 | train | function(callback){
var options = this.options,
cache = this.options.cache,
logger = this.options.logger;
if(this.url){
logger.log('fetch page: ' + this.url);
// if there is a cache and it holds the url
if(cache &&cache.has(this.url)){
// http status - content locat... | javascript | {
"resource": ""
} | |
q6883 | train | function(callback){
var options = {},// utils.clone( this.options ),
self = this;
options.baseUrl = self.url;
self.startedUFParse = new Date();
//console.log(self.url)
try
{
parser.parseHtml (self.html, options, function(err, data){
//console.log( JSON.stringify(data) ... | javascript | {
"resource": ""
} | |
q6884 | train | function(callback){
var options = this.options,
cache = this.options.cache,
logger = this.options.logger;
if(this.apiInterface){
logger.info('fetch data from api: ' + this.apiInterface.name);
var sgn = this.profile.identity.sgn || '',
self = this;
try
... | javascript | {
"resource": ""
} | |
q6885 | IncludeRequiredScriptsMiddleware | train | function IncludeRequiredScriptsMiddleware (context)
{
var path = require ('path');
/**
* Paths of the required scripts.
* @type {string[]}
*/
var paths = [];
/**
* File content of the required scripts.
* @type {string[]}
*/
var sources = [];
/**
* Map of required script paths, as the... | javascript | {
"resource": ""
} |
q6886 | prep | train | function prep (id) {
id = id.replace(/(?:%20|\+)/g, | javascript | {
"resource": ""
} |
q6887 | train | function (fieldname, file, filename) {
const acceptedExtensions = strapi.api.upload.config.acceptedExtensions || [];
if (acceptedExtensions[0] !== '*' && !_.contains(acceptedExtensions, path.extname(filename))) {
this.status = 400;
this.body = {
| javascript | {
"resource": ""
} | |
q6888 | createHeaderGetter | train | function createHeaderGetter(str) {
var header = str.toLowerCase()
return headerGetter
function headerGetter(req, res) {
// set appropriate Vary header
res.vary(str)
| javascript | {
"resource": ""
} |
q6889 | PatternEmitter | train | function PatternEmitter() {
EventEmitter.call(this);
this.event = '';
this._regexesCount = 0;
this._events = this._events || | javascript | {
"resource": ""
} |
q6890 | iterate | train | function iterate(self, interceptors, args, after) {
if (!interceptors || !interceptors.length) {
after.apply(self, args);
return;
}
var i = 0;
var len = interceptors.length;
if (!len) {
after.apply(self, args);
return;
}
function nextIntercepto... | javascript | {
"resource": ""
} |
q6891 | createTransaction | train | function createTransaction (database, sequelizeTransaction) {
const transaction = Object.assign(sequelizeTransaction, {
getImplementation () {
return sequelizeTransaction
},
| javascript | {
"resource": ""
} |
q6892 | train | function(fn, suffix) {
if(suffix.charAt(0) !== '.') {
suffix = '.' + suffix;
}
if(fn.length <= suffix.length) { | javascript | {
"resource": ""
} | |
q6893 | combineReducers | train | function combineReducers (reducers) {
const databaseReducers = Object.keys(reducers)
.map((collectionName) => {
const reducer = reducers[ collectionName ]
return createDatabaseReducer(reducer, collectionName)
})
| javascript | {
"resource": ""
} |
q6894 | createDatabaseReducer | train | function createDatabaseReducer (collectionReducer, collectionName) {
return (database, event) => {
const collection = database.collections[ collectionName ]
if (!collection) {
throw new | javascript | {
"resource": ""
} |
q6895 | isReady | train | function isReady(aImage) {
// first check : load status
if (typeof aImage.complete === "boolean" && !aImage.complete) return false;
// second check : validity of source (can | javascript | {
"resource": ""
} |
q6896 | onReady | train | function onReady(aImage, aCallback, aErrorCallback) {
// if this didn't resolve in a full second, we presume the Image is corrupt
var MAX_ITERATIONS = 60;
var iterations = 0;
function readyCheck() {
if (Loader.isReady(aImage)) {
aCallback();
} ... | javascript | {
"resource": ""
} |
q6897 | listRequest | train | function listRequest (path, options = {}, cb) {
if (typeof options === 'function') {
cb = options;
options = {};
}
// serialise options
let opts = [];
for (let k in options) {
// The whole URL *minus* the scheme and "://" (for whatever benighted reason) has to be at most
// 4096 characters lon... | javascript | {
"resource": ""
} |
q6898 | template | train | function template(str, data, options) {
var data = data || {};
var options = options || {};
var keys = Array.isArray(data) ? Array.apply(null, { length: data.length }).map(Number.call, Number) : Object.keys(data);
var len = keys.length;
if (!len) {
return str;
}
var before = options.before !== unde... | javascript | {
"resource": ""
} |
q6899 | bootstrap | train | function bootstrap (bootstrappers) {
const bootstrapPromise = bootstrappers.reduce(
(metaPromise, bootstrapper) => metaPromise.then((prevMeta) =>
Promise.resolve(bootstrapper(prevMeta)).then((newMeta) => Object.assign({}, prevMeta, newMeta))
),
Promise.resolve({})
).then((meta) => | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.