From cb746f9ea2cfcc723a83a460bc73800a8fa070d1 Mon Sep 17 00:00:00 2001
From: Delaigue Olivier <olivier.delaigue@irstea.fr>
Date: Fri, 8 Jan 2021 15:21:42 +0100
Subject: [PATCH] v1.6.9.6 refactor: replace lapply by NextMethod to classicaly
 extract elements with '['.InputsModel and '['.OutputsModel Refs #67

---
 DESCRIPTION |  2 +-
 NEWS.md     |  2 +-
 R/Utils.R   | 12 ++++--------
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index e07fa3d9..e146d0e1 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.6.9.5
+Version: 1.6.9.6
 Date: 2021-01-08
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
diff --git a/NEWS.md b/NEWS.md
index e43b5023..0d1ef362 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,7 +2,7 @@
 
 
 
-### 1.6.9.5 Release Notes (2021-01-08)
+### 1.6.9.6 Release Notes (2021-01-08)
 
 #### New features
 
diff --git a/R/Utils.R b/R/Utils.R
index adf2d570..a6153a7a 100644
--- a/R/Utils.R
+++ b/R/Utils.R
@@ -113,12 +113,10 @@
     i <- as.character(i)
   }
   if (is.numeric(i)) {
-    res <- .ExtractInputsModel(x, i)
+    .ExtractInputsModel(x, i)
   } else {
-    res <- lapply(i, function(name) x[[name, exact = TRUE]])
-    names(res) <- i
+    NextMethod()
   }
-  return(res)
 }
 
 
@@ -161,10 +159,8 @@
     i <- as.character(i)
   }
   if (is.numeric(i)) {
-    res <- .ExtractOutputsModel(x, i)
+    .ExtractOutputsModel(x, i)
   } else {
-    res <- lapply(i, function(name) x[[name, exact = TRUE]])
-    names(res) <- i
+    NextMethod()
   }
-  return(res)
 }
-- 
GitLab