_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q10300 | train | function( text2search, noSearchPhrase, noSearchResult ) {
Array.call( this );
/**
* Gets the text to search.
* @type {string|null}
*/
this.text2search = text2search || null;
/**
* Gets a message to display when search phrase is missing.
* @type {string}
*/
this.noSearchPhrase = noSearchPh... | javascript | {
"resource": ""
} | |
q10301 | train | function (files, latestMigrationFile) {
if (direction === 'do') {
return files
.sort()
.filter(function () {
var _mustBeApplied = (latestMigrationFile === null);
return function (name) {
if (latestMigrationFile === n... | javascript | {
"resource": ""
} | |
q10302 | train | function (order, unorderedObj) {
var orderedObj = [];
for (var i = 0; i < order.length; i++) {
| javascript | {
"resource": ""
} | |
q10303 | train | function (latestMigrationFile) {
return function (err, files) {
if (err) {
throw err;
}
files = _getApplicableMigrations(files, latestMigrationFile);
var filesRemaining = files.length;
var parsedMigrations = {};
console.log... | javascript | {
"resource": ""
} | |
q10304 | validateFilename | train | function validateFilename(input) {
let isValidCharacterString = validateCharacterString(input);
if (isValidCharacterString !== true) {
return isValidCharacterString;
} | javascript | {
"resource": ""
} |
q10305 | makeHeaders | train | function makeHeaders(headers, params) {
if (headers.length <= 0) {
return params;
}
for (var prop in headers) {
var head = headers[prop];
prop = prop.replace(/-/, '_').toUpperCase();
if (prop.indexOf('CONTENT_') < 0) {
| javascript | {
"resource": ""
} |
q10306 | readContents | train | function readContents( contentPath, submenuFile, filingCabinet, renderer ) {
var typeName = 'Content';
logger.showInfo( '*** Reading contents...' );
// Read directory items in the content store.
var items = fs.readdirSync( path.join( process.cwd(), contentPath ) );
items.forEach( function ( item ) {
v... | javascript | {
"resource": ""
} |
q10307 | train | function (tmplPath) {
var text = fs.readFileSync(tmplPath)
.toString()
| javascript | {
"resource": ""
} | |
q10308 | train | function (obj, opts) {
var toc = [];
// Finesse comment markdown data.
// Also, statefully create TOC.
var sections = _.chain(obj)
.map(function (data) { return new Section(data, opts); })
.filter(function (s) { | javascript | {
"resource": ""
} | |
q10309 | train | function (text) {
var inApiSection = false;
return fs.createReadStream(opts.src)
.pipe(es.split("\n"))
.pipe(es.through(function (line) {
// Hit the start marker.
if (line === opts.start) {
// Emit our line (it **is** included).
this.emit("data", ... | javascript | {
"resource": ""
} | |
q10310 | train | function(element, options) {
_.extend(this, Backbone.Events);
var defaults = require('../utils/default-options')();
// set to be an object in case
// it's undefined
options = options || {};
// extend the defaults
options = _.extend(defaults, options);
this.options = options;
this... | javascript | {
"resource": ""
} | |
q10311 | GitRepos | train | function GitRepos (path, callback) {
var ev = FindIt(Abs(path));
ev.on("directory", function (dir, stat, stop) {
var cDir = Path.dirname(dir)
, base = Path.basename(dir)
;
if (base === ".git") { | javascript | {
"resource": ""
} |
q10312 | Row | train | function Row(columnSpecs, row) {
var i, col, type, val, cols = [];
for (i = 0; i < columnSpecs.length; i++) {
col = columnSpecs[i];
type = types.fromType(col.type);
if (col.subtype) {
type = type(col.subtype);
} else if (col.keytype) {
type = type(col.keytype, col.valuetype);
}
| javascript | {
"resource": ""
} |
q10313 | awaitFunction | train | function awaitFunction(fn) {
return (req, res, | javascript | {
"resource": ""
} |
q10314 | prepareConfig | train | function prepareConfig(config) {
if (!('authorizationError' in config)) {
config.authorizationError = {status: 401, message: 'Unauthorized'};
}
| javascript | {
"resource": ""
} |
q10315 | retrieveUserFromRedis | train | async function retrieveUserFromRedis(res, auth, tokenOrEmail, config) {
if (config.redisClient) {
const getFromRedis = util
.promisify(config.redisClient.get)
.bind(config.redisClient);
const cachedUserData = await getFromRedis(`${ns}:${tokenOrEmail}`);
if (cachedUserData) {
const | javascript | {
"resource": ""
} |
q10316 | saveUserInRedis | train | function saveUserInRedis(user, tokenOrEmail, config) {
if (config.redisClient) {
const key = `${ns}:${tokenOrEmail}`; | javascript | {
"resource": ""
} |
q10317 | locationToPoint | train | function locationToPoint(loc) {
var lat, lng, radius, cosLat, sinLat, cosLng, sinLng, x, y, z;
lat = loc.lat * Math.PI / 180.0;
lng = loc.lng * Math.PI / 180.0;
radius = loc.elv + getRadius(lat);
cosLng = Math.cos(lng);
sinLng = Math.sin(lng);
cosLat = Math.cos(lat); | javascript | {
"resource": ""
} |
q10318 | distance | train | function distance(ap, bp) {
var dx, dy, dz;
dx = ap.x - bp.x;
| javascript | {
"resource": ""
} |
q10319 | rotateGlobe | train | function rotateGlobe(b, a, bRadius) {
var br, brp, alat, acos, asin, bx, by, bz;
// Get modified coordinates of 'b' by rotating the globe so
// that 'a' is at lat=0, lng=0
br = { lat: b.lat, lng: (b.lng - a.lng), elv:b.elv };
brp = locationToPoint(br);
// scale all the coordinates based on the original, c... | javascript | {
"resource": ""
} |
q10320 | train | function(path, partials)
{
var templates = { };
grunt.file.recurse(path, function (absPath, rootDir, subDir, filename)
{
// ignore non-template files
if (!filename.match(matcher)) {
return;
}
// read template source and data
var relPath = absPat... | javascript | {
"resource": ""
} | |
q10321 | train | function(el, options) {
if (typeof options === 'undefined') {
options = {};
}
// apply defaults
options = _.defaults(options, defaults, {
orientation : 'left',
labelText: '',
// true to position the axis-label
// when chart uses layout positioning of axis-labels... | javascript | {
"resource": ""
} | |
q10322 | eatNumber | train | function eatNumber(stream) {
const start = stream.pos;
const negative = stream.eat(DASH);
const afterNegative = stream.pos;
stream.eatWhile(isNumber);
const prevPos = stream.pos;
if (stream.eat(DOT) && !stream.eatWhile(isNumber)) {
// Number followed by a dot, but then no number
| javascript | {
"resource": ""
} |
q10323 | Mangonel | train | function Mangonel (modules = []) {
const getLaunchersByName = (modules, name) =>
modules.filter(m => m.name === name)
const getFirstLauncher = (...args) =>
modules.filter(m => m.platforms.filter(p => p === args[1]).length > 0)[0]
return {
/**
*
*
* @param {function} emulator launcher module... | javascript | {
"resource": ""
} |
q10324 | columnizeArray | train | function columnizeArray(array, opts) {
// conditionally sort array
//----------------------------------------------------------
const ar =
opts && opts.sort
? typeof opts.sort === 'boolean'
? array.sort()
: opts.sort(array)
: array
// build and freeze props
//----------------... | javascript | {
"resource": ""
} |
q10325 | getComponentConfiguration | train | function getComponentConfiguration(name) {
var config = {};
if (typeof projectConfig[name] === 'object') {
config = projectConfig[name];
}
if (typeof componentConfig[name] === 'object') {
if (config == null) config = {};
config = util.extend(true, config, componentConfig[name]);
}
... | javascript | {
"resource": ""
} |
q10326 | toInboundMessage | train | function toInboundMessage(relayMessage, mail) {
let inboundMessage = transport.defaultInboundMessage({
to: {
email: relayMessage.rcpt_to,
name: ''
},
from: mail.from[0],
subject: mail.subject,
text: mail.text,
html: mail.html,
recipients: mail.to,
cc: ... | javascript | {
"resource": ""
} |
q10327 | handleReply | train | function handleReply(inboundMessage, data) {
if (data.reply) {
_.merge(data.content.headers, Transport.getReplyHeaders(inboundMessage)); | javascript | {
"resource": ""
} |
q10328 | throwUpError | train | function throwUpError(err) {
if (err.name === 'SparkPostError')
| javascript | {
"resource": ""
} |
q10329 | train | function(model) {
model.can = _.extend({create: true, read: true, update: | javascript | {
"resource": ""
} | |
q10330 | Snippets | train | function Snippets(options) {
this.options = options || {};
this.store = store(this.options);
this.snippets = {};
this.presets = {};
this.cache = {};
this.cache.data = {};
var FetchFiles = lazy.FetchFiles();
this.downloader = new FetchFiles(this.options);
this.presets | javascript | {
"resource": ""
} |
q10331 | train | function (name, val) {
if (typeof name === 'object') {
return this.visit('set', name);
}
| javascript | {
"resource": ""
} | |
q10332 | train | function (name, preset) {
if(typeof name !== 'string') {
throw new TypeError('snippets#get expects `name` to be a string.');
}
if (utils.startsWith(name, './')) {
return this.read(name);
}
// ex: `http(s)://api.github.com/...`
if (/^\w+:\/\//.test(name) || preset) {
var snippe... | javascript | {
"resource": ""
} | |
q10333 | train | function (snippets, options) {
if (typeof snippets === 'string') {
var glob = lazy.glob();
var files = glob.sync(snippets, options);
files.forEach(function (fp) {
| javascript | {
"resource": ""
} | |
q10334 | train | function(options) {
var userOptions = options;
var series = userOptions.series;
if (!series) {
return userOptions;
}
series.forEach(function(value, index) {
if (Object.keys(userOptions.yScales).length < 2 && Object.keys(userOptions.yScales).indexOf(value.y... | javascript | {
"resource": ""
} | |
q10335 | train | function(seriesKeys) {
var fieldValues = _.values(seriesKeys),
matchingSeriesDef = _.find(this._attributes.series, function(seriesDef) {
return _.contains(fieldValues, seriesDef.name);
});
if (!matchingSeriesDef) {
| javascript | {
"resource": ""
} | |
q10336 | train | function() {
this._setTimeRangeTo(this._jut_time_bounds, this._juttleNow);
if (this._hasReceivedData && | javascript | {
"resource": ""
} | |
q10337 | tick | train | function tick() {
currentTime += 1 / 60;
var p = currentTime / time;
var t = easingEquations[easing](p);
if (p < | javascript | {
"resource": ""
} |
q10338 | chunk | train | function chunk(start, end) {
// Slice, unescape and push onto result array.
res.push(str.slice(start, end).replace(/\\\\/g, '\\').replace(/\\\./g, '.'));
| javascript | {
"resource": ""
} |
q10339 | Buf | train | function Buf(buffer) {
this._initialSize = 64 * 1024;
this._stepSize = this._initialSize;
this._pos = 0;
if (typeof buffer === 'number') {
this._initialSize = buffer;
}
if (buffer | javascript | {
"resource": ""
} |
q10340 | runTheHandler | train | function runTheHandler(inboundMessage) {
let handler = convo.handler;
convo.handler = null;
let result = handler.apply(convo, [convo, inboundMessage]);
if (result === IS_WAIT_FUNCTION) {
// reset the handler to wait again
convo.handler = handler;
}
// this was | javascript | {
"resource": ""
} |
q10341 | addInboundMessageToConvo | train | function addInboundMessageToConvo(inboundMessage) {
if (_.last(convo.inboundMessages) !== inboundMessage) {
fuse.logger.debug(`Add ${inboundMessage.id} to transcript`);
| javascript | {
"resource": ""
} |
q10342 | resetTimeout | train | function resetTimeout() {
clearTimeout(convo.timeout_function);
| javascript | {
"resource": ""
} |
q10343 | ExpandFiles | train | function ExpandFiles(options) {
if (!(this instanceof ExpandFiles)) {
return new ExpandFiles(options);
}
Base.call(this, {}, options);
this.use(utils.plugins()); | javascript | {
"resource": ""
} |
q10344 | expandMapping | train | function expandMapping(config, options) {
var len = config.files.length, i = -1;
var res = [];
while (++i < len) {
var raw = config.files[i];
var node = new RawNode(raw, config, this);
this.emit('files', 'rawNode', node);
| javascript | {
"resource": ""
} |
q10345 | RawNode | train | function RawNode(raw, config, app) {
utils.define(this, 'isRawNode', true);
util.run(config, 'rawNode', raw);
this.files = [];
var paths = {};
raw.options = utils.extend({}, config.options, raw.options);
var opts = resolvePaths(raw.options);
var filter = filterFiles(opts);
var srcFiles = utils.arrayif... | javascript | {
"resource": ""
} |
q10346 | FilesNode | train | function FilesNode(src, raw, config) {
utils.define(this, 'isFilesNode', true);
this.options = utils.omit(raw.options, ['mapDest', 'flatten', 'rename', 'filter']);
this.src = utils.arrayify(src);
if (this.options.resolve) {
var cwd = path.resolve(this.options.cwd || process.cwd());
this.src = this.src.... | javascript | {
"resource": ""
} |
q10347 | rewriteDest | train | function rewriteDest(dest, src, opts) {
dest = utils.resolve(dest);
if (opts.destBase) {
dest = path.join(opts.destBase, dest);
}
if (opts.extDot || opts.hasOwnProperty('ext')) {
dest = rewriteExt(dest, opts); | javascript | {
"resource": ""
} |
q10348 | toNested | train | function toNested(map) {
var split, first, last;
utils.walkObject(map, function (val, prop1) {
split = prop1.split('.');
if (!utils.validateFieldName(prop1)) {
log.error('map field name "' + prop1 + '" is invalid');
}
last = split[split.length - 1];
first = prop1.replace('.' + last, ''... | javascript | {
"resource": ""
} |
q10349 | toPlain | train | function toPlain(map) {
var split;
var form = {};
var throwErr = function throwErr(key) {
return log.error('map field name "' + key + '" is invalid');
};
var isInvalidKey = function isInvalidKey(str) {
return str.split('.').length > 1;
};
var run = function run(n, o, p) {
if (o.hasOwnPropert... | javascript | {
"resource": ""
} |
q10350 | iterateStyleRules | train | function iterateStyleRules(argument) {
if (typeof argument === 'string') {
checkStyleExistence(styleDefinitions, argument);
collectedStyles.push(styleDefinitions[argument]);
return;
}
if (typeof argument === 'object') {
Object.keys(argument).forEach(function(styleName... | javascript | {
"resource": ""
} |
q10351 | NativeProtocol | train | function NativeProtocol(protocolVersion) {
var _protocolVersion = protocolVersion || DEFAULT_PROTOCOL_VERSION;
if (!(this instanceof NativeProtocol))
return new NativeProtocol();
stream.Duplex.call(this);
Object.defineProperties(this, {
'protocolVersion': {
set: function(val) {
if (typ... | javascript | {
"resource": ""
} |
q10352 | ErrorMessage | train | function ErrorMessage(errorCode, errorMessage, details) {
Response.call(this, 0x00);
Object.defineProperties(this, {
'errorCode': {
value: errorCode | javascript | {
"resource": ""
} |
q10353 | AuthChallengeMessage | train | function AuthChallengeMessage(token) {
var _token = token || new Buffer(0);
Response.call(this, 0x0E);
Object.defineProperty(this, 'token', {
| javascript | {
"resource": ""
} |
q10354 | Engine | train | function Engine() {
// The content manager object.
var contents = null;
/**
* Gets the configuration object.
* @param {string} configPath - The path of the configuration JSON file.
* @returns {Configuration} The configuration object.
*/
this.getConfiguration = function( configPath ) {
logger.sh... | javascript | {
"resource": ""
} |
q10355 | createNode | train | function createNode(name, parent, stat, parentNodeId, callback) {
if(utility.hasInvalidChars(name)) {
logger.info('Ignoring file \'' + name + '\' because filename contains invalid chars');
return callback(undefined);
}
var newNode = {
directory: stat.isDirectory(),
name: name,
parent: parent,... | javascript | {
"resource": ""
} |
q10356 | deleteNode | train | function deleteNode(node, immediate, callback) {
node.localActions = {delete: {
remoteId: node.remoteId,
actionInitialized: new | javascript | {
"resource": ""
} |
q10357 | train | function(dirPath, callback) {
logger.info('getDelta start', {category: 'sync-local-delta'});
async.series([
(cb) => {
logger.debug('findDeletedNodes start', {category: 'sync-local-delta'});
this.findDeletedNodes(cb)
},
(cb) => {
logger.debug('findChanges start', {cate... | javascript | {
"resource": ""
} | |
q10358 | train | function(dirPath, oldDirPath, parentNodeId, callback) {
fsWrap.readdir(dirPath, (err, nodes) => {
//if it is not possible to read dir abort sync
if(err) {
logger.warning('Error while reading dir', {category: 'sync-local-delta', dirPath, err});
throw new BlnDeltaError(err.message);
... | javascript | {
"resource": ""
} | |
q10359 | train | function(callback) {
//process first all directories and then all files.
async.mapSeries(['getDirectories', 'getFiles'], (nodeSource, cbMap) => {
syncDb[nodeSource]((err, nodes) => {
async.eachSeries(nodes, (node, cb) => {
// If a node has to be redownloaded do not delete it remotely
... | javascript | {
"resource": ""
} | |
q10360 | Model | train | function Model(name, referenceModel, modellingElements, transitive) {
/** @memberOf Model
* @member {string} name - The name of the model
*/
this.__name = name
_.set(this, ['__jsmf__','conformsTo'], Model)
_.set(this, ['__jsmf__','uuid'], generateId())
/** @memberof Model
* @member {Model} referenceM... | javascript | {
"resource": ""
} |
q10361 | modelExport | train | function modelExport(m) {
const result = _.mapValues(m.classes, | javascript | {
"resource": ""
} |
q10362 | train | function (client, migrationFolder) {
events.EventEmitter.call(this);
if (client === undefined) {
throw new Error('no client provided');
}
_client = client;
| javascript | {
"resource": ""
} | |
q10363 | CruxLogger | train | function CruxLogger(_type, _level) {
if (this instanceof CruxLogger) {
Component.apply(this, arguments);
this.name = 'log';
var hasColors = this.config.colors;
delete this.config.colors;
if (!hasColors) {
for (var i = 0; i < this.config.appenders.length; i++) {
this.config.appenders[... | javascript | {
"resource": ""
} |
q10364 | groupDelta | train | function groupDelta(nodes, callback) {
async.eachLimit(nodes, 10, (node, cb) => {
if(node.path === null) {
// if node.path is null we have to skip the node
logger.info('Remote Delta: Got node with path | javascript | {
"resource": ""
} |
q10365 | groupNode | train | function groupNode(node) {
node.parent = node.parent || '';
if(groupedDelta[node.id] === undefined) {
groupedDelta[node.id] = {
id: node.id,
directory: node.directory,
actions: {}
};
} else if(groupedDelta[node.id].directory === undefined && node.directory !== undefined) {
// Since ... | javascript | {
"resource": ""
} |
q10366 | train | function(cursor, callback) {
groupedDelta = {};
async.series([
(cb) => {
logger.info('Fetching delta', {category: 'sync-remote-delta'});
fetchDelta({cursor}, (err, newCursor) => {
if(err) return cb(err);
cb(null, newCursor);
});
},
(cb) => {
... | javascript | {
"resource": ""
} | |
q10367 | use | train | function use(type, fn, options) {
if (typeof type === 'string' || Array.isArray(type)) {
fn = wrap(type, fn);
} else {
options = fn;
fn = type;
}
var val = fn.call(this, this, this.base || {}, options || {}, this.env || {});
if (typeof val === 'function') {
| javascript | {
"resource": ""
} |
q10368 | train | function(entry, options) {
if (options.isClass) return options.isClass(entry);
var tags = entry.tags;
for(var k = 0; k < tags.length; k++) {
| javascript | {
"resource": ""
} | |
q10369 | assertAsDefined | train | function assertAsDefined(obj, errorMsg) {
if (_.isUndefined(obj) | javascript | {
"resource": ""
} |
q10370 | hasDotNesting | train | function hasDotNesting(string) {
const loc = string.indexOf('.'); | javascript | {
"resource": ""
} |
q10371 | substrAtNthOccurence | train | function substrAtNthOccurence(string, start, delimiter) {
const _delimiter = getValueWithDefault(delimiter, '.');
const _start = getValueWithDefault(start, 1);
| javascript | {
"resource": ""
} |
q10372 | chineseRemainder_bignum | train | function chineseRemainder_bignum(a, n){
var p = bignum(1);
var p1 = bignum(1);
var prod = bignum(1);
var i = 1;
var sm = bignum(0);
for(i=0; i< n.length; i++){
prod = prod.mul( n[i] );
//prod = prod * n[i];
}
for(i=0; i< n.length; i++){
p = prod.div( n[i] );
//sm = | javascript | {
"resource": ""
} |
q10373 | Arc | train | function Arc(start, end, height) {
this.start | javascript | {
"resource": ""
} |
q10374 | cleanStyles | train | function cleanStyles(e) {
if (!e) return;
// Remove any root styles, if we're able.
if (typeof e.removeAttribute == 'function' && e.className != 'readability-styled') e.removeAttribute('style');
// Go until there are no more child nodes
var cur = e.firstChild;
while (cur) {
if (cur.nodeType == 1) {
... | javascript | {
"resource": ""
} |
q10375 | getCharCount | train | function getCharCount(e, s) {
s = s || ",";
| javascript | {
"resource": ""
} |
q10376 | fixLinks | train | function fixLinks(e) {
if (!e.ownerDocument.originalURL) {
return;
}
function fixLink(link) {
var fixed = url.resolve(e.ownerDocument.originalURL, link);
return fixed;
}
var i;
var imgs = e.getElementsByTagName('img');
for (i = imgs.length - 1; i >= 0; --i) {
var src = imgs[i].getAttribu... | javascript | {
"resource": ""
} |
q10377 | cleanSingleHeader | train | function cleanSingleHeader(e) {
for (var headerIndex = 1; headerIndex < 7; headerIndex++) {
var headers = e.getElementsByTagName('h' + headerIndex);
for (var i = headers.length - 1; i >= 0; --i) { | javascript | {
"resource": ""
} |
q10378 | Snippet | train | function Snippet(file) {
if (!(this instanceof Snippet)) {
return new Snippet(file);
}
if (typeof file === 'string') {
file = {path: file};
| javascript | {
"resource": ""
} |
q10379 | train | function (prop, val) {
if (arguments.length === 1) {
if (typeof prop === 'string') {
return utils.get(this.options, prop);
}
if (typeof prop === | javascript | {
"resource": ""
} | |
q10380 | train | function (fp) {
if (this.content) return this;
fp = path.resolve(this.cwd, | javascript | {
"resource": ""
} | |
q10381 | train | function (val, opts) {
if (typeof val === 'function') {
return new Snippet(val(this));
}
if (typeof val === 'string') {
var str = utils.tryRead(val);
var res = {content: null, options: opts || {}};
if (str) {
| javascript | {
"resource": ""
} | |
q10382 | train | function (fp, options) {
if (typeof fp === 'function') {
return fp.call(this, this.path);
}
var opts = extend({}, this.options, options);
if (typeof fp === 'object') {
opts = extend({}, opts, fp);
}
if (typeof fp === 'string' && ~fp.indexOf(':')) {
fp = fp.replace(/:(\w+)/g, ... | javascript | {
"resource": ""
} | |
q10383 | train | function (fp, opts, cb) {
if (typeof fp !== 'string') {
cb = opts;
opts = fp;
fp = null;
}
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
if (typeof cb !== 'function') {
throw new Error('expected a callback function.');
}
var dest = this.dest(f... | javascript | {
"resource": ""
} | |
q10384 | splitImportsList | train | function splitImportsList(text) {
const list = [];
list.push(...text
.split(',')
.map(s | javascript | {
"resource": ""
} |
q10385 | goToNext | train | function goToNext() {
count++;
if (count === _.size(config)) {
grunt.log.writeln(''); // line break
| javascript | {
"resource": ""
} |
q10386 | train | function() {
this.top = ''
this.stack = []
this.caret = false
this.vowels = []
this.finals = []
this.finals_found = newHashMap()
this.visarga = false
this.cons_str = ''
this.single_cons = ''
this.prefix = false
this.suffix | javascript | {
"resource": ""
} | |
q10387 | train | function(str) {
var tokens = [] // size = str.length + 2
var i = 0;
var maxlen = str.length;
TOKEN:
while (i < maxlen) {
var c = str.charAt(i);
var mlo = m_tokens_start.get(c);
// if there are multi-char tokens starting with this char, try them
if (mlo != null) {
for (var len = mlo; len > 1; len--) {
... | javascript | {
"resource": ""
} | |
q10388 | validHex | train | function validHex(t) {
for (var i = 0; i < t.length; i++) {
var c = t.charAt(i);
if (!((c >= 'a' && c | javascript | {
"resource": ""
} |
q10389 | unicodeEscape | train | function unicodeEscape (warns, line, t) { // [], int, str
var hex = t.substring(2);
if (hex == '') return null; | javascript | {
"resource": ""
} |
q10390 | formatHex | train | function formatHex(t) { //char
// not compatible with GWT...
// return String.format("\\u%04x", (int)t);
| javascript | {
"resource": ""
} |
q10391 | putStackTogether | train | function putStackTogether(st) {
var out = '';
// put the main elements together... stacked with "+" unless it's a regular stack
if (tib_stack(st.cons_str)) {
out += st.stack.join("");
} else out += (st.cons_str);
// caret (tsa-phru) goes here as per some | javascript | {
"resource": ""
} |
q10392 | error | train | function error(msg) {
if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.errors) {
console.log('Error: ' + msg);
console.log(backtrace());
| javascript | {
"resource": ""
} |
q10393 | PDFPageProxy_render | train | function PDFPageProxy_render(params) {
var stats = this.stats;
stats.time('Overall');
// If there was a pending destroy cancel it so no cleanup happens during
// this call to render.
this.pendingDestroy = false;
var renderingIntent = (params.intent === 'print' ? 'print' : 'display'... | javascript | {
"resource": ""
} |
q10394 | PDFPageProxy__destroy | train | function PDFPageProxy__destroy() {
if (!this.pendingDestroy ||
Object.keys(this.intentStates).some(function(intent) {
var intentState = this.intentStates[intent];
return (intentState.renderTasks.length !== 0 ||
intentState.receivingOperatorList);
}, ... | javascript | {
"resource": ""
} |
q10395 | PDFPageProxy_renderPageChunk | train | function PDFPageProxy_renderPageChunk(operatorListChunk,
intent) {
var intentState = this.intentStates[intent];
var i, ii;
// Add the new chunk to the current operator list.
for (i = 0, ii = operatorListChunk.length; i < ii; i++) {
... | javascript | {
"resource": ""
} |
q10396 | PDFObjects_getData | train | function PDFObjects_getData(objId) {
var objs = this.objs;
if (!objs[objId] || | javascript | {
"resource": ""
} |
q10397 | pf | train | function pf(value) {
if (value === (value | 0)) { // integer number
return value.toString();
}
var s = value.toFixed(10);
var i = s.length - 1;
if (s[i] !== '0') {
return s;
}
| javascript | {
"resource": ""
} |
q10398 | pm | train | function pm(m) {
if (m[4] === 0 && m[5] === 0) {
if (m[1] === 0 && m[2] === 0) {
if (m[0] === 1 && m[3] === 1) {
return '';
}
return 'scale(' + pf(m[0]) + ' ' + pf(m[3]) + ')';
}
if (m[0] === m[3] && m[1] === -m[2]) {
var a = Math.acos(m[0]) * 180 / Math.P... | javascript | {
"resource": ""
} |
q10399 | train | function() {
// Path to apis.js file
var apis_js = path.join(__dirname, '../src', 'apis.js');
// Create content
// Use json-stable-stringify rather than JSON.stringify to | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.