Puppet Function: simplib::knockout
- Defined in:
- functions/knockout.pp
- Function type:
- Puppet Language
Overview
uses the knockout prefix of ‘–’ to remove elements from an array.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'functions/knockout.pp', line 15
function simplib::knockout(Array $array) {
$included = $array.filter |$data| {
$data !~ /^--/
}
$excluded_filter = $array.filter |$data| {
$data =~ /^--/
}
$excluded = $excluded_filter.map |$data| {
delete($data, '--')
}
($included - $excluded)
}
|