Skip to content

Commit fbaf21a

Browse files
committed
chore: format
1 parent f5da7e3 commit fbaf21a

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

lua/elixir/iter/init.lua

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@
292292
-- license for previous Vim releases instead of the license that they came
293293
-- with, at your option.
294294

295-
296295
---@defgroup vim.iter
297296
---
298297
--- This module provides a generic interface for working with
@@ -381,22 +380,22 @@ end
381380
local packedmt = {}
382381

383382
local function unpack(t)
384-
if type(t) == 'table' and getmetatable(t) == packedmt then
383+
if type(t) == "table" and getmetatable(t) == packedmt then
385384
return _G.unpack(t, 1, t.n)
386385
end
387386
return t
388387
end
389388

390389
local function pack(...)
391-
local n = select('#', ...)
390+
local n = select("#", ...)
392391
if n > 1 then
393392
return setmetatable({ n = n, ... }, packedmt)
394393
end
395394
return ...
396395
end
397396

398397
local function sanitize(t)
399-
if type(t) == 'table' and getmetatable(t) == packedmt then
398+
if type(t) == "table" and getmetatable(t) == packedmt then
400399
-- Remove length tag
401400
t.n = nil
402401
end
@@ -413,7 +412,7 @@ end
413412
---@return boolean True if the iterator stage should continue, false otherwise
414413
---@return any Function arguments.
415414
local function continue(...)
416-
if select('#', ...) > 0 then
415+
if select("#", ...) > 0 then
417416
return false, ...
418417
end
419418
return true
@@ -429,7 +428,7 @@ end
429428
---@return boolean True if the iterator pipeline should continue, false otherwise
430429
---@return any Return values of f
431430
local function apply(f, ...)
432-
if select('#', ...) > 0 then
431+
if select("#", ...) > 0 then
433432
return continue(f(...))
434433
end
435434
return false
@@ -560,7 +559,7 @@ end
560559
--- in the pipeline as arguments.
561560
function Iter.each(self, f)
562561
local function fn(...)
563-
if select('#', ...) > 0 then
562+
if select("#", ...) > 0 then
564563
f(...)
565564
return true
566565
end
@@ -739,7 +738,7 @@ end
739738
---
740739
---@return Iter
741740
function Iter.rev(self)
742-
error('rev() requires a list-like table')
741+
error("rev() requires a list-like table")
743742
return self
744743
end
745744

@@ -769,7 +768,7 @@ end
769768
---
770769
---@return any
771770
function Iter.peek(self) -- luacheck: no unused args
772-
error('peek() requires a list-like table')
771+
error("peek() requires a list-like table")
773772
end
774773

775774
---@private
@@ -802,7 +801,7 @@ end
802801
---
803802
---@return any
804803
function Iter.find(self, f)
805-
if type(f) ~= 'function' then
804+
if type(f) ~= "function" then
806805
local val = f
807806
f = function(v)
808807
return v == val
@@ -848,12 +847,12 @@ end
848847
---
849848
---@return any
850849
function Iter.rfind(self, f) -- luacheck: no unused args
851-
error('rfind() requires a list-like table')
850+
error("rfind() requires a list-like table")
852851
end
853852

854853
---@private
855854
function ListIter.rfind(self, f) -- luacheck: no unused args
856-
if type(f) ~= 'function' then
855+
if type(f) ~= "function" then
857856
local val = f
858857
f = function(v)
859858
return v == val
@@ -886,7 +885,7 @@ end
886885
---
887886
---@return any
888887
function Iter.nextback(self) -- luacheck: no unused args
889-
error('nextback() requires a list-like table')
888+
error("nextback() requires a list-like table")
890889
end
891890

892891
function ListIter.nextback(self)
@@ -914,7 +913,7 @@ end
914913
---
915914
---@return any
916915
function Iter.peekback(self) -- luacheck: no unused args
917-
error('peekback() requires a list-like table')
916+
error("peekback() requires a list-like table")
918917
end
919918

920919
function ListIter.peekback(self)
@@ -970,7 +969,7 @@ end
970969
---@param n number Number of values to skip.
971970
---@return Iter
972971
function Iter.skipback(self, n) -- luacheck: no unused args
973-
error('skipback() requires a list-like table')
972+
error("skipback() requires a list-like table")
974973
return self
975974
end
976975

@@ -1181,9 +1180,9 @@ end
11811180
---@private
11821181
function Iter.new(src, ...)
11831182
local it = {}
1184-
if type(src) == 'table' then
1183+
if type(src) == "table" then
11851184
local mt = getmetatable(src)
1186-
if mt and type(mt.__call) == 'function' then
1185+
if mt and type(mt.__call) == "function" then
11871186
---@private
11881187
function it.next()
11891188
return src()
@@ -1209,7 +1208,7 @@ function Iter.new(src, ...)
12091208
return ListIter.new(t)
12101209
end
12111210

1212-
if type(src) == 'function' then
1211+
if type(src) == "function" then
12131212
local s, var = ...
12141213

12151214
--- Use a closure to handle var args returned from iterator
@@ -1227,7 +1226,7 @@ function Iter.new(src, ...)
12271226

12281227
setmetatable(it, Iter)
12291228
else
1230-
error('src must be a table or function')
1229+
error("src must be a table or function")
12311230
end
12321231
return it
12331232
end
@@ -1301,4 +1300,3 @@ return setmetatable(M, {
13011300
return Iter.new(...)
13021301
end,
13031302
})
1304-

0 commit comments

Comments
 (0)