_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6900 | driver | train | function driver(options, fn) {
if ('function' == typeof options) fn = options, options = {};
options = options || {};
fn = fn || electron;
var nightmare = new Nightmare(options);
return function nightmare_driver(ctx, done) {
if (ctx !=null) {
debug('goingto %s', ctx.url);
... | javascript | {
"resource": ""
} |
q6901 | combineChangesets | train | function combineChangesets (changesets) {
const actions = changesets.map((changeset) => changeset.apply)
const combinedAction = function () {
const args = arguments
return actions.reduce((promise, action) | javascript | {
"resource": ""
} |
q6902 | isDataSource | train | function isDataSource( image ) {
const source = (typeof image === "string" ? image : image.src).substr(0, 5);
// base 64 string contains data-attribute, the MIME type and then the content, e.g. :
// e.g. "data:image/png;base64," for a typical PNG, | javascript | {
"resource": ""
} |
q6903 | anyBase | train | function anyBase(srcAlphabet, dstAlphabet) {
var converter = new Converter(srcAlphabet, dstAlphabet);
/**
* Convert function
*
* @param {string|Array} number
| javascript | {
"resource": ""
} |
q6904 | train | function (fn, context, rate, warningThreshold) {
var queue = [],
timeout;
function next () {
if (queue.length === 0) {
timeout = null;
return;
}
fn.apply(context, queue.shift());
timeout = setTimeout(next, ... | javascript | {
"resource": ""
} | |
q6905 | train | function (name, fn, ctx) {
assert(isString(name), 'EventEmitter#on: name is not a string');
assert(isFunction(fn), 'EventEmitter#on: fn is not a function');
// If the context is not passed, use `this`.
ctx = ctx || this;
| javascript | {
"resource": ""
} | |
q6906 | train | function (name, fn, ctx) {
// If the context is not passed, use `this`.
ctx = ctx || this;
var self = this;
function onHandler() {
fn.apply(ctx, arguments);
| javascript | {
"resource": ""
} | |
q6907 | train | function (name, fn) {
this._listeners = !name
? []
: filter(this._listeners, function (listener) {
if (listener.name !== name) {
return true;
} else {
if (isFunction(fn)) {
| javascript | {
"resource": ""
} | |
q6908 | train | function (name, params) {
assert(isString(name), 'EventEmitter#emit: name is not a string');
forEach(this._listeners, function (event) {
if (event.name === name) {
event.fn.call(event.ctx, params);
}
// Special behaviour for wildcard - invoke each ev... | javascript | {
"resource": ""
} | |
q6909 | getElementBoundingRect | train | function getElementBoundingRect(elementSelector) {
/**
* @param {Window} win
* @param {Object} [dims]
* @returns {Object}
*/
function computeFrameOffset(win, dims) {
// initialize our result variable
dims = dims || {
left: win.pageXOffset,
top: win.pag... | javascript | {
"resource": ""
} |
q6910 | reduxifyReducer | train | function reduxifyReducer (reducer, collectionName = null) {
return (state = [], action) => {
const collection = createReduxifyCollection(state, collectionName)
const changeset = reducer(collection, action)
// the changesets returned by the reduxify collections are just plain synchronous methods
retur... | javascript | {
"resource": ""
} |
q6911 | NoEmpty | train | function NoEmpty(type) {
type = typeof type == 'string' ?
Block.create({
type,
nodes: [
Text.create()
]
}) : type;
const onBeforeChange = (state) => {
const { document } = | javascript | {
"resource": ""
} |
q6912 | onRequest | train | function onRequest (request, sender, sendResponse) {
// Show the page action for the tab that the sender (content script) was on.
chrome.pageAction.show(sender.tab.id)
var files = request.files
if (request.action === 'load') {
var rules = []
for (var file in files) {
var regex
var isKnownF... | javascript | {
"resource": ""
} |
q6913 | waitFor | train | function waitFor (event, listener, context, wait) {
var timeout;
if (!wait) {
throw new Error("[FATAL] waitFor called without wait time");
}
var handler = function () {
clearTimeout(timeout);
listener.apply(context, arguments);
};
timeout = setTimeout(function () {
| javascript | {
"resource": ""
} |
q6914 | listenFor | train | function listenFor (event, listener, context, duration) {
setTimeout(function () | javascript | {
"resource": ""
} |
q6915 | connectTo | train | function connectTo (connectionSettings, createCollections) {
const sequelize = new Sequelize(connectionSettings)
const collections = createCollections(sequelize, createCollection)
const database = {
/** @property {Sequelize} connection */
connection: sequelize,
/** @property {Object} collections ... | javascript | {
"resource": ""
} |
q6916 | stringifyObject | train | function stringifyObject(obj, prefix) {
var ret = []
, keys = objectKeys(obj)
, key;
for (var i = 0, len = keys.length; i < len; ++i) {
key = keys[i];
ret.push(stringify(obj[key], prefix | javascript | {
"resource": ""
} |
q6917 | train | function(target, obj){
for (var attr in obj) {
if(obj.hasOwnProperty(attr)){
| javascript | {
"resource": ""
} | |
q6918 | getCredits | train | function getCredits(projectPath, credits) {
credits = credits || [];
const jspmPath = path.join(projectPath, 'jspm_packages');
globby.sync([`${jspmPath}/npm/*/package.json`, `${jspmPath}/github/*/*/{package.json,bower.json}`])
.forEach(packagePath => {
| javascript | {
"resource": ""
} |
q6919 | getCredit | train | function getCredit(credits, author) {
const credit = credits.filter(credit => {
// Fallback to name when no email
// is available
if (credit.email && author.email) {
return credit.email === author.email;
}
| javascript | {
"resource": ""
} |
q6920 | addCreditToCredits | train | function addCreditToCredits(credits, person, name) {
let credit = getCredit(credits, person);
if (!credit) {
credit = person;
credit.packages = [];
credits.push(credit);
}
if | javascript | {
"resource": ""
} |
q6921 | RedisStore | train | function RedisStore(port, host, options) {
port = port || 6379;
host = host || '127.0.0.1';
this._options = options || {};
this._options.redisstore = this._options.redisstore || {};
if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) {
throw new Error('database has to be a numbe... | javascript | {
"resource": ""
} |
q6922 | createOAuthWrapper | train | function createOAuthWrapper(oauthkey,
oauthsecret, headers) {
return new OAuthClient(
'https://api.7digital.com/1.2/oauth/requesttoken',
| javascript | {
"resource": ""
} |
q6923 | breadcrumb | train | function breadcrumb() {
const $breadcrumb = $(`.${namespace}-breadcrumbs`).empty();
chain().each(function () {
const $crumb | javascript | {
"resource": ""
} |
q6924 | animation | train | function animation($column, $columns) {
let width = 0;
chain().not($column).each(function () {
width += $(this).outerWidth(true);
});
$columns.stop().animate({
scrollLeft: width
}, settings.delay, function () {
const last = $columns.find(`.${na... | javascript | {
"resource": ""
} |
q6925 | unnest | train | function unnest($columns) {
const queue = [];
let $node;
// Push the root unordered list item into the queue.
queue.push($columns.children());
while (queue.length) {
$node = queue.shift();
$node.children(itemSelector).each(function (item, el) {
... | javascript | {
"resource": ""
} |
q6926 | getAllStar | train | function getAllStar(person) {
// Override properties from all-stars if available | javascript | {
"resource": ""
} |
q6927 | getPersonObject | train | function getPersonObject(personString) {
const regex = personString.match(/^(.*?)\s?(<(.*)>)?\s?(\((.*)\))?\s?$/);
return getAllStar({ | javascript | {
"resource": ""
} |
q6928 | getAuthor | train | function getAuthor(packageJson) {
if (Array.isArray(packageJson.authors)) {
packageJson.authors = packageJson.authors.map(author => {
if (typeof author === 'string') {
return getPersonObject(author);
}
return getAllStar(author);
});
return packageJson.authors | javascript | {
"resource": ""
} |
q6929 | getMaintainers | train | function getMaintainers(packageJson) {
if (Array.isArray(packageJson.maintainers)) {
packageJson.maintainers = packageJson.maintainers.map(maintainer => {
if (typeof maintainer === 'string') {
return getPersonObject(maintainer);
| javascript | {
"resource": ""
} |
q6930 | getNpmCredits | train | function getNpmCredits(packagePath, credits) {
const directoryPath = path.dirname(packagePath);
const name = path.basename(path.dirname(packagePath));
if (
name[0] !== '.' && (
fs.lstatSync(directoryPath).isDirectory() ||
fs.lstatSync(directoryPath).isSymbolicLink()
)
) {
const packageJson = packageUti... | javascript | {
"resource": ""
} |
q6931 | getCredits | train | function getCredits(projectPath, credits) {
credits = credits || [];
const depPath = path.join(projectPath, 'node_modules');
globby.sync(`${depPath}/**/package.json`) | javascript | {
"resource": ""
} |
q6932 | preProcessBindings | train | function preProcessBindings(bindingString) {
var results = [];
var bindingHandlers = this.bindingHandlers;
var preprocessed;
// Check for a Provider.preprocessNode property
if (typeof this.preprocessNode === 'function') {
preprocessed = this.preprocessNode(bindingString, this);
if (preprocessed) { bi... | javascript | {
"resource": ""
} |
q6933 | template | train | function template(url, params) {
var templated = url;
var keys = _.keys(params);
var loweredKeys = _.map(keys, function (key) {
return key.toLowerCase();
});
var keyLookup = _.zipObject(loweredKeys, keys);
_.each(templateParams(url), function replaceParam(param) {
var normalisedParam = param.toLowerCase().su... | javascript | {
"resource": ""
} |
q6934 | readDirectory | train | function readDirectory( projectPath, analyzers ) {
var credits = {};
for ( var analyzer in analyzers ) {
| javascript | {
"resource": ""
} |
q6935 | getBowerCredits | train | function getBowerCredits(bowerJsonPath, credits) {
const name = path.basename(path.dirname(bowerJsonPath));
const bowerJson = packageUtil.readJSONSync(bowerJsonPath);
const authors = packageUtil.getAuthor(bowerJson);
if | javascript | {
"resource": ""
} |
q6936 | getCredits | train | function getCredits(projectPath, credits) {
credits = credits || [];
const depPath = path.join(projectPath, 'bower_components');
globby.sync([`${depPath}/*/bower.json`]) | javascript | {
"resource": ""
} |
q6937 | arrySignaturesMatch | train | function arrySignaturesMatch(array1, array2){
// setup variables
var ref, test;
// we want to use the shorter array if one is longer
if (array1.length >= array2.length) {
ref = array2;
test = array1;
} else {
ref = array1;
test = array2;
}
// loop over the shorter a... | javascript | {
"resource": ""
} |
q6938 | objectSignaturesMatch | train | function objectSignaturesMatch(object1, object2){
// because typeof null is object we need to check for it here before Object.keys
if(object1 === null && object2 === null){
return true;
}
// if the objects have different lengths of keys we should fail immediatly
if (Object.keys(object1).leng... | javascript | {
"resource": ""
} |
q6939 | train | function() {
var refArgs = Array.prototype.slice.call(arguments);
var calledArgs = this.actual.mostRecentCall.args;
var arg;
for(arg in refArgs){
var ref = refArgs[arg];
var test = calledArgs[arg];
// if the types of the objects dont match
if(typeof ref !== type... | javascript | {
"resource": ""
} | |
q6940 | getAnalyzers | train | function getAnalyzers(config) {
const methods = {};
const basePath = config.filePaths.analyzers;
globby.sync(`${basePath}/*`)
.forEach(analyzer => {
const | javascript | {
"resource": ""
} |
q6941 | prepare | train | function prepare(data, consumerkey) {
var prop;
data = data || {};
for (prop in data) {
if (data.hasOwnProperty(prop)) {
if (_.isDate(data[prop])) {
| javascript | {
"resource": ""
} |
q6942 | logHeaders | train | function logHeaders(logger, headers) {
return _.each(_.keys(headers), function (key) {
| javascript | {
"resource": ""
} |
q6943 | get | train | function get(endpointInfo, requestData, headers, credentials, logger,
callback) {
var normalisedData = prepare(requestData, credentials.consumerkey);
var fullUrl = endpointInfo.url + '?' + qs.stringify(normalisedData);
var hostInfo = {
host: endpointInfo.host,
port: endpointInfo.port
};
// Decide whether to... | javascript | {
"resource": ""
} |
q6944 | dispatchSecure | train | function dispatchSecure(path, httpMethod, requestData, headers, authtype,
hostInfo, credentials, logger, callback) {
var url;
var is2Legged = authtype === '2-legged';
var token = is2Legged ? null : requestData.accesstoken;
var secret = is2Legged ? null : requestData.accesssecret;
var mergedHeaders = createHeader... | javascript | {
"resource": ""
} |
q6945 | dispatch | train | function dispatch(url, httpMethod, data, headers, hostInfo, credentials,
logger, callback) {
hostInfo.port = hostInfo.port || 80;
var apiRequest, prop, hasErrored;
var mergedHeaders = createHeaders(hostInfo.host, headers);
var apiPath = url;
data = prepare(data, credentials.consumerkey);
// Special case for... | javascript | {
"resource": ""
} |
q6946 | makeLogger | train | function makeLogger(level, method) {
// The logger function to return takes a variable number of arguments
// and formats like console.log
function logger() {
var args = [].slice.call(arguments);
var format = level.toUpperCase() + ': (api-client) ' + args.shift();
var logArgs = [format].concat(args); | javascript | {
"resource": ""
} |
q6947 | ensureCollections | train | function ensureCollections(collectionPaths, response) {
var basket;
_.each(collectionPaths, function checkLength(item) {
var parts = item.split('.');
var allPartsButLast = _.initial(parts);
var lastPart = _.last(parts);
var parents = _.reduce(allPartsButLast, function (chain, part) {
return chain.pluck(par... | javascript | {
"resource": ""
} |
q6948 | Api | train | function Api(options, schema) {
var prop, resourceOptions, resourceConstructor;
var apiRoot = this;
// Set default options for any unsupplied overrides
_.defaults(options, config);
this.options = options;
this.schema = schema;
configureSchemaFromEnv(this.schema);
// Creates a constructor with the pre-built r... | javascript | {
"resource": ""
} |
q6949 | createResourceConstructor | train | function createResourceConstructor(resourcePrototype) {
function APIResource(resourceOptions) {
// Allow creating resources without `new` keyword
if (!(this instanceof APIResource)) {
return new APIResource(resourceOptions);
}
resourceOptions = resourceOptions || {};
// Override any default option... | javascript | {
"resource": ""
} |
q6950 | _getIdByUsername | train | function _getIdByUsername(username) {
const url = `${API}/get-user-id`;
| javascript | {
"resource": ""
} |
q6951 | rant | train | function rant(id = _noRantIdError()) {
const url = `${API}/devrant/rants/${id}`;
const params = | javascript | {
"resource": ""
} |
q6952 | rants | train | function rants({
sort = 'algo',
limit = 50,
skip = 0
} = {}) {
const url = `${API}/devrant/rants`;
| javascript | {
"resource": ""
} |
q6953 | search | train | function search(term = _noSearchTermError()) {
const url = `${API}/devrant/search`;
| javascript | {
"resource": ""
} |
q6954 | profile | train | function profile(username = _noUsernameError()) {
return co(function *resolveUsername() {
const userId = yield _getIdByUsername(username);
const url = `${API}/users/${userId}`;
const | javascript | {
"resource": ""
} |
q6955 | to2 | train | function to2 (alpha3) {
if (alpha3 && alpha3.length > 1) state = alpha3
if (state.length !== 3) return state
return | javascript | {
"resource": ""
} |
q6956 | to3 | train | function to3 (alpha2) {
if (alpha2 && alpha2.length > 1) state = alpha2
if (state.length !== 2) return state
return | javascript | {
"resource": ""
} |
q6957 | Resource | train | function Resource(options, schema) {
this.logger = options.logger;
this.resourceName = options.resourceDefinition.resource;
this.host = options.resourceDefinition.host || schema.host;
this.sslHost = options.resourceDefinition.sslHost || schema.sslHost;
this.port = options.resourceDefinition.port || schema.port;
t... | javascript | {
"resource": ""
} |
q6958 | truncFilename | train | function truncFilename(path, rootFolderName) {
// bail if a string wasn't provided
if (typeof path !== 'string') {
return path; | javascript | {
"resource": ""
} |
q6959 | getTimestampString | train | function getTimestampString(date) {
// all this nasty code is faster (~30k ops/sec) than doing "moment(date).format('HH:mm:ss:SSS')" and means 0 dependencies
var hour = '0' + date.getHours();
hour = hour.slice(hour.length - 2);
var minute = '0' + date.getMinutes();
minute = minute.slice(minute.lengt... | javascript | {
"resource": ""
} |
q6960 | getColorSeverity | train | function getColorSeverity(severity) {
// get the color associated with the severity level
const color = severityMap[severity] | javascript | {
"resource": ""
} |
q6961 | formatter | train | function formatter(options, severity, date, elems) {
/*
OPTIONS
*/
const indent = options.indent || defaultIndent;
const objectDepth = options.objectDepth;
const timestamp = (function () {
if (check.function(options.timestamp)) {
return options.timestamp; // user-provided ti... | javascript | {
"resource": ""
} |
q6962 | parse | train | function parse(response, opts, callback) {
var parser, jsonParseError, result;
if (opts.format.toUpperCase() === 'XML') {
callback(null, response);
return;
}
if (opts.contentType && opts.contentType.indexOf('json') >= 0) {
try {
result = JSON.parse(response);
} catch (e) {
jsonParseError = e;
}
... | javascript | {
"resource": ""
} |
q6963 | ApiHttpError | train | function ApiHttpError(statusCode, response, message) {
this.name = "ApiHttpError";
this.statusCode = statusCode;
this.response = response;
this.message = | javascript | {
"resource": ""
} |
q6964 | ApiParseError | train | function ApiParseError(parseErrorMessage, response) {
this.name = "ApiParseError";
this.response = response;
this.message = parseErrorMessage;
if (Error.captureStackTrace
&& | javascript | {
"resource": ""
} |
q6965 | RequestError | train | function RequestError(err, url) {
VError.call(this, err, 'for url %s', | javascript | {
"resource": ""
} |
q6966 | OAuthError | train | function OAuthError(errorResponse, message) {
this.name = "OAuthError";
this.message = message || errorResponse.errorMessage;
this.code = errorResponse.code;
this.response = errorResponse;
if | javascript | {
"resource": ""
} |
q6967 | train | function(args, data, msg) {
if (typeof (args) !== 'object') {
args = [args];
}
for (var i in args) | javascript | {
"resource": ""
} | |
q6968 | parseLinkHeader | train | function parseLinkHeader(header) {
if (!header) {
return {};
}
// Split parts by comma
const parts = header.split(',');
const links = {};
// Parse each part into a named link
parts.forEach((p) => {
| javascript | {
"resource": ""
} |
q6969 | train | function (name) {
if (JOII.Config.constructors.indexOf(name) !== -1) {
return;
| javascript | {
"resource": ""
} | |
q6970 | train | function(name) {
if (JOII.Config.constructors.indexOf(name) === -1) {
return;
| javascript | {
"resource": ""
} | |
q6971 | train | function(msg) {
if (yahoo.logging) {
console.log('ERROR: ' + msg);
}
| javascript | {
"resource": ""
} | |
q6972 | processNewMessage | train | function processNewMessage(msg, mailMessage) {
// msg = JSON.parse(JSON.stringify(msg)); // Clone the message
// Populate the msg fields from the content of the email message
// that we have just parsed.
msg.payload = mailMessage.text;
msg.... | javascript | {
"resource": ""
} |
q6973 | checkPOP3 | train | function checkPOP3(msg) {
let currentMessage;
let maxMessage;
// Form a new connection to our email server using POP3.
let pop3Client = new POP3Client(
node.port, node.server,
{enabletls: node.useSSL} // Should we u... | javascript | {
"resource": ""
} |
q6974 | processValuesFromContext | train | function processValuesFromContext(node, params, msg, varList) {
let pMsg = {};
Object.assign(pMsg, params);
varList.forEach((varItem) => {
if (varItem.type === undefined || params[varItem.type] === undefined) {
pMsg[varItem.name... | javascript | {
"resource": ""
} |
q6975 | splitRow | train | function splitRow(s, delimiter) {
var row = [], c, col = '', i, inString = false;
s = s.trim();
for (i = 0; i < s.length; i += 1) {
c = s[i];
if (c === '"') {
if (s[i+1] === '"') {
col += '"';
i += 1;
} else {
inString =... | javascript | {
"resource": ""
} |
q6976 | train | function(name) {
var list = this.getProperties();
for (var i in list) {
| javascript | {
"resource": ""
} | |
q6977 | train | function(filter) {
var result = [];
for (var i in this.proto) {
if (typeof (this.proto[i]) === 'function' && JOII.Compat.indexOf(JOII.InternalPropertyNames, i) === -1) {
| javascript | {
"resource": ""
} | |
q6978 | train | function(name) {
var list = this.getMethods();
for (var i in list) {
| javascript | {
"resource": ""
} | |
q6979 | train | function(name) {
var list = this.getMethods();
for (var i in list) {
if (list[i].getName() === | javascript | {
"resource": ""
} | |
q6980 | train | function(name) {
var list = this.getProperties();
for (var i in list) {
if (list[i].getName() === | javascript | {
"resource": ""
} | |
q6981 | train | function() {
var name_parts = [],
proto_ref = this.reflector.getProto()[this.name],
name = '',
body = '';
if (this.meta.is_abstract) { name_parts.push('abstract'); }
if (this.meta.is_final) { name_parts.push('final'); }
name_parts.push(t... | javascript | {
"resource": ""
} | |
q6982 | train | function() {
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m,
FN_ARG_SPLIT = /,/,
FN_ARG = /^\s*(_?)(\S+?)\1\s*$/,
STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
getParams = function(fn) {
var fnText, argDecl;
... | javascript | {
"resource": ""
} | |
q6983 | train | function(f) {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
fn_text = this.reflector.getProto()[this.name].toString().replace(STRIP_COMMENTS, '');
| javascript | {
"resource": ""
} | |
q6984 | train | function() {
// Get the "declaration" part of the method.
var prefix = this['super']('toString').split(':')[0],
body = '[Function',
args = this.getParameters(),
is_var = this.usesVariadicArguments();
if (args.length > 0 && typeof (args[0]) === 'object') ... | javascript | {
"resource": ""
} | |
q6985 | sendError | train | function sendError(node, msg, err, ...attrs) {
if (check.string(err)) {
msg.error = {
node: node.name,
message: util.format(err, ...attrs),
};
} else if | javascript | {
"resource": ""
} |
q6986 | Walk | train | function Walk(root, onDir, onEnd, onError) {
if (!(this instanceof Walk)) {
return new Walk(root, onDir, onEnd, onError);
}
this.dirs = [path.resolve(root)];
| javascript | {
"resource": ""
} |
q6987 | LineReader | train | function LineReader(file) {
if (typeof file === 'string') {
this.readstream = fs.createReadStream(file);
} else {
this.readstream = file;
}
this.remainBuffers = [];
var self = this;
this.readstream.on('data', function (data) {
| javascript | {
"resource": ""
} |
q6988 | loadWebAssembly | train | function loadWebAssembly(filename, imports) {
// Fetch the file and compile it
return fetch(filename)
.then(response => response.arrayBuffer())
.then(buffer => WebAssembly.compile(buffer))
.then(module => {
// create the imports for the module, including the
// standard dynamic library impor... | javascript | {
"resource": ""
} |
q6989 | train | function(message) {
if (debug) console.log('Decoding HEP3 Packet...');
try {
var HEP = hepHeader.parse(message);
if(HEP.payload && HEP.payload.length>0){
var data = HEP.payload;
var tot = 0;
var decoded = {};
var PAYLOAD;
while(true){
PAYLOAD = hepParse.parse( data.slice(tot) );
var t... | javascript | {
"resource": ""
} | |
q6990 | toGradientData | train | function toGradientData(v1, v2, v3, v4, v5) {
var startColor, endColor, type, rotation, spread, d;
var data = {};
if (arguments.length === 1) { // The argument is a dictionary or undefined.
d = v1 || {};
startColor = d.startColor;
endColor = d.endColor;
type = d.type;
... | javascript | {
"resource": ""
} |
q6991 | train | function (canvas) {
this.width = canvas.width;
this.height = canvas.height;
var ctx = canvas.getContext('2d');
this._data = | javascript | {
"resource": ""
} | |
q6992 | walkModules | train | function walkModules(dir, done) {
var results = [];
fs.readdir(dir, function(err, list) {
if (err) return done(err);
var pending = list.length;
if (!pending) return done(null, results);
list.forEach(function(file) {
file = dir + path.sep + file;
fs.stat(file, function(err... | javascript | {
"resource": ""
} |
q6993 | readRows | train | function readRows(ws, rows, opts) {
let contents = {};
if (typeof rows === 'string') {
rows = rows.split(',');
}
opts = (opts === undefined) ? {} : opts;
// console.log('Typeof Rows %s', typeof rows);
// console.log('Typeof Rows %s', rows);
// console.... | javascript | {
"resource": ""
} |
q6994 | readCols | train | function readCols(ws, cols, opts) {
// console.log('Reading cols ' + cols.length);
// console.log(cols);
let contents = {};
if (typeof cols === 'string') {
cols = cols.split(',');
}
opts = (opts === undefined) ? {} : opts;
let dRange = xlsx.utils.decod... | javascript | {
"resource": ""
} |
q6995 | readRegion | train | function readRegion(ws, range, opts) {
let contents = {};
opts = (opts === undefined) ? {} : opts;
// console.log('Xref:%s', ws['!ref']);
let dORange = xlsx.utils.decode_range(ws['!ref']);
let dRange = xlsx.utils.decode_range(range);
// Support for cols only ranges like ... | javascript | {
"resource": ""
} |
q6996 | writeRegion | train | function writeRegion(ws, urange, contents) {
let range = ws['!ref'];
range = check.undefined(range) ? 'A1:A1' : range;
let dRange = xlsx.utils.decode_range(range);
let dUrange = xlsx.utils.decode_range(urange);
let newRef = {s: {c: 0, r: 0}, e: {c: dRange.e.c, r: dRange.e.r}};
... | javascript | {
"resource": ""
} |
q6997 | writeCols | train | function writeCols(ws, cols, contents) {
let range = ws['!ref'];
range = check.undefined(range) ? 'A1:A1' : range;
let dRange = xlsx.utils.decode_range(range);
let newRef = {s: {c: 0, r: 0}, e: {c: dRange.e.c, r: dRange.e.r}};
let encCell;
if (typeof cols === 'string') {
... | javascript | {
"resource": ""
} |
q6998 | writeRows | train | function writeRows(ws, rows, contents) {
// console.log('Typeof Rows %s', typeof rows);
// console.log('Typeof Rows %s', rows);
// console.log('Length Rows %d', rows.length);
let range = ws['!ref'];
range = check.undefined(range) ? 'A1:A1' : range;
let dRange = xlsx.utils... | javascript | {
"resource": ""
} |
q6999 | format | train | function format(opt_clangOptions, opt_clangFormat) {
var actualClangFormat = opt_clangFormat || clangFormat;
var optsStr = getOptsString(opt_clangOptions);
function formatFilter(file, enc, done) {
function onClangFormatFinished() {
file.contents = Buffer.from(formatted, 'utf-8');
done(null, file)... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.