From d77fc13592c8d147a38b861429e1c2418d900825 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 8 Sep 2019 07:40:07 -0500 Subject: [PATCH] feat: Collection::createClone --- packages/behavior/item/collection.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/behavior/item/collection.js b/packages/behavior/item/collection.js index 401ce41..4b491cf 100644 --- a/packages/behavior/item/collection.js +++ b/packages/behavior/item/collection.js @@ -23,6 +23,13 @@ export function Collection(type) { } } + createClone() { + const Items = this.constructor; + const items = new Items(); + items.clone(this); + return items; + } + count() { return this[plural].length; }