_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
27
233k
language
stringclasses
1 value
meta_information
dict
q12100
initRedis
train
function initRedis() { return when.promise((resolve, reject) => { redis.get(name, (err, res) => { if(err) { memStore = {}; } else if(res) { memStore
javascript
{ "resource": "" }
q12101
syncRedis
train
function syncRedis() { // if memStore has changed... if(JSON.stringify(memCache) !== JSON.stringify(memStore)) { return when.promise((resolve, reject) => { var serializedStore = JSON.stringify(memStore); redis.set(name, serializedStore, err => { if(err) { reject(err);...
javascript
{ "resource": "" }
q12102
getKoaLogger
train
function getKoaLogger (logger4js, options) { if (typeof options === 'object') { options = options || {} } else if (options) { options = { format: options } } else { options = {} } let thislogger = logger4js let level = levels.getLevel(options.level, levels.INFO) let fmt = options.format || DE...
javascript
{ "resource": "" }
q12103
format
train
function format (str, tokens) { for (let i = 0; i < tokens.length;
javascript
{ "resource": "" }
q12104
createNoLogCondition
train
function createNoLogCondition (nolog) { let regexp = null if (nolog) { if (nolog instanceof RegExp) { regexp = nolog } if (typeof nolog === 'string') {
javascript
{ "resource": "" }
q12105
log
train
function log(msg, color) { if (typeof(msg) === 'object') { for (var item in msg) { if (msg.hasOwnProperty(item)) { if(color && color in $.util.colors) {
javascript
{ "resource": "" }
q12106
clean
train
function clean(path, done) { log('Cleaning: ' + $.util.colors.green(path));
javascript
{ "resource": "" }
q12107
bytediffFormatter
train
function bytediffFormatter(data) { var difference = (data.savings > 0) ? ' smaller.' : ' larger.'; return data.fileName + ' went from ' + (data.startSize / 1000).toFixed(2) + ' kB to ' +
javascript
{ "resource": "" }
q12108
train
function() { let options = {}; tap(Mix.paths.root('.babelrc'), babelrc => { if (File.exists(babelrc)) { options = JSON.parse(File.find(babelrc).read()); } }); if (this.babelConfig) { options = webpackMe...
javascript
{ "resource": "" }
q12109
MixDefinitionsPlugin
train
function MixDefinitionsPlugin(envPath) { expand(
javascript
{ "resource": "" }
q12110
train
function (name) { // @option imagePath: String // `Icon.Default` will try to auto-detect the location of // the blue icon images. If you are placing these images in a // non-standard way, set this option to point to the right // path, before any marker is added to a map. // Caution: do not use this option w...
javascript
{ "resource": "" }
q12111
train
function (imagePath) { this._setOptions('icon', _detectIconOptions, imagePath); this._setOptions('shadow', _detectIconOptions, imagePath); this._setOptions('popup',
javascript
{ "resource": "" }
q12112
train
function (name, detectorFn, imagePath) { var options = this.options, prefix = options.classNamePrefix, optionValues =
javascript
{ "resource": "" }
q12113
_getStyle
train
function _getStyle(el, style) { return L.DomUtil.getStyle(el, style) ||
javascript
{ "resource": "" }
q12114
fadeIn
train
function fadeIn(el) { el.style.opacity = 0; el.style.display = "block"; (function fadeIn() {
javascript
{ "resource": "" }
q12115
copy
train
function copy(from, to) { var name; for (name in from) { if (from.hasOwnProperty(name)) {
javascript
{ "resource": "" }
q12116
matchesCustom
train
function matchesCustom(ctx, opts) { if (opts.custom) {
javascript
{ "resource": "" }
q12117
matchesPath
train
function matchesPath(requestedUrl, opts) { var paths = !opts.path || Array.isArray(opts.path) ? opts.path : [opts.path]; if (paths) { return paths.some(function(p) { return (typeof p ===
javascript
{ "resource": "" }
q12118
matchesExtension
train
function matchesExtension(requestedUrl, opts) { var exts = !opts.ext || Array.isArray(opts.ext) ? opts.ext : [opts.ext]; if (exts) { return exts.some(function(ext) {
javascript
{ "resource": "" }
q12119
matchesMethod
train
function matchesMethod(method, opts) { var methods = !opts.method || Array.isArray(opts.method) ? opts.method : [opts.method];
javascript
{ "resource": "" }
q12120
startRtm
train
function startRtm (token) { api.rtm.start(token, (err, bot) => { if (err) { return console.log(err) } bot.on(/hello/, (bot, message) => { bot.reply(message, 'GO
javascript
{ "resource": "" }
q12121
sendToClient
train
function sendToClient (message, client) { return new Promise((resolve, reject) => { try { client.send(JSON.stringify(message), (e) => { if (e) { logger.error(`could not send rtm message to client`, e) return reject(e)
javascript
{ "resource": "" }
q12122
scrollableElement
train
function scrollableElement(els) { for (var i = 0, argLength = arguments.length; i <argLength; i++) { var el = arguments[i], $scrollElement = $(el); if ($scrollElement.scrollTop()> 0) { return el; } else { $scrollElement.scrollTop(1);
javascript
{ "resource": "" }
q12123
instantiationError
train
function instantiationError(injector, originalException, originalStack, key) { return injectionError(injector, key, function () { var /** @type {?} */ first = stringify(this.keys[0].token); return getOriginalError(this).message + ":
javascript
{ "resource": "" }
q12124
templateVisitAll
train
function templateVisitAll(visitor, asts, context) { if (context === void 0) { context = null; } var /** @type {?} */ result = []; var /** @type {?} */ visit = visitor.visit ? function (ast) { return visitor.visit(ast, context) || ast.visit(visitor, context); } : function (ast) {
javascript
{ "resource": "" }
q12125
can
train
function can(rbac, action, resource, cb) { // check existance of permission rbac.getPermission(action, resource, (err, permission) => { if (err) { return cb(err); } if (!permission) { return cb(null, false); } // check user additional permissions if (indexOf(this.permissions, p...
javascript
{ "resource": "" }
q12126
addPermission
train
function addPermission(rbac, action, resource, cb) { rbac.getPermission(action, resource, (err, permission) => { if (err) { return cb(err); } if (!permission) { return cb(new Error('Permission not exists')); } if (indexOf(this.permissions, permission.name) !==
javascript
{ "resource": "" }
q12127
hasRole
train
function hasRole(rbac, role, cb) { if (!this.role) { cb(null, false);
javascript
{ "resource": "" }
q12128
addcalendarExtenderToDateInputs
train
function addcalendarExtenderToDateInputs () { //get and loop all the input[type=date]s in the page that dont have "haveCal" class yet var dateInputs = document.querySelectorAll('input[type=date]:not(.haveCal)'); [].forEach.call(dateInputs, function (dateInput) {
javascript
{ "resource": "" }
q12129
train
function(data, done) { try { // Retrieve all the dependencies _.forEach(data._dependencies || {}, function(value, key) { if(this.sandbox[key] !== undefined) { // Do nothing if the dependency is already defined ...
javascript
{ "resource": "" }
q12130
train
function(ref) { var keys = ref.split('.'), key = keys.shift(), result = _this.result[key]; if(!result) { // If the result does not exist, return an empty throw new TypeError('Could not read property \'' + key + '\' from undefined')...
javascript
{ "resource": "" }
q12131
train
function(data, options, callback) { if(_.isFunction(options)) { // Set the correct callback function callback = options; options = {}; } // Create a deferred object for the promise var def = Q.defer(); // If no...
javascript
{ "resource": "" }
q12132
done
train
function done(err, result) { if(err) { def.reject(err); callback(err); return;
javascript
{ "resource": "" }
q12133
proxyConfig
train
function proxyConfig(path) { const config = {} const {endpointsExtension} = tryGetGraphQLProjectConfig() if (endpointsExtension) { const graphqlEndpoint = endpointsExtension.getEndpoint() const {url: target, headers} = graphqlEndpoint const changeOrigin =
javascript
{ "resource": "" }
q12134
train
function(source, options) { try { return prettify(source, options); } catch (e) { console.error(e);
javascript
{ "resource": "" }
q12135
refresh
train
function refresh() { if( active ) { requestAnimFrame( refresh ); for( var i = 0,
javascript
{ "resource": "" }
q12136
add
train
function add( element, options ) { // Only allow ul/ol if( !element.nodeName || /^(ul|li)$/i.test( element.nodeName ) === false ) { return false; } // Delete duplicates (but continue and re-bind this list to get the // latest properties and list items) else if( contains( element ) ) { ...
javascript
{ "resource": "" }
q12137
remove
train
function remove( element ) { for( var i = 0; i < lists.length; i++ ) { var list = lists[i]; if( list.element == element ) { list.destroy(); lists.splice( i, 1 ); i--;
javascript
{ "resource": "" }
q12138
contains
train
function contains( element ) { for( var i = 0, len = lists.length; i < len;
javascript
{ "resource": "" }
q12139
batch
train
function batch( target, method, options ) { var i, len; // Selector if( typeof target === 'string' ) { var targets = document.querySelectorAll( target ); for( i = 0, len = targets.length; i < len; i++ ) { method.call( null, targets[i], options );
javascript
{ "resource": "" }
q12140
TouchList
train
function TouchList( element ) { this.element = element; this.element.style.overflow = 'hidden'; this.top = { value: 0, natural: 0 }; this.touch = { value: 0, offset: 0, start: 0,
javascript
{ "resource": "" }
q12141
displayMetrics
train
function displayMetrics(file) { var prefix = ''; var code = fs.readFileSync(file, 'utf-8'); // We remove any shebang at the start of the file since that isn't valid // Javascript and will trip up the parser. code = code.replace(/^#!.*\n/, ''); var metrics = complexity(code); // Walk the...
javascript
{ "resource": "" }
q12142
walk
train
function walk(data, name) { // Fade out anonymous functions. if (name.indexOf('anon@') === 0) { name = name.grey; } rows.push([ prefix + name, data.ecc, data.arity, data.codeLines, data.commentLines, Math.round(100 * data.commentLines / data.codeLines) ]); // Add
javascript
{ "resource": "" }
q12143
train
function(v) { var t = this.t, //refers to the element's style property filters = t.filter || _getStyle(this.data, "filter") || "", val = (this.s + this.c * v) | 0, skip; if (val === 100) { //for older versions of IE that need to use a filter to apply opacity, we should remove the filter if opacit...
javascript
{ "resource": "" }
q12144
isVisualViewport
train
function isVisualViewport ( name ) { var viewport = isString( name ) && name.toLowerCase(); if ( name && !viewport ) throw new Error( "Invalid viewport option: " + name ); if ( viewport
javascript
{ "resource": "" }
q12145
restoreGlobalDocument
train
function restoreGlobalDocument ( previousState ) { if ( previousState.documentElement.modified ) document.documentElement.style.overflowX = previousState.documentElement.styleOverflowX;
javascript
{ "resource": "" }
q12146
guessDocumentSize
train
function guessDocumentSize( dimension, _document ) { var ddE = _document.documentElement; return Math.max( ddE.body[ "scroll" + dimension ], _document[ "scroll" + dimension ],
javascript
{ "resource": "" }
q12147
getWindowInnerSize
train
function getWindowInnerSize ( dimension, _window ) { var size = ( _window || window ).visualViewport ? ( _window || window ).visualViewport[ dimension.toLowerCase() ] : ( _window || window )[ "inner" + dimension];
javascript
{ "resource": "" }
q12148
getIEVersion
train
function getIEVersion () { var userAgent, userAgentTestRx; if ( ieVersion === undefined ) { ieVersion = false; userAgent = navigator && navigator.userAgent; if ( navigator && navigator.appName === "Microsoft Internet Explorer" && userAgent ) { userA...
javascript
{ "resource": "" }
q12149
train
function() { this.$container = $(this.options.buttonContainer); this.$container.on('show.bs.dropdown', this.options.onDropdownShow);
javascript
{ "resource": "" }
q12150
train
function() { if (typeof this.options.selectAllValue === 'number') { this.options.selectAllValue = this.options.selectAllValue.toString(); } var alreadyHasSelectAll = this.hasSelectAll(); if (!alreadyHasSelectAll && this.options.includeSelectAllOption && ...
javascript
{ "resource": "" }
q12151
train
function (justVisible) { var justVisible = typeof justVisible === 'undefined' ? true : justVisible; if(justVisible) { var visibleCheckboxes = $("li input[type='checkbox']:not(:disabled)", this.$ul).filter(":visible"); visibleCheckboxes.prop('checked', false); ...
javascript
{ "resource": "" }
q12152
train
function() { this.$ul.html(''); // Important to distinguish between radios and checkboxes. this.options.multiple = this.$select.attr('multiple') === "multiple"; this.buildSelectAll(); this.buildDropdownOptions(); this.buildFilter(); ...
javascript
{ "resource": "" }
q12153
train
function() { if (this.hasSelectAll()) { var allBoxes = $("li:not(.multiselect-item):not(.filter-hidden) input:enabled", this.$ul); var allBoxesLength = allBoxes.length; var checkedBoxesLength = allBoxes.filter(":checked").length; var selectAllL...
javascript
{ "resource": "" }
q12154
extend
train
function extend(obj, extObj) { var a, b, i; if (arguments.length > 2) { for (a = 1, b = arguments.length; a < b; a += 1) { extend(obj, arguments[a]); } } else {
javascript
{ "resource": "" }
q12155
toCamel
train
function toCamel(string) { if (string === null || string === undefined) { return ""; }
javascript
{ "resource": "" }
q12156
removeClass
train
function removeClass(element, value) { var class2remove = value || "", cur = element.nodeType === 1 && (element.className ? (" " + element.className + " ").replace(rclass, " ") : ""); if (cur) { while (cur.indexOf(" " + class2remove + " ") >=
javascript
{ "resource": "" }
q12157
setVersion
train
function setVersion(versionType, versionFull) { versionType.version = versionFull; var versionArray = versionFull.split("."); if (versionArray.length > 0) { versionArray = versionArray.reverse(); versionType.major = versionArray.pop(); if (versionArray.length ...
javascript
{ "resource": "" }
q12158
getBoundingClientRectCompat
train
function getBoundingClientRectCompat ( elem ) { var elemRect = elem.getBoundingClientRect(); if ( elemRect.width === undefined || elemRect.height === undefined ) { // Fix for IE8
javascript
{ "resource": "" }
q12159
getAppliedOverflows
train
function getAppliedOverflows ( props, createBooleans ) { var status = {}; // Establish the applied overflow (e.g. overflowX: "scroll") status.overflowX = props.overflowX || props.overflow || "visible"; status.overflowY = props.overflowY || props.overflow || "visible"; // Create the derived boolean...
javascript
{ "resource": "" }
q12160
getAppliedViewportOverflows
train
function getAppliedViewportOverflows ( documentElementProps, bodyProps ) { var _window = getAppliedOverflows( documentElementProps, false ), body = getAppliedOverflows( bodyProps, false ), consolidated = { window: {}, body: {} }; // Handle the interdependent relation between body and window (do...
javascript
{ "resource": "" }
q12161
scaleLog
train
function scaleLog () { var zoomFactor = $.pinchZoomFactor(), logProps = { top: ( initialLogProps.top / zoomFactor ) + "px", left: ( initialLogProps.left / zoomFactor ) + "px", paddingTop: ( initialLogProps.pa...
javascript
{ "resource": "" }
q12162
injectElementWithStyles
train
function injectElementWithStyles(rule, callback, nodes, testnames) { var mod = 'modernizr'; var style; var ret; var node; var docOverflow; var div = createElement('div'); var body = getBody(); if (parseInt(nodes, 10)) { // In order not to give false positives we create a node for ...
javascript
{ "resource": "" }
q12163
htmlAsEntities
train
function htmlAsEntities(html){ html = html.replace(/&/g, '&amp;'); html = html.replace(/>/g, '&gt;');
javascript
{ "resource": "" }
q12164
map
train
function map(obj, callback){ var result = {}; Object.keys(obj).forEach(function(key){ result[key]
javascript
{ "resource": "" }
q12165
sanitizeHtml
train
function sanitizeHtml(html){ var separator = '/'; if(html.constructor === Object){ return map(html, function(value){ var sanitizedHtml = value.split(separator) .map(sanitizeHtml) .join(separator); return sanitizedHtml; }); } else if(ht...
javascript
{ "resource": "" }
q12166
_isInView
train
function _isInView ( elem, config ) { var containerWidth, containerHeight, hTolerance, vTolerance, rect, container = config.container, $container = config.$container, cache = config.cache, elemInView = true; if ( elem === container ) throw new Error( "In...
javascript
{ "resource": "" }
q12167
getRelativeRect
train
function getRelativeRect ( rect, $container, cache ) { var containerPaddingRectRoot; if ( cache && cache.containerPaddingRectRoot ) { containerPaddingRectRoot = cache.containerPaddingRectRoot; } else { // gBCR coordinates enclose padding, and leave out margin. That is ...
javascript
{ "resource": "" }
q12168
getContentRect
train
function getContentRect( elem ) { var rect = elem.getBoundingClientRect(), props = getCss( elem, [ "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"
javascript
{ "resource": "" }
q12169
wrapContainer
train
function wrapContainer ( container ) { var $container, isJquery = container instanceof $; if ( ! isJquery && ! $.isWindow( container ) && ! container.nodeType && ! isString( container ) ) throw new Error( 'Invalid container: not a window, node, jQuery object or selector string' ); ...
javascript
{ "resource": "" }
q12170
checkOptions
train
function checkOptions ( opts ) { var isNum, isNumWithUnit; if ( opts.direction && !( opts.direction === 'vertical' || opts.direction === 'horizontal' || opts.direction === 'both' ) ) { throw new Error( 'Invalid option value: direction = "' + opts.direction + '"' ); } if ( o...
javascript
{ "resource": "" }
q12171
getContainerScrollbarWidths
train
function getContainerScrollbarWidths ( $container, cache ) { var containerScrollbarWidths; if ( cache && cache.containerScrollbarWidths ) { containerScrollbarWidths = cache.containerScrollbarWidths;
javascript
{ "resource": "" }
q12172
getCss
train
function getCss ( elem, properties, opts ) { var i, length, name, props = {}, _window = ( elem.ownerDocument.defaultView || elem.ownerDocument.parentWindow ), computedStyles = _useGetComputedStyle ? _window.getComputedStyle( elem, null ) : elem.currentStyle; opts || ...
javascript
{ "resource": "" }
q12173
isIOS
train
function isIOS () { if ( _isIOS === undefined ) _isIOS = (/iPad|iPhone|iPod/g).test(
javascript
{ "resource": "" }
q12174
toFloat
train
function toFloat ( object ) { var transformed = {}; $.map( object, function ( value, key ) {
javascript
{ "resource": "" }
q12175
createChildWindow
train
function createChildWindow ( readyDfd, size ) { var childWindow, width, height, sizedDefaultProps = ",top=0,left=0,location=no,menubar=no,status=no,toolbar=no,resizeable=yes,scrollbars=yes"; if ( size ) { width = size === "parent" ? window.document.documentElement.clientWidth : size.width; ...
javascript
{ "resource": "" }
q12176
createIframe
train
function createIframe ( opts ) { var parent = ( opts && opts.parent ) ? ( varExists( $ ) && opts.parent instanceof $ ) ? opts.parent[0] : opts.parent : document.body, _document = parent.ownerDocument, iframe = _document.createElement( "iframe" ); opts || ( opts = {} ); if ( opts.elementSty...
javascript
{ "resource": "" }
q12177
createIframeDocument
train
function createIframeDocument ( iframe, documentStyles ) { if ( varExists( $ ) && iframe instanceof $ ) iframe = iframe[0]; if ( ! iframe.ownerDocument.body.contains( iframe ) ) throw new Error( "The iframe has not been appended to the DOM, or is not a descendant of the body element. Can't create an iframe con...
javascript
{ "resource": "" }
q12178
windowSizeReady
train
function windowSizeReady ( queriedWindow, readyDfd, interval ) { if ( !varExists( $ ) ) throw new Error( "This method uses jQuery deferreds, but the $ variable is not available" ); if ( queriedWindow instanceof $ ) queriedWindow = queriedWindow[0]; readyDfd || ( readyDfd = $.Deferred() ); $( queried...
javascript
{ "resource": "" }
q12179
validateWindowSize
train
function validateWindowSize ( expected, opts ) { var msg = "", documentElement = ( opts && opts.window || window ).document.documentElement, width = documentElement.clientWidth, height = documentElement.clientHeight; if ( opts && opts.exactly ) { if ( width !== expected.width ) ...
javascript
{ "resource": "" }
q12180
forceReflow
train
function forceReflow ( element ) { if ( !varExists( $ ) ) throw new Error( "This method uses jQuery, but the $ variable is not available" ); var $element = element instanceof $ ? element
javascript
{ "resource": "" }
q12181
isIE
train
function isIE ( opts ) { var ver = getIEVersion(), isMatch = ver !== 0; opts || ( opts = {} ); if ( isMatch && opts.eq ) isMatch = ver === opts.eq; if ( isMatch && opts.lt ) isMatch = ver < opts.lt; if ( isMatch && opts.lte ) isMatch = ver <= opts.lte; if (
javascript
{ "resource": "" }
q12182
getIEVersion
train
function getIEVersion () { var ieMatch = /MSIE (\d+)/.exec( navigator.userAgent ) ||
javascript
{ "resource": "" }
q12183
removeEmptySources
train
function removeEmptySources (sources) { return _.reject(sources, function (obj) {
javascript
{ "resource": "" }
q12184
train
function(){ var self = this; var camera = self.el.sceneEl.camera; if(camera) { var camera_rotation = camera.el.getAttribute("rotation"); var camera_yaw = camera_rotation.y; // Set position of menu based on camera yaw and data.pitch // Have to add 1.6m to camera.positio...
javascript
{ "resource": "" }
q12185
validateObject
train
function validateObject (object = {}, label, schema, options) { // Skip validation if no schema is provided if (schema) { // Validate the object against the provided
javascript
{ "resource": "" }
q12186
validate
train
function validate (validationObj) { // Return a Koa middleware function return (ctx, next) => { try { // Validate each request data object in the Koa context object validateObject(ctx.headers, 'Headers', validationObj.headers, { allowUnknown: true }) validateObject(ctx.params,
javascript
{ "resource": "" }
q12187
train
function (protocol, host, port, username, password, onConnected) { this.rocketChatClient = new RocketChatClient(protocol, host, port, username, password, onConnected); this.token = null; /** * login the rocket chat * @param callback after login the rocket chat , will invoke the callback function ...
javascript
{ "resource": "" }
q12188
resizeWordsCloud
train
function resizeWordsCloud() { $timeout(function() { var element = document.getElementById('wordsCloud'); var height = $window.innerHeight * 0.75; element.style.height = height + 'px'; var width = element.getBoundingClientRect().width; var maxCount = o...
javascript
{ "resource": "" }
q12189
train
function(records,config) { //the hell is this doing here this.id = new Date(); if ( records instanceof Array ) { this.records = records; } else { var dataField = records.data; var data = records.datasource; this.records = data[dataField]; } this.config = co...
javascript
{ "resource": "" }
q12190
train
function (req, res) { // check for a user id if (!req[this.paramName]._id) { return res.badRequest(); } req[this.paramName].password = req.body.password; delete req.body.password;
javascript
{ "resource": "" }
q12191
train
function (req, res, next) { var userId = req[this.paramName]._id; var oldPass = String(req.body.oldPassword); var newPass = String(req.body.newPassword); this.model.findOne({'_id': userId}, function (err, user) { if (user.authenticate(oldPass)) { user.password = newPass; user.sav...
javascript
{ "resource": "" }
q12192
train
function (req, res, next) { if (!req.userInfo) {
javascript
{ "resource": "" }
q12193
handleError
train
function handleError(err, options) { // jshint validthis: true // Get access to response object var res = this.res; var statusCode; console.log('handleError', err, options); if (err.name && err.name === 'ValidationError') { return res.badRequest(err); } try { statusCode = err.status || 500; ...
javascript
{ "resource": "" }
q12194
validateUniqueName
train
function validateUniqueName(value, respond) { // jshint validthis: true var self = this; // check for uniqueness of user name this.constructor.findOne({name: value}, function (err, user) { if (err) { throw err; } if (user) {
javascript
{ "resource": "" }
q12195
preSave
train
function preSave(next) { // jshint validthis: true var self = this; if (this.isNew && !validatePresenceOf(this.hashedPassword)) { return next(new MongooseError.ValidationError('Missing password')); } // check if the root user should be updated // return an error if some not root tries to touch the roo...
javascript
{ "resource": "" }
q12196
preRemove
train
function preRemove(next) { // jshint validthis: true if (auth.roles.isRoot(this.role))
javascript
{ "resource": "" }
q12197
getAuthentication
train
function getAuthentication(authModel, config) { /** * @name authenticate * @function * @memberOf getAuthentication * Authenticate the user. * @param {String} name - The name used to authenticate the user * @param {String} password - The hashed password * @param {function} done - The callback fun...
javascript
{ "resource": "" }
q12198
authenticate
train
function authenticate(req, res, next) { var callback = _.bind(authCallback, {req: req, res: res});
javascript
{ "resource": "" }
q12199
CrudController
train
function CrudController(model, idName) { // call super constructor BaseController.call(this); // set the model instance to work on this.model = model; // set id name
javascript
{ "resource": "" }