DeleteN is the same as Delete, but can delete many tokens at once. If there aren't N tokens available to delete, none are deleted.
(amount int)
| 463 | // DeleteN is the same as Delete, but can delete many tokens at once. |
| 464 | // If there aren't N tokens available to delete, none are deleted. |
| 465 | func (d *Dispenser) DeleteN(amount int) []Token { |
| 466 | if amount > 0 && d.cursor >= (amount-1) && d.cursor <= len(d.tokens)-1 { |
| 467 | d.tokens = append(d.tokens[:d.cursor-(amount-1)], d.tokens[d.cursor+1:]...) |
| 468 | d.cursor -= amount |
| 469 | } |
| 470 | return d.tokens |
| 471 | } |
| 472 | |
| 473 | // SetContext sets a key-value pair in the context map. |
| 474 | func (d *Dispenser) SetContext(key string, value any) { |
no outgoing calls
no test coverage detected