I don´t know if Unitful has a specific function for that. But you cannot “attach” the units to such array, because the array is of immutable values, and the unitful values are a different type of animal.
Thus, you can do, for example:
julia> x = [1,2,3,4,5];
julia> x .* 1u"km"
5-element Vector{Quantity{Int64, 𝐋, Unitful.FreeUnits{(km,), 𝐋, nothing}}}:
1 km
2 km
3 km
4 km
5 km
I’m not sure if there is a convert(...) type of function in Unitful for doing that with another syntax. But anyway you need to define a new variable.
(I think that if the purpose is to propagate units that are attached to some input variable, the most useful pattern is something like:
julia> a = 1u"km"
1 km
julia> x = [1,2];
julia> y = x .* oneunit(a)
2-element Vector{Quantity{Int64, 𝐋, Unitful.FreeUnits{(km,), 𝐋, nothing}}}:
1 km
2 km