-
Notifications
You must be signed in to change notification settings - Fork 1
vitals.fill
Adam Smith edited this page Feb 19, 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 defined it is considered an array of keys that will limit the fill action. If a string is defined it is converted to an array using one of the values in the following list for the separator (values 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 defined it is considered an array of keys that will limit the fill action. If a string is defined it is converted to an array using one of the values in the following list for the separator (values 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,