1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-20 06:56:40 +02:00
keeweb/app/scripts/collections/file-collection.js
2019-08-18 10:17:09 +02:00

25 lines
572 B
JavaScript

const Backbone = require('backbone');
const FileModel = require('../models/file-model');
const FileCollection = Backbone.Collection.extend({
model: FileModel,
hasOpenFiles() {
return this.some(file => file.get('open'));
},
hasUnsavedFiles() {
return this.some(file => file.get('modified'));
},
hasDirtyFiles() {
return this.some(file => file.get('dirty'));
},
getByName(name) {
return this.find(file => file.get('name').toLowerCase() === name.toLowerCase());
}
});
module.exports = FileCollection;