UNPKG
expeditaet
Version:
latest (1.2.0)
1.2.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.2
1.0.1
1.0.0
Advent of Code Solutions
github.com/MariannaBoyle/expeditaet.git
MariannaBoyle/expeditaet
expeditaet
/
solutions
/
typescript
/
2022
/
03
/
src
/
split-rucksack-into-compartments.function.ts
5 lines
(4 loc)
•
218 B
text/typescript
View Raw
1
2
3
4
5
export
const
splitRucksackIntoCompartments = (
rucksack
:
string
):
readonly
[
string
,
string
] => {
const
middle =
Math
.
floor
(rucksack.
length
/
2
);
return
[rucksack.
slice
(
0
, middle), rucksack.
slice
(middle)]
as
const
; };