_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q63700
parseNumericLiteral
test
function parseNumericLiteral(AST) { var literal = [], value; while(hasNext() && validNum(peek())) { literal[literal.length] = next(); } value = parseFloat(literal.join('')); /** * Thanks to CMS's answer on StackOverflow: * http://stackoverflow.com/questions/18082/validate-numb...
javascript
{ "resource": "" }
q63701
stage1
test
function stage1(AST) { if(hasNext()) { switch (peek()) { case 'a': parseArray(AST); break; case 'o': parseObject(AST); break; default: if (/[nsSbfdr_]/.test(peek())) { parseGeneric(AST,peek()); } else { ...
javascript
{ "resource": "" }
q63702
curry
test
function curry(fun, args) { return function (x) { return fun.apply(bindingContext, args.concat([x])); }; }
javascript
{ "resource": "" }
q63703
matchArray
test
function matchArray(m,a) { var from = 0, rest = false, restBindingResult, index, matcher, item, matchResult, restOfArray = [], i, result = { result: false, param: a }; // If this isn't an array then it can't match if (!is(a, '[object Array]')) { return result; } // If the...
javascript
{ "resource": "" }
q63704
compileNode
test
function compileNode(ast) { var result = [], index, node, matcher; for(index=0;index<ast.length;index++) { node = ast[index]; switch(node.type) { case 'a': matcher = curry(matchArray, [compileNode(node.nodes)]); break; case 'o': matcher = curry(ma...
javascript
{ "resource": "" }
q63705
getName
test
function getName(tag) { return tag.name ? tag.name.value.toLowerCase() : `#${tag.type}`; }
javascript
{ "resource": "" }
q63706
eatAttributeValue
test
function eatAttributeValue(stream) { const start = stream.pos; if (eatQuoted(stream)) { // Should return token that points to unquoted value. // Use stream readers’ public API to traverse instead of direct // manipulation const current = stream.pos; let valueStart, valueEnd; stream.pos = start; stream....
javascript
{ "resource": "" }
q63707
isUnquoted
test
function isUnquoted(code) { return !isNaN(code) && !isQuote(code) && !isSpace(code) && !isTerminator(code); }
javascript
{ "resource": "" }
q63708
setDefault
test
function setDefault(obj, key, val) { if (_.isUndefined(obj[key])) { obj[key] = val; return val; } return obj[key]; }
javascript
{ "resource": "" }
q63709
getXml
test
function getXml(path, finish) { fs.readFile(path, function(err, data) { if (err) throw err; xmlParser.parseString(data, function (err, result) { if (err) throw err; finish(result); }); }); }
javascript
{ "resource": "" }
q63710
appendUISource
test
function appendUISource(client){ angoose.getLogger('angoose').debug("Appending angoose-ui sources"); // client.source += " \n;console.log('####################----------- angoose-ui -----------##############');\n"; var output=""; output += readFile(path.resolve(__dirname, 'angular-modules.js')); outp...
javascript
{ "resource": "" }
q63711
error
test
function error(msg, addHint) { console.log('\x1b[31m'); console.log('The compiler has stopped on an error') console.log(`\x1b[1;31mError: ${msg}\x1b[0m`); if (addHint) console.log(`\nPlease use -h to show the usage`); process.exit(1); }
javascript
{ "resource": "" }
q63712
compile
test
function compile(modelName, schema, dependencies) { logger.trace("Compiling schema ", modelName) var model = function AngooseModule(data) { //@todo proper clone for (var i in data) { this[i] = data[i]; } }; model.toString = function()...
javascript
{ "resource": "" }
q63713
addProps
test
function addProps(props, options) { if (!props) return '## No props' const keys = Object.keys(props).filter(key => filterProps(key, props[key], options), ) const filteredProps = keys.reduce( (last, key) => ({ ...last, [key]: props[key] }), {}, ) let output = '\n## Props\n' let isFlow = false ...
javascript
{ "resource": "" }
q63714
debounce
test
function debounce(quietMillis, fn, ctx ) { ctx = ctx || undefined; var timeout; return function () { var args = arguments; clearTimeout(timeout); timeout = setTimeout(function() { fn.apply(ctx, args); }, quietMillis); }; }
javascript
{ "resource": "" }
q63715
matroshka
test
function matroshka(fn) { var babushka = fn; Object.keys(process.namespaces).forEach(function (name) { babushka = process.namespaces[name].bind(babushka); }); return babushka; }
javascript
{ "resource": "" }
q63716
findTagged
test
function findTagged(modelClass,tag){ if(!modelClass || !modelClass.schema) return []; var cols = []; Object.keys(modelClass.schema.paths).forEach(function(path){ var data = modelClass.schema.paths[path]; if(data.options.tags && data.options.tags.indexOf(tag)>=0) cols.push(data)...
javascript
{ "resource": "" }
q63717
error
test
function error(msg) { if (exports.error) exports.error(msg); else console.log('Error: ' + msg); }
javascript
{ "resource": "" }
q63718
call
test
function call(name, isLong) { var obj = isLong ? long[name] : short[name]; if (!obj) return error(`Unknown argument '${name}'`); if (n + obj.length > count) return error(`Too few arguments after '${name}'`); var arr = process.argv.slice(n, n + obj.length); n += obj.length; obj.callback(arr); }
javascript
{ "resource": "" }
q63719
findInputElement
test
function findInputElement(templateElement) { return angular.element(templateElement.find('input')[0] || templateElement.find('select')[0] || templateElement.find('textarea')[0]); }
javascript
{ "resource": "" }
q63720
getValidationMessageMap
test
function getValidationMessageMap(originalElement) { // Find all the <validator> child elements and extract their (key, message) info var validationMessages = {}; angular.forEach(originalElement.find('validator'), function(element) { // Wrap the element in jqLite/jQuery element = angular.element(...
javascript
{ "resource": "" }
q63721
registerClass
test
function registerClass(nameOrOpts, claz){ var opts = typeof(nameOrOpts) == 'object'?nameOrOpts: {name: nameOrOpts}; var className = opts.name; if(!className) throw "Missing module name: "+ className if(beans[className]) logger.warn("Overriding existing bean: ", className); if(claz._angooseme...
javascript
{ "resource": "" }
q63722
config
test
function config(path, val){ if(!path) return options; /**@todo: probably a deep copy */ if(!angoose.initialized && typeof(path) == 'string') throw "Cannot call config(" + path+") before angoose is intialized"; //if(angoose.initialized && typeof(conf) == 'object') throw "Cannot config Angoose after startup";...
javascript
{ "resource": "" }
q63723
connect
test
function connect (url, next) { log('connecting to %s', url); mongo.Db.connect(url, { db: { w: 1 }}, next); }
javascript
{ "resource": "" }
q63724
startShell
test
function startShell (db, program, files) { var repl = global.repl = term(db); createContext(db, repl, function () { var code = program.eval; if (code) { executeJS(code); if (!program.shell) { repl.emit('exit'); return; } } if (files.length) { executeFiles(f...
javascript
{ "resource": "" }
q63725
executeFiles
test
function executeFiles (files) { var dir = process.cwd(); files.forEach(function (file) { require(dir + '/' + file); }); }
javascript
{ "resource": "" }
q63726
wrap
test
function wrap (proto, name) { var old = proto[name]; proto[name] = function () { if (global.repl) global.repl.bufferStart(); var args = slice(arguments); var last = args[args.length-1]; if ('function' == typeof last) { args[args.length-1] = function () { if (global.repl) global.repl.b...
javascript
{ "resource": "" }
q63727
handleError
test
function handleError (err, cb) { if (err) { if (cb) { return process.nextTick(function(){ cb(err); }); } console.error(err); } }
javascript
{ "resource": "" }
q63728
tablature
test
function tablature(conf) { const { keys = [], data = [], headings = {}, replacements = {}, centerValues = [], centerHeadings = [], } = conf const [i] = data if (!i) return '' const cv = makeBinaryHash(centerValues) const hv = makeBinaryHash(centerHeadings) const k = Object.keys(i...
javascript
{ "resource": "" }
q63729
_save
test
function _save() { if (db.source && db.write && writeOnChange) { var str = JSON.stringify(db.object); if (str !== db._checksum) { db._checksum = str; return db.write(db.source, db.object); } } }
javascript
{ "resource": "" }
q63730
Picklr
test
function Picklr (startDir, options) { options = options || {}; let defaultExcludeDirsRe; if (/^\./.test(startDir)) { defaultExcludeDirsRe = /\/\.|node_modules/i; } else { defaultExcludeDirsRe = /^\.|\/\.|node_modules/i; } this.totalFileCount = 0; this.matchedFileCount = 0; this.startDir = star...
javascript
{ "resource": "" }
q63731
test
function (p) { fs.readdirSync(p).forEach(function (file) { const curPath = path.join(p, path.sep, file); const stats = fs.statSync(curPath); if (this.isDirectory(stats, curPath)) { this.recurseFiles(curPath); } else if (this.isFile(stats, curPath)) { this.picklrActions[this....
javascript
{ "resource": "" }
q63732
test
function (stats, p) { let result = stats.isFile(); if (result) { const ext = path.extname(p); result = this.includeExts.indexOf(ext) !== -1; } return result; }
javascript
{ "resource": "" }
q63733
test
function (stats, p) { let result = stats.isDirectory(); if (result) { result = !this.excludeDirs.test(p); } return result; }
javascript
{ "resource": "" }
q63734
processAllFiles
test
function processAllFiles (startDir, options) { const picklr = new Picklr(startDir, options); picklr.recurseFiles(startDir); }
javascript
{ "resource": "" }
q63735
processFile
test
function processFile (filePath, update) { let change, found = false; const lines = fs.readFileSync(filePath, { encoding: 'utf8' }).split('\n'); for (let i = 0; i < lines.length; i++) { if (lines[i].indexOf(this.targetText) !== -1) { found = true; change = lines[i].replace( this.targetText...
javascript
{ "resource": "" }
q63736
initHTTPServer
test
async function initHTTPServer({ ENV = {}, HOST = '127.0.0.1', PORT = 8080, MAX_HEADERS_COUNT = 800, KEEP_ALIVE_TIMEOUT = ms('5m'), TIMEOUT = ms('2m'), MAX_CONNECTIONS, httpRouter, log = noop, }) { const sockets = ENV.DESTROY_SOCKETS ? new Set() : {}.undef; const httpServer = http.createServer(http...
javascript
{ "resource": "" }
q63737
sortAndAddFirstElement
test
function sortAndAddFirstElement(array, sortBy, element) { return _(array) .sortBy(sortBy) .unshift(element) .value(); }
javascript
{ "resource": "" }
q63738
objectInterface
test
function objectInterface(config) { return function(obj) { var result = {}; for (var i = 0; i < config.length; i++) { var OR, NEXT, REAL; if ((OR = config[i].split('/')) && OR[1]) { result[OR[0]] = obj[OR[0]] || Function('return ' + OR[1])(); } ...
javascript
{ "resource": "" }
q63739
httpTransaction
test
function httpTransaction(req, res) { let initializationPromise; /* Architecture Note #3.1: New Transaction The idea is to maintain a hash of each pending transaction. To do so, we create a transaction object that contains useful informations about the transaction and we store it into the ...
javascript
{ "resource": "" }
q63740
dateDifference
test
function dateDifference(date1, date2, differenceType) { var diffMilliseconds = Math.abs(date1 - date2); switch(differenceType) { case 'days': return dates._getDaysDiff(diffMilliseconds); case 'hours': return dates._differenceInHours(diffMilliseconds); case 'minut...
javascript
{ "resource": "" }
q63741
initErrorHandler
test
function initErrorHandler({ ENV = {}, DEBUG_NODE_ENVS = DEFAULT_DEBUG_NODE_ENVS, STRINGIFYERS = DEFAULT_STRINGIFYERS, }) { return Promise.resolve(errorHandler); /** * Handle an HTTP transaction error and * map it to a serializable response * @param {String} transactionId * A raw NodeJS HTTP inc...
javascript
{ "resource": "" }
q63742
dateDifferenceFromNow
test
function dateDifferenceFromNow(date, differenceType) { var now = new Date(), diffMilliseconds = Math.abs(date - now); switch(differenceType) { case 'days': return dates._getDaysDiff(diffMilliseconds); case 'hours': return dates._differenceInHours(diffMilliseconds...
javascript
{ "resource": "" }
q63743
consumePair
test
function consumePair(stream, close, open) { const start = stream.pos; if (stream.eat(close)) { while (!stream.sol()) { if (stream.eat(open)) { return true; } stream.pos--; } } stream.pos = start; return false; }
javascript
{ "resource": "" }
q63744
consumeArray
test
function consumeArray(stream, arr) { const start = stream.pos; let consumed = false; for (let i = arr.length - 1; i >= 0 && !stream.sol(); i--) { if (!stream.eat(arr[i])) { break; } consumed = i === 0; } if (!consumed) { stream.pos = start; } return consumed; }
javascript
{ "resource": "" }
q63745
isIdent
test
function isIdent(c) { return c === COLON || c === DASH || isAlpha(c) || isNumber(c); }
javascript
{ "resource": "" }
q63746
onCycle
test
function onCycle(event) { if(objectPool.length == 0) { throw new Error('Pool ran out of objects'); } console.log(String(event.target)); initPool(); }
javascript
{ "resource": "" }
q63747
json
test
function json(file) { var filename = path.basename(file.path, path.extname(file.path)) + ".json"; return optional(path.join(path.dirname(file.path), filename)) || {}; }
javascript
{ "resource": "" }
q63748
test
function (event) { if (event.name === 'goToLevel' && event.level !== self.level) { self.pushLevel(event.level); } }
javascript
{ "resource": "" }
q63749
test
function (event) { if (event.name === 'goToLevel') { if (event.level === self.level) { this.transitionTo(open); } else { self.pushLevel(event.level); this.transitionTo(moving); } } }
javascript
{ "resource": "" }
q63750
decryptGCM
test
function decryptGCM(encryptedComponents, keyDerivationInfo) { // Extract the components const encryptedContent = encryptedComponents.content; const iv = new Buffer(encryptedComponents.iv, "hex"); const { auth: tagHex, salt } = encryptedComponents; // Prepare tool const decryptTool = crypto.creat...
javascript
{ "resource": "" }
q63751
encryptCBC
test
function encryptCBC(text, keyDerivationInfo, iv) { return Promise.resolve().then(() => { const ivHex = iv.toString("hex"); const encryptTool = crypto.createCipheriv(ENC_ALGORITHM_CBC, keyDerivationInfo.key, iv); const hmacTool = crypto.createHmac(HMAC_ALGORITHM, keyDerivationInfo.hmac); ...
javascript
{ "resource": "" }
q63752
encryptGCM
test
function encryptGCM(text, keyDerivationInfo, iv) { return Promise.resolve().then(() => { const ivHex = iv.toString("hex"); const { rounds } = keyDerivationInfo; const encryptTool = crypto.createCipheriv(ENC_ALGORITHM_GCM, keyDerivationInfo.key, iv); // Add additional auth data ...
javascript
{ "resource": "" }
q63753
unpackEncryptedContent
test
function unpackEncryptedContent(encryptedContent) { const [content, iv, salt, auth, roundsRaw, methodRaw] = encryptedContent.split("$"); // iocane was originally part of Buttercup's core package and used defaults from that originally. // There will be 4 components for pre 0.15.0 archives, and 5 in newer arc...
javascript
{ "resource": "" }
q63754
deriveFromPassword
test
function deriveFromPassword(pbkdf2Gen, password, salt, rounds, generateHMAC = true) { if (!password) { return Promise.reject(new Error("Failed deriving key: Password must be provided")); } if (!salt) { return Promise.reject(new Error("Failed deriving key: Salt must be provided")); } ...
javascript
{ "resource": "" }
q63755
pbkdf2
test
function pbkdf2(password, salt, rounds, bits) { return new Promise((resolve, reject) => { deriveKey(password, salt, rounds, bits / 8, DERIVED_KEY_ALGORITHM, (err, key) => { if (err) { return reject(err); } return resolve(key); }); }); }
javascript
{ "resource": "" }
q63756
createEncodeStream
test
function createEncodeStream(schema) { const stream = new BinaryStream({ readableObjectMode: false, writableObjectMode: true, transform: transformEncode, }); stream[kschema] = schema; return stream; }
javascript
{ "resource": "" }
q63757
createDecodeStream
test
function createDecodeStream(bufOrSchema) { let schema = null; const isBuffer = Buffer.isBuffer(bufOrSchema); if (!isBuffer) { schema = bufOrSchema; } const stream = new BinaryStream({ transform: transformDecode, readableObjectMode: true, writableObjectMode: false, }); stream[kschema] = ...
javascript
{ "resource": "" }
q63758
erdosRenyi
test
function erdosRenyi(GraphClass, options) { if (!isGraphConstructor(GraphClass)) throw new Error('graphology-generators/random/erdos-renyi: invalid Graph constructor.'); var order = options.order, probability = options.probability, rng = options.rng || Math.random; var graph = new GraphClass(); ...
javascript
{ "resource": "" }
q63759
erdosRenyiSparse
test
function erdosRenyiSparse(GraphClass, options) { if (!isGraphConstructor(GraphClass)) throw new Error('graphology-generators/random/erdos-renyi: invalid Graph constructor.'); var order = options.order, probability = options.probability, rng = options.rng || Math.random; var graph = new GraphClas...
javascript
{ "resource": "" }
q63760
single_curve
test
function single_curve(d, ctx) { var centroids = compute_centroids(d); var cps = compute_control_points(centroids); ctx.moveTo(cps[0].e(1), cps[0].e(2)); for (var i = 1; i < cps.length; i += 3) { if (__.showControlPoints) { for (var j = 0; j < 3; j++) { ...
javascript
{ "resource": "" }
q63761
color_path
test
function color_path(d, ctx) { ctx.beginPath(); if ((__.bundleDimension !== null && __.bundlingStrength > 0) || __.smoothness > 0) { single_curve(d, ctx); } else { single_path(d, ctx); } ctx.stroke(); }
javascript
{ "resource": "" }
q63762
paths
test
function paths(data, ctx) { ctx.clearRect(-1, -1, w() + 2, h() + 2); ctx.beginPath(); data.forEach(function(d) { if ((__.bundleDimension !== null && __.bundlingStrength > 0) || __.smoothness > 0) { single_curve(d, ctx); } else { single_path...
javascript
{ "resource": "" }
q63763
brushUpdated
test
function brushUpdated(newSelection) { __.brushed = newSelection; events.brush.call(pc,__.brushed); pc.renderBrushed(); }
javascript
{ "resource": "" }
q63764
selected
test
function selected() { var actives = d3.keys(__.dimensions).filter(is_brushed), extents = actives.map(function(p) { return brushes[p].extent(); }); // We don't want to return the full data set when there are no axes brushed. // Actually, when there are no axes brushed...
javascript
{ "resource": "" }
q63765
consecutive
test
function consecutive(first, second) { var length = d3.keys(__.dimensions).length; return d3.keys(__.dimensions).some(function(d, i) { return (d === first) ? i + i < length && __.dimensions[i + 1] === second ...
javascript
{ "resource": "" }
q63766
convertProperty
test
function convertProperty(originalKey, originalValue, isRtl) { const key = getPropertyDoppelganger(originalKey, isRtl) const value = getValueDoppelganger(key, originalValue, isRtl) return {key, value} }
javascript
{ "resource": "" }
q63767
getPropertyDoppelganger
test
function getPropertyDoppelganger(property, isRtl) { const convertedProperty = isRtl ? propertiesToConvert.rtl[property] : propertiesToConvert.ltr[property] return convertedProperty || property }
javascript
{ "resource": "" }
q63768
ReadFileCache
test
function ReadFileCache(sourceDir, charset) { assert.ok(this instanceof ReadFileCache); assert.strictEqual(typeof sourceDir, "string"); this.charset = charset; EventEmitter.call(this); Object.defineProperties(this, { sourceDir: { value: sourceDir }, sourceCache: { value: {} } }...
javascript
{ "resource": "" }
q63769
done
test
function done(err, resource) { totalRequestElapsed += ((new Date().getTime()) - started); ++totalRequests; stats.avgFetchTime = parseInt(totalRequestElapsed / totalRequests); if (err || verbose) util.log('cache|execute|done|err='+err+'|result='+(resource ? 'found':'null')...
javascript
{ "resource": "" }
q63770
test
function(options) { options = (options||{}); this.agent = options.agent; this.defaults = options.defaults||{}; this.log = options.logger||(new Ax({ level: "info" })); this._sharedCookieJar = new CookieJar(); this.logCurl = options.logCurl || false; }
javascript
{ "resource": "" }
q63771
test
function(level,message) { var debug = (level=="debug"||level=="error"); if (!message) { return message.toString(); } if (typeof(message) == "object") { if (message instanceof Error && debug) { return message.stack; } else { return inspect(message); } } else { return message.toString(...
javascript
{ "resource": "" }
q63772
test
function(options) { this.log = options.logger; this.cookieJar = options.cookieJar; this.encoding = options.encoding; this.logCurl = options.logCurl; processOptions(this,options||{}); createRequest(this); }
javascript
{ "resource": "" }
q63773
test
function(request,options) { request.log.debug("Processing request options .."); // We'll use `request.emitter` to manage the `on` event handlers. request.emitter = (new Emitter); request.agent = options.agent; // Set up the handlers ... if (options.on) { for (var key in options.on) { if (optio...
javascript
{ "resource": "" }
q63774
test
function(event) { var emitter = request.emitter; var textStatus = STATUS_CODES[response.status] ? STATUS_CODES[response.status].toLowerCase() : null; if (emitter.listeners(response.status).length > 0 || emitter.listeners(textStatus).length > 0) { emitter.emit(response.status, response)...
javascript
{ "resource": "" }
q63775
test
function (req) { var headers = req.getHeaders(); var headerString = ""; for (var key in headers) { headerString += '-H "' + key + ": " + headers[key] + '" '; } var bodyString = "" if (req.content) { bodyString += "-d '" + req.content.body + "' "; } var query = req.query ? '?' + req.query : "...
javascript
{ "resource": "" }
q63776
test
function(raw, request, callback) { var response = this; this._raw = raw; // The `._setHeaders` method is "private"; you can't otherwise set headers on // the response. this._setHeaders.call(this,raw.headers); // store any cookies if (request.cookieJar && this.getHeader('set-cookie')) { var cookie...
javascript
{ "resource": "" }
q63777
test
function(constructor) { constructor.prototype.getHeader = function(name) { return getHeader(this,name); }; constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); }; }
javascript
{ "resource": "" }
q63778
test
function(constructor) { constructor.prototype._setHeader = function(key,value) { return setHeader(this,key,value); }; constructor.prototype._setHeaders = function(hash) { return setHeaders(this,hash); }; }
javascript
{ "resource": "" }
q63779
test
function(constructor) { constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); }; constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); }; }
javascript
{ "resource": "" }
q63780
test
function(constructor) { constructor.prototype.getHeader = function(name) { return getHeader(this,name); }; constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); }; constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); }; constructor.protot...
javascript
{ "resource": "" }
q63781
test
function(encoding) { var enc = encoding || "utf8"; var codecOptions = undefined; while (1) { if (getType(enc) === "String") enc = enc.replace(/[- ]/g, "").toLowerCase(); var codec = iconv.encodings[enc]; var type = getType(codec); i...
javascript
{ "resource": "" }
q63782
test
function(options) { // Prepare chars if needed if (!options.chars || (options.chars.length !== 128 && options.chars.length !== 256)) throw new Error("Encoding '"+options.type+"' has incorrect 'chars' (must be of len 128 or 256)"); if (options.chars.length...
javascript
{ "resource": "" }
q63783
test
function(options) { var table = options.table, key, revCharsTable = options.revCharsTable; if (!table) { throw new Error("Encoding '" + options.type +"' has incorect 'table' option"); } if(!revCharsTable) { revCharsTable = options.revCharsT...
javascript
{ "resource": "" }
q63784
encodeUserAuth
test
function encodeUserAuth(user) { if (!user) { return null; } var token = user.token; if (token) { var sha1 = typeof token === 'object' ? token.sha1 : token; return 'token ' + sha1; } return 'Basic ' + base64.encode(user.username + ':' + user.password) }
javascript
{ "resource": "" }
q63785
Vec4
test
function Vec4() { switch ( arguments.length ) { case 1: // array or VecN argument var argument = arguments[0]; this.x = argument.x || argument[0] || 0.0; this.y = argument.y || argument[1] || 0.0; this.z = argument.z || ...
javascript
{ "resource": "" }
q63786
create
test
function create(EConstructor) { FormattedError.displayName = EConstructor.displayName || EConstructor.name return FormattedError function FormattedError(format) { if (format) { format = formatter.apply(null, arguments) } return new EConstructor(format) } }
javascript
{ "resource": "" }
q63787
Mat44
test
function Mat44( that ) { that = that || [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; if ( that instanceof Array ) { this.data = that; } else { this.data = new Array( 16 ); this.data[0] = that.data[...
javascript
{ "resource": "" }
q63788
Vec2
test
function Vec2() { switch ( arguments.length ) { case 1: // array or VecN argument var argument = arguments[0]; this.x = argument.x || argument[0] || 0.0; this.y = argument.y || argument[1] || 0.0; break; case...
javascript
{ "resource": "" }
q63789
Quaternion
test
function Quaternion() { switch ( arguments.length ) { case 1: // array or Quaternion argument var argument = arguments[0]; if ( argument.w !== undefined ) { this.w = argument.w; } else if ( argument[0] !== undefined ...
javascript
{ "resource": "" }
q63790
Vec3
test
function Vec3() { switch ( arguments.length ) { case 1: // array or VecN argument var argument = arguments[0]; this.x = argument.x || argument[0] || 0.0; this.y = argument.y || argument[1] || 0.0; this.z = argument.z || ...
javascript
{ "resource": "" }
q63791
test
function() { if (!document.getElementById("snackbar-container")) { var snackbarContainer = document.createElement("div"); snackbarContainer.setAttribute("id", "snackbar-container"); document.body.appendChild(snackbarContainer); } }
javascript
{ "resource": "" }
q63792
test
function(element) { var __self = this; // Adding event listener for when user clicks on the snackbar to remove it element.addEventListener("click", function(){ if (typeof __self.callback == "function") { __self.callback(); } element.setAttribute("class", "snackbar"); __self.destroy(element); ...
javascript
{ "resource": "" }
q63793
test
function(newOptions) { var __self = this, options = newOptions || {}; for (var opt in this.options) { if (__self.options.hasOwnProperty(opt) && !options.hasOwnProperty(opt)) { options[opt] = __self.options[opt]; } } return options; }
javascript
{ "resource": "" }
q63794
test
function(Vue){ var __self = this; Vue.prototype.$snackbar = {}; Vue.prototype.$snackbar.create = function(data, options, callback){ __self.create(data, options, callback); }; }
javascript
{ "resource": "" }
q63795
Transform
test
function Transform( that ) { that = that || {}; if ( that.data instanceof Array ) { // Mat33 or Mat44, extract transform components that = that.decompose(); this.rotation = that.rotation; this.translation = that.translation || new Vec3(); this....
javascript
{ "resource": "" }
q63796
Triangle
test
function Triangle() { switch ( arguments.length ) { case 1: // array or object argument var arg = arguments[0]; this.a = new Vec3( arg[0] || arg.a ); this.b = new Vec3( arg[1] || arg.b ); this.c = new Vec3( arg[2] || arg...
javascript
{ "resource": "" }
q63797
bash
test
function bash(str, pattern, options) { if (typeof str !== 'string') { throw new TypeError('expected a string'); } if (typeof pattern !== 'string') { throw new TypeError('expected a string'); } if (isWindows()) { throw new Error('bash-match does not work on windows'); } try { var opts = c...
javascript
{ "resource": "" }
q63798
cmd
test
function cmd(str, pattern, options) { var valid = ['dotglob', 'extglob', 'failglob', 'globstar', 'nocaseglob', 'nullglob']; var args = []; for (var key in options) { if (options.hasOwnProperty(key) && valid.indexOf(key) !== -1) { args.push('-O', key); } } args.push('-c', 'IFS=$"\n"; if [[ "' + ...
javascript
{ "resource": "" }
q63799
createOptions
test
function createOptions(pattern, options) { if (options && options.normalized === true) return options; var opts = extend({cwd: process.cwd()}, options); if (opts.nocase === true) opts.nocaseglob = true; if (opts.nonull === true) opts.nullglob = true; if (opts.dot === true) opts.dotglob = true; if (!opts.has...
javascript
{ "resource": "" }