_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q40700
assetQueue
train
function assetQueue(addr, queue, options) { return createChannel(addr).then(data => { let ch = data[1]; return ch.assertQueue(queue, options).then(q => [ch, q]); }); }
javascript
{ "resource": "" }
q40701
createChannel
train
function createChannel(addr) { return amqp.connect(genAddr(addr)).then(conn => { return conn.createChannel().then(ch => { connections.push(conn); return [conn, ch]; }); }, debugError); }
javascript
{ "resource": "" }
q40702
SubClass
train
function SubClass() { var ret; // Call the parent constructor. parent.apply(this, arguments); // Only call initialize in self constructor. if(this.constructor === SubClass && this.initialize) { ret = this.initialize.apply(this, arguments); } return ret ? ret : this; }
javascript
{ "resource": "" }
q40703
train
function (event) { //event = $.event.fix(event); // jQuery event normalization. var element = this;//event.target; // @ TextNode -> nodeType == 3 element = (element.nodeType == 3) ? element.parentNode : element; if (opt['disableInInput']) { // Disable shortcut keys in Input, Tex...
javascript
{ "resource": "" }
q40704
init
train
function init() { return user.initComplete ? Q.when(user) : userService.findMe() .then(function setUserLocal(me) { me = me || {}; // pull out the user _.extend(user, me.user); // return the ...
javascript
{ "resource": "" }
q40705
filteredFiles
train
function filteredFiles(folder, pattern) { var files = []; if (fs.existsSync(folder)){ fs.readdirSync(folder).forEach(function(file) { if (file.match(pattern) != null) files.push(file); }); } return files; }
javascript
{ "resource": "" }
q40706
loadViews
train
function loadViews(timbit) { timbit.views = []; var pattern = new RegExp('\.' + timbits.app.settings['view engine'] + '$') , folder = path.join(config.home, 'views', timbit.viewBase); if (fs.existsSync(folder)) { var files = fs.readdirSync(folder); files.forEach(function(file) { timbit.view...
javascript
{ "resource": "" }
q40707
compileTemplate
train
function compileTemplate(name) { var filename = path.join(__dirname, "templates", name + '.hjs'); var contents = fs.readFileSync(filename); return hogan.compile(contents.toString()); }
javascript
{ "resource": "" }
q40708
allowedMethods
train
function allowedMethods(methods) { // default values var methodsAllowed = { 'GET': true, 'POST': false, 'PUT': false, 'HEAD': false, 'DELETE': false }; // check and override if one of the default methods for (var key in methods) { var newKey = key.toUpperCase(); if ( methodsAllowed[newKey]!=undefined) ...
javascript
{ "resource": "" }
q40709
text
train
function text(element) { var type = element.nodeType , value = ''; if (1 === type || 9 === type || 11 === type) { // // Use `textContent` instead of `innerText` as it's inconsistent with new // lines. // if ('string' === typeof element.textContent) return element.textContent; for (elem...
javascript
{ "resource": "" }
q40710
attribute
train
function attribute(element, name, val) { return supports.attributes || !supports.html ? element.getAttribute(name) : (val = element.getAttributeNode(name)) && val.specified ? val.value : ''; }
javascript
{ "resource": "" }
q40711
get
train
function get(element) { var name = element.nodeName.toLowerCase() , value; if (get.parser[element.type] && hasOwn.call(get.parser, element.type)) { value = get.parser[element.type](element); } else if (get.parser[name] && hasOwn.call(get.parser, name)) { value = get.parser[name](element); } if (...
javascript
{ "resource": "" }
q40712
execute
train
function execute(req, res) { req.conn.monitor(this); res.send(null, Constants.OK); }
javascript
{ "resource": "" }
q40713
routeMatcher
train
function routeMatcher(keys) { return match => { const parseParams = paramsParser(keys); if(match) { const params = parseParams(match); return { match, keys, params, } } } }
javascript
{ "resource": "" }
q40714
train
function(msg, code, errorStr, cb1) { return function(error, data) { if (error) { error = json_rpc.newSysError(msg, code, errorStr, error); } cb1(error, data); ...
javascript
{ "resource": "" }
q40715
train
function(project_dir) { var mDoc = xml_helpers.parseElementtreeSync(path.join(project_dir, 'AndroidManifest.xml')); return mDoc._root.attrib['package']; }
javascript
{ "resource": "" }
q40716
tryWrap
train
function tryWrap(fn) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } return function (def) { try { return fn.apply(void 0, args); } catch (ex) { if (is_1.isFunction(def)) return def(e...
javascript
{ "resource": "" }
q40717
tryRequire
train
function tryRequire(name, def, isRoot) { function _require() { if (!is_1.isNode()) /* istanbul ignore next */ return to_1.toDefault(null, def); if (isRoot) return require.main.require(name); return require(name); } return tryWrap(_require)(def); }
javascript
{ "resource": "" }
q40718
getPascalCase
train
function getPascalCase(val) { var parts = val.split('.'); var newVal = ''; for (var i = 0; i < parts.length; i++) { newVal += parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1); } return newVal; }
javascript
{ "resource": "" }
q40719
mouseup_callback
train
function mouseup_callback(e) { var press_time = new Date().getTime() - mouse_down_time; if (press_time < duration) { // cancel the timeout clearTimeout(timeout); // call the shortCallback if provided if (typ...
javascript
{ "resource": "" }
q40720
train
function () { var series = this, points = series.points, options, level, dataLabelsGroup = this.dataLabelsGroup, dataLabels; each(points, function (point) { if (point.node.isVisible) { level = series.levelMap[point.level]; if (!point.isLeaf || level) { options = undefined; ...
javascript
{ "resource": "" }
q40721
train
function () { var series = this, points = series.points, seriesOptions = series.options, attr, hover, level; each(points, function (point) { if (point.node.isVisible) { level = series.levelMap[point.level]; attr = { stroke: seriesOptions.borderColor, 'stroke-width': s...
javascript
{ "resource": "" }
q40722
train
function () { var series = this, points = series.points; each(points, function (point) { var drillId, drillName; if (point.node.isVisible) { H.removeEvent(point, 'click'); if (point.graphic) { point.graphic.css({ cursor: 'default' }); } // Get the drill to id if (s...
javascript
{ "resource": "" }
q40723
train
function (point) { var series = this, drillId = false; if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.isLeaf) { drillId = point.id; } return drillId; }
javascript
{ "resource": "" }
q40724
train
function (point) { var series = this, drillId = false, nodeParent; if ((point.node.parent !== series.rootNode) && (point.isLeaf)) { nodeParent = point.node; while (!drillId) { nodeParent = series.nodeMap[nodeParent.parent]; if (nodeParent.parent === series.rootNode) { drillId = nod...
javascript
{ "resource": "" }
q40725
simplified
train
function simplified(js) { var is = false; var go = false; var here = 'out.html += '; // hardcoced var gone = ' '; // hardcoded to equal length var fixes = []; var lines = js.split('\n').map(function(line, index) { go = line.trim().startsWith(here); if (is && go) { line = line.replace(here, gone)...
javascript
{ "resource": "" }
q40726
train
function (params) { // // Close the route once it has been handled. // var closeRoute = function () { that._closeRoute(dir, req, res, params); }; var async = new Async(closeRoute); routeConfig.handler(req, res, params, async); if (!async.started()) { // No async operation was started....
javascript
{ "resource": "" }
q40727
replace
train
function replace(node, {enter, leave}) { let rep = (enter && enter(node)) || node switch (rep.type) { // regular non-leaf nodes case 'Apply': for (let i = 0; i < rep.args.length; i++) { const arg = rep.args[i] rep.args[i] = replace(arg, {enter, leave}...
javascript
{ "resource": "" }
q40728
ErrorBadRequest
train
function ErrorBadRequest (message) { Error.call(this); // Add Information this.name = 'ErrorBadRequest'; this.type = 'client'; this.status = 400; if (message) { this.message = message; } }
javascript
{ "resource": "" }
q40729
train
function (source) { packageUrl = source; if (source && source.indexOf(bower.config.rhodecode.repo) != -1) { return true; } return Q.nfcall(registryClient.lookup.bind(registryClient), source) .then(function (entry) { i...
javascript
{ "resource": "" }
q40730
train
function (endpoint) { var deferred = Q.defer(), tmpDir = tmp.dirSync().name, target = endpoint.target == '*' ? 'tip' : endpoint.target, url = endpoint.source + '/archive/' + target + '.zip?auth_token=' + bower.config.rhodecode.token, filePath =...
javascript
{ "resource": "" }
q40731
listItemsService
train
function listItemsService(app) { apiService.call(this); this.setApp(app); var service = this; /** * Default function used to resolve a result set * * @param {Error} err mongoose error * @param {Array} docs an array of mongoose documents or an array of objects */ this....
javascript
{ "resource": "" }
q40732
initRedis
train
function initRedis(config, callback) { var self = this; protos.util.checkLocalPort(config.port, function(err) { if (err) { app.log("RedisTransport [%s:%s] %s", config.host, config.port, err.code); } else { // Set redis client self.client = redis.createClient(config.port, config.host, s...
javascript
{ "resource": "" }
q40733
listInstanceMethods
train
function listInstanceMethods (Model) { var classMethods = Object.keys(Model.schema.methods); for (var method in ModelPrototype) { if (!isPrivateMethod(method) && isFunction(ModelPrototype[method])) { classMethods.push(method); } } return classMethods; }
javascript
{ "resource": "" }
q40734
circulationSearch
train
function circulationSearch(array, current, direction, func) { let start = 0; let end = array.length - 1; if (direction === -1) { start = array.length - 1; end = 0; } for (let i = current; i * direction <= end * direction; i += direction) { if (func(array[i])) { return i; } } for (le...
javascript
{ "resource": "" }
q40735
execute
train
function execute(req, res) { // store returns a number but we need to send // a bulk string reply var reply = req.exec.proxy(req, res); res.send(null, '' + reply); }
javascript
{ "resource": "" }
q40736
find
train
function find (client) { return function find (pushAppId) { const req = { url: pushAppId ? `${client.baseUrl}/rest/applications/${pushAppId}` : `${client.baseUrl}/rest/applications/` }; return request(client, req) .then((response) => { if (response.resp.statusCode !== 200) { ...
javascript
{ "resource": "" }
q40737
update
train
function update (client) { return function update (pushApp) { const req = { url: `${client.baseUrl}/rest/applications/${pushApp.pushApplicationID}`, body: pushApp, method: 'PUT' }; return request(client, req) .then((response) => { if (response.resp.statusCode !== 204) { ...
javascript
{ "resource": "" }
q40738
bootstrap
train
function bootstrap (client) { return function bootstrap (pushApp) { const req = { url: `${client.baseUrl}/rest/applications/bootstrap`, method: 'POST' }; const data = pushApp; // If they send in a string, then lets assume that is the location of the cert file // Otherwise, we will as...
javascript
{ "resource": "" }
q40739
train
function () { var res = arguments[0]; userOptions.emit('response', req, res); if (callback && userOptions.resCallback) callback.apply(this, arguments); res.on('end', function() { userOptions.emit('afterResponse', req, res); }); }
javascript
{ "resource": "" }
q40740
get_cookies
train
function get_cookies(url) { debug.assert(url).is('object'); debug.assert(url.host).is('string'); if(!is.array(_cookies[url.host])) { //debug.log('No cookies for host ', url.host); return undefined; } var cookies = ARRAY(_cookies[url.host]).map(function(cookie) { var i = cookie.indexOf(';'); return cookie...
javascript
{ "resource": "" }
q40741
set_cookies
train
function set_cookies(url, cookies) { if(is.string(cookies)) { cookies = [cookies]; } debug.assert(url).is('object'); debug.assert(url.host).is('string'); debug.assert(cookies).is('array'); //debug.log('Saving cookies for host = ', url.host); if(!is.array(_cookies[url.host])) { _cookies[url.host] = cookies;...
javascript
{ "resource": "" }
q40742
grunt
train
function grunt(gruntInst, verbose, patch) { var mw = (patch || core.base()); mw.enabled = true; if (verbose) { mw.writeln = function (line) { if (mw.enabled) { gruntInst.verbose.writeln(line); } }; } else { mw.writeln = function (line) { if (mw.enabled) { gruntInst.log.writeln(l...
javascript
{ "resource": "" }
q40743
stoogeStored
train
function stoogeStored(model, error) { if (typeof error != 'undefined') { callback(error); return; } try { self.stoogeIDsStored.push(model.get('id')); //console.log('Now we have moe ' + self.moe.get('id')); //console.log('model says ' + model.get(...
javascript
{ "resource": "" }
q40744
createLines
train
function createLines() { var moesLine = new self.StoogeLine(); moesLine.set('Scene', 1); moesLine.set('SetID', self.indoorSet.get('id')); moesLine.set('StoogeID', self.moe.get('id')); moesLine.set('Line', 'To be or not to be?'); var larrysLine = new self.StoogeLine(); ...
javascript
{ "resource": "" }
q40745
toggle
train
function toggle(main, alt) { var mw = core.base(); mw.main = main; mw.alt = (alt || function () { }); mw.active = mw.main; mw.enabled = true; mw.swap = function () { mw.active = (mw.active !== mw.main ? mw.main : mw.alt); }; mw.writeln = function (line) { if (!mw.enabled) { return; } ...
javascript
{ "resource": "" }
q40746
multi
train
function multi(list /*, ... */) { var mw = core.base(); mw.targets = (isArray(list) ? list : Array.prototype.slice.call(arguments.length, 0)); mw.enabled = true; mw.writeln = function (line) { if (mw.enabled) { for (var i = 0, ii = mw.targets.length; i < ii; i++) { mw.targets[i].writeln(line); }...
javascript
{ "resource": "" }
q40747
peek
train
function peek(target, callback) { var mw = core.base(); mw.enabled = true; mw.target = target; mw.callback = (callback || function (line /*, mw*/) { return line; }); mw.writeln = function (line) { if (mw.enabled && mw.callback) { line = mw.callback(line, mw); if (typeof line === 'string') { ...
javascript
{ "resource": "" }
q40748
need
train
function need(args) { var argsArray, restArgs; if (!args) { return args; } argsArray = Array.prototype.slice.call(args); restArgs = Array.prototype.slice.call(arguments, 1); if (isArgumentObject(args)) { return argCheck(argsArray, restArgs); ...
javascript
{ "resource": "" }
q40749
train
function(config) { var directory = null; if(config.workingDir) { directory = path.join(config.workingDir, 'level'); } else { throw Errors.invalidConfig('Invalid configuration. Working directory not defined.'); } return directory; }
javascript
{ "resource": "" }
q40750
train
function(config) { var filePath = null; if(config.levelControllerConfig && config.levelControllerConfig.fileName) { filePath = path.join(_getLevelDir(config), config.levelControllerConfig.fileName); } else { throw Errors.invalidConfig('Invalid configuration. Level controller fil...
javascript
{ "resource": "" }
q40751
assertType
train
function assertType(value, type, allowUndefined, message) { if (!assert(type !== undefined, 'Paremeter \'type\' must be a string or a class')) return; if (!assert((allowUndefined === undefined) || (typeof allowUndefined === 'boolean'), 'Paremeter \'allowUndefined\', if specified, must be a boolean')) return; if (...
javascript
{ "resource": "" }
q40752
listToObject
train
function listToObject(list, key) { var length, result, i, obj, keyValue; if (!list) { list = []; } length = list.length; result = { valids: {}, discarded: [] }; for (i = 0; i < length; i += 1) { obj = list[i]; keyValue = obj[key]; ...
javascript
{ "resource": "" }
q40753
exclude
train
function exclude(obj, keys) { var result, key; result = {}; keys = keys || []; for (key in obj) { if (obj.hasOwnProperty(key)) { if (keys.indexOf(key) === -1) { if (typeof obj[key] !== 'function') { result[key] = obj...
javascript
{ "resource": "" }
q40754
keep
train
function keep(orig, dest, options) { var keep, i, t; keep = options.keep || []; if (keep.length === 0) { return dest; } for (i = 0; i < keep.length; i += 1) { t = orig[keep[i]]; if (t !== undefined) { dest[keep[i]] = t; ...
javascript
{ "resource": "" }
q40755
train
function(p, cb) { //Get the status of the path return fs.stat(p, function(error, stat) { //Check the error if(error) { //Check the error code if(error.code !== 'ENOENT') { //Do the callback with the error return cb(error, false, stat); } else { ...
javascript
{ "resource": "" }
q40756
train
function(index) { //Check the index if(index >= files.length) { //Do the callback return cb(null); } //Get the file to remove var file = files[index]; //Remove the file fs.unlink(file, function(error) { //Check the error if(error) { //Check t...
javascript
{ "resource": "" }
q40757
filterCards
train
function filterCards(cards) { // Option was passed in to disabled this filter. // User is probably requesting to discard. if (noCardFilter) { return cards } const [head, ...tail] = cards if (head && head.filter) { return [head].concat(head.filter(tail)) } return cards }
javascript
{ "resource": "" }
q40758
createBoxes
train
function createBoxes(count) { var boxes = []; for (var i = 0; i < N; i++) { boxes.push( V( elementFlag, "div", "box-view", V(elementFlag, "div", "box", count % 100, { style: { top: Math.sin(count / 10) * 10 + "px", lef...
javascript
{ "resource": "" }
q40759
enumerateBuiltInCommands
train
function enumerateBuiltInCommands(config) { const builtInCommandParentDirGlob = path_1.join(config.builtInCommandLocation, '/*.js'); return globby.sync(builtInCommandParentDirGlob, { ignore: '**/*.map' }); }
javascript
{ "resource": "" }
q40760
build
train
function build(mode, system, cdef, out, cb) { logger.info('building'); out.stdout('building'); cb(); }
javascript
{ "resource": "" }
q40761
undeploy
train
function undeploy(mode, target, system, containerDef, container, out, cb) { logger.info('undeploying'); out.stdout('undeploying'); cb(); }
javascript
{ "resource": "" }
q40762
link
train
function link(mode, target, system, containerDef, container, out, cb) { logger.info('linking'); out.stdout('linking'); var elb = findParentELB(system, container); if (elb) { logger.info(elb, 'elb found'); linkToELB(mode, system, elb, container, out, cb); } else { logger.info('elb...
javascript
{ "resource": "" }
q40763
unlink
train
function unlink(mode, target, system, containerDef, container, out, cb) { logger.info('unlinking'); out.stdout('unlinking'); var elb = findParentELB(system, container); if (elb) { logger.info(elb, 'elb found'); unlinkFromELB(mode, system, elb, container, out, cb); } else { logger...
javascript
{ "resource": "" }
q40764
train
function (options, chart, firstAxis) { var pane = this, backgroundOption, defaultOptions = pane.defaultOptions; pane.chart = chart; // Set options if (chart.angular) { // gauges defaultOptions.background = {}; // gets extended by this.defaultBackgroundOptions } pane.options = options = merge(...
javascript
{ "resource": "" }
q40765
train
function () { // Call the Axis prototype method (the method we're in now is on the instance) axisProto.getOffset.call(this); // Title or label offsets are not counted this.chart.axisOffset[this.side] = 0; // Set the center array this.center = this.pane.center = CenteredSeriesMixin.getCenter.call(this....
javascript
{ "resource": "" }
q40766
train
function (lineWidth, radius) { var center = this.center; radius = pick(radius, center[2] / 2 - this.offset); return this.chart.renderer.symbols.arc( this.left + center[0], this.top + center[1], radius, radius, { start: this.startAngleRad, end: this.endAngleRad, open: true, inner...
javascript
{ "resource": "" }
q40767
train
function () { // Call uber method axisProto.setAxisTranslation.call(this); // Set transA and minPixelPadding if (this.center) { // it's not defined the first time if (this.isCircular) { this.transA = (this.endAngleRad - this.startAngleRad) / ((this.max - this.min) || 1); ...
javascript
{ "resource": "" }
q40768
train
function () { axisProto.setAxisSize.call(this); if (this.isRadial) { // Set the center array this.center = this.pane.center = Highcharts.CenteredSeriesMixin.getCenter.call(this.pane); // The sector is used in Axis.translate to compute the translation of reversed axis points (#2570) if (this.isCirc...
javascript
{ "resource": "" }
q40769
train
function (value, length) { return this.postTranslate( this.isCircular ? this.translate(value) : 0, // #2848 pick(this.isCircular ? length : this.translate(value), this.center[2] / 2) - this.offset ); }
javascript
{ "resource": "" }
q40770
train
function (from, to, options) { var center = this.center, startAngleRad = this.startAngleRad, fullRadius = center[2] / 2, radii = [ pick(options.outerRadius, '100%'), options.innerRadius, pick(options.thickness, 10) ], percentRegex = /%$/, start, end, open, isCircular = this.isCi...
javascript
{ "resource": "" }
q40771
train
function (value, reverse) { var axis = this, center = axis.center, chart = axis.chart, end = axis.getPosition(value), xAxis, xy, tickPositions, ret; // Spokes if (axis.isCircular) { ret = ['M', center[0] + chart.plotLeft, center[1] + chart.plotTop, 'L', end.x, end.y]; // Concentric...
javascript
{ "resource": "" }
q40772
train
function () { var center = this.center, chart = this.chart, titleOptions = this.options.title; return { x: chart.plotLeft + center[0] + (titleOptions.x || 0), y: chart.plotTop + center[1] - ({ high: 0.5, middle: 0.25, low: 0 }[titleOptions.align] * center[2]) + (titleOptions.y || 0) }; }
javascript
{ "resource": "" }
q40773
train
function (segment) { var lowSegment, highSegment = [], i = segment.length, baseGetSegmentPath = Series.prototype.getSegmentPath, point, linePath, lowerPath, options = this.options, step = options.step, higherPath; // Remove nulls from low segment lowSegment = HighchartsAdapter.gr...
javascript
{ "resource": "" }
q40774
train
function () { var data = this.data, length = data.length, i, originalDataLabels = [], seriesProto = Series.prototype, dataLabelOptions = this.options.dataLabels, align = dataLabelOptions.align, point, inverted = this.chart.inverted; if (dataLabelOptions.enabled || this._hasPointLabels...
javascript
{ "resource": "" }
q40775
train
function () { var series = this, yAxis = series.yAxis, options = series.options, center = yAxis.center; series.generatePoints(); each(series.points, function (point) { var dialOptions = merge(options.dial, point.dial), radius = (pInt(pick(dialOptions.radius, 80)) * center[2]) / 200, ...
javascript
{ "resource": "" }
q40776
train
function (init) { var series = this; if (!init) { each(series.points, function (point) { var graphic = point.graphic; if (graphic) { // start value graphic.attr({ rotation: series.yAxis.startAngleRad * 180 / Math.PI }); // animate graphic.animate({ rotation: point....
javascript
{ "resource": "" }
q40777
train
function (point) { // return a plain array for speedy calculation return [point.low, point.q1, point.median, point.q3, point.high]; }
javascript
{ "resource": "" }
q40778
train
function (force) { var series = this, options = series.options, yData = series.yData, points = series.options.data, // #3710 Update point does not propagate to sum point, dataLength = yData.length, threshold = options.threshold || 0, subSum, sum, dataMin, dataMax, y, i; sum = su...
javascript
{ "resource": "" }
q40779
train
function (pt) { if (pt.isSum) { return (pt.x === 0 ? null : "sum"); //#3245 Error when first element is Sum or Intermediate Sum } else if (pt.isIntermediateSum) { return (pt.x === 0 ? null : "intermediateSum"); //#3245 } return pt.y; }
javascript
{ "resource": "" }
q40780
train
function () { seriesTypes.column.prototype.getAttribs.apply(this, arguments); var series = this, options = series.options, stateOptions = options.states, upColor = options.upColor || series.color, hoverColor = Highcharts.Color(upColor).brighten(0.1).get(), seriesDownPointAttr = merge(series.pointAtt...
javascript
{ "resource": "" }
q40781
train
function () { var data = this.data, length = data.length, lineWidth = this.options.lineWidth + this.borderWidth, normalizer = mathRound(lineWidth) % 2 / 2, path = [], M = 'M', L = 'L', prevArgs, pointArgs, i, d; for (i = 1; i < length; i++) { pointArgs = data[i].shapeArgs; prev...
javascript
{ "resource": "" }
q40782
train
function (fill) { var markerOptions = this.options.marker, fillOpacity = pick(markerOptions.fillOpacity, 0.5); // When called from Legend.colorizeItem, the fill isn't predefined fill = fill || markerOptions.fillColor || this.color; if (fillOpacity !== 1) { fill = Color(fill).setOpacity(fillOpacity)...
javascript
{ "resource": "" }
q40783
train
function () { var obj = Series.prototype.convertAttribs.apply(this, arguments); obj.fill = this.applyOpacity(obj.fill); return obj; }
javascript
{ "resource": "" }
q40784
train
function (zMin, zMax, minSize, maxSize) { var len, i, pos, zData = this.zData, radii = [], sizeByArea = this.options.sizeBy !== 'width', zRange; // Set the shape type and arguments to be picked up in drawPoints for (i = 0, len = zData.length; i < len; i++) { zRange = zMax - zMin; pos = ...
javascript
{ "resource": "" }
q40785
train
function (init) { var animation = this.options.animation; if (!init) { // run the animation each(this.points, function (point) { var graphic = point.graphic, shapeArgs = point.shapeArgs; if (graphic && shapeArgs) { // start values graphic.attr('r', 1); // animate graphic.ani...
javascript
{ "resource": "" }
q40786
train
function () { var i, data = this.data, point, radius, radii = this.radii; // Run the parent method seriesTypes.scatter.prototype.translate.call(this); // Set the shape type and arguments to be picked up in drawPoints i = data.length; while (i--) { point = data[i]; radius = radi...
javascript
{ "resource": "" }
q40787
initArea
train
function initArea(proceed, chart, options) { proceed.call(this, chart, options); if (this.chart.polar) { /** * Overridden method to close a segment path. While in a cartesian plane the area * goes down to the threshold, in the polar chart it goes to the center. */ this.closeSegment = function ...
javascript
{ "resource": "" }
q40788
train
function () { var mediaPath = path.join(__dirname, '..', 'media'), templateFile = path.join(mediaPath, 'templates', 'index.jade'), monolith = require('monolith').init({ minify: true }); monolith.addCSSFile(path.join(mediaPath, "css", "normalize.css")); monolith.addCSSFile(path.join(medi...
javascript
{ "resource": "" }
q40789
load
train
function load (routes) { if (!Array.isArray(routes) || routes.length === 0) { throw new Error('argument should be an array not empty.') } if (!Array.isArray(routes[0])) { routes = [routes] } return routes.map(route => _getFiles(route)) .reduce((acc, routes) => acc.concat(routes), []) ...
javascript
{ "resource": "" }
q40790
_getFiles
train
function _getFiles (route) { const dir = route[0] const prefix = route.splice(1).join('/') return _browseDir(dir) .map(file => require(file)) .reduce((acc, routes) => acc.concat(routes), []) .map(routes => _normalizeUrl(routes, prefix)) }
javascript
{ "resource": "" }
q40791
_browseDir
train
function _browseDir (dir, fileList) { fileList || (fileList = []) try { fs.readdirSync(dir) .map(item => _buildFullPath(dir, item)) .map(item => _addFileOrContinueBrowsing(item, fileList)) } catch (e) { throw new Error(e.message) } return fileList }
javascript
{ "resource": "" }
q40792
_addFileOrContinueBrowsing
train
function _addFileOrContinueBrowsing (item, fileList) { !fs.statSync(item).isDirectory() ? fileList.push(item) : _browseDir(item, fileList) }
javascript
{ "resource": "" }
q40793
_normalizeUrl
train
function _normalizeUrl (route, prefix) { const _route = Object.assign({}, route) const url = _route.url .replace(/^\//, '') .replace(/\/$/, '') // build prefix prefix = prefix ? `/${prefix}` : '' _route.url = url ? `${prefix}/${url}/` : `${prefix}/` debug(`rewritting url:...
javascript
{ "resource": "" }
q40794
train
function(opts) { xml2js.opts = opts; return opts .option('-i, --inputdir [directory]', 'directory for xml files', __dirname + '/xml/mraa') .option('-c, --custom [file]', 'json for customizations') .option('-t, --typemaps [directory]', 'directory for custom pointer type maps') .option('-g...
javascript
{ "resource": "" }
q40795
createXmlParser
train
function createXmlParser(XML_GRAMMAR_SPEC) { return fs.readFileAsync(XML_GRAMMAR_SPEC, 'utf8').then(function(xmlgrammar) { return peg.buildParser(xmlgrammar); }); }
javascript
{ "resource": "" }
q40796
findUsage
train
function findUsage(type, classOnly) { var filterClasses = function(fn) { return _.without(_.map(xml2js.CLASSES, fn), undefined); }; var usesType = function(classSpec, className) { var methodsOfType = (_.find(classSpec.methods, function(methodSpec, methodName) { return ((!_.isEmpty(methodSpec.return) && me...
javascript
{ "resource": "" }
q40797
customizeMethods
train
function customizeMethods(custom) { _.each(custom, function(classMethods, className) { _.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) { return isValidMethodSpec(methodSpec, className + '.' + methodName); })); }); }
javascript
{ "resource": "" }
q40798
isValidMethodSpec
train
function isValidMethodSpec(methodSpec, methodName) { var valid = true; var printIgnoredMethodOnce = _.once(function() { console.log(methodName + ' from ' + path.basename(xml2js.opts.custom) + ' is omitted from JS documentation.'); }); function checkRule(rule, errMsg) { if (!rule) { printIgnoredMethodOnc...
javascript
{ "resource": "" }
q40799
getEnums
train
function getEnums(spec_c, bygroup, parent) { var spec_js = {}; var enumGroups = _.find(getChildren(spec_c, 'sectiondef'), function(section) { var kind = getAttr(section, 'kind'); return ((kind == 'enum') || (kind == 'public-type')); }); if (enumGroups) { _.each(enumGroups.children, function(enumGrou...
javascript
{ "resource": "" }