Use Array<Foo> instead of Array.<Foo>

This commit is contained in:
Tim Schaub
2018-07-25 18:32:43 -07:00
parent 5a6502572f
commit d12ef20b12
184 changed files with 1194 additions and 1194 deletions

View File

@@ -14,12 +14,12 @@ import {extend} from './array.js';
/**
* @typedef {function(Node, Array.<*>)} Parser
* @typedef {function(Node, Array<*>)} Parser
*/
/**
* @typedef {function(Node, *, Array.<*>)} Serializer
* @typedef {function(Node, *, Array<*>)} Serializer
*/
@@ -66,9 +66,9 @@ export function getAllTextContent(node, normalizeWhitespace) {
* @param {Node} node Node.
* @param {boolean} normalizeWhitespace Normalize whitespace: remove all line
* breaks.
* @param {Array.<string>} accumulator Accumulator.
* @param {Array<string>} accumulator Accumulator.
* @private
* @return {Array.<string>} Accumulator.
* @return {Array<string>} Accumulator.
*/
export function getAllTextContent_(node, normalizeWhitespace, accumulator) {
if (node.nodeType == Node.CDATA_SECTION_NODE ||
@@ -131,7 +131,7 @@ export function parse(xml) {
/**
* Make an array extender function for extending the array at the top of the
* object stack.
* @param {function(this: T, Node, Array.<*>): (Array.<*>|undefined)} valueReader Value reader.
* @param {function(this: T, Node, Array<*>): (Array<*>|undefined)} valueReader Value reader.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {module:ol/xml~Parser} Parser.
* @template T
@@ -140,12 +140,12 @@ export function makeArrayExtender(valueReader, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function(node, objectStack) {
const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
if (value !== undefined) {
const array = /** @type {Array.<*>} */ (objectStack[objectStack.length - 1]);
const array = /** @type {Array<*>} */ (objectStack[objectStack.length - 1]);
extend(array, value);
}
}
@@ -156,7 +156,7 @@ export function makeArrayExtender(valueReader, opt_this) {
/**
* Make an array pusher function for pushing to the array at the top of the
* object stack.
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {function(this: T, Node, Array<*>): *} valueReader Value reader.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {module:ol/xml~Parser} Parser.
* @template T
@@ -165,12 +165,12 @@ export function makeArrayPusher(valueReader, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function(node, objectStack) {
const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
if (value !== undefined) {
const array = /** @type {Array.<*>} */ (objectStack[objectStack.length - 1]);
const array = /** @type {Array<*>} */ (objectStack[objectStack.length - 1]);
array.push(value);
}
});
@@ -180,7 +180,7 @@ export function makeArrayPusher(valueReader, opt_this) {
/**
* Make an object stack replacer function for replacing the object at the
* top of the stack.
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {function(this: T, Node, Array<*>): *} valueReader Value reader.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {module:ol/xml~Parser} Parser.
* @template T
@@ -189,7 +189,7 @@ export function makeReplacer(valueReader, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function(node, objectStack) {
const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
@@ -203,7 +203,7 @@ export function makeReplacer(valueReader, opt_this) {
/**
* Make an object property pusher function for adding a property to the
* object at the top of the stack.
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {function(this: T, Node, Array<*>): *} valueReader Value reader.
* @param {string=} opt_property Property.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {module:ol/xml~Parser} Parser.
@@ -213,7 +213,7 @@ export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function(node, objectStack) {
const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
@@ -234,7 +234,7 @@ export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) {
/**
* Make an object property setter function.
* @param {function(this: T, Node, Array.<*>): *} valueReader Value reader.
* @param {function(this: T, Node, Array<*>): *} valueReader Value reader.
* @param {string=} opt_property Property.
* @param {T=} opt_this The object to use as `this` in `valueReader`.
* @return {module:ol/xml~Parser} Parser.
@@ -244,7 +244,7 @@ export function makeObjectPropertySetter(valueReader, opt_property, opt_this) {
return (
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
*/
function(node, objectStack) {
const value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
@@ -261,7 +261,7 @@ export function makeObjectPropertySetter(valueReader, opt_property, opt_this) {
* Create a serializer that appends nodes written by its `nodeWriter` to its
* designated parent. The parent is the `node` of the
* {@link module:ol/xml~NodeStackItem} at the top of the `objectStack`.
* @param {function(this: T, Node, V, Array.<*>)} nodeWriter Node writer.
* @param {function(this: T, Node, V, Array<*>)} nodeWriter Node writer.
* @param {T=} opt_this The object to use as `this` in `nodeWriter`.
* @return {module:ol/xml~Serializer} Serializer.
* @template T, V
@@ -283,7 +283,7 @@ export function makeChildAppender(nodeWriter, opt_this) {
* designed to serialize a single item. An example would be a LineString
* geometry writer, which could be reused for writing MultiLineString
* geometries.
* @param {function(this: T, Node, V, Array.<*>)} nodeWriter Node writer.
* @param {function(this: T, Node, V, Array<*>)} nodeWriter Node writer.
* @param {T=} opt_this The object to use as `this` in `nodeWriter`.
* @return {module:ol/xml~Serializer} Serializer.
* @template T, V
@@ -314,14 +314,14 @@ export function makeArraySerializer(nodeWriter, opt_this) {
* @param {string=} opt_namespaceURI Fixed namespace URI which will be used for
* all created nodes. If not provided, the namespace of the parent node will
* be used.
* @return {function(*, Array.<*>, string=): (Node|undefined)} Node factory.
* @return {function(*, Array<*>, string=): (Node|undefined)} Node factory.
*/
export function makeSimpleNodeFactory(opt_nodeName, opt_namespaceURI) {
const fixedNodeName = opt_nodeName;
return (
/**
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node} Node.
*/
@@ -345,7 +345,7 @@ export function makeSimpleNodeFactory(opt_nodeName, opt_namespaceURI) {
* `nodeName` passed by {@link module:ol/xml~serialize} or
* {@link module:ol/xml~pushSerializeAndPop} to the node factory.
* @const
* @type {function(*, Array.<*>, string=): (Node|undefined)}
* @type {function(*, Array<*>, string=): (Node|undefined)}
*/
export const OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory();
@@ -356,8 +356,8 @@ export const OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory();
* `opt_key` argument.
* @param {Object.<string, V>} object Key-value pairs for the sequence. Keys can
* be a subset of the `orderedKeys`.
* @param {Array.<string>} orderedKeys Keys in the order of the sequence.
* @return {Array.<V>} Values in the order of the sequence. The resulting array
* @param {Array<string>} orderedKeys Keys in the order of the sequence.
* @return {Array<V>} Values in the order of the sequence. The resulting array
* has the same length as the `orderedKeys` array. Values that are not
* present in `object` will be `undefined` in the resulting array.
* @template V
@@ -376,7 +376,7 @@ export function makeSequence(object, orderedKeys) {
* Create a namespaced structure, using the same values for each namespace.
* This can be used as a starting point for versioned parsers, when only a few
* values are version specific.
* @param {Array.<string>} namespaceURIs Namespace URIs.
* @param {Array<string>} namespaceURIs Namespace URIs.
* @param {T} structure Structure.
* @param {Object.<string, T>=} opt_structureNS Namespaced structure to add to.
* @return {Object.<string, T>} Namespaced structure.
@@ -400,7 +400,7 @@ export function makeStructureNS(namespaceURIs, structure, opt_structureNS) {
* @param {Object.<string, Object.<string, module:ol/xml~Parser>>} parsersNS
* Parsers by namespace.
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {*=} opt_this The object to use as `this`.
*/
export function parseNode(parsersNS, node, objectStack, opt_this) {
@@ -423,7 +423,7 @@ export function parseNode(parsersNS, node, objectStack, opt_this) {
* @param {Object.<string, Object.<string, module:ol/xml~Parser>>} parsersNS
* Parsers by namespace.
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @param {Array<*>} objectStack Object stack.
* @param {*=} opt_this The object to use as `this`.
* @return {T} Object.
* @template T
@@ -439,16 +439,16 @@ export function pushParseAndPop(object, parsersNS, node, objectStack, opt_this)
* Walk through an array of `values` and call a serializer for each value.
* @param {Object.<string, Object.<string, module:ol/xml~Serializer>>} serializersNS
* Namespaced serializers.
* @param {function(this: T, *, Array.<*>, (string|undefined)): (Node|undefined)} nodeFactory
* @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory
* Node factory. The `nodeFactory` creates the node whose namespace and name
* will be used to choose a node writer from `serializersNS`. This
* separation allows us to decide what kind of node to create, depending on
* the value we want to serialize. An example for this would be different
* geometry writers based on the geometry type.
* @param {Array.<*>} values Values to serialize. An example would be an array
* @param {Array<*>} values Values to serialize. An example would be an array
* of {@link module:ol/Feature~Feature} instances.
* @param {Array.<*>} objectStack Node stack.
* @param {Array.<string>=} opt_keys Keys of the `values`. Will be passed to the
* @param {Array<*>} objectStack Node stack.
* @param {Array<string>=} opt_keys Keys of the `values`. Will be passed to the
* `nodeFactory`. This is used for serializing object literals where the
* node name relates to the property key. The array length of `opt_keys` has
* to match the length of `values`. For serializing a sequence, `opt_keys`
@@ -479,16 +479,16 @@ export function serialize(
* @param {O} object Object.
* @param {Object.<string, Object.<string, module:ol/xml~Serializer>>} serializersNS
* Namespaced serializers.
* @param {function(this: T, *, Array.<*>, (string|undefined)): (Node|undefined)} nodeFactory
* @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory
* Node factory. The `nodeFactory` creates the node whose namespace and name
* will be used to choose a node writer from `serializersNS`. This
* separation allows us to decide what kind of node to create, depending on
* the value we want to serialize. An example for this would be different
* geometry writers based on the geometry type.
* @param {Array.<*>} values Values to serialize. An example would be an array
* @param {Array<*>} values Values to serialize. An example would be an array
* of {@link module:ol/Feature~Feature} instances.
* @param {Array.<*>} objectStack Node stack.
* @param {Array.<string>=} opt_keys Keys of the `values`. Will be passed to the
* @param {Array<*>} objectStack Node stack.
* @param {Array<string>=} opt_keys Keys of the `values`. Will be passed to the
* `nodeFactory`. This is used for serializing object literals where the
* node name relates to the property key. The array length of `opt_keys` has
* to match the length of `values`. For serializing a sequence, `opt_keys`