-
Notifications
You must be signed in to change notification settings - Fork 1
vitals.fill
Adam Smith edited this page Feb 16, 2016
·
10 revisions
Method | Section | Alias |
---|---|---|
fill | base | |
fill.object | base | fill.obj |
fill.array | base | fill.arr |
fill.string | base | fill.str |
Fills an array, object, or string with specified values.
Params
-
source
?(Array|Object|function|number)
If source is a number returns a new string filled with the value x times.
-
keys
(!Array|string)=
Only use with an object/function source. If provided it is converted to an array of keys to limit the object fill to. The chars in the following list can be used as the separator for keys in a keys string (chars listed in order of rank): ` ", " "," "|" " " `
-
val
*
The value to fill the array, object, or string with.
-
start
number=
default value: ` 0 `
Only for use with source arrays.
-
end
number=
default value: ` source.length `
Only for use with source arrays.
Returns ?(Array|Object|function|string)
Fills an existing object/function with specified keys and values.
Params
-
obj
!(Object|function)
-
keys
(!Array|string)=
If provided it is converted to an array of keys to limit the object fill to. The chars in the following list can be used as the separator for keys in a keys string (chars listed in order of rank): ` ", " "," "|" " " `
-
val
*
Returns !(Object|function)
Fills an existing or new array with specified values.
Params
-
arr
!(Array|number)
If number makes new array with arr length.
-
val
*
-
start
number=
default value: ` 0 `
-
end
number=
default value: ` arr.length `
Returns !Array
Fills a new string with specified values.
Params
-
count
number
-
val
*
All val types are converted to string via `String(val)`.
Returns string
-- Happy Developing,