polymer-bundler
Version:
Process Web Components into one output file
48 lines (47 loc) • 2.16 kB
TypeScript
/**
* @license
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
/**
* Simple utility function used to find an item in a set with a predicate
* function. Analagous to Array.find(), without requiring converting the set
* an Array.
*/
export declare function find<T>(items: Iterable<T>, predicate: (item: T) => boolean): T | undefined;
/**
* Converts string like `abc-xyz__omg` to `abcXyzOmg`.
*/
export declare function camelCase(text: string): string;
/**
* Returns a set of unique/distinct values returned by calling the given
* function on each item.
*/
export declare function uniq<T, R>(items: Iterable<T>, map: (item: T) => R): Set<R>;
/**
* Returns a map of arrays of items, with keys generated by the keygen function.
*/
export declare function partitionMap<K, V>(items: Iterable<V>, keygen: (item: V) => K): Map<K, V[]>;
/**
* Performs an in-place rewrite of a target object's properties from a given
* replacement node. This is useful because there are some transformations
* of ASTs which simply require replacing a node, but it is not always
* convenient to obtain the specific parent node property to which a node may be
* attached out of many possible configurations.
*/
export declare function rewriteObject(target: Object, replacement: Object): void;
/**
* Generate a valid identifier name which is unique (i.e. does not appear
* anywhere in the source text provided). Do this by trying the provided
* `value` and then successively trying the value with an incrementing suffix
* counter until one is found that appears nowhere in the source.
*/
export declare function generateUniqueIdentifierName(value: string, source: string): string;