Skip to content

Commit 03c907f

Browse files
committed
Simplify lambda functions throughout the library where possible
1 parent c2e8ea3 commit 03c907f

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

influxdb-client/InfluxDB.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@
113113

114114
% Execute other queries or commands
115115
function result = runCommand(obj, command, varargin)
116-
idx = find(cellfun(@(x) ischar(x), varargin), 1, 'first');
116+
idx = find(cellfun(@ischar, varargin), 1, 'first');
117117
database = iif(isempty(idx), '', varargin{idx});
118-
idx = find(cellfun(@(x) islogical(x), varargin), 1, 'first');
118+
idx = find(cellfun(@islogical, varargin), 1, 'first');
119119
requiresPost = iif(isempty(idx), false, varargin{idx});
120120
if isempty(database)
121121
params = {'q', command};

influxdb-client/QueryBuilder.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
% Append where clause
259259
function query = appendWhereTo(obj, query)
260260
clauses = [obj.Tags, {obj.Before, obj.After, obj.Where}];
261-
ispresent = cellfun(@(x) ~isempty(x), clauses);
261+
ispresent = ~cellfun(@isempty, clauses);
262262
condition = strjoin(clauses(ispresent), ' AND ');
263263
if ~isempty(condition)
264264
query = [query ' WHERE ' condition];

influxdb-client/QueryResult.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
'from:empty', 'the response contains no results');
5656
objs = arrayfun(@(x) QueryResult.wrap(x, epoch), ...
5757
response.results, 'UniformOutput', false);
58-
nonempty = cellfun(@(x) ~isempty(x), objs);
58+
nonempty = ~cellfun(@isempty, objs);
5959
objs = cellfun(@(x) x, objs(nonempty));
6060
end
6161
end

influxdb-client/SeriesResult.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@
146146
for i = C:-1:1
147147
field = fields{i};
148148
column = celled(:, i);
149-
if all(cellfun(@(x) isnumeric(x), column))
149+
if all(cellfun(@isnumeric, column))
150150
% Convert to a numeric array
151151
for j = 1:N
152152
if isempty(column{j})
153153
column{j} = NaN;
154154
end
155155
end
156156
value = cell2mat(column);
157-
elseif any(cellfun(@(x) islogical(x), column))
157+
elseif any(cellfun(@islogical, column))
158158
% Convert to a logical array
159159
value = zeros(N, 1);
160160
for j = 1:N

influxdb-client/WriteBuilder.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
else
5454
f = @(x) x.toLine(obj.Precision);
5555
items = cellfun(f, obj.Items, 'UniformOutput', false);
56-
nonempty = cellfun(@(x) ~isempty(x), items);
56+
nonempty = ~cellfun(@isempty, items);
5757
lines = strjoin(items(nonempty), newline);
5858
end
5959
end

0 commit comments

Comments
 (0)