about summary refs log tree commit diff
path: root/users/wpcarro/slx.js
diff options
context:
space:
mode:
Diffstat (limited to 'users/wpcarro/slx.js')
-rw-r--r--users/wpcarro/slx.js/index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/users/wpcarro/slx.js/index.js b/users/wpcarro/slx.js/index.js
index 0f980c8d5a97..8f6eff3c43bd 100644
--- a/users/wpcarro/slx.js/index.js
+++ b/users/wpcarro/slx.js/index.js
@@ -1,4 +1,9 @@
 function select(query, xs, config) {
+    // naive optimizations
+    if (query === '' || xs === []) {
+        return xs;
+    }
+
     const predicate = compile(parse(query, config), config);
     return xs.filter(predicate);
 }