Files
playlet-piped/playlet-lib/src/source/utils/ArrayUtils.bs
T
Brahim Hadricheandgithub-action linter 394dd23999 Multiple profiles (#312)
* Navbar user profile

* profiles stuff

* fix profile

* Lint fix

* Some ui experiments

* More ui work

* progress

* Lint fix

* migration, web api, wip

* profile view and web app

* web app and apis

* Invidious and profiles

* Lint fix

* bug fix

* Remove ActionContentNode

* Profile icon button, profile color

* Lint fix

* reset server url

* href that doesn't work

* remove activate button on active profile

* TODO

* Fin.

* Final touches

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-03-04 09:04:34 -05:00

43 lines
1.0 KiB
Plaintext

import "pkg:/source/utils/Types.bs"
namespace ArrayUtils
function IndexOfString(array as object, value as dynamic) as integer
if not IsString(value)
return -1
end if
for i = 0 to array.Count() - 1
if array[i] = value
return i
end if
end for
return -1
end function
function IndexOfNode(array as object, value as dynamic) as integer
if not IsNode(value)
return -1
end if
for i = 0 to array.Count() - 1
if value.isSameNode(array[i])
return i
end if
end for
return -1
end function
function Insert(array as object, value as dynamic, index as integer) as void
if index = 0
array.Unshift(value)
return
end if
if index < array.Count()
for i = array.Count() - 1 to index step -1
array[i + 1] = array[i]
end for
end if
array[index] = value
end function
end namespace