_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q62900
bemNames
test
function bemNames(entitys, delimiters) { var resultString = ''; var names = entitys || { mods: {}, mixin: '' }; var delims = _extends({ ns: '', el: '__', mod: '--', modVal: '-' }, delimiters); var mixin = isString(names.mixin) ? ' ' + names.mixin : ''; if (!names.block) return ''; resultS...
javascript
{ "resource": "" }
q62901
deepMergeConfigs
test
function deepMergeConfigs(configs, options) { return merge.all(configs.filter(config => config), options); }
javascript
{ "resource": "" }
q62902
loadYaml
test
async function loadYaml(context, params) { try { const response = await context.github.repos.getContents(params); return parseConfig(response.data.content); } catch (e) { if (e.code === 404) { return null; } throw e; } }
javascript
{ "resource": "" }
q62903
getBaseParams
test
function getBaseParams(params, base) { if (typeof base !== 'string') { throw new Error(`Invalid repository name in key "${BASE_KEY}"`); } const match = base.match(BASE_REGEX); if (match == null) { throw new Error(`Invalid repository name in key "${BASE_KEY}": ${base}`); } return { owner: match...
javascript
{ "resource": "" }
q62904
getConfig
test
async function getConfig(context, fileName, defaultConfig, deepMergeOptions) { const filePath = path.posix.join(CONFIG_PATH, fileName); const params = context.repo({ path: filePath, }); const config = await loadYaml(context, params); let baseRepo; if (config == null) { baseRepo = DEFAULT_BASE; } ...
javascript
{ "resource": "" }
q62905
defineProperty
test
function defineProperty (obj, name, value) { var enumerable = !!obj[name] && obj.propertyIsEnumerable(name) Object.defineProperty(obj, name, { configurable: true, enumerable: enumerable, writable: true, value: value }) }
javascript
{ "resource": "" }
q62906
shimmer
test
function shimmer (options) { if (options && options.logger) { if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing") else logger = options.logger } }
javascript
{ "resource": "" }
q62907
injectManifest
test
function injectManifest(data) { let manifestHtml = `<head><link rel=manifest href=${hexo.config.pwa.manifest.path}>`; if (data.indexOf(manifestHtml) === -1) { data = data.replace('<head>', manifestHtml); } return data; }
javascript
{ "resource": "" }
q62908
injectSWRegister
test
function injectSWRegister(data) { let swHtml = `<script>${compiledSWRegTpl}</script></body>`; if (data.indexOf(compiledSWRegTpl) === -1) { data = data.replace('</body>', swHtml); } return data; }
javascript
{ "resource": "" }
q62909
injectAsyncLoadPageJS
test
function injectAsyncLoadPageJS(data) { let injectHtml = `<script>${asyncLoadPageJSTpl}</script>`; if (data.indexOf(injectHtml) === -1) { data = data.replace('</head>', injectHtml); } return data; }
javascript
{ "resource": "" }
q62910
rehype2react
test
function rehype2react(options) { var settings = options || {}; var createElement = settings.createElement; var components = settings.components || {}; this.Compiler = compiler; /* Compile HAST to React. */ function compiler(node) { if (node.type === 'root') { if (node.children.length === 1 && no...
javascript
{ "resource": "" }
q62911
doExec
test
function doExec(method, args) { var cp; var cpPromise = new ChildProcessPromise(); var reject = cpPromise._cpReject; var resolve = cpPromise._cpResolve; var finalArgs = slice.call(args, 0); finalArgs.push(callback); cp = child_process[method].apply(child_process, finalArgs); function ...
javascript
{ "resource": "" }
q62912
doSpawn
test
function doSpawn(method, command, args, options) { var result = {}; var cp; var cpPromise = new ChildProcessPromise(); var reject = cpPromise._cpReject; var resolve = cpPromise._cpResolve; var successfulExitCodes = (options && options.successfulExitCodes) || [0]; cp = method(command, args...
javascript
{ "resource": "" }
q62913
slope2
test
function slope2(that, t) { var h = that._x1 - that._x0; return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; }
javascript
{ "resource": "" }
q62914
shouldSetAttribute
test
function shouldSetAttribute(name, value) { if (isReservedProp(name)) { return false; } if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { return false; } if (value === null) { return true; } switch (typeof value) { case 'boolean': r...
javascript
{ "resource": "" }
q62915
createMarkupForProperty
test
function createMarkupForProperty(name, value) { var propertyInfo = getPropertyInfo(name); if (propertyInfo) { if (shouldIgnoreValue(propertyInfo, value)) { return ''; } var attributeName = propertyInfo.attributeName; if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue &&...
javascript
{ "resource": "" }
q62916
trapBubbledEvent
test
function trapBubbledEvent(topLevelType, handlerBaseName, element) { if (!element) { return null; } return EventListener.listen(element, handlerBaseName, dispatchEvent.bind(null, topLevelType)); }
javascript
{ "resource": "" }
q62917
createUpdateQueue
test
function createUpdateQueue(baseState) { var queue = { baseState: baseState, expirationTime: NoWork, first: null, last: null, callbackList: null, hasForceUpdate: false, isInitialized: false }; { queue.isProcessing = false; } return queue; }
javascript
{ "resource": "" }
q62918
mountClassInstance
test
function mountClassInstance(workInProgress, renderExpirationTime) { var current = workInProgress.alternate; { checkClassInstance(workInProgress); } var instance = workInProgress.stateNode; var state = instance.state || null; var props = workInProgress.pendingProps; !props ? invarian...
javascript
{ "resource": "" }
q62919
requestWork
test
function requestWork(root, expirationTime) { if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinit...
javascript
{ "resource": "" }
q62920
shouldYield
test
function shouldYield() { if (deadline === null) { return false; } if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) { return false; } deadlineDidExpire = true; return true; }
javascript
{ "resource": "" }
q62921
deleteValueForProperty
test
function deleteValueForProperty(node, name) { var propertyInfo = getPropertyInfo(name); if (propertyInfo) { var mutationMethod = propertyInfo.mutationMethod; if (mutationMethod) { mutationMethod(node, undefined); } else if (propertyInfo.mustUseProperty) { var propName = propertyInfo.property...
javascript
{ "resource": "" }
q62922
updateProperties$1
test
function updateProperties$1(domElement, updatePayload, tag, lastRawProps, nextRawProps) { var wasCustomComponentTag = isCustomComponent(tag, lastRawProps); var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff. updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, is...
javascript
{ "resource": "" }
q62923
sympact
test
async function sympact(code, options) { if (typeof code !== 'string') { throw new TypeError("The 'code' paramater must a string'"); } if (typeof options === 'undefined') { options = {}; } if (typeof options !== 'object') { throw new TypeError("The 'options' paramater must an object'"); } const...
javascript
{ "resource": "" }
q62924
ExponentialBackoffStrategy
test
function ExponentialBackoffStrategy(options) { BackoffStrategy.call(this, options); this.backoffDelay_ = 0; this.nextBackoffDelay_ = this.getInitialDelay(); this.factor_ = ExponentialBackoffStrategy.DEFAULT_FACTOR; if (options && options.factor !== undefined) { precond.checkArgument(options...
javascript
{ "resource": "" }
q62925
Backoff
test
function Backoff(backoffStrategy) { events.EventEmitter.call(this); this.backoffStrategy_ = backoffStrategy; this.maxNumberOfRetry_ = -1; this.backoffNumber_ = 0; this.backoffDelay_ = 0; this.timeoutID_ = -1; this.handlers = { backoff: this.onBackoff_.bind(this) }; }
javascript
{ "resource": "" }
q62926
FunctionCall
test
function FunctionCall(fn, args, callback) { events.EventEmitter.call(this); precond.checkIsFunction(fn, 'Expected fn to be a function.'); precond.checkIsArray(args, 'Expected args to be an array.'); precond.checkIsFunction(callback, 'Expected callback to be a function.'); this.function_ = fn; ...
javascript
{ "resource": "" }
q62927
Channel
test
function Channel(connection, name, options) { options || (options = {}); options.capped = true; // In mongo v <= 2.2 index for _id is not done by default options.autoIndexId = true; options.size || (options.size = 1024 * 1024 * 5); options.strict = false; this.options = options; this.co...
javascript
{ "resource": "" }
q62928
Connection
test
function Connection(uri, options) { var self = this; options || (options = {}); options.autoReconnect != null || (options.autoReconnect = true); // It's a Db instance. if (uri.collection) { this.db = uri; } else { MongoClient.connect(uri, options, function (err, db) { ...
javascript
{ "resource": "" }
q62929
Draggable
test
function Draggable(target, options) { if (!(this instanceof Draggable)) { return new Draggable(target, options); } var that = this; //ignore existing instance var instance = draggableCache.get(target); if (instance) { instance.state = 'reset'; //take over options extend(instance, options); instance....
javascript
{ "resource": "" }
q62930
ConjunctionMap
test
function ConjunctionMap() { let _conjunctions = []; /** * Add a mapping of a conjunction to a value to this map. * @param {Array} conjunction The conjunction to map the value * @param {any} value The value to be mapped */ this.add = function add(conjunction, value) { if (value === undefined...
javascript
{ "resource": "" }
q62931
sortTimables
test
function sortTimables(conjunction, forTime) { let earlyConjuncts = []; let laterConjuncts = []; let dependentTimeVariables = {}; // determine the time dependent variables for (let k = 0; k < conjunction.length; k += 1) { let conjunct = conjunction[k]; if (!(conjunct instanceof Timable)) { // ...
javascript
{ "resource": "" }
q62932
test
function (programArgs) { let _programArgs = programArgs; if (programArgs === undefined) { _programArgs = []; } // map to values _programArgs = _programArgs.map(arg => new Value(arg)); let argsList = new List(_programArgs); let theta = { List: argsList }; return programArgsPredicate.substitute(...
javascript
{ "resource": "" }
q62933
createProgramArgsUpdaterFunc
test
function createProgramArgsUpdaterFunc(programArgs) { return (program) => { let programArgsFact = buildProgramArgsPredicate(programArgs); program.getFacts().add(programArgsFact); return Promise.resolve(program); }; }
javascript
{ "resource": "" }
q62934
processCycleObservations
test
function processCycleObservations() { let activeObservations = new LiteralTreeMap(); if (_observations[_currentTime] === undefined) { // no observations for current time return activeObservations; } let cloneProgram = _program.clone(); cloneProgram.setExecutedActions(activeObservations)...
javascript
{ "resource": "" }
q62935
actionsSelector
test
function actionsSelector(goalTrees) { const recursiveActionsSelector = (actionsSoFar, programSoFar, l) => { if (l >= goalTrees.length) { let actions = new LiteralTreeMap(); actionsSoFar.forEach((map) => { map.forEach((literal) => { actions.add(literal); }); ...
javascript
{ "resource": "" }
q62936
performCycle
test
function performCycle() { _currentTime += 1; let selectedAndExecutedActions = new LiteralTreeMap(); let executedObservations = new LiteralTreeMap(); // Step 0 - Updating database let updatedState = _program.getState().clone(); updateStateWithFluentActors( this, _program.getExecuted...
javascript
{ "resource": "" }
q62937
applyArgs
test
function applyArgs(func, thisObj, args) { return func.apply(thisObj, Array.prototype.slice.call(args)); }
javascript
{ "resource": "" }
q62938
define
test
function define() { var thisFlow = function() { applyArgs(thisFlow.exec, thisFlow, arguments); } thisFlow.blocks = arguments; thisFlow.exec = function() { // The flowState is the actual object each step in the flow is applied to. It acts as a // callback to the next function. It also maintains t...
javascript
{ "resource": "" }
q62939
test
function() { if (flowState.__frozen) return; if (flowState.__timeoutId) { clearTimeout(flowState.__timeoutId); delete flowState.__timeoutId; } var blockIdx = flowState.__nextBlockIdx ++; var block = thisFlow.blocks[blockIdx]; if (block === undefined) { return; }...
javascript
{ "resource": "" }
q62940
exec
test
function exec() { var flow = typeof exports != 'undefined' ? exports : window.flow; applyArgs(flow.define, flow, arguments)(); }
javascript
{ "resource": "" }
q62941
padStart
test
function padStart(str, length, padChar) { if (str.length >= length) { return str; } else { return padChar.repeat(length - str.length) + str; } }
javascript
{ "resource": "" }
q62942
SM2Curve
test
function SM2Curve(params) { if (!(this instanceof SM2Curve)) { return new SM2Curve(params); } elliptic.curve.short.call(this, params); }
javascript
{ "resource": "" }
q62943
SM2KeyPair
test
function SM2KeyPair(pub, pri) { if (!(this instanceof SM2KeyPair)) { return new SM2KeyPair(pub, pri); } this.curve = SM2; // curve parameter this.pub = null; // public key, should be a point on the curve this.pri = null; // private key, should be a integer var validPub = false; var validPri = false; ...
javascript
{ "resource": "" }
q62944
gulpStaticI18n
test
function gulpStaticI18n(options) { return through.obj(function(target, encoding, cb) { var stream = this; var build = new StaticI18n(target, options, stream); build.translate(cb); }); }
javascript
{ "resource": "" }
q62945
test
function (obj, type, fn, scope) { scope = scope || obj; var wrappedFn = function (e) { fn.call(scope, e); }; obj.addEventListener(type, wrappedFn, false); cache.push([obj, type, fn, wrappedFn]); }
javascript
{ "resource": "" }
q62946
test
function (obj, type, fn) { var wrappedFn, item, len = cache.length, i; for (i = 0; i < len; i++) { item = cache[i]; if (item[0] === obj && item[1] === type && item[2] === fn) { wrappedFn = item[3]; ...
javascript
{ "resource": "" }
q62947
View
test
function View(model) { var wrapper; this.el = wrapper = document.createElement('div'); this.model = model; this.isShowing = false; // HTML wrapper.id = config.name; config.parent.appendChild(wrapper); // CSS css.inject(document.getElementsByTagName('head')[0], config.styles); ...
javascript
{ "resource": "" }
q62948
Product
test
function Product(data) { data.quantity = parser.quantity(data.quantity); data.amount = parser.amount(data.amount); data.href = parser.href(data.href); this._data = data; this._options = null; this._discount = null; this._amount = null; this._total = null; Pubsub.call(this); }
javascript
{ "resource": "" }
q62949
Cart
test
function Cart(name, duration) { var data, items, settings, len, i; this._items = []; this._settings = { bn: constants.BN }; Pubsub.call(this); Storage.call(this, name, duration); if ((data = this.load())) { items = data.items; settings = data.settings; if (settings) {...
javascript
{ "resource": "" }
q62950
onRejected
test
function onRejected(error) { attemts_left -= 1; if (attemts_left < 1) { throw error; } console.log("A retried call failed. Retrying " + attemts_left + " more time(s)."); // retry call self again with the same arguments, except attemts_left ...
javascript
{ "resource": "" }
q62951
fixDate
test
function fixDate(type, value, hash) { if (type !== "commit" && type !== "tag") return; // Add up to 3 extra newlines and try all 30-minutes timezone offsets. var clone = JSON.parse(JSON.stringify(value)); for (var x = 0; x < 3; x++) { for (var i = -720; i < 720; i += 30) { if (type === "commit") { ...
javascript
{ "resource": "" }
q62952
test
function () { var $this = this; // remove all data set with .data() $this.removeData(); // unbind the document as well $(document) .unbind('mousemove.nstSlider') .unbind('mouseup.nstSlider'); // unbind events boun...
javascript
{ "resource": "" }
q62953
test
function () { var $this = this; // re-set the slider step if specified var lastStepHistogram = $this.data('last_step_histogram'); if (typeof lastStepHistogram !== 'undefined') { methods.set_step_histogram.call($this, lastStepHistogram); } ...
javascript
{ "resource": "" }
q62954
GoogleLogin
test
function GoogleLogin() { if (!(this instanceof GoogleLogin)) { return new GoogleLogin(); } const self = this; /** * Based of https://github.com/tejado/pgoapi/blob/master/pgoapi/auth_google.py#L33 */ const GOOGLE_LOGIN_ANDROID_ID = '9774d56d682e549c'; const GOOGLE_LOGIN_SERVICE...
javascript
{ "resource": "" }
q62955
test
function(lat, lng, radius, level) { if (typeof radius === 'undefined') radius = 3; if (typeof level === 'undefined') level = 15; /* eslint-disable new-cap */ var origin = s2.S2Cell.FromLatLng({ lat: lat, lng: lng }, level); var cells = []; ...
javascript
{ "resource": "" }
q62956
test
function(enumObj, val) { for (var key of Object.keys(enumObj)) { if (enumObj[key] === val) { return key.split('_') .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(' '); } } return null;...
javascript
{ "resource": "" }
q62957
test
function(object) { if (!object || typeof object !== 'object') return object; if (object instanceof ByteBuffer) return object; if (Long.isLong(object)) { return object.lessThanOrEqual(Number.MAX_SAFE_INTEGER) && object.greaterThanOrEqual(Number.MIN_SAFE_INTEGER) ...
javascript
{ "resource": "" }
q62958
Random
test
function Random(seed) { this.multiplier = 16807; this.modulus = 0x7fffffff; this.seed = seed; this.mq = Math.floor(this.modulus / this.multiplier); this.mr = this.modulus % this.multiplier; }
javascript
{ "resource": "" }
q62959
prettyDate
test
function prettyDate(time){ /*var date = new Date((time || "")*/ var diff = (((new Date()).getTime() - time) / 1000), day_diff = Math.floor(diff / 86400); if ( isNaN(day_diff) || day_diff < 0 || day_diff >= 31 ) return; return day_diff == 0 && ( diff < 60 && "just now" || diff < 120 && ...
javascript
{ "resource": "" }
q62960
LoggerFactory
test
function LoggerFactory(options) { options = options || { prefix: true }; // If `console.log` is not accessible, `log` is a noop. if ( typeof console !== 'object' || typeof console.log !== 'function' || typeof console.log.bind !== 'function' ) { retu...
javascript
{ "resource": "" }
q62961
runRequestQueue
test
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": "" }
q62962
jsonp
test
function jsonp(opts, cb) { opts = opts || {}; if (typeof window === 'undefined') { // FUTURE: refactor node usage to live in here return cb(); } var scriptEl = document.createElement('script'); window._sailsIoJSConnect = function(response) { // In rare circumstanc...
javascript
{ "resource": "" }
q62963
validateParameterValue
test
function validateParameterValue (parameter, type, format, value) { if (type === 'integer') { const parsedValue = Number.parseInt(value) if (_.isNaN(parsedValue)) { throw new Error(`Invalid "${parameter}" value: failed to parse "${value}" as integer`) } return parsedValue } else if (type === 'n...
javascript
{ "resource": "" }
q62964
parameterDeclarationToYargs
test
function parameterDeclarationToYargs (yargs, parameter, declaration) { const optionName = _.kebabCase(parameter) let option = {} if (declaration.description) { option.describe = declaration.description } if (declaration.type) { if (declaration.type === 'integer') { option.type = 'number' } ...
javascript
{ "resource": "" }
q62965
configDeclarationToYargs
test
function configDeclarationToYargs (yargs, configDeclaration) { _.forOwn(configDeclaration, (parameter, parameterName) => { parameterDeclarationToYargs(yargs, parameterName, parameter) }) return yargs }
javascript
{ "resource": "" }
q62966
NGramParser
test
function NGramParser(theNgramList, theByteMap) { var N_GRAM_MASK = 0xFFFFFF; this.byteIndex = 0; this.ngram = 0; this.ngramList = theNgramList; this.byteMap = theByteMap; this.ngramCount = 0; this.hitCount = 0; this.spaceChar; /* * Binary search for value in table, which must have exactly 64 e...
javascript
{ "resource": "" }
q62967
collectScenariosFromElement
test
function collectScenariosFromElement(parentElement) { var scenarios = []; var templates = []; var elements = parentElement.children(); var i = 0; angular.forEach(elements, function(el) { var elem = angular.element(el); //if no source or no html, capture element it...
javascript
{ "resource": "" }
q62968
changed
test
function changed (done) { const files = [].slice.call(arguments); if (typeof files[files.length - 1] === 'function') done = files.pop(); done = typeof done === 'function' ? done : () => {}; debug('Notifying %d servers - Files: ', servers.length, files); servers.forEach(srv => { const params = { params: { ...
javascript
{ "resource": "" }
q62969
test
function(children, element) { this.portalNode = document.createElement('div'); (element || document.body).appendChild(this.portalNode); ReactDOM.render(children, this.portalNode); }
javascript
{ "resource": "" }
q62970
test
function() { /* eslint-disable no-alert */ var close = typeof this.portalConfirmOnCloseMessage === 'string' ? confirm(this.portalConfirmOnCloseMessage) : true; /* eslint-enable no-alert */ if (this.portalNode && this.portalNode.parentNode && close) { ReactDOM.unmountComponen...
javascript
{ "resource": "" }
q62971
test
function(data) { if (this.filterValue) { data = this.quickFilterData(data, this.filterValue); } if (this.advancedFilters) { data = this.advancedFilterData(data, this.advancedFilters); } this.dataCount = data.length; return data; }
javascript
{ "resource": "" }
q62972
test
function(id, definition, dataFormatter) { this.collection[id] = new Table(id, definition, dataFormatter); return this.collection[id]; }
javascript
{ "resource": "" }
q62973
test
function(payload) { var action = payload.action; if (!this.shouldHandleAction(action.component)) { return; } switch (action.actionType) { case ActionTypes.REQUEST_DATA: this.handleRequestDataAction(action); break; case...
javascript
{ "resource": "" }
q62974
test
function(nextProps) { if (this.props.filters !== nextProps.filters && JSON.stringify(this.props.filters) !== JSON.stringify(nextProps.filters)) { setTimeout(function() { this.requestData(); }.bind(this), 0); } }
javascript
{ "resource": "" }
q62975
test
function(store) { return { /** * Adds the listeners required when requesting data from the server. */ componentDidMount: function() { store.on('change:' + this.props.componentId, this.onDataReceived); store.on('fail:' + this.props...
javascript
{ "resource": "" }
q62976
test
function() { store.on('change:' + this.props.componentId, this.onDataReceived); store.on('fail:' + this.props.componentId, this.onError); }
javascript
{ "resource": "" }
q62977
test
function() { store.removeListener('change:' + this.props.componentId, this.onDataReceived); store.removeListener('fail:' + this.props.componentId, this.onError); }
javascript
{ "resource": "" }
q62978
test
function(id, definition, dataFormatter, filters) { AppDispatcher.dispatchAction({ actionType: this.actionTypes.REQUEST_DATA, component: 'Table', id: id, data: { definition: definition, dataFormatter: dataFormatter, f...
javascript
{ "resource": "" }
q62979
test
function(id, value) { AppDispatcher.dispatchAction({ actionType: this.actionTypes.FILTER, component: 'Table', id: id, data: { value: value } }); }
javascript
{ "resource": "" }
q62980
test
function(id, direction) { AppDispatcher.dispatchAction({ actionType: this.actionTypes.PAGINATE, component: 'Table', id: id, data: { direction: direction } }); }
javascript
{ "resource": "" }
q62981
test
function(id, deselect) { AppDispatcher.dispatchAction({ actionType: this.actionTypes.TOGGLE_BULK_SELECT, component: 'Table', id: id, data: { deselect: deselect } }); }
javascript
{ "resource": "" }
q62982
test
function(id, rowIndex) { AppDispatcher.dispatchAction({ actionType: this.actionTypes.TOGGLE_ROW_SELECT, component: 'Table', id: id, data: { rowIndex: rowIndex } }); }
javascript
{ "resource": "" }
q62983
extractValue
test
function extractValue(attr, node) { if (attr === 'translate') { return node.html() || getAttr(attr) || ''; } return getAttr(attr) || node.html() || ''; }
javascript
{ "resource": "" }
q62984
test
function(obj, callback, thisArg) { return obj.map ? obj.map.call(obj, callback, thisArg) : map.call(obj, callback, thisArg); }
javascript
{ "resource": "" }
q62985
test
function(obj, callback, thisArg) { return obj.filter ? obj.filter.call(obj, callback, thisArg) : filter.call(obj, callback, thisArg); }
javascript
{ "resource": "" }
q62986
test
function(obj, elements) { return elements === undefined ? [] : utils.map(elements, function(item) { return utils.indexOf(obj, item); }); }
javascript
{ "resource": "" }
q62987
test
function(array, item) { var index = utils.indexOf(array, item); if (index === -1) { array.push(item); } }
javascript
{ "resource": "" }
q62988
test
function(array, idx, amt, objects) { if (array.replace) { return array.replace(idx, amt, objects); } else { return utils._replace(array, idx, amt, objects); } }
javascript
{ "resource": "" }
q62989
test
function(array1, array2) { var intersection = []; utils.forEach(array1, function(element) { if (utils.indexOf(array2, element) >= 0) { intersection.push(element); } }); return intersection; }
javascript
{ "resource": "" }
q62990
removeListener
test
function removeListener(obj, eventName, target, method) { Ember.assert("You must pass at least an object and event name to Ember.removeListener", !!obj && !!eventName); if (!method && 'function' === typeof target) { method = target; target = null; } function _removeListener(target, method) { var a...
javascript
{ "resource": "" }
q62991
suspendListener
test
function suspendListener(obj, eventName, target, method, callback) { if (!method && 'function' === typeof target) { method = target; target = null; } var actions = actionsFor(obj, eventName), actionIndex = indexOf(actions, target, method); if (actionIndex !== -1) { actions[actionIndex+2] |= ...
javascript
{ "resource": "" }
q62992
dependentKeysDidChange
test
function dependentKeysDidChange(obj, depKey, meta) { if (obj.isDestroying) { return; } var seen = DID_SEEN, top = !seen; if (top) { seen = DID_SEEN = {}; } iterDeps(propertyDidChange, obj, depKey, seen, meta); if (top) { DID_SEEN = null; } }
javascript
{ "resource": "" }
q62993
set
test
function set(obj, keyName, value, tolerant) { if (typeof obj === 'string') { Ember.assert("Path '" + obj + "' must be global if no obj is given.", IS_GLOBAL.test(obj)); value = keyName; keyName = obj; obj = null; } Ember.assert("Cannot call set with "+ keyName +" key.", !!keyName); if (!obj ||...
javascript
{ "resource": "" }
q62994
test
function(key, value) { var keys = this.keys, values = this.values, guid = guidFor(key); keys.add(key); values[guid] = value; set(this, 'length', keys.list.length); }
javascript
{ "resource": "" }
q62995
test
function(key) { // don't use ES6 "delete" because it will be annoying // to use in browsers that are not ES6 friendly; var keys = this.keys, values = this.values, guid = guidFor(key); if (values.hasOwnProperty(guid)) { keys.remove(key); delete values[guid]; set(this, '...
javascript
{ "resource": "" }
q62996
test
function(callback, self) { var keys = this.keys, values = this.values; keys.forEach(function(key) { var guid = guidFor(key); callback.call(self, key, values[guid]); }); }
javascript
{ "resource": "" }
q62997
test
function(obj) { Ember.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj); var twoWay = !this._oneWay; // remove an observer on the object so we're no longer notified of // changes that should update bindings. Ember.removeObserver(obj, this._from, this, this.fromDidChange); ...
javascript
{ "resource": "" }
q62998
filter
test
function filter(promises, filterFn, label) { return all(promises, label).then(function(values){ if (!isArray(promises)) { throw new TypeError('You must pass an array to filter.'); } if (!isFunction(filterFn)){ throw new TypeError("You must pass a function to filter's s...
javascript
{ "resource": "" }
q62999
Container
test
function Container(parent) { this.parent = parent; this.children = []; this.resolver = parent && parent.resolver || function() {}; this.registry = new InheritingDict(parent && parent.registry); this.cache = new InheritingDict(parent && parent.cache); this.factoryCache = new Inherit...
javascript
{ "resource": "" }