From e45843c71c73511ba0f499053184883ddc28f990 Mon Sep 17 00:00:00 2001 From: Morgan Harris Date: Wed, 24 Nov 2021 11:35:39 +1100 Subject: Allow access to original Array.prototype methods on List prefixed with $ --- src/types/List.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/types/List.js b/src/types/List.js index 197a155..97536ed 100644 --- a/src/types/List.js +++ b/src/types/List.js @@ -47,6 +47,11 @@ List.extend = function (methods) { // Don't add private methods if (name[0] === '_') return obj + // Allow access to original Array methods through a prefix + if (name in Array.prototype) { + obj['$' + name] = Array.prototype[name] + } + // Relay every call to each() obj[name] = function (...attrs) { return this.each(name, ...attrs) -- cgit v1.2.3