first commit
This commit is contained in:
30
node_modules/lit-html/development/directives/map.js
generated
vendored
Normal file
30
node_modules/lit-html/development/directives/map.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
/**
|
||||
* Returns an iterable containing the result of calling `f(value)` on each
|
||||
* value in `items`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* render() {
|
||||
* return html`
|
||||
* <ul>
|
||||
* ${map(items, (i) => html`<li>${i}</li>`)}
|
||||
* </ul>
|
||||
* `;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export function* map(items, f) {
|
||||
if (items !== undefined) {
|
||||
let i = 0;
|
||||
for (const value of items) {
|
||||
yield f(value, i++);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=map.js.map
|
Reference in New Issue
Block a user