_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q60800 | atomSerialize | validation | function atomSerialize () {
var options = {isUnloading: true}
if (atom.serialize != null) return atom.serialize(options)
// Atom <= 1.6
return {
version: atom.constructor.version,
project: atom.project.serialize(options),
workspace: atom.workspace.serialize(),
packageStates: packageStatesSerial... | javascript | {
"resource": ""
} |
q60801 | splitUnique | validation | function splitUnique (string) {
string = string && string.trim();
if (string) {
return unique(string.split(/\s+/));
} else {
return undefined;
}
} | javascript | {
"resource": ""
} |
q60802 | walkNodes | validation | function walkNodes ($nodes, currentItem) {
$nodes.each(function (i, node) {
var $node = $(node);
var props = splitUnique($node.attr('itemprop'));
if (props && currentItem) {
var value = null;
if ($node.is('[itemscope]')) {
value = parseItem(node, currentItem);
} ... | javascript | {
"resource": ""
} |
q60803 | parseItem | validation | function parseItem (node, currentItem) {
// REMARK: note the raw dom node instead of $node to guarantee uniqueness
if (currentItem && currentItem.hasMemoryOf(node)) {
return Item.ERROR;
}
var $node = $(node);
var type = splitUnique($node.attr('itemtype'));
type = type && type.filter(isAbs... | javascript | {
"resource": ""
} |
q60804 | resolveUrlAttribute | validation | function resolveUrlAttribute ($node, attr) {
var url = $node.attr(attr);
if (url === undefined) return '';
if (isAbsoluteUrl(url)) {
return url;
} else {
return urlUtil.resolve(base, url);
}
} | javascript | {
"resource": ""
} |
q60805 | parsePropertyValue | validation | function parsePropertyValue (node) {
var $node = $(node);
if ($node.is('meta')) {
return resolveAttribute($node, 'content');
} else if ($node.is('audio,embed,iframe,img,source,track,video')) {
return resolveUrlAttribute($node, 'src');
} else if ($node.is('a,area,link')) {
return resol... | javascript | {
"resource": ""
} |
q60806 | processPatterns | validation | function processPatterns(patterns, fn) {
// Filepaths to return.
var result = [];
// Iterate over flattened patterns array.
_.flattenDeep(patterns).forEach(function(pattern) {
// If the first character is ! it should be omitted
var exclusion = pattern.indexOf('!') === 0;
// If the pattern is an exc... | javascript | {
"resource": ""
} |
q60807 | sendMessage | validation | function sendMessage( args ){
last = new Date();
fs.write( tmpfile, JSON.stringify( args ) + '\n', 'a' );
// Exit when all done.
if( /^done/.test( args[0] ) ){
phantom.exit();
}
} | javascript | {
"resource": ""
} |
q60808 | validation | function( url ){
grunt.verbose.write( 'Running PhantomJS...' ).or.write( '...' );
grunt.log.error();
grunt.warn( 'PhantomJS unable to load "' + url + '" URI.', 90 );
} | javascript | {
"resource": ""
} | |
q60809 | F | validation | function F(type, term) {
let original = term;
if (term && !term.__meta) {
term = type.wrap ? type.wrap(term) : term;
term.__meta = {};
term.__name = function(name) {
term.__meta.name = name;
return term;
};
term.__desc = function(desc) {
term.__meta.desc = desc;
return te... | javascript | {
"resource": ""
} |
q60810 | validation | function (json, delimiter) {
var result = [];
var recurse = function (cur, prop) {
for (var key in cur) {
if (cur.hasOwnProperty(key)) {
var item = cur[key];
result.push({
match: prop ? prop + delimiter + key : key,
replacement: item,
expression: false
... | javascript | {
"resource": ""
} | |
q60811 | ld | validation | function ld(date, long = true, options = null) {
return Localizer.Singleton.formatDate(date, long, options)
} | javascript | {
"resource": ""
} |
q60812 | ldt | validation | function ldt(date, long = true, options = null) {
return Localizer.Singleton.formatDateTime(date, long, options)
} | javascript | {
"resource": ""
} |
q60813 | getStyle | validation | function getStyle (element, property) {
if (window.getComputedStyle) {
return getStyleProperty(element, property).original;
} else if (element.currentStyle) {
return element.currentStyle[property];
}
return null;
} | javascript | {
"resource": ""
} |
q60814 | hasChanged | validation | function hasChanged(newData, oldData) {
var changed = false
for (var i = 0; i < scope.length; i++) {
var k = scope[i],
newVal = _.get(newData, k),
oldVal = _.get(oldData, k)
if (!_.isEqual(newVal, oldVal)) {
changed = true
break
}
}
return changed
} | javascript | {
"resource": ""
} |
q60815 | validation | function(initValues, element, notCreate) {
if (element === undefined) {
if (notCreate) {
item.values(initValues, notCreate);
} else {
item.values(initValues);
}
} else {
item.elm = element;
... | javascript | {
"resource": ""
} | |
q60816 | checkUrl | validation | function checkUrl(url, method, routes){
method=method.toLowerCase();
for (var i=0; i<routes.length; i++){
var route=routes[i];
if ((matchPath(route.url,url)) && (method==route.method)) return route;
}
return false;
} | javascript | {
"resource": ""
} |
q60817 | eatBraces | validation | function eatBraces(stream, root) {
if (stream.eat(LBRACE)) {
let stack = 1, token;
while (!stream.eof()) {
if (stream.eat(RBRACE)) {
stack--;
if (!stack) {
break;
}
} else if (stream.eat(LBRACE)) {
stack++;
} else if (eatUrl(stream) || eatString(stream)) {
continue;
} else if ... | javascript | {
"resource": ""
} |
q60818 | underscore | validation | function underscore(baseQuery) {
return _.mapKeys(baseQuery, function(v, k) {
return tableColumnRenamer.underscore(k)
})
} | javascript | {
"resource": ""
} |
q60819 | filterQueryParams | validation | function filterQueryParams (baseClause, request) {
_.forEach(request.query, function(v, k) {
addWhereClause(baseClause, k, v)
})
return baseClause
} | javascript | {
"resource": ""
} |
q60820 | addWhereClause | validation | function addWhereClause(baseClause, k, v) {
if (v.startsWith('>')) {
baseClause.where(k, '>=', v.substring(1)); return
}
if (v.startsWith('<')) {
baseClause.where(k, '<=', v.substring(1)); return
}
if (v.startsWith('~')) {
baseClause.where(k, 'LIKE', v.substring(1)); return
}
if (k.endsWith('Id')) {
base... | javascript | {
"resource": ""
} |
q60821 | findByIdQueryParams | validation | function findByIdQueryParams (request, config) {
return typeof config.baseQuery === 'undefined' ? {'id': request.params.id} : _.merge({'id': request.params.id}, underscore(config.baseQuery(request)))
} | javascript | {
"resource": ""
} |
q60822 | empty | validation | function empty (entity, schema, Empty) {
if (typeof entity === 'undefined' || entity === null) {
return
}
_.forEach(schema, function(v, k) {
if (v === Empty) {
delete entity[k]
}
})
} | javascript | {
"resource": ""
} |
q60823 | initModel | validation | function initModel (config) {
if (typeof config.bookshelfModel.prototype.schema === 'undefined') {
config.bookshelfModel.prototype.schema = {}
}
addConstraintsForForeignKeys(config.bookshelfModel, config.baseQuery)
config.bookshelfModel.prototype.format = tableColumnRenamer.renameOnFormat
config.bookshelf... | javascript | {
"resource": ""
} |
q60824 | initJsonDateFormat | validation | function initJsonDateFormat (bookshelfModel) {
const schema = bookshelfModel.prototype.schema
const originalFunction = bookshelfModel.prototype.toJSON
// read from MySQL date, based on https://github.com/tgriesser/bookshelf/issues/246#issuecomment-35498066
bookshelfModel.prototype.toJSON = function () {
con... | javascript | {
"resource": ""
} |
q60825 | formatNumber | validation | function formatNumber (payload, schema) {
_.forEach(schema, function(v, k) {
if (v !== null && v._type === 'number') {
if (typeof payload[k] === 'undefined' || payload[k] === null) {
payload[k] = 0
}
}
})
} | javascript | {
"resource": ""
} |
q60826 | formatDate | validation | function formatDate (payload, schema) {
_.forEach(schema, function(v, k) {
if (v !== null && v._type === 'date') {
if (payload[k] !== null) {
payload[k] = new Date(payload[k])
}
}
})
} | javascript | {
"resource": ""
} |
q60827 | setForeignKeys | validation | function setForeignKeys (request, baseQuery) {
if (typeof baseQuery === 'undefined') {
return
}
_.forEach(baseQuery(request), function(v, k) {
request.payload[k] = request.params[k]
})
} | javascript | {
"resource": ""
} |
q60828 | transformConstraintViolationMessages | validation | function transformConstraintViolationMessages (input) {
return {
validationErrors: _.chain(input.details)
.mapKeys(function(v, k) {
// Use '.' as the key if the entire object is erroneous
return (input.details.length == 1 && input.details[0].path === 'value' && input.details[0].type === 'object... | javascript | {
"resource": ""
} |
q60829 | lazyConsForce | validation | function lazyConsForce() {
/* jshint validthis:true */
var val = this.tailFn();
/* eslint-disable no-use-before-define */
this.tailValue = Array.isArray(val) ? fromArray(val) : val;
/* eslint-enable no-use-before-define */
delete this.tail;
delete this.force;
return this;
} | javascript | {
"resource": ""
} |
q60830 | isEmptyTag | validation | function isEmptyTag(node) {
if(node.constructor === Element && !node.hasChildNodes()) return true
return Boolean(EMPTY_TAG_SET[node.tagName])
} | javascript | {
"resource": ""
} |
q60831 | LogWatcher | validation | function LogWatcher(dirpath, maxfiles, ignoreInitial) {
_classCallCheck(this, LogWatcher);
var _this = _possibleConstructorReturn(this, (LogWatcher.__proto__ || Object.getPrototypeOf(LogWatcher)).call(this));
_this._dirpath = dirpath || DEFAULT_SAVE_DIR;
_this._filter = isCommanderLog;
_this._maxfiles = max... | javascript | {
"resource": ""
} |
q60832 | loadImage | validation | function loadImage(image) {
$scope.$applyAsync(function () {
if ($scope.reversed) $scope.flipContext();
$scope.signatureReady = true;
ctxBackground.clearRect(0, 0, canvas.width, canvas.height);
ctxBackground.drawImage(image, 0, 0, canvasBackground.width, canvasBackground.height);
});
} | javascript | {
"resource": ""
} |
q60833 | validation | function() {
if(this.read) {
// 1. parse value
this.computed_observable = new Observer(this.createFunction("return ("+this.value+");", ["m", "p"], [this.context.model, this.context.parent], this.context.domElement), {
/* for debugging only */
domElement: this.context.domElement,
attribute: this.nam... | javascript | {
"resource": ""
} | |
q60834 | validation | function(functionBody, argNames, argValues, context) {
// store context
var functionArgs = argNames.concat(functionBody);
var fn = Function.apply(null, functionArgs);
// return function
return function() {
// mix predefined arguments with passed
var args = argValues.concat(Array.prototype.slice.call... | javascript | {
"resource": ""
} | |
q60835 | validation | function( expected, actual, optionsOrMsg ) {
var options = optionsOrMsg instanceof Object ? optionsOrMsg : { message: optionsOrMsg },
msg = options.message,
compatHtml = bender.tools && bender.tools.compatHtml;
if ( !options.skipCompatHtml ) {
var sortAttributes = ( 'sortAttributes' in options ) ? op... | javascript | {
"resource": ""
} | |
q60836 | validation | function( expected, actual, msg ) {
bender.assert.areSame( js_beautify( expected, this._config ), js_beautify( actual, this._config ), msg );
} | javascript | {
"resource": ""
} | |
q60837 | validation | function( expected, actual, msg ) {
var assert = bender.assert;
assert.isTypeOf( 'object', expected, 'Expected is not an object' );
assert.isTypeOf( 'object', actual, 'Actual is not an object' );
// Simply convert to JSON strings for a good diff in case of fails.
expected = JSON.stringify( objectHelper... | javascript | {
"resource": ""
} | |
q60838 | checkIfShouldStick | validation | function checkIfShouldStick() {
if (mediaQuery && !matchMedia('(' + mediaQuery + ')').matches) return;
var scrollTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
var shouldStick = scrollTop >= stickyLine;
// Switch the sticky modes if the element has crossed the sticky line
if (sh... | javascript | {
"resource": ""
} |
q60839 | buildServicesInternal | validation | function buildServicesInternal() {
if (_.isFunction(subdivision.buildServices)) {
subdivision.vent.trigger('before:buildServices');
return subdivision.buildServices().then(function () {
subdivision.vent.trigger('after:buildServices');
});
} else {
... | javascript | {
"resource": ""
} |
q60840 | validation | function(path) {
var node = this.$getNode(path, false);
if (node !== null){
return _.keys(node.nodes);
} else {
return null;
}
} | javascript | {
"resource": ""
} | |
q60841 | validation | function(obj) {
if(obj == null || typeof obj != 'object' || Object.isFrozen(obj) || obj._keepHot) return;
Object.freeze(obj); // First freeze the object.
for (var key in obj) {
if(obj.hasOwnProperty(key)) deepFreeze(obj[key]); // Recursively call deepFreeze.
}
} | javascript | {
"resource": ""
} | |
q60842 | validation | function(parentClass, constructor) {
// inherits methods from parent class
constructor.prototype = Object.create(parentClass.prototype);
// inherits methods from Subscribable class
for(var key in Subscribable.prototype) {
constructor.prototype[key] = Subscribable.prototype[key];
}
constructor.prototype.con... | javascript | {
"resource": ""
} | |
q60843 | BinarySearchTreeIterator | validation | function BinarySearchTreeIterator(tree, type) {
type = type || 'v';
if (type !== 'k' && type !== 'v' && type !== 'e') {
throw new Error('Incorrect binary search tree iterator type "' + type + '"!');
}
this._type = type;
this._tree = tree;
this._last = null;
this._done = false;
} | javascript | {
"resource": ""
} |
q60844 | validation | function (xhr, options, promise) {
var instance = this,
url = options.url,
method = options.method || GET,
headers = options.headers ? options.headers.itsa_deepClone() : {}, // all request will get some headers
async = !options.sync,
... | javascript | {
"resource": ""
} | |
q60845 | validation | function(xhr, promise, headers, method) {
// XDR cannot set requestheaders, only XHR:
if (!xhr._isXDR) {
var name;
if ((method!=="POST") && (method!=="PUT")) {
// force GET-request to make a request instead of using cache (like IE does):
... | javascript | {
"resource": ""
} | |
q60846 | validation | function(data) {
var paramArray = [],
key, value;
for (key in data) {
value = data[key];
key = ENCODE_URI_COMPONENT(key);
paramArray.push((value === null) ? key : (key + "=" + ENCODE_URI_COMPONENT(value)));
}
... | javascript | {
"resource": ""
} | |
q60847 | validation | function(queryString) {
var args = queryString.split("&"),
data = {};
args.forEach(function(arg) {
var item = arg.split("=");
(item.length===2) && (data[item[0]]=item[1]);
});
return data;
} | javascript | {
"resource": ""
} | |
q60848 | validation | function() {
var instance = this;
instance._runningRequests.forEach(function(promise) {
promise.abort();
});
instance._runningRequests.length = 0;
} | javascript | {
"resource": ""
} | |
q60849 | invokeConfigFn | validation | function invokeConfigFn(tasks) {
for (var taskName in tasks) {
if (tasks.hasOwnProperty(taskName)) {
tasks[taskName](grunt);
}
}
} | javascript | {
"resource": ""
} |
q60850 | ensureProperties | validation | function ensureProperties(str) {
str = str || '';
t.ok(hasPropertyDefinition(view, 'value'), 'has `value` property' + str);
t.equal(typeof view.name, 'string', 'has `name` property that is a string' + str);
t.notEqual(view.name, '', '`name` property should... | javascript | {
"resource": ""
} |
q60851 | printEnvironment | validation | function printEnvironment(environment, path, outputFile) {
// print sub-objects in an environment.
if (path) environment = traverse(environment).get(path.split('.'));
path = path ? '.' + path : '';
if (argv.format === 'json' || outputFile) {
var json = JSON.stringify(environment, null, 2);
if (outputFi... | javascript | {
"resource": ""
} |
q60852 | rte | validation | function rte(src, dest, data) {
if (typeof dest === 'object') {
data = dest; dest = src;
}
var rte = new Rte(src, data);
return rte.stringify(dest);
} | javascript | {
"resource": ""
} |
q60853 | Component | validation | function Component(domElement) {
this.domElement = domElement;
this.template = "";
this.templateNodes = [];
this.model = [];
this.parentModel = null;
this.built = false;
} | javascript | {
"resource": ""
} |
q60854 | validation | function(template) {
// unbind old models from old dom elements
this.unbindAll();
if(template == null) {
// save template html
this.template = this.domElement.innerHTML;
}
else {
// set template string
this.template = template;
// fill element.innerHTML with the template
//this.domElem... | javascript | {
"resource": ""
} | |
q60855 | validation | function(newModel) {
var oldPos;
for(var i = 0; i < newModel.length; i++) {
oldPos = this.model.indexOf(newModel[i]);
if(oldPos >= 0) {
// model already in the DOM
if(i != oldPos) {
// adjust template
this.moveTemplateNodes(oldPos, i);
// and model
this.model.splice(i, 0, this... | javascript | {
"resource": ""
} | |
q60856 | validation | function(position) {
if(!this.templateNodes[0]) {
// fill element.innerHTML with the template
//this.domElement.innerHTML = this.template;
htmlToElem(this.domElement, this.template);
// save template nodes
this.templateNodes.push(Array.prototype.slice.call(this.domElement.childNodes));
retur... | javascript | {
"resource": ""
} | |
q60857 | validation | function(from, to) {
var templateNodes = this.templateNodes[from];
// insert at the position (before nodes of this.templateNodes[position])
for(var i = 0; i < templateNodes.length; i++) {
this.domElement.insertBefore(templateNodes[i], this.templateNodes[to][0]);
}
this.templateNodes.splice(from, 1);
... | javascript | {
"resource": ""
} | |
q60858 | BaseImporter | validation | function BaseImporter () {
this._schema = null;
this._export = null;
this._types = {};
this._model = {
properties:{},
definitions:{},
ids:{}
};
this.error = null;
var baseImporter = this;
//setup listeners
this.on('readyStateChanged', function (readyState) {
//state ch... | javascript | {
"resource": ""
} |
q60859 | validation | function(nextSchema, nextScope, nextIndex, nextPath, nextCBack){
var nSchema = nextSchema || false;
var nScope = nextScope;
var nIndex = nextIndex;
var nPath = nextPath;
var nCBack = nextCBack || function(){};
if(false === nSchema){
return function(){};
}else{
return f... | javascript | {
"resource": ""
} | |
q60860 | loadFormatter | validation | function loadFormatter(formatterPath) {
try {
// @TODO: deprecate
formatterPath = (formatterPath === 'jslint_xml') ? 'jslint' : formatterPath;
return require('./lib/' + formatterPath + '_emitter');
} catch (e) {
console.error('Unrecognized format: %s', formatterPath);
con... | javascript | {
"resource": ""
} |
q60861 | createDirectory | validation | function createDirectory(filePath, cb) {
var dirname = path.dirname(filePath);
mkdirp(dirname, function (err) {
if (!err) {
cb();
} else {
console.error('Error creating directory: ', err);
}
});
} | javascript | {
"resource": ""
} |
q60862 | binb_sha1 | validation | function binb_sha1 (x, len) {
// append padding
x[len >> 5] |= 0x80 << (24 - len % 32);
x[((len + 64 >> 9) << 4) + 15] = len;
var w = Array(80);
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var e = -1009589776;
var t, oa, ob, oc, od, oe, i = 0, j = 0;
for (i;... | javascript | {
"resource": ""
} |
q60863 | Observer | validation | function Observer(fn, observerInfo) {
// call Subscribable constructor
Subscribable.call(this);
this.fn = fn;
this.dependency = [];
this.currentValue = null;
this.observerInfo = observerInfo;
// hard binded callbacks
this._dependencyGetter = this.dependencyGetter.bind(this);
this.call();
} | javascript | {
"resource": ""
} |
q60864 | validation | function(directory) {
var git, gitRef, packagePath, packageInfos;
packagePath = path.join(directory, "package.json");
// Check directory is a git repository
return Q.nfcall(exec, "cd "+directory+" && git config --get remote.origin.url").then(function(output) {
git = output.join("").replace(... | javascript | {
"resource": ""
} | |
q60865 | validation | function (payload, next) {
jira.getProject(options.project, handleGetProject(options, payload, next));
} | javascript | {
"resource": ""
} | |
q60866 | validation | function(localImagePath) {
// Read the file in and convert it.
var imageFile = fs.readFileSync(localImagePath);
var mimeType = mime.lookup(localImagePath);
var ret = "data:";
ret += mimeType;
ret += ";base64,";
ret += imageFile.toString("base64");
return ret;
} | javascript | {
"resource": ""
} | |
q60867 | end | validation | function end() {
try {
this.queue(transformCss(filePath, data, opts));
} catch(err) {
this.emit("error", new Error(err));
}
this.queue(null);
} | javascript | {
"resource": ""
} |
q60868 | apilist | validation | function apilist(items) {
return ul(items.map(item => li({
// use innerHTML to generate nested links
innerHTML : item.replace(/(\w+)/g, apilink)
})))
} | javascript | {
"resource": ""
} |
q60869 | validation | function(property, callback) {
if(typeof property != "string") {
callback = property;
property = "__all__";
}
this._subscribers[property] = this._subscribers[property] || [];
if(this._subscribers[property].indexOf(callback) == -1) {
this._subscribers[property].push(callback);
}
} | javascript | {
"resource": ""
} | |
q60870 | validation | function(property, callback) {
if(typeof property != "string") {
callback = property;
property = "__all__";
}
// empty, don't remove anything
if(!this._subscribers[property]) return;
// remove everything
if(callback == null) this._subscribers[property] = [];
// find callback and remove it
... | javascript | {
"resource": ""
} | |
q60871 | validation | function(property, val) {
if(val === undefined) {
// if second argument is missing, use property as value
val = (property === undefined) ? this : property;
property = "__all__";
}
if(property == "__all__") {
// notify global subscribers
notify(this._subscribers["__all__"], val);
}
else {
... | javascript | {
"resource": ""
} | |
q60872 | rowgroup | validation | function rowgroup(items, name) {
return items.map(([htmlterm, ariaterm], i) => {
htmlcount += htmlterm.split(', ').length
ariacount += ariaterm.split(', ').length
return tr([
!i && th({
rowSpan : items.length,
children : name,
}),
... | javascript | {
"resource": ""
} |
q60873 | addStats | validation | function addStats(database, cb){
// If a databaseName is present, it's a single db. No need to switch.
var changeDB = database.databaseName ? database : db.db(database.name);
// Get the stats
changeDB.stats(function(err, stats){
// Remove 1 from collection count, unless it's zero. Not sure wh... | javascript | {
"resource": ""
} |
q60874 | tail | validation | function tail(array) {
var length = array ? array.length : 0;
return length ? baseSlice(array, 1, length) : [];
} | javascript | {
"resource": ""
} |
q60875 | basePick | validation | function basePick(object, props) {
object = Object(object);
return basePickBy(object, props, function(value, key) {
return key in object;
});
} | javascript | {
"resource": ""
} |
q60876 | arrayAggregator | validation | function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array ? array.length : 0;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
} | javascript | {
"resource": ""
} |
q60877 | createHybrid | validation | function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & ARY_FLAG,
isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),
isFlip = bitmask & FLIP_... | javascript | {
"resource": ""
} |
q60878 | baseXor | validation | function baseXor(arrays, iteratee, comparator) {
var index = -1,
length = arrays.length;
while (++index < length) {
var result = result
? arrayPush(
baseDifference(result, arrays[index], iteratee, comparator),
baseDifference(arrays[index], result, iteratee, comparator)
)... | javascript | {
"resource": ""
} |
q60879 | baseMean | validation | function baseMean(array, iteratee) {
var length = array ? array.length : 0;
return length ? (baseSum(array, iteratee) / length) : NAN;
} | javascript | {
"resource": ""
} |
q60880 | baseIsTypedArray | validation | function baseIsTypedArray(value) {
return isObjectLike$1(value) && isLength(value.length) && !!typedArrayTags[objectToString$1.call(value)];
} | javascript | {
"resource": ""
} |
q60881 | baseUnset | validation | function baseUnset(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
object = parent(object, path);
var key = toKey(last(path));
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
} | javascript | {
"resource": ""
} |
q60882 | basePullAt | validation | function basePullAt(array, indexes) {
var length = array ? indexes.length : 0,
lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
}... | javascript | {
"resource": ""
} |
q60883 | isError | validation | function isError(value) {
if (!isObjectLike(value)) {
return false;
}
return (objectToString.call(value) == errorTag) ||
(typeof value.message == 'string' && typeof value.name == 'string');
} | javascript | {
"resource": ""
} |
q60884 | createWrap | validation | function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(PARTIAL_FLAG | P... | javascript | {
"resource": ""
} |
q60885 | forInRight | validation | function forInRight(object, iteratee) {
return object == null
? object
: baseForRight(object, baseIteratee(iteratee, 3), keysIn);
} | javascript | {
"resource": ""
} |
q60886 | basePickBy | validation | function basePickBy(object, props, predicate) {
var index = -1,
length = props.length,
result = {};
while (++index < length) {
var key = props[index],
value = object[key];
if (predicate(value, key)) {
baseAssignValue(result, key, value);
}
}
return result;
} | javascript | {
"resource": ""
} |
q60887 | SelectQuery | validation | function SelectQuery(request, context) {
this.request = request;
this.domain = new Domain({ source: request,
context: context });
this.filters = [];
this.matchExpression = '';
this.noResult = false;
this.parse();
} | javascript | {
"resource": ""
} |
q60888 | validation | function(fieldName) {
var field;
if (this.domain && fieldName) {
field = this.domain.getIndexField(fieldName);
if (!field.exists()) {
this.throwValidationError(
'CS-UnknownFieldInMatchExpression',
'Field \'' + fieldName + '\' is not defined in the metadata for this ' +
... | javascript | {
"resource": ""
} | |
q60889 | formatTable | validation | function formatTable(table, links, notes) {
var widths = [];
var rows = table.map(function (row) {
var cells = row.map(function (cell) {
return formatSpans(cell, links, notes);
});
cells.forEach(function (cell, index) {
widths[index] = Math.max(cell.length, widths[index] || 5);
widths[... | javascript | {
"resource": ""
} |
q60890 | validation | function(plugins, config) {
var self = this;
var aliasMap = Object.keys(plugins)
.reduce(function(aliases, pluginName) {
if (!aliases[pluginName] || !aliases[pluginName].as) {
aliases[pluginName] = { as: [pluginName] };
}
aliases[pluginName].as = self._castArray(aliases[... | javascript | {
"resource": ""
} | |
q60891 | validation | function(aliasMap, config) {
var aliases = this._flattenAliasMap(aliasMap);
var allExcept = null;
if (typeof config.allExcept !== 'undefined') {
allExcept = this._castArray(config.allExcept);
delete config.allExcept;
}
var keys = Object.keys(config);
if (allExcept) {
keys = ... | javascript | {
"resource": ""
} | |
q60892 | validation | function(config, aliasMap, pluginInstances) {
var self = this;
pluginInstances.forEach(function(instance) {
if (instance.runBefore) {
var befores = self._castArray(instance.runBefore);
config = self._mergeAuthorProvidedOrderWithConfigOrder('before', instance.name, befores, config, aliasMa... | javascript | {
"resource": ""
} | |
q60893 | validation | function(options, params) {
// Create connection to qps
var qpsApi = qps(options);
// Returned object
var task = new Task();
// Ticket flow
Rx.Observable
.from(qpsApi.ticket.post(params))
.catch((err) => {
... | javascript | {
"resource": ""
} | |
q60894 | exportCubeMixin | validation | function exportCubeMixin(cubeDef) {
var app = this;
var task = new Task();
promise().then(function() {
// Start
task.running('info', 'Starting!');
}).then(function(reply) {
// Create cube
return app.createSessionObject({
... | javascript | {
"resource": ""
} |
q60895 | createListBoxMixin | validation | function createListBoxMixin({ id, field }) {
return this.createObject({
qInfo: {
qType: 'ListObject'
},
qListObjectDef: {
qStateName: '$',
qLibraryId: undef.if(id, ''),
qDef: {
qFieldDefs: und... | javascript | {
"resource": ""
} |
q60896 | grayTransform | validation | function grayTransform (entry, direction, x, dim) { // :: Int -> Int -> Int -> Int
return bitwise.rotateRight((x ^ entry), dim, 0, direction + 1)
} | javascript | {
"resource": ""
} |
q60897 | directionSequence | validation | function directionSequence(i, dim) { // :: Int -> Int -> Int
if (i == 0) return 0
if (i % 2 == 0) return bitwise.trailingSetBits(i - 1) % dim
return bitwise.trailingSetBits(i) % dim
} | javascript | {
"resource": ""
} |
q60898 | nthRoot | validation | function nthRoot(num, nArg, precArg) { // : Int -> Int -> Int -> Int
var n = nArg || 2;
var prec = precArg || 12;
var x = 1; // Initial guess.
for (var i=0; i<prec; i++) {
x = 1/n * ((n-1)*x + (num / Math.pow(x, n-1)));
}
return x;
} | javascript | {
"resource": ""
} |
q60899 | hilbertIndex | validation | function hilbertIndex(point, options) { // :: [Int, Int, ..] -> {} -> Int
options = options || {}
var index = 0, code,
entry = options.entry || 0,
direction = options.direction || 0,
i = options.precision || bitwise.bitPrecision(Math.max.apply(null, point)) - 1,
dim = point.lengt... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.