Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

Commit

Permalink
fix: Close #112
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsuya Nakano committed Jan 4, 2017
1 parent cdf0044 commit 800f2cc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"mocha": "^3.1.2",
"npm-run-all": "^3.1.1",
"object-assign": "^4.1.0",
"object.values": "^1.0.4",
"postcss-loader": "^1.2.1",
"postcss-nesting": "^2.3.1",
"raw-loader": "^0.5.1",
Expand Down
5 changes: 3 additions & 2 deletions src/common/util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import objectAssign from 'object-assign';
import objectValues from 'object.values';
import ChromeStorage from './chrome-storage';

export default class Util {
Expand All @@ -25,12 +26,12 @@ export default class Util {
}

static removeOldHistories(histories, maxSize = 1000) {
const sortedHistories = Object.values(histories).sort((itemA, itemB) => (itemA.date < itemB.date) ? 1 : -1);
const sortedHistories = objectValues(histories).sort((itemA, itemB) => (itemA.date < itemB.date) ? 1 : -1);
if (sortedHistories.length < maxSize) {
return histories;
}

const items = Object.values(histories).sort((itemA, itemB) => (itemA.date > itemB.date) ? 1 : -1);
const items = objectValues(histories).sort((itemA, itemB) => (itemA.date > itemB.date) ? 1 : -1);

const removeSize = sortedHistories.length - maxSize;

Expand Down
3 changes: 2 additions & 1 deletion src/components/settings/histories.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import objectValues from 'object.values';
import Vue from 'vue';
import Util from '../../common/util';

Expand Down Expand Up @@ -32,7 +33,7 @@ export default function (histories) {
</mdl-dialog>
</section>`,
data: () => {
const items = Object.values(histories).sort((itemA, itemB) => (itemA.date < itemB.date) ? 1 : -1);
const items = objectValues(histories).sort((itemA, itemB) => (itemA.date < itemB.date) ? 1 : -1);
const search = '';
return {
items,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import objectValues from 'object.values';
import Util from '../../common/util';
import PopularItemsDomHandler from './popular-items-dom-handler.js';

Expand All @@ -6,7 +7,7 @@ export default class MuteAlreadyReadArticleContent {

run() {
Util.getHistories(historiesObj => {
const histories = Object.values(historiesObj);
const histories = objectValues(historiesObj);
const handler = new PopularItemsDomHandler();

handler.getArticles().forEach(article => {
Expand Down

0 comments on commit 800f2cc

Please sign in to comment.