_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q55800 | train | function (str, options)
{
options = options || { };
var optimize = options.optimize;
var optimizerList = [];
if (optimize)
{
var optimizeComplex;
var optimizeToString;
if (typeof optimize === 'object')
... | javascript | {
"resource": ""
} | |
q55801 | train | function (array, maxLength)
{
var result =
this.replaceStringArray(array, [FALSE_FREE_DELIMITER], null, false, maxLength);
return result;
} | javascript | {
"resource": ""
} | |
q55802 | encode | train | function encode(input, options)
{
input = esToString(input);
options = options || { };
var features = options.features;
var runAsData;
var runAs = options.runAs;
if (runAs !== undefined)
runAsData = filterRunAs(runAs, 'runAs');
else
run... | javascript | {
"resource": ""
} |
q55803 | MapOperation | train | function MapOperation() {
this.counters = { increment: [], remove : []};
this.maps = { modify: [], remove: []};
this.sets = { adds: [], removes: [], remove: []};
this.registers = { set: [], remove: [] };
this.flags = { set: [], remove: [] };
} | javascript | {
"resource": ""
} |
q55804 | train | function(key) {
this._removeAddsOrRemoves(this.counters.increment, key);
if (this.counters.remove.indexOf(key) === -1) {
this.counters.remove.push(key);
}
return this;
} | javascript | {
"resource": ""
} | |
q55805 | train | function(key, value) {
this._removeRemove(this.sets.remove, key);
var op = this._getOp(this.sets.removes, key);
if (op) {
op.remove.push(value);
} else {
this.sets.removes.push({key: key, remove: [value]});
}
return this;
} | javascript | {
"resource": ""
} | |
q55806 | train | function(key) {
this._removeAddsOrRemoves(this.sets.adds, key);
this._removeAddsOrRemoves(this.sets.removes, key);
if (this.sets.remove.indexOf(key) === -1) {
this.sets.remove.push(key);
}
return this;
} | javascript | {
"resource": ""
} | |
q55807 | train | function(key, value) {
this._removeRemove(this.registers.remove, key);
var op = this._getOp(this.registers.set, key);
if (op) {
op.value = value;
} else {
this.registers.set.push({key: key, value: value});
}
return this;
} | javascript | {
"resource": ""
} | |
q55808 | train | function(key) {
this._removeAddsOrRemoves(this.registers.set, key);
if (this.registers.remove.indexOf(key) === -1) {
this.registers.remove.push(key);
}
return this;
} | javascript | {
"resource": ""
} | |
q55809 | train | function(key, state) {
this._removeRemove(this.flags.remove, key);
var op = this._getOp(this.flags.set, key);
if (op) {
op.state = state;
} else {
this.flags.set.push({key: key, state: state});
}
return this;
} | javascript | {
"resource": ""
} | |
q55810 | train | function(key) {
this._removeAddsOrRemoves(this.flags.set, key);
if (this.flags.remove.indexOf(key) === -1) {
this.flags.remove.push(key);
}
return this;
} | javascript | {
"resource": ""
} | |
q55811 | train | function(key) {
this._removeAddsOrRemoves(this.maps.modify, key);
if (this.maps.remove.indexOf(key) === -1) {
this.maps.remove.push(key);
}
return this;
} | javascript | {
"resource": ""
} | |
q55812 | train | function(nodes) {
for (var i = 0; i < nodes.length; i++) {
if (nodes[i] instanceof RiakNode) {
this.nodes.push(nodes[i]);
}
}
return this;
} | javascript | {
"resource": ""
} | |
q55813 | finishRelease | train | function finishRelease() {
log.done();
execSync("npm run examples", {stdio: "inherit"});
execSync("npm run docs", {stdio: "inherit"});
let commits = "", releaseUrl = "", zipSize = 0;
log.timer("compiling release notes");
execAsync("git log --pretty=format:'* %s (%h)' `git describe --tags --abbrev=0`...HEA... | javascript | {
"resource": ""
} |
q55814 | initBuffer | train | function initBuffer(data) {
// Create a new buffer to receive data if needed
if (buffer === null) {
buffer = new ByteBuffer(initBufferSize);
}
buffer.append(data);
buffer.flip();
} | javascript | {
"resource": ""
} |
q55815 | train | function (addresses, options) {
var riakNodes = [];
if (options === undefined) {
options = {};
}
for (var i = 0; i < addresses.length; i++) {
var split = addresses[i].split(':');
options.remoteAddress = split[0];
if (split.length === 2) {
options.remotePort ... | javascript | {
"resource": ""
} | |
q55816 | execAsync | train | function execAsync(cmd, opts = {}) {
return new Promise((resolve, reject) => {
shell.exec(cmd, opts, (code, stdout, stderr) => {
if (code !== 0) return reject(new Error(stderr));
return resolve(stdout);
});
});
} | javascript | {
"resource": ""
} |
q55817 | CommandBase | train | function CommandBase(pbRequestName, pbResponseName, callback) {
var requestCode = ProtoBufFactory.getCodeFor(pbRequestName);
this.expectedCode = ProtoBufFactory.getCodeFor(pbResponseName);
this.pbBuilder = ProtoBufFactory.getProtoFor(pbRequestName);
var schema = Joi.func().required();
var self = th... | javascript | {
"resource": ""
} |
q55818 | ByKeyBase | train | function ByKeyBase(options, pbRequestName, pbResponseName, callback) {
CommandBase.call(this, pbRequestName, pbResponseName, callback);
this.validateOptions(options, schema);
} | javascript | {
"resource": ""
} |
q55819 | train | function(indexName, key) {
if (this.indexes === undefined) {
this.indexes = {};
}
if (!this.indexes.hasOwnProperty(indexName)) {
this.indexes[indexName] = [];
}
for (var i = 1; i < arguments.length; i++) {
this.indexes[indexName].push(arguments... | javascript | {
"resource": ""
} | |
q55820 | encodeBlocks | train | function encodeBlocks($, prefix, blockType, args, block) {
if (!prefix) prefix = "";
if (blockType == "function") {
// decode the function block (THIS IS THE IMPORTANT BIT)
// We are retrieving all sub-blocks and will re-parse them in light
// of newly shrunk variables
block ... | javascript | {
"resource": ""
} |
q55821 | decodeBlocks | train | function decodeBlocks(script, encoded) {
while (encoded.test(script)) {
script = script.replace(global(encoded), function(match, index) {
return blocks[index];
});
}
return script;
} | javascript | {
"resource": ""
} |
q55822 | parseShortcode | train | function parseShortcode(innerShortcode) {
var trimmedInnerShortcode = innerShortcode.trim();
// If no shortcode, it was blank between the blocks - return nothing.
if (!trimmedInnerShortcode) return;
// If no whitespace, then shortcode is just name with no attributes.
if (!hasWhiteSpace(trimmedInnerShortcode... | javascript | {
"resource": ""
} |
q55823 | _Array_forEach | train | function _Array_forEach(array, block, context) {
if (array == null) array = global;
var length = array.length || 0, i; // preserve length
if (typeof array == "string") {
for (i = 0; i < length; i++) {
block.call(context, array.charAt(i), i, array);
}
} else { // Cater for sparse arrays.
for (i... | javascript | {
"resource": ""
} |
q55824 | train | function() {
if(file.revOrigPath) {
rimraf(file.revOrigPath, function(err) {
if (err) return cb(err);
cb(null, file);
});
} else {
cb(null);
}
} | javascript | {
"resource": ""
} | |
q55825 | train | function(message) {
// Send notification as a proactive message
var activity = message.activity
var reference = TurnContext.getConversationReference(activity);
MicrosoftAppCredentials.trustServiceUrl(activity.serviceUrl);
adapter.continueConversation(reference, async (context) => {
//... | javascript | {
"resource": ""
} | |
q55826 | sendMessage | train | function sendMessage() {
var cache = [];
var args = [].slice.call(arguments);
// Safe stringifying of cyclical JSON
function decycle(key, val) {
if (typeof val === 'object' && val !== null) {
if (cache.indexOf(val) >= 0) return;
cache.push(val);
}
return val;
}
... | javascript | {
"resource": ""
} |
q55827 | decycle | train | function decycle(key, val) {
if (typeof val === 'object' && val !== null) {
if (cache.indexOf(val) >= 0) return;
cache.push(val);
}
return val;
} | javascript | {
"resource": ""
} |
q55828 | createGruntListener | train | function createGruntListener(ev, runner) {
runner.on(ev, function(test, err) {
var data = {
err: err
};
if (test) {
data.title = test.title;
data.fullTitle = test.fullTitle();
data.state = test.state;
data.duration = test.duration;
data.slow = test.... | javascript | {
"resource": ""
} |
q55829 | train | function(err) {
var stats = runner.stats;
testStats.push(stats);
if (err) {
// Show Growl notice
// @TODO: Get an example of this
// growl('PhantomJS Error!');
// If there was a PhantomJS error, abort the series.
grunt.fatal(err... | javascript | {
"resource": ""
} | |
q55830 | train | function(arg) {
var args = Array.isArray(arg) ? arg : [].slice.call(arguments);
last = new Date();
fs.write(tmpfile, JSON.stringify(args) + '\n', 'a');
} | javascript | {
"resource": ""
} | |
q55831 | bluemixServiceLookup | train | function bluemixServiceLookup(options, verbose) {
var result = false;
if (process.env.VCAP_SERVICES) {
if (verbose) console.log('VCAP_SERVICES variable present in environment');
var services = JSON.parse(process.env.VCAP_SERVICES);
for (var key in services) {
if (key.lastIndexOf(mqlightServiceName... | javascript | {
"resource": ""
} |
q55832 | setupError | train | function setupError(obj, name, message) {
if (obj) {
Error.call(obj);
Object.defineProperty(obj, 'name', {
value: name,
enumerable: false
});
Object.defineProperty(obj, 'message', {
value: message,
enumerable: false
});
} else {
logger.ffdc('setupError', 'ffdc001', nu... | javascript | {
"resource": ""
} |
q55833 | getNamedError | train | function getNamedError(obj) {
if (obj && obj instanceof Error && 'name' in obj) {
var Constructor = exports[obj.name];
if (typeof Constructor === 'function') {
var res = new Constructor(obj.message);
if (res) {
res.stack = obj.stack;
return res;
}
}
}
return obj;
} | javascript | {
"resource": ""
} |
q55834 | shouldReconnect | train | function shouldReconnect(err) {
// exclude all programming errors
return (!(err instanceof TypeError) &&
!(err instanceof InvalidArgumentError) &&
!(err instanceof NotPermittedError) &&
!(err instanceof ReplacedError) &&
!(err instanceof StoppedError) &&
!(err insta... | javascript | {
"resource": ""
} |
q55835 | train | function(fileUrl) {
logger.entry('getFileServiceFunction', logger.NO_CLIENT_ID);
logger.log('parms', logger.NO_CLIENT_ID, 'fileUrl:', fileUrl);
if (typeof fileUrl !== 'string') {
var err = new TypeError('fileUrl must be a string type');
logger.ffdc('getFileServiceFunction', 'ffdc001', null, err);
log... | javascript | {
"resource": ""
} | |
q55836 | train | function(client) {
if (typeof client === 'undefined'/* || client.constructor !== Client*/) {
logger.entry('Client.reconnect', logger.NO_CLIENT_ID);
logger.log('parms', logger.NO_CLIENT_ID, 'client:', client);
logger.exit('Client.reconnect', logger.NO_CLIENT_ID, undefined);
return;
}
logger.entry('... | javascript | {
"resource": ""
} | |
q55837 | train | function(error) {
logger.entry('Client._tryService.tryNextService', _id);
if (serviceList.length === 1) {
// We've tried all services without success. Pause for a while
// before trying again
logger.log('data', _id, 'End of service list');
client._se... | javascript | {
"resource": ""
} | |
q55838 | train | function(err) {
logger.entry('Client._tryService.connError', _id);
err = lookupError(err);
logger.log('data', _id, 'failed to connect to: ' + logUrl +
' due to error: ' + util.inspect(err));
// This service failed to connect. Try the next one.
// ... | javascript | {
"resource": ""
} | |
q55839 | meta_data_still_fresh | train | function meta_data_still_fresh(item) {
var promise = read_meta_data(item).
then(function(item) {
return new Promise(function(resolve, reject) {
if (headers_still_fresh(item.meta_data.headers)) {
resolve(item);
} else {
reject(item);
}
... | javascript | {
"resource": ""
} |
q55840 | ModelType | train | function ModelType(name, prefix, endp) {
this.name = name;
this.prefix = prefix;
this.endp = endp;
} | javascript | {
"resource": ""
} |
q55841 | getDataBasedOnCatalog | train | function getDataBasedOnCatalog(options, catalogs, models, cb) {
async.each(catalogs,
function(catalog, catcallback) {
/* Next, go to APIs for each catalog */
async.each(models,
function(model, modelcallback) {
pullDataFromEndp(options, catalog, model, function(err) {
if ... | javascript | {
"resource": ""
} |
q55842 | fetchFromCache | train | function fetchFromCache(options, opts, cb) {
// look for existing cached resource
if (indirFiles.length > 0) {
var etag;
var regexp = '^' + opts.prefix +
'([A-Za-z0-9]+={0,2})' + // base64 encoded
opts.suffix + '$';
var regex = new RegExp(regexp);
var i;
for (i ... | javascript | {
"resource": ""
} |
q55843 | train | function(callback) {
stageModels(app, models, function(err) {
models.pop(); // remove snapshot model
models.pop(); // remove optimizedData model
callback(err);
});
} | javascript | {
"resource": ""
} | |
q55844 | train | function(err) {
if (!err) {
loadData(app, apimanager, models, true, uid);
}
if (!apimanager.host) {
//monitor the file changes, load data again if any changes
fs.watch(definitionsDir, function(event, filename) {
if (filename !== '.datastore') {
logger.debu... | javascript | {
"resource": ""
} | |
q55845 | loadData | train | function loadData(app, apimanager, models, reload, uid) {
var currdir = getPreviousSnapshotDir();
var snapdir;
var snapshotID = getSnapshotID();
var populatedSnapshot = false;
async.series([
function(callback) {
logger.debug('apimanager before pullFromAPIm: %j', apimanager);
if (apimanager.ho... | javascript | {
"resource": ""
} |
q55846 | train | function(callback) {
populatedSnapshot = true;
loadConfig(app,
apimanager,
models,
currdir,
snapdir,
snapshotID,
callback);
} | javascript | {
"resource": ""
} | |
q55847 | stageModels | train | function stageModels(app, models, cb) {
logger.debug('stageModels entry');
async.forEach(models,
function(model, callback) {
app.dataSources.db.automigrate(
model.name,
function(err) {
callback(err);
}
);
},
function(err) {
logger.debug('stageModels ex... | javascript | {
"resource": ""
} |
q55848 | addSignatureHeaders | train | function addSignatureHeaders(body, headers, keyId, private_key) {
var sign = function(str, private_key) {
var sign = Crypto.createSign('RSA-SHA256');
sign.update(str);
return sign.sign(private_key, 'base64');
};
var sha256 = function(str, encoding) {
var bodyStr = JSON.stringify(str);
var has... | javascript | {
"resource": ""
} |
q55849 | handshakeWithAPIm | train | function handshakeWithAPIm(app, apimanager, private_key, cb) {
logger.debug('handshakeWithAPIm entry');
async.series([
function(callback) {
var body = JSON.stringify({ gatewayVersion: version });
var headers = { 'content-type': 'application/json' };
addSignatureHeaders(body, headers, 'micro-... | javascript | {
"resource": ""
} |
q55850 | pullFromAPIm | train | function pullFromAPIm(apimanager, currdir, uid, cb) {
logger.debug('pullFromAPIm entry');
// Have an APIm, grab latest if we can..
var snapdir = path.join(process.env.ROOTCONFIGDIR, uid);
fs.mkdirs(snapdir, function(err) {
if (err) {
logger.warn('Failed to create snapshot directory');
logger.de... | javascript | {
"resource": ""
} |
q55851 | loadConfig | train | function loadConfig(app, apimanager, models, currdir, snapdir, uid, cb) {
logger.debug('loadConfig entry');
var dirToLoad = (snapdir === '') ? currdir : snapdir;
loadConfigFromFS(app, apimanager, models, dirToLoad, uid, function(err) {
if (err) {
logger.error(err);
logger.debug('loadConfig error(... | javascript | {
"resource": ""
} |
q55852 | loadConfigFromFS | train | function loadConfigFromFS(app, apimanager, models, dir, uid, cb) {
// clear out existing files from model structure
models.forEach(
function(model) {
model.files = [];
}
);
if (apimanager.host) {
var files = [];
logger.debug('loadConfigFromFS entry');
try {
if (dir !== '') {
... | javascript | {
"resource": ""
} |
q55853 | train | function(seriesCallback) {
async.forEach(YAMLfiles,
function(file, fileCallback) {
logger.debug('Loading data from %s', file);
var readfile;
try {
// read the content of the files into memory and parse as JSON
readfile = YAML.load(fs.readFileSync(file,... | javascript | {
"resource": ""
} | |
q55854 | train | function(seriesCallback) {
defaultCatalog['snapshot-id'] = uid;
app.models['catalog'].create(
defaultCatalog,
function(err, mymodel) {
if (err) {
logger.error(err);
seriesCallback(err);
return;
}
logger.debug('%s created: %j',... | javascript | {
"resource": ""
} | |
q55855 | train | function(seriesCallback) {
var entry = {};
// add catalog
entry.catalog = defaultCatalog;
entry['snapshot-id'] = uid;
entry.document = {
product: '1.0.0',
info: {
name: 'static-product',
version: '1.0.0',
title: 'static-product' },
vis... | javascript | {
"resource": ""
} | |
q55856 | train | function(seriesCallback) {
var subscriptions = [];
if (apicCfg && apicCfg.plans && apicCfg.applications) {
//add the configured plans
var idx = 0;
for (var k in apicCfg.applications) {
var theApp = apicCfg.applications[k];
//An application can subscribe only one p... | javascript | {
"resource": ""
} | |
q55857 | train | function(seriesCallback) {
var modelname = 'tlsprofile';
async.forEachOf(
apicCfg['tls-profiles'],
function(profile, name, asyncCB) {
var instance = {
'snapshot-id': uid,
'org-id': defaultOrg.id,
id: 'defaultTlsProfile-' + name,
name:... | javascript | {
"resource": ""
} | |
q55858 | populateSnapshot | train | function populateSnapshot(app, uid, cb) {
logger.debug('populateSnapshot entry');
app.models.snapshot.create(
{ id: uid,
refcount: '1',
current: 'false' },
function(err, mymodel) {
if (err) {
logger.error('populateSnapshot error');
cb(err);
return;
}
lo... | javascript | {
"resource": ""
} |
q55859 | releaseSnapshot | train | function releaseSnapshot(app, uid, cb) {
logger.debug('releaseSnapshot entry');
app.models.snapshot.release(uid,
function(err) {
if (err) {
logger.error(err);
}
logger.debug('releaseSnapshot exit');
if (cb) {
cb(err);
}
});
} | javascript | {
"resource": ""
} |
q55860 | updateSnapshot | train | function updateSnapshot(app, uid, cb) {
logger.debug('updateSnapshot entry');
app.models.snapshot.findOne(
{ where: { current: 'true' } },
function(err, instance) {
if (err) {
// fall through assuming there was no current
} else if (instance) {
instance.updateAttributes(
... | javascript | {
"resource": ""
} |
q55861 | getOpParams | train | function getOpParams(pathParams, opParams) {
var unionParams = _.unionWith(opParams, pathParams, opParamComparator);
return unionParams;
} | javascript | {
"resource": ""
} |
q55862 | free | train | function free(key) {
if (locks[key]) {
delete locks[key];
stats.lock_remove();
}
tick(key);
} | javascript | {
"resource": ""
} |
q55863 | tick | train | function tick(key) {
var next;
if (waiting[key]) {
//there's somone waiting for this resource
if (!locks[key]) {
locks[key] = true;
stats.lock_add();
next = waiting[key].shift();
if (waiting[key].length === 0) {
//nobody is waiting ... | javascript | {
"resource": ""
} |
q55864 | wait | train | function wait(key, cb) {
if (!waiting[key]) {
waiting[key] = [];
}
waiting[key].push(cb);
} | javascript | {
"resource": ""
} |
q55865 | lock | train | function lock(key) {
var promise = new Promise(function(resolve, reject) {
wait(key, function(key) {
var released = false;
var lock = function() {
if (!released) {
free(key);
released = true;
}
};
... | javascript | {
"resource": ""
} |
q55866 | check | train | async function check(){
if (broker.emitter.open <= 0) return true;
else {
this.logger.warn("Event queue not empty... waiting", {queue: broker.emitter.open});
throw "Retry";
}
} | javascript | {
"resource": ""
} |
q55867 | isPropertyRequired | train | function isPropertyRequired(property, requiredArray) {
var found = false;
requiredArray = requiredArray || [];
requiredArray.forEach(function(requiredProperty) {
if (requiredProperty === property) {
found = true;
}
});
return found;
} | javascript | {
"resource": ""
} |
q55868 | instantiatePrimitive | train | function instantiatePrimitive(val) {
var type = val.type;
// Support for default values in the JSON Schema.
if (val.hasOwnProperty('default')) {
return val.default;
}
return typesInstantiator[type];
} | javascript | {
"resource": ""
} |
q55869 | getObjectType | train | function getObjectType(obj) {
// Check if type is array of types.
if (isArray(obj.type)) {
obj.type = obj.type[0];
}
return obj.type;
} | javascript | {
"resource": ""
} |
q55870 | findDefinition | train | function findDefinition(schema, ref) {
var propertyPath = ref.split('/').slice(1); // Ignore the #/uri at the beginning.
var currentProperty = propertyPath.splice(0, 1)[0];
var currentValue = schema;
while (currentProperty) {
currentValue = currentValue[currentProperty];
currentProperty = propertyPath... | javascript | {
"resource": ""
} |
q55871 | instantiate | train | function instantiate(schema, options) {
options = options || {};
/**
* Visits each sub-object using recursion.
* If it reaches a primitive, instantiate it.
* @param obj - The object that represents the schema.
* @param name - The name of the current object.
* @param data - The instance data that rep... | javascript | {
"resource": ""
} |
q55872 | train | function(options) {
if (config.sourcemaps) {
options = _.defaults(
options,
{ devtool: '#source-map' }
);
}
if (config.production) {
var currPlugins = _.isArray(options.plugins) ? options.plugins : [];
options.plugins = currPlugins.concat([new UglifyJ... | javascript | {
"resource": ""
} | |
q55873 | getRule | train | function getRule(commitlintConfig, ruleName) {
const rule = commitlintConfig.rules[ruleName];
if (rule) {
return {
raw: rule,
level: rule[0],
applicable: rule[1],
value: rule[2],
};
}
} | javascript | {
"resource": ""
} |
q55874 | reportIsValid | train | function reportIsValid(report = {}) {
return report.valid && report.errors.length === 0 && report.warnings.length === 0;
} | javascript | {
"resource": ""
} |
q55875 | reportSummary | train | function reportSummary(report = {}) {
if (reportIsValid(report)) {
return '';
}
const countErrors = report.errors.length;
const countWarnings = report.warnings.length;
const color = countErrors > 0 ? 'red' : 'yellow';
const summaries = [];
const issues = [];
if (countErrors > 0) {
summaries.push(chalk`{r... | javascript | {
"resource": ""
} |
q55876 | connect | train | function connect() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var callback = arguments[1];
this.host = props.host || '127.0.0.1';
this.port = props.port || 21000;
this.resultType = props.resultType || null;
this.timeout = props.timeout || 1... | javascript | {
"resource": ""
} |
q55877 | mkdir_p | train | function mkdir_p (path, mode, callback, position) {
var parts = require('path').normalize(path).split(osSep);
mode = mode || process.umask();
position = position || 0;
if (position >= parts.length) {
return callback();
}
var directory = parts.slice(0, position + 1).join(osSep) || os... | javascript | {
"resource": ""
} |
q55878 | RemoteLS | train | function RemoteLS (opts) {
var _this = this
_.extend(this, {
logger: console,
development: true, // include dev dependencies.
optional: true, // include optional dependencies.
peer: false, // include peer dependencies.
verbose: false,
registry: require('registry-url')(), // URL of registry ... | javascript | {
"resource": ""
} |
q55879 | _fnAddColumn | train | function _fnAddColumn( oSettings, nTh )
{
var oDefaults = DataTable.defaults.columns;
var iCol = oSettings.aoColumns.length;
var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, {
"sSortingClass": oSettings.oClasses.sSortable,
"sSortingClassJUI": oSettings.oClasses.sSortJUI,
"nTh": nTh ?... | javascript | {
"resource": ""
} |
q55880 | _fnVisbleColumns | train | function _fnVisbleColumns( oS )
{
var iVis = 0;
for ( var i=0 ; i<oS.aoColumns.length ; i++ )
{
if ( oS.aoColumns[i].bVisible === true )
{
iVis++;
}
}
return iVis;
} | javascript | {
"resource": ""
} |
q55881 | _fnDetectType | train | function _fnDetectType( sData )
{
var aTypes = DataTable.ext.aTypes;
var iLen = aTypes.length;
for ( var i=0 ; i<iLen ; i++ )
{
var sType = aTypes[i]( sData );
if ( sType !== null )
{
return sType;
}
}
return 'string';
} | javascript | {
"resource": ""
} |
q55882 | _fnReOrderIndex | train | function _fnReOrderIndex ( oSettings, sColumns )
{
var aColumns = sColumns.split(',');
var aiReturn = [];
for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
for ( var j=0 ; j<iLen ; j++ )
{
if ( oSettings.aoColumns[i].sName == aColumns[j] )
{
aiReturn.push( j );
... | javascript | {
"resource": ""
} |
q55883 | _fnColumnOrdering | train | function _fnColumnOrdering ( oSettings )
{
var sNames = '';
for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
sNames += oSettings.aoColumns[i].sName+',';
}
if ( sNames.length == iLen )
{
return "";
}
return sNames.slice(0, -1);
} | javascript | {
"resource": ""
} |
q55884 | _fnGetRowData | train | function _fnGetRowData( oSettings, iRow, sSpecific )
{
var out = [];
for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
out.push( _fnGetCellData( oSettings, iRow, i, sSpecific ) );
}
return out;
} | javascript | {
"resource": ""
} |
q55885 | _fnSetCellData | train | function _fnSetCellData( oSettings, iRow, iCol, val )
{
var oCol = oSettings.aoColumns[iCol];
var oData = oSettings.aoData[iRow]._aData;
oCol.fnSetData( oData, val );
} | javascript | {
"resource": ""
} |
q55886 | _fnGetDataMaster | train | function _fnGetDataMaster ( oSettings )
{
var aData = [];
var iLen = oSettings.aoData.length;
for ( var i=0 ; i<iLen; i++ )
{
aData.push( oSettings.aoData[i]._aData );
}
return aData;
} | javascript | {
"resource": ""
} |
q55887 | _fnGetUniqueThs | train | function _fnGetUniqueThs ( oSettings, nHeader, aLayout )
{
var aReturn = [];
if ( !aLayout )
{
aLayout = oSettings.aoHeader;
if ( nHeader )
{
aLayout = [];
_fnDetectHeader( aLayout, nHeader );
}
}
for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ )
{
for ( var j=0, j... | javascript | {
"resource": ""
} |
q55888 | _fnBuildSearchArray | train | function _fnBuildSearchArray ( oSettings, iMaster )
{
if ( !oSettings.oFeatures.bServerSide )
{
/* Clear out the old data */
oSettings.asDataSearch.splice( 0, oSettings.asDataSearch.length );
var aArray = (iMaster && iMaster===1) ?
oSettings.aiDisplayMaster : oSettings.aiDisplay;
... | javascript | {
"resource": ""
} |
q55889 | _fnBuildSearchRow | train | function _fnBuildSearchRow( oSettings, aData )
{
var sSearch = '';
if ( oSettings.__nTmpFilter === undefined )
{
oSettings.__nTmpFilter = document.createElement('div');
}
var nTmp = oSettings.__nTmpFilter;
for ( var j=0, jLen=oSettings.aoColumns.length ; j<jLen ; j++ )
{
if ( oSetting... | javascript | {
"resource": ""
} |
q55890 | _fnDataToSearch | train | function _fnDataToSearch ( sData, sType )
{
if ( typeof DataTable.ext.ofnSearch[sType] === "function" )
{
return DataTable.ext.ofnSearch[sType]( sData );
}
else if ( sData === null )
{
return '';
}
else if ( sType == "html" )
{
return sData.replace(/[\r\n]/g," ").replace( /<.*?>/g,... | javascript | {
"resource": ""
} |
q55891 | _fnEscapeRegex | train | function _fnEscapeRegex ( sVal )
{
var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^' ];
var reReplace = new RegExp( '(\\' + acEscape.join('|\\') + ')', 'g' );
return sVal.replace(reReplace, '\\$1');
} | javascript | {
"resource": ""
} |
q55892 | _fnCalculateEnd | train | function _fnCalculateEnd( oSettings )
{
if ( oSettings.oFeatures.bPaginate === false )
{
oSettings._iDisplayEnd = oSettings.aiDisplay.length;
}
else
{
/* Set the end point of the display - based on how many elements there are
* still to display
*/
if ( oSettings._iDisplayStart + o... | javascript | {
"resource": ""
} |
q55893 | _fnScrollingWidthAdjust | train | function _fnScrollingWidthAdjust ( oSettings, n )
{
if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "" )
{
/* When y-scrolling only, we want to remove the width of the scroll bar so the table
* + scroll bar will fit into the area avaialble.
*/
var iOrigWidth = $(n).width();
n.... | javascript | {
"resource": ""
} |
q55894 | _fnSaveState | train | function _fnSaveState ( oSettings )
{
if ( !oSettings.oFeatures.bStateSave || oSettings.bDestroying )
{
return;
}
/* Store the interesting variables */
var i, iLen, bInfinite=oSettings.oScroll.bInfinite;
var oState = {
"iCreate": new Date().getTime(),
"iStart": (bInfinite ?... | javascript | {
"resource": ""
} |
q55895 | _fnLoadState | train | function _fnLoadState ( oSettings, oInit )
{
if ( !oSettings.oFeatures.bStateSave )
{
return;
}
var oData = oSettings.fnStateLoad.call( oSettings.oInstance, oSettings );
if ( !oData )
{
return;
}
/* Allow custom and plug-in manipulation functions to alter the saved data set and
... | javascript | {
"resource": ""
} |
q55896 | _fnCreateCookie | train | function _fnCreateCookie ( sName, sValue, iSecs, sBaseName, fnCallback )
{
var date = new Date();
date.setTime( date.getTime()+(iSecs*1000) );
/*
* Shocking but true - it would appear IE has major issues with having the path not having
* a trailing slash on it. We need the cookie to be available... | javascript | {
"resource": ""
} |
q55897 | _fnReadCookie | train | function _fnReadCookie ( sName )
{
var
aParts = window.location.pathname.split('/'),
sNameEQ = sName + '_' + aParts[aParts.length-1].replace(/[\/:]/g,"").toLowerCase() + '=',
sCookieContents = document.cookie.split(';');
for( var i=0 ; i<sCookieContents.length ; i++ )
{
var c = sCookieCo... | javascript | {
"resource": ""
} |
q55898 | _fnGetTrNodes | train | function _fnGetTrNodes ( oSettings )
{
var aNodes = [];
var aoData = oSettings.aoData;
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].nTr !== null )
{
aNodes.push( aoData[i].nTr );
}
}
return aNodes;
} | javascript | {
"resource": ""
} |
q55899 | _fnGetTdNodes | train | function _fnGetTdNodes ( oSettings, iIndividualRow )
{
var anReturn = [];
var iCorrector;
var anTds;
var iRow, iRows=oSettings.aoData.length,
iColumn, iColumns, oData, sNodeName, iStart=0, iEnd=iRows;
/* Allow the collection to be limited to just one row */
if ( iIndividualRow !== undefined ... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.