_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q63100 | test | function(trapName) {
var trap = this.handler[trapName];
if (trap === undefined) {
// the trap was not defined,
// perform the default forwarding behavior
return undefined;
}
| javascript | {
"resource": ""
} | |
q63101 | test | function(name) {
var handler = this;
if (!handler.has(name)) return undefined;
return {
get: function() {
return handler.get(this, name);
},
set: function(val) {
if (handler.set(this, name, val)) {
return | javascript | {
"resource": ""
} | |
q63102 | test | function() {
var trap = this.getTrap("freeze");
if (trap === undefined) {
// default forwarding behavior
return Reflect.freeze(this.target);
}
var success = trap.call(this.handler, this.target);
success = !!success; // coerce to Boolean
if (success) {
if (!Object_isFrozen(this... | javascript | {
"resource": ""
} | |
q63103 | test | function() {
var trap = this.getTrap("seal");
if (trap === undefined) {
// default forwarding behavior
return Reflect.seal(this.target);
}
var success = trap.call(this.handler, this.target);
success = !!success; // coerce to Boolean
if (success) {
if (!Object_isSealed(this.tar... | javascript | {
"resource": ""
} | |
q63104 | test | function() {
var trap = this.getTrap("preventExtensions");
if (trap === undefined) {
// default forwarding behavior
return Reflect.preventExtensions(this.target);
}
var success = trap.call(this.handler, this.target); | javascript | {
"resource": ""
} | |
q63105 | test | function(name) {
"use strict";
var trap = this.getTrap("deleteProperty");
if (trap === undefined) {
// default forwarding behavior
return Reflect.deleteProperty(this.target, name);
}
name = String(name);
var res = trap.call(this.handler, this.target, name);
res = !!res; // coerc... | javascript | {
"resource": ""
} | |
q63106 | test | function() {
var trap = this.getTrap("iterate");
if (trap === undefined) {
// default forwarding behavior
return Reflect.iterate(this.target);
}
var trapResult = trap.call(this.handler, this.target);
if (Object(trapResult) !== trapResult) {
| javascript | {
"resource": ""
} | |
q63107 | test | function() {
var trap = this.getTrap("keys");
if (trap === undefined) {
// default forwarding behavior
return Reflect.keys(this.target);
}
var trapResult = trap.call(this.handler, this.target);
// propNames is used as a set of strings
var propNames = Object.create(null);
var nu... | javascript | {
"resource": ""
} | |
q63108 | test | function() {
var trap = this.getTrap("ownKeys");
if (trap === undefined) {
// default forwarding behavior
return Reflect.ownKeys(this.target);
}
var trapResult = trap.call(this.handler, this.target);
if (trapResult === null || typeof trapResult !== "object") | javascript | {
"resource": ""
} | |
q63109 | makeUnwrapping0ArgMethod | test | function makeUnwrapping0ArgMethod(primitive) {
return function builtin() {
var vHandler = safeWeakMapGet(directProxies, this); | javascript | {
"resource": ""
} |
q63110 | load | test | function load(obj) {
var name, root;
root = typeof global !== "undefined" && global !== | javascript | {
"resource": ""
} |
q63111 | test | function(record, options) {
var json = {};
if (options && options.includeId) {
var id = get(record, 'id');
if (id) {
json[get(this, 'primaryKey')] = id;
}
}
record.eachAttribute(function(key, attribute) {
this.serializeAttribute(record, json, key, attribute);
}, th... | javascript | {
"resource": ""
} | |
q63112 | test | function(record, json, key, attribute) {
var attrs = get(this, 'attrs');
var value = get(record, key), type = attribute.type;
if (type) {
var transform = this.transformFor(type);
| javascript | {
"resource": ""
} | |
q63113 | test | function(record, json, relationship) {
var key = relationship.key;
var belongsTo = get(record, key);
key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo") : key;
if (isNone(belongsTo)) {
json[key] = belongsTo;
} else {
json[key] = get(belongsTo, | javascript | {
"resource": ""
} | |
q63114 | test | function(record, json, relationship) {
var key = relationship.key;
var relationshipType = DS.RelationshipChange.determineRelationshipType(record.constructor, relationship);
if (relationshipType === 'manyToNone' || relationshipType === 'manyToMany') {
| javascript | {
"resource": ""
} | |
q63115 | test | function(store, type, payload, id, requestType) {
this.extractMeta(store, type, payload);
var specificExtract = "extract" + requestType.charAt(0).toUpperCase() | javascript | {
"resource": ""
} | |
q63116 | test | function(store, type, payload) {
if (payload && payload.meta) | javascript | {
"resource": ""
} | |
q63117 | test | function() {
var promiseLabel = "DS: RecordArray#save " + get(this, 'type');
var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function(array) | javascript | {
"resource": ""
} | |
q63118 | test | function(index, removed, added) {
// Map the array of record objects into an array of client ids.
added = map(added, function(record) {
Ember.assert("You cannot | javascript | {
"resource": ""
} | |
q63119 | test | function(hash) {
var owner = get(this, 'owner'),
store = get(owner, 'store'),
type = get(this, 'type'),
record;
Ember.assert("You cannot add '" + type.typeKey + "' records to | javascript | {
"resource": ""
} | |
q63120 | test | function(type) {
var adapter = this.adapterFor(type);
if (adapter && adapter.generateIdForRecord) {
| javascript | {
"resource": ""
} | |
q63121 | test | function(type, id) {
type = this.modelFor(type);
var record = this.recordForId(type, id);
var promise = this.fetchRecord(record) || resolve(record, | javascript | {
"resource": ""
} | |
q63122 | test | function(type, ids) {
var store = this;
var promiseLabel = "DS: Store#findByIds " + type;
return promiseArray(Ember.RSVP.all(map(ids, function(id) {
return | javascript | {
"resource": ""
} | |
q63123 | test | function(record) {
var type = record.constructor,
adapter = this.adapterFor(type),
id = get(record, 'id');
Ember.assert("You cannot reload a record without an ID", id);
Ember.assert("You tried to reload a record but you have no adapter | javascript | {
"resource": ""
} | |
q63124 | test | function(records, owner, resolver) {
if (!records.length) { return; }
// Group By Type
var recordsByTypeMap = Ember.MapWithDefault.create({
defaultValue: function() { return Ember.A(); }
});
forEach(records, function(record) {
recordsByTypeMap.get(record.constructor).push(record);
... | javascript | {
"resource": ""
} | |
q63125 | test | function(type, id) {
id = coerceId(id);
type | javascript | {
"resource": ""
} | |
q63126 | test | function(type, id) {
type = this.modelFor(type);
id = coerceId(id);
var record = | javascript | {
"resource": ""
} | |
q63127 | test | function(type, query) {
type = this.modelFor(type);
var array = this.recordArrayManager
.createAdapterPopulatedRecordArray(type, query);
var adapter = this.adapterFor(type),
promiseLabel = "DS: Store#findQuery " + type,
resolver = Ember.RSVP.defer(promiseLabel);
Ember.assert("Yo... | javascript | {
"resource": ""
} | |
q63128 | test | function(type) {
type = this.modelFor(type);
var typeMap = this.typeMapFor(type),
findAllCache = typeMap.findAllCache;
if (findAllCache) { return findAllCache; }
var array | javascript | {
"resource": ""
} | |
q63129 | test | function(type) {
type = this.modelFor(type);
var typeMap = this.typeMapFor(type),
records = typeMap.records, record;
| javascript | {
"resource": ""
} | |
q63130 | test | function(type, query, filter) {
var promise;
// allow an optional server query
if (arguments.length === 3) {
promise = this.findQuery(type, query);
} else if (arguments.length === 2) {
filter = query;
}
type = this.modelFor(type);
var array = this.recordArrayManager
| javascript | {
"resource": ""
} | |
q63131 | test | function() {
var pending = this._pendingSave.slice();
this._pendingSave = [];
forEach(pending, function(tuple) {
var record = tuple[0], resolver = tuple[1],
adapter = this.adapterFor(record.constructor),
operation;
if (get(record, 'isNew')) {
operation = 'createReco... | javascript | {
"resource": ""
} | |
q63132 | test | function(record, data) {
if (data) {
// normalize relationship IDs into records
data = normalizeRelationships(this, record.constructor, data, record);
| javascript | {
"resource": ""
} | |
q63133 | test | function(record, data) {
var oldId = get(record, 'id'),
id = coerceId(data.id);
Ember.assert("An adapter cannot assign a new id to a record that already has an id. " + record + " had id: " + oldId + " | javascript | {
"resource": ""
} | |
q63134 | test | function(type) {
var typeMaps = get(this, 'typeMaps'),
guid = Ember.guidFor(type),
typeMap;
typeMap = typeMaps[guid];
| javascript | {
"resource": ""
} | |
q63135 | test | function(type, data, _partial) {
// _partial is an internal param used by `update`.
// If passed, it means that the data should be
// merged into the existing data, not replace it.
Ember.assert("You must include an `id` in a hash passed to `push`", data.id != null);
| javascript | {
"resource": ""
} | |
q63136 | test | function (type, payload) {
var serializer;
if (!payload) {
payload = type;
serializer = defaultSerializer(this.container);
Ember.assert("You cannot use `store#pushPayload` without a type unless your default | javascript | {
"resource": ""
} | |
q63137 | test | function(type, metadata) {
type = this.modelFor(type);
| javascript | {
"resource": ""
} | |
q63138 | test | function(type, id, data) {
var typeMap = this.typeMapFor(type),
idToRecord = typeMap.idToRecord;
Ember.assert('The id ' + id + ' has already been used with another record of type ' + type.toString() + '.', !id || !idToRecord[id]);
// lookupFactory should really return an object that creates
| javascript | {
"resource": ""
} | |
q63139 | addUnsavedRecords | test | function addUnsavedRecords(record, key, data) {
if(record) {
| javascript | {
"resource": ""
} |
q63140 | deepClone | test | function deepClone(object) {
var clone = {}, value;
for (var prop in object) {
value = object[prop];
if (value && typeof value === 'object') {
| javascript | {
"resource": ""
} |
q63141 | test | function(attribute, messages) {
var wasEmpty = get(this, 'isEmpty');
messages = this._findOrCreateMessages(attribute, messages);
get(this, 'content').addObjects(messages);
this.notifyPropertyChange(attribute);
| javascript | {
"resource": ""
} | |
q63142 | test | function(attribute) {
if (get(this, 'isEmpty')) { return; }
var content = get(this, 'content').rejectBy('attribute', attribute);
| javascript | {
"resource": ""
} | |
q63143 | test | function(data) {
set(this, 'isError', false);
if (data) {
this._data = data;
} else {
Ember.mixin(this._data, this._inFlightAttributes);
}
this._inFlightAttributes = {};
| javascript | {
"resource": ""
} | |
q63144 | test | function() {
this._attributes = {};
if (get(this, 'isError')) {
this._inFlightAttributes = {};
set(this, 'isError', false);
| javascript | {
"resource": ""
} | |
q63145 | test | function(callback, binding) {
var observers = get(this.constructor, 'relationshipNames').belongsTo;
var self = this;
try {
this._suspendedRelationships = true;
Ember._suspendObservers(self, observers, | javascript | {
"resource": ""
} | |
q63146 | test | function() {
var promiseLabel = "DS: Model#save " + this;
var resolver = Ember.RSVP.defer(promiseLabel);
this.get('store').scheduleSave(this, resolver);
this._inFlightAttributes = this._attributes;
| javascript | {
"resource": ""
} | |
q63147 | test | function() {
set(this, 'isReloading', true);
var record = this;
var promiseLabel = "DS: Model#reload of " + this;
var promise = new Ember.RSVP.Promise(function(resolve){
record.send('reloadRecord', resolve);
}, promiseLabel).then(function() {
record.set('isReloading', false);
r... | javascript | {
"resource": ""
} | |
q63148 | test | function(attributeName, value) {
// If a value is passed in, update the internal attributes and clear
// the attribute cache so it picks up the new value. Otherwise,
// collapse the current value into the internal attributes because
// the adapter has acknowledged it.
if (value !== undefined) {
... | javascript | {
"resource": ""
} | |
q63149 | test | function(callback, binding) {
get(this, 'attributes').forEach(function(name, | javascript | {
"resource": ""
} | |
q63150 | test | function(callback, binding) {
get(this, 'transformedAttributes').forEach(function(name, | javascript | {
"resource": ""
} | |
q63151 | test | function(proto, key, value) {
// Check if the value being set is a computed property.
if (value instanceof Ember.Descriptor) {
// If it is, get the metadata for the relationship. This is
// populated by the `DS.belongsTo` helper when it is creating
// the computed property.
var meta = v... | javascript | {
"resource": ""
} | |
q63152 | test | function(callback, binding) {
get(this, 'relationshipsByName').forEach(function(name, | javascript | {
"resource": ""
} | |
q63153 | test | function() {
forEach(this.changedRecords, function(record) {
if (get(record, 'isDeleted')) {
this._recordWasDeleted(record);
} else { | javascript | {
"resource": ""
} | |
q63154 | test | function(array, filter, type, record) {
var shouldBeInArray;
if (!filter) {
shouldBeInArray = true;
} else {
shouldBeInArray = filter(record);
}
var recordArrays = this.recordArraysForRecord(record);
if (shouldBeInArray) {
| javascript | {
"resource": ""
} | |
q63155 | test | function(array, type, filter) {
var typeMap = this.store.typeMapFor(type),
records = typeMap.records, record;
for (var i=0, l=records.length; i<l; i++) {
record = records[i];
| javascript | {
"resource": ""
} | |
q63156 | test | function(type, records) {
var manyArray = DS.ManyArray.create({
type: type,
content: records,
store: this.store
});
forEach(records, function(record) {
| javascript | {
"resource": ""
} | |
q63157 | test | function(type) {
var array = DS.RecordArray.create({
type: type,
content: Ember.A(),
store: this.store,
isLoaded: true
| javascript | {
"resource": ""
} | |
q63158 | test | function(type, filter) {
var array = DS.FilteredRecordArray.create({
type: type,
content: Ember.A(),
store: this.store,
manager: this,
| javascript | {
"resource": ""
} | |
q63159 | test | function(type, query) {
return DS.AdapterPopulatedRecordArray.create({
type: type,
query: query,
| javascript | {
"resource": ""
} | |
q63160 | test | function(array, type, filter) {
var recordArrays = this.filteredRecordArrays.get(type);
| javascript | {
"resource": ""
} | |
q63161 | test | function(record, array) {
var loadingRecordArrays = record._loadingRecordArrays || [];
loadingRecordArrays.push(array);
| javascript | {
"resource": ""
} | |
q63162 | test | function(record, options) {
return get(record, 'store').serializerFor(record.construc | javascript | {
"resource": ""
} | |
q63163 | test | function(store, type, ids) {
var promises = map.call(ids, function(id) { | javascript | {
"resource": ""
} | |
q63164 | test | function(type) {
if (type.FIXTURES) {
var fixtures = Ember.A(type.FIXTURES);
return fixtures.map(function(fixture){
var fixtureIdType = typeof fixture.id;
if(fixtureIdType !== "number" && fixtureIdType !== "string"){
throw new | javascript | {
"resource": ""
} | |
q63165 | test | function(store, type, record) {
return sto | javascript | {
"resource": ""
} | |
q63166 | test | function(type, hash, prop) {
this.normalizeId(hash);
this.normalizeAttributes(type, hash);
this.normalizeRelationships(type, hash);
| javascript | {
"resource": ""
} | |
q63167 | test | function(store, primaryType, payload, recordId, requestType) {
payload = this.normalizePayload(primaryType, payload);
var primaryTypeName = primaryType.typeKey,
primaryRecord;
for (var prop in payload) {
var typeName = this.typeForRoot(prop),
isPrimary = typeName === primaryTypeNa... | javascript | {
"resource": ""
} | |
q63168 | test | function(store, primaryType, payload) {
payload = this.normalizePayload(primaryType, payload);
var primaryTypeName = primaryType.typeKey,
primaryArray;
for (var prop in payload) {
var typeKey = prop,
forcedSecondary = false;
if (prop.charAt(0) === '_') {
forcedSecond... | javascript | {
"resource": ""
} | |
q63169 | test | function(store, payload) {
payload = this.normalizePayload(null, payload);
for (var prop in payload) {
var typeName = this.typeForRoot(prop),
type = store.modelFor(typeName);
/*jshint loopfunc:true*/
var normalizedArray = | javascript | {
"resource": ""
} | |
q63170 | test | function(hash, type, record, options) {
hash[type.typeKey] | javascript | {
"resource": ""
} | |
q63171 | test | function(record, json, relationship) {
var key = relationship.key,
belongsTo = get(record, key);
key = this.keyForAttribute ? | javascript | {
"resource": ""
} | |
q63172 | test | function(store, type, sinceToken) {
var query;
if (sinceToken) {
query = { since: sinceToken };
}
return | javascript | {
"resource": ""
} | |
q63173 | test | function(store, type, ids) {
return this.ajax(this.buildURL(type.typeKey), | javascript | {
"resource": ""
} | |
q63174 | test | function(store, type, record) {
var data = {};
var serializer = store.serializerFor(type.typeKey);
serializer.serializeIntoHash(data, type, record, { | javascript | {
"resource": ""
} | |
q63175 | test | function(store, type, record) {
var data = {};
var serializer = store.serializerFor(type.typeKey);
serializer.serializeIntoHash(data, type, record);
| javascript | {
"resource": ""
} | |
q63176 | test | function(store, type, record) {
var id = get(record, | javascript | {
"resource": ""
} | |
q63177 | test | function(type, id) {
var url = [],
host = get(this, 'host'),
prefix = this.urlPrefix();
if (type) { url.push(this.pathForType(type)); }
if (id) { url.push(id); }
if (prefix) { | javascript | {
"resource": ""
} | |
q63178 | test | function(url, type, hash) {
var adapter = this;
return new Ember.RSVP.Promise(function(resolve, reject) {
hash = adapter.ajaxOptions(url, type, hash);
hash.success = function(json) {
Ember.run(null, resolve, json);
};
hash.error = function(jqXHR, textStatus, errorThrown) {
| javascript | {
"resource": ""
} | |
q63179 | Inflector | test | function Inflector(ruleSet) {
ruleSet = ruleSet || {};
ruleSet.uncountable = ruleSet.uncountable || {};
ruleSet.irregularPairs = ruleSet.irregularPairs || {};
var rules = this.rules | javascript | {
"resource": ""
} |
q63180 | test | function(key, kind) {
key = Ember.String.decamelize(key);
if (kind === "belongsTo") {
return key + "_id";
} else if (kind === "hasMany") {
| javascript | {
"resource": ""
} | |
q63181 | test | function(data, type, record, options) {
var root = Ember.String.decamelize(type.typeKey);
| javascript | {
"resource": ""
} | |
q63182 | test | function(record, json, relationship) {
var key = relationship.key,
belongsTo = get(record, key);
key = this.keyForAttribute(key);
| javascript | {
"resource": ""
} | |
q63183 | test | function(root) {
var camelized = Ember.String.camelize(root);
| javascript | {
"resource": ""
} | |
q63184 | test | function(data){
if (data.links) {
var links = data.links;
for (var link in links) {
var camelizedLink = Ember.String.camelize(link);
if (camelizedLink !== link) {
| javascript | {
"resource": ""
} | |
q63185 | test | function(type, hash) {
var payloadKey, payload;
if (this.keyForRelationship) {
type.eachRelationship(function(key, relationship) {
if (relationship.options.polymorphic) {
payloadKey = this.keyForAttribute(key);
payload = hash[payloadKey];
if (payload && payload.type)... | javascript | {
"resource": ""
} | |
q63186 | test | function(record, json, relationship) {
var key = relationship.key,
attrs = get(this, 'attrs'),
embed = attrs && attrs[key] && attrs[key].embedded === 'always';
if (embed) {
| javascript | {
"resource": ""
} | |
q63187 | test | function(store, primaryType, payload, recordId, requestType) {
var root = this.keyForAttribute(primaryType.typeKey),
| javascript | {
"resource": ""
} | |
q63188 | test | function(store, type, payload) {
var root = this.keyForAttribute(type.typeKey),
partials = payload[Ember.String.pluralize(root)];
| javascript | {
"resource": ""
} | |
q63189 | test | function(type) {
var decamelized = Ember.String.decamelize(type);
| javascript | {
"resource": ""
} | |
q63190 | test | function(jqXHR) {
var error = this._super(jqXHR);
if (jqXHR && jqXHR.status === 422) {
var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"],
| javascript | {
"resource": ""
} | |
q63191 | parseKeyValue | test | function parseKeyValue(/**string*/keyValue) {
var obj = {}, key_value, key;
forEach((keyValue || "").split('&'), function(keyValue){
if ( keyValue ) {
key_value = keyValue.split('=');
key = tryDecodeURIComponent(key_value[0]);
if ( isDefined(key) ) {
var val = isDefined(key_value[1]) ?... | javascript | {
"resource": ""
} |
q63192 | test | function(key, value, writeAttr, attrName) {
//special case for class attribute addition + removal
//so that class changes can tap into the animation
//hooks provided by the $animate service
if(key == 'class') {
value = value || '';
var current = this.$$element.attr('c... | javascript | {
"resource": ""
} | |
q63193 | compileNodes | test | function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective) {
var linkFns = [],
nodeLinkFn, childLinkFn, directives, attrs, linkFnFound;
for(var i = 0; i < nodeList.length; i++) {
attrs = new Attributes();
// we must always refer to nodeList[i] since... | javascript | {
"resource": ""
} |
q63194 | groupElementsLinkFnWrapper | test | function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
return function(scope, element, attrs, | javascript | {
"resource": ""
} |
q63195 | replaceWith | test | function replaceWith($rootElement, elementsToRemove, newNode) {
var firstElementToRemove = elementsToRemove[0],
removeCount = elementsToRemove.length,
parent = firstElementToRemove.parentNode,
i, ii;
if ($rootElement) {
for(i = 0, ii = $rootElement.length; i < ii; i++)... | javascript | {
"resource": ""
} |
q63196 | arrayDeclaration | test | function arrayDeclaration () {
var elementFns = [];
var allConstant = true;
if (peekToken().text != ']') {
do {
var elementFn = expression();
elementFns.push(elementFn);
if (!elementFn.constant) {
| javascript | {
"resource": ""
} |
q63197 | isSameOrigin | test | function isSameOrigin(requestUrl) {
var parsed = (typeof requestUrl === 'string') ? resolve(requestUrl, true) : requestUrl;
| javascript | {
"resource": ""
} |
q63198 | traverse | test | function traverse(node, opt_onEnter, opt_onLeave) {
if (opt_onEnter) opt_onEnter(node);
var childNodes = _collectChildNodes(node); | javascript | {
"resource": ""
} |
q63199 | Client | test | function Client() {
logger('new Client');
this.type = 'client';
this.id = uuid();
| javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.