_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q60600 | titleCase | validation | function titleCase (s) {
var arr = [];
libs.object.each(s.split(' '), function (t) { arr.push(libs.string.ucFirst(t)); });
return arr.join(' ');
} | javascript | {
"resource": ""
} |
q60601 | splice | validation | function splice (s, index, count, add) {
return s.slice(0, index) + (add || '') + s.slice(index + count);
} | javascript | {
"resource": ""
} |
q60602 | ellipses_ | validation | function ellipses_ (s, length, place, ellipses) {
if(isNaN(parseInt(length, 10))) length = s.length;
if(length < 0 || !isFinite(length)) length = 0;
ellipses = typeof ellipses === 'string' ? ellipses : '...';
if(s.length <= length) return ... | javascript | {
"resource": ""
} |
q60603 | shuffle | validation | function shuffle (s, splitter) {
var a = s.split(typeof splitter === 'string' ? splitter : ''), n = a.length,
replaceSplits = n - 1;
for(var i = n - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1)),
... | javascript | {
"resource": ""
} |
q60604 | reverse | validation | function reverse (s) {
if(s.length < 64) {
var str = '';
for(var i = s.length; i >= 0; i--) str += s.charAt(i);
return str;
}
else {
return s.split('').reverse().jo... | javascript | {
"resource": ""
} |
q60605 | withoutTrailingSlash | validation | function withoutTrailingSlash (s) {
if(!IS_BROWSER && HAS_OS && require('os').platform === 'win32') return s.replace(/\\+$/, '');
return s.replace(/\/+$/, '');
} | javascript | {
"resource": ""
} |
q60606 | pad | validation | function pad (s, length, delim, pre) {
var i, thisLength = s.length;
if(!delim) delim = ' ';
if(length === 0) return ''; else if(isNaN(parseInt(length, 10))) return s;
length = parseInt(length, 10);
if(length < thisLen... | javascript | {
"resource": ""
} |
q60607 | wordWrapToLength | validation | function wordWrapToLength (s, width, padleft, padright, omitFirst) {
if(padright === undefined && padleft) padright = padleft;
padleft = !isNaN(parseInt(padleft, 10)) ? parseInt(padleft, 10) : 0;
padright = !isNaN(parseInt(padright, 10)) ? parseInt(padrigh... | javascript | {
"resource": ""
} |
q60608 | advanceDays | validation | function advanceDays (d, daysInTheFuture, adjustForWeekend) {
if(!(d instanceof Date)) return d;
daysInTheFuture = daysInTheFuture && libs.generic.isNumeric(daysInTheFuture) ? daysInTheFuture : 1;
d.setTime(d.getTime() + (daysInTheFuture * 86400000));
... | javascript | {
"resource": ""
} |
q60609 | advanceMonths | validation | function advanceMonths (d, monthsInTheFuture, adjustForWeekend) {
if(!(d instanceof Date)) return d;
monthsInTheFuture = monthsInTheFuture && libs.generic.isNumeric(monthsInTheFuture) ? monthsInTheFuture : 1;
d.setTime(d.getTime() + (monthsInTheFuture * 262974... | javascript | {
"resource": ""
} |
q60610 | advanceYears | validation | function advanceYears (d, yearsInTheFuture, adjustForWeekend) {
if(!(d instanceof Date)) return d;
yearsInTheFuture = yearsInTheFuture && libs.generic.isNumeric(yearsInTheFuture) ? yearsInTheFuture : 1;
d.setTime(d.getTime() + (yearsInTheFuture * 31536000000))... | javascript | {
"resource": ""
} |
q60611 | yyyymmdd | validation | function yyyymmdd (d, delim) {
if(!(d instanceof Date)) return d;
delim = typeof delim !== 'string' ? '-' : delim ;
var dd = d.getDate(),
mm = d.getMonth() + 1,
yyyy = d.getFullYear();
i... | javascript | {
"resource": ""
} |
q60612 | validation | function (n, placeholder) {
if(n === undefined || n === null || !libs.object.isNumeric(n)) return n;
placeholder = typeof placeholder === 'string' ? placeholder : '.';
var rest, idx, int, ns = n.toString(), neg = n < 0;
idx = ns.indexOf('... | javascript | {
"resource": ""
} | |
q60613 | validation | function (n, symbol) {
if(n === undefined || n === null || !libs.object.isNumeric(n)) return n;
n = libs.object.getNumeric(n).toFixed(2);
symbol = typeof symbol === 'string' ? symbol : '$';
return n.replace(/^(-)?(\d+)\.(\d+)$/, function (... | javascript | {
"resource": ""
} | |
q60614 | factorial | validation | function factorial (n) {
if(typeof n !== 'number' || n < 0) return NaN;
if(n > 170) return Infinity;
if(n === 0 || n === 1) return 1;
return n * factorial(n - 1);
} | javascript | {
"resource": ""
} |
q60615 | isInt | validation | function isInt () {
return libs.object.every(arguments, function (n) {
return typeof n === 'number' && n % 1 === 0 && n.toString().indexOf('.') === -1;
});
} | javascript | {
"resource": ""
} |
q60616 | choose | validation | function choose (n, k) {
if(typeof n !== 'number' || typeof k !== 'number') return NaN;
if(k === 0) return 1;
return (n * choose(n - 1, k - 1)) / k;
} | javascript | {
"resource": ""
} |
q60617 | pad | validation | function pad (n, length) {
return libs.string.pad(n.toString(), length, '0', true);
} | javascript | {
"resource": ""
} |
q60618 | inherits | validation | function inherits (constructor, superConstructor) {
if (constructor === undefined || constructor === null)
throw new TypeError('The constructor to "inherits" must not be ' + 'null or undefined');
if (superConstructor === undefined || superConstructor === ... | javascript | {
"resource": ""
} |
q60619 | union | validation | function union (a) {
var args = libs.object.only(libs.object.toArray(arguments), 'array');
var union = [];
args.unshift(a);
libs.object.each(args, function (array) {
libs.object.each(array, function (item) {
... | javascript | {
"resource": ""
} |
q60620 | intersect | validation | function intersect () {
var arrays = libs.object.only(libs.object.toArray(arguments), 'array');
if(arrays.length === 0) return [];
if(arrays.length === 1) return libs.object.copy(arrays[0]);
var intersection = arrays[0], intermediate = []... | javascript | {
"resource": ""
} |
q60621 | rotateLeft | validation | function rotateLeft (a, amount) {
if(!(a instanceof Array)) return a;
return libs.array.rotate(a, 'left', amount);
} | javascript | {
"resource": ""
} |
q60622 | makeUnique | validation | function makeUnique (a) {
if(!(a instanceof Array)) return a;
var visited = [];
for(var i = 0; i < a.length; i++) {
if(visited.indexOf(a[i]) === -1) {
visited.push(a[i]);
}
... | javascript | {
"resource": ""
} |
q60623 | unique | validation | function unique (a) {
if(!(a instanceof Array)) return a;
var visited = [],
unique = [];
libs.object.each(a, function (item) {
if(visited.indexOf(item) === -1) {
unique.push(item);
... | javascript | {
"resource": ""
} |
q60624 | ascending | validation | function ascending (a) {
if(!(a instanceof Array)) return a;
return a.sort(function (a, b) {
if(a !== undefined && a !== null) a = a.toString();
if(b !== undefined && b !== null) b = b.toString();
return a < ... | javascript | {
"resource": ""
} |
q60625 | descending | validation | function descending (a) {
if(!(a instanceof Array)) return a;
return a.sort(function (a, b) {
if(a !== undefined && a !== null) a = a.toString();
if(b !== undefined && b !== null) b = b.toString();
return a >... | javascript | {
"resource": ""
} |
q60626 | histogram | validation | function histogram () {
var histogram = {};
libs.object.every(arguments, function (o) {
if(typeof o === 'boolean') {
if(!histogram[o]) histogram[o] = 1; else histogram[o]++;
}
else... | javascript | {
"resource": ""
} |
q60627 | copy | validation | function copy (item) {
var copy;
if(!item) return item;
switch (typeof item) {
case 'string':
case 'number':
case 'function':
case 'boolean':
... | javascript | {
"resource": ""
} |
q60628 | occurrencesOf | validation | function occurrencesOf (obj, what) {
if(arguments.length < 2) return 0;
if(typeof obj === 'boolean') {
return 0;
}
if(typeof obj === 'number') {
return occurrencesOf(obj.toString(), what);
... | javascript | {
"resource": ""
} |
q60629 | keys | validation | function keys (o) {
if(o === undefined || o === null) return [];
var keys = getKeys(o), idx;
if(libs.object.isArguments(o)) {
idx = keys.indexOf('length');
if(idx > -1) keys.splice(idx, 1);
}... | javascript | {
"resource": ""
} |
q60630 | isNumeric | validation | function isNumeric () {
return libs.object.every(arguments, function (item) {
return !isNaN(parseFloat(item)) && isFinite(item);
});
} | javascript | {
"resource": ""
} |
q60631 | getNumeric | validation | function getNumeric () {
var vals = [];
libs.object.every(arguments, function (o) {
vals.push(libs.object.isNumeric(o) ? parseFloat(o) : NaN);
});
return vals.length === 1 ? vals[0] : vals;
} | javascript | {
"resource": ""
} |
q60632 | isArguments | validation | function isArguments () {
return libs.object.every(arguments, function (item) {
return Object.prototype.toString.call(item) === '[object Arguments]';
});
} | javascript | {
"resource": ""
} |
q60633 | toInt | validation | function toInt () {
var vals = [];
libs.object.every(arguments, function (o) {
var radix = /^0x/.test(o) ? 16 : 10; // Check for hex string
vals.push(libs.object.isNumeric(o) ? parseInt(o, radix) : NaN);
});
... | javascript | {
"resource": ""
} |
q60634 | random | validation | function random (o) {
if(typeof o === 'object') {
return o instanceof Array ?
o[Math.floor(Math.random() * o.length)] :
o[Object.keys(o)[Math.floor(Math.random() * Object.keys(o).length)]];
}
... | javascript | {
"resource": ""
} |
q60635 | any | validation | function any (o, f) {
f = f instanceof Function ? f : undefined;
if(f instanceof Function) {
var self = o, keys, property, value;
if(typeof self === 'number' || typeof self === 'function' || typeof self === 'boolean') self = o.toSt... | javascript | {
"resource": ""
} |
q60636 | first | validation | function first (o, n) {
var gotN = (n === 0 ? true : !!n),
v;
n = parseInt(n, 10);
n = isNaN(n) || !isFinite(n) ? 1 : n;
if(typeof o === 'boolean') {
return o;
}
... | javascript | {
"resource": ""
} |
q60637 | last | validation | function last (o, n) {
if(typeof o === 'boolean') return o;
var gotN = (!!n || n === 0);
n = parseInt(n, 10);
n = isNaN(n) || !isFinite(n) ? 1 : n;
var v = null, keys, len = libs.object.size(o), idx;
... | javascript | {
"resource": ""
} |
q60638 | getCallback | validation | function getCallback (o) {
var last = libs.object.last(o);
return last instanceof Function ? last : NULL_FUNCTION;
} | javascript | {
"resource": ""
} |
q60639 | only | validation | function only (o, types) {
types = libs.object.toArray(arguments);
types.shift();
// Allows the 'plural' form of the type...
libs.object.each(types, function (type, key) { this[key] = type.replace(/s$/, ''); });
if(typ... | javascript | {
"resource": ""
} |
q60640 | whereKeys | validation | function whereKeys (o, predicate) {
if(!(predicate instanceof Function)) {
var temp = predicate;
predicate = function (k) { return k == temp; }; // jshint ignore:line
}
if(o === null || o === undefined) return o... | javascript | {
"resource": ""
} |
q60641 | max | validation | function max (o, func) {
if(!o || typeof o !== 'object') return o;
if(libs.object.size(o) === 0) return;
if(!(func instanceof Function)) func = undefined;
var max, maxValue;
if(!func) {
max = li... | javascript | {
"resource": ""
} |
q60642 | keyOfMax | validation | function keyOfMax (o, func) {
if(!o || typeof o !== 'object') return o;
if(libs.object.size(o) === 0) return;
if(!(func instanceof Function)) func = undefined;
var max, maxValue, maxKey;
if(!func) {
... | javascript | {
"resource": ""
} |
q60643 | min | validation | function min (o, func) {
if(!o || typeof o !== 'object') return o;
if(libs.object.size(o) === 0) return;
if(!(func instanceof Function)) func = undefined;
if(typeof o !== 'object') return o;
var min, minValue;
... | javascript | {
"resource": ""
} |
q60644 | keyOfMin | validation | function keyOfMin (o, func) {
if(!o || typeof o !== 'object') return o;
if(libs.object.size(o) === 0) return;
if(!(func instanceof Function)) func = undefined;
if(typeof o !== 'object') return o;
var min, minValue, min... | javascript | {
"resource": ""
} |
q60645 | _implements | validation | function _implements () {
var args = libs.object.toArray(arguments),
a = args.shift();
if(!a) return false;
return libs.object.every(args, function (m) {
if(!(a[m] instanceof Function)) return false;
... | javascript | {
"resource": ""
} |
q60646 | implementsOwn | validation | function implementsOwn (o, method) {
var args = libs.object.toArray(arguments),
a = args.shift();
if(!a) return false;
return libs.object.every(args, function (m) {
if(!(a[m] instanceof Function) || !o.hasOwn... | javascript | {
"resource": ""
} |
q60647 | create | validation | function create(props) {
var joystick = Object.create(this);
// apply Widget defaults, then overwrite (if applicable) with Slider defaults
_canvasWidget2.default.create.call(joystick);
// ...and then finally override with user defaults
Object.assign(joystick, Joystick.defaults, props);
// set... | javascript | {
"resource": ""
} |
q60648 | create | validation | function create() {
var shouldUseTouch = _utilities2.default.getMode() === 'touch';
_widget2.default.create.call(this);
Object.assign(this, DOMWidget.defaults);
// ALL INSTANCES OF DOMWIDGET MUST IMPLEMENT CREATE ELEMENT
if (typeof this.createElement === 'function') {
/**
* The DOM ... | javascript | {
"resource": ""
} |
q60649 | place | validation | function place() {
var containerWidth = this.container.getWidth(),
containerHeight = this.container.getHeight(),
width = this.width <= 1 ? containerWidth * this.width : this.width,
height = this.height <= 1 ? containerHeight * this.height : this.height,
x = this.x < 1 ? containerWidt... | javascript | {
"resource": ""
} |
q60650 | equalArrayElements | validation | function equalArrayElements (needle, haystack) {
let missingNeedle = needle.filter(n => haystack.indexOf(n) === -1)
if (missingNeedle.length !== 0) {
return false
}
let missingHaystack = haystack.filter(h => needle.indexOf(h) === -1)
return missingHaystack.length === 0
} | javascript | {
"resource": ""
} |
q60651 | Series | validation | function Series(asyncFncWrapper) {
asyncFncWrapper = getAsyncFncWrapper(asyncFncWrapper);
this.add = function() {
var fnc, args;
if(arguments.length===1) {
fnc=arguments[0];
}
else if(arguments.length > 1) {
fnc=arguments[arguments.length - 1];... | javascript | {
"resource": ""
} |
q60652 | Parallel | validation | function Parallel(asyncFncWrapper) {
asyncFncWrapper = getAsyncFncWrapper(asyncFncWrapper);
this.add = function() {
var fnc, args;
if(arguments.length===1) {
fnc=arguments[0];
}
else if(arguments.length > 1) {
fnc=arguments[arguments.length - 1];
... | javascript | {
"resource": ""
} |
q60653 | create | validation | function create(props) {
var menu = Object.create(this);
_domWidget2.default.create.call(menu);
Object.assign(menu, Menu.defaults, props);
menu.createOptions();
menu.element.addEventListener('change', function (e) {
menu.__value = e.target.value;
menu.output();
if (menu.onvalu... | javascript | {
"resource": ""
} |
q60654 | createOptions | validation | function createOptions() {
this.element.innerHTML = '';
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this.options[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _ite... | javascript | {
"resource": ""
} |
q60655 | create | validation | function create(props) {
var multiSlider = Object.create(this);
// apply Widget defaults, then overwrite (if applicable) with MultiSlider defaults
_canvasWidget2.default.create.call(multiSlider);
// ...and then finally override with user defaults
Object.assign(multiSlider, MultiSlider.defaults, pr... | javascript | {
"resource": ""
} |
q60656 | processPointerPosition | validation | function processPointerPosition(e) {
var prevValue = this.value,
sliderNum = void 0;
if (this.style === 'horizontal') {
sliderNum = Math.floor(e.clientY / this.rect.height / (1 / this.count));
this.__value[sliderNum] = (e.clientX - this.rect.left) / this.rect.width;
} else {
slide... | javascript | {
"resource": ""
} |
q60657 | matchAll | validation | function matchAll (regex, string) {
let match
let matches = []
while ((match = regex.exec(string)) !== null) {
delete match['index']
delete match['input']
matches.push(match)
}
return matches
} | javascript | {
"resource": ""
} |
q60658 | beforeEach | validation | function beforeEach(test, context, done) {
context.dir = tmp.dirSync().name;
process.chdir(context.dir);
done && done();
} | javascript | {
"resource": ""
} |
q60659 | promiseShouldFail | validation | function promiseShouldFail(promise, done, handler) {
promise.then(result => done(new Error('Promise expected to fail'))).
catch(error => {
handler(error)
done()
}).
catch(error => done(error))
} | javascript | {
"resource": ""
} |
q60660 | promiseShouldSucceed | validation | function promiseShouldSucceed(promise, done, handler) {
promise.then(result => {
handler(result)
done()
}).
catch(error => done(error))
} | javascript | {
"resource": ""
} |
q60661 | copyAssetToContext | validation | function copyAssetToContext(src, dest, context) {
var sourceAsset = path.join(testDir, src);
var targetAsset = path.join(context.dir, dest);
if (!fs.existsSync(sourceAsset)) {
// The source asset requested is missing
throw new Error("The test asset is missing");
}
// Attempt to cop... | javascript | {
"resource": ""
} |
q60662 | deepSet | validation | function deepSet(parent, key, value, mode) {
// if(typeof value==='string') value = value.replace(/(\r\n|\r|\n)\s*$/, ''); // replace line endings and white spaces
var parts = key.split('.');
var current = parent;
if(key==='this') {
if(mode==='push') parent.push(value);
else parent = val... | javascript | {
"resource": ""
} |
q60663 | validation | function (fPath, strict, fn) {
if (typeof(strict) === 'function') {
fn = strict;
strict = false;
}
var dir = path.dirname(fPath);
var base = path.basename(fPath);
if (typeof watched === 'undefined')
{
return fn && fn('[checkFile] watched a... | javascript | {
"resource": ""
} | |
q60664 | create | validation | function create(props) {
var shouldUseTouch = _utilities2.default.getMode() === 'touch';
_domWidget2.default.create.call(this);
Object.assign(this, CanvasWidget.defaults);
/**
* Store a reference to the canvas 2D context.
* @memberof CanvasWidget
* @instance
* @type {CanvasRenderi... | javascript | {
"resource": ""
} |
q60665 | createElement | validation | function createElement() {
var element = document.createElement('canvas');
element.setAttribute('touch-action', 'none');
element.style.position = 'absolute';
element.style.display = 'block';
return element;
} | javascript | {
"resource": ""
} |
q60666 | convertOfficialMap | validation | function convertOfficialMap (attributes) {
let map = {}
for (let attribute in attributes) {
let key = officialAttributeMap[attribute]
map[key] = attributes[attribute]
}
return map
} | javascript | {
"resource": ""
} |
q60667 | validation | function() {
return _.map(ko.unwrap(that.relations), function(relation) {
return ko.unwrap(relation.relatedPost.id);
});
} | javascript | {
"resource": ""
} | |
q60668 | validation | function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var $element = $(element);
var observable = valueAccessor();
if (ko.unwrap(observable)) {
$element.datepicker('update', observable.datePicker().format('DD.MM.YYYY')); // same as for .datepicker()));
}
} | javascript | {
"resource": ""
} | |
q60669 | disposable | validation | async function disposable() {
const name = "tmp" + Math.floor(Math.random() * 10000);
await connection.dbCreate(name).run();
const r = Object.create(connection);
r.dispose = async function() {
await this.dbDrop(name).run();
};
r._poolMaster._options.db = name;
return r;
} | javascript | {
"resource": ""
} |
q60670 | runRequestQueue | validation | function runRequestQueue (socket) {
var queue = socket.requestQueue;
if (!queue) return;
for (var i in queue) {
// Double-check that `queue[i]` will not
// inadvertently discover extra properties attached to the Object
// and/or Array prototype by other libraries/frameworks/t... | javascript | {
"resource": ""
} |
q60671 | create | validation | function create(props) {
var slider = Object.create(this);
// apply Widget defaults, then overwrite (if applicable) with Slider defaults
_canvasWidget2.default.create.call(slider);
// ...and then finally override with user defaults
Object.assign(slider, Slider.defaults, props);
// set underly... | javascript | {
"resource": ""
} |
q60672 | processPointerPosition | validation | function processPointerPosition(e) {
var prevValue = this.value;
if (this.style === 'horizontal') {
this.__value = (e.clientX - this.rect.left) / this.rect.width;
} else {
this.__value = 1 - (e.clientY - this.rect.top) / this.rect.height;
}
// clamp __value, which is only used internal... | javascript | {
"resource": ""
} |
q60673 | storeJob | validation | function storeJob(jobCompleted) {
// if jobCompleted is jobFootPrint
let emitterStore = new EventEmitter();
let socketStoreJob = io.connect(urlSocket);
let msg = messageBuilder(jobCompleted, 'storeJob', true);
socketStoreJob.on('connect', function () {
socketStoreJob.emit('storeJob', msg);
... | javascript | {
"resource": ""
} |
q60674 | handshake | validation | function handshake(param) {
return new Promise((resolve, reject) => {
if (types.isClientConfig(param)) {
logger_1.logger.log('info', `Client config paramaters perfectly loaded`);
logger_1.logger.log('debug', `Config file content: \n ${JSON.stringify(param)}`);
let socket ... | javascript | {
"resource": ""
} |
q60675 | pivotTable | validation | function pivotTable(dataset) {
var column_names = [];
var xvalues = [];
var values = {};
var rows = {};
for (rn in dataset.data) {
// at first run fill the existing data (rows/columns/values)
if (rn == 0) {
// skip first row as it contains ... | javascript | {
"resource": ""
} |
q60676 | init | validation | function init(user_id, secret, storage, callback) {
API_USER_ID = user_id;
API_SECRET = secret;
TOKEN_STORAGE = storage;
if (!callback) {
callback = function() {}
}
if (!fs.existsSync(TOKEN_STORAGE)) {
mkdirSyncRecursive(TOKEN_STORAGE);
}
if (TOKEN_STORAGE.substr(-1) !... | javascript | {
"resource": ""
} |
q60677 | getEmailTemplate | validation | function getEmailTemplate(callback, id){
if (id === undefined) {
return callback(returnError('Empty email template id'));
}
sendRequest('template/' + id, 'GET', {}, true, callback);
} | javascript | {
"resource": ""
} |
q60678 | updateEmailVariables | validation | function updateEmailVariables(callback,id,email,variables){
if ((id===undefined) || (email === undefined) || (variables === undefined) || (! variables.length)) {
return callback(returnError("Empty email, variables or book id"));
}
var data = {
email: email,
variables: variables
}... | javascript | {
"resource": ""
} |
q60679 | smsAddPhonesWithVariables | validation | function smsAddPhonesWithVariables(callback, addressbook_id, phones) {
if ((addressbook_id === undefined) || (phones === undefined) || (!Object.keys(phones).length)) {
return callback(returnError("Empty phones or book id"));
}
var data = {
addressBookId: addressbook_id,
phones: JSON.... | javascript | {
"resource": ""
} |
q60680 | smsGetPhoneInfo | validation | function smsGetPhoneInfo(callback, addressbook_id, phone) {
if ((addressbook_id === undefined) || (phone === undefined)) {
return callback(returnError("Empty phone or book id"));
}
sendRequest('sms/numbers/info/' + addressbook_id + '/' + phone, 'GET', {}, true, callback);
} | javascript | {
"resource": ""
} |
q60681 | smsUpdatePhonesVariables | validation | function smsUpdatePhonesVariables(callback, addressbook_id, phones, variables) {
if (addressbook_id === undefined) {
return callback(returnError("Empty book id"));
}
if ((phones === undefined) || (!phones.length)) {
return callback(returnError("Empty phones"));
}
if ((variables === u... | javascript | {
"resource": ""
} |
q60682 | smsAddPhonesToBlacklist | validation | function smsAddPhonesToBlacklist(callback, phones, comment){
if ((phones === undefined) || (!phones.length)) {
return callback(returnError("Empty phones"));
}
var data = {
'phones': JSON.stringify(phones),
'description': comment
}
sendRequest('sms/black_list', 'POST', data, ... | javascript | {
"resource": ""
} |
q60683 | smsDeletePhonesFromBlacklist | validation | function smsDeletePhonesFromBlacklist(callback, phones) {
if ((phones === undefined) || (!phones.length)) {
return callback(returnError("Empty phones"));
}
var data = {
'phones': JSON.stringify(phones),
}
sendRequest('sms/black_list', 'DELETE', data, true, callback);
} | javascript | {
"resource": ""
} |
q60684 | smsAddCampaign | validation | function smsAddCampaign(callback, sender_name, addressbook_id, body, date, transliterate){
if (sender_name === undefined) {
return callback(returnError("Empty sender name"));
}
if (addressbook_id === undefined) {
return callback(returnError("Empty book id"));
}
if (body === undefined... | javascript | {
"resource": ""
} |
q60685 | smsSend | validation | function smsSend(callback, sender_name, phones, body, date, transliterate) {
if (sender_name === undefined) {
return callback(returnError("Empty sender name"));
}
if ((phones === undefined) || (!phones.length)) {
return callback(returnError("Empty phones"));
}
if (body === undefined)... | javascript | {
"resource": ""
} |
q60686 | smsGetListCampaigns | validation | function smsGetListCampaigns(callback, date_from, date_to) {
var data = {
'dateFrom': date_from,
'dateTo': date_to
}
sendRequest('sms/campaigns/list', 'GET', data, true, callback);
} | javascript | {
"resource": ""
} |
q60687 | smsGetCampaignInfo | validation | function smsGetCampaignInfo(callback, campaign_id){
if (campaign_id === undefined) {
return callback(returnError("Empty sms campaign id"));
}
sendRequest('sms/campaigns/info/' + campaign_id, 'GET', {}, true, callback);
} | javascript | {
"resource": ""
} |
q60688 | smsCancelCampaign | validation | function smsCancelCampaign(callback, campaign_id) {
if (campaign_id === undefined) {
return callback(returnError("Empty sms campaign id"));
}
sendRequest('sms/campaigns/cancel/' + campaign_id, 'PUT', {}, true, callback);
} | javascript | {
"resource": ""
} |
q60689 | smsGetCampaignCost | validation | function smsGetCampaignCost(callback, sender_name, body, addressbook_id, phones){
if (sender_name === undefined) {
return callback(returnError("Empty sender name"));
}
if (body === undefined) {
return callback(returnError("Empty sms text"));
}
if ((addressbook_id === undefined) || (p... | javascript | {
"resource": ""
} |
q60690 | smsDeleteCampaign | validation | function smsDeleteCampaign(callback, campaign_id) {
if (campaign_id === undefined) {
return callback(returnError("Empty sms campaign id"));
}
var data = {
'id': campaign_id
}
sendRequest('sms/campaigns', 'DELETE', data, true, callback);
} | javascript | {
"resource": ""
} |
q60691 | forEach | validation | function forEach(arr, callback, scope) {
var i, len = arr.length;
for (i = 0; i < len; i += 1) {
callback.call(scope, arr[i], i);
}
} | javascript | {
"resource": ""
} |
q60692 | emit | validation | function emit(instance, name) {
var args = [].slice.call(arguments, 2);
if (events.indexOf(name) > -1) {
if (instance.handlers[name] && instance.handlers[name] instanceof Array) {
forEach(instance.handlers[name], function (handle) {
window.setTimeout(function () {
... | javascript | {
"resource": ""
} |
q60693 | render | validation | function render(self) {
var container = isDOMElement(self.node) ? self.node : document.getElementById(self.node);
var leaves = [], click;
var renderLeaf = function (item) {
var leaf = document.createElement('div');
var content = document.createElement('div');
var te... | javascript | {
"resource": ""
} |
q60694 | validatePackageName | validation | function validatePackageName(package_name) {
//Make the package conform to Java package types
//http://developer.android.com/guide/topics/manifest/manifest-element.html#package
//Enforce underscore limitation
var msg = 'Error validating package name. ';
if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z... | javascript | {
"resource": ""
} |
q60695 | validateProjectName | validation | function validateProjectName(project_name) {
var msg = 'Error validating project name. ';
//Make sure there's something there
if (project_name === '') {
return Q.reject(new CordovaError(msg + 'Project name cannot be empty'));
}
//Enforce stupid name error
if (project_name === 'CordovaAc... | javascript | {
"resource": ""
} |
q60696 | validation | function (file) {
var contents = fs.readFileSync(file, 'utf-8');
if (contents) {
// Windows is the BOM. Skip the Byte Order Mark.
contents = contents.substring(contents.indexOf('<'));
}
var doc = new et.ElementTree(et.XML(contents)); // eslint-disable-line babel/new-cap
var root = doc.getroot(... | javascript | {
"resource": ""
} | |
q60697 | Config | validation | function Config(file) {
this._file = file;
this._doc = _this.parse(file);
this._root = this._doc.getroot();
} | javascript | {
"resource": ""
} |
q60698 | captureStream | validation | function captureStream(name, callback) {
var stream = process[name];
var originalWrite = stream.write;
stream.write = function(str) {
callback(name, str);
};
return {
restore: function() {
stream.write = originalWrite;
}
};
} | javascript | {
"resource": ""
} |
q60699 | messageHandler | validation | function messageHandler() {
var message = messages.read(arguments, _session.signer);
if (!message) {
return;
}
var handler = _session.handlers[message.header.msg_type];
if (handler) {
handler(message);
}
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.