This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git


The following commit(s) were added to refs/heads/master by this push:
     new c14c8c6  Tweaks to cartesian rewrite
c14c8c6 is described below

commit c14c8c6dbd2a208a137f8a6e918e0443866161ce
Author: Gerben <[email protected]>
AuthorDate: Thu Oct 8 16:21:39 2020 +0200

    Tweaks to cartesian rewrite
    
    - remove type declaration of dropped dependency
    - tiny code simplifications
---
 packages/dom/src/range/cartesian.ts   |  4 ++--
 packages/dom/src/types/cartesian.d.ts | 25 -------------------------
 2 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/packages/dom/src/range/cartesian.ts 
b/packages/dom/src/range/cartesian.ts
index 8c60cde..37e9876 100644
--- a/packages/dom/src/range/cartesian.ts
+++ b/packages/dom/src/range/cartesian.ts
@@ -33,7 +33,7 @@ export async function* cartesian<T>(
       for await (const value of iterable) {
         yield { index, value };
       }
-      return { index, value: undefined };
+      return { index };
     };
     return generator();
   });
@@ -76,7 +76,7 @@ export async function* cartesian<T>(
 
     // Synchronously compute and yield tuples of the partial product.
     yield* scratch.reduce(
-      (a, b) => a.flatMap((v) => Array.from(b).map((w) => [...v, w])),
+      (a, b) => a.flatMap((v) => b.map((w) => [...v, w])),
       [[]] as T[][],
     );
   }
diff --git a/packages/dom/src/types/cartesian.d.ts 
b/packages/dom/src/types/cartesian.d.ts
deleted file mode 100644
index 9578e84..0000000
--- a/packages/dom/src/types/cartesian.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @license
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-declare module 'cartesian' {
-  export default function cartesian<T>(
-    list: Array<Array<T>> | { [k: string]: Array<T> },
-  ): Array<Array<T>>;
-}

Reply via email to