UNPKG
photocopy
Version:
latest (3.2.5)
3.2.5
3.2.4
3.2.3
3.2.2
3.2.1
3.1.0
3.0.0
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.2
2.0.1
2.0.0
1.0.1
1.0.0
0.0.0
Iterate anything and return a modified copy.
github.com/nrn/photocopy
nrn/photocopy
photocopy
/
x
/
slice
/
index.js
11 lines
(9 loc)
•
291 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
var pc = require
(
'../../index'
)
module.exports = slice function slice
(
collection,
start
,
end
, seed
)
{
start
||
(
start
=
0
)
if
(
typeof
end
=== 'number'
)
{
return
pc
(
collection, pc.comp
(
pc.skip
(
start
)
, pc.take
(
end
-
start
))
, seed
)
}
return
pc
(
collection, pc.skip
(
start
)
, seed
)
}