Skip to content

Commit

Permalink
Remove "ember-lodash" dependency (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 authored and marcoow committed Jun 20, 2016
1 parent e4b7cec commit f0f8bd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
12 changes: 5 additions & 7 deletions addon/services/cookies.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Ember from 'ember';
import getOwner from 'ember-getowner-polyfill';
import _object from 'lodash/object';
import _collection from 'lodash/collection';

const {
computed,
Expand All @@ -28,7 +26,7 @@ export default Ember.Service.extend({
_documentCookies: computed(function() {
let all = this.get('_document.cookie').split(';');

return _collection.reduce(all, (acc, cookie) => {
return all.reduce((acc, cookie) => {
if (!isEmpty(cookie)) {
let [key, value] = cookie.split('=');
acc[key.trim()] = value.trim();
Expand Down Expand Up @@ -59,7 +57,7 @@ export default Ember.Service.extend({
if (name) {
return this._decodeValue(all[name]);
} else {
return _collection.map(all, (value) => this._decodeValue(value));
return all.map((value) => this._decodeValue(value));
}
},

Expand Down Expand Up @@ -100,7 +98,7 @@ export default Ember.Service.extend({

_cacheFastBootCookie(name, value, options = {}) {
let fastBootCache = this.getWithDefault('_fastBootCookiesCache', {});
let cachedOptions = _object.assign({}, options);
let cachedOptions = Ember.merge({}, options);

if (cachedOptions.maxAge) {
let expires = new Date();
Expand All @@ -116,8 +114,8 @@ export default Ember.Service.extend({
_filterCachedFastBootCookies(fastBootCookiesCache) {
let { hostname, path: requestPath, protocol } = this.get('_fastBoot.request');

return _collection.reduce(fastBootCookiesCache, (acc, cookie, name) => {
let { value, options } = cookie;
return Object.keys(fastBootCookiesCache).reduce((acc, name) => {
let { value, options } = fastBootCookiesCache[name];
options = options || {};

let { path: optionsPath, domain, expires, secure } = options;
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
],
"dependencies": {
"ember-cli-babel": "^5.1.6",
"ember-getowner-polyfill": "~1.0.1",
"ember-lodash": "0.0.6"
"ember-getowner-polyfill": "~1.0.1"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down

0 comments on commit f0f8bd9

Please sign in to comment.