Skip to content

Commit

Permalink
Linter changes for addon/-private (not iprivae/system)
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-the-pete authored and pete committed Jan 16, 2017
1 parent ba5874b commit 334125d
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
18 changes: 9 additions & 9 deletions addon/-private/adapters/build-url-mixin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';

var get = Ember.get;
const get = Ember.get;

/**
Expand Down Expand Up @@ -86,10 +86,10 @@ export default Ember.Mixin.create({
@return {String} url
*/
_buildURL(modelName, id) {
var url = [];
var host = get(this, 'host');
var prefix = this.urlPrefix();
var path;
let path;
let url = [];
const host = get(this, 'host');
const prefix = this.urlPrefix();

if (modelName) {
path = this.pathForType(modelName);
Expand Down Expand Up @@ -378,8 +378,8 @@ export default Ember.Mixin.create({
@return {String} urlPrefix
*/
urlPrefix(path, parentURL) {
var host = get(this, 'host');
var namespace = get(this, 'namespace');
let host = get(this, 'host');
const namespace = get(this, 'namespace');

if (!host || host === '/') {
host = '';
Expand All @@ -401,7 +401,7 @@ export default Ember.Mixin.create({
}

// No path provided
var url = [];
const url = [];
if (host) { url.push(host); }
if (namespace) { url.push(namespace); }
return url.join('/');
Expand Down Expand Up @@ -434,7 +434,7 @@ export default Ember.Mixin.create({
@return {String} path
**/
pathForType(modelName) {
var camelized = Ember.String.camelize(modelName);
const camelized = Ember.String.camelize(modelName);
return Ember.String.pluralize(camelized);
}
});
10 changes: 5 additions & 5 deletions addon/-private/ext/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ import { deprecate } from 'ember-data/-private/debug';
*/
Ember.Date = Ember.Date || {};

var origParse = Date.parse;
var numericKeys = [1, 4, 5, 6, 7, 10, 11];
const origParse = Date.parse;
const numericKeys = [1, 4, 5, 6, 7, 10, 11];

export const parseDate = function (date) {
var timestamp, struct;
var minutesOffset = 0;
let timestamp, struct;
let minutesOffset = 0;

// ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
// before falling back to any implementation-specific date parsing, so that’s what we do, even if native
// implementations could be faster
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if ((struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?:(\d{2}))?)?)?$/.exec(date))) {
// avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
for (var i = 0, k; (k = numericKeys[i]); ++i) {
for (let i = 0, k; (k = numericKeys[i]); ++i) {
struct[k] = +struct[k] || 0;
}

Expand Down
2 changes: 1 addition & 1 deletion addon/-private/initializers/store-injections.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
export default function initializeStoreInjections(registry) {
// registry.injection for Ember < 2.1.0
// application.inject for Ember 2.1.0+
var inject = registry.inject || registry.injection;
const inject = registry.inject || registry.injection;
inject.call(registry, 'controller', 'store', 'service:store');
inject.call(registry, 'route', 'store', 'service:store');
inject.call(registry, 'data-adapter', 'store', 'service:store');
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/initializers/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function has(applicationOrRegistry, fullName) {
export default function initializeStore(registry) {
// registry.optionsForType for Ember < 2.1.0
// application.registerOptionsForType for Ember 2.1.0+
var registerOptionsForType = registry.registerOptionsForType || registry.optionsForType;
const registerOptionsForType = registry.registerOptionsForType || registry.optionsForType;
registerOptionsForType.call(registry, 'serializer', { singleton: false });
registerOptionsForType.call(registry, 'adapter', { singleton: false });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@param {Ember.ApplicationInstance} applicationOrRegistry
*/
export default function initializeStoreService(application) {
var container = application.lookup ? application : application.container;
const container = application.lookup ? application : application.container;
// Eagerly generate the store so defaultStore is populated.
container.lookup('service:store');
}
2 changes: 1 addition & 1 deletion addon/-private/transforms/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const { isNone } = Ember;
*/
export default Transform.extend({
deserialize(serialized, options) {
var type = typeof serialized;
const type = typeof serialized;

if (isNone(serialized) && options.allowNull === true) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/transforms/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Transform from "ember-data/transform";

export default Transform.extend({
deserialize(serialized) {
var type = typeof serialized;
const type = typeof serialized;

if (type === "string") {
return new Date(parseDate(serialized));
Expand Down
6 changes: 3 additions & 3 deletions addon/-private/transforms/number.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import Transform from "ember-data/transform";

var empty = Ember.isEmpty;
const empty = Ember.isEmpty;

function isNumber(value) {
return value === value && value !== Infinity && value !== -Infinity;
Expand Down Expand Up @@ -31,7 +31,7 @@ function isNumber(value) {
*/
export default Transform.extend({
deserialize(serialized) {
var transformed;
let transformed;

if (empty(serialized)) {
return null;
Expand All @@ -43,7 +43,7 @@ export default Transform.extend({
},

serialize(deserialized) {
var transformed;
let transformed;

if (empty(deserialized)) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/transforms/string.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import Transform from "ember-data/transform";

var none = Ember.isNone;
const none = Ember.isNone;

/**
The `DS.StringTransform` class is used to serialize and deserialize
Expand Down
4 changes: 2 additions & 2 deletions addon/-private/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function modelHasAttributeOrRelationshipNamedType(modelClass) {
triggering deprecations.
*/
function getOwner(context) {
var owner;
let owner;

if (Ember.getOwner) {
owner = Ember.getOwner(context);
Expand All @@ -32,7 +32,7 @@ function getOwner(context) {
// `owner` is a container, we are just making this work
owner._lookupFactory = owner.lookupFactory;
owner.register = function() {
var registry = owner.registry || owner._registry || owner;
const registry = owner.registry || owner._registry || owner;

return registry.register(...arguments);
};
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/utils/parse-response-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import EmptyObject from 'ember-data/-private/system/empty-object';
const CLRF = '\u000d\u000a';

export default function parseResponseHeaders(headersString) {
let headers = new EmptyObject();
const headers = new EmptyObject();

if (!headersString) {
return headers;
Expand Down

0 comments on commit 334125d

Please sign in to comment.