_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q10500 | setLab | train | function setLab(color, l, a, b) {
var white = [ 95.047, 100.000, 108.883 ]; //for X, Y, Z
var y = (l + 16) / 116;
var x = a / 500 + y;
var z = y - b / 200;
| javascript | {
"resource": ""
} |
q10501 | getLab | train | function getLab(color) {
var xyz = getXYZ(color);
var white = [ 95.047, 100.000, 108.883 ]; //for X, Y, Z
var x = fromXYZValueToLabValue(xyz[0], white[0]); | javascript | {
"resource": ""
} |
q10502 | DatabaseDbModel | train | function DatabaseDbModel(name, tableName) {
this.__name = name;
this.hasRelationships = false;
this.hasValidations = false;
this.hasMethods = false;
this.hasStatics = false;
this.hasFields = false;
this.fields = {};
this.__hasMany = {};
this.__hasOne = {};
this.__belongsTo = {};
this.__errors = {}... | javascript | {
"resource": ""
} |
q10503 | Enum | train | function Enum(name, values) {
/** The generic Enum instance
* @constructor
*/
function EnumInstance(x) {return _.includes(EnumInstance, x)}
Object.defineProperties(EnumInstance,
{ __jsmf__: {value: {uuid: generateId(), conformsTo: Enum}}
, __name: {value: name}
, getName: {value: getName}
, ... | javascript | {
"resource": ""
} |
q10504 | createElementModule | train | function createElementModule() {
return gulp
.src(`./${config.src.path}/${config.src.entrypoint}`)
.pipe(
modifyFile(content => {
return content.replace(
new RegExp(`../node_modules/${config.element.scope}/`, 'g'),
'../'
);
| javascript | {
"resource": ""
} |
q10505 | injectTemplate | train | function injectTemplate(forModule) {
return (
gulp
.src(
forModule
? `./${config.temp.path}/${config.element.tag}.js`
: `./${config.temp.path}/${config.element.tag}.script.js`
)
// Inject the template html.
.pipe(
inject(gulp.src(`./${config.temp.path}/... | javascript | {
"resource": ""
} |
q10506 | train | function(index, value) {
if (index && value) {
if (this.cache[index] === undefined) {
this.cache[index] = false;
}
this.cache[index] = value;
}else{
if (!index) {
return this.cache; | javascript | {
"resource": ""
} | |
q10507 | train | function(component) {
var cid,
foundCmp;
if (typeof component === 'object') {
cid = component.id();
}
foundCmp = false;
$.each(jsCow.componentsObjectList, function(i, c) {
| javascript | {
"resource": ""
} | |
q10508 | train | function(childs) {
var list = [];
if ( childs instanceof Array ) {
list = childs;
} else {
list.push(childs);
}
$.each(list, (function(self) {
return function(i, child) {
if (typeof child === 'object' && !child.__cfg__.__execInit__) {
... | javascript | {
"resource": ""
} | |
q10509 | train | function(child) {
window.setTimeout((function(self, child) {
return function() {
if (!child.config.__execInit__ && typeof child === 'object') {
self.add(child);
| javascript | {
"resource": ""
} | |
q10510 | train | function(cmp) {
// Remove the component reference from parent children list
if (typeof cmp !== 'undefined' && typeof cmp === 'object') {
$(this.children()).each((function(self, cmp) {
return function(i,c) {
if (c.id() === cmp.id()) {
self.__children__.splice(i,1);
... | javascript | {
"resource": ""
} | |
q10511 | train | function(method, root) {
var methodList;
if (root === true) {
$.extend(true, this, method);
} else {
var _this = this;
if (!this.extension) {
var ext = function() {};
methodList = {};
$.each(method, function... | javascript | {
"resource": ""
} | |
q10512 | train | function(config) {
var cfg = config;
var self = this;
var viewList = this.list();
$(viewList).each(function(i, view) {
if (!view.isInit) {
if (view.dom !== 'undefined' && view.dom.main !== 'undefined') {
if (i === 0 && self.cmp().placeholder()) {
self.cmp().placeholder().r... | javascript | {
"resource": ""
} | |
q10513 | train | function() {
var self = this;
var viewList = this.list();
$.each(viewList, function(i, view) {
| javascript | {
"resource": ""
} | |
q10514 | train | function(target) {
var self = this;
var viewList = this.list();
$.each(viewList, function(i, view) {
| javascript | {
"resource": ""
} | |
q10515 | train | function (event, d, l) {
var config = this.cmp().config();
var data = d;
var local = l;
if (typeof d === 'undefined' || !d) {
data = config;
}else if (typeof d === 'object') {
data = d;
}else{
data = {};
}
if (data) {
var self = this;
if (typeof local === 'undefined' || !lo... | javascript | {
"resource": ""
} | |
q10516 | train | function (event, data, local) {
// trigger event in current component
var bubble = this.bubbleTrigger(event, data, local);
if (bubble) {
// Next Event | javascript | {
"resource": ""
} | |
q10517 | train | function (event, data, local) {
var bubble = | javascript | {
"resource": ""
} | |
q10518 | solveAngle | train | function solveAngle(a, b, c) {
var temp = (a * a + b * b - c * c) / (2 * a * b);
if (temp >= -1 && temp <= 1) | javascript | {
"resource": ""
} |
q10519 | area | train | function area(poly) {
var i = -1,
n = poly.length,
a,
b = poly[n - 1],
area = 0;
while (++i < n) {
a = b;
| javascript | {
"resource": ""
} |
q10520 | _loop | train | function _loop(i, storesLen) {
var store = stores[i];
var getState = store.getState,
name = store.anew.name,
_store$dispatch = store.dispatch,
reducers = _store$dispatch.reducers,
effects = _store$dispatch.effects,
actions = _store$dispatch.actions,
_store$dispat... | javascript | {
"resource": ""
} |
q10521 | _slice | train | function _slice(args, from, to) {
switch (arguments.length) {
case 1:
return _slice(args, 0, args.length);
case 2:
return _slice(args, from, args.length);
| javascript | {
"resource": ""
} |
q10522 | from | train | function from(arg, encodingOrOffset, length) {
if (typeof arg === 'number') {
throw new TypeError('Argument must | javascript | {
"resource": ""
} |
q10523 | train | function(browser, data) {
// Some browsers are platform specific so exit out if not available
if(data[browser][process.platform]) {
if(browser.indexOf("firefox") !== -1) {
// Handles firefox, firefox aurora and firefox nightly
cleanLaunchFirefox(browser, data)... | javascript | {
"resource": ""
} | |
q10524 | canInitialize | train | function canInitialize(dependencies, initialized) {
return !dependencies ||
dependencies.length === 0 || | javascript | {
"resource": ""
} |
q10525 | done | train | function done(error) {
if (error) {
errors.push(error);
}
if (--initializing <= 0) {
if (errors && errors.length) {
var errorResult = new Error('Errors occurred during initialization.');
errorResult.initializationErrors = errors;
| javascript | {
"resource": ""
} |
q10526 | createPersistStore | train | function createPersistStore(reduxStore) {
var persistor = (0, _reduxPersist.persistStore)(reduxStore);
var dispatch = persistor.dispatch,
getState = persistor.getState;
reduxStore.persistor = persistor;
reduxStore.getState.persistor = getState;
reduxStore.dispatch.persistor = dispatch;
| javascript | {
"resource": ""
} |
q10527 | train | function(paths) {
var appends = [];
if (grunt.option("quiet") || config.quiet) {
appends.push("--quiet");
}
if (grunt.option("verbose") || config.verbose) {
appends.push("--verbose");
}
if (grunt.option("rules") || config.rules) {
v... | javascript | {
"resource": ""
} | |
q10528 | createPointObjects | train | function createPointObjects(array) {
if (!array) {
array = [];
}
var acc = array.reduce(function(accumulator, current) {
if (current.x && current.y) { // Point
accumulator.push(current);
}
else if (current.start && current.end && current.height) { // Arc
... | javascript | {
"resource": ""
} |
q10529 | esc | train | function esc(str) {
if(typeof(str) !== "string")
str = "" + str;
str = str.replace(/[\0\n\r\b\t\\\'\"\x1a]/g, function(res) {
switch(res) {
case "\0": return "\\0";
case "\n": return "\\n";
case "\r": return "\\r";
| javascript | {
"resource": ""
} |
q10530 | readComponents | train | function readComponents(
componentPath,
referenceFile, localeFile, layoutSegment, contentSegment,
filingCabinet, renderer
) {
logger.showInfo( '*** Reading components...' );
// Initialize the store.
getComponents(
componentPath, 0, '',
referenceFile, localeFile, | javascript | {
"resource": ""
} |
q10531 | makeFixer | train | function makeFixer(options) {
if (typeof options === 'undefined') {
return true;
}
if (typeof options === 'boolean') {
return options;
}
const rulesToFix = options.rules;
const fixWarnings = options.warnings;
function ruleFixer(eslintMessage) {
if (!rulesToFix) return true;
if (rulesTo... | javascript | {
"resource": ""
} |
q10532 | createFunction | train | function createFunction() {
// Lazy define.
createFunction = function(args, body) {
var result,
anchor = freeDefine ? freeDefine.amd : Benchmark,
prop = uid + 'createFunction';
runScript((freeDefine ? 'define.amd.' : 'Benchmark.') + prop + '=function(' | javascript | {
"resource": ""
} |
q10533 | delay | train | function delay(bench, fn) {
bench._timerId | javascript | {
"resource": ""
} |
q10534 | getMean | train | function getMean(sample) {
return (_.reduce(sample, function(sum, x) {
| javascript | {
"resource": ""
} |
q10535 | isStringable | train | function isStringable(value) {
return _.isString(value) | javascript | {
"resource": ""
} |
q10536 | execute | train | function execute() {
var listeners,
async = isAsync(bench);
if (async) {
// Use `getNext` as the first listener.
bench.on('complete', getNext);
listeners = bench.events.complete;
listeners.splice(0, 0, listeners.pop());
}
// Execute me... | javascript | {
"resource": ""
} |
q10537 | getNext | train | function getNext(event) {
var cycleEvent,
last = bench,
async = isAsync(last);
if (async) {
last.off('complete', getNext);
last.emit('complete');
}
// Emit "cycle" event.
eventProps.type = 'cycle';
eventProps.target = last;
... | javascript | {
"resource": ""
} |
q10538 | compare | train | function compare(other) {
var bench = this;
// Exit early if comparing the same benchmark.
if (bench == other) {
return 0;
}
var critical,
zStat,
sample1 = bench.stats.sample,
sample2 = other.stats.sample,
size1 = sample1.length,
s... | javascript | {
"resource": ""
} |
q10539 | interpolate | train | function interpolate(string) {
// Replaces all occurrences of `#` with a unique number and template tokens with content.
| javascript | {
"resource": ""
} |
q10540 | findItem | train | function findItem( path, items ) {
var result = null;
items.forEach( function ( item ) {
if (!result && item instanceof MenuItem && item.paths.filter( function( value ) {
return value === path;
} ).length > 0)
result = item;
| javascript | {
"resource": ""
} |
q10541 | getAggregationFields | train | function getAggregationFields(query, aggParam, supplimentalBanList) {
let retVal = [];
const _aggParam = aggParam || 'aggregations';
if (!query[_aggParam]) {
return retVal;
}
const _supplimentalBanList = supplimentalBanList || {};
_.each(query[_aggParam].split(','), (agg) => {
asse... | javascript | {
"resource": ""
} |
q10542 | getTopHitsResult | train | function getTopHitsResult(aggResponse, aggName, esResponse, aggregationObjects) {
const aggLookup = {};
const linked = {}; // keeps track of all linked objects. type->id->true
const typeLookup = {};
function getAggLookup(_aggLookup, _aggregationObjects) {
_.each(_aggregationObjects, (aggObj) => {... | javascript | {
"resource": ""
} |
q10543 | createBuckets | train | function createBuckets(terms) {
return _.map(terms, (term) => {
// 1. see if there are other terms & if they have buckets.
const retVal = { key: term.key, count: term.doc_count };
_.each(term, (aggResponse, responseKey) => {
if (responseKey === 'key... | javascript | {
"resource": ""
} |
q10544 | createCustomRoutingQueryString | train | function createCustomRoutingQueryString(pathToCustomRoutingKey, query) {
const invalidRegexList = [/^ge=/, /^gt=/, /^ge=/, /^lt=/, /\*$/]; // array of invalid regex
let customRoutingValue;
if (!pathToCustomRoutingKey) return ''; // customRouting is not enabled for this type
customRoutingValue = query[p... | javascript | {
"resource": ""
} |
q10545 | unexpandEntity | train | function unexpandEntity(sourceObject, includeFields) {
_.each(sourceObject.links || [], (val, key) => {
if (!_.isArray(sourceObject.links[key])) {
// I know the extra .toString seems unnecessary, but sometimes val.id is already an objectId, and other times its
// a string.
sourceObject.links[key... | javascript | {
"resource": ""
} |
q10546 | unexpandSubentity | train | function unexpandSubentity(subEntity) {
if (_.isArray(subEntity)) {
_.each(subEntity, (entity, index) => {
subEntity[index] = unexpandSubentity(entity);
});
} else {
| javascript | {
"resource": ""
} |
q10547 | groupNestedPredicates | train | function groupNestedPredicates(_nestedPredicates) {
let maxDepth = 0;
const nestedPredicateObj = {};
const nestedPredicateParts = _.map(_nestedPredicates, (predicateArr) => {
const predicate = predicateArr[0];
const retVal = predicate.split('.');
nestedPredicateObj[predicate] = predicateAr... | javascript | {
"resource": ""
} |
q10548 | train | function(indexOrItem) {
this._assertNotDestroyed('$save');
var self = this;
var item = self._resolveItem(indexOrItem);
var key = self.$keyAt(item);
if( key !== null ) {
var ref = self.$ref().ref().child(key);
var data = $wilddogUtils.toJSON(item)... | javascript | {
"resource": ""
} | |
q10549 | train | function(indexOrItem) {
this._assertNotDestroyed('$remove');
var key = this.$keyAt(indexOrItem);
if( key !== null ) {
var ref = this.$ref().ref().child(key);
return $wilddogUtils.doRemove(ref).then(function() {
return ref;
| javascript | {
"resource": ""
} | |
q10550 | train | function(profile) {
var user = this.getUser();
if (user) {
return this._q.when(user.updateProfile(profile));
} else {
return | javascript | {
"resource": ""
} | |
q10551 | WilddogObject | train | function WilddogObject(ref) {
if( !(this instanceof WilddogObject) ) {
return new WilddogObject(ref);
}
// These are private config props and functions used internally
// they are collected here to reduce clutter in console.log and forEach
this.$$conf = {
// s... | javascript | {
"resource": ""
} |
q10552 | train | function () {
var self = this;
var ref = self.$ref();
var data = $wilddogUtils.toJSON(self);
| javascript | {
"resource": ""
} | |
q10553 | train | function(fn, ctx, wait, maxWait) {
var start, cancelTimer, args, runScheduledForNextTick;
if( typeof(ctx) === 'number' ) {
maxWait = wait;
wait = ctx;
ctx = null;
}
if( typeof wait !== 'number' ) {
throw new Error('... | javascript | {
"resource": ""
} | |
q10554 | runNow | train | function runNow() {
cancelTimer = null;
start = null;
runScheduledForNextTick = | javascript | {
"resource": ""
} |
q10555 | otuMapArray | train | function otuMapArray(data) {
this.data = data;
this.len = this.data.length;
this.data[this.len] = [];
for (var i = 0; i < this.len; i++) {
this.data[this.len].push(i);
}
this.reset = function () {
var _this = this;
if (!this.data[this.len]) {
this.data[this.... | javascript | {
"resource": ""
} |
q10556 | prepareStack | train | function prepareStack(stack) {
let lines = stack.split('\n').slice(1)
if (lines.length > 500) {
// Stack too big, probably this is caused by stack overflow
// Remove middle values
let skipped = lines.length - 500,
top = lines.slice(0, 250),
| javascript | {
"resource": ""
} |
q10557 | getReference | train | function getReference( referenceFile ) {
var text = '';
// Read references file.
var referencePath = path.join( process.cwd(), referenceFile );
var stats = fs.statSync( referencePath );
if (stats && stats.isFile()) {
text = fs.readFileSync( referencePath, { encoding: 'utf8' } );
// Find common root... | javascript | {
"resource": ""
} |
q10558 | createPersistConfig | train | function createPersistConfig(persist, name) {
switch (typeof persist === 'undefined' ? 'undefined' : _typeof(persist)) {
case 'boolean':
if (persist) {
persist = {
key: name,
storage: _storage2.default
};
}
... | javascript | {
"resource": ""
} |
q10559 | getListener | train | function getListener(event, id) {
if (hasListeners(event)) {
var listeners = | javascript | {
"resource": ""
} |
q10560 | addListener | train | function addListener(id, event, listener) {
if (!hasListeners(event)) {
context._events[event] = {};
}
| javascript | {
"resource": ""
} |
q10561 | wipeCache | train | function wipeCache(stubs, resolver, waveCallback, removeFromCache = removeFromCache_nodejs) {
waveCallback = waveCallback || waveCallback_default;
const cache = require.cache;
wipeMap(
cache,
| javascript | {
"resource": ""
} |
q10562 | train | function(){
scheduler.sequence(function(){
console.log("running");
motors.set({"A,B": 20, "C,D": 0}); //move left wheels
}).wait(function(){
//wait until we moved off the line
return colorSensor.value == ColorSensor.colors.WHITE;
}).do(function(){
motors.set({"A,B": 0, "... | javascript | {
"resource": ""
} | |
q10563 | train | async function(fileName, fileExt, resolve, parse, cwd) {
// Get an array of paths to tell the location of potential files
const locations = resolve(fileName, fileExt)
// Look for the data in the same directory as filePath
const relativePath = await locatePath(locations, { cwd })
// Only continue with files
if ... | javascript | {
"resource": ""
} | |
q10564 | train | async function(filePath, index, resolvers, opts) {
// Use the filePath to generate a unique id
const id = crypto.createHash('sha1').update(filePath).digest('hex')
// File name and extension
const { name: fileName, ext: fileExt } = path.parse(filePath)
// Absolute directory path to the component
const fileCwd =... | javascript | {
"resource": ""
} | |
q10565 | caseInsensitiveLookup | train | function caseInsensitiveLookup (object, lookup) {
lookup = lookup.toLowerCase();
for (var property in object) { | javascript | {
"resource": ""
} |
q10566 | tryPackErrorKeys | train | function tryPackErrorKeys(object, results) {
if (object instanceof Error) {
results.push(packValue("message"), | javascript | {
"resource": ""
} |
q10567 | packValue | train | function packValue(value) {
const result = memoizedMap.get(value);
if (result == null) {
if (value >= MIN_DICT_INDEX && value <= MAX_VERBATIM_INTEGER && Number.isInteger(value))
return -value;
memoize(value);
... | javascript | {
"resource": ""
} |
q10568 | memoize | train | function memoize(value, objectKey) {
const oldValue = memoized[memoizedIndex];
if (oldValue !== undefined) {
memoizedMap.delete(oldValue);
memoizedObjectMap.delete(oldValue);
}
if (objectKey)
memoizedObjectMap.s... | javascript | {
"resource": ""
} |
q10569 | daisy_chain | train | function daisy_chain(head, tail) {
var result = head;
for (var i = 0; i < tail.length; i++) {
result = new node({
type: "binary",
operator: tail[i][1],
| javascript | {
"resource": ""
} |
q10570 | preprocessor_branch | train | function preprocessor_branch(if_directive,
elif_directives,
else_directive) {
var elseList = elif_directives;
if (else_directive) {
elseList = elseList.concat([else_directive]);
}
var result = if_directive[0];
result... | javascript | {
"resource": ""
} |
q10571 | Sounds | train | function Sounds(folder,loadCallback) {
if(!folder)
throw new Error('No folder given for sounds !')
// sound is on by default
this.muted=false;
// contains sounds elements
this.sounds={};
// contains sounds to load
this.soundsToLoad=new Array();
// callback executed when each sounds are loaded
this.loadedSoun... | javascript | {
"resource": ""
} |
q10572 | bindState | train | function bindState(rows) {
// build state from rows and immutable initState
//----------------------------------------------------------
this.state = merge(
{}
, this.props.initState
, {rows}
)
// fill state arrays with init vals
//----------------------------------------------------------
f... | javascript | {
"resource": ""
} |
q10573 | readServerConfig | train | function readServerConfig( server ) {
try {
const severConfig = getConfig( appSeverConfig );
return Right( Object.assign( server, severConfig ));
} catch ( e ) {
print(
| javascript | {
"resource": ""
} |
q10574 | readWebpackConfig | train | function readWebpackConfig( server ) {
const devConfig = server.webpackConfig && server.webpackConfig.dev;
const configFile = paths.resolveApp( devConfig ) || appWebpackDevConfig;
try {
assert(
existsSync( configFile ),
`File ${devConfig || WEBPACK_DEV_CONFIG} is not exsit.`
);
const w... | javascript | {
"resource": ""
} |
q10575 | Babbler | train | function Babbler (id) {
if (!(this instanceof Babbler)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
if (!id) {
throw new Error('id required');
}
this.id = id;
this.listeners = []; | javascript | {
"resource": ""
} |
q10576 | flattenAll | train | function flattenAll() {
var result = [];
for (var role in permissions) | javascript | {
"resource": ""
} |
q10577 | flatten | train | function flatten(role) {
var children = permissions[role] || [];
var result = [role];
for (var i in children) {
| javascript | {
"resource": ""
} |
q10578 | getParent | train | function getParent(role) {
var result = [];
for (var parentRole in permissions) {
if (permissions[parentRole].indexOf(role) > -1) {
result.push(parentRole);
| javascript | {
"resource": ""
} |
q10579 | iszero | train | function iszero(x, tolerance) {
if (tolerance === void 0) { tolerance = constants_1.EPSILON; }
// the 'less-than-equal' comparision | javascript | {
"resource": ""
} |
q10580 | isequal | train | function isequal(a, b, tolerance) {
if (tolerance === void 0) { tolerance | javascript | {
"resource": ""
} |
q10581 | range | train | function range(a, b) {
if (b === undefined) {
b = a;
a = 0;
}
b = Math.max(b, 0);
| javascript | {
"resource": ""
} |
q10582 | eye | train | function eye(arg0, datatype) {
var n, m;
if (Array.isArray(arg0)) {
n = arg0[0];
if (arg0.length > 1) {
m = arg0[1];
}
else {
| javascript | {
"resource": ""
} |
q10583 | zeros | train | function zeros(arg0, datatype) {
var A;
if (Array.isArray(arg0)) {
A = new ndarray_1.NDArray({ shape: arg0, datatype: datatype });
}
else {
| javascript | {
"resource": ""
} |
q10584 | empty | train | function empty(arg0, datatype) {
var A;
if (Array.isArray(arg0)) {
A = new ndarray_1.NDArray({ shape: arg0, datatype: datatype });
}
else {
| javascript | {
"resource": ""
} |
q10585 | cross | train | function cross(A, B) {
if (A.shape.length !== 1 || B.shape.length !== 1) {
throw new Error('A or B is not 1D');
}
if (A.length < 3 || B.length < 3) {
throw new Error('A or B is less than 3 in length');
}
var a1 = A.getN(0);
var a2 = A.getN(1);
var a3 = A.getN(2);
| javascript | {
"resource": ""
} |
q10586 | length | train | function length(A) {
if (A.shape.length !== 1) {
throw new Error('A is not | javascript | {
"resource": ""
} |
q10587 | dir | train | function dir(A) {
if (A.shape.length !== 1) {
throw new Error('A is not a | javascript | {
"resource": ""
} |
q10588 | IIf | train | function IIf (condition, trueBlock, falseBlock) {
if (!(this instanceof IIf)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
if (typeof condition === 'function') {
this.condition = condition;
}
else if (condition instanceof RegExp) {
this.condition = function (mess... | javascript | {
"resource": ""
} |
q10589 | train | function () {
return Token.destroy({
where: {
code: req.get('token')
}
}).then(function (data) {
| javascript | {
"resource": ""
} | |
q10590 | train | function (roles) {
roles.map(function (role) {
return Role.findOrCreate({
where: {
code: role,
ownerId: req[options.auth.model].id
},
defaults: {
code: role,
... | javascript | {
"resource": ""
} | |
q10591 | train | function (role) {
return Role.destroy({
where: {
code: role,
ownerId: req[options.auth.model].id
},
| javascript | {
"resource": ""
} | |
q10592 | train | function (role) {
return Role.count({
where: {
code: role,
ownerId: req[options.auth.model].id
| javascript | {
"resource": ""
} | |
q10593 | train | function (roles) {
return Role.count({
where: {
code: {
$in: roles
},
ownerId: req[options.auth.model].id
}
| javascript | {
"resource": ""
} | |
q10594 | create | train | function create(key, value) {
if (!Buffer.isBuffer(key)) {
throw new TypeError('expected buffer')
}
return {
key,
| javascript | {
"resource": ""
} |
q10595 | compare | train | function compare(tree_key, key) {
let buf
if (Buffer.isBuffer(key)) {
buf = key
} else if (typeof key == 'string') {
buf = Buffer.from(key)
} else {
| javascript | {
"resource": ""
} |
q10596 | lookup | train | function lookup(tree, key) {
if (!tree) {
return null
}
switch (compare(tree.key, key)) {
case 0:
return tree
case 1:
| javascript | {
"resource": ""
} |
q10597 | train | function( definitions, path ) {
//region Search engine properties
/**
* Gets the title of the document.
* @type {string}
* @readonly
*/
this.title = '';
/**
* Gets the keywords of the document.
* @type {string}
* @readonly
*/
this.keywords = '';
/**
* Gets the description of t... | javascript | {
"resource": ""
} | |
q10598 | findLeadingComments | train | function findLeadingComments(comments, index, beginIndex, first) {
const leadComments = [];
if (first && ignoreComment.test(comments[index].raw)) {
return leadComments;
}
let backIndex = index - 1;
while (backIndex >= beginIndex &&
(comments[backIndex].loc.end.line + 1 === comments[b... | javascript | {
"resource": ""
} |
q10599 | loadTo | train | function loadTo(S) {
/**
* Takes a non-empty list as its argument and return the first member of the argument.
* @param {list} l
* @returns {*}
* @example
* // returns 1
* car([1, 2]);
*/
S.car = (l) => {
if (S.isAtom(l) || S.isNull(l)) {
throw new TypeError('The Law of Car: You can... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.