_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q61700 | validation | function(config) {
if(!config) {
return "";
}
var result = [];
for(var key in config) {
if(typeof config[key] == "undefined") {
continue;
}
| javascript | {
"resource": ""
} | |
q61701 | validation | function(consumerKey, consumerSecret, applicationName, format, useCompression) {
this.eventHandlers = {};
this.consumerKey = consumerKey;
this.consumerSecret = consumerSecret;
this.useCompression = useCompression || true;
this.format = format || "json";
this.acceptEncoding = this.useCompression ? '... | javascript | {
"resource": ""
} | |
q61702 | save | validation | function save(file, options) {
var stream = fs.createWriteStream(file, options);
function onSave() {
stream.removeAllListeners();
this.emit('save');
}
function onError(err) {
stream.removeAllListeners();
this.emit('error', | javascript | {
"resource": ""
} |
q61703 | findPath | validation | function findPath(request, paths) {
if (paths.length == 1 && /^\.{2}/.test(request)) {
paths[0] = path.dirname(paths[0])
| javascript | {
"resource": ""
} |
q61704 | run | validation | function run(js, path) {
var m = new Module(path, module)
Module._findPath = findPath
m.paths = Module._nodeModulePaths(dirname(path))
| javascript | {
"resource": ""
} |
q61705 | move_aspirate_forward | validation | function move_aspirate_forward(hash) {
var asp = u.unasp2asp(hash.stemUlt);
if (!asp) return;
var stem = u.replaceEnd(hash.stem, hash.stemUlt, asp);
if | javascript | {
"resource": ""
} |
q61706 | get | validation | function get (options, config) {
options = options || found
config = config || {}
// Load options.
var dir = options.dir || found.dir || 'config'
var env = options.env || found.env || 'staging'
var base = options.base || found.base || 'base'
// Allow many "env" values.
var key = env.toLowerCase()
... | javascript | {
"resource": ""
} |
q61707 | decorate | validation | function decorate (object, values) {
for (var key in values) {
if (typeof object[key] === 'object') {
| javascript | {
"resource": ""
} |
q61708 | hide | validation | function hide (object, name, value) {
Object.defineProperty(object, name, {
| javascript | {
"resource": ""
} |
q61709 | _instanceCopy | validation | function _instanceCopy(sourceRef, copyRef, rc, copier) {
let origIndex = rc.xStack.indexOf(sourceRef);
if (origIndex === -1) {
rc.push(sourceRef, copyRef);
forEach(sourceRef, function(value, key) {
| javascript | {
"resource": ""
} |
q61710 | _objectCopy | validation | function _objectCopy(sourceRef, copyRef, rc) {
let origIndex = rc.xStack.indexOf(sourceRef);
if (origIndex === -1) {
rc.push(sourceRef, copyRef);
for (let [key, val] of _entries(sourceRef))
copyRef[key] = _clone(val, rc);
let symbols = Object.getOwnPropertySymbols(sourc... | javascript | {
"resource": ""
} |
q61711 | _setCopy | validation | function _setCopy(sourceRef, copyRef, rc) {
return _instanceCopy(sourceRef, copyRef, rc, (set, val) | javascript | {
"resource": ""
} |
q61712 | _mapCopy | validation | function _mapCopy(sourceRef, copyRef, rc) {
return _instanceCopy(sourceRef, | javascript | {
"resource": ""
} |
q61713 | _singleCopy | validation | function _singleCopy(sourceRef, copyRef, rc) {
return _instanceCopy(sourceRef, | javascript | {
"resource": ""
} |
q61714 | clone | validation | function clone(origSource) {
let origIndex = -1;
let rc = new RecurseCounter(1000);
| javascript | {
"resource": ""
} |
q61715 | _compareObject | validation | function _compareObject(x, y, rc) {
if (x === y)
return true;
if (x.constructor && y.constructor && x.constructor !== y.constructor)
return false;
let xKeys = Object.keys(x);
let yKeys = Object.keys(y);
xKeys.sort();
yKeys.sort();
if (!_equals(xKeys, yKeys, rc))
... | javascript | {
"resource": ""
} |
q61716 | equals | validation | function equals(x, y) {
let rc = new RecurseCounter(1000);
| javascript | {
"resource": ""
} |
q61717 | forEach | validation | function forEach(item, method, context) {
let type = getType(item);
switch(type) {
case types.date:
case types.function:
case types.object:
case types.regexp:
if (!item[Symbol.iterator]) {
for (let [key, value] of _entries(item)) {
... | javascript | {
"resource": ""
} |
q61718 | typeForExtend | validation | function typeForExtend(val) {
// treat unknown types (classes, hopefully?) and functions as objects
| javascript | {
"resource": ""
} |
q61719 | isExtendable | validation | function isExtendable(...args) {
// this is a fairly expensive call. find a way to optimize further?
if (args.length < 1)
return false;
let baseType = typeForExtend(args[0]);
if (!(
baseType === types.array
|| baseType === types.object
|| baseType... | javascript | {
"resource": ""
} |
q61720 | _extend | validation | function _extend(a, b) {
forEach(b, (bVal, key) => {
let type = typeForExtend(a);
switch(type) {
case types.array:
case types.object:
if (a[key] === undefined || a[key] === null)
a[key] = b[key];
else if (isExtendabl... | javascript | {
"resource": ""
} |
q61721 | extend | validation | function extend(a, ...rest) {
rest.forEach(b => {
if (isExtendable(a, b))
| javascript | {
"resource": ""
} |
q61722 | _smash | validation | function _smash(a, b) {
this.forEach(b, (val, key) => {
if (this.isSmashable(a[key], b[key])) // find a way to move isSmashable internal
| javascript | {
"resource": ""
} |
q61723 | smash | validation | function smash(a, ...rest) {
rest.forEach(b => {
if (this.isSmashable(a, b)) // find a way to move isSmashable internal
| javascript | {
"resource": ""
} |
q61724 | File | validation | function File(name, file, parent) {
this.name = name;
this.file = file;
this.parent = | javascript | {
"resource": ""
} |
q61725 | validation | function(msg, code, errorStr, cb) {
return function(error, data) {
if (error) {
error = json_rpc.newSysError(msg, code, errorStr,
| javascript | {
"resource": ""
} | |
q61726 | getTimeDifference | validation | function getTimeDifference(timestr1, timestr2) {
if (typeof timestr1 !== 'string' || typeof timestr2 !== 'string') {
throw new Error('pendel.time() expects string arguments');
}
// Check if we are getting the short timecode formats
// like 1:32PM or 13:32. If Yes, convert it into a
// generic datestring so that... | javascript | {
"resource": ""
} |
q61727 | getDateDifference | validation | function getDateDifference(timestr1, timestr2) {
// Force into predictable date format
var start = timestr1.toLocaleDateString ? timestr1 : new Date(timestr1);
var end = timestr2.toLocaleDateString ? timestr2 : new Date(timestr2);
if (start.toString() === 'Invalid | javascript | {
"resource": ""
} |
q61728 | getTotalResultsFromEpochs | validation | function getTotalResultsFromEpochs(epoch1, epoch2) {
var millisecs = Math.abs(epoch1 - epoch2);
var seconds = millisecs / 1000;
return {
| javascript | {
"resource": ""
} |
q61729 | InputCommand | validation | function InputCommand(args) {
var parsed = new statements.ArgumentStatement(args);
if (!parsed.args.length) throw new SyntaxError('INPUT requires at least one argument');
var question = "", placeVar, file;
if (parsed.args.length === 1) placeVar = parsed.args[0];
else {
if (parsed.args[0].ch... | javascript | {
"resource": ""
} |
q61730 | PiechartCommand | validation | function PiechartCommand(args) {
var parsed = new statements.ArgumentStatement(args);
if (parsed.args.length < 8) throw new SyntaxError('PIECHART command requires 8 arguments');
| javascript | {
"resource": ""
} |
q61731 | flatMap | validation | function flatMap(mapper) {
return function* (iterable) {
let index = 0;
for (const value of iterable) {
const innerIterable = mapper(value, index);
| javascript | {
"resource": ""
} |
q61732 | skipWhile | validation | function skipWhile(predicate) {
return function* (iterable) {
let i = 0;
let canReturn = false;
for (const item of iterable) {
if (!canReturn) {
| javascript | {
"resource": ""
} |
q61733 | skipUntil | validation | function skipUntil(predicate) {
return function* (iterable) {
let i = 0;
let canReturn = false;
for (const item of iterable) {
if (!canReturn) {
canReturn = predicate(item, i);
if (canReturn) {
yield item;
| javascript | {
"resource": ""
} |
q61734 | distinctUntilKeyChanged | validation | function distinctUntilKeyChanged(keySelector) {
return function* (it) {
let prev = undefined;
for (const item of it) {
const key = keySelector(item);
if (key === prev) {
| javascript | {
"resource": ""
} |
q61735 | orderBy | validation | function orderBy(keySelector, comparison) {
const trueKeySelector = keySelector || defaultKeySelector;
const trueComparison = comparison || defaultComparison;
return function* (item) {
const keyedMapper = map((item, | javascript | {
"resource": ""
} |
q61736 | repeat | validation | function repeat(times) {
return function* (it) {
const buffer = [];
for (const item of it) {
buffer.push(item);
yield item;
| javascript | {
"resource": ""
} |
q61737 | shuffle | validation | function shuffle(it, rand = () => Math.random()) {
return map((x) | javascript | {
"resource": ""
} |
q61738 | validation | function(compressedData) {
var inflatedData = zlib.inflateSync( new Buffer(compressedData, 'base64'));
var outputString = "[" + String.fromCharCode.apply(null,inflatedData) + "]";
| javascript | {
"resource": ""
} | |
q61739 | ShapeCommand | validation | function ShapeCommand(args) {
var parsed = new statements.ArgumentStatement(args);
if (parsed.args.length < 3) throw new SyntaxError('SHAPE command | javascript | {
"resource": ""
} |
q61740 | scrollSpy | validation | function scrollSpy() {
var scrollTop = $window.scrollTop(),
$anchors = $childMenu.find('a'),
activeIndex;
$anchors.each(function (index) {
var $target = $($(this).attr('href').replace(/\./g, '\\.')),
offsetTop = $target.offset()... | javascript | {
"resource": ""
} |
q61741 | fixSidebar | validation | function fixSidebar() {
if ($sidebarInner.outerHeight() < $content.outerHeight()) {
$sidebar.addClass('kss-fixed');
if ($sidebarInner.outerHeight() > $window.height()) {
$sidebar.height($window.height());
$window.on('scroll', scrollSide... | javascript | {
"resource": ""
} |
q61742 | scrollSidebar | validation | function scrollSidebar(event) {
if (event.handled !== true) {
var scrollTop = $window.scrollTop(),
maxScrollTop = $document.height() - $window.height();
if (scrollTop >= 0 && prevScrollTop >= 0 && scrollTop <= maxScrollTop && prevScrollTop <= maxScrollTop)... | javascript | {
"resource": ""
} |
q61743 | forEach | validation | function forEach(declarations, reqName, callback) {
var d;
if (reqName === "*") {
// Iterate over all declarations.
for (d in declarations) {
callback.call(this, d);
}
} else if (reqName.charAt(reqName.length - 1) === "*") {
// Iter... | javascript | {
"resource": ""
} |
q61744 | mkdir | validation | function mkdir(units, name) {
if (name !== "") {
var parts = name.split(".");
var path = "";
for (var i = 0, len = parts.length; i < len; i++) {
var part = parts[i];
path += part;
if (units[part] == null) {
u... | javascript | {
"resource": ""
} |
q61745 | pickUnit | validation | function pickUnit(srcDecls, destDecls, name, picked, stack) {
var decl = srcDecls[name];
if (!picked[name]) {
if (stack[name]) {
error("Recursive dependency '" + name + "'");
}
stack[name] = true;
for (var i = 0, len = decl._dependencies.le... | javascript | {
"resource": ""
} |
q61746 | pickUnits | validation | function pickUnits(dest, settings) {
var units = settings.units;
if (!isArray(units)) {
error("Invalid units array in pick settings");
}
if (!(settings.namespace instanceof Gumup)) {
error("Invalid namespace in pick settings");
}
var picked = {},
... | javascript | {
"resource": ""
} |
q61747 | initialize | validation | function initialize(dest, declarations, name, cache, inited) {
var decl = declarations[name];
if (!inited[name]) {
// Create unit dependencies first.
var len = cache.dependencies[name].length;
| javascript | {
"resource": ""
} |
q61748 | getShaSalt | validation | function getShaSalt() {
var shaDeps = [__filename,
__dirname + '/protractor_api.dart'];
| javascript | {
"resource": ""
} |
q61749 | isBemDecl | validation | function isBemDecl(node) {
if (node.type !== 'CallExpression') {
return false;
}
if (node.callee.type !== 'MemberExpression') {
return false;
}
if (node.callee.property.type !== 'Identifier' || node.callee.property.name !== 'decl') {
return false;
}
var obj = node.... | javascript | {
"resource": ""
} |
q61750 | getEntity | validation | function getEntity(decl) {
if (decl.type === "Literal") {
return {block: decl.value};
}
if (decl.type === "ObjectExpression") {
var base = getProperty(decl, 'baseBlock'),
| javascript | {
"resource": ""
} |
q61751 | getProperty | validation | function getProperty(objNode, name) {
for (var i=0; i<objNode.properties.length; i++) {
if (getKey(objNode.properties[i]) === name) {
| javascript | {
"resource": ""
} |
q61752 | getKey | validation | function getKey(propNode) {
if (propNode.key.type === "Literal") {
return propNode.key.value;
}
| javascript | {
"resource": ""
} |
q61753 | addDocletBemEntity | validation | function addDocletBemEntity(e) {
var bemEntity = e.code.bemEntity;
e.doclet.block = bemEntity.block;
if (bemEntity.base) {
| javascript | {
"resource": ""
} |
q61754 | isStaticDecl | validation | function isStaticDecl(node) {
var parent = node.parent; | javascript | {
"resource": ""
} |
q61755 | hasStatic | validation | function hasStatic(node) {
var args = node.arguments;
if (!args) {
return false;
}
return args.length >= 3 &&
| javascript | {
"resource": ""
} |
q61756 | getInputArguments | validation | function getInputArguments(args) {
var out = {};
out.localServices = {};
if (args.length > 0) {
out.source = args[0];
out.target = args[0];
if (_.isPlainObject(args[0])) {
var opts = args[0];
out.target = opts.target;
out.source = opts.sou... | javascript | {
"resource": ""
} |
q61757 | findNext | validation | function findNext(data, items, index) {
var currentIndex = data.length + 1, found = '';
for (var i = 0; i < items.length; i++) {
var item = items[i];
var location = data.indexOf(item, index);
if (location !== -1 && location < currentIndex) {
currentIndex = location;
| javascript | {
"resource": ""
} |
q61758 | findLast | validation | function findLast(data, items, index) {
var currentIndex = -1, found = '';
for (var i = 0; i < items.length; i++) {
var item = items[i];
| javascript | {
"resource": ""
} |
q61759 | findNextOutside | validation | function findNextOutside(data, items, index, exclude) {
var result, positionResult = {start: 0, end: index ? index - 1 : -1};
do {
result = findNext(data, | javascript | {
"resource": ""
} |
q61760 | findLastOutside | validation | function findLastOutside(data, items, index, exclude) {
var result, positionResult = {start: index ? index + 1 : data.length + 1, end: 0};
do {
result | javascript | {
"resource": ""
} |
q61761 | indexOfOutside | validation | function indexOfOutside(data, item, index, exclude) {
var result, positionResult = {start: 0, end: index ? index - 1 : -1};
do {
result | javascript | {
"resource": ""
} |
q61762 | lastIndexOfOutside | validation | function lastIndexOfOutside(data, item, index, exclude) {
var result, positionResult = {start: index ? index + 1 : data.length + 1, end: 0};
do {
result | javascript | {
"resource": ""
} |
q61763 | splitOutside | validation | function splitOutside(data, separator, exclude) {
var result = [];
var accumulator = "";
for (var i = 0; i < data.length; i++) {
accumulator += data[i];
var isInExclusion = inPosition(i, exclude);
if (!isInExclusion && endsWith(accumulator, separator)) {
| javascript | {
"resource": ""
} |
q61764 | inPosition | validation | function inPosition(index, items) {
for (var i = 0; i < items.length; i++) {
var item = items[i];
| javascript | {
"resource": ""
} |
q61765 | endsWith | validation | function endsWith(data, str) {
if (data.length < str.length) return false; | javascript | {
"resource": ""
} |
q61766 | pad | validation | function pad(data, length, pad) {
data = String(data);
| javascript | {
"resource": ""
} |
q61767 | shallowClone | validation | function shallowClone(source, obj) {
if (arguments.length < 2) {
obj = source;
source = {};
}
for (var key in obj) { | javascript | {
"resource": ""
} |
q61768 | validation | function() {
var args = norma('path:s?', arguments);
var _url = url.format(_.clone(this.url));
var _path = | javascript | {
"resource": ""
} | |
q61769 | nextLine | validation | function nextLine(context, ast, prompt, oldPrompt, forceCursor, eval) {
rl.question(prompt, function(answer) {
eval(answer, context, ast, forceCursor === -1 ? ast.root.length : forceCursor, function(newPrompt, newCursor) {
| javascript | {
"resource": ""
} |
q61770 | initialize | validation | function initialize(done) {
done = done || function() { };
if (fileContents) done();
fs.readFile(__dirname + '/../../data/filesystem.json', {
encoding: 'utf8'
}, function(err, data) | javascript | {
"resource": ""
} |
q61771 | save | validation | function save(done) {
if (process.browser) return done();
fs.writeFile(__dirname + '/../../data/filesystem.json', | javascript | {
"resource": ""
} |
q61772 | validation | function (i, validate){
// we offer a shortcut to get types when only one argument is provided
if (arguments.length === 1) {
return av.type(i);
}
// we store the value in private scope
var _i;
// our getter-setter-combo including validation
var me = function (d){
if (!arguments.length) {
if... | javascript | {
"resource": ""
} | |
q61773 | validation | function (d){
if (!arguments.length) {
if (typeof _i === 'object'){
var o = {};
for (var prop in _i){
o[prop] = _i[prop]();
}
return o;
} else {
return _i;
}
}
_i | javascript | {
"resource": ""
} | |
q61774 | DimCommand | validation | function DimCommand(args) {
var parsed = new statements.ArgumentStatement(args, {
parseArgs: false
});
this.creates = [];
for (var i = 0; i < parsed.args.length; i++) {
var dimDef = parsed.args[i];
var startBracket = dimDef.indexOf('(');
var endBracket = dimDef.indexOf(... | javascript | {
"resource": ""
} |
q61775 | genEntityDescription | validation | function genEntityDescription(data, kind, entityName) {
| javascript | {
"resource": ""
} |
q61776 | genBlockMethod | validation | function genBlockMethod(members, name) {
var res = {
name: name,
description: '',
params: [],
returns: [],
deprecated: false,
final: false
};
members.filter({
kind: 'function',
name: name
}).each(function(doclet) {
if (doclet.descri... | javascript | {
"resource": ""
} |
q61777 | genParam | validation | function genParam(param) {
var res = {
name: param.name || '',
description: param.description || '',
optional: !!param.optional
};
if (param.type) {
| javascript | {
"resource": ""
} |
q61778 | genProperty | validation | function genProperty(members, name) {
var res = {
name: name,
deprecated: false,
description: '',
types: []
};
members.filter({
kind: 'member',
name: name
}).each(function(doclet) {
if (doclet.description) {
res.description += doclet.d... | javascript | {
"resource": ""
} |
q61779 | IfCommand | validation | function IfCommand(args, define) {
if (util.endsWith(args.toLowerCase(), ' then')) args = args.slice(0, args.length - 5).trim();
else throw new SyntaxError('IF has no THEN');
| javascript | {
"resource": ""
} |
q61780 | logger | validation | function logger(stream){
return (...text) => {
text.map(text => | javascript | {
"resource": ""
} |
q61781 | forward | validation | function forward(receiver, provider, keys) {
keys = keys || allKeys(provider);
keys = Array.isArray(keys) ? keys : [keys];
keys.forEach(function (key) {
var val = provider[key];
if (typeof val === 'function') {
receiver[key] = function () {
| javascript | {
"resource": ""
} |
q61782 | RegexFinderStrategy | validation | function RegexFinderStrategy(config) {
config = config || {};
FinderStrategy.call(this, config); | javascript | {
"resource": ""
} |
q61783 | SyncFile | validation | function SyncFile(path, flags, mode) {
flags = flags || 'w';
this.fd | javascript | {
"resource": ""
} |
q61784 | write | validation | function write(obj) {
if(obj.type === 'crc') return this.end();
var buffer = this.converter.entry(obj); | javascript | {
"resource": ""
} |
q61785 | writeBuffer | validation | function writeBuffer(buffer) {
var written = fs.writeSync(this.fd, buffer, 0, buffer.length, null); | javascript | {
"resource": ""
} |
q61786 | end | validation | function end() {
this.writeBuffer(this.crc.value());
fs.closeSync(this.fd); | javascript | {
"resource": ""
} |
q61787 | AbstractSyntaxTree | validation | function AbstractSyntaxTree(root, labels, manager) {
this.root = root;
this.labels = labels; | javascript | {
"resource": ""
} |
q61788 | execute | validation | function execute(ast, ctx, done) {
if (!done && !(ctx instanceof ExecutionContext)) {
done = ctx;
| javascript | {
"resource": ""
} |
q61789 | MarkLogicStore | validation | function MarkLogicStore(options) {
options = options || {};
var collectionName = options.collection || defaultOptions.collection;
this.baseUri = options.baseUri || encodeURI(collectionName.replace(/\s/g,'-'));
Store.call(this, options);
this.collectionName = collectionName;
| javascript | {
"resource": ""
} |
q61790 | _vendorsList | validation | function _vendorsList(vendors, ignore = false) {
let vendorsList = ''
let sign = (ignore) ? '-' : '+'
for (let vendor of vendors) {
| javascript | {
"resource": ""
} |
q61791 | create | validation | function create (prototype, properties) {
Ctor.prototype = prototype || {}
return properties ? | javascript | {
"resource": ""
} |
q61792 | copy | validation | function copy (target, source) {
for (var key in Object(source)) | javascript | {
"resource": ""
} |
q61793 | identity | validation | function identity(iterable) {
return __asyncGenerator(this, arguments, function* identity_1() {
| javascript | {
"resource": ""
} |
q61794 | scan | validation | function scan(predicate, initial) {
return function (iterable) {
return __asyncGenerator(this, arguments, function* () {
var e_7, _a;
let index = 0;
let prevState = initial;
try {
for (var iterable_5 = __asyncValues(iterable), iterable_5... | javascript | {
"resource": ""
} |
q61795 | first | validation | async function first(iterable) {
var e_13, _a;
try {
for (var iterable_11 = __asyncValues(iterable), iterable_11_1; iterable_11_1 = await iterable_11.next(), !iterable_11_1.done;) {
const item = iterable_11_1.value;
| javascript | {
"resource": ""
} |
q61796 | skipUntil | validation | function skipUntil(predicate) {
return function (iterable) {
return __asyncGenerator(this, arguments, function* () {
var e_18, _a;
let i = 0;
let canReturn = false;
try {
for (var iterable_16 = __asyncValues(iterable), iterable_16_1; ite... | javascript | {
"resource": ""
} |
q61797 | concat | validation | function concat(...iterables) {
return function (it) {
return __asyncGenerator(this, arguments, function* () {
var e_20, _a;
yield __await(yield* __asyncDelegator(__asyncValues(it)));
try {
for (var iterables_1 = __asyncValues(iterables), iterables_1... | javascript | {
"resource": ""
} |
q61798 | distinct | validation | function distinct(it) {
return __asyncGenerator(this, arguments, function* distinct_1() {
var e_24, _a;
const resultSet = new Set();
try {
for (var it_5 = __asyncValues(it), it_5_1; it_5_1 = yield __await(it_5.next()), !it_5_1.done;) {
const item = it_5_1.va... | javascript | {
"resource": ""
} |
q61799 | orderBy | validation | function orderBy(keySelector, comparison) {
const trueKeySelector = keySelector || defaultKeySelector;
const trueComparison = comparison || defaultComparison;
return function (item) {
return __asyncGenerator(this, arguments, function* () {
var e_25, _a;
const keyedMappe... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.