_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q57900 | checkClass | train | function checkClass(target) {
/*jshint validthis:true*/
var key,
value;
// Check normal functions
for (key in this[$interface].methods) {
value = this[$interface].methods[key];
if (!target[$class].methods[key]) {
throw new Error('Clas... | javascript | {
"resource": ""
} |
q57901 | assignConstant | train | function assignConstant(name, value, interf) {
if (hasDefineProperty) {
Object.defineProperty(interf, name, {
get: function () {
return value;
},
set: function () {
throw new Error('Cannot change value of constan... | javascript | {
"resource": ""
} |
q57902 | addConstant | train | function addConstant(name, value, interf) {
var target;
// Check if it is public
if (name.charAt(0) === '_') {
throw new Error('Interface "' + interf.prototype.$name + '" contains an unallowed non public method: "' + name + '".');
}
// Check if it is a primitive valu... | javascript | {
"resource": ""
} |
q57903 | parseCookies | train | function parseCookies(req, res, next) {
var self = this;
var cookieHeader = req.headers.cookie;
if (cookieHeader) {
req.cookies = cookie.parse(cookieHeader);
} else {
req.cookies = {};
}
/**
* Add a cookie to our response. Uses a Set-Cookie header
* per cookie added.
*
* @param {String... | javascript | {
"resource": ""
} |
q57904 | reportManualError | train | function reportManualError(err, request, additionalMessage, callback) {
if (isString(request)) {
// no request given
callback = additionalMessage;
additionalMessage = request;
request = undefined;
} else if (isFunction(request)) {
// neither request nor additionalMessage given
... | javascript | {
"resource": ""
} |
q57905 | isImmutable | train | function isImmutable(value) {
return value == null || isBoolean(value) || isNumber(value) || isString(value);
} | javascript | {
"resource": ""
} |
q57906 | mixIn | train | function mixIn(target, objects){
var i = 0,
n = arguments.length,
obj;
while(++i < n){
obj = arguments[i];
if (obj != null) {
forOwn(obj, copyProp, target);
}
}
return target;
} | javascript | {
"resource": ""
} |
q57907 | indexOf | train | function indexOf(arr, item, fromIndex) {
fromIndex = fromIndex || 0;
if (arr == null) {
return -1;
}
var len = arr.length,
i = fromIndex < 0 ? len + fromIndex : fromIndex;
while (i < len) {
// we iterate over sparse items since there is no way... | javascript | {
"resource": ""
} |
q57908 | combine | train | function combine(arr1, arr2) {
if (arr2 == null) {
return arr1;
}
var i = -1, len = arr2.length;
while (++i < len) {
if (indexOf(arr1, arr2[i]) === -1) {
arr1.push(arr2[i]);
}
}
return arr1;
} | javascript | {
"resource": ""
} |
q57909 | clone | train | function clone(val){
switch (kindOf(val)) {
case 'Object':
return cloneObject(val);
case 'Array':
return cloneArray(val);
case 'RegExp':
return cloneRegExp(val);
case 'Date':
return cloneDate(val);
... | javascript | {
"resource": ""
} |
q57910 | deepClone | train | function deepClone(val, instanceClone) {
switch ( kindOf(val) ) {
case 'Object':
return cloneObject(val, instanceClone);
case 'Array':
return cloneArray(val, instanceClone);
default:
return clone(val);
}
} | javascript | {
"resource": ""
} |
q57911 | append | train | function append(arr1, arr2) {
if (arr2 == null) {
return arr1;
}
var pad = arr1.length,
i = -1,
len = arr2.length;
while (++i < len) {
arr1[pad + i] = arr2[i];
}
return arr1;
} | javascript | {
"resource": ""
} |
q57912 | bind | train | function bind(fn, context, args){
var argsArr = slice(arguments, 2); //curried args
return function(){
return fn.apply(context, argsArr.concat(slice(arguments)));
};
} | javascript | {
"resource": ""
} |
q57913 | toArray | train | function toArray(val){
var ret = [],
kind = kindOf(val),
n;
if (val != null) {
if ( val.length == null || kind === 'String' || kind === 'Function' || kind === 'RegExp' || val === _win ) {
//string, regexp, function have .length but user probably just ... | javascript | {
"resource": ""
} |
q57914 | deepMatches | train | function deepMatches(target, pattern){
if (target && typeof target === 'object') {
if (isArray(target) && isArray(pattern)) {
return matchArray(target, pattern);
} else {
return matchObject(target, pattern);
}
} else {
retur... | javascript | {
"resource": ""
} |
q57915 | difference | train | function difference(arr) {
var arrs = slice(arguments, 1),
result = filter(unique(arr), function(needle){
return !some(arrs, function(haystack){
return contains(haystack, needle);
});
});
return result;
} | javascript | {
"resource": ""
} |
q57916 | insert | train | function insert(arr, rest_items) {
var diff = difference(slice(arguments, 1), arr);
if (diff.length) {
Array.prototype.push.apply(arr, diff);
}
return arr.length;
} | javascript | {
"resource": ""
} |
q57917 | interfaceDescendantOf | train | function interfaceDescendantOf(interf1, interf2) {
var x,
parents = interf1[$interface].parents;
for (x = parents.length - 1; x >= 0; x -= 1) {
if (parents[x] === interf2) {
return true;
}
if (interfaceDescendantOf(interf1, parents[x])) {
... | javascript | {
"resource": ""
} |
q57918 | instanceOfInterface | train | function instanceOfInterface(instance, target) {
var x,
interfaces = instance.$static[$class].interfaces;
for (x = interfaces.length - 1; x >= 0; x -= 1) {
if (interfaces[x] === target || interfaceDescendantOf(interfaces[x], target)) {
return true;
}
... | javascript | {
"resource": ""
} |
q57919 | instanceOf | train | function instanceOf(instance, target) {
if (!isFunction(target)) {
return false;
}
if (instance instanceof target) {
return true;
}
if (instance && instance.$static && instance.$static[$class] && target && target[$interface]) {
return instanc... | javascript | {
"resource": ""
} |
q57920 | functionMeta | train | function functionMeta(func, name) {
var matches = /^function(\s+[a-zA-Z0-9_\$]*)*\s*\(([^\(]*)\)/m.exec(func.toString()),
ret,
split,
optionalReached = false,
length,
x;
// Analyze arguments
if (!matches) {
return null;
... | javascript | {
"resource": ""
} |
q57921 | handleErrorClassError | train | function handleErrorClassError(err, errorMessage) {
if (err instanceof Error) {
extractFromErrorClass(err, errorMessage);
} else {
handleUnknownAsError(err, errorMessage);
}
} | javascript | {
"resource": ""
} |
q57922 | hapiErrorHandler | train | function hapiErrorHandler(req, err, config) {
var service = '';
var version = '';
if (isObject(config)) {
service = config.getServiceContext().service;
version = config.getServiceContext().version;
}
var em = new ErrorMessage()
.consumeRequestInformation(hapiRequestInformationExtracto... | javascript | {
"resource": ""
} |
q57923 | makeHapiPlugin | train | function makeHapiPlugin(client, config) {
/**
* The register function serves to attach the hapiErrorHandler to specific
* points in the hapi request-response lifecycle. Namely: it attaches to the
* 'request-error' event in Hapi which is emitted when a plugin or receiver
* throws an error while executing ... | javascript | {
"resource": ""
} |
q57924 | extractFromErrorClass | train | function extractFromErrorClass(err, errorMessage) {
errorMessage.setMessage(err.stack);
if (has(err, 'user')) {
errorMessage.setUser(err.user);
}
if (has(err, 'serviceContext') && isObject(err.serviceContext)) {
errorMessage.setServiceContext(err.serviceContext.service,
... | javascript | {
"resource": ""
} |
q57925 | ErrorMessage | train | function ErrorMessage() {
this.eventTime = (new Date()).toISOString();
this.serviceContext = {service : 'node', version : undefined};
this.message = '';
this.context = {
httpRequest : {
method : '',
url : '',
userAgent : '',
referrer : '',
responseStatusCode : 0,
remoteI... | javascript | {
"resource": ""
} |
q57926 | handleObjectAsError | train | function handleObjectAsError(err, errorMessage) {
if (isPlainObject(err)) {
extractFromObject(err, errorMessage);
} else {
handleUnknownAsError(err, errorMessage);
}
} | javascript | {
"resource": ""
} |
q57927 | extractStructuredCallList | train | function extractStructuredCallList(structuredStackTrace) {
/**
* A function which walks the structuredStackTrace variable of its parent
* and produces a JSON representation of the array of CallSites.
* @function
* @inner
* @returns {String} - A JSON representation of the array of CallSites
*/
re... | javascript | {
"resource": ""
} |
q57928 | prepareStackTraceError | train | function prepareStackTraceError(err, structuredStackTrace) {
var returnObj = new CustomStackTrace();
var topFrame = {};
if (!Array.isArray(structuredStackTrace)) {
return returnObj;
}
// Get the topframe of the CallSite array
topFrame = structuredStackTrace[0];
returnObj.setFilePath(topFrame.getFil... | javascript | {
"resource": ""
} |
q57929 | intersection | train | function intersection(arr) {
var arrs = slice(arguments, 1),
result = filter(unique(arr), function(needle){
return every(arrs, function(haystack){
return contains(haystack, needle);
});
});
return result;
} | javascript | {
"resource": ""
} |
q57930 | randomAccessor | train | function randomAccessor(caller) {
if (nrAccesses > nrAllowed || !contains(allowed, caller)) {
throw new Error('Can\'t access random identifier.');
}
nrAccesses += 1;
return random;
} | javascript | {
"resource": ""
} |
q57931 | fetchCache | train | function fetchCache(target, cache) {
var x,
length = cache.length,
curr;
for (x = 0; x < length; x += 1) {
curr = cache[x];
if (curr.target === target) {
return curr.inspect;
}
}
return null;
} | javascript | {
"resource": ""
} |
q57932 | inspectInstance | train | function inspectInstance(target, cache) {
// If browser has no define property it means it is too old and
// in that case we return the target itself.
// This could be improved but I think it does not worth the trouble
if (!hasDefineProperty) {
return target;
}
... | javascript | {
"resource": ""
} |
q57933 | inspectConstructor | train | function inspectConstructor(target, cache) {
// If browser has no define property it means it is too old and
// in that case we return the target itself.
// This could be improved but I think it does not worth the trouble
if (!hasDefineProperty) {
return target;
}
... | javascript | {
"resource": ""
} |
q57934 | protectInstance | train | function protectInstance(instance) {
var key;
obfuscateProperty(instance, cacheKeyword, { properties: {}, methods: {} });
obfuscateProperty(instance, redefinedCacheKeyword, { properties: {}, methods: {} }); // This is for the inspect
for (key in instance.$static[$class].methods) {
... | javascript | {
"resource": ""
} |
q57935 | protectConstructor | train | function protectConstructor(constructor) {
var key,
target,
meta,
prototype = constructor.prototype;
obfuscateProperty(constructor, cacheKeyword, { properties: {}, methods: {} });
for (key in constructor[$class].staticMethods) {
protectStaticMeth... | javascript | {
"resource": ""
} |
q57936 | parseAbstracts | train | function parseAbstracts(abstracts, constructor) {
var optsStatic = { isStatic: true },
key,
value,
unallowed;
// Check argument
if (!isObject(abstracts)) {
throw new Error('$abstracts defined in abstract class "' + constructor.prototype.$name + '"... | javascript | {
"resource": ""
} |
q57937 | parseInterfaces | train | function parseInterfaces(interfaces, constructor) {
var interfs = toArray(interfaces),
x = interfs.length,
interf,
key,
value;
for (x -= 1; x >= 0; x -= 1) {
interf = interfs[x];
// Grab methods
for (key in interf[$int... | javascript | {
"resource": ""
} |
q57938 | createFinalClass | train | function createFinalClass(params, constructor) {
var def = Class.$create(params, constructor);
def[$class].finalClass = true;
return def;
} | javascript | {
"resource": ""
} |
q57939 | makeExpressHandler | train | function makeExpressHandler(client, config) {
/**
* The Express Error Handler function is an interface for the error handler
* stack into the Express architecture.
* @function expressErrorHandler
* @param {Any} err - a error of some type propagated by the express plugin
* stack
* @param {Object} re... | javascript | {
"resource": ""
} |
q57940 | manualRequestInformationExtractor | train | function manualRequestInformationExtractor(req) {
var returnObject = new RequestInformationContainer();
if (!isObject(req) || isArray(req) || isFunction(req)) {
return returnObject;
}
if (has(req, 'method')) {
returnObject.setMethod(req.method);
}
if (has(req, 'url')) {
returnObject.setUr... | javascript | {
"resource": ""
} |
q57941 | train | function(givenConfig, logger) {
/**
* The _logger property caches the logger instance created at the top-level
* for configuration logging purposes.
* @memberof Configuration
* @private
* @type {Object}
* @defaultvalue Object
*/
this._logger = logger;
/**
* The _reportUncaughtExceptions pr... | javascript | {
"resource": ""
} | |
q57942 | restifyErrorHandler | train | function restifyErrorHandler(client, config, err, em) {
var svc = config.getServiceContext();
em.setServiceContext(svc.service, svc.version);
errorHandlerRouter(err, em);
client.sendError(em);
} | javascript | {
"resource": ""
} |
q57943 | restifyRequestFinishHandler | train | function restifyRequestFinishHandler(client, config, req, res) {
var em;
if (res._body instanceof Error ||
res.statusCode > 309 && res.statusCode < 512) {
em = new ErrorMessage().consumeRequestInformation(
expressRequestInformationExtractor(req, res));
restifyErrorHandler(client, config, res... | javascript | {
"resource": ""
} |
q57944 | restifyRequestHandler | train | function restifyRequestHandler(client, config, req, res, next) {
var listener = {};
if (isObject(res) && isFunction(res.on) && isFunction(res.removeListener)) {
listener = function() {
restifyRequestFinishHandler(client, config, req, res);
res.removeListener('finish', listener);
};
res.o... | javascript | {
"resource": ""
} |
q57945 | extractRemoteAddressFromRequest | train | function extractRemoteAddressFromRequest(req) {
if (typeof req.header('x-forwarded-for') !== 'undefined') {
return req.header('x-forwarded-for');
} else if (isObject(req.connection)) {
return req.connection.remoteAddress;
}
return '';
} | javascript | {
"resource": ""
} |
q57946 | expressRequestInformationExtractor | train | function expressRequestInformationExtractor(req, res) {
var returnObject = new RequestInformationContainer();
if (!isObject(req) || !isFunction(req.header) || !isObject(res)) {
return returnObject;
}
returnObject.setMethod(req.method)
.setUrl(req.url)
.setUserAgent(req.header('user-agent'))
... | javascript | {
"resource": ""
} |
q57947 | handleNumberAsError | train | function handleNumberAsError(err, errorMessage) {
var fauxError = new Error();
var errChecked = fauxError.stack;
if (isNumber(err) && isFunction(err.toString)) {
errChecked = err.toString();
}
errorMessage.setMessage(errChecked);
} | javascript | {
"resource": ""
} |
q57948 | _msb | train | function _msb(word) {
word |= word >> 1;
word |= word >> 2;
word |= word >> 4;
word |= word >> 8;
word |= word >> 16;
word = (word >> 1) + 1;
return multiplyDeBruijnBitPosition[(word * 0x077CB531) >>> 27];
} | javascript | {
"resource": ""
} |
q57949 | doMember | train | function doMember(func) {
/*jshint validthis:true*/
func = func || this;
// Check if it is a named func already
if (func[$name]) {
return func;
}
var caller = process._dejavu.caller;
// Check if outside the instance/class
if (!caller) {
... | javascript | {
"resource": ""
} |
q57950 | errorHandlerRouter | train | function errorHandlerRouter(err, em) {
if (err instanceof Error) {
handleErrorClassError(err, em);
return;
}
switch (typeof err) {
case 'object':
handleObjectAsError(err, em);
break;
case 'string':
handleStringAsError(err, em);
break;
case 'number':
handleNumberAsError(err... | javascript | {
"resource": ""
} |
q57951 | handleStringAsError | train | function handleStringAsError(err, errorMessage) {
var fauxError = new Error();
var fullStack = fauxError.stack.split('\n');
var cleanedStack = fullStack.slice(0, 1).concat(fullStack.slice(4));
var errChecked = '';
if (isString(err)) {
// Replace the generic error message with the user-provided string
... | javascript | {
"resource": ""
} |
q57952 | RequestHandler | train | function RequestHandler(config, logger) {
this._request = commonDiag.utils.authorizedRequestFactory(SCOPES, {
keyFile: config.getKeyFilename(),
credentials: config.getCredentials()
});
this._config = config;
this._logger = logger;
} | javascript | {
"resource": ""
} |
q57953 | getErrorReportURL | train | function getErrorReportURL(projectId, key) {
var url = [API, projectId, 'events:report'].join('/');
if (isString(key)) {
url += '?key=' + key;
}
return url;
} | javascript | {
"resource": ""
} |
q57954 | handlerSetup | train | function handlerSetup(client, config) {
/**
* The actual exception handler creates a new instance of `ErrorMessage`,
* extracts infomation from the propagated `Error` and marshals it into the
* `ErrorMessage` instance, attempts to send this `ErrorMessage` instance to
* the Stackdriver Error Reporting API.... | javascript | {
"resource": ""
} |
q57955 | uncaughtExceptionHandler | train | function uncaughtExceptionHandler(err) {
var em = new ErrorMessage();
errorHandlerRouter(err, em);
client.sendError(em, handleProcessExit);
setTimeout(handleProcessExit, 2000);
} | javascript | {
"resource": ""
} |
q57956 | get | train | function get (key, def) {
if (Array.isArray(key)) {
return AsyncStorage.multiGet(key)
.then((values) => values.map(([_, value]) => {
return useDefault(def, value) ? def : parse(value)
}))
.then(results => Promise.all(results))
}
return AsyncStorage.getItem(key).then(value => useDefa... | javascript | {
"resource": ""
} |
q57957 | set | train | function set (key, value) {
if (Array.isArray(key)) {
const items = key.map(([key, value]) => [key, JSON.stringify(value)])
return AsyncStorage.multiSet(items)
}
return AsyncStorage.setItem(key, JSON.stringify(value))
} | javascript | {
"resource": ""
} |
q57958 | update | train | function update (key, value) {
if (Array.isArray(key)) {
return AsyncStorage.multiMerge(key.map(([key, val]) => [key, JSON.stringify(val)]))
}
return AsyncStorage.mergeItem(key, JSON.stringify(value))
} | javascript | {
"resource": ""
} |
q57959 | transformResponse | train | function transformResponse(value, options, context) {
if (options.transform === true) {
assert.func(context.transform, 'context.transform')
return context.transform(value)
}
return value
} | javascript | {
"resource": ""
} |
q57960 | publish | train | async function publish(props) {
const message = getData(props)
return createClient()
.post('/publish/', {
json: true,
body: message
})
} | javascript | {
"resource": ""
} |
q57961 | train | function (records, cb) {
// loop through each record
async.each(records, function (record, recordDone) {
// loop through each field
async.each(Object.keys(req.linz.configList.fields), function (field, fieldDone) {
req.lin... | javascript | {
"resource": ""
} | |
q57962 | grid | train | function grid (data, callback) {
linz.app.render(linz.api.views.viewPath('modelIndex/grid.jade'), data, (err, html) => {
if (err) {
return callback(err);
}
return callback(null, html);
});
} | javascript | {
"resource": ""
} |
q57963 | train | function (cb) {
let actions = req.linz.model.linz.formtools.overview.actions;
if (!actions.length) {
return cb(null);
}
parseDisabledProperties(req.linz.record, actions)
.then((parsedAction... | javascript | {
"resource": ""
} | |
q57964 | train | function (cb) {
let footerActions = req.linz.model.linz.formtools.overview.footerActions;
if (!footerActions.length) {
return cb();
}
parseDisabledProperties(req.linz.record, footerActions)
... | javascript | {
"resource": ""
} | |
q57965 | createResponseHandler | train | function createResponseHandler(fn, key, context) {
// Assert.func(fn,'createResponseHandler:fn')
return function (props) {
const param = key ? props[key] : props
print(fn(param), props, context)
}
} | javascript | {
"resource": ""
} |
q57966 | get | train | function get (configName, copy) {
if (copy) {
return clone(linz.get('configs')[configName]);
}
return linz.get('configs')[configName];
} | javascript | {
"resource": ""
} |
q57967 | permissions | train | function permissions (user, configName, callback) {
return get(configName).schema.statics.getPermissions(user, callback);
} | javascript | {
"resource": ""
} |
q57968 | form | train | function form (req, configName, callback) {
return get(configName).schema.statics.getForm(req, callback);
} | javascript | {
"resource": ""
} |
q57969 | overview | train | function overview (req, configName, callback) {
return get(configName).schema.statics.getOverview(req, callback);
} | javascript | {
"resource": ""
} |
q57970 | labels | train | function labels (configName, callback) {
if (callback) {
return get(configName).schema.statics.getLabels(callback);
}
return get(configName).schema.statics.getLabels();
} | javascript | {
"resource": ""
} |
q57971 | handleQueryError | train | function handleQueryError (err) {
queryErrorCount++;
// Something has gone terribly wrong. Break from loop.
if (queryErrorCount > 1) {
// Reset all filters.
session.list.formData = {};
// Notify the user that an error has occured.
req.linz.noti... | javascript | {
"resource": ""
} |
q57972 | train | function (cb) {
formtoolsAPI.list.renderToolbarItems(req, res, req.params.model, function (err, result) {
if (err) {
return cb(err);
}
req.linz.model.list.toolbarItems = result;
return cb(null);
... | javascript | {
"resource": ""
} | |
q57973 | train | function (cb) {
// check if we need to render the filters
if (!Object.keys(req.linz.model.list.filters).length) {
return cb(null);
}
formtoolsAPI.list.renderFilters(req, req.params.model, function (err, result) {
... | javascript | {
"resource": ""
} | |
q57974 | train | function (cb) {
const filters = req.linz.model.list.filters;
const formData = session.list.formData;
// Make sure we have some filters.
if (!filters) {
return cb(null);
}
// Find the alwaysOn filters, ... | javascript | {
"resource": ""
} | |
q57975 | train | function (cb) {
req.linz.model.list.activeFilters = {};
// check if there are any filters in the form post
if (!session.list.formData.selectedFilters) {
return cb(null);
}
formtoolsAPI.list.getActiveFilters(req, sessi... | javascript | {
"resource": ""
} | |
q57976 | train | function (cb) {
// check if there are any filters in the form post
if (!session.list.formData.selectedFilters) {
return cb(null);
}
formtoolsAPI.list.renderSearchFilters(req, session.list.formData.selectedFilters.split(','), session.l... | javascript | {
"resource": ""
} | |
q57977 | train | function (cb) {
if (!session.list.formData.search || !session.list.formData.search.length || !req.linz.model.list.search || !Array.isArray(req.linz.model.list.search)) {
return cb(null);
}
// Default the `$and` key.
if (!filters.$and)... | javascript | {
"resource": ""
} | |
q57978 | train | function (cb) {
req.linz.model.getQuery(req, filters, function (err, result) {
if (err) {
return cb(err);
}
query = result;
return cb(null);
});
} | javascript | {
"resource": ""
} | |
q57979 | train | function (cb) {
let fields = Object.keys(req.linz.model.list.fields);
// Work in the title field
linz.api.model.titleField(req.params.model, 'title', (err, titleField) => {
if (err) {
return cb(err);
}
... | javascript | {
"resource": ""
} | |
q57980 | train | function (cb) {
req.linz.model.getCount(req, query, function (err, countQuery) {
if (err) {
return cb(err);
}
countQuery.exec(function (countQueryErr, count) {
// A query error has occured, le... | javascript | {
"resource": ""
} | |
q57981 | train | function (cb) {
const getDefaultOrder = field => field.defaultOrder.toLowerCase() === 'desc' ? '-' : '';
if (!session.list.formData.sort && req.linz.model.list.sortBy.length) {
req.linz.model.list.sortingBy = req.linz.model.list.sortBy[0];
// s... | javascript | {
"resource": ""
} | |
q57982 | train | function (cb) {
// skip this if canEdit is not define for model
if (!mongooseRecords[0].canEdit) {
return cb(null);
}
async.each(Object.keys(mongooseRecords), function (index, recordDone) {
mongooseRecords[index].... | javascript | {
"resource": ""
} | |
q57983 | train | function (cb) {
// loop through each record
async.each(Object.keys(records), function (index, recordDone) {
// store the rendered content into a separate property
records[index]['rendered'] = {};
// loop through each field
... | javascript | {
"resource": ""
} | |
q57984 | train | function (cb) {
if (!req.linz.model.list.recordActions.length) {
return cb(null);
}
async.each(req.linz.model.list.recordActions, function (action, actionDone) {
if (!action.disabled) {
return actionDone(n... | javascript | {
"resource": ""
} | |
q57985 | train | function() {
this.$button = $(this.options.templates.button).addClass(this.options.buttonClass);
// Adopt active state.
if (this.$select.prop('disabled')) {
this.disable();
}
else {
this.enable();
}
// ... | javascript | {
"resource": ""
} | |
q57986 | train | function() {
// Build ul.
this.$ul = $(this.options.templates.ul);
if (this.options.dropRight) {
this.$ul.addClass('pull-right');
}
// Set max height of dropdown menu to activate auto scrollbar.
if (this.options.maxHeight) {
... | javascript | {
"resource": ""
} | |
q57987 | train | function(group) {
var groupName = $(group).prop('label');
// Add a header for the group.
var $li = $(this.options.templates.liGroup);
$('label', $li).text(groupName);
this.$ul.append($li);
if ($(group).is(':disabled')) {
$li.addC... | javascript | {
"resource": ""
} | |
q57988 | train | function() {
var alreadyHasSelectAll = this.hasSelectAll();
if (!alreadyHasSelectAll && this.options.includeSelectAllOption && this.options.multiple
&& $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) {
// Check whether to add a di... | javascript | {
"resource": ""
} | |
q57989 | train | function() {
$('option', this.$select).each($.proxy(function(index, element) {
var $input = $('li input', this.$ul).filter(function() {
return $(this).val() === $(element).val();
});
if ($(element).is(':selected')) {
$i... | javascript | {
"resource": ""
} | |
q57990 | train | function() {
this.$ul.html('');
// Important to distinguish between radios and checkboxes.
this.options.multiple = this.$select.attr('multiple') === "multiple";
this.buildSelectAll();
this.buildDropdownOptions();
this.buildFilter();
... | javascript | {
"resource": ""
} | |
q57991 | train | function (value) {
var options = $('option', this.$select);
var valueToCompare = value.toString();
for (var i = 0; i < options.length; i = i + 1) {
var option = options[i];
if (option.value === valueToCompare) {
return $(option);
... | javascript | {
"resource": ""
} | |
q57992 | hasLegacy | train | function hasLegacy (hashes) {
var ary = Object.keys(hashes).filter(function (k) {
return hashes[k] < 0
})
if(ary.length)
peer.blobs.has(ary, function (err, haves) {
if(err) drain.abort(err) //ERROR: abort this stream.
else haves.forEach(function (have, i) {
... | javascript | {
"resource": ""
} |
q57993 | train | function (exports) {
var exp = undefined;
// retrieve the export object
exports.forEach(function (_export) {
// Linz's default export function is called export
if (_export.action && _export.action === 'export') {
exp = _export;
}
});
// if the export object c... | javascript | {
"resource": ""
} | |
q57994 | train | function (cb) {
model.VersionedModel.find({ refId: record._id }, 'dateCreated modifiedBy', { lean: 1, sort: { dateCreated: -1 } }, function (err, result) {
return cb(err, result);
});
} | javascript | {
"resource": ""
} | |
q57995 | hasPermission | train | function hasPermission (user, context, permission, cb) {
var _context = context;
/**
* Support three types of permissions:
* - navigation
* - models and model
* - configs and config
*
* Context can either be an object, or a string. If context is a string, no other data need be passe... | javascript | {
"resource": ""
} |
q57996 | addLoadEvent | train | function addLoadEvent (func) {
if (window.attachEvent) {
return window.attachEvent('onload', func);
}
if (window.addEventListener) {
return window.addEventListener('load', func, false);
}
return document.addEventListener('load', func, false);
} | javascript | {
"resource": ""
} |
q57997 | transform | train | async function transform({ datapath, filepath, inverse = false }) {
assert.string(datapath)
assert.string(filepath)
const data = await loadData(datapath)
const contextdoc = await loadData(filepath)
assert.object(data)
assert.object(contextdoc)
const result = new Context(contextdoc).use(viewPlugin).map(data)
ret... | javascript | {
"resource": ""
} |
q57998 | renderFilters | train | function renderFilters (req, modelName, cb) {
if (!req) {
throw new Error('req is required.');
}
if (typeof modelName !== 'string' || !modelName.length) {
throw new Error('modelName is required and must be of type String and cannot be empty.');
}
linz.api.model.list(req, modelName... | javascript | {
"resource": ""
} |
q57999 | renderSearchFilters | train | function renderSearchFilters(req, fieldNames, data, modelName, cb) {
if (!req) {
throw new Error('req is required.');
}
if (!Array.isArray(fieldNames) || !fieldNames.length) {
throw new Error('fieldNames is required and must be of type Array and cannot be empty.');
}
if (typeof mo... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.